/*
 * GoPlay Admin styles.
 *
 * Tokens follow BRAND_GUIDELINES.md §3.2 (Product Web UX). The "-ink" shades
 * are the AA-contrast text and fill variants of the §3.2 colors, which are too
 * light for text on white. Keep colors in these tokens; components use them.
 */

:root {
    --primary: #4A90E2;
    --primary-ink: #2B6CB0;
    --primary-strong: #1F5A99;
    --primary-tint: #EDF4FC;
    --secondary: #50E3C2;
    --secondary-ink: #0F766E;
    --secondary-tint: #E6FBF6;
    --background: #F8F9FA;
    --surface: #FFFFFF;
    --surface-muted: #F1F4F8;
    --border: #E3E8EF;
    --border-strong: #CBD3DE;
    --text: #1E293B;
    --text-muted: #526070;
    --success: #2ECC71;
    --success-ink: #1E7E46;
    --success-tint: #E8F8EF;
    --warning: #F39C12;
    --warning-ink: #8A5A00;
    --warning-tint: #FEF5E7;
    --danger: #E74C3C;
    --danger-ink: #C0392B;
    --danger-tint: #FDEDEB;
    --overlay: rgba(15, 23, 42, 0.45);

    --font-heading: 'Outfit', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;
    --font-wordmark: 'Fredoka', 'Outfit', system-ui, sans-serif;

    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;
    --space-2xl: 32px;
    --space-3xl: 48px;

    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-pill: 999px;

    --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.05);
    --shadow-raised: 0 12px 40px rgba(15, 23, 42, 0.16);

    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --easing: cubic-bezier(0.2, 0, 0, 1);

    --sidebar-width: 264px;
    --content-max: 1200px;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    background: var(--background);
}

h1, h2, h3, h4 { font-family: var(--font-heading); margin: 0; color: var(--text); }
h1 { font-size: 2rem; font-weight: 800; line-height: 1.2; }
h2 { font-size: 1.5rem; font-weight: 600; line-height: 1.3; }
h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.3; }
h4 { font-size: 1rem; font-weight: 600; line-height: 1.3; }
p { margin: 0; }
a { color: var(--primary-ink); }
a:hover { color: var(--primary-strong); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8125rem; }

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.icon {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    user-select: none;
    flex-shrink: 0;
}
.icon-sm { font-size: 20px; font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20; }

/* ── Shell ─────────────────────────────────────────────────────────── */

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

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-xl) var(--space-xl) var(--space-lg);
    text-decoration: none;
    color: var(--text);
}
.brand-mark {
    width: 44px; height: 44px;
    border-radius: var(--radius-md);
    background: var(--primary-tint);
    color: var(--primary-ink);
    display: grid;
    place-items: center;
}
.brand-name { font-family: var(--font-wordmark); font-weight: 600; font-size: 1.375rem; line-height: 1.1; }
.brand-sub { display: block; font-size: 0.75rem; font-weight: 500; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: var(--space-xs); padding: var(--space-sm) var(--space-lg); }
.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    min-height: 44px;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 600;
    text-decoration: none;
    transition: background var(--duration-fast) var(--easing), color var(--duration-fast) var(--easing);
}
.nav-link:hover { background: var(--surface-muted); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--primary-tint); color: var(--primary-strong); }
.nav-link[aria-current="page"] .icon { color: var(--primary-ink); }
.nav-count {
    margin-left: auto;
    min-width: 24px;
    padding: 0 var(--space-sm);
    border-radius: var(--radius-pill);
    background: var(--danger-tint);
    color: var(--danger-ink);
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    line-height: 22px;
}

.sidebar-footer {
    margin-top: auto;
    padding: var(--space-lg);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}
