/* Z5 — clean design system (2026) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* CLS palette — deep violet + purple accent */
    --z-bg: #22163b;
    --z-bg-elevated: #2a1c48;
    --z-surface: #2a1c48;
    --z-surface-elevated: #342456;
    --z-border: #463568;
    --z-border-subtle: #352651;
    --z-text: #f5f3ff;
    --z-text-secondary: #b8a9d9;
    --z-muted: #b8a9d9;
    --z-dim: #7d6f9a;

    /* Brand — #5f21e5 */
    --z-accent: #5f21e5;
    --z-accent-hover: #7b45f0;
    --z-accent-dim: #4a1ab8;
    --z-accent-muted: rgba(95, 33, 229, 0.18);
    --z-accent-subtle: rgba(95, 33, 229, 0.10);
    --z-accent-border: rgba(95, 33, 229, 0.40);
    --z-on-accent: #ffffff;

    /* Secondary — lighter violet for info / lifetime */
    --z-cyan: #8b5cf6;
    --z-cyan-muted: rgba(139, 92, 246, 0.14);
    --z-cyan-border: rgba(139, 92, 246, 0.35);

    /* Semantic — menu feedback colors */
    --z-danger: #fa4b55;
    --z-danger-hover: #ff6b73;
    --z-danger-muted: rgba(250, 75, 85, 0.12);
    --z-danger-border: rgba(250, 75, 85, 0.4);
    --z-danger-text: #fca5a5;
    --z-success: #4be191;
    --z-success-muted: rgba(75, 225, 145, 0.14);
    --z-warning: #f7ba53;
    --z-warning-muted: rgba(247, 186, 83, 0.12);
    --z-warning-border: rgba(247, 186, 83, 0.35);

    --z-radius: 12px;
    --z-radius-sm: 8px;
    --z-radius-lg: 16px;
    --z-radius-full: 999px;
    --z-font: 'Inter', system-ui, -apple-system, sans-serif;
    --z-mono: ui-monospace, 'Cascadia Code', monospace;
    --z-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --z-max: 1080px;
    --z-app-max: 1200px;
    --z-space-1: 4px;
    --z-space-2: 8px;
    --z-space-3: 12px;
    --z-space-4: 16px;
    --z-space-5: 20px;
    --z-space-6: 24px;
    --z-space-8: 32px;
    --z-space-10: 40px;
    --z-space-12: 48px;
    /* JS legacy aliases */
    --z5-mint: var(--z-accent);
    --z5-rose: var(--z-danger);
    --z5-amber: var(--z-warning);
    --z5-cyan: var(--z-cyan);
    --z5-muted: var(--z-muted);
    --z5-dim: var(--z-dim);
    --z5-text: var(--z-text);

    /* Scrollbars — dark, slim, no native Windows chrome */
    --z-scrollbar-size: 7px;
    --z-scrollbar-size-thin: 5px;
    --z-scrollbar-track: rgba(34, 22, 59, 0.01);
    --z-scrollbar-thumb: rgba(184, 169, 217, 0.38);
    --z-scrollbar-thumb-hover: rgba(184, 169, 217, 0.58);
    --z-scrollbar-thumb-active: rgba(95, 33, 229, 0.55);
}

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

html {
    color-scheme: dark;
    -webkit-font-smoothing: antialiased;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: var(--z-scrollbar-thumb) var(--z-scrollbar-track);
}

/* ── Scrollbars ───────────────────────────────────────────────────────────── */

html,
body,
* {
    scrollbar-width: thin;
    scrollbar-color: var(--z-scrollbar-thumb) var(--z-scrollbar-track);
}

*::-webkit-scrollbar {
    width: var(--z-scrollbar-size);
    height: var(--z-scrollbar-size);
    background: transparent;
}

*::-webkit-scrollbar-button,
*::-webkit-scrollbar-button:single-button,
*::-webkit-scrollbar-button:vertical:start:decrement,
*::-webkit-scrollbar-button:vertical:end:increment {
    display: none;
    width: 0;
    height: 0;
}

*::-webkit-scrollbar-track,
*::-webkit-scrollbar-track-piece {
    background: transparent;
}

*::-webkit-scrollbar-corner {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background-color: var(--z-scrollbar-thumb);
    border: 2px solid transparent;
    background-clip: padding-box;
    border-radius: 999px;
    transition: background-color 0.15s ease;
}

.activity-feed,
.table-wrap,
.app-main,
.login-shell {
    scrollbar-width: thin;
    scrollbar-color: var(--z-scrollbar-thumb) var(--z-scrollbar-track);
}

.activity-feed::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar {
    width: var(--z-scrollbar-size-thin);
    height: var(--z-scrollbar-size-thin);
}

@media (hover: hover) {
    *::-webkit-scrollbar-thumb:hover {
        background-color: var(--z-scrollbar-thumb-hover);
    }

    *::-webkit-scrollbar-thumb:active {
        background-color: var(--z-scrollbar-thumb-active);
    }
}

body {
    font-family: var(--z-font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--z-text-secondary);
    background: #22163b;
    background-attachment: fixed;
    min-height: 100vh;
    min-height: 100dvh;
}

a { color: inherit; text-decoration: none; }

button, input, select { font: inherit; color: inherit; }

/* ── Layout shell ─────────────────────────────────────────────────────────── */

