:root {
    /* Paper */
    --paper: #f3eee5; /* base cream */
    --paper-2: #ece5d6; /* slightly deeper */
    --paper-3: #e3dac4; /* hover/active */
    --ink: #14110d; /* near-black, warm */
    --ink-2: #3a352d; /* secondary */
    --ink-3: #6b6457; /* muted */
    --rule: #14110d; /* hairline color */
    /* Accents */
    --stamp: #c8311a; /* sharp red stamp */
    --stamp-dim: #a52612;
    --valid: #2e5d35; /* dark forest, for [USED] */
    /* Form fields */
    --field-bg: #fbf8f0;
    --field-bg-focus: #ffffff;
    /* Typography */
    /* Type stack: Inter for body/labels (most-legible modern UI sans),
       Fraunces for display headlines (variable serif with real character),
       Geist Mono for labels-in-mono + actual code blocks (HWID, secrets,
       client snippets). */
    --serif: "Fraunces", "Times New Roman", Georgia, serif;
    --mono: "Geist Mono", "SF Mono", ui-monospace, monospace;
    --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    /* Metrics */
    --hairline: 1px;
    --rule-thick: 2px;
    --maxw: 1180px;
}

* {
    box-sizing: border-box;
}

    *::selection {
        background: var(--ink);
        color: var(--paper);
    }

/* Make the hidden attribute reliably win over author display: rules.
   Without this, .auth-view { display: flex } overrides [hidden] from the
   user-agent stylesheet and every section shows at once. */
[hidden] {
    display: none !important;
}

html, body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    /* Sans by default (Plex Sans) for prose / table cells / form inputs /
       anything that doesn't explicitly opt into mono. Kickers, monogram, code
       and form labels still use var(--mono) explicitly. */
    font-family: var(--sans);
    font-size: 13px;
    line-height: 1.55;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    /* Subtle paper grain via radial noise + warm cast */
    background-image: radial-gradient(ellipse at 10% 0%, rgba(232,210,160,0.25), transparent 55%), radial-gradient(ellipse at 90% 100%, rgba(200,49,26,0.04), transparent 55%);
    background-attachment: fixed;
    min-height: 100vh;
}

    /* Tiny noise overlay for paper texture */
    body::before {
        content: "";
        position: fixed;
        inset: 0;
        pointer-events: none;
        z-index: 0;
        opacity: 0.18;
        mix-blend-mode: multiply;
        background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.08  0 0 0 0 0.07  0 0 0 0 0.05  0 0 0 0.55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    }

main, header {
    position: relative;
    z-index: 1;
}

/* ─── Typography ────────────────────────────────────────────── */

.display {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(1.85rem, 3.2vw, 2.85rem);
    line-height: 1.02;
    letter-spacing: -0.012em;
    margin: 0;
    color: var(--ink);
}

    .display em {
        font-style: italic;
        color: var(--stamp);
    }

h3.display {
    font-size: 1.65rem;
}

.kicker {
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin: 0 0 0.6rem;
}

.muted {
    color: var(--ink-3);
}

.meta-line {
    font-size: 0.72rem;
    color: var(--ink-3);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ─── Rules (the horizontal hairlines) ──────────────────────── */
.rule {
    height: var(--hairline);
    background: var(--ink);
    margin: 1rem 0 1.5rem;
}

    .rule.rule-double {
        height: 4px;
        background: linear-gradient(var(--ink), var(--ink)) top/100% var(--hairline) no-repeat, linear-gradient(var(--ink), var(--ink)) bottom/100% var(--hairline) no-repeat;
        background-color: transparent;
    }

/* ─── Top bar ───────────────────────────────────────────────── */

header#topbar {
    padding: 1.5rem 2rem 0;
    max-width: var(--maxw);
    margin: 0 auto;
}

.topbar-inner {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.brand-mark {
    font-family: var(--mono);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.06em;
    color: var(--ink);
}

    .brand-mark .emdash {
        color: var(--stamp);
        margin: 0 0.05em;
    }

.brand-sub {
    font-family: var(--mono);
    font-size: 0.65rem;
    letter-spacing: 0.16em;
    color: var(--ink-3);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* ─── Main layout ───────────────────────────────────────────── */
main#app {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 2rem 2rem 6rem;
}

    /* Auth views are full-bleed and self-pad. When one is visible, the
       wrapper must contribute zero vertical chrome — otherwise main's
       padding pushes the body taller than the viewport and the document
       gets a scrollbar even when the auth-view itself fits perfectly. */
    main#app:has(> .auth-view:not([hidden])) {
        max-width: none;
        padding: 0;
    }

/* ─── Section heads ─────────────────────────────────────────── */
.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    margin-top: 2rem;
}

    .section-head > div {
        max-width: 36rem;
    }

    .section-head .muted {
        margin-top: 0.6rem;
    }

.head-actions {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ─── Buttons ───────────────────────────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    font-weight: 500;
    text-transform: uppercase;
    padding: 0.72rem 1.1rem;
    background: var(--ink);
    color: var(--paper);
    border: var(--hairline) solid var(--ink);
    cursor: pointer;
    transition: transform 0.08s ease, background 0.12s ease;
}

    .btn-primary:hover {
        background: var(--stamp);
        border-color: var(--stamp);
    }

    .btn-primary:active {
        transform: translateY(1px);
    }

    .btn-primary[disabled] {
        opacity: 0.5;
        cursor: progress;
    }

    .btn-primary .btn-arrow {
        transition: transform 0.12s ease;
    }

    .btn-primary:hover .btn-arrow {
        transform: translateX(2px);
    }

.btn-ghost {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    font-weight: 500;
    text-transform: uppercase;
    padding: 0.6rem 0.95rem;
    background: transparent;
    color: var(--ink);
    border: var(--hairline) solid var(--ink);
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

    .btn-ghost:hover {
        background: var(--ink);
        color: var(--paper);
    }

    .btn-ghost.danger {
        color: var(--stamp);
        border-color: var(--stamp);
    }

        .btn-ghost.danger:hover {
            background: var(--stamp);
            color: var(--paper);
        }

    .btn-ghost[disabled] {
        opacity: 0.4;
        cursor: not-allowed;
        pointer-events: none;
    }

.link {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink);
    padding: 0;
    border-bottom: var(--hairline) solid transparent;
    transition: color 0.12s ease, border-color 0.12s ease;
}

    .link:hover {
        color: var(--stamp);
        border-bottom-color: var(--stamp);
    }

    .link .arrow {
        font-family: var(--serif);
        font-size: 0.95rem;
    }

.back-link {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
    padding: 0;
    transition: color 0.12s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

    .back-link:hover {
        color: var(--ink);
    }

    .back-link .back-arrow {
        font-family: var(--serif);
        font-size: 1.1rem;
        transition: transform 0.12s ease;
    }

    .back-link:hover .back-arrow {
        transform: translateX(-2px);
    }

/* ─── Forms ─────────────────────────────────────────────────── */
.form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    max-width: 28rem;
}

    .form .field {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
    }

    .form label {
        font-family: var(--mono);
        font-size: 0.65rem;
        font-weight: 500;
        letter-spacing: 0.16em;
        text-transform: uppercase;
        color: var(--ink-3);
    }

    .form input, .form select {
        font-family: var(--mono);
        font-size: 0.9rem;
        padding: 0.65rem 0.8rem;
        background: var(--field-bg);
        border: var(--hairline) solid var(--ink);
        color: var(--ink);
        border-radius: 0;
        transition: background 0.12s ease, box-shadow 0.12s ease;
    }

        .form input:focus, .form select:focus {
            outline: none;
            background: var(--field-bg-focus);
            box-shadow: inset 0 -2px 0 0 var(--stamp);
        }

        .form input::placeholder {
            color: var(--ink-3);
            opacity: 0.55;
        }

.field-hint {
    font-size: 0.7rem;
    color: var(--ink-3);
    letter-spacing: 0.02em;
}

.field-error {
    font-size: 0.7rem;
    color: var(--stamp);
    letter-spacing: 0.02em;
    min-height: 1em;
}

/* ─── Auth views (setup/login) ──────────────────────────────── */
.auth-view {
    /* Lock to exactly the viewport so the document never scrolls. If the
       auth content ever genuinely exceeds the viewport (very short screens,
       phone in landscape, devtools open), the scrollbar shows up INSIDE
       this container — not on the body. The dvh fallback handles mobile
       browsers where the URL bar shrinks the visible area. */
    height: 100vh;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

/* ── Page marginalia (corner marks + spine text on auth views) ── */
.page-marks {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    color: var(--ink-3);
    text-transform: uppercase;
}

.page-mark {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 1.6rem 1.8rem;
}

    .page-mark.top-left {
        top: 0;
        left: 0;
    }

    .page-mark.top-right {
        top: 0;
        right: 0;
    }

    .page-mark.bottom-left {
        bottom: 0;
        left: 0;
    }

    .page-mark.bottom-right {
        bottom: 0;
        right: 0;
    }

.crop-mark {
    width: 12px;
    height: 12px;
    position: relative;
    flex-shrink: 0;
}

    .crop-mark::before, .crop-mark::after {
        content: "";
        position: absolute;
        background: var(--ink-3);
    }

    .crop-mark::before {
        left: 50%;
        top: 0;
        bottom: 0;
        width: 1px;
        transform: translateX(-50%);
    }

    .crop-mark::after {
        top: 50%;
        left: 0;
        right: 0;
        height: 1px;
        transform: translateY(-50%);
    }

.page-spine {
    position: absolute;
    left: 1.4rem;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
}

    .page-spine span {
        writing-mode: vertical-rl;
        transform: rotate(180deg);
        font-family: var(--mono);
        font-size: 0.62rem;
        letter-spacing: 0.45em;
        color: var(--ink-3);
        opacity: 0.55;
        white-space: nowrap;
    }

@media (max-width: 820px) {
    .page-marks {
        display: none;
    }
}

/* ── Refined editorial auth card (login / setup / register) ───────────
   A single centered card. (The legacy .auth-frame / .auth-mark split-panel
   layout it replaced has been removed.) */
.auth-card {
    width: 100%;
    max-width: 460px;
    background: var(--paper-2);
    border: var(--hairline) solid var(--ink);
    box-shadow: 2px 2px 0 var(--ink);
    padding: 2.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    position: relative;
    z-index: 2;
}

.auth-card-head {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-bottom: 1.1rem;
    border-bottom: var(--hairline) solid var(--ink);
}

.auth-monogram {
    font-family: var(--mono);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.32em;
    color: var(--ink);
    line-height: 1;
}

.auth-tagline {
    font-family: var(--mono);
    font-size: 0.6rem;
    letter-spacing: 0.22em;
    color: var(--ink-3);
    text-transform: uppercase;
}

.auth-title {
    margin: 0;
    font-family: var(--serif);
    font-style: italic;
    font-weight: 400;
    font-size: 2rem;
    line-height: 1.05;
    color: var(--ink);
}

.auth-sub {
    margin: 0.4rem 0 0;
    color: var(--ink-3);
    font-size: 0.9rem;
    line-height: 1.5;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    max-width: none;
}

.auth-submit {
    width: 100%;
    justify-content: center;
}

.auth-alt {
    margin: 0.25rem 0 0;
    padding-top: 1.25rem;
    border-top: var(--hairline) solid var(--ink);
    text-align: center;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: var(--ink-3);
}

.auth-alt a {
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid var(--ink);
    padding-bottom: 1px;
    transition: color 120ms, border-color 120ms;
}

.auth-alt a:hover {
    color: var(--stamp);
    border-bottom-color: var(--stamp);
}

.auth-foot {
    /* Center on its own midpoint so width = content. Avoids edge cases where
       left:0/right:0 fails to stretch the element (e.g. a transformed ancestor
       that becomes the containing block, or a horizontal scrollbar). */
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-family: var(--mono);
    font-size: 0.6rem;
    letter-spacing: 0.22em;
    color: var(--ink-3);
    text-transform: uppercase;
    z-index: 1;
    pointer-events: none;
}

@media (max-width: 480px) {
    .auth-card { padding: 1.75rem 1.4rem; gap: 1.1rem; }
    .auth-title { font-size: 1.7rem; }
    .auth-foot { display: none; }
}

/* ─── Modern auth — "Mono" ──────────────────────────────────────────────
   Pure black & white minimal. No color anywhere — the only chrome is value
   (lightness). Light + dark adaptive via [data-theme="dark"]. Scoped to
   body.modern-auth so reverting is one class-name removal. */

body.modern-auth {
    /* Light mode: paper white. */
    --m-bg: #f7f7f8;                                     /* off-white */
    --m-card-bg: #ffffff;                                /* card */
    --m-ink: #0a0a0a;                                    /* near-black */
    --m-ink-2: #4a4a4a;                                  /* body */
    --m-ink-3: #8a8a8a;                                  /* meta */
    --m-border: #ececee;                                 /* hairline */
    --m-border-strong: #d4d4d6;                          /* input */
    --m-input-bg: #ffffff;
    --m-accent: #0a0a0a;                                 /* solid ink CTA */
    --m-accent-hover: #1f1f1f;
    --m-accent-soft: rgba(10, 10, 10, 0.08);
    --m-error: #1a1a1a;                                  /* even errors stay grey */
    --m-shadow:                                         /* == dash-pro --shadow-lg */
        0 16px 40px -16px rgba(0, 0, 0, 0.12),
        0 8px 24px -8px rgba(0, 0, 0, 0.06);
    color: var(--m-ink);
    background-color: var(--m-bg);
    background-image: none;
    overflow: hidden;
}

body.modern-auth::before { display: none; }
body.modern-auth::after  { display: none; }

/* Dark mode: deep ink. */
[data-theme="dark"] body.modern-auth {
    --m-bg: #0a0a0a;
    --m-card-bg: #131313;
    --m-ink: #f5f5f5;
    --m-ink-2: #b8b8b8;
    --m-ink-3: #6e6e6e;
    --m-border: #232323;
    --m-border-strong: #333333;
    --m-input-bg: #0f0f0f;
    --m-accent: #f5f5f5;                                 /* solid white CTA */
    --m-accent-hover: #ffffff;
    --m-accent-soft: rgba(245, 245, 245, 0.1);
    --m-error: #e5e5e5;
    --m-shadow:
        0 24px 60px -20px rgba(0, 0, 0, 0.85),
        0 12px 30px -12px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    background-color: var(--m-bg);
    background-image: none;
}

@media (prefers-reduced-motion: reduce) {
    .modern-auth .auth-card { transition: none; }
    .modern-auth .reveal { animation: none; }
}

.modern-auth .auth-view {
    background: transparent;
    z-index: 2;
}

.modern-auth .auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--m-card-bg);
    border: 1px solid var(--m-border);
    border-radius: 16px;
    box-shadow: var(--m-shadow);
    padding: 2.5rem 2.25rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    position: relative;
    z-index: 2;
}

.modern-auth .auth-title {
    margin: 0;
    font-family: var(--sans);
    font-style: normal;
    font-weight: 650;
    font-size: 1.6rem;
    line-height: 1.25;
    color: var(--m-ink);
    text-align: center;
    letter-spacing: -0.02em;
}

.modern-auth .auth-sub {
    margin: -0.55rem 0 0.4rem;
    color: var(--m-ink-2);
    font-size: 0.92rem;
    line-height: 1.55;
    text-align: center;
    font-family: var(--sans);
}

.modern-auth .auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: none;
}

.modern-auth .auth-card .field label {
    display: block;
    font-family: var(--sans);
    font-weight: 550;
    font-size: 0.82rem;
    color: var(--m-ink-2);
    margin-bottom: 0.4rem;
    text-transform: none;
    letter-spacing: 0;
}

.modern-auth .auth-card .field input {
    width: 100%;
    background: var(--m-input-bg);
    border: 1px solid var(--m-border-strong);
    border-radius: 10px;
    padding: 0.72rem 0.9rem;
    font-family: var(--sans);
    font-size: 0.94rem;
    color: var(--m-ink);
    transition: border-color 140ms, box-shadow 180ms, background 140ms;
}

.modern-auth .auth-card .field input::placeholder {
    color: var(--m-ink-3);
}

.modern-auth .auth-card .field input:hover:not(:focus) {
    border-color: var(--m-ink-3);
}

.modern-auth .auth-card .field input:focus {
    outline: none;
    border-color: var(--m-ink);
    box-shadow: 0 0 0 3px var(--m-accent-soft);
}

.modern-auth .auth-card .field-hint {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.76rem;
    color: var(--m-ink-3);
    font-family: var(--sans);
}

.modern-auth .auth-card .field-error {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.78rem;
    color: var(--m-error);
    font-family: var(--sans);
    font-weight: 500;
}

.modern-auth .auth-card .btn-primary {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    background: var(--m-accent);
    color: var(--m-card-bg);                             /* inverts with theme */
    border: 1px solid var(--m-accent);
    border-radius: 10px;
    padding: 0.82rem 1rem;
    font-family: var(--sans);
    font-weight: 600;
    font-size: 0.94rem;
    letter-spacing: 0.005em;
    text-transform: none;
    cursor: pointer;
    transition: transform 140ms, background 160ms, color 160ms, box-shadow 200ms;
    margin-top: 0.4rem;
    box-shadow: none;
}

.modern-auth .auth-card .btn-primary:hover {
    transform: translateY(-1px);
    background: var(--m-accent-hover);
    box-shadow: 0 8px 18px -8px rgba(0, 0, 0, 0.35);
}

.modern-auth .auth-card .btn-primary:active {
    transform: translateY(0);
}

.modern-auth .auth-card .btn-primary[disabled] {
    opacity: 0.55;
    cursor: progress;
    transform: none;
}

.modern-auth .auth-card .btn-primary .btn-arrow { display: none; }

/* ── Loading state: replace the global red bottom-bar with a centered
   ring spinner. `currentColor` makes it adopt the button's text color, so
   it inverts cleanly between light (white spinner on black btn) and dark
   (black spinner on white btn). */
.modern-auth .auth-card .btn-primary.loading {
    cursor: progress;
}

.modern-auth .auth-card .btn-primary.loading .btn-label {
    opacity: 0;
    transition: opacity 120ms;
}

.modern-auth .auth-card .btn-primary.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    background: transparent;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: authBtnSpin 0.7s linear infinite;
    transform-origin: center;
}

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

@media (prefers-reduced-motion: reduce) {
    .modern-auth .auth-card .btn-primary.loading::after {
        animation: authBtnPulse 1.4s ease-in-out infinite;
        border-top-color: currentColor;
    }
    @keyframes authBtnPulse {
        0%, 100% { opacity: 0.35; }
        50%      { opacity: 1; }
    }
}

.modern-auth .auth-alt {
    margin: 0.5rem 0 0;
    padding-top: 1.25rem;
    border-top: 1px solid var(--m-border);
    text-align: center;
    font-family: var(--sans);
    font-size: 0.88rem;
    color: var(--m-ink-2);
    text-transform: none;
    letter-spacing: 0;
}

.modern-auth .auth-alt a {
    color: var(--m-ink);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid var(--m-border-strong);
    padding-bottom: 1px;
    transition: border-color 140ms;
}

.modern-auth .auth-alt a:hover {
    border-bottom-color: var(--m-ink);
}

.modern-auth .auth-foot {
    font-family: var(--sans);
    font-size: 0.76rem;
    letter-spacing: 0;
    color: var(--m-ink-3);
    text-transform: none;
}

/* ── Theme toggle (fixed, top-right). Two stacked SVGs; CSS hides the
   one not matching current data-theme. */