.me { display: flex; align-items: center; gap: var(--space-md); min-width: 0; }
.me-text { min-width: 0; display: flex; flex-direction: column; }
.me-name { font-weight: 600; font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-meta { font-size: 0.75rem; color: var(--text-muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 20;
    height: 56px;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar-spacer { width: 44px; }

.content {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: var(--space-2xl);
    animation: fade-in var(--duration-normal) var(--easing);
}

.session-banner {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
    padding: var(--space-md) var(--space-2xl);
    background: var(--warning-tint);
    color: var(--warning-ink);
    font-size: 0.875rem;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
}
.session-banner[hidden] { display: none; }

.drawer-backdrop { display: none; }

@media (max-width: 991px) {
    .sidebar {
        position: fixed;
        z-index: 40;
        left: 0;
        transform: translateX(-100%);
        transition: transform var(--duration-normal) var(--easing);
        box-shadow: var(--shadow-raised);
    }
    .shell[data-drawer="open"] .sidebar { transform: translateX(0); }
    .shell[data-drawer="open"] .drawer-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 30;
        background: var(--overlay);
    }
    .topbar { display: flex; }
    .content { padding: var(--space-xl) var(--space-lg); }
    .session-banner { padding: var(--space-md) var(--space-lg); }
}

/* ── Page structure ────────────────────────────────────────────────── */

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-lg);
    flex-wrap: wrap;
    margin-bottom: var(--space-xl);
}
.page-header p { color: var(--text-muted); margin-top: var(--space-xs); }
.breadcrumb { font-size: 0.875rem; margin-bottom: var(--space-sm); display: flex; align-items: center; gap: var(--space-xs); }
.breadcrumb a { text-decoration: none; font-weight: 500; }

.stack { display: flex; flex-direction: column; gap: var(--space-lg); }
.stack-lg { display: flex; flex-direction: column; gap: var(--space-xl); }
.stack-sm { display: flex; flex-direction: column; gap: var(--space-sm); }
.stack-tight { display: flex; flex-direction: column; min-width: 0; }
.row { display: flex; align-items: center; gap: var(--space-sm); flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); flex-wrap: wrap; }
.grid { display: grid; gap: var(--space-xl); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-lg); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-lg); }
@media (max-width: 767px) {
    .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
    h1 { font-size: 1.5rem; }
}

.muted { color: var(--text-muted); }
.small { font-size: 0.875rem; line-height: 1.5; }
.caption { font-size: 0.75rem; font-weight: 500; line-height: 1.4; color: var(--text-muted); }
.label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.grow { flex: 1; min-width: 0; }
.block { display: block; }
.mt-lg { margin-top: var(--space-lg); }
.strong { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break { overflow-wrap: anywhere; }

/* ── Cards ─────────────────────────────────────────────────────────── */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-subtle);
    padding: var(--space-xl);
    min-width: 0;
}
.card-flush { padding: 0; overflow: hidden; }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    flex-wrap: wrap;
    margin-bottom: var(--space-lg);
}
.card-flush .card-header { padding: var(--space-lg) var(--space-xl) 0; }
.card-intro { padding: 0 var(--space-xl) var(--space-md); }
.card-flush .card-header + .card-intro { margin-top: calc(-1 * var(--space-sm)); }
.card-section-title { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-md); font-size: 1.25rem; }
.card-header .card-section-title { margin-bottom: 0; }

.stat {
    display: flex;
    gap: var(--space-lg);
    align-items: center;
    padding: var(--space-xl);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-subtle);
    text-decoration: none;
    color: var(--text);
    transition: box-shadow var(--duration-normal) var(--easing), transform var(--duration-normal) var(--easing);
}
a.stat:hover { box-shadow: var(--shadow-glass), var(--shadow-subtle); transform: translateY(-2px); color: var(--text); }
.stat-icon {
    width: 52px; height: 52px;
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
}
.stat-value { font-family: var(--font-heading); font-size: 2rem; font-weight: 800; line-height: 1.1; }

.tone-primary { background: var(--primary-tint); color: var(--primary-ink); }
.tone-secondary { background: var(--secondary-tint); color: var(--secondary-ink); }
.tone-success { background: var(--success-tint); color: var(--success-ink); }
.tone-warning { background: var(--warning-tint); color: var(--warning-ink); }
.tone-danger { background: var(--danger-tint); color: var(--danger-ink); }
.tone-neutral { background: var(--surface-muted); color: var(--text-muted); }

.queue-card {
    display: flex;
    gap: var(--space-xl);
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    border-left: 6px solid var(--primary);
}
.queue-card.is-selected { box-shadow: 0 0 0 2px var(--primary); }
.queue-main { display: flex; gap: var(--space-lg); align-items: flex-start; min-width: 0; flex: 1 1 320px; }

.avatar {
    width: 44px; height: 44px;
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.125rem;
    background: var(--primary-tint);
    color: var(--primary-ink);
    flex-shrink: 0;
    text-transform: uppercase;
}
.avatar-lg { width: 72px; height: 72px; font-size: 1.75rem; border-radius: var(--radius-lg); }
.avatar-round { border-radius: 50%; }

