/* ==========================================================================
   Admin console — themed layer over design-tokens.css + ui.css.

   The admin console deliberately does not look like the developer portal.
   Amber is the privilege accent (set by [data-theme="admin"] in the token
   file), a red rail runs across the top of the shell, and tables run denser
   than the developer-facing ones.
   ========================================================================== */

/* --- Privilege rail ----------------------------------------------------- */
.privilege-rail {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 3px;
    z-index: 200;
    background: var(--gradient-brand);
}
.shell { padding-top: 3px; }

/* --- Sidebar identity --------------------------------------------------- */
.brand-stack { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.brand-name { font-size: var(--fs-md); line-height: 1.2; }
.brand-stack .admin-chip { align-self: flex-start; }

.admin-chip {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.12em;
    padding: 0.125rem 0.375rem;
    border-radius: var(--r-sm);
    background: var(--brand-subtle);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: var(--brand-ink);
}

/* Environment badge — the strongest signal that actions here are real. */
.env-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 0.25rem 0.625rem;
    border-radius: var(--r-sm);
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid;
}
.env-badge--production {
    background: rgba(220, 38, 38, 0.15);
    border-color: rgba(220, 38, 38, 0.5);
    color: #fca5a5;
}
.env-badge--other {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text-muted);
}
.env-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* --- Auth --------------------------------------------------------------- */
.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: var(--sp-6);
    background:
        radial-gradient(55rem 38rem at 78% -12%, rgba(245, 158, 11, 0.14), transparent 60%),
        radial-gradient(45rem 35rem at -8% 110%, rgba(239, 68, 68, 0.10), transparent 60%),
        var(--bg);
}
.auth__card {
    width: min(26rem, 100%);
    background: var(--surface-1);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-3);
    padding: var(--sp-8);
}
.auth__brand {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    color: var(--text);
    font-weight: 700;
    margin-bottom: var(--sp-6);
}
.auth__brand:hover { text-decoration: none; }
.auth__brand .logo-mark { width: 24px; height: 24px; flex: none; }
.auth__card h1 { font-size: var(--fs-xl); margin-bottom: var(--sp-2); }
.auth__card > p { color: var(--text-muted); font-size: var(--fs-md); margin-bottom: var(--sp-6); }
.auth__back { display: block; text-align: center; margin-top: var(--sp-5); font-size: var(--fs-md); }

.field--password { position: relative; }
.field--password .field__input { padding-right: 2.75rem; }
.field--password .reveal {
    position: absolute;
    right: 6px;
    top: 2.05rem;
    width: 32px; height: 32px;
    display: grid;
    place-items: center;
    background: none;
    border: 0;
    border-radius: var(--r-sm);
    color: var(--text-muted);
    cursor: pointer;
}
.field--password .reveal:hover { color: var(--text); }