.app {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--z-space-4);
    padding: var(--z-space-4) var(--z-space-6);
    background: rgba(34, 22, 59, 0.88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--z-border-subtle);
}

.app-brand {
    display: flex;
    align-items: center;
    gap: var(--z-space-3);
    min-width: 0;
}

.app-brand img,
.app-brand svg,
.brand-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.app-brand h1 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--z-text);
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-brand small {
    display: block;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--z-dim);
    margin-top: 1px;
}

.app-header-actions {
    display: flex;
    align-items: center;
    gap: var(--z-space-2);
    flex-shrink: 0;
}

.app-menu-toggle {
    display: none;
    width: 42px;
    height: 42px;
    margin-left: auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border-radius: var(--z-radius-sm);
    border: 1px solid var(--z-border-subtle);
    background: rgba(255, 255, 255, 0.03);
    color: var(--z-text);
    cursor: pointer;
    flex-shrink: 0;
}

.app-menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.app-header.is-nav-open .app-menu-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.app-header.is-nav-open .app-menu-toggle span:nth-child(2) {
    opacity: 0;
}

.app-header.is-nav-open .app-menu-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.app-nav-overlay {
    display: none;
}

.app-main {
    flex: 1;
    width: min(var(--z-app-max), 100%);
    margin: 0 auto;
    padding: var(--z-space-6);
    display: flex;
    flex-direction: column;
    gap: var(--z-space-6);
}

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

.card {
    background: var(--z-surface);
    border: 1px solid color-mix(in srgb, var(--z-accent) 22%, var(--z-border-subtle));
    border-radius: var(--z-radius-sm);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--z-space-3);
    padding: var(--z-space-4) var(--z-space-5);
    border-bottom: 1px solid var(--z-border-subtle);
    min-height: 56px;
}

.card-title {
    display: flex;
    align-items: center;
    gap: var(--z-space-2);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--z-muted);
}

.card-title i {
    font-size: 0.85rem;
    color: var(--z-accent);
}

.card-header .btn--header {
    flex: 0 0 auto;
    width: auto;
    padding: 5px 10px;
    font-size: 0.7rem;
    gap: 5px;
}

.card-header .btn--header i {
    font-size: 0.65rem;
}

.card-body {
    padding: var(--z-space-5);
}

.card-footer {
    padding: var(--z-space-4) var(--z-space-5);
    border-top: 1px solid var(--z-border-subtle);
}

/* ── Grid (sync page) ────────────────────────────────────────────────────── */

.sync-grid {
    display: flex;
    flex-direction: column;
    gap: var(--z-space-6);
}

.sync-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--z-space-6);
    align-items: stretch;
}

.sync-row > .card {
    display: flex;
    flex-direction: column;
}

.sync-row > .card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sync-row--match > .card.activity-dock {
    min-height: 0;
    overflow: hidden;
}

.sync-row--match > .card.activity-dock .activity-feed {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    height: auto;
}

.sync-grid > .victory--banner {
    margin: 0;
}

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

.field {
    display: flex;
    flex-direction: column;
    gap: var(--z-space-2);
    margin-bottom: var(--z-space-4);
}

.field:last-child { margin-bottom: 0; }

.field label,
.label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--z-muted);
    letter-spacing: 0.02em;
}

.input,
.select {
    width: 100%;
    padding: 11px 14px;
    background: var(--z-bg);
    border: 1px solid var(--z-border);
    border-radius: var(--z-radius-sm);
    color: var(--z-text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus,
.select:focus {
    border-color: var(--z-accent);
    box-shadow: 0 0 0 3px var(--z-accent-muted);
}

.input--lg { padding: 13px 16px; font-size: 1rem; }

.input--error { border-color: var(--z-danger); }

.select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2371717a' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.input-wrap {
    position: relative;
}

.input-wrap .input { padding-left: 42px; }

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--z-dim);
    font-size: 0.9rem;
    pointer-events: none;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--z-space-2);
    padding: 10px 18px;
    border-radius: var(--z-radius-sm);
    border: 1px solid transparent;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }

.btn--primary {
    background: var(--z-accent);
    color: var(--z-on-accent);
}

.btn--primary:hover { background: var(--z-accent-hover); }

.btn--ghost {
    background: transparent;
    border-color: var(--z-border);
    color: var(--z-muted);
}

.btn--ghost:hover {
    background: var(--z-surface-elevated);
    color: var(--z-text);
    border-color: var(--z-border);
}

.btn--full { width: 100%; }

.btn--lg {
    padding: 14px 20px;
    font-size: 0.95rem;
    border-radius: var(--z-radius);
}

.btn--launch {
    background: var(--z-accent);
    color: var(--z-on-accent);
    width: 100%;
    padding: 14px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: var(--z-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--z-space-3);
    min-height: 52px;
    transition: background 0.15s, opacity 0.15s;
}

.btn--launch:hover { background: var(--z-accent-hover); }

.btn--launch.is-running {
    background: var(--z-danger);
    color: var(--z-text);
}

.btn--launch.is-running:hover { background: var(--z-danger-hover); }

.btn--launch:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Pills & badges ──────────────────────────────────────────────────────── */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--z-radius-sm);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border: 1px solid var(--z-border);
    color: var(--z-muted);
    background: var(--z-surface-elevated);
}

.pill--active {
    color: var(--z-accent);
    border-color: var(--z-accent-border);
    background: var(--z-accent-muted);
}