.theme-toggle {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--m-card-bg, #ffffff);
    color: var(--m-ink, #0a0a0a);
    border: 1px solid var(--m-border, #ececee);
    border-radius: 50%;
    cursor: pointer;
    z-index: 100;
    transition: background 160ms, color 160ms, border-color 160ms, transform 140ms;
}

.theme-toggle:hover {
    transform: translateY(-1px);
    border-color: var(--m-ink-3, #8a8a8a);
}

.theme-toggle:active { transform: translateY(0); }

.theme-toggle svg { display: block; }

/* Light theme shows moon (click → go dark). Dark theme shows sun. */
.theme-toggle .t-sun  { display: none; }
.theme-toggle .t-moon { display: block; }
[data-theme="dark"] .theme-toggle .t-sun  { display: block; }
[data-theme="dark"] .theme-toggle .t-moon { display: none; }

@media (max-width: 480px) {
    .modern-auth .auth-card {
        padding: 2rem 1.5rem 1.6rem;
        border-radius: 14px;
    }
    .modern-auth .auth-title { font-size: 1.35rem; }
    .modern-auth .auth-foot { display: none; }
    .theme-toggle { top: 0.85rem; right: 0.85rem; width: 34px; height: 34px; }
}

/* ═══════════════════════════════════════════════════════════════════
   ░ Customer portal — uses the modern-auth template ──────────────
   Login + transient states share the standard .auth-card.
   Dashboard view uses a wider .portal-dash-card variant with
   subscription / download / info-grid sections inside.
   ═══════════════════════════════════════════════════════════════════ */

/* Loading state — CSS ring spinner centered in the auth card. */
.modern-auth .portal-loading-card {
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    min-height: 180px;
}

.modern-auth .portal-spinner {
    width: 42px;
    height: 42px;
    border: 3px solid var(--m-border);
    border-top-color: var(--m-accent);
    border-radius: 50%;
    animation: portalSpin 0.75s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    .modern-auth .portal-spinner {
        animation-duration: 2.5s;
    }
}

.modern-auth .portal-dash-card {
    max-width: 560px;
    padding: 2rem 2rem 1.75rem;
    gap: 1.1rem;
}

.modern-auth .portal-dash-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding-bottom: 1.1rem;
    border-bottom: 1px solid var(--m-border);
    margin-bottom: 0.25rem;
    text-align: left;
}

.modern-auth .portal-dash-head .auth-title {
    text-align: left;
    font-size: 1.35rem;
    margin: 0;
}

.modern-auth .portal-dash-head .auth-title em {
    font-style: normal;
    color: var(--m-accent);
}

.modern-auth .portal-dash-head .auth-sub {
    text-align: left;
    margin: 0 0 0.15rem;
    font-size: 0.7rem;
    color: var(--m-ink-3);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 600;
}

.modern-auth .portal-logout-btn {
    flex-shrink: 0;
    background: transparent;
    color: var(--m-ink-2);
    border: 1px solid var(--m-border-strong);
    border-radius: 8px;
    padding: 0.45rem 0.75rem;
    font-family: var(--sans);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.modern-auth .portal-logout-btn:hover {
    background: var(--m-accent-soft);
    color: var(--m-ink);
    border-color: var(--m-ink-3);
}

.modern-auth .portal-logout-btn .arrow {
    margin-left: 0.25rem;
    font-size: 0.85rem;
}

.modern-auth .portal-section-label {
    font-family: var(--sans);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--m-ink-3);
    margin: 0 0 0.3rem;
    display: block;
}

/* Subscription card — inset surface */
.modern-auth .portal-sub-card {
    background: var(--m-input-bg);
    border: 1px solid var(--m-border);
    border-radius: 12px;
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.modern-auth .portal-sub-status {
    margin: 0;
    font-family: var(--sans);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--m-ink);
    letter-spacing: -0.015em;
}

.modern-auth .portal-sub-status.ok,
.modern-auth .portal-sub-status.active { color: #15803d; }
.modern-auth .portal-sub-status.expired,
.modern-auth .portal-sub-status.warn   { color: #b45309; }
.modern-auth .portal-sub-status.banned,
.modern-auth .portal-sub-status.danger { color: #b91c1c; }

[data-theme="dark"] .modern-auth .portal-sub-status.ok,
[data-theme="dark"] .modern-auth .portal-sub-status.active { color: #4ade80; }
[data-theme="dark"] .modern-auth .portal-sub-status.expired,
[data-theme="dark"] .modern-auth .portal-sub-status.warn   { color: #fbbf24; }
[data-theme="dark"] .modern-auth .portal-sub-status.banned,
[data-theme="dark"] .modern-auth .portal-sub-status.danger { color: #f87171; }

.modern-auth .portal-sub-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem 1.25rem;
    border-top: 1px solid var(--m-border);
    padding-top: 0.75rem;
}

.modern-auth .portal-sub-meta > div {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.modern-auth .portal-sub-value {
    font-family: var(--sans);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--m-ink);
    font-variant-numeric: tabular-nums;
}

/* Download / external-link cards */
.modern-auth .portal-download-card {
    background: var(--m-input-bg);
    border: 1px solid var(--m-border);
    border-radius: 12px;
    padding: 0.9rem 1.15rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.modern-auth .portal-download-card > div { flex: 1; min-width: 0; }

.modern-auth .portal-download-name {
    font-family: var(--sans);
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--m-ink);
    margin: 0.2rem 0;
    word-break: break-all;
}

.modern-auth #portal-link-url {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--m-ink-2);
}

.modern-auth .portal-download-card .muted {
    margin: 0;
    font-size: 0.78rem;
    color: var(--m-ink-3);
}

.modern-auth .portal-download-card .btn-primary {
    flex-shrink: 0;
    width: auto;
    padding: 0.55rem 1rem;
}

/* Info grid */
.modern-auth .portal-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem 1.25rem;
    background: var(--m-card-bg);
    border: 1px solid var(--m-border);
    border-radius: 12px;
    padding: 1rem 1.15rem;
}

.modern-auth .portal-info-grid > div {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.modern-auth .portal-info-wide {
    grid-column: 1 / -1;
}

.modern-auth .portal-info-grid span:not(.portal-section-label),
.modern-auth .portal-info-grid code {
    font-family: var(--sans);
    font-size: 0.85rem;
    color: var(--m-ink);
    word-break: break-all;
}

.modern-auth .portal-info-grid code {
    font-family: var(--mono);
    font-size: 0.76rem;
    background: var(--m-input-bg);
    padding: 0.3rem 0.5rem;
    border-radius: 5px;
    border: 1px solid var(--m-border);
    color: var(--m-ink-2);
}

/* Mobile: collapse the 2-col grids */
@media (max-width: 540px) {
    .modern-auth .portal-dash-card { padding: 1.5rem 1.25rem; }
    .modern-auth .portal-sub-meta,
    .modern-auth .portal-info-grid {
        grid-template-columns: 1fr;
    }
    .modern-auth .portal-download-card {
        flex-direction: column;
        align-items: stretch;
    }
    .modern-auth .portal-download-card .btn-primary {
        width: 100%;
    }
}

/* ─── Landing page (public/index.html, anon /) ──────────────────────────
   Pure marketing surface — no JS. Reuses the brand tokens (paper/ink/mono,
   stamp red) so it reads as the same product as the dashboard. */
.landing-body { min-height: 100vh; }

.landing-nav {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.4rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    position: relative;
    z-index: 2;
}

.landing-brand {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    text-decoration: none;
    color: var(--ink);
    line-height: 1;
}

.landing-monogram {
    font-family: var(--mono);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.32em;
    color: var(--ink);
}

.landing-brand-sub {
    font-family: var(--mono);
    font-size: 0.58rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.landing-nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.landing-nav-link {
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 120ms;
}
.landing-nav-link:hover { border-bottom-color: var(--ink); }

.landing {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem 2rem 4rem;
    position: relative;
    z-index: 2;
}

/* Hero */
.landing-hero {
    padding: 4rem 0 4.5rem;
    max-width: 720px;
}

.landing-eyebrow { margin-bottom: 1.5rem; }

.landing-headline {
    margin: 0;
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(3rem, 7vw, 5.5rem);
    line-height: 0.96;
    color: var(--ink);
    letter-spacing: -0.01em;
}
.landing-headline em { font-style: italic; }

.landing-deck {
    margin: 1.5rem 0 2rem;
    max-width: 560px;
    font-family: var(--sans);
    font-size: 1.1rem;
    line-height: 1.55;
    color: var(--ink-2);
}

.landing-hero-actions {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.landing-hero-foot {
    margin: 0;
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    color: var(--ink-3);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.landing-hero-foot code {
    font-family: var(--mono);
    color: var(--ink);
    text-transform: none;
    letter-spacing: 0;
}

.dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--stamp);
    flex-shrink: 0;
}

.landing-rule {
    max-width: 1100px;
    margin: 0 auto;
    height: 0;
    border-top: var(--hairline) solid var(--ink);
    position: relative;
    z-index: 2;
}

.landing-section { padding: 4rem 0; }

.landing-section-head {
    margin-bottom: 2.5rem;
    max-width: 720px;
}

.landing-h2 {
    margin: 0.5rem 0 0;
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(2.2rem, 4vw, 3rem);
    line-height: 1.05;
    color: var(--ink);
    letter-spacing: -0.005em;
}
.landing-h2 em { font-style: italic; }

.landing-prose {
    margin: 1.2rem 0 0;
    max-width: 600px;
    font-family: var(--sans);
    font-size: 1.02rem;
    line-height: 1.65;
    color: var(--ink-2);
}
.landing-prose em { font-style: italic; color: var(--ink); }

/* Feature grid (border-collapse trick: outer borders + per-cell right/bottom) */
.landing-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    border-top: var(--hairline) solid var(--ink);
    border-left: var(--hairline) solid var(--ink);
}

.landing-feature {
    padding: 1.8rem 1.6rem;
    border-right: var(--hairline) solid var(--ink);
    border-bottom: var(--hairline) solid var(--ink);
    background: var(--paper-2);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.landing-feature .kicker {
    margin: 0;
    color: var(--stamp);
}

.landing-feature-title {
    margin: 0;
    font-family: var(--serif);
    font-style: italic;
    font-weight: 400;
    font-size: 1.5rem;
    line-height: 1.15;
    color: var(--ink);
}

.landing-feature-body {
    margin: 0;
    font-family: var(--sans);
    font-size: 0.97rem;
    line-height: 1.55;
    color: var(--ink-2);
}

/* Why section */
.landing-why {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 3rem;
    align-items: start;
}

.landing-creed {
    list-style: none;
    margin: 0;
    padding: 1.5rem;
    background: var(--paper-2);
    border: var(--hairline) solid var(--ink);
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
    font-family: var(--sans);
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--ink-2);
}

.landing-creed li {
    display: flex;
    align-items: baseline;
    gap: 0.7rem;
}

/* Invite CTA strip — inverts in dark mode (intentional surface change) */
.landing-cta {
    padding: 3.5rem 2.5rem;
    background: var(--ink);
    color: var(--paper);
    margin-top: 1rem;
}

.landing-cta .kicker { color: var(--paper-2); }
.landing-cta-h { color: var(--paper); }
.landing-cta .landing-prose { color: var(--paper-2); max-width: 620px; }
.landing-cta .landing-prose em { color: var(--paper); }

.landing-cta-btn {
    margin-top: 1.5rem;
    background: var(--paper);
    color: var(--ink);
    border-color: var(--paper);
}
.landing-cta-btn:hover {
    background: var(--stamp);
    color: var(--paper);
    border-color: var(--stamp);
}

/* Footer */
.landing-foot {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    border-top: var(--hairline) solid var(--ink);
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--ink-3);
    position: relative;
    z-index: 2;
}

.landing-foot-left,
.landing-foot-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.landing-foot-meta {
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.landing-foot-link {
    color: var(--ink-3);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 120ms, border-color 120ms;
}
.landing-foot-link:hover {
    color: var(--ink);
    border-bottom-color: var(--ink);
}

@media (max-width: 800px) {
    .landing-nav { padding: 1rem 1.2rem; }
    .landing-nav-links { gap: 0.9rem; }
    .landing { padding: 0.5rem 1.2rem 3rem; }
    .landing-hero { padding: 2.5rem 0 3rem; }
    .landing-features { grid-template-columns: 1fr; }
    .landing-why { grid-template-columns: 1fr; gap: 1.5rem; }
    .landing-cta { padding: 3rem 1.5rem; }
    .landing-foot {
        flex-direction: column;
        align-items: flex-start;
        padding: 1.5rem 1.2rem;
    }
}

@media (max-width: 480px) {
    .landing-brand-sub { display: none; }
    .landing-nav-link { display: none; }
}

/* ─── Apps grid ─────────────────────────────────────────────── */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0;
    border-left: var(--hairline) solid var(--ink);
    border-top: var(--hairline) solid var(--ink);
}

.app-card {
    padding: 1.5rem;
    background: var(--paper);
    border-right: var(--hairline) solid var(--ink);
    border-bottom: var(--hairline) solid var(--ink);
    cursor: pointer;
    position: relative;
    transition: background 0.15s ease;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 150px;
}

    .app-card:hover {
        background: var(--paper-2);
    }

        .app-card:hover .app-card-arrow {
            transform: translate(3px, -3px);
            color: var(--stamp);
        }

.app-card-id {
    font-family: var(--mono);
    font-size: 0.65rem;
    letter-spacing: 0.18em;
    color: var(--ink-3);
    text-transform: uppercase;
}

.app-card-name {
    font-family: var(--serif);
    font-size: 1.6rem;
    line-height: 1.05;
    color: var(--ink);
    margin: 0.2rem 0 0.7rem;
}

.app-card-stats {
    font-size: 0.72rem;
    color: var(--ink-3);
    letter-spacing: 0.04em;
    display: flex;
    gap: 1rem;
    margin-top: auto;
    font-variant-numeric: tabular-nums;
}

    .app-card-stats strong {
        color: var(--ink);
        font-weight: 500;
    }

.app-card-status {
    position: absolute;
    top: 1.4rem;
    right: 1.5rem;
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.16em;
    font-weight: 500;
}

    .app-card-status.on {
        color: var(--valid);
    }

    .app-card-status.off {
        color: var(--stamp);
    }

    .app-card-status::before {
        content: "[";
    }

    .app-card-status::after {
        content: "]";
    }

.app-card-arrow {
    position: absolute;
    bottom: 1.4rem;
    right: 1.5rem;
    font-family: var(--serif);
    font-size: 1.4rem;
    color: var(--ink-3);
    transition: transform 0.15s ease, color 0.15s ease;
}

/* ─── Empty states ──────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 5rem 1.5rem;
    border: var(--hairline) dashed var(--ink);
    margin-top: 1rem;
}

    .empty-state.small {
        padding: 2.5rem 1.5rem;
    }

    .empty-state .display {
        margin-bottom: 0.6rem;
    }

    .empty-state .muted {
        margin-bottom: 1.6rem;
    }

    .empty-state .btn-primary {
        margin: 0 auto;
    }

/* ─── App detail: meta grid ─────────────────────────────────── */
.meta-grid {
    display: grid;
    grid-template-columns: max-content 1fr max-content 1fr;
    gap: 0.45rem 1.5rem;
    margin: 1.5rem 0 0;
    padding: 1.25rem 0;
    border-top: var(--hairline) solid var(--ink);
    border-bottom: var(--hairline) solid var(--ink);
    font-size: 0.85rem;
}

@media (max-width: 640px) {
    .meta-grid {
        grid-template-columns: max-content 1fr;
    }
}

.meta-grid dt {
    font-family: var(--mono);
    font-size: 0.65rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-3);
    align-self: center;
}

.meta-grid dd {
    margin: 0;
    align-self: center;
    font-variant-numeric: tabular-nums;
}

.meta-grid .copyable {
    cursor: pointer;
    border-bottom: var(--hairline) dotted var(--ink-3);
    transition: color 0.12s ease, border-color 0.12s ease;
}

    .meta-grid .copyable:hover {
        color: var(--stamp);
        border-bottom-color: var(--stamp);
    }

/* ─── Stat row ──────────────────────────────────────────────── */
.stat-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    margin: 1.5rem 0 0;
}

@media (max-width: 640px) {
    .stat-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat {
    padding: 1.4rem 1.25rem;
    border-right: var(--hairline) solid var(--ink);
    border-bottom: var(--hairline) solid var(--ink);
    border-top: var(--hairline) solid var(--ink);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

    .stat:first-child {
        border-left: var(--hairline) solid var(--ink);
    }

@media (max-width: 640px) {
    .stat:nth-child(odd) {
        border-left: var(--hairline) solid var(--ink);
    }
}

.stat-label {
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    color: var(--ink-3);
}

.stat-value {
    font-family: var(--serif);
    font-size: 2.3rem;
    line-height: 1;
    color: var(--ink);
    /* Fraunces digits are proportional by default; tabular keeps the four
       stats (TOTAL / UNUSED / USED / BANNED) visually aligned in a row. */
    font-variant-numeric: tabular-nums;
}

    .stat-value.danger {
        color: var(--stamp);
    }

/* ─── Filter bar ────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    gap: 0;
    border: var(--hairline) solid var(--ink);
}

    .filter-bar input, .filter-bar select {
        border: none;
        background: var(--field-bg);
        padding: 0.55rem 0.75rem;
        font-family: var(--mono);
        font-size: 0.78rem;
        color: var(--ink);
    }

    .filter-bar input {
        border-right: var(--hairline) solid var(--ink);
        min-width: 14rem;
    }

        .filter-bar input:focus, .filter-bar select:focus {
            outline: none;
            background: var(--field-bg-focus);
        }

/* ─── Data table ────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    border: var(--hairline) solid var(--ink);
}

    .data-table th {
        font-family: var(--mono);
        font-size: 0.62rem;
        letter-spacing: 0.18em;
        font-weight: 500;
        text-transform: uppercase;
        color: var(--ink-3);
        text-align: left;
        padding: 0.7rem 0.85rem;
        background: var(--paper-2);
        border-bottom: var(--hairline) solid var(--ink);
        white-space: nowrap;
    }

    .data-table td {
        padding: 0.7rem 0.85rem;
        border-bottom: var(--hairline) solid var(--paper-3);
        vertical-align: middle;
        /* Inter has proportional digits — tabular keeps dates / counts / IDs
           lining up cleanly across rows in the data tables. */
        font-variant-numeric: tabular-nums;
    }

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

    .data-table tr:hover td {
        background: var(--paper-2);
    }

    /* Leading multi-select column — keep it tight and centered on the box. */
    .data-table th.col-select,
    .data-table td.col-select {
        width: 1%;
        padding-right: 0.4rem;
        text-align: center;
        white-space: nowrap;
    }

        .data-table .col-select input {
            cursor: pointer;
            accent-color: var(--ink);
            vertical-align: middle;
        }

    .data-table td.key {
        font-family: var(--mono);
        font-size: 0.78rem;
        letter-spacing: 0.02em;
        cursor: pointer;
        white-space: nowrap;
        transition: color 0.12s ease;
    }

        .data-table td.key:hover {
            color: var(--stamp);
        }

        .data-table td.key::before {
            content: "№ ";
            color: var(--ink-3);
            font-family: var(--serif);
            font-size: 0.95rem;
            margin-right: 0.2rem;
        }

.bracket-tag {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    font-weight: 500;
}

    .bracket-tag::before {
        content: "[";
        color: var(--ink-3);
    }

    .bracket-tag::after {
        content: "]";
        color: var(--ink-3);
    }

    .bracket-tag.unused {
        color: var(--ink);
    }

    .bracket-tag.used {
        color: var(--valid);
    }

    .bracket-tag.banned {
        color: var(--stamp);
    }

    /* Expired (lapsed sub) and paused (soft hold) are non-punitive states —
       muted rather than the red of a ban. The dash-pro skin lifts .expired to
       amber on its own; this is the editorial/base treatment. */
    .bracket-tag.expired,
    .bracket-tag.paused {
        color: var(--ink-3);
    }

.row-actions {
    display: flex;
    gap: 0.35rem;
    justify-content: flex-end;
}

    .row-actions .icon-btn {
        background: transparent;
        border: var(--hairline) solid var(--ink-3);
        font-family: var(--mono);
        font-size: 0.62rem;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        padding: 0.3rem 0.55rem;
        color: var(--ink-2);
        cursor: pointer;
        transition: all 0.1s ease;
    }

        .row-actions .icon-btn:hover {
            background: var(--ink);
            color: var(--paper);
            border-color: var(--ink);
        }

        .row-actions .icon-btn.danger {
            color: var(--stamp);
            border-color: var(--stamp);
        }

            .row-actions .icon-btn.danger:hover {
                background: var(--stamp);
                color: var(--paper);
            }

.date-tip {
    font-size: 0.75rem;
    color: var(--ink-3);
    letter-spacing: 0.02em;
    cursor: help;
}

/* ─── Dialogs ───────────────────────────────────────────────── */
.paper-dialog {
    background: var(--paper);
    color: var(--ink);
    border: var(--hairline) solid var(--ink);
    padding: 2rem;
    min-width: 380px;
    max-width: 92vw;
    border-radius: 0;
    box-shadow: 8px 8px 0 var(--ink);
}

    .paper-dialog.wide {
        min-width: 600px;
        max-width: 92vw;
    }

    .paper-dialog::backdrop {
        background: rgba(20, 17, 13, 0.55);
        backdrop-filter: blur(2px);
    }

    .paper-dialog .display {
        margin: 0.3rem 0 1rem;
    }

    .paper-dialog .muted {
        margin: 0 0 1.25rem;
        max-width: 36rem;
    }

    .paper-dialog .form {
        gap: 0.95rem;
        max-width: none;
    }

.dialog-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
}

.dialog-actions {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    margin-top: 0.6rem;
}

    .dialog-actions.end {
        justify-content: flex-end;
    }

.secret-block {
    display: flex;
    gap: 0;
    align-items: stretch;
    border: var(--hairline) solid var(--ink);
    background: var(--paper-2);
    margin: 0.4rem 0 1.5rem;
}

    .secret-block code {
        flex: 1;
        padding: 0.9rem 1rem;
        font-family: var(--mono);
        font-size: 0.78rem;
        word-break: break-all;
        color: var(--ink);
    }

    .secret-block .copy-btn {
        border-left: var(--hairline) solid var(--ink);
        border-width: 0 0 0 var(--hairline);
    }

.keys-reveal-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.6rem;
}

.key-list {
    border: var(--hairline) solid var(--ink);
    max-height: 360px;
    overflow-y: auto;
    background: var(--paper-2);
}

    .key-list .key-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.55rem 0.9rem;
        border-bottom: var(--hairline) solid var(--paper-3);
        font-family: var(--mono);
        font-size: 0.8rem;
    }

        .key-list .key-row:last-child {
            border-bottom: none;
        }

        .key-list .key-row:hover {
            background: var(--paper-3);
        }

        .key-list .key-row .copy-icon {
            font-family: var(--mono);
            font-size: 0.62rem;
            letter-spacing: 0.12em;
            color: var(--ink-3);
            cursor: pointer;
            transition: color 0.12s ease;
        }

            .key-list .key-row .copy-icon:hover {
                color: var(--stamp);
            }

/* ─── Toasts ────────────────────────────────────────────────── */
#toasts {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: var(--ink);
    color: var(--paper);
    border: var(--hairline) solid var(--ink);
    padding: 0.7rem 1rem;
    box-shadow: 4px 4px 0 var(--stamp);
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    min-width: 220px;
    max-width: 380px;
    animation: toastIn 0.18s ease-out;
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

    .toast.success {
        box-shadow: 4px 4px 0 var(--valid);
    }

    .toast.error {
        background: var(--stamp);
        box-shadow: 4px 4px 0 var(--ink);
    }

    .toast::before {
        content: "▸";
        color: var(--paper);
        font-family: var(--serif);
    }

    .toast.success::before {
        content: "✓";
    }

    .toast.error::before {
        content: "✕";
    }

    .toast.leaving {
        animation: toastOut 0.2s ease-in forwards;
    }

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

/* ─── Loading shimmer on async buttons ──────────────────────── */
.btn-primary.loading,
.btn-ghost.loading {
    position: relative;
    pointer-events: none;
}

    .btn-primary.loading::after,
    .btn-ghost.loading::after {
        content: "";
        position: absolute;
        left: 0;
        bottom: 0;
        height: 2px;
        width: 100%;
        background: var(--stamp);
        animation: btnLoad 0.9s ease-in-out infinite;
    }

@keyframes btnLoad {
    0% {
        transform: scaleX(0);
        transform-origin: left;
    }

    50% {
        transform: scaleX(1);
        transform-origin: left;
    }

    50.01% {
        transform-origin: right;
    }

    100% {
        transform: scaleX(0);
        transform-origin: right;
    }
}

/* ─── Page-load reveal ──────────────────────────────────────── */
.reveal {
    animation: reveal 0.35s ease-out both;
}

@keyframes reveal {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ─── Sidebar layout ────────────────────────────────────────── */
/* Body becomes a flex row only when the sidebar is visible.
   On auth views (sidebar hidden) the layout stays as before. */
body:has(#sidebar:not([hidden])) {
    display: flex;
    align-items: stretch;
}

#sidebar {
    width: 260px;
    flex-shrink: 0;
    padding: 1.75rem 1.25rem 1.25rem;
    border-right: var(--rule-thick) solid var(--ink);
    background: var(--paper-2);
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
    min-height: 100vh;
    position: sticky;
    top: 0;
    align-self: flex-start;
    z-index: 2;
    background-image: radial-gradient(ellipse at 20% 0%, rgba(232,210,160,0.35), transparent 60%);
}

/* When sidebar is visible, let main fill the remaining space */
body:has(#sidebar:not([hidden])) main#app {
    flex: 1;
    min-width: 0;
    max-width: none;
    margin: 0;
    padding: 2.5rem 2.5rem 6rem;
}

.sidebar-head {
    display: flex;
    flex-direction: column;
}

    .sidebar-head .brand-mark {
        font-size: 1.4rem;
        display: block;
    }

    .sidebar-head .brand-sub {
        font-size: 0.56rem;
        margin-top: 0.4rem;
    }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.sidebar-section {
    margin: 0 0 0.55rem;
    font-size: 0.62rem;
}

.sidebar-list {
    list-style: none;
    padding: 0.35rem 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    border-top: var(--hairline) solid var(--ink);
    border-bottom: var(--hairline) solid var(--ink);
}

    .sidebar-list li {
        margin: 0;
    }

        .sidebar-list li button {
            width: 100%;
            text-align: left;
            background: transparent;
            border: 0;
            padding: 0.5rem 0.55rem;
            font-family: var(--mono);
            font-size: 0.76rem;
            color: var(--ink);
            cursor: pointer;
            display: flex;
            align-items: baseline;
            gap: 0.55rem;
            letter-spacing: 0.02em;
            transition: background 0.12s ease, padding-left 0.12s ease;
            border-left: 2px solid transparent;
        }

            .sidebar-list li button:hover {
                background: var(--paper-3);
                padding-left: 0.8rem;
            }

            .sidebar-list li button.active {
                background: var(--paper);
                border-left-color: var(--stamp);
                font-weight: 500;
                padding-left: 0.8rem;
            }

    .sidebar-list .app-num {
        font-family: var(--serif);
        font-size: 0.88rem;
        font-style: italic;
        color: var(--ink-3);
        flex-shrink: 0;
    }

    .sidebar-list li button.active .app-num {
        color: var(--stamp);
    }

    .sidebar-list .app-name {
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

.sidebar-muted {
    font-size: 0.72rem;
    color: var(--ink-3);
    padding: 0.5rem 0.3rem;
    margin: 0;
}

.sidebar-action {
    margin-top: 0.7rem;
    width: 100%;
    background: transparent;
    border: var(--hairline) dashed var(--ink);
    padding: 0.65rem;
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    cursor: pointer;
    color: var(--ink);
    transition: background 0.12s ease, border-style 0.12s ease, color 0.12s ease;
}

    .sidebar-action:hover {
        background: var(--paper);
        border-style: solid;
        color: var(--stamp);
    }

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.sidebar-user {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

    .sidebar-user .kicker {
        margin: 0;
        font-size: 0.6rem;
    }

.sidebar-username {
    font-family: var(--serif);
    font-size: 1.05rem;
    font-style: italic;
    color: var(--ink);
    line-height: 1.1;
}

.sidebar-logout {
    background: transparent;
    border: 0;
    padding: 0.3rem 0;
    text-align: left;
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-2);
    cursor: pointer;
    transition: color 0.12s ease;
}

    .sidebar-logout:hover {
        color: var(--stamp);
    }

    .sidebar-logout .arrow {
        display: inline-block;
        transition: transform 0.12s ease;
    }

    .sidebar-logout:hover .arrow {
        transform: translate(2px, -2px);
    }

/* Mobile: sidebar collapses to a horizontal top strip */
@media (max-width: 820px) {
    body:has(#sidebar:not([hidden])) {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        min-height: auto;
        position: relative;
        padding: 1rem 1.25rem;
        border-right: 0;
        border-bottom: var(--rule-thick) solid var(--ink);
        flex-direction: row;
        align-items: center;
        gap: 1.25rem;
        flex-wrap: wrap;
    }

    .sidebar-head {
        flex: 1;
        min-width: 0;
    }

        .sidebar-head .brand-sub {
            display: none;
        }

    .sidebar-nav {
        display: none;
    }

    .sidebar-footer {
        flex-direction: row;
        align-items: center;
        gap: 1rem;
    }

        .sidebar-footer .rule {
            display: none;
        }

    .sidebar-user {
        flex-direction: row;
        align-items: baseline;
        gap: 0.4rem;
    }

        .sidebar-user .kicker {
            display: none;
        }

    .sidebar-username {
        font-size: 0.9rem;
    }

    body:has(#sidebar:not([hidden])) main#app {
        padding: 1.5rem 1.25rem 4rem;
    }
}


/* ─── Sidebar — per-app mode ────────────────────────────────── */
.sidebar-mode {
    display: flex;
    flex-direction: column;
}

/* Back link */
.sidebar-back {
    background: transparent;
    border: 0;
    padding: 0.3rem 0;
    margin-bottom: 1rem;
    text-align: left;
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-3);
    cursor: pointer;
    transition: color 0.12s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

    .sidebar-back:hover {
        color: var(--stamp);
    }

    .sidebar-back .back-arrow {
        font-family: var(--serif);
        font-style: italic;
        font-size: 1rem;
        transition: transform 0.12s ease;
    }

    .sidebar-back:hover .back-arrow {
        transform: translateX(-3px);
    }

/* Current application block */
.sidebar-current {
    padding: 0.7rem 0 1rem;
    border-top: var(--hairline) solid var(--ink);
    border-bottom: var(--hairline) solid var(--ink);
    margin-bottom: 1.1rem;
}

    .sidebar-current .kicker {
        margin: 0 0 0.4rem;
        font-size: 0.6rem;
    }

.sidebar-current-name {
    font-family: var(--serif);
    font-size: 1.2rem;
    line-height: 1.1;
    margin: 0;
    color: var(--ink);
    font-style: italic;
    word-break: break-word;
}

.sidebar-current-id {
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.16em;
    color: var(--ink-3);
    margin: 0.25rem 0 0;
    text-transform: uppercase;
}

/* Numbered nav list */
.sidebar-nav-list {
    padding: 0.35rem 0;
}

.sidebar-nav-item {
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    padding: 0.55rem 0.55rem;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--ink);
    cursor: pointer;
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    letter-spacing: 0.02em;
    transition: background 0.12s ease, padding-left 0.12s ease, color 0.12s ease;
    border-left: 2px solid transparent;
}

    .sidebar-nav-item:hover:not(.disabled) {
        background: var(--paper-3);
        padding-left: 0.8rem;
    }

    .sidebar-nav-item.active {
        background: var(--paper);
        border-left-color: var(--stamp);
        font-weight: 500;
        padding-left: 0.8rem;
    }

    .sidebar-nav-item .nav-num {
        font-family: var(--serif);
        font-style: italic;
        font-size: 0.95rem;
        color: var(--ink-3);
        width: 1.6rem;
        flex-shrink: 0;
    }

    .sidebar-nav-item.active .nav-num {
        color: var(--stamp);
    }

    .sidebar-nav-item .nav-label {
        flex: 1;
    }

    .sidebar-nav-item.disabled {
        color: var(--ink-3);
        cursor: not-allowed;
        font-style: italic;
    }

        .sidebar-nav-item.disabled:hover {
            background: var(--paper-3);
            color: var(--ink-2);
        }

.soon-tag {
    font-family: var(--mono);
    font-size: 0.55rem;
    letter-spacing: 0.16em;
    padding: 0.12rem 0.4rem;
    border: var(--hairline) solid var(--ink-3);
    color: var(--ink-3);
    text-transform: uppercase;
    font-style: normal;
    border-radius: 1px;
}

/* Mobile: hide nav modes entirely; back link from main view still works */
@media (max-width: 820px) {
    .sidebar-mode {
        display: none;
    }
}


/* ─── Dark mode ─────────────────────────────────────────────── */
/* Variables redefined for "paper at night" — dark warm brown
   instead of cream, cream-toned ink reads on it. */
:root[data-theme="dark"] {
    /* Tells the browser to render native form controls (password reveal eye,
       scrollbars, select dropdown arrows, calendar widgets) in dark mode.
       Without this, the Edge ::-ms-reveal eye renders as a dark icon
       invisible against the dark input bg. */
    color-scheme: dark;
    --paper: #1a1612;
    --paper-2: #221d17;
    --paper-3: #2d2620;
    --ink: #fdf7e8; /* brighter primary text */
    --ink-2: #e3d9c1; /* brighter secondary */
    --ink-3: #ada288; /* brighter muted */
    --rule: #fdf7e8;
    --stamp: #f25638;
    --stamp-dim: #d04023;
    --valid: #7fcf7f;
    --field-bg: #15110d;
    --field-bg-focus: #1f1a13;
}

    /* The body has hardcoded warm radial-gradients. Tone them down in dark. */
    :root[data-theme="dark"] body {
        background-image: radial-gradient(ellipse at 10% 0%, rgba(232,210,160,0.04), transparent 55%), radial-gradient(ellipse at 90% 100%, rgba(200,49,26,0.08), transparent 55%);
    }
        /* The body::before paper-grain noise has dark colors baked into its SVG;
   in dark mode just fade it heavily so it doesn't muddy the background. */
        :root[data-theme="dark"] body::before {
            opacity: 0.06;
        }

    /* Selection contrast in dark mode */
    :root[data-theme="dark"] *::selection {
        background: var(--ink);
        color: var(--paper);
    }

/* ─── Theme toggle button ───────────────────────────────────── */
.sidebar-theme-toggle {
    background: transparent;
    border: var(--hairline) solid var(--ink);
    padding: 0.55rem 0.7rem;
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    cursor: pointer;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: background 0.12s ease, color 0.12s ease;
    width: 100%;
}

    .sidebar-theme-toggle:hover {
        background: var(--paper-3);
        color: var(--stamp);
    }

.theme-icon {
    font-family: var(--serif);
    font-size: 1.05rem;
    line-height: 1;
}

/* On mobile the footer rows out; toggle stays compact */
@media (max-width: 820px) {
    .sidebar-theme-toggle {
        width: auto;
        padding: 0.4rem 0.6rem;
        font-size: 0.6rem;
    }

        .sidebar-theme-toggle .theme-label {
            display: none;
        }
}


/* ─── Users table cells ─────────────────────────────────────── */
.data-table td.user-name {
    font-family: var(--mono);
    font-weight: 500;
    white-space: nowrap;
}

    .data-table td.user-name::before {
        content: "@";
        color: var(--ink-3);
        margin-right: 0.1rem;
    }

.data-table td.user-hwid {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--ink-3);
    letter-spacing: 0.04em;
}

