@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,500;0,600;0,700;1,600&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/*
 * Soul and Psyche — Admin Control Center
 * Unified @brand Design System (Derived from Academy Tokens)
 */

:root {
    /* Surfaces — Ivory Atelier */
    --surface-canvas: #F7F3E9;
    --surface-raised: #FFFDF7;
    --surface-sunken: #EFE9D9;
    --surface-overlay: rgba(255, 253, 247, 0.85);

    /* Ink / Typography */
    --ink-strong: #1C3A5B;
    --ink: #3D4C5C;
    --ink-muted: #5F6E7C;
    --ink-faint: #8A96A2;
    --ink-inverse: #FFFDF7;

    /* Brand Accents — Botanical Sage & Royal Gold */
    --brand: #2D5A43;
    --brand-strong: #1D4330;
    --brand-soft: rgba(45, 90, 67, 0.10);
    --brand-ink: #FFFDF7;

    --brand-gold: #C5A059;
    --brand-gold-hi: #E2C167;
    --brand-gold-deep: #8A6A12;
    --brand-gold-soft: rgba(197, 160, 89, 0.14);
    --brand-gold-glow: rgba(201, 162, 39, 0.28);

    --brand-sage: #2D5A43;
    --brand-sage-light: #3F7257;
    --brand-sage-glow: rgba(45, 90, 67, 0.22);
    --brand-navy: #1C3A5B;

    --gold-grad: linear-gradient(135deg, #E2C167 0%, #C9A227 46%, #8A6A12 100%);
    --sage-grad: linear-gradient(135deg, #3F7257 0%, #2D5A43 100%);

    /* Status */
    --success: #2D5A43;
    --success-soft: rgba(45, 90, 67, 0.12);
    --warning: #C5A059;
    --warning-soft: rgba(197, 160, 89, 0.14);
    --danger: #B14A44;
    --danger-soft: rgba(177, 74, 68, 0.12);
    --info: #1C3A5B;
    --info-soft: rgba(28, 58, 91, 0.10);

    /* Lines and depth */
    --line: rgba(28, 58, 91, 0.12);
    --line-strong: rgba(28, 58, 91, 0.22);
    --line-gold: rgba(201, 162, 39, 0.35);
    --shadow-sm: 0 1px 3px rgba(28, 58, 91, 0.06);
    --shadow: 0 6px 20px -4px rgba(28, 58, 91, 0.12), 0 2px 6px -2px rgba(28, 58, 91, 0.05);
    --shadow-lg: 0 20px 40px -12px rgba(28, 58, 91, 0.20), 0 0 0 1px rgba(28, 58, 91, 0.08);

    /* Typography families */
    --font-heading: 'Playfair Display', Georgia, serif;
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;

    /* Geometry */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --radius-pill: 999px;
    --sidebar-width: 260px;
    --topbar-height: 68px;

    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

:root[data-theme="dark"] {
    /* Surfaces — Obsidian Observatory */
    --surface-canvas: #08182A;
    --surface-raised: #0C1B2C;
    --surface-sunken: #061220;
    --surface-overlay: rgba(12, 27, 44, 0.85);

    /* Ink / Typography */
    --ink-strong: #FFFDF7;
    --ink: #CBD5E1;
    --ink-muted: #7C8AA1;
    --ink-faint: #4B5563;
    --ink-inverse: #0C1B2C;

    /* Brand Accents */
    --brand: #8FA87C;
    --brand-strong: #B0C79E;
    --brand-soft: rgba(143, 168, 124, 0.15);
    --brand-ink: #0C1B2C;

    --brand-gold: #D9B449;
    --brand-gold-hi: #EFD79A;
    --brand-gold-deep: #A8811C;
    --brand-gold-soft: rgba(217, 180, 73, 0.15);
    --brand-gold-glow: rgba(217, 180, 73, 0.32);

    --brand-sage: #8FA87C;
    --brand-sage-light: #B0C79E;
    --brand-sage-glow: rgba(143, 168, 124, 0.26);
    --brand-navy: #1C3A5B;

    --gold-grad: linear-gradient(135deg, #EFD79A 0%, #D9B449 46%, #A8811C 100%);
    --sage-grad: linear-gradient(135deg, #B0C79E 0%, #8FA87C 100%);

    /* Status */
    --success: #8FA87C;
    --success-soft: rgba(143, 168, 124, 0.16);
    --warning: #D9B449;
    --warning-soft: rgba(217, 180, 73, 0.16);
    --danger: #F87171;
    --danger-soft: rgba(248, 113, 113, 0.16);
    --info: #60A5FA;
    --info-soft: rgba(96, 165, 250, 0.16);

    /* Lines and depth */
    --line: rgba(242, 240, 230, 0.10);
    --line-strong: rgba(242, 240, 230, 0.18);
    --line-gold: rgba(217, 180, 73, 0.35);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow: 0 6px 20px -4px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(242, 240, 230, 0.08);
    --shadow-lg: 0 20px 40px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(217, 180, 73, 0.18);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    background: var(--surface-canvas);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

h1, h2, h3, h4 {
    color: var(--ink-strong);
    margin: 0;
    font-weight: 650;
    letter-spacing: -0.015em;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-strong); }

/* ---------------------------------------------------------------- Shell */

.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--surface-raised);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    transition: transform 0.24s var(--ease);
}

.sidebar__brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 20px;
    border-bottom: 1px solid var(--line);
}

.sidebar__mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--brand), var(--brand-strong));
    color: var(--brand-ink);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.sidebar__name { font-weight: 650; color: var(--ink-strong); font-size: 14px; }