.status-pill {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 5px 10px;
    border-radius: var(--z-radius-sm);
    border: 1px solid var(--z-border);
    color: var(--z-dim);
    background: var(--z-bg);
}

.status-pill--scanning {
    color: var(--z-cyan);
    border-color: var(--z-cyan-border);
    background: var(--z-cyan-muted);
}

.status-pill--found {
    color: var(--z-accent);
    border-color: var(--z-accent-border);
    background: var(--z-accent-muted);
}

/* ── Alerts ──────────────────────────────────────────────────────────────── */

.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--z-space-3);
    padding: var(--z-space-3) var(--z-space-4);
    border-radius: var(--z-radius-sm);
    font-size: 0.875rem;
    line-height: 1.45;
    margin-bottom: 16px;
}

.alert--error {
    background: var(--z-danger-muted);
    border: 1px solid var(--z-danger-border);
    color: var(--z-danger-text);
}

.alert--ok {
    background: var(--z-accent-muted);
    border: 1px solid var(--z-accent-border);
    color: var(--z-accent);
}

.alert--err {
    background: var(--z-danger-muted);
    border: 1px solid var(--z-danger-border);
    color: var(--z-danger-text);
}

.hint {
    font-size: 0.8rem;
    color: var(--z-dim);
    line-height: 1.5;
    margin-bottom: var(--z-space-4);
}

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

.page-login {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--z-space-6);
}

.login-shell {
    width: 100%;
    max-width: var(--z-max);
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--z-surface);
    border: 1px solid var(--z-border-subtle);
    border-radius: var(--z-radius-lg);
    overflow: hidden;
    min-height: min(640px, 90vh);
}

.login-hero {
    padding: var(--z-space-10) var(--z-space-8);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-right: 1px solid var(--z-border-subtle);
    background: linear-gradient(160deg, var(--z-surface-elevated) 0%, var(--z-surface) 100%);
}

.login-hero-content { max-width: 360px; }

.login-logo {
    width: 48px;
    height: 48px;
    margin-bottom: var(--z-space-8);
}

.login-logo svg,
.login-logo img { width: 100%; height: 100%; display: block; object-fit: contain; }

.login-hero h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--z-text);
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: var(--z-space-3);
}

.login-hero .lead {
    font-size: 0.95rem;
    color: var(--z-muted);
    margin-bottom: var(--z-space-8);
    max-width: 32ch;
}

.login-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--z-space-4);
    margin-bottom: var(--z-space-8);
}

.login-features li {
    display: flex;
    align-items: center;
    gap: var(--z-space-3);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--z-text-secondary);
}

.feat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--z-accent);
    flex-shrink: 0;
}

.login-discord {
    display: inline-flex;
    align-items: center;
    gap: var(--z-space-2);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--z-muted);
    padding: var(--z-space-2) 0;
    transition: color 0.15s;
}

.login-discord:hover { color: var(--z-text); }

.login-copy {
    font-size: 0.72rem;
    color: var(--z-dim);
}

.login-panel {
    padding: var(--z-space-10) var(--z-space-8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-form-wrap {
    width: 100%;
    max-width: 360px;
}

.login-form-wrap .eyebrow {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--z-accent);
    margin-bottom: var(--z-space-2);
}

.login-form-wrap h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--z-text);
    letter-spacing: -0.02em;
    margin-bottom: var(--z-space-2);
}

.login-form-wrap .sub {
    font-size: 0.9rem;
    color: var(--z-muted);
    margin-bottom: var(--z-space-8);
}

.login-footnote {
    margin-top: var(--z-space-6);
    font-size: 0.8rem;
    color: var(--z-dim);
    text-align: center;
}

/* ── Accounts ────────────────────────────────────────────────────────────── */

#tokenList {
    display: flex;
    flex-direction: column;
    gap: var(--z-space-4);
}

.acct {
    padding: var(--z-space-3) var(--z-space-4);
    background: var(--z-bg);
    border: 1px solid var(--z-border-subtle);
    border-radius: var(--z-radius);
    animation: fadeUp 0.3s ease both;
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.acct.is-synced {
    border-color: rgba(158, 240, 112, 0.5);
    background: rgba(158, 240, 112, 0.07);
    box-shadow: inset 4px 0 0 #9ef070;
}

.acct.is-unsynced {
    border-color: rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.15);
}