.photo-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.photo-frame {
    aspect-ratio: 4 / 3;
    background: var(--surface-muted);
    display: grid;
    place-items: center;
    color: var(--text-muted);
    position: relative;
}
.photo-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-frame .photo-fallback { display: flex; flex-direction: column; align-items: center; gap: var(--space-xs); font-size: 0.875rem; }
.photo-body { padding: var(--space-lg); display: flex; flex-direction: column; gap: var(--space-md); flex: 1; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-sm); }
.list-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    background: var(--surface-muted);
    color: var(--text);
    text-decoration: none;
    min-width: 0;
}
a.list-item:hover { background: var(--primary-tint); color: var(--text); }
.list-item .grow { flex: 1; min-width: 0; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-sm) var(--space-xl); margin: 0; }
.kv dt { font-size: 0.875rem; color: var(--text-muted); }
.kv dd { margin: 0; font-size: 0.875rem; font-weight: 500; overflow-wrap: anywhere; }
@media (max-width: 575px) { .kv { grid-template-columns: 1fr; gap: 0; } .kv dd { margin-bottom: var(--space-sm); } }

.notice {
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* ── Badges ────────────────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 2px var(--space-sm);
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-plain::before { display: none; }

/* ── Buttons ───────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    min-height: 44px;
    padding: 0 var(--space-lg);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--duration-fast) var(--easing), border-color var(--duration-fast) var(--easing), color var(--duration-fast) var(--easing);
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary-ink); color: #FFFFFF; }
.btn-primary:hover:not(:disabled) { background: var(--primary-strong); color: #FFFFFF; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-muted); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-muted); color: var(--text); }
.btn-danger { background: var(--danger-ink); color: #FFFFFF; }
.btn-danger:hover:not(:disabled) { background: #A93226; color: #FFFFFF; }
.btn-danger-outline { background: var(--surface); color: var(--danger-ink); border-color: var(--danger-tint); }
.btn-danger-outline:hover:not(:disabled) { background: var(--danger-tint); }
.btn-success { background: var(--success-ink); color: #FFFFFF; }
.btn-success:hover:not(:disabled) { background: #186A3B; color: #FFFFFF; }
.btn-sm { min-height: 36px; padding: 0 var(--space-md); font-size: 0.875rem; border-radius: var(--radius-sm); }
.btn-icon { width: 44px; padding: 0; }
.btn-block { width: 100%; }
.btn[data-busy="true"] { position: relative; color: transparent; }
.btn[data-busy="true"]::after {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 2px solid var(--border-strong);
    border-top-color: var(--primary-ink);
    animation: spin 0.8s linear infinite;
}

/* ── Forms ─────────────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: var(--space-xs); min-width: 0; }
.field > span, .field > label { font-size: 0.875rem; font-weight: 600; }
.field .hint { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }
.input, .select, .textarea {
    width: 100%;
    min-height: 44px;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.9375rem;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); outline: 2px solid var(--primary-tint); outline-offset: 0; }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger-ink); }
.checkbox { width: 20px; height: 20px; accent-color: var(--primary-ink); cursor: pointer; }
.check-row { display: flex; align-items: center; gap: var(--space-sm); min-height: 44px; font-size: 0.9375rem; cursor: pointer; }

.filters {
    display: flex;
    gap: var(--space-md);
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: var(--space-lg);
}
.filters .field { flex: 1 1 180px; max-width: 320px; }
.filters .field-wide { flex: 3 1 260px; max-width: none; }

.switch {
    position: relative;
    width: 48px; height: 28px;
    flex-shrink: 0;
    appearance: none;
    border-radius: var(--radius-pill);
    background: var(--border-strong);
    cursor: pointer;
    transition: background var(--duration-fast) var(--easing);
    margin: 8px 0;
}
.switch::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: #FFFFFF;
    box-shadow: var(--shadow-subtle);
    transition: transform var(--duration-fast) var(--easing);
}
.switch:checked { background: var(--primary-ink); }
.switch:checked::after { transform: translateX(20px); }
.switch:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Tabs ──────────────────────────────────────────────────────────── */

.tabs {
    display: flex;
    gap: var(--space-xs);
    padding: var(--space-xs);
    background: var(--surface-muted);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-xl);
    overflow-x: auto;
    width: fit-content;
    max-width: 100%;
}
.tab {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    min-height: 40px;
    padding: 0 var(--space-lg);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9375rem;
    text-decoration: none;
    white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab[aria-current="page"] { background: var(--surface); color: var(--primary-strong); box-shadow: var(--shadow-subtle); }

/* ── Tables ────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th {
    text-align: left;
    padding: var(--space-md) var(--space-lg);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--surface-muted);
    white-space: nowrap;
}
.table td { padding: var(--space-md) var(--space-lg); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #FAFBFD; }
.table .cell-person { display: flex; align-items: center; gap: var(--space-md); min-width: 200px; }
.table .cell-person a { font-weight: 600; text-decoration: none; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }

@media (max-width: 767px) {
    .table-stack thead { display: none; }
    .table-stack tr { display: block; padding: var(--space-md) var(--space-lg); border-bottom: 1px solid var(--border); }
    .table-stack td { display: flex; justify-content: space-between; gap: var(--space-md); padding: var(--space-xs) 0; border: 0; }
    .table-stack td::before { content: attr(data-label); font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
    .table-stack td.cell-main { display: block; }
    .table-stack td.cell-main::before { display: none; }
    .table-stack .num, .table-stack .actions { text-align: left; }
}

.nowrap { white-space: nowrap; }
.detail-lines { margin: 0; display: flex; flex-direction: column; gap: 2px; min-width: 200px; font-size: 0.8125rem; line-height: 1.4; }
.detail-lines div { display: flex; gap: var(--space-sm); }
.detail-lines dt { color: var(--text-muted); white-space: nowrap; }
.detail-lines dd { margin: 0; overflow-wrap: anywhere; }

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text-muted);
}
.pager-standalone { border-top: 0; padding: var(--space-lg) 0 0; }

/* ── States ────────────────────────────────────────────────────────── */

.state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-3xl) var(--space-xl);
    text-align: center;
    color: var(--text-muted);
}
.state-boxed { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); }
.state .icon { font-size: 40px; color: var(--border-strong); }
.state-error .icon { color: var(--danger); }
.spinner {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 3px solid var(--border);
    border-top-color: var(--primary-ink);
    animation: spin 0.8s linear infinite;
}