.sidebar__tag { font-size: 11px; color: var(--ink-faint); }

.sidebar__nav { padding: 14px 12px; overflow-y: auto; flex: 1; }

.nav__section {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--ink-faint);
    padding: 14px 10px 6px;
    font-weight: 650;
}

.nav__link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 11px;
    border-radius: var(--radius-sm);
    color: var(--ink-muted);
    font-weight: 500;
    margin-bottom: 2px;
    transition: background-color 0.15s var(--ease), color 0.15s var(--ease), transform 0.15s var(--ease);
}

.nav__link:hover {
    background: var(--surface-sunken);
    color: var(--ink-strong);
    transform: translateX(2px);
}

.nav__link--active {
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 600;
}

.nav__link svg { width: 17px; height: 17px; flex-shrink: 0; }

.nav__badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    border-radius: 999px;
    padding: 1px 7px;
    font-size: 10px;
    font-weight: 700;
}

/* ---------------------------------------------------------------- Main */

.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-height);
    background: var(--surface-overlay);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 30;
}

.topbar__title { font-size: 16px; font-weight: 650; color: var(--ink-strong); }
.topbar__spacer { flex: 1; }

.icon-button {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--surface-raised);
    color: var(--ink-muted);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.15s var(--ease);
}

.icon-button:hover {
    color: var(--ink-strong);
    border-color: var(--line-strong);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.icon-button svg { width: 17px; height: 17px; }

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-strong));
    color: var(--brand-ink);
    display: grid;
    place-items: center;
    font-weight: 650;
    font-size: 12px;
}

.content { padding: 24px; flex: 1; }

.page-head {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.page-head__title { 
    font-family: var(--font-heading); 
    font-size: 24px; 
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink-strong);
}
.page-head__sub { color: var(--ink-muted); font-size: 13px; margin-top: 3px; }
.page-head__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- Cards */

