/* ============================================================================
   JourneyGuru Central — design system (TASK-599)
   A deliberate, branded control-plane aesthetic: deep neutral canvas, an
   indigo→violet brand gradient, a teal operational accent, and a calm,
   information-dense shell. NOT the default Blazor template.
   ============================================================================ */

:root {
    color-scheme: dark;

    /* Canvas + surfaces */
    --bg: #0a0c11;
    --bg-elev: #0e1118;
    --surface: #12151d;
    --surface-2: #171b25;
    --surface-3: #1d222e;
    --border: #242a37;
    --border-strong: #313a4d;

    /* Text */
    --text: #e8ebf2;
    --text-dim: #9aa3b4;
    --text-faint: #6a7282;

    /* Brand + accents */
    --brand-1: #6366f1;
    --brand-2: #8b5cf6;
    --brand-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --brand-soft: rgba(124, 108, 246, 0.14);
    --accent: #2dd4bf;

    /* Status */
    --ok: #34d399;
    --bad: #f87171;
    --warn: #fbbf24;

    /* Shape */
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 10px 40px -12px rgba(0, 0, 0, 0.6);
    --ring: 0 0 0 3px rgba(124, 108, 246, 0.35);

    --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
    --mono: "JetBrains Mono", "Cascadia Code", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3 { font-weight: 650; letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: 1.6rem; margin: 0 0 .35rem; }
h2 { font-size: 1.2rem; margin: 0 0 .5rem; }
p { color: var(--text-dim); }
code { font-family: var(--mono); font-size: .85em; color: #c7b8ff; background: rgba(124,108,246,.1); padding: .1em .35em; border-radius: 5px; }

/* ------------------------------------------------------------------ Brand */

.brand { display: flex; align-items: center; gap: .65rem; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--brand-grad);
    display: grid; place-items: center;
    font-weight: 800; font-size: 1rem; color: #fff;
    box-shadow: 0 4px 14px -2px rgba(124, 108, 246, .55);
    flex: 0 0 auto;
}
.brand-name { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name .word { font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em; }
.brand-name .eyebrow { font-size: .62rem; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--accent); }

/* ================================================================ Login */

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem;
    background:
        radial-gradient(900px 500px at 15% -10%, rgba(99, 102, 241, .18), transparent 60%),
        radial-gradient(800px 500px at 100% 110%, rgba(45, 212, 191, .10), transparent 55%),
        var(--bg);
}
.auth-card {
    width: 100%; max-width: 400px;
    background: linear-gradient(180deg, var(--surface-2), var(--surface));
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 2.25rem 2.25rem 1.75rem;
}
.auth-card .brand { margin-bottom: 1.75rem; }
.auth-title { font-size: 1.35rem; margin: 0 0 .25rem; }
.auth-sub { color: var(--text-dim); font-size: .9rem; margin: 0 0 1.5rem; }

.field { margin-bottom: 1.05rem; }
.field label { display: block; font-size: .78rem; font-weight: 600; color: var(--text-dim); margin-bottom: .4rem; letter-spacing: .01em; }
.input {
    width: 100%;
    background: var(--bg-elev);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: .95rem;
    padding: .7rem .8rem;
    transition: border-color .15s, box-shadow .15s;
    font-family: inherit;
}
.input::placeholder { color: var(--text-faint); }
.input:focus { outline: none; border-color: var(--brand-2); box-shadow: var(--ring); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    font-family: inherit; font-size: .92rem; font-weight: 600;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    padding: .68rem 1.1rem; cursor: pointer;
    transition: transform .08s ease, filter .15s, background .15s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { width: 100%; color: #fff; background: var(--brand-grad); box-shadow: 0 6px 18px -6px rgba(124,108,246,.6); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); border-color: var(--brand-2); }

.auth-error {
    display: flex; align-items: center; gap: .55rem;
    background: rgba(248, 113, 113, .1);
    border: 1px solid rgba(248, 113, 113, .35);
    color: #fecaca; font-size: .85rem;
    border-radius: var(--radius-sm); padding: .6rem .75rem; margin-bottom: 1.1rem;
}
.auth-foot { margin-top: 1.5rem; padding-top: 1.1rem; border-top: 1px solid var(--border); font-size: .76rem; color: var(--text-faint); line-height: 1.5; }

/* ================================================================ App shell */

.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

.sidebar {
    background: var(--bg-elev);
    border-right: 1px solid var(--border);
    padding: 1.35rem 1rem;
    display: flex; flex-direction: column; gap: .35rem;
    position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: .25rem .35rem 1.25rem; }

.nav-group { margin-top: 1rem; }
.nav-group:first-of-type { margin-top: .25rem; }
.nav-label { font-size: .64rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--text-faint); padding: 0 .6rem; margin-bottom: .4rem; }

.nav-link {
    display: flex; align-items: center; gap: .6rem;
    color: var(--text-dim); font-size: .9rem; font-weight: 500;
    padding: .5rem .6rem; border-radius: var(--radius-sm);
    position: relative; transition: background .13s, color .13s;
}
.nav-link .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); flex: 0 0 auto; transition: background .13s; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link:hover .dot { background: var(--text-dim); }
.nav-link.active { background: var(--brand-soft); color: #fff; }
.nav-link.active .dot { background: var(--brand-2); box-shadow: 0 0 8px 1px rgba(139,92,246,.7); }
.nav-link.active::before { content: ""; position: absolute; left: -1rem; top: 20%; bottom: 20%; width: 3px; border-radius: 3px; background: var(--brand-grad); }

.sidebar-foot { margin-top: auto; padding: .75rem .6rem 0; font-size: .68rem; color: var(--text-faint); border-top: 1px solid var(--border); }

/* Topbar + content */
.main-col { display: flex; flex-direction: column; min-width: 0; }
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .85rem 2rem; border-bottom: 1px solid var(--border);
    background: rgba(14, 17, 24, .7); backdrop-filter: blur(8px);
    position: sticky; top: 0; z-index: 10;
}
.topbar .env-chip { font-size: .7rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); border: 1px solid rgba(45,212,191,.3); background: rgba(45,212,191,.08); border-radius: 999px; padding: .2rem .6rem; }