/* ─── Bulk action bar (licenses) ────────────────────────────── */
.bulk-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.65rem 0.9rem;
    margin-top: 0.75rem;
    background: var(--paper-2);
    border: var(--hairline) solid var(--ink);
    border-bottom: none;
}

.bulk-bar-count {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-2);
}

    .bulk-bar-count strong {
        color: var(--ink);
        font-weight: 700;
        margin-right: 0.25rem;
    }

.bulk-bar-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

    .bulk-bar-actions .btn-ghost {
        padding: 0.45rem 0.85rem;
        font-size: 0.65rem;
    }

/* When bulk bar is visible, drop the table's top border so they read as one block */
.bulk-bar:not([hidden]) + .data-table {
    margin-top: 0;
}

/* ─── Selection column ──────────────────────────────────────── */
.data-table th.col-select,
.data-table td.col-select {
    width: 1.6rem;
    padding-right: 0.4rem;
    text-align: center;
}

.data-table td.col-select {
    vertical-align: middle;
}

.data-table input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--ink);
    margin: 0;
    vertical-align: middle;
}

/* ─── Pagination ────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 0.4rem 0;
    border-top: var(--hairline) solid var(--paper-3);
    flex-wrap: wrap;
}

.page-btn {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    font-weight: 500;
    text-transform: uppercase;
    padding: 0.5rem 0.9rem;
    background: transparent;
    color: var(--ink);
    border: var(--hairline) solid var(--ink-3);
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

    .page-btn:hover:not([disabled]) {
        background: var(--ink);
        color: var(--paper);
        border-color: var(--ink);
    }

    .page-btn[disabled] {
        opacity: 0.35;
        cursor: not-allowed;
    }

    .page-btn .page-arrow {
        transition: transform 0.12s ease;
    }

    .page-btn:hover:not([disabled]) .page-arrow {
        transform: translateX(2px);
    }

    .page-btn:first-child:hover:not([disabled]) .page-arrow {
        transform: translateX(-2px);
    }

    /* Themed focus ring. Without this the button fell back to the browser's
       default outline (a blue/black halo) that clashed with the mono palette
       in both light and dark. --ink is theme-aware (near-black in light,
       near-white in dark), matching the switch/checkbox focus treatment.
       Mouse clicks get no stray ring; keyboard focus gets a clear one. */
    .page-btn:focus { outline: none; }
    .page-btn:focus-visible {
        outline: 2px solid var(--ink);
        outline-offset: 2px;
    }

.page-info {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-3);
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: center;
}

    .page-info strong {
        color: var(--ink);
        font-weight: 700;
    }

.page-range {
    font-size: 0.62rem;
    color: var(--ink-3);
    letter-spacing: 0.12em;
}

    .page-range::before {
        content: "· ";
        color: var(--ink-3);
        margin-right: 0.15rem;
    }

/* ─── Settings panel ───────────────────────────────────────── */
.settings-form {
    max-width: none;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin-top: 0.6rem;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.settings-section-kicker {
    margin: 0;
    color: var(--ink-3);
}

.settings-grid-two {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1rem;
}

@media (max-width: 760px) {
    .settings-grid-two { grid-template-columns: 1fr; }
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--ink-3);
}

/* ─── Service status card with toggle ──────────────────────── */
.status-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 0.65rem 1.25rem;
    background: var(--paper-2);
    border: 1px solid var(--ink);
    border-left: 4px solid var(--valid);
    transition: border-left-color 200ms, background 200ms;
}

.status-card.paused {
    border-left-color: var(--stamp);
    background: color-mix(in srgb, var(--stamp) 5%, var(--paper-2));
}

.status-card-meta { display: flex; flex-direction: column; gap: 0.25rem; }

.status-card-meta .kicker { margin: 0 0 0.2rem 0; }

.status-card-title {
    font-family: var(--serif);
    font-size: 1.3rem;
    font-style: italic;
    margin: 0;
    color: var(--ink);
    line-height: 1.1;
}

.status-card-title strong {
    font-weight: 400;
    color: var(--valid);
    border-bottom: 2px solid currentColor;
    padding-bottom: 1px;
}

.status-card.paused .status-card-title strong { color: var(--stamp); }

.status-card-sub {
    margin: 0.15rem 0 0 0;
    font-family: var(--mono);
    font-size: 0.74rem;
    color: var(--ink-3);
    letter-spacing: 0.04em;
}

/* ─── Switch (custom toggle) ───────────────────────────────── */
.switch {
    --w: 60px;
    --h: 32px;
    --pad: 3px;
    position: relative;
    display: inline-block;
    width: var(--w);
    height: var(--h);
    cursor: pointer;
    flex-shrink: 0;
}

.switch.small { --w: 48px; --h: 26px; --pad: 3px; }

.switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.switch-track {
    position: absolute;
    inset: 0;
    background: var(--paper-3);
    border: 1px solid var(--ink);
    border-radius: calc(var(--h) / 2);
    transition: background 180ms ease;
}

.switch-thumb {
    position: absolute;
    top: var(--pad);
    left: var(--pad);
    width: calc(var(--h) - 2 * var(--pad) - 2px);
    height: calc(var(--h) - 2 * var(--pad) - 2px);
    background: var(--paper);
    border: 1px solid var(--ink);
    border-radius: 50%;
    transition: transform 180ms ease, background 180ms ease;
    box-shadow: 0 1px 2px rgba(20, 17, 13, 0.25);
}

.switch input:checked + .switch-track {
    background: var(--valid);
}

.switch input:checked + .switch-track .switch-thumb {
    transform: translateX(calc(var(--w) - var(--h)));
    background: var(--paper);
}

.switch input:focus-visible + .switch-track {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

/* ─── Broadcast card (developer message) ───────────────────── */
.broadcast-card {
    border: 1px solid var(--ink);
    background: var(--field-bg);
    display: flex;
    flex-direction: column;
}

.broadcast-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.9rem;
    background: var(--paper-2);
    border-bottom: 1px solid var(--ink);
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--ink-3);
    text-transform: uppercase;
}

.broadcast-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--valid);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--valid) 30%, transparent);
    flex-shrink: 0;
}

.broadcast-label { flex: 1; }

.broadcast-counter {
    font-variant-numeric: tabular-nums;
    color: var(--ink-3);
}

.broadcast-counter.near-limit { color: var(--stamp); }

.broadcast-card textarea {
    border: 0;
    background: transparent;
    padding: 0.75rem 1rem;
    font-family: var(--mono);
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--ink);
    resize: vertical;
    min-height: 70px;
    outline: 0;
}

.broadcast-card textarea::placeholder { color: var(--ink-3); font-style: italic; }

.broadcast-card:focus-within {
    outline: 1px solid var(--ink);
    outline-offset: -2px;
}

/* ─── Inline help "?" badge + tooltip ───────────────────────────
   Small circular "?" next to a heading; reveals an explanatory bubble on
   hover or keyboard focus. Theme-aware (uses --ink / --surface). Tooltip
   text comes from data-tip; aria-label carries the same text for AT. */
.help-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    margin-left: 0.4rem;
    border: 1px solid var(--ink-3);
    border-radius: 50%;
    font-family: var(--sans);
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1;
    color: var(--ink-3);
    text-transform: none;
    letter-spacing: 0;
    cursor: help;
    position: relative;
    vertical-align: middle;
    transition: color 120ms ease, border-color 120ms ease;
}

.help-tip:hover,
.help-tip:focus-visible {
    color: var(--ink);
    border-color: var(--ink);
    outline: none;
}

.help-tip::after {
    content: attr(data-tip);
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 60;
    width: max-content;
    max-width: 280px;
    padding: 0.55rem 0.7rem;
    background: var(--surface, var(--paper-2));
    color: var(--ink-2);
    border: 1px solid var(--border-strong, var(--ink-3));
    border-radius: 8px;
    box-shadow: var(--shadow-md, 0 8px 20px -8px rgba(0, 0, 0, 0.4));
    font-family: var(--sans);
    font-size: 0.72rem;
    font-weight: 400;
    line-height: 1.45;
    letter-spacing: 0;
    text-transform: none;
    white-space: normal;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-3px);
    transition: opacity 130ms ease, transform 130ms ease, visibility 130ms;
    pointer-events: none;
}

.help-tip:hover::after,
.help-tip:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ─── Toggle row (HWID + similar) ──────────────────────────── */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 0.75rem 1.1rem;
    border: 1px solid var(--ink-3);
    background: var(--field-bg);
}

.toggle-row-info { display: flex; flex-direction: column; gap: 0.2rem; }

.toggle-row-info strong {
    font-family: var(--mono);
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    color: var(--ink);
}

.toggle-row-info span {
    font-size: 0.8rem;
    color: var(--ink-3);
}

/* ─── Secret-reveal: code snippet block ────────────────────── */
.code-snippet {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
}

.code-snippet pre {
    margin: 0;
    padding: 0.75rem 0.9rem;
    background: color-mix(in srgb, currentColor 5%, transparent);
    border: 1px solid var(--ink-3);
    border-radius: 2px;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 0.82rem;
    line-height: 1.55;
    white-space: pre;
}

.code-snippet pre code {
    background: none;
    padding: 0;
    font-size: inherit;
}

.code-snippet .copy-btn {
    align-self: flex-end;
}

/* ─── Admin overview: compact layout ──────────────────────── */
#view-admin .section-head { margin-bottom: 0.5rem; }

.stat-row.admin-stats {
    grid-template-columns: repeat(6, 1fr);
    margin: 1rem 0 0;
}

@media (max-width: 980px) {
    .stat-row.admin-stats { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 540px) {
    .stat-row.admin-stats { grid-template-columns: repeat(2, 1fr); }
}

#view-admin .stat {
    padding: 0.9rem 1rem;
    gap: 0.25rem;
}

#view-admin .stat-value {
    font-size: 1.75rem;
}

#view-admin .stat-label {
    font-size: 0.58rem;
}

/* 7-day activity as an inline strip, not a full section */
.admin-7d-strip {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 0.65rem 1rem;
    margin-top: 0.75rem;
    background: var(--paper-2);
    border: 1px solid var(--ink-3);
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--ink-3);
    letter-spacing: 0.04em;
}

.admin-7d-strip .kicker {
    margin: 0;
    padding-right: 1rem;
    border-right: 1px solid var(--ink-3);
    color: var(--ink-3);
}

.admin-7d-strip .strip-item {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
}

.admin-7d-strip .strip-item strong {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.2rem;
    color: var(--ink);
    font-weight: 400;
    line-height: 1;
}

/* Compact section: just a kicker + optional button, no big display title */
.admin-section {
    margin-top: 1.5rem;
}

.admin-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--ink-3);
}

.admin-section-head .kicker {
    margin: 0;
    font-size: 0.7rem;
    color: var(--ink);
}

/* ─── Customer portal ──────────────────────────────────────── */
.portal-body {
    background: var(--paper);
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 4rem 1.5rem 2rem;
}

.portal-main {
    width: 100%;
    max-width: 540px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.portal-card {
    background: var(--paper-2);
    border: 1px solid var(--ink);
    padding: 2rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.portal-card .kicker {
    margin: 0;
    color: var(--ink-3);
}

.portal-card .display {
    margin: 0;
    color: var(--ink);
    font-family: var(--serif);
    font-size: 2rem;
    line-height: 1.05;
}

.portal-card .muted {
    margin: 0 0 0.5rem 0;
    color: var(--ink-3);
    font-size: 0.88rem;
    line-height: 1.5;
}

.portal-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--ink-3);
    margin: 0.75rem 0 0.25rem;
}

.portal-tab {
    flex: 1;
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    padding: 0.7rem 0.5rem;
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    color: var(--ink-3);
    transition: color 140ms, border-color 140ms;
}

.portal-tab.active {
    color: var(--ink);
    border-bottom-color: var(--ink);
}

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

.portal-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 0.75rem;
}

.portal-form .btn-primary {
    align-self: flex-start;
    margin-top: 0.5rem;
}

/* ─── Customer dashboard ──────────────────────────────────── */
.portal-dashboard {
    gap: 1.25rem;
}

.portal-dash-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.portal-dash-head .display em {
    font-style: italic;
    color: var(--ink);
}

.portal-sub-card {
    border: 1px solid var(--ink);
    background: var(--paper);
    padding: 1.1rem 1.25rem;
    border-left: 4px solid var(--ink-3);
}

.portal-sub-card.active  { border-left-color: var(--valid); }
.portal-sub-card.expired { border-left-color: var(--stamp); }

.portal-sub-card .kicker { margin: 0 0 0.3rem 0; }

.portal-sub-status {
    margin: 0 0 1rem 0;
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.3rem;
    color: var(--ink);
}

.portal-sub-card.expired .portal-sub-status { color: var(--stamp); }
.portal-sub-card.active  .portal-sub-status { color: var(--valid); }

.portal-sub-meta {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1rem;
}

.portal-sub-meta > div {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.portal-sub-meta .kicker { margin: 0; }

.portal-sub-value {
    font-family: var(--mono);
    font-size: 0.95rem;
    color: var(--ink);
}

.portal-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--ink-3);
}

.portal-info-grid > div {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.portal-info-grid .kicker { margin: 0; }

.portal-info-grid > div > :last-child {
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--ink);
    word-break: break-all;
}

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

.portal-footer {
    text-align: center;
    margin: 1rem 0 0 0;
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--ink-3);
    letter-spacing: 0.08em;
}

.portal-footer a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid var(--ink-3);
}

.portal-footer a:hover { color: var(--ink); }

@media (max-width: 540px) {
    .portal-info-grid { grid-template-columns: 1fr; }
    .portal-sub-meta  { grid-template-columns: 1fr; }
    .portal-dash-head { flex-direction: column; }
}

/* ─── App meta: customer portal link cell ──────────────────── */
.portal-link-cell {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.portal-link-cell a {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--ink);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
    word-break: break-all;
}

.portal-link-cell a:hover { color: var(--stamp); }

.portal-copy-btn {
    flex-shrink: 0;
    padding: 0.3rem 0.65rem;
    font-size: 0.7rem;
}

/* ─── Settings: distribution section ──────────────────────── */
.dist-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--ink-3);
    background: var(--field-bg);
    flex-wrap: wrap;
}

.dist-label {
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    color: var(--ink-3);
    white-space: nowrap;
}

.dist-url {
    flex: 1;
    min-width: 200px;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--ink);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
    word-break: break-all;
}

.dist-url:hover { color: var(--stamp); }

.dist-action {
    flex-shrink: 0;
    padding: 0.3rem 0.65rem;
    font-size: 0.7rem;
}

.dist-loader {
    margin-top: 0.75rem;
    border: 1px dashed var(--ink-3);
    background: var(--field-bg);
    transition: border-color 140ms, background 140ms, transform 140ms;
}

/* Filled loader (current) reads better with a solid border than dashed. */
.dist-loader:has(.dist-loader-current:not([hidden])) {
    border-style: solid;
}

/* Drag-over feedback. Pointer-events on children get disabled so dragleave
   doesn't flicker as the cursor crosses inner element boundaries. */
.dist-loader.drag-over {
    border-color: var(--ink);
    background: var(--paper, var(--field-bg));
    transform: scale(1.005);
}
.dist-loader.drag-over * { pointer-events: none; }

.dist-loader-current {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    flex-wrap: wrap;
}

.dist-loader-meta {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.dist-loader-meta strong {
    font-family: var(--mono);
    font-size: 0.88rem;
    color: var(--ink);
    word-break: break-all;
}

.dist-loader-meta .muted {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--ink-3);
}

.dist-loader-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.dist-loader-empty {
    padding: 1.1rem 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-items: center;
    text-align: center;
}

/* Upload-arrow icon — Unicode glyph keeps it asset-free. */
.dist-loader-empty::before {
    content: '\21EA';   /* ⇪ */
    display: block;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--ink-3);
    margin-bottom: 0.1rem;
    transition: color 140ms, transform 140ms;
}

.dist-loader.drag-over .dist-loader-empty::before {
    color: var(--ink);
    transform: translateY(-2px);
}

.dist-loader-empty .dist-label { margin-bottom: 0; }

.dist-loader-empty .muted {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.5;
    max-width: 38rem;
}

.dist-loader-empty .field-hint {
    margin-top: 0.25rem;
    font-style: italic;
    opacity: 0.85;
}

/* ─── TAMPER CHECK hash drop-zone ─────────────────────────────
   Visual twin of .dist-loader but for in-browser SHA-256 compute. No upload
   happens — the file is read via FileReader and digested with crypto.subtle. */
.hash-dropzone {
    margin-top: 0.75rem;
    border: 1px dashed var(--ink-3);
    background: var(--paper-2);
    transition: border-color 140ms, background 140ms, transform 140ms;
    cursor: pointer;
}
.hash-dropzone.drag-over {
    border-color: var(--ink);
    background: var(--paper, var(--field-bg));
    transform: scale(1.005);
}
.hash-dropzone.drag-over * { pointer-events: none; }

.hash-dropzone-state {
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: center;
    text-align: center;
}

.hash-dropzone-state strong {
    font-family: var(--mono);
    font-size: 0.92rem;
    letter-spacing: 0.04em;
    color: var(--ink);
}

.hash-dropzone-state em {
    font-family: var(--mono);
    font-style: normal;
    color: var(--ink);
}

.hash-dropzone-state .muted {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.5;
    max-width: 38rem;
}

/* Mirrors .dist-loader-empty .field-hint so both dropzones read identically. */
.hash-dropzone-state .field-hint {
    margin-top: 0.25rem;
    font-style: italic;
    opacity: 0.85;
}

/* Monochrome glyph for the empty state. \2317 (⌗) is the viewdata square —
   reads as "hash" without summoning the colored emoji renderer that Windows
   uses for U+1F5xx codepoints. */
.hash-dropzone-state[data-state="empty"]::before {
    content: '\2317';   /* ⌗ */
    display: block;
    font-family: var(--mono);
    font-size: 1.4rem;
    line-height: 1;
    color: var(--ink-3);
    margin-bottom: 0.05rem;
    transition: color 140ms, transform 140ms;
}
.hash-dropzone.drag-over .hash-dropzone-state[data-state="empty"]::before {
    color: var(--ink);
    transform: translateY(-2px) scale(1.08);
}

/* Tamper tab header: kicker row above the toggle. */
.tamper-head {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 0.3rem;
}

/* Toggle sits between the status head and the hash dropzone. */
.tamper-toggle-row { margin: 0.4rem 0 1.25rem; }

/* List of registered hashes, one row per stored entry. */
.hash-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.75rem;
}
.hash-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--ink-3);
    background: var(--field-bg);
}
.hash-row-meta {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    min-width: 0;
    flex: 1;
}
.hash-row-meta strong {
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hash-row-meta code {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--ink-3);
    word-break: break-all;
    user-select: all;     /* one click selects the whole hash */
}
.hash-row-meta .muted {
    font-size: 0.7rem;
}
.hash-row .btn-ghost { flex-shrink: 0; }

.hash-empty-note {
    margin-top: 0.6rem;
    font-style: italic;
    text-align: center;
    max-width: 36rem;
    margin-left: auto;
    margin-right: auto;
}

/* Subtle animated dots while we're hashing. Pure CSS, no JS-driven RAF loop. */
.hash-dropzone-state[data-state="working"] strong::after {
    content: '';
    display: inline-block;
    width: 1.2em;
    text-align: left;
    animation: hash-dots 1.1s steps(4, end) infinite;
}
@keyframes hash-dots {
    0%   { content: ''; }
    25%  { content: '.'; }
    50%  { content: '..'; }
    75%  { content: '...'; }
    100% { content: ''; }
}

/* ─── Customer portal: download card ──────────────────────── */
.portal-download-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--ink);
    background: var(--paper);
    flex-wrap: wrap;
}

.portal-download-card .kicker { margin: 0 0 0.25rem 0; }

.portal-download-name {
    margin: 0;
    font-family: var(--mono);
    font-size: 0.95rem;
    color: var(--ink);
    word-break: break-all;
}

.portal-download-card .muted {
    margin: 0.2rem 0 0 0;
    font-family: var(--mono);
    font-size: 0.74rem;
    color: var(--ink-3);
}

.portal-download-card .btn-primary { flex-shrink: 0; }

/* ─── Settings: tab bar ───────────────────────────────────── */
.settings-tabbar {
    display: flex;
    gap: 0;
    margin: 1.25rem 0 0;
    border-bottom: 1px solid var(--ink-3);
}

.settings-tab {
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    padding: 0.7rem 1.1rem;
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    color: var(--ink-3);
    text-transform: uppercase;
    transition: color 140ms, border-color 140ms;
    margin-bottom: -1px;
}

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

.settings-tab.active {
    color: var(--ink);
    border-bottom-color: var(--ink);
}

.settings-tab-panel {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin-top: 1rem;
}

/* Stack of related toggles (e.g. SECURITY: HWID lock + Require nonce).
   One outer card, internal rows borderless with hairline dividers. */
.toggle-stack {
    border: 1px solid var(--ink-3);
    background: var(--field-bg);
    display: flex;
    flex-direction: column;
}
.toggle-row.in-stack {
    border: 0;
    background: transparent;
    padding: 0.85rem 1.1rem;
}
.toggle-row.in-stack + .toggle-row.in-stack {
    border-top: 1px solid var(--ink-3);
}

/* Opt-in toggle inside confirm dialogs (e.g. "also delete bound user").
   Native checkbox is restyled into an iOS-style pill switch.
   The dialog form globally uppercases <label> text — override it back to
   sentence case here since this is a full opt-in toggle, not a field label. */
.confirm-check {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin: 0.6rem 0 0.2rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--ink-3);
    background: var(--field-bg);
    cursor: pointer;
    user-select: none;
    transition: border-color 140ms, background 140ms;
}
.confirm-check:hover { border-color: var(--ink-2); }

.confirm-check input {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    padding: 0;
    border: 1.5px solid var(--ink-2);
    background: transparent;
    box-shadow: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 140ms ease, border-color 140ms ease;
}
.confirm-check input:focus,
.confirm-check input:focus-visible {
    box-shadow: none;
    background: transparent;
}
.confirm-check input:checked:focus,
.confirm-check input:checked:focus-visible {
    background: var(--ink);
}
.confirm-check input:hover {
    border-color: var(--ink);
}
.confirm-check input:checked {
    background: var(--ink);
    border-color: var(--ink);
}
.confirm-check input:checked::after {
    content: "";
    position: absolute;
    top: 45%;
    left: 50%;
    width: 0.32rem;
    height: 0.6rem;
    border: solid var(--paper, #fff);
    border-width: 0 1.8px 1.8px 0;
    transform: translate(-50%, -55%) rotate(45deg);
}
.confirm-check input:focus-visible {
    outline: 2px solid var(--ink-2);
    outline-offset: 2px;
}

.confirm-check #confirm-check-label {
    font-family: var(--sans, inherit);
    font-size: 0.88rem;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink-2);
    line-height: 1.35;
    /* The flex row is already align-items:center, but Inter's ink sits high
       inside its line-box, so beside the 1.15rem checkbox the text reads as
       riding too high. Drop it 1px so the text's optical center lands on the
       checkbox's center. Pure optical tweak — bump to 2px if it still reads high. */
    position: relative;
    top: 1px;
}
.confirm-check:has(input:checked) {
    border-color: var(--ink);
    background: var(--paper, var(--field-bg));
}
.confirm-check:has(input:checked) #confirm-check-label {
    color: var(--ink);
}

/* ─── App meta: APP ID row with copy button ────────────────── */
.meta-id {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.meta-id code {
    font-family: var(--mono);
    font-size: 0.88rem;
    color: var(--ink);
}

.meta-copy-btn {
    padding: 0.25rem 0.55rem;
    font-size: 0.65rem;
}

/* ─── Settings: reseller section ────────────────────────────
   A reseller is a small sub-account scoped to one app. The owner panel
   needs to surface: how much credit they have left, who they are, and
   a couple of management actions (top up, reset password, delete).
   Layout: hero card up top with the balance as the focal point, then
   inline action rows (label + input + button on one line), and a
   small danger zone at the bottom. */

/* ── Empty state (no reseller yet) ── */
.reseller-intro {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1.4rem 1.5rem;
    border: 1px solid var(--ink-3);
    background: var(--field-bg);
    margin-bottom: 1.25rem;
}

.reseller-intro-mark {
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--serif);
    font-size: 2.2rem;
    line-height: 1;
    color: var(--ink-3);
    border: 1px dashed var(--ink-3);
    background: transparent;
}

.reseller-intro-copy {
    flex: 1;
    min-width: 0;
}

.reseller-intro-copy .kicker {
    margin-bottom: 0.35rem;
}

.reseller-intro-title {
    font-family: var(--serif);
    font-size: 1.45rem;
    font-weight: 400;
    color: var(--ink);
    margin: 0 0 0.4rem;
    line-height: 1.15;
}

.reseller-intro-body {
    font-family: var(--mono);
    font-size: 0.78rem;
    line-height: 1.55;
    color: var(--ink-2, var(--ink-3));
    margin: 0;
    max-width: 52ch;
}

.reseller-create-card {
    border: 1px solid var(--ink-3);
    background: var(--field-bg);
    padding: 1.25rem 1.5rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    /* Override the global .form { max-width: 28rem } — the create card has
       its own 3-column grid and needs the full settings panel width. */
    width: 100%;
    max-width: none;
}