/* --- Professional operator sign-in ------------------------------------ */
.auth-shell {
    width: min(68rem, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(22rem, 27rem);
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: calc(var(--r-xl) + 0.25rem);
    background: var(--surface-1);
    box-shadow: var(--shadow-3);
}
.auth__story {
    position: relative;
    min-height: 34rem;
    display: flex;
    flex-direction: column;
    padding: clamp(2rem, 5vw, 4.5rem);
    background:
        linear-gradient(145deg, rgba(245, 158, 11, 0.12), transparent 44%),
        radial-gradient(circle at 88% 16%, rgba(239, 68, 68, 0.18), transparent 30%),
        var(--surface-2);
}
.auth__story .auth__brand { margin-bottom: auto; }
.auth__eyebrow, .auth__kicker { color: var(--brand-ink); font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.auth__story h1 { max-width: 14ch; margin: var(--sp-3) 0 var(--sp-4); font-size: clamp(2.1rem, 3.8vw, 3.4rem); line-height: 1.02; letter-spacing: -0.04em; }
.auth__lead { max-width: 34rem; color: var(--text-muted); font-size: var(--fs-base); line-height: 1.55; }
.auth__story .env-badge { align-self: flex-start; margin-top: var(--sp-6); }
.auth__warning { display: grid; gap: var(--sp-1); max-width: 31rem; margin-top: var(--sp-6); padding: var(--sp-4); border: 1px solid rgba(245, 158, 11, 0.35); border-radius: var(--r-lg); background: rgba(245, 158, 11, 0.07); color: var(--text-muted); font-size: var(--fs-sm); }
.auth__warning strong { color: var(--text); }
.auth__site-link { margin-top: auto; font-size: var(--fs-sm); }
.auth__card { width: auto; border: 0; border-left: 1px solid var(--border); border-radius: 0; box-shadow: none; padding: clamp(1.75rem, 3vw, 2.75rem); }
.auth__card h2 { margin: var(--sp-3) 0 var(--sp-2); font-size: var(--fs-lg); letter-spacing: -.02em; }
.auth__card > p { color: var(--text-muted); font-size: var(--fs-md); }
.auth__google { width: 100%; min-height: 2.75rem; display: flex; align-items: center; justify-content: center; gap: var(--sp-2); margin-top: var(--sp-5); border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--surface-2); color: var(--text); font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; }
.auth__google:hover { border-color: var(--brand); background: var(--brand-subtle); }
.auth__google:disabled { cursor: wait; opacity: 0.7; }
.auth__google-mark { width: 1.25rem; height: 1.25rem; display: grid; place-items: center; flex: none; }
.auth__google-mark svg { display: block; width: 100%; height: 100%; }
.auth__google-status { min-height: 1.25rem; margin-top: var(--sp-2); text-align: center; font-size: var(--fs-sm) !important; }
.auth__divider { display: flex; align-items: center; gap: var(--sp-3); margin: var(--sp-4) 0; color: var(--text-muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.08em; }
.auth__divider::before, .auth__divider::after { content: ''; height: 1px; flex: 1; background: var(--border); }
.auth__policy { margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--border); font-size: var(--fs-sm) !important; line-height: 1.5; }
@media (max-width: 820px) {
    .auth { padding: 0; place-items: stretch; }
    .auth-shell { grid-template-columns: 1fr; border: 0; border-radius: 0; }
    .auth__story { min-height: auto; padding: var(--sp-7) var(--sp-5); }
    .auth__story .auth__brand { margin-bottom: var(--sp-8); }
    .auth__story h1 { font-size: clamp(2.2rem, 12vw, 3.5rem); }
    .auth__site-link { margin-top: var(--sp-6); }
    .auth__card { border-left: 0; border-top: 1px solid var(--border); padding: var(--sp-7) var(--sp-5); }
}

/* --- Panels ------------------------------------------------------------- */
.panel {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--sp-6);
}
.panel > h3 { font-size: var(--fs-base); margin-bottom: var(--sp-2); }
.panel__desc { font-size: var(--fs-md); color: var(--text-muted); margin-bottom: var(--sp-5); }

/* --- Recent list -------------------------------------------------------- */
.recent-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.recent-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface-1);
}
.recent-item .icon { color: var(--brand-ink); }
.recent-item strong { display: block; color: var(--text); font-size: var(--fs-md); overflow-wrap: anywhere; }
.recent-item .meta { font-size: var(--fs-sm); color: var(--text-muted); }

/* --- Dense table extras ------------------------------------------------- */
.mono-cell {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--text-muted);
}
.email-cell {
    color: var(--text);
    font-weight: 600;
    min-width: 13rem;
    overflow-wrap: break-word;
}
.reason-cell {
    max-width: 22rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
}

/* --- Plans -------------------------------------------------------------- */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--sp-5);
}
.plan-card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--sp-5);
}
.plan-card--default { border-color: rgba(245, 158, 11, 0.4); }
.plan-card__head { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.plan-card h3 { font-size: var(--fs-base); }
.plan-card__desc { font-size: var(--fs-md); color: var(--text-muted); margin-bottom: var(--sp-4); }
.plan-stats { display: flex; gap: var(--sp-6); margin-bottom: var(--sp-4); }
.plan-stat strong { display: block; font-size: var(--fs-lg); color: var(--text); font-variant-numeric: tabular-nums; }
.plan-stat span { font-size: var(--fs-sm); color: var(--text-muted); }
.plan-caps { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

/* --- Detail drawer ------------------------------------------------------ */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--sp-3);
}
.detail-item {
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
    padding: var(--sp-3);
    background: var(--surface-2);
    border-radius: var(--r-md);
}
.detail-item .label { font-size: var(--fs-sm); color: var(--text-muted); }
.detail-item .value { font-size: var(--fs-md); font-weight: 600; color: var(--text); overflow-wrap: anywhere; }

.danger-zone {
    margin-top: var(--sp-6);
    padding: var(--sp-4);
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: var(--r-lg);
    background: var(--danger-bg);
}
.danger-zone h4 {
    font-size: var(--fs-md);
    color: var(--danger);
    margin-bottom: var(--sp-2);
}
.danger-zone p { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: var(--sp-4); }
.danger-zone__actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; }

.drawer-section { margin-top: var(--sp-6); }
.drawer-section h4 { font-size: var(--fs-md); margin-bottom: var(--sp-3); }