.operator { display: flex; align-items: center; gap: .8rem; }
.operator .who { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.operator .who .name { font-size: .85rem; font-weight: 600; }
.operator .roles { display: flex; gap: .3rem; margin-top: .15rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-grad); display: grid; place-items: center; font-size: .8rem; font-weight: 700; color: #fff; }

.role-badge { font-size: .62rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: .12rem .45rem; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-dim); }
.role-badge.admin { color: #c4b5fd; border-color: rgba(139,92,246,.5); background: rgba(139,92,246,.12); }
.role-badge.agent { color: #7dd3fc; border-color: rgba(56,189,248,.45); background: rgba(56,189,248,.1); }
.role-badge.finance { color: #6ee7b7; border-color: rgba(52,211,153,.45); background: rgba(52,211,153,.1); }

.content { padding: 2rem 2.25rem; max-width: 1200px; width: 100%; }
.page-head { margin-bottom: 1.5rem; }
.page-head .kicker { font-size: .68rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); margin-bottom: .35rem; }

/* ------------------------------------------------------------- Components */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.4rem; }
.card + .card { margin-top: 1rem; }
.card h2 { display: flex; align-items: center; gap: .5rem; }

.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.stat .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-faint); font-weight: 600; }
.stat .value { font-size: 1.7rem; font-weight: 700; margin-top: .25rem; }
.stat .value.muted { color: var(--text-faint); }

.tag-stub { display: inline-flex; align-items: center; gap: .4rem; font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--warn); background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.3); border-radius: 999px; padding: .12rem .5rem; }

.stub { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 1rem 1.25rem; background: var(--surface-2); color: var(--text-dim); font-size: .9rem; }

.roadmap { list-style: none; padding: 0; margin: .5rem 0 0; }
.roadmap li { display: flex; align-items: center; gap: .6rem; padding: .4rem 0; border-bottom: 1px solid var(--border); font-size: .88rem; color: var(--text-dim); }
.roadmap li:last-child { border-bottom: none; }
.roadmap .pill { font-size: .6rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: .1rem .45rem; border-radius: 999px; }
.roadmap .pill.next { color: #c4b5fd; background: rgba(139,92,246,.14); }
.roadmap .pill.later { color: var(--text-faint); background: var(--surface-3); }

table.matrix { border-collapse: collapse; margin-top: 1rem; width: 100%; font-size: .88rem; }
table.matrix th, table.matrix td { border: 1px solid var(--border); padding: .5rem .8rem; text-align: left; }
table.matrix th { background: var(--surface-2); font-weight: 600; color: var(--text-dim); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.ok { color: var(--ok); } .bad { color: var(--bad); } .muted { color: var(--text-faint); }

.callout { display: flex; gap: .7rem; align-items: flex-start; background: var(--brand-soft); border: 1px solid rgba(124,108,246,.28); border-radius: var(--radius); padding: .9rem 1.1rem; font-size: .88rem; color: var(--text-dim); }
.callout strong { color: var(--text); }

@media (max-width: 820px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
    .sidebar .nav-group { margin: 0; }
    .sidebar-foot { display: none; }
}

/* TASK-601: Operator management — a general-purpose data table (distinct from the health-check
   `table.matrix`) plus role-checkbox groups, inline row actions, and an inline confirm bar (disable /
   reset-password) — no window.confirm(), stays consistent with the branded shell. */
table.data-table { border-collapse: collapse; margin-top: .75rem; width: 100%; font-size: .88rem; }
table.data-table th, table.data-table td { border-bottom: 1px solid var(--border); padding: .6rem .75rem; text-align: left; vertical-align: middle; }
table.data-table th { color: var(--text-faint); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
table.data-table tbody tr:hover { background: var(--surface-2); }

.role-checks { display: flex; flex-wrap: wrap; gap: .6rem; }
.role-check { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; font-size: .85rem; color: var(--text-dim); }
.role-check input { accent-color: var(--brand-2); }

.inline-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.inline-actions .btn { padding: .4rem .7rem; font-size: .8rem; }

.confirm-bar { display: inline-flex; align-items: center; gap: .5rem; background: rgba(248,113,113,.08); border: 1px solid rgba(248,113,113,.3); border-radius: var(--radius-sm); padding: .35rem .6rem; font-size: .82rem; color: #fecaca; }
.confirm-bar .btn { padding: .35rem .6rem; font-size: .78rem; }
.confirm-bar .input { padding: .35rem .5rem; font-size: .82rem; }

/* TASK-600: MFA enrollment page — setup steps + monospace secret / otpauth URI. */
.enroll-steps { margin: .2rem 0 1.1rem; padding-left: 1.2rem; font-size: .88rem; color: var(--text-dim); line-height: 1.5; }
.enroll-steps li { margin: .3rem 0; }
.mfa-secret { display: block; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 1rem; letter-spacing: .12em; padding: .55rem .7rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); word-break: break-all; }
.mfa-uri { display: block; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .72rem; padding: .5rem .7rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-faint); word-break: break-all; }

/* TASK-634: scannable enrollment QR — same otpauth URI as the manual key, rendered as an inline
   data-URI PNG (no external calls). Framed to match the monospace secret/URI panels above. */
.mfa-qr-field { text-align: center; }
.mfa-qr { display: block; margin: 0 auto; padding: .7rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); image-rendering: pixelated; }