.reseller-create-kicker {
    margin: 0;
}

/* 3 columns on wide: USERNAME | PASSPHRASE | CREDITS (smaller).
   Below 720px it collapses to one column. */
.reseller-create-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.65fr);
    gap: 1rem 1.25rem;
}

.reseller-create-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 0.5rem;
    border-top: 1px solid var(--ink-3);
}

.reseller-create-actions .btn-primary {
    width: auto;
    padding: 0.55rem 1.4rem;
}

@media (max-width: 720px) {
    .reseller-create-grid {
        grid-template-columns: 1fr;
    }
    .reseller-intro {
        flex-direction: column;
        gap: 1rem;
    }
}
.reseller-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
    gap: 1.25rem;
    align-items: center;
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--ink-3);
    background: var(--field-bg);
    margin-bottom: 1.25rem;
}

.reseller-hero-balance {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding-right: 1.25rem;
    border-right: 1px solid var(--ink-3);
}

.reseller-hero-credits {
    font-family: var(--serif);
    line-height: 1;
}

.reseller-hero-credits strong {
    font-size: 2.4rem;
    font-weight: 500;
    color: var(--ink);
    margin-right: 0.4rem;
}

.reseller-hero-unit {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.reseller-hero-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem 1.5rem;
    margin: 0;
}

.reseller-hero-meta dt {
    font-family: var(--mono);
    font-size: 0.6rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 0.15rem;
}

.reseller-hero-meta dd {
    margin: 0;
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.reseller-hero-meta a {
    color: var(--stamp);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
}

.reseller-tiny-btn {
    padding: 0.18rem 0.5rem;
    font-size: 0.6rem;
    letter-spacing: 0.12em;
}

/* One-line action row: [LABEL] [input fills space] [button] */
.reseller-action-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--ink-3);
    background: var(--field-bg);
    margin-top: 0.85rem;
    flex-wrap: wrap;
}

.reseller-action-label {
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    color: var(--ink-3);
    white-space: nowrap;
    min-width: 7rem;
}

/* Outside the .form scope, so re-apply the field input styling explicitly. */
.reseller-action-input {
    flex: 1;
    min-width: 12rem;
    margin: 0;
    padding: 0.5rem 0.7rem;
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--ink);
    background: var(--paper, var(--field-bg-focus, #fff));
    border: var(--hairline, 1px) solid var(--ink);
    border-radius: 0;
    transition: box-shadow 0.12s ease, background 0.12s ease;
}

.reseller-action-input::placeholder {
    color: var(--ink-3);
    opacity: 0.55;
}

.reseller-action-input:focus {
    outline: none;
    background: var(--field-bg-focus, var(--field-bg));
    box-shadow: inset 0 -2px 0 0 var(--stamp);
}

.reseller-action-btn {
    flex-shrink: 0;
    padding: 0.45rem 0.9rem;
    font-size: 0.72rem;
}

.reseller-action-hint {
    display: block;
    margin: 0.35rem 0 0 7.85rem;  /* aligns under the input column */
    color: var(--ink-3);
}

/* Danger zone — destructive action separated visually from the rest */
.reseller-danger {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 0.95rem 1.1rem;
    border: 1px dashed var(--stamp);
    background: transparent;
}

.reseller-danger-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.reseller-danger-info strong {
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    color: var(--ink);
}

.reseller-danger-info span {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--ink-3);
    line-height: 1.5;
}

/* Narrow viewports: stack the hero + collapse action labels */
@media (max-width: 720px) {
    .reseller-hero {
        grid-template-columns: 1fr;
    }
    .reseller-hero-balance {
        padding-right: 0;
        padding-bottom: 1rem;
        border-right: none;
        border-bottom: 1px solid var(--ink-3);
    }
    .reseller-hero-meta {
        grid-template-columns: 1fr;
    }
    .reseller-action-hint {
        margin-left: 0;
    }
}

/* ─── Reseller panel (/reseller standalone page) ─────────────
   This is the page the reseller themselves logs into — a different
   audience and a different layout from the owner-side reseller tab.
   Mirrors the portal styling but with a richer dashboard. */
.rsl-main {
    max-width: 880px;
}

/* Login card: narrow + centered so the sign-in screen feels focused
   instead of a wide card with a tiny form floating top-left. */
.rsl-login-card {
    max-width: 32rem;
    margin-left: auto;
    margin-right: auto;
}

/* Inputs inside the login form should fill the card width (override the
   global .form max-width which would otherwise cap them at 28rem inside
   an already-narrow card). */
.rsl-login-form {
    max-width: none;
}

.rsl-login-form input {
    width: 100%;
}

.rsl-login-submit {
    width: auto;
    align-self: flex-start;
    padding: 0.55rem 1.4rem;
}

.rsl-dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
}

/* ── Header ── */
.rsl-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1.1rem;
    border-bottom: 1px solid var(--ink-3);
}

.rsl-head-id .kicker {
    margin-bottom: 0.3rem;
}

.rsl-head-id .display {
    font-size: 1.6rem;
    font-weight: 400;
    line-height: 1.1;
    margin: 0;
    color: var(--ink);
}

.rsl-head-id .display em {
    font-style: italic;
    color: var(--ink);
}

.rsl-logout {
    flex-shrink: 0;
    padding: 0.45rem 0.9rem;
    font-size: 0.7rem;
}

/* ── Balance hero ── */
.rsl-balance {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.4rem 1.6rem;
    border: 1px solid var(--ink);
    border-left: 4px solid var(--ink);
    background: var(--field-bg);
}

.rsl-balance.low {
    border-left-color: var(--stamp);
}

.rsl-balance-meta {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.rsl-balance-credits {
    margin: 0;
    line-height: 1;
    font-family: var(--serif);
}

.rsl-balance-credits strong {
    font-size: 2.8rem;
    font-weight: 500;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.rsl-balance-unit {
    margin-left: 0.5rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.rsl-balance-hint {
    margin: 0;
    font-family: var(--mono);
    font-size: 0.72rem;
    line-height: 1.5;
    color: var(--ink-3);
}

.rsl-balance.low .rsl-balance-hint {
    color: var(--stamp);
}

.rsl-balance-status {
    flex-shrink: 0;
}

/* ── Generic content section (generate form, keys table) ── */
.rsl-section {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--ink-3);
    background: var(--field-bg);
}

.rsl-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.rsl-section-head .kicker {
    margin: 0;
}

/* Compact "cost badge" shown next to the GENERATE header */
.rsl-cost-tag {
    font-family: var(--mono);
    font-size: 0.7rem;
    padding: 0.25rem 0.55rem;
    color: var(--ink-2, var(--ink));
    background: var(--paper);
    border: 1px solid var(--ink-3);
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.rsl-cost-tag.over {
    color: var(--stamp);
    border-color: var(--stamp);
}

.rsl-keys-count {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--ink-3);
    letter-spacing: 0.08em;
}

/* ── Generate form ── */
.rsl-gen-form {
    margin: 0;
}

/* 3 narrow + 1 wide on desktop. Inputs get a sensible compact width. */
.rsl-gen-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 0.9fr) minmax(0, 0.9fr) minmax(0, 2.5fr);
    gap: 0.9rem 1rem;
    align-items: start;
}

.rsl-field-narrow input,
.rsl-field-wide input {
    width: 100%;
}

.rsl-optional {
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.6rem;
    color: var(--ink-3);
    margin-left: 0.3rem;
}

.rsl-gen-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 0.4rem;
    border-top: 1px solid var(--ink-3);
}

.rsl-gen-btn {
    width: auto;
    padding: 0.55rem 1.4rem;
}

/* ── Keys table ── */
.rsl-keys-table {
    table-layout: fixed;
    width: 100%;
    margin: 0;
}

.rsl-col-key { width: auto; }
.rsl-col-dur { width: 5rem; }
.rsl-col-status { width: 7rem; }
.rsl-col-created { width: 11rem; }
.rsl-col-actions { width: 9rem; }

.rsl-keys-table td.rsl-key-cell {
    /* Key strings are ~30 chars with dashes. Force them onto a single line in
       a monospace tag with horizontal scroll if the viewport is too narrow.
       Without this, the cell wraps the key across 5+ lines (ugly + unreadable). */
    padding: 0.55rem 0.7rem;
}

.rsl-key-code {
    display: inline-block;
    font-family: var(--mono);
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    color: var(--ink);
    padding: 0.25rem 0.45rem;
    background: var(--paper);
    border: 1px solid var(--ink-3);
    white-space: nowrap;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    cursor: pointer;
    transition: border-color 140ms, color 140ms;
}

.rsl-key-code:hover {
    border-color: var(--ink);
}

.rsl-keys-table td.rsl-actions-cell {
    text-align: right;
    white-space: nowrap;
}

.rsl-keys-table .rsl-row-btn {
    padding: 0.28rem 0.6rem;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    margin-left: 0.35rem;
}

.rsl-keys-empty {
    margin: 0.5rem 0 0;
    padding: 1.5rem;
    text-align: center;
    color: var(--ink-3);
    font-family: var(--mono);
    font-size: 0.78rem;
    border: 1px dashed var(--ink-3);
    background: transparent;
}

/* "Warn" variant of bracket-tag for the LOW BALANCE chip */
.bracket-tag.warn {
    color: var(--stamp);
    border-color: var(--stamp);
}

/* Narrow viewports */
@media (max-width: 720px) {
    .rsl-balance {
        flex-direction: column;
        align-items: flex-start;
    }
    .rsl-gen-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .rsl-gen-grid .rsl-field-wide {
        grid-column: 1 / -1;
    }
    .rsl-col-created { display: none; }
    .rsl-keys-table .rsl-col-created,
    .rsl-keys-table td.rsl-created-cell { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════
   ░ DASH-PRO  ─  "Quiet Luxe"  ────────────────────────────────────
   Full structural redesign for the owner dashboard. Replaces the
   editorial paper aesthetic with a modern SaaS shell on a refined
   mono palette. Inspired by Linear / Vercel / Cal.com.

   Scoped to body.dash-pro. Removing the class restores the original
   editorial paper palette from :root.
   ═══════════════════════════════════════════════════════════════════ */

body.dash-pro {
    /* Surfaces — sunken page, raised cards. Page bg matches the login /
       register / landing "Mono" theme (--m-bg) exactly so the whole app
       shares one background. */
    --paper:           #f7f7f8;
    --paper-2:         #eeeeef;
    --paper-3:         #e4e4e6;
    --surface:         #ffffff;         /* login --m-card-bg */
    --surface-2:       #f7f7f8;
    /* Ink — neutral greys lifted straight from the login "Mono" theme. */
    --ink:             #0a0a0a;         /* login --m-ink */
    --ink-2:           #4a4a4a;         /* login --m-ink-2 */
    --ink-3:           #8a8a8a;         /* login --m-ink-3 */
    /* Rules / borders — the login --m-border / --m-border-strong pair. */
    --rule:            #ececee;
    --border-soft:     #ececee;
    --border-strong:   #d4d4d6;
    /* Fields */
    --field-bg:        #ffffff;
    --field-bg-focus:  #ffffff;
    /* Accent = solid ink CTA, mirroring login --m-accent / --m-accent-hover.
       --valid stays grey so success text reads mono like the auth pages. */
    --stamp:           #0a0a0a;
    --stamp-dim:       #1f1f1f;
    --valid:           #4a4a4a;
    /* Dedicated semantic colors — kept narrow for UX clarity. */
    --danger:          #dc2626;
    --danger-dim:      #b91c1c;
    /* Depth */
    --shadow-sm:       0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md:       0 4px 12px -4px rgba(0, 0, 0, 0.08), 0 2px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg:       0 16px 40px -16px rgba(0, 0, 0, 0.12), 0 8px 24px -8px rgba(0, 0, 0, 0.06);
    /* Radii */
    --radius-sm:       8px;
    --radius:          12px;
    --radius-lg:       16px;
    /* Sidebar width */
    --sb-w:            264px;

    background: var(--paper);
    background-image: none;
}

[data-theme="dark"] body.dash-pro {
    /* Tonal hierarchy: page (paper) < card (surface) < hover (paper-2)
       < active/deeper (paper-3). Each step is a small but visible lift
       in lightness. Light mode gets depth from contrast against white;
       dark mode needs explicit tonal separation between layers. */
    --paper:           #0a0a0a;       /* page bg — login --m-bg */
    --surface:         #131313;       /* raised card — login --m-card-bg */
    --surface-2:       #0f0f0f;       /* sunken — login --m-input-bg */
    --paper-2:         #1c1c1c;       /* hover — neutral, lighter than surface */
    --paper-3:         #232323;       /* active — login --m-border */
    --ink:             #f5f5f5;       /* login --m-ink */
    --ink-2:           #b8b8b8;       /* login --m-ink-2 */
    --ink-3:           #6e6e6e;       /* login --m-ink-3 */
    --rule:            #232323;       /* login --m-border */
    --border-soft:     #232323;
    --border-strong:   #333333;       /* login --m-border-strong */
    --field-bg:        #0f0f0f;       /* login --m-input-bg */
    --field-bg-focus:  #1a1a1a;
    --stamp:           #f5f5f5;       /* login --m-accent */
    --stamp-dim:       #ffffff;       /* login --m-accent-hover */
    --valid:           #b8b8b8;
    --danger:          #ef4444;
    --danger-dim:      #f87171;
    /* Shadows in dark mode combine a strong drop shadow with an inset
       top-highlight — the highlight simulates light catching the top
       edge of an elevated surface, which is how dark UIs read "lifted"
       (drop shadows alone fade into the dark bg). */
    --shadow-sm:
        0 1px 2px rgba(0, 0, 0, 0.6),
        0 2px 4px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    --shadow-md:
        0 8px 24px -8px rgba(0, 0, 0, 0.7),
        0 4px 12px -4px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    --shadow-lg:
        0 24px 60px -20px rgba(0, 0, 0, 0.85),
        0 12px 30px -12px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    background: var(--paper);
    background-image: none;
}

/* Kill the warm radial gradients + paper-grain noise. */
body.dash-pro::before { display: none; }
[data-theme="dark"] body.dash-pro { background-image: none; }

/* ─── Base reset for dash-pro ────────────────────────────────────── */
body.dash-pro {
    color: var(--ink);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.5;
    font-feature-settings: "cv11", "ss01";
}

body.dash-pro main, body.dash-pro header { z-index: 1; }

/* Match the editorial layout pattern: body becomes flex when sidebar is
   visible (base rule at line 1981 does this), sidebar is a flex item with
   fixed width, main has flex: 1 + margin: 0 (base rule at 2004 does this).
   Override only the things we want different in dash-pro. The :has()
   selector mirrors the base rule's specificity so we win on equal terms. */
body.dash-pro:has(#sidebar:not([hidden])) main#app {
    flex: 1;
    min-width: 0;
    max-width: none;
    margin: 0;
    padding: 2.5rem 2.5rem 4rem;
}

@media (max-width: 980px) {
    /* Mobile: drawer pattern — undo flex on body so main isn't squeezed
       by the sidebar's flex item. Sidebar becomes a fixed overlay (see
       drawer block further down). */
    body.dash-pro:has(#sidebar:not([hidden])) {
        display: block;
    }
    body.dash-pro:has(#sidebar:not([hidden])) main#app {
        padding: 3.5rem 1.25rem 3rem;
    }
}

/* ─── Typography overrides ───────────────────────────────────────── */
body.dash-pro .display {
    font-family: var(--sans);
    font-weight: 700;
    font-size: clamp(1.5rem, 2.4vw, 1.875rem);
    line-height: 1.2;
    letter-spacing: -0.022em;
    color: var(--ink);
}

body.dash-pro .display em {
    font-style: normal;
    color: var(--ink);
    text-decoration: none;
    border-bottom: none;
}

body.dash-pro h3.display {
    font-size: 1.125rem;
    font-weight: 650;
    letter-spacing: -0.012em;
}

body.dash-pro .kicker {
    font-family: var(--sans);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin: 0 0 0.4rem;
}

body.dash-pro .muted {
    color: var(--ink-3);
    font-size: 0.875rem;
}

/* ─── Rules: from hairline ink to soft separator ─────────────────── */
body.dash-pro .rule {
    height: 1px;
    background: var(--border-soft);
    margin: 1.25rem 0 1.75rem;
}

body.dash-pro .rule.rule-double {
    height: 1px;
    background: var(--border-soft);
}

/* ─── Sidebar ────────────────────────────────────────────────────── */
/* Desktop: flex item, sticky so it stays at top while scrolling.
   align-self: flex-start + max-height: 100vh keeps it viewport-locked.
   Mobile breakpoint below switches to position: fixed for drawer. */
body.dash-pro aside#sidebar {
    position: sticky;
    top: 0;
    align-self: flex-start;
    width: var(--sb-w);
    max-height: 100vh;
    flex-shrink: 0;
    background: var(--surface);
    background-image: none;                      /* kill editorial cream radial */
    border-right: 1px solid var(--border-soft);
    padding: 1.25rem 0.875rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    z-index: 50;
    overflow-y: auto;
}

/* Mobile: sidebar is a slide-in drawer. Off-screen by default; body.sidebar-open
   translates it back in. A backdrop dims the page. */
@media (max-width: 980px) {
    body.dash-pro aside#sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: min(280px, 86vw);
        height: 100vh;
        border-right: 1px solid var(--border-soft);
        border-bottom: none;
        flex-direction: column;
        align-items: stretch;
        gap: 1.5rem;
        padding: 1.25rem 0.875rem 1rem;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 240ms cubic-bezier(0.32, 0.72, 0, 1);
        box-shadow: var(--shadow-lg);
    }
    body.dash-pro.sidebar-open aside#sidebar {
        transform: translateX(0);
    }
}

/* Brand — flex centering is more reliable than text-align here because
   the brand-mark is `display: inline-flex` which can fight text-align in
   some cascade orders. Forcing flex+justify wins cleanly. */
body.dash-pro .sidebar-head {
    padding: 0.5rem 0.5rem 1rem;
    border-bottom: none;
    margin-bottom: 0.25rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

body.dash-pro .sidebar-head .brand-mark {
    display: inline-flex;
    margin: 0 auto;
}

body.dash-pro .brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--sans);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--ink);
    text-decoration: none;
    letter-spacing: -0.01em;
}

body.dash-pro .brand-logo {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    object-fit: cover;
    box-shadow: var(--shadow-sm);
}

body.dash-pro .brand-name { font-weight: 650; }

/* (Removed obsolete horizontal-row mobile rule for .sidebar-head — drawer
   layout uses the desktop styling.) */

/* Nav sections */
body.dash-pro .sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-height: 0;
}

body.dash-pro .sidebar-section {
    padding: 0 0.5rem;
    margin: 0 0 0.4rem;
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    color: var(--ink-3);
}

body.dash-pro .sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

/* Nav items: pill-style */
body.dash-pro .sidebar-nav-item,
body.dash-pro .sidebar-action {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.5rem 0.625rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-family: var(--sans);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ink-2);
    text-align: left;
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
}

body.dash-pro .sidebar-nav-item:hover:not(.disabled),
body.dash-pro .sidebar-action:hover {
    background: var(--paper-2);
    color: var(--ink);
    padding-left: 0.625rem; /* override editorial slide */
}

body.dash-pro .sidebar-nav-item.active {
    background: var(--ink);
    color: var(--paper);
    font-weight: 600;
    border-left: none;
    padding-left: 0.625rem;
}

body.dash-pro .sidebar-nav-item.active .nav-num {
    color: var(--paper);
    font-style: normal;
}

body.dash-pro .sidebar-nav-item .nav-num,
body.dash-pro .sidebar-action .nav-num {
    font-family: var(--sans);
    font-size: 0.95rem;
    font-style: normal;
    color: var(--ink-3);
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    line-height: 1;
}

body.dash-pro .sidebar-nav-item:hover:not(.disabled) .nav-num {
    color: var(--ink);
}

body.dash-pro .sidebar-nav-item.disabled {
    color: var(--ink-3);
    cursor: not-allowed;
    font-style: normal;
    opacity: 0.6;
}

body.dash-pro .sidebar-nav-item.disabled:hover {
    background: transparent;
    color: var(--ink-3);
}

body.dash-pro .soon-tag {
    margin-left: auto;
    font-family: var(--sans);
    font-size: 0.62rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 0.1rem 0.4rem;
    border: 1px solid var(--border-strong);
    color: var(--ink-3);
    border-radius: 4px;
    font-style: normal;
}

/* Sidebar app list items (rendered by JS) — inherit pill style */
body.dash-pro #sidebar-apps li button,
body.dash-pro #sidebar-apps li a {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.5rem 0.625rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-family: var(--sans);
    font-size: 0.875rem;
    color: var(--ink-2);
    text-align: left;
    cursor: pointer;
    text-decoration: none;
    transition: background 120ms ease, color 120ms ease;
}

body.dash-pro #sidebar-apps li button:hover,
body.dash-pro #sidebar-apps li a:hover {
    background: var(--paper-2);
    color: var(--ink);
}

body.dash-pro #sidebar-apps li button.active {
    background: var(--paper-3);
    color: var(--ink);
    font-weight: 650;
    padding-left: 0.875rem;
    box-shadow: inset 3px 0 0 0 var(--ink);
}

body.dash-pro #sidebar-apps li button.active:hover {
    background: var(--paper-3);
    padding-left: 0.875rem;
}

body.dash-pro #sidebar-apps li .app-num {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--ink-3);
    width: 36px;
    flex-shrink: 0;
    letter-spacing: 0;
    font-weight: 500;
}

body.dash-pro #sidebar-apps li button.active .app-num {
    color: var(--ink-2);
}

body.dash-pro #sidebar-apps li .app-name {
    font-family: var(--sans);
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

body.dash-pro .sidebar-action {
    margin-top: 0.5rem;
    color: var(--ink-3);
    border: 1px dashed var(--border-strong);
    justify-content: flex-start;
    font-weight: 500;
}

body.dash-pro .sidebar-action:hover {
    background: var(--paper-2);
    color: var(--ink);
    border-color: var(--ink-3);
    border-style: solid;
}

body.dash-pro .sidebar-action .nav-num {
    font-size: 1rem;
    font-weight: 400;
}

body.dash-pro .sidebar-muted {
    padding: 0.5rem 0.625rem;
    color: var(--ink-3);
    font-size: 0.825rem;
    font-style: italic;
}

/* Mode B: per-app context */
body.dash-pro .sidebar-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: transparent;
    border: none;
    color: var(--ink-3);
    font-family: var(--sans);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: color 120ms ease, background 120ms ease;
}

body.dash-pro .sidebar-back:hover {
    color: var(--ink);
    background: var(--paper-2);
}

body.dash-pro .sidebar-back .back-arrow {
    font-size: 1rem;
    line-height: 1;
}

body.dash-pro .sidebar-current {
    padding: 0.75rem 0.625rem 1rem;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 0.25rem;
}

body.dash-pro .sidebar-current .kicker {
    margin-bottom: 0.25rem;
    font-size: 0.65rem;
}

body.dash-pro .sidebar-current-name {
    margin: 0.1rem 0 0.2rem;
    font-family: var(--sans);
    font-weight: 650;
    font-size: 0.95rem;
    color: var(--ink);
    letter-spacing: -0.01em;
    line-height: 1.2;
    font-style: normal;
}

body.dash-pro .sidebar-current-id {
    margin: 0;
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--ink-3);
    letter-spacing: 0.02em;
}

/* Sidebar footer */
body.dash-pro .sidebar-footer {
    border-top: 1px solid var(--border-soft);
    padding-top: 0.875rem;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

body.dash-pro .sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.25rem 0.5rem;
}

body.dash-pro .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ink) 0%, var(--ink-2) 100%);
    flex-shrink: 0;
    display: inline-block;
    box-shadow: var(--shadow-sm);
}

body.dash-pro .sidebar-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

body.dash-pro .sidebar-username {
    font-family: var(--sans);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: 0;
    text-transform: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.dash-pro .user-label {
    font-family: var(--sans);
    font-size: 0.7rem;
    color: var(--ink-3);
    letter-spacing: 0;
    text-transform: none;
}

body.dash-pro .sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

body.dash-pro .sidebar-theme-toggle,
body.dash-pro .sidebar-logout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.45rem 0.625rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-family: var(--sans);
    font-size: 0.825rem;
    font-weight: 500;
    color: var(--ink-2);
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
}

body.dash-pro .sidebar-theme-toggle:hover,
body.dash-pro .sidebar-logout:hover {
    background: var(--paper-2);
    color: var(--ink);
}

body.dash-pro .theme-icon {
    font-family: var(--sans);
    font-size: 0.95rem;
    line-height: 1;
}

body.dash-pro .arrow {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--ink-3);
}

/* (Removed: this hid the nav and footer on mobile, making the drawer
   useless. Drawer now shows the full sidebar contents.) */

/* ─── Top bar / section heads ────────────────────────────────────── */
body.dash-pro header#topbar {
    padding: 0 0 1rem;
    max-width: none;
}

body.dash-pro .section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    margin-top: 0;
    margin-bottom: 1.5rem;
}

body.dash-pro .section-head > div { max-width: 44rem; }

body.dash-pro .section-head .muted {
    margin-top: 0.4rem;
    color: var(--ink-3);
}

body.dash-pro .head-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ─── Buttons ────────────────────────────────────────────────────── */
body.dash-pro .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--sans);
    font-size: 0.825rem;
    letter-spacing: 0;
    font-weight: 600;
    text-transform: none;
    padding: 0.5rem 0.85rem;
    background: var(--ink);
    color: var(--paper);
    border: 1px solid var(--ink);
    border-radius: 8px;
    cursor: pointer;
    transition: transform 100ms ease, background 140ms ease, box-shadow 140ms ease;
    box-shadow: var(--shadow-sm);
}

body.dash-pro .btn-primary:hover {
    background: var(--ink-2);
    border-color: var(--ink-2);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

body.dash-pro .btn-primary:active { transform: translateY(0); }

body.dash-pro .btn-primary[disabled] {
    opacity: 0.5;
    cursor: progress;
    transform: none;
}

body.dash-pro .btn-primary .btn-arrow { font-size: 0.95em; }

body.dash-pro .btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--sans);
    font-size: 0.825rem;
    letter-spacing: 0;
    font-weight: 500;
    text-transform: none;
    padding: 0.5rem 0.85rem;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease, transform 100ms ease;
}

body.dash-pro .btn-ghost:hover {
    background: var(--paper-2);
    border-color: var(--ink-3);
}

body.dash-pro .btn-ghost.danger {
    color: var(--danger);
    border-color: var(--border-strong);
}

body.dash-pro .btn-ghost.danger:hover {
    background: rgba(220, 38, 38, 0.06);
    border-color: var(--danger);
    color: var(--danger);
}