.acct.is-unsynced .acct-name {
    opacity: 0.55;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.acct-row {
    display: flex;
    align-items: center;
    gap: var(--z-space-3);
    min-width: 0;
}

.acct-sync-toggle {
    position: relative;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.acct-sync-cb {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.acct-sync-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--z-mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 6px 11px 5px;
    border-radius: 7px;
    line-height: 1;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.acct-sync-badge i {
    font-size: 0.72rem;
}

.acct-sync-badge--on {
    display: none;
    color: #c8ff8a;
    background: rgba(158, 240, 112, 0.18);
    border: 1px solid rgba(158, 240, 112, 0.55);
    box-shadow: 0 0 12px rgba(158, 240, 112, 0.15);
}

.acct-sync-badge--off {
    color: #ff9a9a;
    background: rgba(240, 110, 110, 0.12);
    border: 1px solid rgba(240, 110, 110, 0.45);
}

.acct-sync-toggle:has(.acct-sync-cb:checked) .acct-sync-badge--on {
    display: inline-flex;
}

.acct-sync-toggle:has(.acct-sync-cb:checked) .acct-sync-badge--off {
    display: none;
}

.acct-sync-toggle:hover .acct-sync-badge--off {
    background: rgba(240, 110, 110, 0.2);
    border-color: rgba(255, 130, 130, 0.65);
}

.acct-sync-toggle:hover .acct-sync-badge--on,
.acct-sync-toggle:has(.acct-sync-cb:checked):hover .acct-sync-badge--on {
    background: rgba(158, 240, 112, 0.26);
    border-color: rgba(200, 255, 138, 0.7);
    box-shadow: 0 0 14px rgba(158, 240, 112, 0.22);
}

.acct-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.85rem;
    color: var(--z-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.acct-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
}

.acct-skip-tuts,
.acct-copy {
    flex-shrink: 0;
    font-family: var(--z-mono);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    padding: 5px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}

.acct-skip-tuts {
    border: 1px solid var(--z5-amber, #f59e0b);
    background: rgba(245, 158, 11, 0.08);
    color: var(--z5-amber, #f59e0b);
}

.acct-skip-tuts:hover:not(:disabled) {
    background: rgba(245, 158, 11, 0.16);
    border-color: #fbbf24;
}

.acct-copy {
    border: 1px solid rgba(95, 33, 229, 0.35);
    background: rgba(95, 33, 229, 0.08);
    color: var(--z-cyan);
}

.acct-copy:hover:not(:disabled) {
    background: rgba(95, 33, 229, 0.16);
    border-color: rgba(95, 33, 229, 0.55);
}

.acct-copy.is-copied {
    border-color: rgba(130, 220, 160, 0.55);
    background: rgba(130, 220, 160, 0.14);
    color: var(--z-green, #82dc9f);
}

.acct-skip-tuts:disabled,
.acct-copy:disabled {
    opacity: 0.65;
    cursor: wait;
}

.acct-tag {
    font-family: var(--z-mono);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    background: var(--z-accent-muted);
    color: var(--z-accent);
    border: 1px solid var(--z-accent-border);
}

.acct-name.is-resolved { color: var(--z-muted); }
.acct-name.is-resolved .acct-display-name { color: var(--z-cyan); }
.acct-name.is-resolved.is-warn .acct-display-name { color: var(--z5-amber, #f59e0b); }

.acct-platform-sep {
    margin: 0 0.4em;
    color: var(--z-dim);
    user-select: none;
}

.acct-platform {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 1px 7px;
    border-radius: 5px;
    color: var(--z-text-secondary);
    background: rgba(184, 169, 217, 0.12);
    border: 1px solid rgba(184, 169, 217, 0.22);
    vertical-align: baseline;
}

.acct-platform--steam {
    color: #9fd4ff;
    background: rgba(123, 69, 240, 0.14);
    border-color: rgba(123, 69, 240, 0.35);
}

.acct-platform--xbox_pc {
    color: #9ef0c4;
    background: rgba(55, 211, 154, 0.12);
    border-color: rgba(55, 211, 154, 0.32);
}

.acct-platform--xbox {
    color: #b8e89a;
    background: rgba(158, 208, 129, 0.12);
    border-color: rgba(158, 208, 129, 0.32);
}

.acct-shimmer {
    display: inline-block;
    width: 80px;
    height: 0.75rem;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--z-surface-elevated) 25%, var(--z-border) 50%, var(--z-surface-elevated) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
}

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

.acct-field { position: relative; }

.acct-input {
    flex: 1 1 8rem;
    min-width: 0;
    padding: 8px 10px;
    background: var(--z-surface);
    border: 1px solid var(--z-border);
    border-radius: var(--z-radius-sm);
    color: var(--z-text);
    font-family: var(--z-mono);
    font-size: 0.68rem;
    outline: none;
}

.acct-input:focus { border-color: var(--z-accent); }

.acct-del {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--z-border);
    border-radius: 6px;
    background: transparent;
    color: var(--z-dim);
    cursor: pointer;
    padding: 0;
    font-size: 0.85rem;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.acct-del:hover {
    color: var(--z-danger);
    border-color: rgba(240, 110, 110, 0.45);
    background: rgba(240, 110, 110, 0.08);
}

.match-actions {
    margin-top: auto;
    padding-top: var(--z-space-4);
}

/* ── Status panel ────────────────────────────────────────────────────────── */

.status-body {
    align-items: center;
    text-align: center;
    gap: var(--z-space-5);
}

.status-visual {
    position: relative;
    width: 148px;
    height: 148px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Radar display ───────────────────────────────────────────────────────── */

.radar {
    position: relative;
    width: 100%;
    height: 100%;
}

.radar__disc {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    background:
        radial-gradient(circle at center, rgba(95, 33, 229, 0.06) 0%, transparent 55%),
        radial-gradient(circle at center, var(--z-bg) 0%, var(--z-surface) 72%);
    border: 2px solid var(--z-border);
    box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.35);
    transition: border-color 0.35s, box-shadow 0.35s;
}

.radar__ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    border: 1px solid rgba(95, 33, 229, 0.12);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.radar__ring--1 { width: 34%; height: 34%; }
.radar__ring--2 { width: 67%; height: 67%; }

.radar__axis {
    position: absolute;
    background: rgba(95, 33, 229, 0.1);
    pointer-events: none;
}

.radar__axis--h {
    left: 8%;
    right: 8%;
    top: 50%;
    height: 1px;
    margin-top: -0.5px;
}

.radar__axis--v {
    top: 8%;
    bottom: 8%;
    left: 50%;
    width: 1px;
    margin-left: -0.5px;
}

.radar__sweep {
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: conic-gradient(
        from -90deg,
        transparent 0deg,
        transparent 258deg,
        rgba(95, 33, 229, 0.05) 285deg,
        rgba(95, 33, 229, 0.35) 318deg,
        rgba(95, 33, 229, 0.75) 360deg
    );
    opacity: 0;
    transform-origin: center center;
    animation: radar-sweep 2.2s linear infinite;
    pointer-events: none;
}

.radar__core {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: var(--z-cyan);
    box-shadow: 0 0 10px var(--z-cyan-muted);
    z-index: 2;
    transition: background 0.35s, box-shadow 0.35s;
}

.radar__blip {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--z-cyan);
    box-shadow: 0 0 8px var(--z-cyan);
    opacity: 0;
    z-index: 1;
    pointer-events: none;
}

.radar__blip--1 { top: 28%; left: 62%; }
.radar__blip--2 { top: 58%; left: 34%; }
.radar__blip--3 { top: 44%; left: 72%; }

.radar__found {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--z-accent-muted);
    border: 2px solid var(--z-accent-border);
    font-size: 2.25rem;
    color: var(--z-accent);
    z-index: 3;
    animation: radar-found-pop 0.35s var(--z-ease-out, ease-out);
}

.radar__found[hidden] {
    display: none !important;
}

/* Idle — dim slow sweep */
.status-visual.is-idle .radar__disc {
    border-color: var(--z-border);
}

.status-visual.is-idle .radar__sweep {
    opacity: 0.35;
    animation-duration: 5s;
}

.status-visual.is-idle .radar__core {
    background: var(--z-dim);
    box-shadow: 0 0 6px rgba(58, 80, 112, 0.35);
}

/* Scanning — full radar */
.status-visual.is-scanning .radar__disc {
    border-color: var(--z-cyan-border);
    box-shadow:
        inset 0 0 28px rgba(95, 33, 229, 0.08),
        0 0 20px var(--z-cyan-muted);
}

.status-visual.is-scanning .radar__sweep {
    opacity: 1;
}

.status-visual.is-scanning .radar__blip {
    animation: radar-blip 2.2s ease-in-out infinite;
}

.status-visual.is-scanning .radar__blip--2 { animation-delay: 0.7s; }
.status-visual.is-scanning .radar__blip--3 { animation-delay: 1.4s; }

/* Found — lock on target */
.status-visual.is-found .radar__disc {
    border-color: var(--z-accent-border);
    box-shadow:
        inset 0 0 24px rgba(55, 211, 154, 0.12),
        0 0 18px var(--z-accent-muted);
}

.status-visual.is-found .radar__sweep {
    opacity: 0;
    animation: none;
}

.status-visual.is-found .radar__core {
    background: var(--z-accent);
    box-shadow: 0 0 12px var(--z-accent-muted);
}

@keyframes radar-sweep {
    to { transform: rotate(360deg); }
}

@keyframes radar-blip {
    0%, 55%, 100% { opacity: 0; transform: scale(0.6); }
    62%, 78% { opacity: 1; transform: scale(1); }
}

@keyframes radar-found-pop {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

.status-caption {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--z-muted);
}

.progress-block {
    width: 100%;
    max-width: 320px;
}

.progress-head {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--z-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: var(--z-space-2);
}

.progress-track {
    height: 6px;
    background: var(--z-bg);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--z-accent);
    border-radius: 999px;
    transition: width 0.4s ease;
}

.stat-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--z-space-3);
    width: 100%;
}

.stat {
    padding: var(--z-space-3);
    background: var(--z-bg);
    border: 1px solid var(--z-border-subtle);
    border-radius: var(--z-radius-sm);
    text-align: center;
}

.stat-val {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--z-text);
    line-height: 1.2;
}

.stat-val--text { font-size: 0.85rem; font-weight: 600; color: var(--z-accent); }

.stat-lbl {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--z-dim);
    margin-top: 4px;
}

