/* =========================================================================
   DiagOS — warm, humanist, near-monochrome clinical interface.
   Chrome is monochrome-warm (paper + ink). Colour is reserved for triage
   severity only, so colour always means clinical meaning. Editorial serif
   headings; humanist sans body; calm, deliberate motion.
   ========================================================================= */
:root {
    /* Warm paper monochrome */
    --paper:        #F6F3EC;
    --paper-raised: #FCFAF5;
    --paper-sunken: #EFEBE1;
    --ink:          #1F1B15;
    --ink-2:        #4C463B;
    --ink-3:        #8A8173;
    --line:         #E5DFD2;
    --line-2:       #D7CFBF;
    --ring:         #B98E62;          /* warm focus ring, used sparingly */

    /* Functional severity — muted, warm, but clearly distinct (safety) */
    --red:    #B0392C; --red-bg:    #F4E5E1; --red-line:    #E2C3BB;
    --orange: #C0742B; --orange-bg: #F5EBDB; --orange-line: #E7CFAC;
    --gold:   #9E842A; --gold-bg:   #F1ECD6; --gold-line:   #DED09B;
    --green:  #4E7A54; --green-bg:  #E7EFE6; --green-line:  #C4D6C2;
    --unset:  #948B7C; --unset-bg:  #ECE7DC; --unset-line:  #D5CCBB;

    --r-card: 14px; --r-ctl: 9px; --r-pill: 999px;
    --shadow-sm: 0 1px 2px rgba(31,27,21,.04);
    --shadow:    0 1px 3px rgba(31,27,21,.05), 0 8px 24px -12px rgba(31,27,21,.12);
    --shadow-lg: 0 2px 6px rgba(31,27,21,.06), 0 24px 48px -20px rgba(31,27,21,.22);

    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, "Helvetica Neue",
            "Noto Sans", "Noto Sans Tamil", ui-sans-serif, sans-serif;
    --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
    --mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--sans);
    font-size: 15.5px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line-2); transition: border-color .15s, color .15s; }