[data-theme="dark"] body.dash-pro .btn-ghost.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

body.dash-pro .btn-ghost[disabled] { opacity: 0.4; cursor: not-allowed; }

/* Loading state: reuse the auth-style ring spinner. */
body.dash-pro .btn-primary.loading,
body.dash-pro .btn-ghost.loading {
    pointer-events: none;
    position: relative;
}

body.dash-pro .btn-primary.loading .btn-label,
body.dash-pro .btn-primary.loading .btn-arrow,
body.dash-pro .btn-ghost.loading .btn-label {
    opacity: 0;
}

body.dash-pro .btn-primary.loading::after,
body.dash-pro .btn-ghost.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    background: transparent;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: dashBtnSpin 0.65s linear infinite;
}

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

/* ─── Cards: apps grid ──────────────────────────────────────────── */
body.dash-pro .apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    border: none;
}

body.dash-pro .app-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.25rem 1rem;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 180ms ease, border-color 140ms ease;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 138px;
}

body.dash-pro .app-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
    background: var(--surface);
}

body.dash-pro .app-card:hover .app-card-arrow {
    color: var(--ink);
    transform: translate(3px, -3px);
}

body.dash-pro .app-card-id {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    color: var(--ink-3);
    text-transform: none;
}

body.dash-pro .app-card-name {
    font-family: var(--sans);
    font-weight: 650;
    font-size: 1.15rem;
    line-height: 1.25;
    color: var(--ink);
    margin: 0.1rem 0 0.6rem;
    letter-spacing: -0.012em;
}

body.dash-pro .app-card-stats {
    font-family: var(--sans);
    font-size: 0.78rem;
    color: var(--ink-3);
    letter-spacing: 0;
    display: flex;
    gap: 1rem;
    margin-top: auto;
    font-variant-numeric: tabular-nums;
}

body.dash-pro .app-card-stats strong {
    color: var(--ink);
    font-weight: 600;
}

body.dash-pro .app-card-status {
    position: absolute;
    top: 1.1rem;
    right: 1.25rem;
    font-family: var(--sans);
    font-size: 0.7rem;
    letter-spacing: 0;
    font-weight: 500;
    text-transform: none;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: var(--paper-2);
    border: 1px solid var(--border-soft);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

body.dash-pro .app-card-status::before { content: ""; margin: 0; }
body.dash-pro .app-card-status::after  { content: ""; }

/* Active = green tinted pill + green dot, Off/Paused = red tinted pill + red dot.
   Mirrors the bracket-tag semantic states for cross-surface consistency. */
body.dash-pro .app-card-status.on {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: #15803d;
}

body.dash-pro .app-card-status.on::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
}

body.dash-pro .app-card-status.off {
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.3);
    color: #b91c1c;
}

body.dash-pro .app-card-status.off::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
}

[data-theme="dark"] body.dash-pro .app-card-status.on {
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(34, 197, 94, 0.35);
    color: #4ade80;
}

[data-theme="dark"] body.dash-pro .app-card-status.off {
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}

body.dash-pro .app-card-arrow {
    position: absolute;
    bottom: 1.1rem;
    right: 1.25rem;
    font-family: var(--sans);
    font-size: 1.1rem;
    color: var(--ink-3);
    transition: transform 160ms ease, color 140ms ease;
}

/* ─── Empty state ────────────────────────────────────────────────── */
body.dash-pro .empty-state {
    text-align: center;
    padding: 4rem 1.5rem;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    margin-top: 1rem;
}

body.dash-pro .empty-state.small { padding: 2.5rem 1.5rem; }

body.dash-pro .empty-state .display {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
    font-weight: 650;
}

body.dash-pro .empty-state .display em {
    font-style: normal;
    color: var(--ink);
    border-bottom: none;
}

body.dash-pro .empty-state .muted {
    margin-bottom: 1.5rem;
    color: var(--ink-3);
}

/* ─── Stat row / tiles ───────────────────────────────────────────── */
body.dash-pro .stat-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.875rem;
    margin: 1rem 0 1.5rem;
}

@media (max-width: 720px) {
    body.dash-pro .stat-row { grid-template-columns: repeat(2, 1fr); }
}

body.dash-pro .stat {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 1rem 1.125rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: flex-start;
}

body.dash-pro .stat:first-child,
body.dash-pro .stat:nth-child(odd) { background: var(--surface); }

body.dash-pro .stat-label {
    font-family: var(--sans);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-3);
}

body.dash-pro .stat-value {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 1.875rem;
    letter-spacing: -0.02em;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

body.dash-pro .stat-value.danger {
    color: var(--ink);
    font-weight: 700;
}

/* (No triangle glyph — bare number is cleaner.) */
body.dash-pro .stat-value.danger::before {
    content: none;
}

/* ─── Meta grid ──────────────────────────────────────────────────── */
body.dash-pro .meta-grid {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem 1.5rem;
    margin: 1rem 0;
    border-top: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
}

/* ─── Status card ────────────────────────────────────────────────── */
body.dash-pro .status-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-left: 3px solid var(--ink);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 0.85rem 1.25rem;
}

body.dash-pro .status-card.paused {
    border-left-style: dashed;
    border-left-color: var(--ink-3);
    background: var(--paper-2);
}

body.dash-pro .status-card-title { font-family: var(--sans); font-weight: 650; font-style: normal; font-size: 1rem; }

body.dash-pro .status-card-title strong {
    color: var(--ink);
    border-bottom: none;
    font-weight: 700;
}

body.dash-pro .status-card.paused .status-card-title strong {
    color: var(--ink-3);
}

body.dash-pro .status-card-sub {
    font-family: var(--sans);
    color: var(--ink-3);
    letter-spacing: 0;
}

/* ─── Tables ─────────────────────────────────────────────────────── */
body.dash-pro table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

body.dash-pro thead th {
    text-align: left;
    padding: 0.65rem 0.875rem;
    background: var(--paper-2);
    border-bottom: 1px solid var(--border-soft);
    font-family: var(--sans);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-3);
}

body.dash-pro tbody td {
    padding: 0.65rem 0.875rem;
    border-bottom: 1px solid var(--border-soft);
    font-size: 0.875rem;
    color: var(--ink-2);
}

body.dash-pro tbody tr:last-child td { border-bottom: none; }

body.dash-pro tbody tr:hover td { background: var(--paper-2); }

/* ─── Form fields ────────────────────────────────────────────────── */
/* Broadened — covers url/search/tel that base editorial styles didn't,
   which made the download-link input render differently from siblings. */
body.dash-pro .form input[type="text"],
body.dash-pro .form input[type="password"],
body.dash-pro .form input[type="email"],
body.dash-pro .form input[type="number"],
body.dash-pro .form input[type="url"],
body.dash-pro .form input[type="search"],
body.dash-pro .form input[type="tel"],
body.dash-pro .form input:not([type]),
body.dash-pro .form textarea,
body.dash-pro .form select {
    background: var(--field-bg);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 0.55rem 0.75rem;
    font-family: var(--sans);
    font-size: 0.875rem;
    color: var(--ink);
    transition: border-color 140ms ease, box-shadow 160ms ease;
}

body.dash-pro .form input::placeholder,
body.dash-pro .form textarea::placeholder {
    color: var(--ink-3);
    font-family: var(--sans);
    font-style: normal;
    opacity: 1;
}

body.dash-pro .form input:focus,
body.dash-pro .form textarea:focus,
body.dash-pro .form select:focus {
    outline: none;
    border-color: var(--ink);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] body.dash-pro .form input:focus,
[data-theme="dark"] body.dash-pro .form textarea:focus,
[data-theme="dark"] body.dash-pro .form select:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

/* ─── Back link (used by app detail header) ─────────────────────── */
body.dash-pro .back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: transparent;
    border: none;
    color: var(--ink-3);
    font-family: var(--sans);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
    padding: 0.25rem 0;
    transition: color 120ms ease;
}

body.dash-pro .back-link:hover { color: var(--ink); }

body.dash-pro .back-link .back-arrow { font-size: 1rem; line-height: 1; }

/* (Removed: #apps-list:empty + .empty-state forced display:block, which
   flashed the empty state during the load-before-JS gap and over-rode the
   [hidden] attribute. JS already toggles .hidden correctly.) */

/* ─── Modal/dialog softening ────────────────────────────────────── */
body.dash-pro .modal,
body.dash-pro .dialog,
body.dash-pro [role="dialog"],
body.dash-pro .paper-dialog {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-lg);
    background: var(--surface);
    color: var(--ink);
    padding: 1.5rem 1.5rem 1.25rem;
}

/* Dialog actions row — equal spacing, ghost cancel + primary action */
body.dash-pro .dialog-actions {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    margin-top: 1.25rem;
}

body.dash-pro .dialog-actions.end {
    justify-content: flex-end;
}

/* Confirm checkbox — soft surface card matching dash-pro form chrome. */
body.dash-pro .confirm-check {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin: 0.85rem 0 0.25rem;
    padding: 0.7rem 0.9rem;
    background: var(--paper-2);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    font-family: var(--sans);
    font-size: 0.875rem;
    color: var(--ink-2);
    transition: border-color 140ms ease, background 140ms ease;
}

body.dash-pro .confirm-check:hover {
    background: var(--paper-3);
    border-color: var(--border-strong);
    color: var(--ink);
}

body.dash-pro .confirm-check input {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    width: 18px;
    height: 18px;
    margin: 0;
    border: 1.5px solid var(--border-strong);
    border-radius: 4px;
    background: var(--surface);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 140ms ease, border-color 140ms ease;
}

body.dash-pro .confirm-check input:hover {
    border-color: var(--ink-3);
}

/* Inline SVG checkmark as a background image — reliable, sharp, properly
   centered. Two variants: white stroke for light mode (white check on dark
   bg), dark stroke for dark mode (dark check on light bg). */
body.dash-pro .confirm-check input:checked {
    background-color: var(--ink);
    border-color: var(--ink);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23fafafa' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3.5 8 6.5 11 12.5 5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 14px 14px;
}

[data-theme="dark"] body.dash-pro .confirm-check input:checked {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%230a0a0c' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3.5 8 6.5 11 12.5 5'/%3E%3C/svg%3E");
}

body.dash-pro .confirm-check input:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

/* Dialog kicker — smaller, subtle */
body.dash-pro .paper-dialog .kicker {
    font-size: 0.68rem;
    color: var(--ink-3);
    margin-bottom: 0.3rem;
}

/* Title spacing inside dialog */
body.dash-pro .paper-dialog .display {
    font-size: 1.25rem;
    font-weight: 650;
    margin: 0 0 0.5rem;
    letter-spacing: -0.015em;
}

body.dash-pro .paper-dialog .muted {
    margin: 0 0 0.5rem;
    line-height: 1.5;
}

/* ── Keys-reveal dialog (Issued / New license keys) ──────────────
   Soft surface list with hairline rows, refined Copy chip per row,
   "Copy all" button aligned right above the list. */

body.dash-pro .keys-reveal-actions {
    display: flex;
    justify-content: flex-end;
    margin: 0.5rem 0 0.75rem;
}

body.dash-pro .key-list {
    background: var(--paper-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    max-height: 360px;
    overflow-y: auto;
}

body.dash-pro .key-list .key-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--border-soft);
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--ink);
    transition: background 120ms ease;
}

body.dash-pro .key-list .key-row:last-child {
    border-bottom: none;
}

body.dash-pro .key-list .key-row:hover {
    background: var(--surface);
}

body.dash-pro .key-list .key-row > span:first-child {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.dash-pro .key-list .key-row .copy-icon {
    font-family: var(--sans);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--ink-3);
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
    padding: 0.25rem 0.55rem;
    border-radius: 6px;
    border: 1px solid transparent;
    flex-shrink: 0;
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

body.dash-pro .key-list .key-row:hover .copy-icon {
    color: var(--ink-2);
}

body.dash-pro .key-list .key-row .copy-icon:hover {
    background: var(--paper-3);
    border-color: var(--border-strong);
    color: var(--ink);
}

/* Inline warning banner inside dialogs — soft amber tone with a leading
   dot. Replaces verbose explanatory paragraphs with a single-line cue. */
body.dash-pro .dialog-alert {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.25rem 0 1rem;
    padding: 0.55rem 0.8rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    color: #b45309;
    font-family: var(--sans);
    font-size: 0.825rem;
    font-weight: 500;
    line-height: 1.45;
}

body.dash-pro .dialog-alert-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

[data-theme="dark"] body.dash-pro .dialog-alert {
    background: rgba(251, 191, 36, 0.12);
    border-color: rgba(251, 191, 36, 0.3);
    color: #fbbf24;
}

/* ── Secret-block: integrate the Copy button as a trailing segment.
   Was a free-floating ghost button to the right of the field; now it
   docks into the same bordered shell with a hairline divider. */
body.dash-pro .secret-block {
    display: flex;
    align-items: stretch;
    background: var(--field-bg);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    margin: 0.4rem 0 1.25rem;
    overflow: hidden;
    transition: border-color 140ms ease, box-shadow 160ms ease;
}

body.dash-pro .secret-block:focus-within,
body.dash-pro .secret-block:hover {
    border-color: var(--ink);
}

body.dash-pro .secret-block code {
    flex: 1;
    padding: 0.7rem 0.9rem;
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--ink);
    word-break: break-all;
    background: transparent;
    border: none;
}

body.dash-pro .secret-block.code-snippet {
    flex-direction: column;
    align-items: stretch;
}

body.dash-pro .secret-block.code-snippet pre {
    margin: 0;
    padding: 0.85rem 1rem;
    overflow-x: auto;
    border-bottom: 1px solid var(--border-strong);   /* full-width divider */
}

body.dash-pro .secret-block.code-snippet pre code {
    padding: 0;
    background: transparent;
    border: none;
    white-space: pre;
}

/* Copy button: ghost segmented part of the field, not a separate pill. */
body.dash-pro .secret-block .copy-btn,
body.dash-pro .secret-block .btn-ghost.copy-btn {
    flex-shrink: 0;
    padding: 0 1rem;
    background: transparent;
    border: none;
    border-left: 1px solid var(--border-strong);
    border-radius: 0;
    font-family: var(--sans);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--ink-2);
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
    box-shadow: none;
    min-width: 72px;
}

body.dash-pro .secret-block .copy-btn:hover {
    background: var(--paper-2);
    color: var(--ink);
}

body.dash-pro .secret-block.code-snippet .copy-btn {
    border-left: none;
    border-top: none;                                /* divider lives on pre now */
    align-self: flex-end;
    padding: 0.5rem 1.25rem;
    min-width: auto;
}

/* ── Broadcast card: modern card chrome ─────────────────────────
   Base styles used mono uppercase head + harsh ink border. Now soft
   surface chrome, sentence-case head, refined counter. */
body.dash-pro .broadcast-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: border-color 140ms ease, box-shadow 180ms ease;
}

body.dash-pro .broadcast-card:focus-within {
    border-color: var(--ink);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] body.dash-pro .broadcast-card:focus-within {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

body.dash-pro .broadcast-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.875rem;
    background: var(--paper-2);
    border-bottom: 1px solid var(--border-soft);
    font-family: var(--sans);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--ink-3);
    text-transform: none;
}

body.dash-pro .broadcast-label {
    flex: 1;
    font-style: normal;
}

body.dash-pro .broadcast-counter {
    font-family: var(--mono);
    font-size: 0.7rem;
    font-variant-numeric: tabular-nums;
    color: var(--ink-3);
    letter-spacing: 0;
    margin-left: auto;   /* label removed — keep the counter pinned right */
}

body.dash-pro .broadcast-counter.near-limit { color: var(--danger); }

body.dash-pro .broadcast-card textarea {
    border: none;
    background: transparent;
    padding: 0.85rem 1rem;
    font-family: var(--sans);
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--ink);
    resize: vertical;
    min-height: 100px;
    outline: none;
    border-radius: 0;
}

body.dash-pro .broadcast-card textarea::placeholder {
    color: var(--ink-3);
    font-style: normal;
    font-family: var(--sans);
}

/* ── Loader empty state: replace Unicode glyph with proper SVG icon. */
body.dash-pro .dist-loader-empty::before {
    content: none;                 /* kill the editorial ⇪ pseudo-content */
}

body.dash-pro .dist-loader-icon {
    width: 44px;
    height: 44px;
    color: var(--ink-3);
    margin: 0 auto 0.25rem;
    transition: color 140ms ease, transform 200ms ease;
}

body.dash-pro .dist-loader.drag-over .dist-loader-icon {
    color: var(--ink);
    transform: translateY(-3px);
}

body.dash-pro .dist-loader-empty .field-hint {
    font-style: normal;
    margin-top: 0.5rem;
    color: var(--ink-3);
}

/* OR BROWSE / Upload-loader button inside the empty state — refined. */
body.dash-pro .dist-loader-empty .btn-primary {
    margin: 0.4rem auto 0;
}

/* ── Floating-label inputs (.field-floating) ─────────────────────
   Modern Material-style label: sits centered inside the empty input,
   floats up to the border on focus or when the input has a value.
   Requires DOM order: <input> first, then <label>. */

body.dash-pro .field-floating {
    position: relative;
    margin: 0;
}

/* Field-error must NOT contribute to .field-floating's height — otherwise
   the label's `top: 50%` resolves to 50% of (input + error) which puts
   the label below the input's true center. Float the error below absolutely.
   Style matches the login page (bold ink, not red) for cross-page consistency. */
body.dash-pro .field-floating .field-error {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.7rem;
    font-size: 0.82rem;
    color: var(--ink);
    font-weight: 600;
    text-align: center;
}

body.dash-pro .field-floating input,
body.dash-pro .field-floating textarea {
    width: 100%;
    padding: 1.05rem 0.85rem 0.4rem;       /* compact box, big text */
    font-family: var(--sans);
    font-size: 1.05rem;                     /* bumped — main change */
    line-height: 1.3;
}

/* The label — absolutely positioned over the input. */
body.dash-pro .field-floating label {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    padding: 0 0.4rem;
    font-family: var(--sans);
    font-size: 1.05rem;                     /* matches input font when inside */
    font-weight: 400;
    color: var(--ink-3);
    background: var(--field-bg);
    border-radius: 3px;
    pointer-events: none;
    transition:
        top 160ms cubic-bezier(0.4, 0, 0.2, 1),
        font-size 160ms cubic-bezier(0.4, 0, 0.2, 1),
        color 160ms ease,
        font-weight 160ms ease;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1;
    z-index: 1;
}

/* Float the label when the field is focused OR has content (placeholder-shown
   trick — only true when input is empty AND has a placeholder attribute).
   The label rises to sit on the top border, smaller, ink-colored. */
body.dash-pro .field-floating input:focus ~ label,
body.dash-pro .field-floating input:not(:placeholder-shown) ~ label,
body.dash-pro .field-floating textarea:focus ~ label,
body.dash-pro .field-floating textarea:not(:placeholder-shown) ~ label {
    top: 0;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--ink-2);
}

/* When focused, the label uses the focused border color so it reads
   "active" — matches the input's focus ring tone. */
body.dash-pro .field-floating input:focus ~ label,
body.dash-pro .field-floating textarea:focus ~ label {
    color: var(--ink);
}

/* Hide the native placeholder when the field is NOT focused, so the
   floating label is the only thing showing inside the empty input.
   Once focused, the placeholder reappears as a format hint. */
body.dash-pro .field-floating input:not(:focus)::placeholder,
body.dash-pro .field-floating textarea:not(:focus)::placeholder {
    color: transparent;
}

/* ── Tamper-check dropzone: shield icon + softer chrome ──────────
   Was a 1px-dashed editorial card with a ⌗ glyph that rendered as a
   small square. Now matches the loader-file empty state — soft surface
   card with a proper outlined shield-check SVG. */
/* Solid border + soft surface — a true twin of .dist-loader (the loader-file
   card on the Distribution tab), so both dropzones read as one component. */
body.dash-pro .hash-dropzone {
    margin-top: 0.75rem;
    border: 1px solid var(--border-soft);
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

body.dash-pro .hash-dropzone.drag-over {
    border-color: var(--ink);
    background: var(--paper-2);
}

body.dash-pro .hash-dropzone-state {
    padding: 1.1rem 1.25rem 1rem;
    gap: 0.4rem;
}

/* Kill the editorial ⌗ pseudo-icon. */
body.dash-pro .hash-dropzone-state[data-state="empty"]::before {
    content: none;
}

body.dash-pro .hash-dropzone-icon {
    width: 44px;
    height: 44px;
    color: var(--ink-3);
    margin: 0 auto 0.25rem;
    transition: color 140ms ease, transform 200ms ease;
}

body.dash-pro .hash-dropzone.drag-over .hash-dropzone-icon {
    color: var(--ink);
    transform: translateY(-3px);
}

body.dash-pro .hash-dropzone-state strong {
    font-family: var(--sans);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--ink);
    text-transform: none;
}

body.dash-pro .hash-dropzone-state em {
    font-family: var(--mono);
    font-style: normal;
    color: var(--ink);
}

/* Primary button + hint, matching .dist-loader-empty on the Distribution tab. */
body.dash-pro .hash-dropzone-state .btn-primary {
    margin: 0.4rem auto 0;
}

body.dash-pro .hash-dropzone-state .field-hint {
    font-style: normal;
    margin-top: 0.5rem;
    color: var(--ink-3);
}

/* ── Hash list ───────────────────────────────────────────────────
   Base editorial chrome uses hard ink-3 hash-row borders; modernize to
   soft surface cards. */

body.dash-pro .hash-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 1rem;
}

body.dash-pro .hash-row {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 0.85rem 1.1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* Stacked column: head (filename + hash inline) on top, date below. */
body.dash-pro .hash-row-meta {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 0.3rem;
    min-width: 0;
    flex: 1;
    text-align: left !important;
}

/* Head row: filename + hash chip side-by-side, left-aligned. */
body.dash-pro .hash-row-head {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    width: 100%;
}

body.dash-pro .hash-row-head strong {
    font-family: var(--sans);
    font-size: 0.92rem;
    font-weight: 650;
    color: var(--ink);
    letter-spacing: -0.005em;
    flex-shrink: 0;
}

body.dash-pro .hash-row-head code {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--ink-3);
    background: var(--paper-2);
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
    border: 1px solid var(--border-soft);
    user-select: all;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

body.dash-pro .hash-row-meta .muted {
    font-family: var(--sans);
    font-size: 0.75rem;
    color: var(--ink-3);
    letter-spacing: 0;
    margin: 0;
}

body.dash-pro .hash-row .btn-ghost {
    flex-shrink: 0;
    text-transform: none;
    letter-spacing: 0;
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
}

/* ─── Toasts (color-neutral) ────────────────────────────────────── */
body.dash-pro .toast {
    background: var(--ink);
    color: var(--paper);
    border: 1px solid var(--ink);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-family: var(--sans);
    font-size: 0.85rem;
}

body.dash-pro .toast.error { background: var(--danger); border-color: var(--danger); }
body.dash-pro .toast.success { background: var(--ink); color: var(--paper); }

/* ─── Selection ─────────────────────────────────────────────────── */
body.dash-pro *::selection {
    background: var(--ink);
    color: var(--paper);
}

[data-theme="dark"] body.dash-pro *::selection {
    background: var(--ink);
    color: var(--paper);
}

/* ─── Reveal ────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    body.dash-pro .app-card,
    body.dash-pro .btn-primary,
    body.dash-pro .btn-ghost { transition: none; }
    body.dash-pro .btn-primary:hover,
    body.dash-pro .app-card:hover { transform: none; }
    body.dash-pro aside#sidebar { transition: none; }
}

/* ─── Mobile drawer chrome ─────────────────────────────────────── */
body.dash-pro .sidebar-toggle {
    display: none;
    position: fixed;
    top: 0.85rem;
    left: 0.85rem;
    z-index: 60;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: background 140ms ease, transform 120ms ease;
}

body.dash-pro .sidebar-toggle:hover {
    background: var(--paper-2);
}

body.dash-pro .sidebar-toggle:active { transform: scale(0.96); }

body.dash-pro .sidebar-toggle svg { display: block; }

/* Animate hamburger → X when drawer is open. */
body.dash-pro .sidebar-toggle svg path {
    transform-origin: center;
    transition: transform 220ms ease, opacity 180ms ease;
}

body.dash-pro.sidebar-open .sidebar-toggle .sb-bar-1 {
    transform: translateY(6px) rotate(45deg);
}

body.dash-pro.sidebar-open .sidebar-toggle .sb-bar-2 {
    opacity: 0;
}

body.dash-pro.sidebar-open .sidebar-toggle .sb-bar-3 {
    transform: translateY(-6px) rotate(-45deg);
}

body.dash-pro .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

body.dash-pro.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
}

/* Show drawer chrome only on mobile widths. */
@media (max-width: 980px) {
    body.dash-pro .sidebar-toggle { display: inline-flex; }
    body.dash-pro .sidebar-backdrop { display: block; }
    /* Keep main padding clear of the hamburger button. */
    body.dash-pro main#app { padding-top: 3.5rem; }
}