.victory {
    display: none;
}

.victory--banner {
    position: relative;
    width: 100%;
    padding: var(--z-space-5) var(--z-space-6);
    padding-right: calc(var(--z-space-6) + 2rem);
    background: var(--z-accent-muted);
    border: 1px solid var(--z-accent-border);
    border-radius: var(--z-radius-lg);
    align-items: center;
    justify-content: space-between;
    gap: var(--z-space-5);
}

.victory-banner-dismiss {
    position: absolute;
    top: var(--z-space-3);
    right: var(--z-space-3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: none;
    border-radius: var(--z-radius-sm);
    background: transparent;
    color: var(--z-muted);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}

.victory-banner-dismiss:hover {
    color: var(--z-text);
    background: rgba(255, 255, 255, 0.06);
}

.victory-banner-dismiss:focus-visible {
    outline: 2px solid var(--z-accent);
    outline-offset: 2px;
}

.victory-banner-dismiss i {
    font-size: 0.95rem;
}

.victory--banner.is-visible {
    display: flex;
}

.victory-banner-main {
    min-width: 0;
}

.victory--banner h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--z-accent);
    margin-bottom: var(--z-space-1);
    display: flex;
    align-items: center;
    gap: var(--z-space-2);
}

.victory--banner p {
    font-size: 0.9rem;
    color: var(--z-text-secondary);
    margin: 0;
}