.card {
    background: var(--surface-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.card__head {
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 12px;
}

.card__title { 
    font-family: var(--font-sans);
    font-size: 14px; 
    font-weight: 650; 
    color: var(--ink-strong); 
}
.card__body { padding: 18px; }

.grid { display: grid; gap: 16px; }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid--halves { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

/* ---------------------------------------------------------------- Stats */

.stat {
    background: var(--surface-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 17px 18px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.stat:hover { transform: translateY(-5px); box-shadow: var(--shadow); }

.stat__top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }

.stat__icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: var(--brand-soft);
    color: var(--brand);
}

.stat__icon svg { width: 17px; height: 17px; }
.stat__icon--success { background: var(--success-soft); color: var(--success); }
.stat__icon--warning { background: var(--warning-soft); color: var(--warning); }
.stat__icon--danger { background: var(--danger-soft); color: var(--danger); }
.stat__icon--info { background: var(--info-soft); color: var(--info); }

.stat__label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ink-faint);
    font-weight: 650;
}

.stat__value {
    font-size: 25px;
    font-weight: 700;
    color: var(--ink-strong);
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.stat__foot { font-size: 12px; color: var(--ink-muted); margin-top: 5px; }

/* ---------------------------------------------------------------- Tables */

.table-wrap { overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 640px;
}

table.data th {
    text-align: left;
    padding: 11px 14px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ink-faint);
    font-weight: 650;
    border-bottom: 1px solid var(--line);
    background: var(--surface-sunken);
    white-space: nowrap;
}

table.data td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    vertical-align: middle;
}

table.data tbody tr { transition: background-color 0.12s var(--ease); }
table.data tbody tr:hover { background: var(--surface-sunken); }
table.data tbody tr:last-child td { border-bottom: none; }

.cell-strong { color: var(--ink-strong); font-weight: 600; }
.cell-muted { color: var(--ink-muted); font-size: 12px; }
.cell-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* ---------------------------------------------------------------- Badges */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 650;
    white-space: nowrap;
}

.badge::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-info    { background: var(--info-soft);    color: var(--info); }
.badge-neutral { background: var(--surface-sunken); color: var(--ink-muted); }

/* ---------------------------------------------------------------- Forms */

.field { margin-bottom: 16px; }

.field__label {
    display: block;
    font-size: 12px;
    font-weight: 650;
    color: var(--ink-strong);
    margin-bottom: 5px;
}

.field__hint { font-size: 12px; color: var(--ink-muted); margin-top: 5px; }
.field__error { font-size: 12px; color: var(--danger); margin-top: 5px; font-weight: 500; }

.input, .select, .textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-raised);
    color: var(--ink-strong);
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.input::placeholder { color: var(--ink-faint); }
.textarea { min-height: 90px; resize: vertical; }

/*
 * Chrome paints its own background on autofilled fields and ignores the
 * background property, so a saved password renders as a white box on a dark
 * form. The inset shadow is the only thing that overrides it — there is no
 * supported way to set the colour directly.
 */
.input:-webkit-autofill,
.input:-webkit-autofill:hover,
.input:-webkit-autofill:focus,
.select:-webkit-autofill,
.textarea:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px var(--surface-raised) inset;
    box-shadow: 0 0 0 1000px var(--surface-raised) inset;
    -webkit-text-fill-color: var(--ink-strong);
    caret-color: var(--ink-strong);
    transition: background-color 9999s ease-in-out 0s;
}

.input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--surface-raised) inset, 0 0 0 3px var(--brand-soft);
    box-shadow: 0 0 0 1000px var(--surface-raised) inset, 0 0 0 3px var(--brand-soft);
}