a:hover { border-color: var(--ink); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
h1 { font-size: 1.75rem; margin: 0; line-height: 1.2; }
h2 { font-size: 1.15rem; margin: 0; }
.mono { font-family: var(--mono); font-size: .9em; letter-spacing: -.01em; }
.muted { color: var(--ink-3); }
::selection { background: #E7D8C4; }

/* ---- Top bar --------------------------------------------------------------*/
.topbar { background: var(--paper-raised); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.topbar-inner { display: flex; align-items: center; gap: 26px; max-width: 1180px; margin: 0 auto; padding: 0 24px; height: 62px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); border: 0; }
.brand:hover { border: 0; }
.brand-mark { width: 22px; height: 22px; border-radius: 7px; background: var(--ink); position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 6px; border-radius: 3px; border: 1.5px solid var(--paper-raised); }
.brand-mark--lg { width: 46px; height: 46px; border-radius: 13px; }
.brand-mark--lg::after { inset: 12px; border-width: 2px; }
.brand-name { font-family: var(--serif); font-weight: 600; font-size: 1.2rem; letter-spacing: -.01em; }
.mainnav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; align-items: center; }
.mainnav a { color: var(--ink-2); padding: 8px 13px; border-radius: var(--r-ctl); font-size: .93rem; border: 0; transition: background .15s, color .15s; }
.mainnav a:hover { color: var(--ink); background: var(--paper-sunken); }
.nav-cta { color: var(--paper-raised) !important; background: var(--ink); font-weight: 500; border: 0; }
.nav-cta:hover { background: #000 !important; color: #fff !important; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.bell { font-size: .85rem; color: var(--ink-2); border-bottom: 0; }
.bell-count { background: var(--red); color: #fff; border-radius: var(--r-pill); padding: 1px 7px; font-size: .74rem; font-variant-numeric: tabular-nums; }
.locale-form { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-ctl); overflow: hidden; background: var(--paper); }
.locale-btn { background: transparent; color: var(--ink-3); border: 0; padding: 5px 11px; cursor: pointer; font-family: var(--sans); font-size: .84rem; transition: background .15s, color .15s; }
.locale-btn.is-active { background: var(--ink); color: var(--paper-raised); }
.who { font-size: .9rem; color: var(--ink-2); }
.logout-form { margin: 0; }
.btn-link { background: none; border: 0; color: var(--ink-3); cursor: pointer; font-family: var(--sans); font-size: .9rem; padding: 4px; border-bottom: 1px solid transparent; }
.btn-link:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* ---- Page shell -----------------------------------------------------------*/
.page { max-width: 1180px; margin: 0 auto; padding: 34px 24px 64px; animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-head h1 { font-size: 1.9rem; }
.scope-tag { background: var(--paper-raised); border: 1px solid var(--line); color: var(--ink-2); border-radius: var(--r-pill); padding: 5px 14px; font-size: .82rem; }
.footer { max-width: 1180px; margin: 0 auto; padding: 26px 24px 40px; color: var(--ink-3); font-size: .82rem; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; border-top: 1px solid var(--line); }
.footer-note { font-style: italic; }

/* ---- Flash ----------------------------------------------------------------*/
.flash { padding: 13px 17px; border-radius: var(--r-ctl); margin-bottom: 18px; border: 1px solid var(--line-2); font-size: .93rem; background: var(--paper-raised); display: flex; align-items: center; gap: 10px; animation: rise .3s ease both; }
.flash::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: none; }
.flash-success { background: var(--green-bg); border-color: var(--green-line); color: #33502F; }
.flash-success::before { background: var(--green); }
.flash-error   { background: var(--red-bg); border-color: var(--red-line); color: #7E2A22; }
.flash-error::before { background: var(--red); }
.flash-info    { background: var(--paper-sunken); }

/* ---- Panels & tables ------------------------------------------------------*/
.panel { background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-sm); margin-bottom: 22px; overflow: hidden; }
.panel-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.panel-head h2 { font-size: 1.05rem; }
.empty { padding: 26px 20px; color: var(--ink-3); font-style: italic; }
.table-wrap { overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; font-size: .93rem; }
.grid th { text-align: left; padding: 12px 18px; font-family: var(--sans); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid td { padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tbody tr { transition: background .12s; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover { background: var(--paper); }
.grid--dense td, .grid--dense th { padding: 9px 14px; font-size: .87rem; }

/* Severity spine */
.row-spine { border-left: 3px solid transparent; }
.row-spine.sev-red    { border-left-color: var(--red); }
.row-spine.sev-orange { border-left-color: var(--orange); }
.row-spine.sev-yellow { border-left-color: var(--gold); }
.row-spine.sev-green  { border-left-color: var(--green); }
.row-spine.sev-unset  { border-left-color: var(--unset); }

/* ---- Chips & pills --------------------------------------------------------*/
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: var(--r-pill); font-size: .77rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap; letter-spacing: .01em; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.chip--lg { font-size: .88rem; padding: 5px 15px; }
.sev-red    { background: var(--red-bg);    color: var(--red);    border-color: var(--red-line); }
.sev-orange { background: var(--orange-bg); color: #9C5A1F;       border-color: var(--orange-line); }
.sev-yellow { background: var(--gold-bg);   color: #6E5C16;       border-color: var(--gold-line); }
.sev-green  { background: var(--green-bg);  color: var(--green);  border-color: var(--green-line); }
.sev-unset  { background: var(--unset-bg);  color: #5E5648;       border-color: var(--unset-line); }
.status-pill { display: inline-block; background: var(--paper-sunken); border: 1px solid var(--line-2); border-radius: var(--r-ctl); padding: 3px 10px; font-size: .78rem; color: var(--ink-2); text-transform: capitalize; white-space: nowrap; }
.status-pill--lg { font-size: .84rem; padding: 4px 13px; }
.status-pill--active,.status-pill--approved { background: var(--green-bg); border-color: var(--green-line); color: #33502F; }
.status-pill--draft { background: var(--gold-bg); border-color: var(--gold-line); color: #6E5C16; }
.status-pill--retired,.status-pill--locked,.status-pill--disabled { background: var(--unset-bg); color: #5E5648; }
.status-pill--pending { background: var(--orange-bg); border-color: var(--orange-line); color: #9C5A1F; }
.tag { display: inline-block; background: var(--paper-sunken); border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; font-size: .74rem; color: var(--ink-2); margin-left: 7px; }
.tag--sys { background: #EAE3D6; color: #5E5648; }
.tag--flag { background: var(--red-bg); color: var(--red); border-color: var(--red-line); }
.is-overdue { color: var(--red); font-weight: 600; }

/* ---- Dashboard inference banner ------------------------------------------*/
.readout { background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--r-card); padding: 22px 24px; margin-bottom: 22px; box-shadow: var(--shadow-sm); display: flex; gap: 18px; align-items: flex-start; }
.readout-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--green); box-shadow: 0 0 0 4px var(--green-bg); }
.readout--busy .readout-dot { background: var(--orange); box-shadow: 0 0 0 4px var(--orange-bg); }
.readout--critical .readout-dot { background: var(--red); box-shadow: 0 0 0 4px var(--red-bg); animation: pulse 2.4s ease-in-out infinite; }
.readout-text { font-family: var(--serif); font-size: 1.22rem; line-height: 1.45; color: var(--ink); }
.readout-text b { font-weight: 600; }
.readout-sub { font-family: var(--sans); font-size: .9rem; color: var(--ink-3); margin-top: 4px; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 4px var(--red-bg); } 50% { box-shadow: 0 0 0 8px rgba(176,57,44,.10); } }

/* ---- Stat cards -----------------------------------------------------------*/
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat { background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-sm); padding: 20px 22px; transition: transform .18s ease, box-shadow .18s ease; }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-num { font-family: var(--serif); font-size: 2.4rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--ink-3); font-size: .84rem; margin-top: 8px; }
.stat--red .stat-num { color: var(--red); }
.stat--warn .stat-num { color: #9C5A1F; }

/* ---- Buttons --------------------------------------------------------------*/
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: var(--paper-raised); color: var(--ink); border: 1px solid var(--line-2); border-radius: var(--r-ctl); padding: 9px 16px; font-family: var(--sans); font-size: .9rem; font-weight: 500; cursor: pointer; transition: transform .12s ease, background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { background: var(--paper); border-color: var(--ink-3); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--paper-raised); }
.btn-primary:hover { background: #000; border-color: #000; color: #fff; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #97302400; background: #8E2A22; border-color: #8E2A22; }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--ink-2); }
.btn-sm { padding: 6px 12px; font-size: .83rem; border-radius: 7px; }
.btn-block { width: 100%; }

/* ---- Forms ----------------------------------------------------------------*/
.form-card { background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-sm); padding: 28px; max-width: 920px; }
fieldset { border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px; margin: 0 0 22px; }
legend { padding: 0 10px; font-family: var(--serif); font-weight: 600; color: var(--ink); font-size: 1rem; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: .82rem; color: var(--ink-2); font-weight: 500; }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
    font-family: var(--sans); font-size: .93rem; padding: 10px 12px; border: 1px solid var(--line-2);
    border-radius: var(--r-ctl); background: var(--paper); color: var(--ink); width: 100%; transition: border-color .15s, box-shadow .15s, background .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ring); background: var(--paper-raised); box-shadow: 0 0 0 3px rgba(185,142,98,.18); }
.btn:focus-visible, a:focus-visible, button:focus-visible, .locale-btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 9px; margin-top: 9px; }
.form-actions { display: flex; gap: 11px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.hint { color: var(--ink-3); font-size: .85rem; margin: 0 0 12px; }
.hint--warn { color: #9C5A1F; }
.hint--muted { margin-top: 14px; }
.filters { display: flex; gap: 11px; margin-bottom: 18px; flex-wrap: wrap; }
.filters select, .filters input { width: auto; min-width: 160px; }

.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 14px; }
.check { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--r-ctl); font-size: .9rem; transition: background .12s; }
.check:hover { background: var(--paper); }
.check--flag span { color: var(--red); }
.flag-dot { color: var(--red); font-size: .6em; vertical-align: middle; }
.flag-row { display: flex; gap: 11px; flex-wrap: wrap; }
.pill-check { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); border-radius: var(--r-pill); padding: 8px 16px; cursor: pointer; font-size: .88rem; transition: background .12s, border-color .12s; }
.pill-check:hover { background: var(--paper); border-color: var(--ink-3); }
.pill-check:has(input:checked) { background: var(--ink); color: var(--paper-raised); border-color: var(--ink); }
input[type=checkbox], input[type=radio] { accent-color: var(--ink); width: auto; }

/* ---- Auth -----------------------------------------------------------------*/
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px; background: radial-gradient(120% 90% at 50% -10%, #FBF8F1 0%, var(--paper) 55%, var(--paper-sunken) 120%); }
.auth-card { background: var(--paper-raised); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 38px 34px; width: 100%; max-width: 400px; }
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-head h1 { margin: 16px 0 6px; font-size: 1.7rem; }
.auth-head .brand-mark--lg { margin: 0 auto; }
.auth-sub { color: var(--ink-3); font-size: .9rem; margin: 0; }
.auth-foot { color: var(--ink-3); font-size: .8rem; font-style: italic; }

/* ---- Case detail ----------------------------------------------------------*/
.case-spine { background: var(--paper-raised); border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--r-card); box-shadow: var(--shadow-sm); padding: 24px 26px; margin-bottom: 24px; display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.case-spine.sev-red { border-left-color: var(--red); }
.case-spine.sev-orange { border-left-color: var(--orange); }
.case-spine.sev-yellow { border-left-color: var(--gold); }
.case-spine.sev-green { border-left-color: var(--green); }
.case-spine.sev-unset { border-left-color: var(--unset); }
.spine-top { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; margin-bottom: 10px; }
.case-ref { font-size: 1rem; color: var(--ink-2); }
.spine-name { font-size: 1.7rem; margin: 4px 0 8px; }
.spine-meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--ink-2); font-size: .92rem; align-items: center; }
.pathway-tag { background: var(--paper-sunken); color: var(--ink-2); border: 1px solid var(--line-2); border-radius: 6px; padding: 1px 9px; }
.case-cols { display: grid; grid-template-columns: 1fr 348px; gap: 22px; align-items: start; }
.case-main { min-width: 0; }
.alert-card { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.alert-card:last-child { border-bottom: 0; }
.alert-top { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.alert-top strong { font-family: var(--serif); font-weight: 600; }
.alert-reason { margin: 8px 0; font-size: .9rem; }
.alert-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: .82rem; margin-top: 6px; }
.alert-actions { display: flex; gap: 11px; flex-wrap: wrap; margin-top: 14px; align-items: flex-start; }
.inline-form { display: inline-flex; gap: 7px; align-items: center; margin: 0; flex-wrap: wrap; }
.inline-form input[type=text], .inline-form select { width: auto; min-width: 160px; }
.action-details summary { list-style: none; }
.action-details summary::-webkit-details-marker { display: none; }
.action-details[open] summary { margin-bottom: 9px; }
.mt { margin-top: 14px; }
.dx-list { list-style: none; padding: 0; margin: 0; }
.dx-list li { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.dx-list li:last-child { border-bottom: 0; }
.dx-type { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); background: var(--paper-sunken); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; font-weight: 600; }
.dx-text { font-weight: 500; }
.kv { width: 100%; border-collapse: collapse; }
.kv th { text-align: left; font-weight: 500; color: var(--ink-2); padding: 9px 0; font-size: .88rem; border-bottom: 1px solid var(--line); width: 55%; }
.kv td { text-align: right; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .92rem; font-variant-numeric: tabular-nums; }
.kv tr:last-child th, .kv tr:last-child td { border-bottom: 0; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 7px; padding: 4px 0; }
.tag-cloud .tag { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.timeline li { padding: 10px 0 10px 16px; border-bottom: 1px dashed var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: 0; top: 16px; width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); }
.timeline li:last-child { border-bottom: 0; }
.case-side .panel-head { padding: 14px 18px; }
.case-side .panel .stack-sm, .case-side .panel .kv, .case-side .panel .tag-cloud, .case-side .panel .empty { padding: 0 18px 18px; }

/* ---- Triage ---------------------------------------------------------------*/
.vitals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.field--vital .range-hint { color: var(--ink-3); font-size: .74rem; font-style: normal; }
.sev-picker { display: flex; gap: 12px; flex-wrap: wrap; }
.sev-opt { position: relative; display: flex; align-items: center; justify-content: center; padding: 14px 22px; border-radius: var(--r-card); border: 1.5px solid; cursor: pointer; font-weight: 600; min-width: 104px; transition: transform .12s, box-shadow .15s; }
.sev-opt:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.sev-opt input { position: absolute; opacity: 0; }
.sev-opt.sev-red    { border-color: var(--red-line); color: var(--red); }
.sev-opt.sev-orange { border-color: var(--orange-line); color: #9C5A1F; }
.sev-opt.sev-yellow { border-color: var(--gold-line); color: #6E5C16; }
.sev-opt.sev-green  { border-color: var(--green-line); color: var(--green); }
.sev-opt:has(input:checked).sev-red    { background: var(--red);  color: #fff; border-color: var(--red); }
.sev-opt:has(input:checked).sev-orange { background: var(--orange); color: #fff; border-color: var(--orange); }
.sev-opt:has(input:checked).sev-yellow { background: var(--gold); color: #fff; border-color: var(--gold); }
.sev-opt:has(input:checked).sev-green  { background: var(--green); color: #fff; border-color: var(--green); }

/* ---- Rule editor rows -----------------------------------------------------*/
.cond-fieldset .hint { margin-bottom: 14px; }
.cond-row { display: grid; grid-template-columns: 74px 116px 1fr 138px 1fr 38px; gap: 9px; margin-bottom: 9px; align-items: center; }
.cond-row input, .cond-row select { width: 100%; }
.cond-remove { padding: 6px; }
@media (max-width: 640px) { .cond-row { grid-template-columns: 1fr 1fr; } }

/* ---- Errors ---------------------------------------------------------------*/
.error-page { text-align: center; padding: 72px 24px; max-width: 500px; margin: 0 auto; }
.error-code { font-family: var(--serif); font-size: 4rem; font-weight: 600; color: var(--ink); letter-spacing: -.02em; }
.error-page h1 { margin: 10px 0 12px; }
.error-page p { color: var(--ink-3); margin-bottom: 24px; }

/* =========================================================================
   Guided demo — persona bar + tour overlay
   ========================================================================= */
.demo-bar { position: sticky; top: 62px; z-index: 25; background: var(--ink); color: var(--paper-raised); }
.demo-bar-inner { max-width: 1180px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.demo-badge { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: #C9BFB0; border: 1px solid #4A4238; border-radius: var(--r-pill); padding: 3px 10px; }
.demo-personas { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.persona { display: inline-flex; align-items: center; gap: 7px; background: transparent; color: #D9D0C2; border: 1px solid #443D33; border-radius: var(--r-pill); padding: 5px 13px; font-family: var(--sans); font-size: .84rem; cursor: pointer; text-decoration: none; transition: background .15s, color .15s, border-color .15s; }
.persona:hover { background: #2C271F; color: #fff; border-color: #5A5245; }
.persona.is-active { background: var(--paper-raised); color: var(--ink); border-color: var(--paper-raised); font-weight: 600; }
.persona .persona-role { opacity: .7; font-size: .78rem; }
.persona.is-active .persona-role { opacity: .6; }
.demo-exit { color: #C9BFB0; font-size: .82rem; border-bottom: 1px solid transparent; }
.demo-exit:hover { color: #fff; border-bottom-color: #fff; }

.tour { position: fixed; right: 24px; bottom: 24px; z-index: 60; width: 360px; max-width: calc(100vw - 32px); background: var(--paper-raised); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; animation: rise .3s ease both; }
.tour-head { padding: 16px 20px 0; display: flex; align-items: center; justify-content: space-between; }
.tour-step-no { font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.tour-close { background: none; border: 0; color: var(--ink-3); cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.tour-close:hover { background: var(--paper-sunken); color: var(--ink); }
.tour-body { padding: 8px 20px 18px; }
.tour-title { font-family: var(--serif); font-size: 1.2rem; margin: 0 0 8px; }
.tour-persona { display: inline-flex; align-items: center; gap: 7px; font-size: .8rem; color: var(--ink-2); background: var(--paper-sunken); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 3px 11px; margin-bottom: 10px; }
.tour-persona .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }
.tour-text { font-size: .93rem; color: var(--ink-2); line-height: 1.55; }
.tour-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--paper); }
.tour-dots { display: flex; gap: 6px; }
.tour-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); transition: background .2s, transform .2s; }
.tour-dot.is-done { background: var(--ink-3); }
.tour-dot.is-current { background: var(--ink); transform: scale(1.3); }
.tour-actions { display: flex; gap: 8px; }
.tour-launch { position: fixed; right: 24px; bottom: 24px; z-index: 60; }

/* highlight a target element the tour points at */
.tour-highlight { position: relative; z-index: 40; box-shadow: 0 0 0 3px var(--ring), 0 0 0 9px rgba(185,142,98,.18); border-radius: 12px; animation: haze 1.8s ease-in-out infinite; }
@keyframes haze { 0%,100% { box-shadow: 0 0 0 3px var(--ring), 0 0 0 9px rgba(185,142,98,.16); } 50% { box-shadow: 0 0 0 3px var(--ring), 0 0 0 14px rgba(185,142,98,.06); } }

/* ---- Responsive -----------------------------------------------------------*/
@media (max-width: 900px) {
    .case-cols { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .topbar-inner { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 12px; }
    .mainnav { order: 3; width: 100%; }
    .page { padding: 24px 16px 48px; }
    .readout-text { font-size: 1.08rem; }
}

/* ---- Motion / a11y --------------------------------------------------------*/
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