.victory-banner-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--z-space-2);
    flex-shrink: 0;
    text-align: right;
}

.victory-id {
    font-family: var(--z-mono);
    font-size: 0.75rem;
    color: var(--z-muted);
    word-break: break-all;
    max-width: 280px;
}

.victory-timer {
    font-size: 0.8rem;
    color: var(--z-dim);
    display: flex;
    align-items: center;
    gap: var(--z-space-2);
    margin: 0;
}

@media (max-width: 600px) {
    .victory--banner {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .victory-banner-meta {
        align-items: flex-start;
        text-align: left;
        width: 100%;
    }

    .victory-id { max-width: none; }
}

/* ── Activity log ────────────────────────────────────────────────────────── */

.activity-bar {
    display: flex;
    align-items: center;
    gap: var(--z-space-3);
    padding: var(--z-space-4) var(--z-space-5);
    border-bottom: 1px solid var(--z-border-subtle);
    background: var(--z-surface-elevated);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--z-dim);
    flex-shrink: 0;
}

.status-dot--idle { background: var(--z-dim); }
.status-dot--running { background: var(--z-cyan); box-shadow: 0 0 8px var(--z-cyan-muted); }
.status-dot--ok { background: var(--z-accent); }
.status-dot--err { background: var(--z-danger); }

.status-msg {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--z-muted);
}

.status-msg--running { color: var(--z-cyan); }
.status-msg--ok { color: var(--z-accent); }
.status-msg--err { color: var(--z-danger); }

.status-timer {
    display: flex;
    align-items: center;
    gap: var(--z-space-4);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--z-dim);
    font-family: var(--z-mono);
}

.status-timer[hidden] { display: none !important; }

.activity-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--z-space-3) var(--z-space-5);
    border-bottom: 1px solid var(--z-border-subtle);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--z-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.activity-head i { color: var(--z-accent); margin-right: 6px; }

.activity-feed {
    --activity-log-lines: 6;
    --activity-line-height: calc(0.72rem * 1.6 + 2px);
    max-height: calc(var(--activity-line-height) * var(--activity-log-lines) + var(--z-space-3) * 2);
    overflow-y: auto;
    padding: var(--z-space-3) var(--z-space-4);
    font-family: var(--z-mono);
    font-size: 0.72rem;
    line-height: 1.6;
}

.log-line {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    padding: 1px 0;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

.log-line-icon { width: 14px; flex-shrink: 0; opacity: 0.7; }

.log-line-ts { color: var(--z-dim); flex-shrink: 0; }

.log-line-msg { color: var(--z-muted); }

.log-ok .log-line-msg { color: var(--z-accent); }
.log-err .log-line-msg { color: var(--z-danger); }
.log-warn .log-line-msg { color: var(--z-warning); }
.log-info .log-line-icon { color: var(--z-cyan); }
.log-dim .log-line-msg { color: var(--z-dim); }

/* ── Toast ───────────────────────────────────────────────────────────────── */

.toast {
    position: fixed;
    bottom: var(--z-space-6);
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    padding: 12px 20px;
    background: var(--z-surface-elevated);
    border: 1px solid var(--z-border);
    border-radius: var(--z-radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--z-text);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 200;
    max-width: min(90vw, 400px);
    text-align: center;
}

.toast.is-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast--ok { border-color: var(--z-accent-border); }
.toast--err { border-color: var(--z-danger-border); }

.keys-modal__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: min(48vh, 360px);
    overflow: auto;
}

.keys-modal__list li {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--z-border-subtle);
    border-radius: var(--z-radius-sm);
    background: rgba(255, 255, 255, 0.03);
    font-family: var(--z-mono);
    font-size: 0.84rem;
}

.keys-modal__actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.keys-modal__actions .btn--full {
    width: 100%;
    justify-content: center;
}

/* ── Admin ───────────────────────────────────────────────────────────────── */

.gate-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--z-space-6);
}

.gate {
    width: 100%;
    max-width: 400px;
    padding: var(--z-space-8);
    background: var(--z-surface);
    border: 1px solid var(--z-border-subtle);
    border-radius: var(--z-radius-lg);
    text-align: center;
}

.gate-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto var(--z-space-5);
    border-radius: var(--z-radius);
    background: var(--z-accent-muted);
    color: var(--z-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.gate h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--z-text);
    margin-bottom: var(--z-space-2);
}

.gate p {
    font-size: 0.9rem;
    color: var(--z-muted);
    margin-bottom: var(--z-space-6);
}

.gate-form { text-align: left; }

.gate-err {
    margin-top: var(--z-space-4);
    font-size: 0.85rem;
    color: var(--z-danger);
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--z-space-4);
}

.admin-stat {
    padding: var(--z-space-5);
    background: var(--z-surface);
    border: 1px solid var(--z-border-subtle);
    border-radius: var(--z-radius);
    text-align: center;
}

.admin-stat-num {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--z-text);
    line-height: 1;
}

.admin-stat-lbl {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--z-dim);
    margin-top: var(--z-space-2);
}