/* The native checkbox is white-on-white in dark mode without this. */
input[type="checkbox"], input[type="radio"] {
    accent-color: var(--brand);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.input--mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filters .field { margin-bottom: 0; min-width: 160px; flex: 1 1 160px; }

/* ---------------------------------------------------------------- Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    min-height: 38px;
    transition: all 0.15s var(--ease);
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }

.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover:not(:disabled) {
    background: var(--brand-strong);
    color: var(--brand-ink);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-ghost {
    background: var(--surface-raised);
    border-color: var(--line-strong);
    color: var(--ink);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-sunken); color: var(--ink-strong); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(0.92); }

.btn-sm { padding: 5px 11px; font-size: 12px; min-height: 30px; }

/* ---------------------------------------------------------------- States */

.empty { text-align: center; padding: 48px 24px; }

.empty__mark {
    width: 52px;
    height: 52px;
    border-radius: 15px;
    background: var(--surface-sunken);
    color: var(--ink-faint);
    display: grid;
    place-items: center;
    margin: 0 auto 14px;
}

.empty__mark svg { width: 25px; height: 25px; }
.empty__title { font-size: 15px; font-weight: 650; color: var(--ink-strong); margin-bottom: 5px; }
.empty__text { color: var(--ink-muted); font-size: 13px; max-width: 380px; margin: 0 auto; }

.skeleton {
    background: linear-gradient(90deg, var(--surface-sunken) 25%, var(--line) 50%, var(--surface-sunken) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: var(--radius-sm);
    height: 15px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.spinner {
    width: 15px;
    height: 15px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.is-loading { pointer-events: none; opacity: 0.6; }

/* ---------------------------------------------------------------- Pagination */

.pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 18px;
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
}

.pagination__info { color: var(--ink-muted); font-size: 12px; }
.pagination__links { margin-left: auto; display: flex; gap: 4px; }

.pagination__links a,
.pagination__links span {
    min-width: 32px;
    height: 32px;
    padding: 0 9px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    color: var(--ink-muted);
    font-size: 12px;
    font-weight: 600;
}

.pagination__links a:hover { background: var(--surface-sunken); color: var(--ink-strong); }
.pagination__links .is-current { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.pagination__links .is-disabled { opacity: 0.4; }

/* ---------------------------------------------------------------- Login */

.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(1000px 520px at 12% -8%, var(--brand-soft), transparent 62%),
        var(--surface-canvas);
}

.auth__card {
    width: 100%;
    max-width: 396px;
    background: var(--surface-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 32px;
}

.auth__mark {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--brand), var(--brand-strong));
    color: var(--brand-ink);
    display: grid;
    place-items: center;
    font-weight: 700;
    margin-bottom: 18px;
}

.auth__title { font-size: 20px; margin-bottom: 5px; }
.auth__sub { color: var(--ink-muted); font-size: 13px; margin-bottom: 24px; }

.alert {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.alert-danger { background: var(--danger-soft); color: var(--danger); border-color: currentColor; }
.alert-success { background: var(--success-soft); color: var(--success); border-color: currentColor; }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: currentColor; }

/* ---------------------------------------------------------------- Misc */

.sidebar__toggle { display: none; }
.scrim { display: none; }

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row--wrap { flex-wrap: wrap; }

.divider { height: 1px; background: var(--line); margin: 16px 0; }

.masked {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    letter-spacing: 0.1em;
    color: var(--ink-faint);
}

/* ---------------------------------------------------------------- Tabs */

.tabs {
    display: flex;
    gap: 3px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 18px;
    overflow-x: auto;
    /* The scrollbar under a tab strip is noise; the overflow still scrolls. */
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    border: none;
    background: none;
    color: var(--ink-muted);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.tab:hover { color: var(--ink-strong); }

.tab[aria-selected="true"] {
    color: var(--brand);
    border-bottom-color: var(--brand);
}

.tab__count {
    background: var(--surface-sunken);
    color: var(--ink-faint);
    border-radius: 999px;
    padding: 1px 7px;
    font-size: 10px;
    font-weight: 700;
}

.tab[aria-selected="true"] .tab__count { background: var(--brand-soft); color: var(--brand); }

.tab-panel[hidden] { display: none; }

/* ---------------------------------------------------------------- Dialog */

/*
 * The house dialog, used for every notification and confirmation. Browser
 * alert() and confirm() are never used — they cannot be styled, they block
 * the whole browser, and they cannot show a pending state.
 */
.swal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: grid;
    place-items: center;
    padding: 24px;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.18s var(--ease);
}

.swal-overlay.is-open { opacity: 1; }

.swal {
    background: var(--surface-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 26px;
    width: 100%;
    max-width: 384px;
    text-align: center;
    transform: scale(0.94) translateY(8px);
    transition: transform 0.18s var(--ease);
}

.swal-overlay.is-open .swal { transform: scale(1) translateY(0); }

.swal__mark {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin: 0 auto 15px;
}

.swal__mark svg { width: 24px; height: 24px; }
.swal__mark--success { background: var(--success-soft); color: var(--success); }
.swal__mark--danger  { background: var(--danger-soft);  color: var(--danger); }
.swal__mark--warning { background: var(--warning-soft); color: var(--warning); }
.swal__mark--info    { background: var(--info-soft);    color: var(--info); }

.swal__title { font-size: 16px; font-weight: 650; color: var(--ink-strong); margin-bottom: 6px; }
.swal__text { color: var(--ink-muted); font-size: 13px; margin-bottom: 20px; }
.swal__actions { display: flex; gap: 8px; justify-content: center; }
.swal__actions .btn { flex: 1; max-width: 160px; }

/* ---------------------------------------------------------------- Responsive */

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar.is-open { transform: translateX(0); }
    .main { margin-left: 0; }
    .sidebar__toggle { display: grid; }

    .scrim {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 35;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s var(--ease);
    }

    .scrim.is-open { opacity: 1; pointer-events: auto; }
}

@media (max-width: 640px) {
    .content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .grid--halves { grid-template-columns: 1fr; }
    .page-head { flex-direction: column; align-items: stretch; }
    .page-head__actions { margin-left: 0; }
}

/* ---------------------------------------------------------------- Brand Utilities */

.btn-gold {
    background: var(--gold-grad);
    color: #1C3A5B !important;
    font-weight: 700;
    border: none;
    box-shadow: 0 2px 8px var(--brand-gold-glow);
}
.btn-gold:hover:not(:disabled) {
    filter: brightness(1.05);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px var(--brand-gold-glow);
}

.btn-sage {
    background: var(--sage-grad);
    color: #FFFDF7 !important;
    font-weight: 600;
    border: none;
}
.btn-sage:hover:not(:disabled) {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.badge-gold {
    background: var(--brand-gold-soft);
    color: var(--brand-gold-deep);
    border: 1px solid var(--line-gold);
}
:root[data-theme="dark"] .badge-gold {
    color: var(--brand-gold-hi);
}

.badge-sage {
    background: var(--brand-soft);
    color: var(--brand);
}

/* ---------------------------------------------------------------- Log Viewer */

.log-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 12px;
}

.log-table th {
    padding: 10px 14px;
    background: var(--surface-sunken);
    color: var(--ink-faint);
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.08em;
    font-weight: 650;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.log-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    vertical-align: top;
    line-height: 1.5;
}

.log-table tr:hover td {
    background: var(--surface-sunken);
}

.log-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.log-badge--emergency,
.log-badge--alert,
.log-badge--critical,
.log-badge--error {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid rgba(177, 74, 68, 0.3);
}

.log-badge--warning {
    background: var(--warning-soft);
    color: var(--warning);
    border: 1px solid rgba(197, 160, 89, 0.3);
}

.log-badge--notice,
.log-badge--info {
    background: var(--info-soft);
    color: var(--info);
}

.log-badge--debug {
    background: var(--surface-sunken);
    color: var(--ink-faint);
}

.log-trace-chip {
    font-size: 11px;
    padding: 2px 6px;
    background: var(--brand-soft);
    color: var(--brand);
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.log-trace-chip:hover {
    background: var(--brand);
    color: var(--brand-ink);
}

.log-message {
    word-break: break-word;
    white-space: pre-wrap;
    max-height: 120px;
    overflow-y: auto;
}