/* ── Login ─────────────────────────────────────────────────────────── */

.login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: var(--space-xl) var(--space-lg);
    background: linear-gradient(135deg, var(--primary-tint) 0%, var(--background) 55%, var(--secondary-tint) 100%);
}
.login-card {
    width: 100%;
    max-width: 420px;
    padding: var(--space-2xl);
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(12px);
    border: 1px solid var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass), var(--shadow-subtle);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    animation: fade-in var(--duration-normal) var(--easing);
}
.login-card .brand { justify-content: center; padding: 0; }
.login-card form { text-align: left; }
.gsi-slot { display: flex; justify-content: center; min-height: 44px; }
.login-divider { display: flex; align-items: center; gap: var(--space-md); color: var(--text-muted); font-size: 0.75rem; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.form-error { color: var(--danger-ink); font-size: 0.875rem; font-weight: 600; min-height: 1.5em; }

/* ── Dialog ────────────────────────────────────────────────────────── */

.dialog {
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    padding: 0;
    border: 0;
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-raised);
}
.dialog::backdrop { background: var(--overlay); }
.dialog[open] { animation: fade-in var(--duration-normal) var(--easing); }
.dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-md); padding: var(--space-xl) var(--space-xl) 0; }
.dialog-body { padding: var(--space-lg) var(--space-xl); overflow-y: auto; display: flex; flex-direction: column; gap: var(--space-lg); }
.dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    flex-wrap: wrap;
    padding: var(--space-lg) var(--space-xl) var(--space-xl);
    border-top: 1px solid var(--border);
}
@media (max-width: 575px) { .dialog-footer .btn { flex: 1; } }

/* ── Toasts ────────────────────────────────────────────────────────── */

.toasts {
    position: fixed;
    right: var(--space-lg);
    bottom: var(--space-lg);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-width: min(420px, calc(100vw - 32px));
}
.toast {
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    background: var(--text);
    color: #FFFFFF;
    box-shadow: var(--shadow-raised);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    animation: fade-in var(--duration-normal) var(--easing);
}
.toast-error { background: var(--danger-ink); }
.toast-success { background: var(--success-ink); }

.chips { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    min-height: 32px;
    padding: 0 var(--space-md);
    border-radius: var(--radius-pill);
    background: var(--surface-muted);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text);
}
a.chip:hover { background: var(--primary-tint); color: var(--primary-strong); }

pre.json {
    margin: 0;
    padding: var(--space-md);
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    font-size: 0.75rem;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 240px;
    overflow: auto;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
