:root {
    /* Legacy token NAMES kept (used across every page/badge class) — values re-pointed
       at the VAST corporate palette. */
    --blue:        #1d4279;   /* navy-600: solid primary surfaces */
    --blue-light:  #eef4fb;   /* bg-tint */
    --green:       #2E7D32;
    --green-light: #E8F5E9;
    --red:         #C62828;
    --red-light:   #FFEBEE;
    --orange:      #E65100;
    --orange-light:#FFF3E0;
    --gray-100:    #f5f8fc;   /* bg-soft */
    --gray-200:    #e3e8ef;   /* line */
    --gray-300:    #d5dde7;   /* slightly darker neighbour of --line */
    --gray-500:    #76859a;   /* muted */
    --gray-700:    #4b5a6e;   /* slate */
    --text:        #0f1b2d;   /* ink */
    --sidebar-w:   220px;

    /* VAST corporate palette (vast-design skill) — new tokens for new work. */
    --navy-900:#081427; --navy-800:#0d1f3c; --navy-700:#14305c; --navy-600:#1d4279;
    --accent:#1ec8de;   --accent-2:#13a3c4; --amber:#ffb547;
    --ink:#0f1b2d; --slate:#4b5a6e; --muted:#76859a; --line:#e3e8ef;
    --bg:#ffffff; --bg-soft:#f5f8fc; --bg-tint:#eef4fb;
    --radius:14px; --radius-lg:22px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
       background: var(--gray-100); color: var(--text); font-size: 14px; }
a { color: var(--navy-600); }
a:hover { color: var(--accent-2); }