/* Prevent background scroll when drawer is open. */
body.dash-pro.sidebar-open {
    overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════════
   Defensive sidebar overrides — kill editorial leakage.

   Base .sidebar-list and .sidebar-list li button rules set hairline
   borders, mono uppercase tracking, italic serif app-nums, and a
   border-left that I missed when writing the dash-pro pass. Properties
   not explicitly overridden cascade from base, so these had to be
   forced one-by-one. */

body.dash-pro .sidebar-list {
    border: none;
    padding: 0;
    margin: 0;
}

body.dash-pro .sidebar-list li {
    margin: 0;
}

body.dash-pro .sidebar-list li button {
    color: var(--ink-2);
    font-family: var(--sans);
    font-size: 0.875rem;
    font-style: normal;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    border: none;
    border-left: none;
    padding: 0.5rem 0.625rem;
    align-items: center;
}

body.dash-pro .sidebar-list li button:hover {
    background: var(--paper-2);
    color: var(--ink);
    padding-left: 0.625rem;
}

/* Active state: soft tinted pill with a 3px ink accent bar on the left.
   Replaces the stark solid-ink block, which read like a banner in dark
   mode. The accent bar pins identity; the bg tint signals "currently here"
   without competing with the rest of the sidebar. */
body.dash-pro .sidebar-list li button.active {
    background: var(--paper-3);
    color: var(--ink);
    font-weight: 650;
    padding-left: 0.875rem;        /* shifts text right to accommodate bar */
    position: relative;
    border-left: none;
    box-shadow: inset 3px 0 0 0 var(--ink);
}

body.dash-pro .sidebar-list li button.active:hover {
    background: var(--paper-3);     /* don't lighten on hover when active */
    padding-left: 0.875rem;
}

body.dash-pro .sidebar-list .app-num {
    font-family: var(--mono);
    font-size: 0.72rem;
    font-style: normal;
    color: var(--ink-3);
    letter-spacing: 0;
    font-weight: 500;
}

body.dash-pro .sidebar-list li button.active .app-num {
    color: var(--paper);
}

body.dash-pro .sidebar-list .app-name {
    color: inherit;
    font-family: var(--sans);
    font-style: normal;
    letter-spacing: 0;
}

/* Action button (+ New application): kill the uppercase tracked mono. */
body.dash-pro .sidebar-action {
    color: var(--ink-3);
    font-family: var(--sans);
    font-size: 0.825rem;
    font-style: normal;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    border: 1px dashed var(--border-strong);
    border-radius: 8px;
    text-align: left;
    justify-content: flex-start;
    padding: 0.5rem 0.625rem;
    margin-top: 0.5rem;
}

body.dash-pro .sidebar-action:hover {
    background: var(--paper-2);
    color: var(--ink);
    border-color: var(--ink-3);
    border-style: solid;
}

/* Sidebar nav items in mode B (per-app): match. */
body.dash-pro .sidebar-nav-item {
    text-transform: none;
    letter-spacing: 0;
    font-style: normal;
    border-left: none;
}

/* ── Sidebar nav: polish pass ────────────────────────────────────
   Tighter section labels, clearer disabled state, more tactile hover. */

/* NAVIGATION / APPLICATIONS section labels — tighter to their list. */
body.dash-pro .sidebar-section {
    margin-bottom: 0.5rem;
    padding-left: 0.625rem;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    color: var(--ink-3);
    opacity: 0.85;
}

/* Inactive items: refined hover — subtle bg + tiny indent for tactile feel. */
body.dash-pro .sidebar-list li button:not(.active):hover,
body.dash-pro .sidebar-nav-item:not(.active):not(.disabled):hover {
    background: var(--paper-2);
    color: var(--ink);
    padding-left: 0.75rem;        /* tiny 2px slide */
}

/* Disabled items: clearer demote. Not just opacity — also cursor & no hover. */
body.dash-pro .sidebar-nav-item.disabled {
    color: var(--ink-3);
    cursor: not-allowed;
    opacity: 0.5;
    font-style: normal;
}

body.dash-pro .sidebar-nav-item.disabled:hover {
    background: transparent;
    color: var(--ink-3);
    padding-left: 0.625rem;       /* no slide */
}

/* Soon tag: refined pill — smaller, softer, with subtle accent. */
body.dash-pro .soon-tag {
    margin-left: auto;
    font-family: var(--sans);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.12rem 0.42rem;
    border: 1px solid var(--border-strong);
    background: var(--paper-2);
    color: var(--ink-3);
    border-radius: 4px;
    font-style: normal;
    line-height: 1.3;
}

/* Group spacing: whitespace-only rest between disabled "Soon" cluster
   and the Sessions/Settings group. No divider line. */
body.dash-pro .sidebar-nav-list li:has(.sidebar-nav-item.disabled) + li:not(:has(.sidebar-nav-item.disabled)) {
    margin-top: 0.75rem;
}

/* Sidebar-current (the "Application / Test" card above NAVIGATION) — refine.
   No bottom divider; whitespace separates from NAVIGATION below. */
body.dash-pro .sidebar-current {
    padding: 0.65rem 0.75rem 0.9rem;
    margin-bottom: 0.25rem;
    border-bottom: none;
    border-radius: 0;
}

body.dash-pro .sidebar-current .kicker {
    margin-bottom: 0.2rem;
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    opacity: 0.85;
}

body.dash-pro .sidebar-current-name {
    margin: 0;
    font-family: var(--sans);
    font-weight: 700;
    font-size: 1rem;
    color: var(--ink);
    letter-spacing: -0.015em;
    line-height: 1.2;
    font-style: normal;
}

/* Back-link: more tactile (slide-back on hover) */
body.dash-pro .sidebar-back {
    transition: color 140ms ease, background 140ms ease, padding-left 140ms ease;
}

body.dash-pro .sidebar-back:hover {
    color: var(--ink);
    background: var(--paper-2);
    padding-left: 0.35rem;
}

body.dash-pro .sidebar-back .back-arrow {
    transition: transform 140ms ease;
}

body.dash-pro .sidebar-back:hover .back-arrow {
    transform: translateX(-2px);
}

/* ═══════════════════════════════════════════════════════════════════
   ░ DASH-PRO — Per-app detail surfaces  ─────────────────────────
   Header, meta-grid, filter-bar, data-table, bulk-bar, pagination,
   small empty states, settings tabs + form, switch, bracket-tag.
   Each block kills editorial chrome and lays down modern SaaS treatment.
   ═══════════════════════════════════════════════════════════════════ */

/* ── App-detail header: cleaner action row ──────────────────────── */
body.dash-pro #view-app .back-link {
    margin-bottom: 1.25rem;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.825rem;
}

body.dash-pro #app-id-kicker {
    cursor: default;
    font-family: var(--mono);
    letter-spacing: 0;
    font-size: 0.7rem;
    text-transform: none;
    color: var(--ink-3);
    font-weight: 500;
}

/* ── Meta grid: real card with proper rows ──────────────────────── */
body.dash-pro .meta-grid {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1rem 1.25rem;
    margin: 1.25rem 0 1.5rem;
    display: grid;
    grid-template-columns: max-content 1fr max-content 1fr;
    gap: 0.5rem 1.5rem;
    align-items: center;
}

body.dash-pro .meta-grid dt {
    font-family: var(--sans);
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--ink-3);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin: 0;
}

body.dash-pro .meta-grid dd {
    margin: 0;
    font-family: var(--sans);
    font-size: 0.875rem;
    color: var(--ink);
    font-weight: 500;
    word-break: break-all;
}

body.dash-pro .meta-grid .copyable {
    font-family: var(--mono);
    font-size: 0.78rem;
    background: var(--paper-2);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-soft);
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease;
    display: inline-block;
}

body.dash-pro .meta-grid .copyable:hover {
    background: var(--paper-3);
    border-color: var(--border-strong);
}

@media (max-width: 720px) {
    body.dash-pro .meta-grid {
        grid-template-columns: max-content 1fr;
    }
}

/* ── Filter bar: combined search + select ───────────────────────── */
body.dash-pro .filter-bar {
    display: inline-flex;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 140ms ease, box-shadow 180ms ease;
}

body.dash-pro .filter-bar:focus-within {
    border-color: var(--ink);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] body.dash-pro .filter-bar:focus-within {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

body.dash-pro .filter-bar input[type="text"],
body.dash-pro .filter-bar input[type="search"],
body.dash-pro .filter-bar input:not([type]) {
    border: none;
    border-radius: 0;
    background: transparent;
    padding: 0.5rem 0.85rem;
    font-family: var(--sans);
    font-size: 0.875rem;
    color: var(--ink);
    min-width: 220px;
    outline: none;
    box-shadow: none;
}

body.dash-pro .filter-bar input::placeholder {
    color: var(--ink-3);
}

body.dash-pro .filter-bar select {
    border: none;
    border-left: 1px solid var(--border-soft);
    border-radius: 0;
    background: var(--paper-2);
    padding: 0.5rem 0.75rem;
    padding-right: 1.75rem;
    font-family: var(--sans);
    font-size: 0.825rem;
    color: var(--ink-2);
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238a8a92' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.625rem center;
}

body.dash-pro .filter-bar select:hover { background-color: var(--paper-3); }

/* ── Data table: modern soft chrome ─────────────────────────────── */
body.dash-pro .data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin: 1rem 0;
    font-variant-numeric: tabular-nums;
}

body.dash-pro .data-table thead th {
    text-align: left;
    padding: 0.65rem 0.875rem;
    background: var(--paper-2);
    border-bottom: 1px solid var(--border-soft);
    font-family: var(--sans);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-3);
    position: sticky;
    top: 0;
    z-index: 1;
}

body.dash-pro .data-table tbody td {
    padding: 0.7rem 0.875rem;
    border-bottom: 1px solid var(--border-soft);
    font-size: 0.875rem;
    color: var(--ink-2);
    vertical-align: middle;
}

body.dash-pro .data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Force rounded clipping at the table level via clip-path — `overflow: hidden`
   alone doesn't always clip cell backgrounds at the rounded corners in
   Chromium-based browsers, producing a visible white-square artifact in
   the bottom-right when a corner cell is empty. clip-path is enforced. */
body.dash-pro .data-table {
    clip-path: inset(0 round var(--radius));
    isolation: isolate;
}

body.dash-pro .data-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: var(--radius);
}
body.dash-pro .data-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: var(--radius);
}

/* Universal: empty row-actions cells get a subtle "—" placeholder so they
   read as "no actions available" rather than a broken white block.
   Works for mixed tables where some rows have buttons (column auto-sizes
   to fit them) and other rows are empty (would otherwise show as a flat
   white rectangle in that 120-ish px space). */
body.dash-pro .data-table td.row-actions:empty::before {
    content: "—";
    color: var(--ink-3);
    font-family: var(--sans);
    font-size: 0.95rem;
    opacity: 0.5;
}

/* All row-actions cells inherit row hover bg cleanly, no own surface paint. */
body.dash-pro .data-table td.row-actions {
    background-color: transparent !important;
}

body.dash-pro .data-table tbody tr:hover td.row-actions {
    background-color: var(--paper-2) !important;
}

/* Scrollbar corner (where h+v scrollbars meet): default is white in light
   mode in some browsers — make it transparent. */
body.dash-pro ::-webkit-scrollbar-corner {
    background: transparent;
}

/* Custom scrollbar — visible thumb that matches dash-pro tokens.
   Wide enough to read as a real interaction target. */
body.dash-pro ::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

body.dash-pro ::-webkit-scrollbar-track {
    background: var(--paper-2);
}

body.dash-pro ::-webkit-scrollbar-thumb {
    background: var(--ink-3);
    border-radius: 6px;
    border: 2px solid var(--paper-2);
    background-clip: padding-box;
    min-height: 40px;
}

body.dash-pro ::-webkit-scrollbar-thumb:hover {
    background: var(--ink-2);
    background-clip: padding-box;
}

body.dash-pro ::-webkit-scrollbar-thumb:active {
    background: var(--ink);
    background-clip: padding-box;
}

/* Firefox */
body.dash-pro {
    scrollbar-width: auto;
    scrollbar-color: var(--ink-3) var(--paper-2);
}

/* (Removed: a previous experiment locked the page with overflow:hidden +
   height:100vh + hidden scrollbars. That made the Save / form actions at
   the bottom unreachable on shorter viewports. Page now scrolls natively
   with the styled scrollbar from the dash-pro scrollbar block above.) */

body.dash-pro .data-table tbody tr {
    transition: background 100ms ease;
}

body.dash-pro .data-table tbody tr:hover td {
    background: var(--paper-2);
}

/* Checkbox column — compact, vertically centered. */
body.dash-pro .data-table th.col-select,
body.dash-pro .data-table td.col-select {
    width: 36px;
    padding-right: 0;
    text-align: center;
}

/* Custom checkbox to match the .confirm-check styling — appearance:none,
   SVG check via background-image, theme-adapts via two background variants. */
body.dash-pro .data-table input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    margin: 0;
    border: 1.5px solid var(--border-strong);
    border-radius: 4px;
    background-color: var(--surface);
    cursor: pointer;
    position: relative;
    transition: background-color 140ms ease, border-color 140ms ease;
    flex-shrink: 0;
}

body.dash-pro .data-table input[type="checkbox"]:hover {
    border-color: var(--ink-3);
}

body.dash-pro .data-table input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

body.dash-pro .data-table input[type="checkbox"]:checked {
    background-color: var(--ink);
    border-color: var(--ink);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23fafafa' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3.5 8 6.5 11 12.5 5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px 12px;
}

[data-theme="dark"] body.dash-pro .data-table input[type="checkbox"]:checked {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%230a0a0c' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3.5 8 6.5 11 12.5 5'/%3E%3C/svg%3E");
}

/* Indeterminate state — "select all" with partial selection. Horizontal dash. */
body.dash-pro .data-table input[type="checkbox"]:indeterminate {
    background-color: var(--ink);
    border-color: var(--ink);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23fafafa' stroke-width='2.5' stroke-linecap='round'%3E%3Cline x1='4' y1='8' x2='12' y2='8'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px 12px;
}

[data-theme="dark"] body.dash-pro .data-table input[type="checkbox"]:indeterminate {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%230a0a0c' stroke-width='2.5' stroke-linecap='round'%3E%3Cline x1='4' y1='8' x2='12' y2='8'/%3E%3C/svg%3E");
}

/* Monospace cells (keys, hwids) */
body.dash-pro .data-table td.user-hwid,
body.dash-pro .data-table .mono-cell,
body.dash-pro .data-table code {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--ink-2);
    background: var(--paper-2);
    padding: 0.15rem 0.45rem;
    border-radius: 5px;
    border: 1px solid var(--border-soft);
    white-space: nowrap;
}

body.dash-pro .data-table td.user-name {
    font-weight: 600;
    color: var(--ink);
}

/* Linked customer license in the Users table: keep the wide key compact while
   preserving the full value in the tooltip and clipboard action. */
body.dash-pro .data-table .user-license-key {
    display: block;
    max-width: 12.5rem;
    overflow: hidden;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--ink-2);
    font-family: var(--mono);
    font-size: 0.78rem;
    line-height: 1.4;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: copy;
    transition: color 120ms ease;
}

body.dash-pro .data-table .user-license-key:hover,
body.dash-pro .data-table .user-license-key:focus-visible {
    color: var(--ink);
}

body.dash-pro .data-table .user-license-key:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 3px;
    border-radius: 2px;
}

/* The desktop sidebar leaves less room on laptop-sized screens. Tighten only
   the key preview there; the tooltip and copy action still retain the full key. */
@media (min-width: 821px) and (max-width: 1400px) {
    body.dash-pro .data-table .user-license-key {
        max-width: 6.5rem;
    }
}

/* Status pill cells — used for license/user/session states */
body.dash-pro .data-table .status-pill,
body.dash-pro .data-table .bracket-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--sans);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    background: var(--paper-2);
    border: 1px solid var(--border-soft);
    color: var(--ink-2);
    letter-spacing: 0;
    text-transform: none;
}

/* Row action cell — use native table-cell layout with vertical-align:
   middle so buttons center cleanly against tall cells in the row. The
   base editorial rule sets display: flex on .row-actions, which makes
   vertical-align a no-op — must explicitly force display: table-cell. */
body.dash-pro .data-table .row-actions {
    display: table-cell !important;
    text-align: right;
    vertical-align: middle !important;
    white-space: nowrap;
}

body.dash-pro .data-table .row-actions .icon-btn + .icon-btn,
body.dash-pro .data-table .row-actions button + button,
body.dash-pro .data-table .row-actions .icon-btn + button,
body.dash-pro .data-table .row-actions button + .icon-btn {
    margin-left: 0.4rem;
}

/* Inline action buttons inside rows — refined ghost pill.
   Base editorial .row-actions .icon-btn uses mono uppercase 0.12em-tracking
   that forced text-wrap on multi-word labels ("RESET PW" → "RESET / PW").
   Override forces sans sentence-case, nowrap, consistent vertical padding. */
body.dash-pro .data-table .row-action,
body.dash-pro .data-table .row-actions .icon-btn,
body.dash-pro .data-table .row-actions button {
    background: transparent;
    border: 1px solid var(--border-soft);
    border-radius: 7px;
    padding: 0.35rem 0.7rem;
    font-family: var(--sans);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink-2);
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.2;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

body.dash-pro .data-table .row-action:hover,
body.dash-pro .data-table .row-actions .icon-btn:hover,
body.dash-pro .data-table .row-actions button:hover {
    background: var(--paper-2);
    border-color: var(--border-strong);
    color: var(--ink);
}

/* Danger variant — destructive actions get a warm-red border + hover fill. */
body.dash-pro .data-table .row-actions .icon-btn.danger {
    color: var(--danger);
    border-color: var(--border-soft);
}

body.dash-pro .data-table .row-actions .icon-btn.danger:hover {
    background: rgba(220, 38, 38, 0.08);
    border-color: var(--danger);
    color: var(--danger);
}

[data-theme="dark"] body.dash-pro .data-table .row-actions .icon-btn.danger:hover {
    background: rgba(239, 68, 68, 0.14);
}

/* ── Bulk bar: floating elevated strip ──────────────────────────── */
body.dash-pro .bulk-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--ink);
    color: var(--paper);
    border: 1px solid var(--ink);
    border-radius: var(--radius);
    padding: 0.625rem 1rem;
    box-shadow: var(--shadow-lg);
    margin: 0.5rem 0;
    position: sticky;
    top: 1rem;
    z-index: 5;
}

body.dash-pro .bulk-bar-count {
    font-family: var(--sans);
    font-size: 0.875rem;
    color: var(--paper);
    letter-spacing: 0;
    text-transform: none;
}

body.dash-pro .bulk-bar-count strong {
    color: var(--paper);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

body.dash-pro .bulk-bar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

body.dash-pro .bulk-bar .btn-ghost {
    background: transparent;
    color: var(--paper);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

body.dash-pro .bulk-bar .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: var(--paper);
}

body.dash-pro .bulk-bar .btn-ghost.danger {
    color: #fca5a5;
    border-color: rgba(252, 165, 165, 0.4);
}

body.dash-pro .bulk-bar .btn-ghost.danger:hover {
    background: rgba(220, 38, 38, 0.2);
    border-color: #fca5a5;
    color: #fecaca;
}

/* Remove the editorial sibling-pinning rule (bulk bar visually
   stacked against the table). Modern bulk bar floats with shadow. */
body.dash-pro .bulk-bar:not([hidden]) + .data-table {
    margin-top: 0.5rem;
}

/* ── Pagination ─────────────────────────────────────────────────── */
body.dash-pro .pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1rem 0 0.5rem;
    padding: 0.5rem 0;
}

body.dash-pro .page-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 0.4rem 0.75rem;
    font-family: var(--sans);
    font-size: 0.825rem;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease;
}

body.dash-pro .page-btn:hover:not([disabled]) {
    background: var(--paper-2);
    border-color: var(--ink-3);
    /* Must set color explicitly: the base .page-btn:hover rule sets
       color:var(--paper), which out-specifies dash-pro's resting color and
       would bleed through here — making the text the SAME tone as this
       --paper-2 background (invisible: white-on-white in light, dark-on-dark
       in dark). --ink is the readable foreground in both themes. */
    color: var(--ink);
}

body.dash-pro .page-btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

body.dash-pro .page-arrow {
    font-size: 0.9rem;
    line-height: 1;
}

body.dash-pro .page-info {
    font-family: var(--sans);
    font-size: 0.825rem;
    color: var(--ink-3);
    letter-spacing: 0;
    text-transform: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

body.dash-pro .page-info strong {
    font-weight: 600;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

body.dash-pro .page-range {
    margin-left: 0.5rem;
    padding: 0.15rem 0.5rem;
    background: var(--paper-2);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    font-size: 0.72rem;
    color: var(--ink-3);
}

/* ── Small empty states: clean inline message ───────────────────── */
body.dash-pro .empty-state.small {
    background: var(--paper-2);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    box-shadow: none;
    padding: 2rem 1.5rem;
    text-align: center;
}

body.dash-pro .empty-state.small .muted em {
    font-style: normal;
    font-weight: 600;
    color: var(--ink);
}

/* ── Bracket-tag → pill badge ───────────────────────────────────── */
body.dash-pro .bracket-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--sans);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: var(--paper-2);
    border: 1px solid var(--border-strong);
    color: var(--ink-2);
    letter-spacing: 0;
    text-transform: none;
}

body.dash-pro .bracket-tag::before,
body.dash-pro .bracket-tag::after { content: ""; }

/* Semantic state variants — JS sets these modifier classes on row badges
   (license status, user status, session status, invite code state, etc.).
   Each adds a tinted bg + matching border + accent text, plus a leading dot. */
body.dash-pro .bracket-tag.ok,
body.dash-pro .bracket-tag.active,
body.dash-pro .bracket-tag.loggedin {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: #15803d;
}

body.dash-pro .bracket-tag.banned,
body.dash-pro .bracket-tag.danger {
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.3);
    color: #b91c1c;
}

body.dash-pro .bracket-tag.expired,
body.dash-pro .bracket-tag.pending,
body.dash-pro .bracket-tag.warn {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.35);
    color: #b45309;
}

body.dash-pro .bracket-tag.used {
    background: var(--paper-3);
    border-color: var(--border-strong);
    color: var(--ink-2);
}

/* Dark mode lifts saturation. */
[data-theme="dark"] body.dash-pro .bracket-tag.ok,
[data-theme="dark"] body.dash-pro .bracket-tag.active,
[data-theme="dark"] body.dash-pro .bracket-tag.loggedin {
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(34, 197, 94, 0.35);
    color: #4ade80;
}

[data-theme="dark"] body.dash-pro .bracket-tag.banned,
[data-theme="dark"] body.dash-pro .bracket-tag.danger {
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}

[data-theme="dark"] body.dash-pro .bracket-tag.expired,
[data-theme="dark"] body.dash-pro .bracket-tag.pending,
[data-theme="dark"] body.dash-pro .bracket-tag.warn {
    background: rgba(251, 191, 36, 0.16);
    border-color: rgba(251, 191, 36, 0.35);
    color: #fbbf24;
}

/* Leading dot for state pills — matches text color, signals state at a glance. */
body.dash-pro .bracket-tag.ok::before,
body.dash-pro .bracket-tag.active::before,
body.dash-pro .bracket-tag.loggedin::before,
body.dash-pro .bracket-tag.banned::before,
body.dash-pro .bracket-tag.danger::before,
body.dash-pro .bracket-tag.expired::before,
body.dash-pro .bracket-tag.pending::before,
body.dash-pro .bracket-tag.warn::before,
body.dash-pro .bracket-tag.used::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

/* Unsaved indicator gets warm amber treatment so it draws the eye. */
body.dash-pro #settings-dirty-flag {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.4);
    color: #b45309;
}

[data-theme="dark"] body.dash-pro #settings-dirty-flag {
    background: rgba(251, 191, 36, 0.16);
    border-color: rgba(251, 191, 36, 0.35);
    color: #fbbf24;
}

body.dash-pro #settings-dirty-flag::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ── Settings tab bar → segmented pill control ──────────────────── */
body.dash-pro .settings-tabbar {
    display: inline-flex;
    gap: 0.125rem;
    margin: 1.25rem 0 1rem;
    padding: 0.25rem;
    background: var(--paper-2);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    border-bottom: 1px solid var(--border-soft);
}

body.dash-pro .settings-tab {
    background: transparent;
    border: none;
    border-bottom: none;
    padding: 0.4rem 0.875rem;
    font-family: var(--sans);
    font-size: 0.825rem;
    font-weight: 500;
    color: var(--ink-3);
    letter-spacing: 0;
    text-transform: none;
    border-radius: 7px;
    margin-bottom: 0;
    transition: background 120ms ease, color 120ms ease;
}

body.dash-pro .settings-tab:hover {
    background: var(--paper-3);
    color: var(--ink);
}

body.dash-pro .settings-tab.active {
    background: var(--surface);
    color: var(--ink);
    border-bottom: none;
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

body.dash-pro .settings-tab-panel {
    margin-top: 0.5rem;
}

/* ── Settings form sections + kickers ───────────────────────────── */
body.dash-pro .settings-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;            /* tightened from 1.75 → 1.25 */
    margin-top: 0.75rem;
}

/* More breathing room between fields in each settings section.
   Base .settings-section gap is 0.5rem — too tight for the floating-label
   fields that need vertical air to read cleanly. */
body.dash-pro .settings-section {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;            /* tightened from 1rem → 0.65rem */
}

body.dash-pro .settings-grid-two {
    gap: 1rem 1.25rem;
}

/* Settings actions row — drop the editorial top-border divider; whitespace
   handles separation cleanly in dash-pro. Same fix for reseller-create. */
body.dash-pro .settings-actions,
body.dash-pro .reseller-create-actions {
    border-top: none;
    padding-top: 0.5rem;
}

body.dash-pro .settings-section-kicker {
    font-family: var(--sans);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin: 0 0 0.6rem;
}

body.dash-pro .settings-form .field label,
body.dash-pro .settings-form label {
    font-family: var(--sans);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink-2);
    letter-spacing: 0;
    text-transform: none;
    margin-bottom: 0.35rem;                  /* tightened from 0.5 → 0.35 */
    display: block;
}

/* ── Settings form inputs — bigger, more clickable, clear focus ring.
   Default dash-pro .form input is fine for dialogs but feels cramped
   on the settings page where you sit with these fields longer. */
body.dash-pro .settings-form .field input[type="text"],
body.dash-pro .settings-form .field input[type="password"],
body.dash-pro .settings-form .field input[type="email"],
body.dash-pro .settings-form .field input[type="number"],
body.dash-pro .settings-form .field input[type="url"],
body.dash-pro .settings-form .field input[type="search"],
body.dash-pro .settings-form .field input:not([type]),
body.dash-pro .settings-form .field textarea {
    background: var(--field-bg);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 0.6rem 0.85rem;                 /* tightened from 0.75 0.95 */
    font-family: var(--sans);
    font-size: 0.92rem;                       /* tightened from 0.95rem */
    color: var(--ink);
    width: 100%;
    transition: border-color 140ms ease, box-shadow 180ms ease, background 140ms ease;
    cursor: text;
}

/* No hover state — input stays idle until you actually click it.
   (User feedback: the hover state lighting up when crossing into the
   input area read as "the label triggered it" and felt buggy.) */

/* Focus state for mouse click — subtle border change only, no big ring.
   Mouse users get a quiet indicator that the field is active for typing. */
body.dash-pro .settings-form .field input:focus,
body.dash-pro .settings-form .field textarea:focus {
    outline: none;
    border-color: var(--ink-2);
    background: var(--field-bg-focus);
}

/* Strong focus RING only shows for keyboard navigation (Tab key).
   This is the modern :focus-visible pattern — accessibility for keyboard
   users without the visual noise of a persistent ring after mouse clicks. */
body.dash-pro .settings-form .field input:focus-visible,
body.dash-pro .settings-form .field textarea:focus-visible {
    border-color: var(--ink);
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] body.dash-pro .settings-form .field input:focus-visible,
[data-theme="dark"] body.dash-pro .settings-form .field textarea:focus-visible {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.1);
}

/* Toggle stack — outer container with no chrome, just a gap. Each toggle
   row inside gets its own card chrome so the rows read as separate cells
   instead of being grouped under one shared card. */
body.dash-pro .toggle-stack {
    border: none;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;            /* tightened from 0.75 → 0.45rem */
}

body.dash-pro .toggle-row.in-stack {
    padding: 0.9rem 1.2rem !important;     /* tightened from 1.25 1.4 → 0.9 1.2 */
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: border-color 140ms ease, box-shadow 200ms ease;
}