.admin-stat--ok .admin-stat-num { color: var(--z-accent); }
.admin-stat--life .admin-stat-num { color: var(--z-cyan); }
.admin-stat--warn .admin-stat-num { color: var(--z-warning); }
.admin-stat--err .admin-stat-num { color: var(--z-danger); }

.info-box {
    font-size: 0.875rem;
    color: var(--z-muted);
    line-height: 1.55;
    padding: var(--z-space-4);
    background: var(--z-bg);
    border-radius: var(--z-radius-sm);
    border: 1px solid var(--z-border-subtle);
}

.info-box strong { color: var(--z-text-secondary); }

.info-box code {
    font-family: var(--z-mono);
    font-size: 0.8rem;
    color: var(--z-cyan);
}

.gen-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--z-space-4);
    align-items: end;
}

.gen-row .field {
    margin-bottom: 0;
}

.gen-row .field label {
    display: block;
    min-height: 18px;
    line-height: 18px;
}

.gen-row .input,
.gen-row .select,
.gen-row .btn {
    height: 40px;
    box-sizing: border-box;
}

.gen-row .btn {
    width: 100%;
    padding-top: 0;
    padding-bottom: 0;
}

.admin-tabs {
    display: flex;
    gap: var(--z-space-2);
    margin-bottom: var(--z-space-5);
    border-bottom: 1px solid var(--z-border-subtle);
    padding-bottom: var(--z-space-2);
}

.admin-tab {
    display: inline-flex;
    align-items: center;
    gap: var(--z-space-2);
    padding: var(--z-space-2) var(--z-space-4);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--z-muted);
    background: transparent;
    border: none;
    border-radius: var(--z-radius-sm);
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.admin-tab:hover {
    color: var(--z-text-secondary);
    background: var(--z-bg-elevated);
}

.admin-tab.is-active {
    color: var(--z-accent);
    background: var(--z-accent-muted);
}

.admin-tab-panel {
    display: flex;
    flex-direction: column;
    gap: var(--z-space-6);
}

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

.admin-quota-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--z-space-2);
    padding: var(--z-space-2) var(--z-space-3);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--z-accent);
    background: var(--z-accent-muted);
    border: 1px solid var(--z-accent-border);
    border-radius: var(--z-radius-full);
}

.team-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--z-space-4);
    align-items: end;
}

.team-form .field {
    margin-bottom: 0;
}

.team-form .input,
.team-form .select,
.team-form .btn {
    height: 40px;
    box-sizing: border-box;
}

.team-form .btn {
    width: 100%;
}

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

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.table th {
    text-align: left;
    padding: var(--z-space-3) var(--z-space-4);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--z-dim);
    border-bottom: 1px solid var(--z-border-subtle);
    background: var(--z-bg);
}

.table td {
    padding: var(--z-space-3) var(--z-space-4);
    border-bottom: 1px solid var(--z-border-subtle);
    vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }

.table .empty {
    text-align: center;
    color: var(--z-dim);
    padding: var(--z-space-8);
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge--active { background: var(--z-accent-muted); color: var(--z-accent); }
.badge--lifetime { background: var(--z-cyan-muted); color: var(--z-cyan); }
.badge--day { background: rgba(184, 169, 217, 0.12); color: var(--z-muted); }
.badge--expired { background: var(--z-warning-muted); color: var(--z-warning); }
.badge--revoked { background: var(--z-danger-muted); color: var(--z-danger); }

.key-cell {
    font-family: var(--z-mono);
    font-size: 0.72rem;
    color: var(--z-cyan);
    cursor: pointer;
    transition: color 0.15s;
}

.key-cell:hover,
.key-cell.is-copied { color: var(--z-accent); }

.key-cell:focus-visible {
    outline: 2px solid var(--z-accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.act-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.lic-days-form {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0;
}

.lic-days-input {
    width: 64px !important;
    min-width: 64px;
    padding: 4px 6px !important;
    font-size: 0.72rem !important;
}

.act {
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--z-border);
    background: transparent;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--z-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.act:hover { background: var(--z-surface-elevated); color: var(--z-text); }

.act--warn { border-color: var(--z-warning-border); color: var(--z-warning); }
.act--danger { border-color: var(--z-danger-border); color: var(--z-danger); }
.act--ok { border-color: var(--z-success-border, #166534); color: var(--z-success, #22c55e); }

.reseller-account {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.25;
}

.reseller-quota {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.82rem;
}

.reseller-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    max-width: 560px;
}

.reseller-actions form {
    margin: 0;
    display: inline-flex;
}

.reseller-actions__quota {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
}

.reseller-actions__quota-input {
    width: 52px !important;
    min-width: 52px;
    padding: 4px 6px !important;
    font-size: 0.72rem !important;
}

.reseller-actions__quota-edit {
    display: inline-flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.reseller-actions__q-label {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--z-dim);
    text-transform: uppercase;
}

.quota-plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
}

.quota-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.quota-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--z-text-secondary);
    background: var(--z-bg-elevated);
    border: 1px solid var(--z-border-subtle);
}

.quota-chip strong {
    color: var(--z-accent);
    font-variant-numeric: tabular-nums;
}

.quota-chip__meta {
    color: var(--z-dim);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.quota-chip.is-empty {
    opacity: 0.55;
}

.quota-chip.is-empty strong {
    color: var(--z-muted);
}

.lic-note-form {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    min-width: 140px;
}

.lic-note-input {
    width: 110px !important;
    min-width: 90px;
    padding: 4px 6px !important;
    font-size: 0.72rem !important;
}

.act--manage {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

html.portal-modal-open {
    overflow: hidden;
}

.portal-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.portal-modal[hidden] {
    display: none !important;
}

.portal-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(34, 22, 59, 0.72);
    border: 0;
    cursor: pointer;
}

.portal-modal__panel {
    position: relative;
    width: min(440px, 100%);
    max-height: min(90vh, 720px);
    overflow: auto;
    background: var(--z-bg-elevated, #2a1c48);
    border: 1px solid var(--z-border);
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
    padding: 20px;
}

.portal-modal__panel--keys {
    width: min(420px, 100%);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.portal-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.portal-modal__head h3 {
    margin: 0;
    font-size: 1.15rem;
}

.portal-modal__key {
    margin: 6px 0 0;
    font-family: var(--z-mono);
    font-size: 0.82rem;
    color: var(--z-cyan);
}

.portal-modal__meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 18px;
    padding: 12px;
    border-radius: 10px;
    background: var(--z-bg, #22163b);
    border: 1px solid var(--z-border-subtle);
}

.portal-modal__meta > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.portal-modal__meta span {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--z-dim);
}

.portal-modal__meta strong {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--z-text-secondary);
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
}

.portal-modal__meta-wide {
    grid-column: 1 / -1;
}

.portal-modal__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.portal-modal__action {
    margin: 0;
}

.portal-modal__action .btn {
    width: 100%;
    justify-content: center;
}

.portal-modal__action[hidden] {
    display: none !important;
}

.portal-modal__days .label {
    margin-bottom: 6px;
}

.portal-modal__days-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    align-items: center;
}

.portal-modal__days-row .input {
    height: 40px;
}

.portal-modal__gen-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.portal-modal__gen-form .btn--full {
    width: 100%;
    justify-content: center;
    margin-top: 4px;
}

    margin: 0 0 18px;
    padding: 12px;
    border-radius: 10px;
    background: var(--z-bg, #22163b);
    border: 1px solid var(--z-border-subtle);
}

.portal-modal__quota-block > .label {
    display: block;
    margin-bottom: 8px;
}

.portal-modal__quota-block .quota-chips {
    margin-bottom: 14px;
}

.portal-modal__quota-add {
    margin: 0;
}

.portal-modal__quota-add-row {
    display: grid;
    grid-template-columns: 72px repeat(4, minmax(0, 1fr));
    gap: 6px;
    align-items: center;
}

.portal-modal__quota-add-row .input {
    height: 40px;
    text-align: center;
}

.portal-modal__quota-add-row .btn {
    width: 100%;
    justify-content: center;
    padding-left: 6px;
    padding-right: 6px;
}

@media (max-width: 520px) {
    .portal-modal__quota-add-row {
        grid-template-columns: 1fr 1fr;
    }

    .portal-modal__quota-add-row .input {
        grid-column: 1 / -1;
    }
}

html.portal-confirm-open {
    overflow: hidden;
}

.portal-confirm {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.portal-confirm[hidden] {
    display: none !important;
}

.portal-confirm__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(34, 22, 59, 0.78);
    border: 0;
    cursor: pointer;
}

.portal-confirm__panel {
    position: relative;
    width: min(400px, 100%);
    background: var(--z-bg-elevated, #2a1c48);
    border: 1px solid var(--z-border);
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    padding: 22px;
}

.portal-confirm__panel.is-danger {
    border-color: var(--z-danger-border);
}

.portal-confirm__msg {
    margin: 8px 0 18px;
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--z-text-secondary);
}

.portal-confirm__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.portal-confirm__actions .btn {
    min-width: 96px;
    justify-content: center;
}

.portal-confirm__panel.is-danger [data-confirm-ok] {
    background: var(--z-danger);
    border-color: var(--z-danger);
    color: #fff;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
    .login-shell { grid-template-columns: 1fr; min-height: auto; }
    .login-hero { border-right: none; border-bottom: 1px solid var(--z-border-subtle); padding: var(--z-space-8) var(--z-space-6); }
    .login-copy { display: none; }
    .login-panel { padding: var(--z-space-8) var(--z-space-6); }
    .sync-row { grid-template-columns: 1fr; }
    .admin-stats { grid-template-columns: repeat(2, 1fr); }

    .app-menu-toggle { display: inline-flex; }

    .app-header-actions {
        display: none;
        position: absolute;
        top: calc(100% + 1px);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: var(--z-space-2);
        padding: var(--z-space-4);
        background: rgba(34, 22, 59, 0.97);
        border-bottom: 1px solid var(--z-border-subtle);
        box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
        z-index: 60;
    }

    .app-header.is-nav-open .app-header-actions {
        display: flex;
    }

    .app-header-actions .btn {
        width: 100%;
        justify-content: flex-start;
        min-height: 44px;
    }

    .app-nav-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 40;
        background: rgba(0, 0, 0, 0.45);
        backdrop-filter: blur(2px);
    }

    .app-nav-overlay[hidden] {
        display: none;
    }

    html.is-nav-open {
        overflow: hidden;
    }
}

@media (max-width: 600px) {
    .app-header { padding: var(--z-space-3) var(--z-space-4); }
    .app-main { padding: var(--z-space-4); }
    .app-brand h1 { font-size: 0.85rem; }
    .pill { display: none; }
}