/* ── Layout ── */
.layout       { display: flex; min-height: 100vh; }
.sidebar      { width: var(--sidebar-w); background: linear-gradient(180deg,#0d1f3c,#081427); color: #fff;
                display: flex; flex-direction: column; flex-shrink: 0; position: fixed;
                top: 0; bottom: 0; left: 0; overflow-y: auto; }
.sidebar-brand{ background: var(--navy-900); color: #fff; padding: 20px 16px 12px;
                font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em;
                border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand span { color: var(--accent); }
.sidebar-brand small { display: block; font-size: 11px; font-weight: 400;
                       color: var(--muted); margin-top: 2px; }
.sidebar-section { padding: 14px 16px 4px; font-size: .75rem; font-weight: 600;
                   letter-spacing: .08em; text-transform: uppercase; color: var(--accent);
                   border-bottom: 1px solid rgba(255,255,255,.12); }
.sidebar a    { display: flex; align-items: center; gap: 9px; padding: 9px 16px;
                color: rgba(255,255,255,.85); text-decoration: none; font-size: 13px;
                transition: background .15s; }
.sidebar a:hover { background: rgba(255,255,255,.08); }
.sidebar a.active { background: rgba(30,200,222,.16); color: #fff;
                    box-shadow: inset 3px 0 0 var(--accent); }
.sidebar-footer { margin-top: auto; padding: 12px 16px;
                  border-top: 1px solid rgba(255,255,255,.15); }
.main         { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column;
                background: var(--bg-soft); }
.topbar       { background: #fff; border-bottom: 1px solid var(--gray-200);
                padding: 12px 24px; display: flex; align-items: center;
                justify-content: space-between; }
.topbar h1    { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
.page         { padding: 24px; }

/* ── Cards ── */
.card         { background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
                padding: 20px; margin-bottom: 16px; }
.card-sm      { padding: 14px; }
.card-grid    { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.stat-card    { background: #fff; border: 1px solid var(--gray-200); border-radius: 10px;
                padding: 18px; text-align: center; }
.stat-card .num{ font-size: 32px; font-weight: 700; color: var(--blue); }
.stat-card .lbl{ font-size: 12px; color: var(--gray-500); margin-top: 4px; }

/* ── Tables ── */
.tbl          { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th       { background: var(--gray-100); text-align: left; padding: 10px 12px;
                font-weight: 600; font-size: 11px; text-transform: uppercase;
                letter-spacing: .5px; color: var(--gray-700);
                border-bottom: 1px solid var(--gray-200); }
.tbl td       { padding: 10px 12px; border-bottom: 1px solid var(--gray-200);
                vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--gray-100); }
.tbl-wrap     { overflow-x: auto; border-radius: 10px; border: 1px solid var(--gray-200);
                background: #fff; }

/* ── Badges ── */
.badge        { display: inline-block; padding: 3px 10px; border-radius: 20px;
                font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-blue   { background: var(--blue-light);   color: var(--blue); }
.badge-green  { background: var(--green-light);  color: var(--green); }
.badge-red    { background: var(--red-light);    color: var(--red); }
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-gray   { background: var(--gray-200);     color: var(--gray-700); }

/* ── Forms ── */
.form-group   { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 600;
                    color: var(--gray-700); margin-bottom: 4px; }
.form-control { width: 100%; padding: 8px 10px; border: 1px solid var(--gray-300);
                border-radius: 7px; font-size: 14px; outline: none; transition: border .15s; }
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 .2rem rgba(30, 200, 222, .25); }
.form-control:disabled { background: var(--gray-100); color: var(--gray-500); }
select.form-control { background: #fff; }
.form-row     { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3   { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ── Buttons ── */
.btn          { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
                border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer;
                border: 1px solid transparent; transition: opacity .15s, background .15s, color .15s; }
.btn:hover    { opacity: .85; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--accent); color: var(--navy-900); }
.btn-primary:hover { background: var(--accent-2); opacity: 1; }
.btn-success  { background: var(--green); color: #fff; }
.btn-danger   { background: var(--red);   color: #fff; }
.btn-outline  { background: transparent; color: var(--navy-600); border-color: var(--navy-600); }
.btn-outline:hover { background: var(--navy-600); color: #fff; opacity: 1; }
.btn-sm       { padding: 5px 11px; font-size: 12px; }
.btn-group    { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Alerts ── */
.alert        { padding: 12px 16px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.alert-info   { background: var(--blue-light);   color: var(--blue); }
.alert-success{ background: var(--green-light);  color: var(--green); }
.alert-danger { background: var(--red-light);    color: var(--red); }
.alert-warning{ background: var(--orange-light); color: var(--orange); }

/* ── Workflow timeline ── */
.timeline     { list-style: none; padding: 0; }
.tl-item      { display: flex; gap: 12px; padding-bottom: 20px; position: relative; }
.tl-dot       { width: 28px; height: 28px; border-radius: 50%; display: flex;
                align-items: center; justify-content: center; font-size: 13px;
                flex-shrink: 0; margin-top: 2px; }
.tl-dot-pending   { background: var(--gray-200); color: var(--gray-500); }
.tl-dot-active    { background: var(--blue-light); color: var(--blue); animation: pulse 1.5s infinite; }
.tl-dot-done      { background: var(--green-light); color: var(--green); }
.tl-dot-rejected  { background: var(--red-light);   color: var(--red); }
.tl-line      { position: absolute; left: 13px; top: 30px; bottom: 0;
                width: 2px; background: var(--gray-200); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }
.tl-content   { flex: 1; }
.tl-title     { font-weight: 600; font-size: 14px; }
.tl-sub       { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.decision-row { display: flex; align-items: center; gap: 8px; font-size: 12px;
                padding: 6px 10px; background: var(--gray-100); border-radius: 6px; margin-top: 6px; }

/* ── Modals ── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000;
                  display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal        { background: #fff; border-radius: 12px; padding: 24px;
                width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal-lg     { max-width: 760px; }
.modal-title  { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 18px;
                display: flex; justify-content: space-between; align-items: center; }

/* ── Misc ── */
.section-title{ font-size: 11px; font-weight: 700; letter-spacing: .6px;
                text-transform: uppercase; color: var(--gray-500); margin-bottom: 10px; }
.text-muted   { color: var(--gray-500); font-size: 12px; }
.text-right   { text-align: right; }
.empty-state  { text-align: center; padding: 60px 20px; color: var(--gray-500); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.filter-bar   { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-bar .btn { font-size: 12px; padding: 5px 12px; }
.filter-bar .btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.totals-row   { border-top: 2px solid var(--gray-200); font-weight: 700; }

/* ── Collapsible nav groups ─────────────────────────────────────────── */
.nav-group { border-bottom: 1px solid rgba(255,255,255,.08); }

.nav-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,.85);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .15s;
}
.nav-group-header:hover { background: rgba(255,255,255,.08); }
.nav-group-header.open  { background: rgba(255,255,255,.10); color: #fff; }

.nav-chevron { font-size: 10px; opacity: .7; }

.nav-group-body {
    padding: 2px 0 6px;
    background: transparent;
    border-left: 3px solid rgba(255,255,255,.2);
    margin-left: 16px;
}
.nav-group-body a, .nav-group-body .nav-link {
    display: block;
    padding: 8px 16px 8px 16px;
    font-size: 13px;
    color: rgba(255,255,255,.75);
    text-decoration: none;
    transition: background .1s, color .1s;
}
.nav-group-body a:hover  { background: rgba(255,255,255,.08); color: #fff; }
.nav-group-body a.active { background: rgba(30,200,222,.16); color: #fff;
                            box-shadow: inset 3px 0 0 var(--accent); }

/* export button group */
.export-bar { display:flex; gap:8px; margin-bottom:14px; flex-wrap:wrap; }

/* ── Blazor error UI ──
   MUST live here, in the GLOBAL stylesheet, not in a scoped .razor.css: a scoped sheet never
   reaches a child component, and the rule failing to apply leaves a permanent
   "An unhandled error has occurred" banner on every page. display:none is the resting state —
   the Blazor runtime sets display:block itself when a circuit actually fails. */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 1000;
    background: var(--orange-light);
    border-top: 1px solid var(--orange);
    color: var(--text);
    padding: 12px 16px;
    box-shadow: 0 -2px 12px rgba(0,0,0,.12);
}
#blazor-error-ui .reload   { color: var(--accent-2); text-decoration: underline; margin-left: 8px; }
#blazor-error-ui .dismiss  { cursor: pointer; float: right; }

/* ── Sign-in (BlankLayout) — VAST corporate card, ported from VastInsight's .vi-auth-* ── */
.mt-auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: linear-gradient(160deg, var(--navy-700) 0%, var(--navy-900) 100%);
}

.mt-auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(8, 20, 39, .45);
}

.mt-auth-brand {
    background: var(--navy-900);
    color: #fff;
    padding: 1.4rem 1.75rem;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -.02em;
}

.mt-auth-brand span { color: var(--accent); }

.mt-auth-brand-sub {
    font-size: .8rem;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--muted);
    margin-top: .15rem;
}

.mt-auth-body { padding: 1.75rem; }

.mt-auth-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 1.25rem;
}

.mt-auth-label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--slate);
    margin-bottom: .3rem;
}

.mt-auth-input {
    width: 100%;
    padding: .6rem .8rem;
    margin-bottom: .35rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--bg-soft);
    color: var(--ink);
    font-size: 14px;
}

.mt-auth-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 .2rem rgba(30, 200, 222, .25);
    background: #fff;
}

.mt-auth-password { position: relative; }
.mt-auth-password .mt-auth-input { padding-right: 2.6rem; }

/* Reveal button positioned over the password input; bottom is the input's own margin-bottom so the
   button centres on the INPUT, matching VastInsight's .vi-auth-password/.vi-reveal pairing. */
.mt-pw-reveal {
    position: absolute;
    right: .45rem;
    bottom: .35rem;
    display: flex;
    align-items: center;
    border: 0;
    background: transparent;
    padding: 0 .35rem;
    border-radius: 8px;
    color: var(--slate);
    cursor: pointer;
    line-height: 0;
}

.mt-pw-reveal:hover { color: var(--ink); }

.mt-pw-reveal:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.mt-auth-remember {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .85rem;
    color: var(--slate);
    margin: .75rem 0 1.1rem;
    cursor: pointer;
}

.mt-auth-button {
    width: 100%;
    padding: .7rem 1rem;
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    color: var(--navy-900);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}

.mt-auth-button:hover { background: var(--accent-2); }

.mt-auth-help {
    margin: 1.25rem 0 0;
    font-size: .8rem;
    color: var(--muted);
    text-align: center;
}