body.dash-pro .toggle-row.in-stack:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
}

/* ── Admin "Last 7 days" strip — modernized ─────────────────────
   Base editorial chrome: mono, ink-3 borders, vertical divider after
   the kicker, italic serif numbers. Replace with soft surface card,
   bigger sans bold numbers, no vertical divider. */
body.dash-pro .admin-7d-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem 2rem;
    padding: 1rem 1.25rem;
    margin-top: 1rem;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    font-family: var(--sans);
    font-size: 0.85rem;
    color: var(--ink-3);
    letter-spacing: 0;
}

body.dash-pro .admin-7d-strip .kicker {
    margin: 0;
    padding: 0;
    border-right: none;
    color: var(--ink-3);
    font-family: var(--sans);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

body.dash-pro .admin-7d-strip .strip-item {
    display: inline-flex;
    align-items: baseline;
    gap: 0.5rem;
    font-family: var(--sans);
    color: var(--ink-2);
}

body.dash-pro .admin-7d-strip .strip-item strong {
    font-family: var(--sans);
    font-style: normal;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
    letter-spacing: -0.015em;
    font-variant-numeric: tabular-nums;
}

/* No divider between toggle rows — whitespace + the outer card carry the
   visual grouping. Cleaner read. Match the base rule's specificity. */
body.dash-pro .toggle-stack > * + *,
body.dash-pro .toggle-row.in-stack + .toggle-row.in-stack {
    border-top: none;
}

/* ── Switch toggle → modern monochrome ──────────────────────────── */
body.dash-pro .switch-track {
    background: var(--paper-3);
    border: 1px solid var(--border-strong);
}

body.dash-pro .switch-thumb {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-sm);
}

body.dash-pro .switch input:checked + .switch-track {
    background: var(--ink);
    border-color: var(--ink);
}

body.dash-pro .switch input:checked + .switch-track .switch-thumb {
    background: var(--paper);
    border-color: var(--paper);
}

body.dash-pro .switch input:focus-visible + .switch-track {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

/* ── Distribution surfaces (customer portal, loader file) ───────── */
body.dash-pro .dist-row {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 0.875rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

body.dash-pro .dist-label {
    font-family: var(--sans);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-3);
}

body.dash-pro .dist-url {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--ink);
    flex: 1;
    background: var(--paper-2);
    padding: 0.4rem 0.65rem;
    border-radius: 6px;
    border: 1px solid var(--border-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: color 120ms ease, background 120ms ease, border-color 120ms ease;
}

/* External-link arrow — pseudo so we don't have to touch the JS that
   sets .textContent on the link. Mirrors the ↗ on the logout button. */
body.dash-pro .dist-url::after {
    content: "↗";
    margin-left: auto;
    color: var(--ink-3);
    font-size: 0.95em;
    font-family: var(--sans);
    transition: color 120ms ease, transform 140ms ease;
    flex-shrink: 0;
}

body.dash-pro .dist-url:hover {
    color: var(--ink);
    background: var(--paper-3);
    border-color: var(--border-strong);
}

body.dash-pro .dist-url:hover::after {
    color: var(--ink);
    transform: translate(2px, -2px);
}

body.dash-pro .dist-loader {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 0;
    overflow: hidden;
}

body.dash-pro .dist-loader.drag-over {
    border-color: var(--ink);
    background: var(--paper-2);
}

/* Loader uploaded state — flex row, meta on left + action buttons on right. */
body.dash-pro .dist-loader-current {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    flex-wrap: wrap;
}

body.dash-pro .dist-loader-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
    flex: 1;
}

body.dash-pro .dist-loader-meta .dist-label {
    font-family: var(--sans);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-3);
}

body.dash-pro .dist-loader-meta strong {
    font-family: var(--sans);
    font-size: 0.95rem;
    font-weight: 650;
    color: var(--ink);
    letter-spacing: -0.005em;
    word-break: break-all;
}

body.dash-pro .dist-loader-meta .muted {
    font-family: var(--sans);
    font-size: 0.78rem;
    color: var(--ink-3);
    letter-spacing: 0;
}

body.dash-pro .dist-loader-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* ── Reseller surfaces in settings ──────────────────────────────── */
body.dash-pro .reseller-intro,
body.dash-pro .reseller-create-card,
body.dash-pro .reseller-hero {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem 1.5rem;
}

body.dash-pro .reseller-hero-credits {
    font-family: var(--sans);
    font-size: 2rem;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

body.dash-pro .reseller-action-label,
body.dash-pro .reseller-create-kicker {
    font-family: var(--sans);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-3);
}

body.dash-pro .reseller-tiny-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 6px;
}

/* ── Reseller action rows (Top up, Reset password) ───────────────
   Base editorial chrome: 1px ink border, mono uppercase labels,
   inline-input with stamp underline focus. Modernize to soft surface
   card with rounded chrome, sans labels, dash-pro form input. */
body.dash-pro .reseller-action-row {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 0.75rem 1rem;
    gap: 1rem;
    margin-top: 0.75rem;
}

body.dash-pro .reseller-action-label {
    font-family: var(--sans);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink-2);
    min-width: 7rem;
}

body.dash-pro .reseller-action-input {
    flex: 1;
    min-width: 12rem;
    padding: 0.55rem 0.75rem;
    font-family: var(--sans);
    font-size: 0.875rem;
    color: var(--ink);
    background: var(--field-bg);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    transition: border-color 140ms ease, box-shadow 160ms ease;
}

body.dash-pro .reseller-action-input::placeholder {
    color: var(--ink-3);
    opacity: 1;
    font-family: var(--sans);
}

body.dash-pro .reseller-action-input:focus {
    outline: none;
    background: var(--field-bg-focus);
    border-color: var(--ink);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] body.dash-pro .reseller-action-input:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

body.dash-pro .reseller-action-btn {
    flex-shrink: 0;
    padding: 0.5rem 0.85rem;
    font-size: 0.825rem;
}

/* ── Reseller danger zone (Delete this reseller) ─────────────────
   Base: dashed red border, mono uppercase title. Refine to soft red-tinted
   surface card so the visual weight matches a destructive action without
   the editorial graph-paper dashes. */
body.dash-pro .reseller-danger {
    background: rgba(220, 38, 38, 0.04);
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: var(--radius);
    padding: 0.85rem 1.1rem;
    margin-top: 1rem;
}

[data-theme="dark"] body.dash-pro .reseller-danger {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.25);
}

body.dash-pro .reseller-danger-info strong {
    font-family: var(--sans);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--ink);
}

body.dash-pro .reseller-danger-info span {
    font-family: var(--sans);
    font-size: 0.78rem;
    color: var(--ink-3);
    letter-spacing: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   ░ DASH-PRO — Customer portal  ─────────────────────────────────
   Customer-facing portal at /p/. Login + dashboard surfaces.
   Inherits dash-pro tokens; layout-specific selectors get overrides
   here so the portal feels like the owner dashboard's design system.
   ═══════════════════════════════════════════════════════════════════ */

/* True centering — vertical + horizontal. Grid centering with place-items
   is more predictable than flex when child has its own max-width. */
body.portal-body.dash-pro {
    background-color: var(--paper);
    min-height: 100vh;
    font-family: var(--sans);
    color: var(--ink);
    display: grid !important;
    place-items: center !important;
    padding: 2rem 1.5rem !important;
    box-sizing: border-box !important;
}

body.portal-body.dash-pro::before { display: none; }

body.portal-body.dash-pro .portal-main {
    width: 100%;
    max-width: 820px !important;     /* spacious card — large auth surface */
    margin: 0 auto !important;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* When the dashboard view is visible, widen so the 2-col info grid breathes,
   and shift back to flex-start so taller content scrolls naturally from the
   top instead of overflowing a center-anchored container. */
body.portal-body.dash-pro:has(#portal-dashboard:not([hidden])) {
    align-items: flex-start !important;
    padding-top: 4rem !important;
}

body.portal-body.dash-pro .portal-main:has(#portal-dashboard:not([hidden])) {
    max-width: 600px;
}

/* ── Card chrome ────────────────────────────────────────────────── */
body.portal-body.dash-pro .portal-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 3rem 3rem 2.5rem;        /* roomier with the wider card */
    display: flex;
    flex-direction: column;
    gap: 1.3rem;
    text-align: center;
    align-items: center;
}

/* Inner form caps at 460px so inputs don't stretch grotesquely wide
   inside the much-bigger card. */
body.portal-body.dash-pro .portal-card .portal-form {
    width: 100%;
    max-width: 460px;
    text-align: left;
    margin: 0 auto;
}

/* (Earlier full-width rule superseded by the max-width:460px form rule above.) */

@media (max-width: 540px) {
    body.portal-body.dash-pro .portal-main {
        padding: 1.5rem 1rem 2rem;
    }
    body.portal-body.dash-pro .portal-card {
        padding: 1.5rem 1.25rem;
        border-radius: var(--radius);
    }
}

body.portal-body.dash-pro .portal-card .display {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 1.65rem;
    letter-spacing: -0.02em;
    margin: 0;
    line-height: 1.2;
}

body.portal-body.dash-pro .portal-card .display em {
    font-style: normal;
    color: var(--ink);
    border-bottom: none;
    text-decoration: none;
}

body.portal-body.dash-pro .portal-card .kicker {
    font-family: var(--sans);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin: 0 0 0.3rem;
}

body.portal-body.dash-pro .portal-card .muted {
    font-family: var(--sans);
    font-style: normal;
    color: var(--ink-2);
    font-size: 0.92rem;
    line-height: 1.55;
    text-align: center;
}

/* ── Login form ─────────────────────────────────────────────────── */
body.portal-body.dash-pro .portal-form {
    display: flex;
    flex-direction: column;
    gap: 0;                    /* fields handle their own bottom spacing */
    margin-top: 0.5rem;
}

/* Reserve space below each floating field for: error message (~1.35rem) +
   clear breathing room (~1rem) before whatever's next. */
body.portal-body.dash-pro .field-floating {
    margin-bottom: 2.4rem;
}

body.portal-body.dash-pro .portal-form {
    gap: 1rem;
}

body.portal-body.dash-pro .portal-form .btn-primary {
    width: 100%;
    justify-content: center;
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
    margin-top: 0.4rem;
}

body.portal-body.dash-pro .portal-form .btn-arrow { transition: transform 140ms ease; }
body.portal-body.dash-pro .portal-form .btn-primary:hover .btn-arrow {
    transform: translateX(3px);
}

body.portal-body.dash-pro .portal-form .field-error {
    color: var(--danger);
    font-size: 0.78rem;
    font-weight: 500;
}

/* ── Dashboard header ───────────────────────────────────────────── */
body.portal-body.dash-pro .portal-dash-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0.25rem 1.5rem;
    margin-bottom: 0;
    border-bottom: none;
}

body.portal-body.dash-pro .portal-dash-head .portal-title {
    font-size: 1.6rem;
    font-weight: 700;
    text-align: left;
    margin: 0;
}

body.portal-body.dash-pro .portal-dash-head .portal-title em {
    font-style: normal;
    color: var(--ink);
}

body.portal-body.dash-pro .portal-dash-head .kicker {
    color: var(--ink-3);
    margin: 0 0 0.3rem;
    text-align: left;
}

body.portal-body.dash-pro #portal-logout {
    flex-shrink: 0;
}

/* ── Subscription card ──────────────────────────────────────────── */
/* Card gets a left-border accent stripe based on subscription state.
   JS adds .active / .expired classes to #portal-sub-card. */
body.portal-body.dash-pro .portal-sub-card {
    background: var(--paper-2);
    border: 1px solid var(--border-soft);
    border-left: 3px solid var(--ink-3);
    border-radius: var(--radius);
    padding: 1.25rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    transition: border-left-color 200ms ease;
}

body.portal-body.dash-pro .portal-sub-card.active {
    border-left-color: #16a34a;
}

body.portal-body.dash-pro .portal-sub-card.expired {
    border-left-color: #dc2626;
}

[data-theme="dark"] body.portal-body.dash-pro .portal-sub-card.active {
    border-left-color: #4ade80;
}

[data-theme="dark"] body.portal-body.dash-pro .portal-sub-card.expired {
    border-left-color: #f87171;
}

/* Status line — sans bold, NOT italic serif; color follows card state. */
body.portal-body.dash-pro .portal-sub-status {
    font-family: var(--sans);
    font-style: normal;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0;
    letter-spacing: -0.015em;
    line-height: 1.3;
}

body.portal-body.dash-pro .portal-sub-card.active .portal-sub-status {
    color: #15803d;
}
body.portal-body.dash-pro .portal-sub-card.expired .portal-sub-status {
    color: #b91c1c;
}
[data-theme="dark"] body.portal-body.dash-pro .portal-sub-card.active .portal-sub-status {
    color: #4ade80;
}
[data-theme="dark"] body.portal-body.dash-pro .portal-sub-card.expired .portal-sub-status {
    color: #f87171;
}

body.portal-body.dash-pro .portal-sub-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem 1.5rem;
    border-top: 1px solid var(--border-soft);
    padding-top: 0.85rem;
}

body.portal-body.dash-pro .portal-sub-meta > div {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

body.portal-body.dash-pro .portal-sub-value {
    font-family: var(--sans);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

/* ── Download / link cards ──────────────────────────────────────── */
body.portal-body.dash-pro .portal-download-card {
    background: var(--paper-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
}

body.portal-body.dash-pro .portal-download-card > div { flex: 1; min-width: 0; }

body.portal-body.dash-pro .portal-download-name {
    font-family: var(--sans);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink);
    margin: 0.2rem 0;
    word-break: break-all;
}

body.portal-body.dash-pro #portal-link-url {
    font-family: var(--mono);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--ink-2);
}

body.portal-body.dash-pro .portal-download-card .btn-primary {
    flex-shrink: 0;
}

/* ── Info grid (Email, HWID, etc.) ──────────────────────────────── */
body.portal-body.dash-pro .portal-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    margin-top: 0.25rem;
}

@media (max-width: 540px) {
    body.portal-body.dash-pro .portal-info-grid {
        grid-template-columns: 1fr;
    }
}

body.portal-body.dash-pro .portal-info-grid > div {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

body.portal-body.dash-pro .portal-info-grid .portal-info-wide {
    grid-column: 1 / -1;
}

body.portal-body.dash-pro .portal-info-grid span:not(.kicker),
body.portal-body.dash-pro .portal-info-grid code {
    font-family: var(--sans);
    font-size: 0.875rem;
    color: var(--ink);
    word-break: break-all;
}

body.portal-body.dash-pro .portal-info-grid code {
    font-family: var(--mono);
    font-size: 0.78rem;
    background: var(--paper-2);
    padding: 0.3rem 0.5rem;
    border-radius: 5px;
    border: 1px solid var(--border-soft);
    color: var(--ink-2);
}

/* ── Footer ─────────────────────────────────────────────────────── */
/* Base .portal-footer uses mono with letter-spacing — override to sans. */
body.portal-body.dash-pro .portal-footer {
    text-align: center;
    margin: 1.5rem 0 0;
    font-family: var(--sans);
    font-size: 0.78rem;
    letter-spacing: 0;
    color: var(--ink-3);
    text-transform: none;
}

body.portal-body.dash-pro .portal-footer a {
    color: var(--ink-3);
    text-decoration: none;
    border-bottom: none;
    padding-bottom: 0;
    font-weight: 500;
    transition: color 120ms ease;
}

body.portal-body.dash-pro .portal-footer a:hover {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--ink-3);
}

/* ── Loading state — centered minimal card ────────────────────── */
body.portal-body.dash-pro #portal-loading {
    text-align: center;
    align-items: center;
}

/* New portal-title — replaces .display in the dash-pro portal markup. */
body.portal-body.dash-pro .portal-title {
    font-family: var(--sans);
    font-weight: 700;
    font-size: 1.65rem;
    letter-spacing: -0.02em;
    margin: 0;
    line-height: 1.2;
    color: var(--ink);
}

body.portal-body.dash-pro .portal-title em {
    font-style: normal;
    color: var(--ink);
    border-bottom: none;
    text-decoration: none;
}

/* Loading spinner — replaces "Reaching the registry…" text. */
body.portal-body.dash-pro .portal-loading-card {
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    min-height: 180px;
}

body.portal-body.dash-pro .portal-spinner {
    width: 42px;
    height: 42px;
    border: 3px solid var(--border-soft);
    border-top-color: var(--ink);
    border-radius: 50%;
    animation: portalSpinDash 0.75s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
    body.portal-body.dash-pro .portal-spinner {
        animation-duration: 2.5s;
    }
}

/* Dashboard wrapper — NOT a portal-card itself; contains multiple sub-cards. */
body.portal-body.dash-pro .portal-dash {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Portal CTA button (login Activate / Sign in, Go to portal) — full width,
   matches dash-pro btn-primary chrome. */
body.portal-body.dash-pro .portal-cta {
    width: 100%;
    justify-content: center;
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
}

body.portal-body.dash-pro .portal-cta .btn-arrow {
    transition: transform 140ms ease;
}

body.portal-body.dash-pro .portal-cta:hover .btn-arrow {
    transform: translateX(3px);
}

/* Logout button in dashboard head */
body.portal-body.dash-pro .portal-logout-btn {
    flex-shrink: 0;
}

/* Section labels inside dashboard cards (Subscription, Loader, etc.) */
body.portal-body.dash-pro .portal-section-label {
    font-family: var(--sans);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin: 0 0 0.3rem;
    display: block;
}

/* Theme toggle on the portal — uses dash-pro tokens instead of the
   modern-auth --m-* tokens that the global .theme-toggle rule expects. */
body.portal-body.dash-pro .theme-toggle {
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-sm);
}

body.portal-body.dash-pro .theme-toggle:hover {
    background: var(--paper-2);
    border-color: var(--ink-3);
}

/* ── Section heads inside panels: tighter ───────────────────────── */
body.dash-pro #view-app .section-head {
    align-items: center;
    margin-top: 2rem !important;
}

body.dash-pro #view-app .section-head .display {
    font-size: 1.4rem;
    font-weight: 650;
}

body.dash-pro #view-app .section-head .kicker {
    margin-bottom: 0.25rem;
}

/* ── Hide the heavy .rule dividers inside panels (whitespace handles it) */
body.dash-pro #view-app .rule,
body.dash-pro #view-app .rule.rule-double {
    background: var(--border-soft);
    height: 1px;
    margin: 0.75rem 0 1.25rem;
}

/* ═══════════════════════════════════════════════════════════════════
   CUSTOMER PORTAL — match the login page ("Mono") palette exactly.

   The portal renders with the dash-pro skin, which is already a cool
   mono palette but drifts slightly from the login's modern-auth values
   (page bg, card surface, muted text, dark-card tint). This block pins
   the color tokens the portal consumes to the login's EXACT values, in
   both light and dark.

   Scoped to body.portal-body.dash-pro so it ONLY touches the customer
   portal — the owner dashboard (body.dash-pro, no .portal-body) keeps
   its own palette, and the login page (modern-auth, --m-* vars) is
   untouched. Higher specificity than the base dash-pro token blocks, so
   these win cleanly. Delete this block to revert.
   Reference values: body.modern-auth (line ~705) light + dark.
   ═══════════════════════════════════════════════════════════════════ */

/* LIGHT — mirrors body.modern-auth --m-* light values. */
body.portal-body.dash-pro {
    background-image: none;            /* flat in light mode, same as login panel */
    background-attachment: scroll;
    --paper:           #f7f7f8;   /* page bg        ← --m-bg */
    --paper-2:         #ffffff;   /* card / raised  ← --m-card-bg */
    --paper-3:         #ececee;   /* hover          ← --m-border */
    --surface:         #ffffff;
    --surface-2:       #f7f7f8;
    --ink:             #0a0a0a;   /* primary text   ← --m-ink */
    --ink-2:           #4a4a4a;   /* secondary      ← --m-ink-2 */
    --ink-3:           #8a8a8a;   /* muted / meta   ← --m-ink-3 */
    --rule:            #ececee;
    --border-soft:     #ececee;   /* card hairline  ← --m-border */
    --border-strong:   #d4d4d6;   /* input border   ← --m-border-strong */
    --field-bg:        #ffffff;
    --field-bg-focus:  #ffffff;
    --stamp:           #0a0a0a;   /* CTA / accent stays solid ink */
    --stamp-dim:       #1f1f1f;
}

/* DARK — mirrors [data-theme="dark"] body.modern-auth --m-* dark values. */
[data-theme="dark"] body.portal-body.dash-pro {
    background-image: radial-gradient(ellipse at 10% 0%, rgba(232,210,160,0.04), transparent 55%), radial-gradient(ellipse at 90% 100%, rgba(200,49,26,0.08), transparent 55%);
    background-attachment: fixed;
    --paper:           #0a0a0a;
    --paper-2:         #131313;
    --paper-3:         #1c1c1c;
    --surface:         #131313;
    --surface-2:       #0f0f0f;
    --ink:             #f5f5f5;
    --ink-2:           #b8b8b8;
    --ink-3:           #6e6e6e;
    --rule:            #232323;
    --border-soft:     #232323;
    --border-strong:   #333333;
    --field-bg:        #0f0f0f;
    --field-bg-focus:  #131313;
    --stamp:           #f5f5f5;
    --stamp-dim:       #ffffff;
}

/* ─── Portal login form — static label-above field, matches login panel ──── */
body.portal-body .portal-form .field label {
    display: block;
    font-family: var(--sans);
    font-weight: 550;
    font-size: 0.82rem;
    color: var(--ink-2);
    margin-bottom: 0.4rem;
    text-transform: none;
    letter-spacing: 0;
}

body.portal-body .portal-form .field input {
    width: 100%;
    background: var(--field-bg);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 0.72rem 0.9rem;
    font-family: var(--sans);
    font-size: 0.94rem;
    color: var(--ink);
    transition: border-color 140ms, box-shadow 180ms, background 140ms;
    box-sizing: border-box;
}

body.portal-body .portal-form .field input:hover:not(:focus) {
    border-color: var(--ink-3);
}

body.portal-body .portal-form .field input:focus {
    outline: none;
    border-color: var(--ink);
    box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.08);
}

[data-theme="dark"] body.portal-body .portal-form .field input:focus {
    box-shadow: 0 0 0 3px rgba(245, 245, 245, 0.1);
}

/* ─── Reseller panel — dash-pro modern skin ─────────────────────────────── */

/* Inner sub-sections: swap the old sharp left-rule box for a soft card. */
body.portal-body.dash-pro .rsl-section,
body.portal-body.dash-pro .rsl-balance {
    background: var(--paper-3);
    border-left: none;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
}

/* Low-balance highlight still uses the accent colour for the left edge. */
body.portal-body.dash-pro .rsl-balance.low {
    border-left: 3px solid var(--stamp);
    border-radius: 0 12px 12px 0;
}

/* Login card — fill portal-main width like the customer portal login card. */
body.portal-body.dash-pro .rsl-login-card {
    max-width: none !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Section divider rule: tone down to border-soft. */
body.portal-body.dash-pro .rsl-gen-actions {
    border-top-color: var(--border-soft);
}

/* Head underline rule: tone down to border-soft. */
body.portal-body.dash-pro .rsl-head {
    border-bottom-color: var(--border-soft);
}

/* Generate form fields — same label/input style as login form. */
body.portal-body.dash-pro .rsl-gen-form .field label {
    display: block;
    font-family: var(--sans);
    font-weight: 550;
    font-size: 0.82rem;
    color: var(--ink-2);
    margin-bottom: 0.4rem;
    text-transform: none;
    letter-spacing: 0;
}

body.portal-body.dash-pro .rsl-gen-form .field input {
    width: 100%;
    background: var(--field-bg);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 0.72rem 0.9rem;
    font-family: var(--sans);
    font-size: 0.94rem;
    color: var(--ink);
    transition: border-color 140ms, box-shadow 180ms, background 140ms;
    box-sizing: border-box;
}

body.portal-body.dash-pro .rsl-gen-form .field input:hover:not(:focus) {
    border-color: var(--ink-3);
}

body.portal-body.dash-pro .rsl-gen-form .field input:focus {
    outline: none;
    border-color: var(--ink);
    box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.08);
}

[data-theme="dark"] body.portal-body.dash-pro .rsl-gen-form .field input:focus {
    box-shadow: 0 0 0 3px rgba(245, 245, 245, 0.1);
}

/* Dashboard children must stretch to full card width and stay left-aligned. */
body.portal-body.dash-pro .rsl-dashboard {
    align-items: stretch;
    text-align: left;
}

/* Actions column: wide enough for COPY + DELETE side by side. */
body.portal-body.dash-pro .rsl-col-actions {
    width: 11rem;
}

/* Cost tag — modern soft badge instead of old stamped border. */
body.portal-body.dash-pro .rsl-cost-tag {
    font-family: var(--sans);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    color: var(--ink-3);
    background: var(--paper-3);
    letter-spacing: 0;
}

body.portal-body.dash-pro .rsl-cost-tag.over {
    color: var(--stamp);
    border-color: var(--stamp);
    background: transparent;
}

/* Keys pager */
body.portal-body.dash-pro .rsl-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-soft);
}

body.portal-body.dash-pro .rsl-page-info {
    font-family: var(--sans);
    font-size: 0.8rem;
    color: var(--ink-3);
    min-width: 2.5rem;
    text-align: center;
}

body.portal-body.dash-pro .rsl-pager-btn {
    padding: 0.35rem 0.85rem;
    font-size: 0.8rem;
}

/* Kill the global .kicker uppercase on portal-body pages — text is sentence case in HTML. */
body.portal-body.dash-pro .kicker {
    text-transform: none;
    letter-spacing: 0.04em;
    font-family: var(--sans);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink-3);
}

/* Generate form — override global .form max-width so the grid fills the section. */
body.portal-body.dash-pro .rsl-gen-form {
    max-width: none;
    width: 100%;
}

/* HWID card — label sits above a row that holds the code pill + Reset button.
   Vertical centering happens between the two items on the body row, so the
   button visually lines up with the code box, not the label above it. */
body.portal-body.dash-pro .portal-hwid-card {
    background: var(--paper-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
body.portal-body.dash-pro .portal-hwid-card .portal-section-label {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ink);
}
body.portal-body.dash-pro .portal-hwid-card .portal-hwid-empty {
    font-family: var(--sans);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--ink);
}
body.portal-body.dash-pro .portal-hwid-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
body.portal-body.dash-pro .portal-hwid-card code {
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--ink);
    background: var(--paper-3);
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    word-break: break-all;
    flex: 1;
    min-width: 0;
}
body.portal-body.dash-pro .portal-hwid-card .muted {
    font-family: var(--sans);
    font-size: 0.88rem;
    color: var(--ink-3);
    flex: 1;
    min-width: 0;
}
body.portal-body.dash-pro .portal-hwid-reset {
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}
body.portal-body.dash-pro .portal-hwid-reset:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Login kickers on portal + reseller — styled like auth-title ("Welcome back"). */
body.portal-body.dash-pro #portal-login .kicker,
body.portal-body.dash-pro #rsl-login .kicker {
    font-family: var(--sans);
    font-size: 1.6rem;
    font-weight: 650;
    font-style: normal;
    line-height: 1.25;
    letter-spacing: -0.02em;
    text-transform: none;
    color: var(--ink);
    text-align: center;
}

/* ─── Reseller network / sub-reseller management ───────────────────────── */
body.portal-body.dash-pro .rsl-main {
    max-width: 1080px;
}

.rsl-parent-context {
    margin: 0.35rem 0 0;
    color: var(--ink-3);
    font-family: var(--sans);
    font-size: 0.8rem;
}

.rsl-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem;
    width: fit-content;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: var(--paper-3);
}

.rsl-nav-btn {
    appearance: none;
    border: 0;
    border-radius: 7px;
    padding: 0.5rem 0.85rem;
    background: transparent;
    color: var(--ink-3);
    font: 600 0.82rem/1 var(--sans);
    cursor: pointer;
    transition: background 140ms, color 140ms, box-shadow 140ms;
}

.rsl-nav-btn:hover {
    color: var(--ink);
}

.rsl-nav-btn.active {
    color: var(--ink);
    background: var(--paper);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.rsl-panel-view {
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
}

.rsl-table-scroll {
    width: 100%;
    overflow-x: auto;
}

.rsl-col-generator {
    width: 8rem;
}

.rsl-generator {
    display: inline-block;
    max-width: 7.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink-2);
    font-size: 0.8rem;
}

.rsl-sub-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.rsl-sub-summary > div {
    padding: 1.25rem 1.4rem;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--paper-3);
}

.rsl-sub-summary-value {
    margin: 0.4rem 0 0;
    color: var(--ink);
    font: 500 1rem/1.2 var(--sans);
}

.rsl-sub-summary-value strong {
    font-family: var(--serif);
    font-size: 2rem;
    font-weight: 500;
}

.rsl-section-copy {
    margin: 0.35rem 0 0;
    color: var(--ink-3);
    font: 400 0.82rem/1.5 var(--sans);
}

.rsl-sub-create-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.rsl-plan-form {
    margin: 0;
}

.rsl-plan-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
}

.rsl-field-plan,
.rsl-field-plan .cb-select {
    width: 100%;
    min-width: 0;
}

.rsl-sub-table {
    width: 100%;
    min-width: 640px;
    margin: 0;
}

.rsl-sub-table td:last-child {
    text-align: right;
}

.rsl-sub-dialog {
    width: min(620px, calc(100vw - 2rem));
    max-width: 620px;
}

.rsl-sub-dialog-body {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.rsl-sub-dialog-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-soft);
}

.rsl-sub-dialog-head .display {
    margin: 0.25rem 0 0;
    font-size: 1.5rem;
}

.rsl-sub-dialog-head .muted {
    margin: 0.35rem 0 0;
}

.rsl-manage-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 0.75rem;
    max-width: none;
    width: 100%;
    margin: 0;
}

.rsl-manage-form .field,
.rsl-manage-form input {
    width: 100%;
}

.rsl-manage-form button {
    min-height: 42px;
}

.rsl-manage-danger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-soft);
}

.rsl-wallet-history {
    padding: 1rem 0;
    border-top: 1px solid var(--border-soft);
}

.rsl-wallet-transactions {
    display: grid;
    gap: 0.15rem;
    margin-top: 0.65rem;
}

.rsl-wallet-transaction {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border-soft);
    color: var(--ink-2);
    font: 500 0.78rem/1.3 var(--sans);
}

.rsl-wallet-transaction span:first-child {
    display: grid;
    gap: 0.15rem;
}

.rsl-wallet-transaction small {
    color: var(--ink-3);
    font: 400 0.68rem/1.2 var(--mono);
}

.rsl-wallet-transaction .positive { color: #4ca86c; }
.rsl-wallet-transaction .negative { color: var(--ink); }

@media (max-width: 720px) {
    .rsl-nav {
        width: 100%;
    }
    .rsl-nav-btn {
        flex: 1;
    }
    .rsl-sub-summary,
    .rsl-sub-create-grid,
    .rsl-plan-grid {
        grid-template-columns: 1fr;
    }
    .rsl-manage-form {
        grid-template-columns: 1fr;
    }
    .rsl-manage-form button {
        width: 100%;
    }
    .rsl-manage-danger {
        align-items: stretch;
        flex-direction: column;
    }
}

/* ─── Reseller panel refresh ────────────────────────────────────────────── */
body.portal-body.dash-pro:has(#rsl-dashboard:not([hidden])) {
    display: block !important;
    padding: 0.75rem 1.25rem 1rem !important;
}

body.portal-body.dash-pro .portal-main.rsl-main {
    width: 100%;
    min-width: 0;
    max-width: 1120px !important;
    box-sizing: border-box;
}

body.portal-body.dash-pro #rsl-dashboard {
    width: 100%;
    min-width: 0;
    padding: 1.15rem 1.35rem 1.25rem;
    gap: 0.75rem;
    border-radius: 16px;
    box-sizing: border-box;
}

body.portal-body.dash-pro .rsl-head {
    align-items: center;
    padding: 0 0 0.75rem;
}

body.portal-body.dash-pro .rsl-head-id .display {
    font-size: clamp(1.35rem, 2vw, 1.7rem);
    font-weight: 700;
    letter-spacing: -0.025em;
}

body.portal-body.dash-pro .rsl-head-id .kicker {
    margin-bottom: 0.35rem;
    letter-spacing: 0.06em;
}

body.portal-body.dash-pro .rsl-logout {
    padding: 0.55rem 0.9rem;
    font-size: 0.78rem;
}

body.portal-body.dash-pro .rsl-nav {
    width: 100%;
    padding: 0;
    gap: 1.25rem;
    border: 0;
    border-bottom: 1px solid var(--border-soft);
    border-radius: 0;
    background: transparent;
}

body.portal-body.dash-pro .rsl-nav-btn {
    flex: 0 0 auto;
    padding: 0.65rem 0.05rem 0.75rem;
    border-radius: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    box-shadow: none;
    color: var(--ink-3);
}

body.portal-body.dash-pro .rsl-nav-btn.active {
    color: var(--ink);
    background: transparent;
    border-bottom-color: var(--ink);
    box-shadow: none;
}

body.portal-body.dash-pro .rsl-panel-view {
    gap: 0.75rem;
    min-width: 0;
}

body.portal-body.dash-pro .rsl-main {
    gap: 0.5rem;
}

body.portal-body.dash-pro .rsl-main > .portal-footer {
    margin: 0.35rem 0 0;
}

.rsl-workspace-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8rem;
    min-width: 0;
}

.rsl-overview-grid {
    display: grid;
    min-width: 0;
    grid-template-columns: minmax(0, 1.55fr) repeat(2, minmax(180px, 0.72fr));
    gap: 1rem;
}

.rsl-dashboard.is-sub-reseller .rsl-overview-grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(180px, 0.72fr);
}

body.portal-body.dash-pro .rsl-overview-grid .rsl-balance,
body.portal-body.dash-pro .rsl-stat-card {
    min-height: 90px;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--paper-3);
    box-sizing: border-box;
}

body.portal-body.dash-pro .rsl-overview-grid .rsl-balance {
    align-items: center;
}

.rsl-stat-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.rsl-stat-card .kicker {
    margin: 0;
}

.rsl-stat-value {
    display: block;
    margin-top: 0.3rem;
    color: var(--ink);
    font-family: var(--serif);
    font-size: 2.1rem;
    font-weight: 500;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.rsl-stat-hint {
    margin: 0.45rem 0 0;
    color: var(--ink-3);
    font-family: var(--sans);
    font-size: 0.74rem;
    line-height: 1.35;
}

body.portal-body.dash-pro .rsl-balance-credits strong {
    font-size: 2rem;
    font-variant-numeric: tabular-nums;
}

body.portal-body.dash-pro .rsl-section {
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
}

body.portal-body.dash-pro .rsl-section-head {
    align-items: flex-start;
}

body.portal-body.dash-pro .rsl-section-head .kicker {
    color: var(--ink-2);
    font-size: 0.78rem;
}

body.portal-body.dash-pro .rsl-section-copy {
    margin-top: 0.3rem;
    font-size: 0.78rem;
}

body.portal-body.dash-pro .rsl-gen-grid {
    grid-template-columns: minmax(92px, 0.7fr) minmax(92px, 0.7fr) minmax(92px, 0.7fr) minmax(220px, 2.2fr);
    gap: 0.85rem;
}

body.portal-body.dash-pro .rsl-gen-actions {
    margin-top: 0;
    padding-top: 0.65rem;
}

body.portal-body.dash-pro .rsl-gen-btn {
    min-width: 118px;
    justify-content: center;
}

body.portal-body.dash-pro .rsl-gen-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    transform: none;
}

body.portal-body.dash-pro .rsl-cost-tag {
    flex-shrink: 0;
    padding: 0.3rem 0.65rem;
    background: var(--paper-2);
}

.rsl-keys-toolbar {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) auto auto auto;
    gap: 0.65rem;
    align-items: center;
}

/* Cost readout in the extend dialog — turns red when the balance falls short. */
.rsl-extend-cost {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--ink-2);
    margin: 0.25rem 0 0;
}

.rsl-extend-cost.over { color: var(--danger, #b4332b); }

.rsl-reset-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 38px;
    padding: 0 0.9rem;
    font-size: 0.78rem;
    white-space: nowrap;
}

.rsl-reset-all-btn svg { flex-shrink: 0; }

/* The keys table is wrapped in a scroll container, so the shared
   `.bulk-bar + .data-table` spacing rule can't reach it. */
.rsl-keys-toolbar + #rsl-keys-bulk-bar { margin-top: 0.75rem; }
#rsl-keys-bulk-bar:not([hidden]) + .rsl-table-scroll { margin-top: 0.5rem; }

/* Keep the select column snug in the reseller table. */
.rsl-keys-table th.col-select,
.rsl-keys-table td.col-select {
    width: 2rem;
    padding-left: 0.5rem;
}

.rsl-search-field {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
    height: 38px;
    padding: 0 0.75rem;
    color: var(--ink-3);
    background: var(--field-bg);
    border: 1px solid var(--border-soft);
    border-radius: 9px;
    transition: border-color 140ms, box-shadow 140ms;
}

.rsl-search-field:focus-within {
    color: var(--ink);
    border-color: var(--ink-3);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 8%, transparent);
}

.rsl-search-field input {
    width: 100%;
    min-width: 0;
    padding: 0;
    color: var(--ink);
    background: transparent;
    border: 0;
    outline: 0;
    font: 400 0.82rem/1 var(--sans);
}

.rsl-search-field input::placeholder {
    color: var(--ink-3);
}

#rsl-key-status {
    height: 38px;
    padding: 0 2rem 0 0.75rem;
    color: var(--ink-2);
    background-color: var(--field-bg);
    border: 1px solid var(--border-soft);
    border-radius: 9px;
    font: 500 0.78rem/1 var(--sans);
    cursor: pointer;
}

#rsl-key-status:focus {
    outline: none;
    border-color: var(--ink-3);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 8%, transparent);
}

/* ─── Centby select menus ────────────────────────────────────────
   Native option popups are controlled by the operating system and cannot be
   themed consistently. The original select stays in the form as the source of
   truth while this progressive enhancement provides the visible control. */
.cb-select {
    position: relative;
    display: inline-flex;
    min-width: 9.5rem;
    vertical-align: middle;
    isolation: isolate;
}

.cb-select.is-open {
    z-index: 80;
}

.cb-select > select.cb-select__native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
}

.cb-select__trigger {
    width: 100%;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.55rem 0.7rem 0.55rem 0.8rem;
    color: var(--ink-2);
    background: var(--field-bg);
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    font: 500 0.825rem/1.2 var(--sans);
    text-align: left;
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease, box-shadow 160ms ease;
}

.cb-select__trigger:hover {
    color: var(--ink);
    background: var(--field-bg-focus);
    border-color: var(--ink-3);
}

.cb-select__trigger:focus-visible,
.cb-select.is-open .cb-select__trigger {
    color: var(--ink);
    outline: none;
    border-color: var(--ink);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 9%, transparent);
}

.cb-select__trigger:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.cb-select__value {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.cb-select__chevron {
    width: 12px;
    height: 8px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    color: var(--ink-3);
    transition: transform 160ms ease, color 140ms ease;
}

.cb-select.is-open .cb-select__chevron {
    color: var(--ink);
    transform: rotate(180deg);
}

.cb-select__menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: max-content;
    min-width: 100%;
    max-width: min(18rem, calc(100vw - 24px));
    /* Fits Centby's six-item status menus without an unnecessary scrollbar.
       Longer menus still scroll when they exceed this comfortable limit. */
    max-height: min(21rem, calc(100vh - 32px));
    overflow-y: auto;
    padding: 0.35rem;
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    border: 1px solid var(--border-strong);
    border-radius: 11px;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.16), 0 3px 10px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(16px);
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
    animation: cb-select-in 120ms ease-out;
}

.cb-select__menu[hidden] {
    display: none;
}

[data-theme="dark"] .cb-select__menu {
    box-shadow: 0 22px 52px rgba(0, 0, 0, 0.48), 0 4px 12px rgba(0, 0, 0, 0.28);
}

.cb-select__option {
    width: 100%;
    min-height: 36px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18px;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0.6rem 0.5rem 0.7rem;
    color: var(--ink-2);
    background: transparent;
    border: 0;
    border-radius: 7px;
    font: 500 0.82rem/1.25 var(--sans);
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}

.cb-select__option:hover,
.cb-select__option:focus-visible {
    color: var(--ink);
    background: var(--paper-2);
    outline: none;
}

.cb-select__option.is-selected {
    color: var(--ink);
    background: color-mix(in srgb, var(--ink) 7%, transparent);
    font-weight: 600;
}

.cb-select__option:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.cb-select__check {
    color: var(--ink);
    font-size: 0.78rem;
    text-align: center;
    opacity: 0;
    transform: scale(0.75);
    transition: opacity 120ms ease, transform 120ms ease;
}

.cb-select__option.is-selected .cb-select__check {
    opacity: 1;
    transform: scale(1);
}

.cb-select__group {
    padding: 0.55rem 0.7rem 0.3rem;
    color: var(--ink-3);
    font: 600 0.65rem/1 var(--sans);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.form .cb-select,
.dialog-row .cb-select {
    width: 100%;
    min-width: 0;
}

/* A native modal defaults to overflow:auto. Let an open menu paint beyond the
   dialog box so it never creates a second scrollbar inside a short modal. */
dialog.has-open-select {
    overflow: visible;
}

body.dash-pro .filter-bar {
    overflow: visible;
}

body.dash-pro .filter-bar .cb-select {
    min-width: 9rem;
    border-left: 1px solid var(--border-soft);
}

body.dash-pro .filter-bar .cb-select__trigger {
    min-height: 100%;
    padding: 0.5rem 0.7rem 0.5rem 0.75rem;
    background: var(--paper-2);
    border: 0;
    border-radius: 0 9px 9px 0;
    box-shadow: none;
}

body.dash-pro .filter-bar .cb-select__trigger:hover,
body.dash-pro .filter-bar .cb-select.is-open .cb-select__trigger {
    background: var(--paper-3);
}

body.dash-pro .filter-bar .cb-select__menu,
.rsl-keys-toolbar .cb-select__menu {
    right: 0;
    left: auto;
}

.rsl-keys-toolbar .cb-select {
    width: 9.5rem;
}

.rsl-keys-toolbar .cb-select__trigger {
    min-height: 38px;
    height: 38px;
    font-size: 0.78rem;
}

@keyframes cb-select-in {
    from { opacity: 0; transform: translateY(-4px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .cb-select__menu { animation: none; }
    .cb-select__chevron,
    .cb-select__check { transition: none; }
}

@media (max-width: 720px) {
    .rsl-keys-toolbar .cb-select {
        width: 100%;
    }
}

body.portal-body.dash-pro .rsl-table-scroll {
    overflow-x: auto;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
}

body.portal-body.dash-pro .rsl-keys-table {
    min-width: 680px;
    border: 0;
}

body.portal-body.dash-pro .rsl-keys-table th {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    background: var(--paper-2);
}

body.portal-body.dash-pro .rsl-keys-table td {
    height: 44px;
    border-bottom-color: var(--border-soft);
}

body.portal-body.dash-pro .rsl-keys-table tbody tr:last-child td {
    border-bottom: 0;
}

body.portal-body.dash-pro .rsl-key-code {
    display: block;
    max-width: 100%;
    padding: 0.25rem 0;
    overflow: hidden;
    color: var(--ink-2);
    background: transparent;
    border: 0;
    text-overflow: ellipsis;
}

body.portal-body.dash-pro .rsl-key-code:hover {
    color: var(--ink);
    border: 0;
    text-decoration: underline;
    text-underline-offset: 3px;
}

body.portal-body.dash-pro .rsl-generator {
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
    background: var(--paper-2);
}

/* Keep the fixed-layout table inside its card. Duration gets enough room for
   its full heading and the actions column always contains both row buttons;
   the flexible key column absorbs the remaining width with ellipsis. */
body.portal-body.dash-pro .rsl-col-generator { width: 6.75rem; }
body.portal-body.dash-pro .rsl-col-dur { width: 5.25rem; }
body.portal-body.dash-pro .rsl-col-status { width: 5.75rem; }
body.portal-body.dash-pro .rsl-col-created { width: 8.25rem; }
body.portal-body.dash-pro .rsl-col-actions { width: 10rem; }

body.portal-body.dash-pro .rsl-keys-table td.rsl-actions-cell {
    padding-right: 0.55rem;
    padding-left: 0.3rem;
}

body.portal-body.dash-pro .rsl-keys-table .rsl-row-btn {
    min-width: 54px;
    margin-left: 0.25rem;
    padding: 0.35rem 0.55rem;
}

body.portal-body.dash-pro .rsl-pager {
    padding-top: 0.5rem;
}

@media (min-width: 1000px) {
    .rsl-workspace-grid {
        grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.55fr);
        align-items: stretch;
    }
    .rsl-workspace-grid > .rsl-section {
        height: 100%;
        box-sizing: border-box;
    }
    body.portal-body.dash-pro .rsl-workspace-grid .rsl-gen-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    body.portal-body.dash-pro .rsl-workspace-grid .rsl-field-wide {
        grid-column: 1 / -1;
    }
    body.portal-body.dash-pro .rsl-workspace-grid > .rsl-section:first-child .rsl-section-head {
        flex-direction: column;
    }
    body.portal-body.dash-pro .rsl-workspace-grid > .rsl-section:first-child .rsl-cost-tag {
        align-self: flex-start;
    }
}

@media (max-width: 900px) {
    .rsl-overview-grid {
        grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(140px, 0.8fr));
    }
}

@media (max-width: 720px) {
    body.portal-body.dash-pro:has(#rsl-dashboard:not([hidden])) {
        padding: 0 !important;
    }
    body.portal-body.dash-pro #rsl-dashboard {
        padding: 1.15rem;
        border-left: 0;
        border-right: 0;
        border-radius: 0;
    }
    body.portal-body.dash-pro:has(#rsl-dashboard:not([hidden])) .theme-toggle {
        top: auto;
        right: 1rem;
        bottom: 1rem;
    }
    .rsl-overview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .rsl-overview-grid .rsl-balance {
        grid-column: 1 / -1;
    }
    body.portal-body.dash-pro .rsl-nav {
        gap: 1.1rem;
    }
    body.portal-body.dash-pro .rsl-nav-btn {
        flex: 0 0 auto;
    }
    body.portal-body.dash-pro .rsl-gen-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    body.portal-body.dash-pro .rsl-gen-grid .rsl-field-wide {
        grid-column: 1 / -1;
    }
    /* Two columns so the pair of bulk actions sits side by side; search and
       the status filter each span the full width above them. */
    .rsl-keys-toolbar {
        grid-template-columns: 1fr 1fr;
    }
    .rsl-keys-toolbar .rsl-search-field,
    .rsl-keys-toolbar #rsl-key-status,
    .rsl-keys-toolbar .cb-select {
        grid-column: 1 / -1;
    }
    #rsl-key-status,
    .rsl-reset-all-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    body.portal-body.dash-pro .rsl-head {
        align-items: flex-start;
    }
    body.portal-body.dash-pro .rsl-logout {
        padding: 0.45rem 0.65rem;
    }
    .rsl-dashboard.is-sub-reseller .rsl-overview-grid,
    body.portal-body.dash-pro .rsl-gen-grid {
        grid-template-columns: 1fr;
    }
    .rsl-overview-grid .rsl-balance,
    body.portal-body.dash-pro .rsl-gen-grid .rsl-field-wide {
        grid-column: auto;
    }
    body.portal-body.dash-pro .rsl-section-head {
        flex-direction: column;
    }
    body.portal-body.dash-pro .rsl-cost-tag {
        align-self: flex-start;
    }
}

/* Reseller dark-mode border correction only. Keep the original UI while
   preventing card, table, status, and action outlines from reading as white. */
[data-theme="dark"] body.portal-body.dash-pro #rsl-dashboard,
[data-theme="dark"] body.portal-body.dash-pro .rsl-overview-grid .rsl-balance,
[data-theme="dark"] body.portal-body.dash-pro .rsl-stat-card,
[data-theme="dark"] body.portal-body.dash-pro .rsl-section,
[data-theme="dark"] body.portal-body.dash-pro .rsl-table-scroll,
[data-theme="dark"] body.portal-body.dash-pro .rsl-search-field,
[data-theme="dark"] body.portal-body.dash-pro .rsl-keys-toolbar .cb-select__trigger {
    border-color: #202020;
}

[data-theme="dark"] body.portal-body.dash-pro .rsl-keys-table th,
[data-theme="dark"] body.portal-body.dash-pro .rsl-keys-table td,
[data-theme="dark"] body.portal-body.dash-pro .rsl-sub-table th,
[data-theme="dark"] body.portal-body.dash-pro .rsl-sub-table td {
    border-bottom-color: #1c1c1c;
}

[data-theme="dark"] body.portal-body.dash-pro .rsl-keys-table .rsl-row-btn,
[data-theme="dark"] body.portal-body.dash-pro .rsl-sub-table .rsl-row-btn,
[data-theme="dark"] body.portal-body.dash-pro .rsl-keys-table .bracket-tag,
[data-theme="dark"] body.portal-body.dash-pro .rsl-sub-table .bracket-tag {
    border-color: #292929;
}

[data-theme="dark"] body.portal-body.dash-pro .rsl-gen-form .field input:focus,
[data-theme="dark"] body.portal-body.dash-pro .rsl-search-field:focus-within,
[data-theme="dark"] body.portal-body.dash-pro .rsl-keys-toolbar .cb-select__trigger:focus-visible,
[data-theme="dark"] body.portal-body.dash-pro .rsl-keys-toolbar .cb-select.is-open .cb-select__trigger {
    border-color: #4a4a4a;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.055);
}

[data-theme="dark"] body.portal-body.dash-pro:has(#rsl-dashboard:not([hidden])) .theme-toggle {
    border-color: #292929;
}

[data-theme="dark"] body.portal-body.dash-pro:has(#rsl-dashboard:not([hidden])) .theme-toggle:focus-visible {
    outline-color: #555555;
}

/* Compact key actions: the key is the copy target, so the actions column only
   carries destructive controls. Tonal surfaces replace the outlined boxes. */
body.portal-body.dash-pro .rsl-workspace-grid > .rsl-section:last-child,
body.portal-body.dash-pro .rsl-table-scroll {
    border: 0;
}

body.portal-body.dash-pro .rsl-keys-table {
    min-width: 600px;
}

body.portal-body.dash-pro .rsl-col-actions {
    width: 3.25rem;
}

body.portal-body.dash-pro .rsl-keys-table td.rsl-actions-cell {
    padding-right: 0.55rem;
    padding-left: 0.25rem;
    text-align: center;
}

.rsl-key-copy {
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.25rem 0;
    color: var(--ink-2);
    background: transparent;
    border: 0;
    border-radius: 5px;
    text-align: left;
    cursor: pointer;
}

body.portal-body.dash-pro .rsl-key-copy .rsl-key-code {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0;
    color: inherit;
    pointer-events: none;
}

.rsl-key-copy-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    color: var(--ink-3);
    opacity: 0;
    transform: translateX(-2px);
    transition: color 130ms ease, opacity 130ms ease, transform 130ms ease;
}

.rsl-key-copy-icon svg,
.rsl-icon-btn svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    stroke-width: 1.55;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.rsl-icon-btn svg {
    width: 17px;
    height: 17px;
    stroke-width: 1.7;
}

.rsl-key-copy-success {
    display: none;
    color: #67a87b;
}

.rsl-key-copy:hover,
.rsl-key-copy:focus-visible {
    color: var(--ink);
    outline: none;
}

.rsl-key-copy:hover .rsl-key-copy-default,
.rsl-key-copy:focus-visible .rsl-key-copy-default {
    opacity: 1;
    transform: translateX(0);
}

.rsl-key-copy:focus-visible {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--ink) 16%, transparent);
}

.rsl-key-copy.is-copied .rsl-key-copy-default {
    display: none;
}

.rsl-key-copy.is-copied .rsl-key-copy-success {
    display: grid;
    opacity: 1;
    transform: translateX(0);
}

.rsl-icon-btn {
    width: 32px;
    height: 32px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    color: var(--ink-3);
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: color 130ms ease, background 130ms ease, transform 130ms ease;
}

.rsl-icon-btn:hover,
.rsl-icon-btn:focus-visible {
    color: var(--ink);
    background: var(--paper-3);
    outline: none;
}

.rsl-icon-btn:focus-visible {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--ink) 16%, transparent);
}

.rsl-icon-btn.danger:hover,
.rsl-icon-btn.danger:focus-visible {
    color: #e9675c;
    background: color-mix(in srgb, #d6473b 13%, transparent);
    transform: scale(1.04);
}

/* Interface language stays in sentence case. Compact table metadata and
   status badges are the only uppercase elements in the reseller workspace. */
body.portal-body.dash-pro .rsl-keys-table th,
body.portal-body.dash-pro .rsl-sub-table th,
body.portal-body.dash-pro .rsl-keys-table .bracket-tag,
body.portal-body.dash-pro .rsl-sub-table .bracket-tag {
    text-transform: uppercase;
}

body.portal-body.dash-pro .rsl-keys-table .bracket-tag,
body.portal-body.dash-pro .rsl-sub-table .bracket-tag {
    letter-spacing: 0.035em;
}

@media (hover: hover) {
    .rsl-keys-table tbody tr:not(:hover) .rsl-icon-btn {
        opacity: 0.72;
    }
}
