/* SUMA PA Gateway console */
:root {
  /* SUMA Health Services brand: navy #102B46 and gold #CCB862 */
  --sea: #102B46;
  --sea-2: #18395A;
  --sea-3: #234A70;
  --sea-text: #B3C1D0;
  --ground: #EEF1F5;
  --surface: #FFFFFF;
  --surface-2: #F6F8FA;
  --line: #DCE2E9;
  --line-soft: #E9EDF2;
  --ink: #12253A;
  --ink-2: #3A4B5E;
  --muted: #5E6D7E;
  --lagoon: #1A4673;
  --lagoon-dark: #102B46;
  --lagoon-tint: #E4EBF4;
  --sun: #CCB862;
  --sun-deep: #8E7A2A;
  --gold-tint: #F7F2DE;
  --ok-bg: #E2F1E7; --ok-fg: #1B6339;
  --pend-bg: #FCEFD3; --pend-fg: #7A4E00;
  --deny-bg: #F9E2E0; --deny-fg: #9C2A1F;
  --err-bg: #EFE4F6; --err-fg: #5E2B82;
  --info-bg: #E2ECF6; --info-fg: #1F4E7E;
  --warn-bg: #FCE6D6; --warn-fg: #8A3D06;
  --radius-s: 6px;
  --radius: 10px;
  --radius-l: 14px;
  --shadow: 0 1px 2px rgba(16, 43, 70, .06), 0 2px 8px rgba(16, 43, 70, .04);
  --font: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--ink); background: var(--ground); -webkit-font-smoothing: antialiased; }
a { color: var(--lagoon); text-decoration: none; }
a:hover { color: var(--lagoon-dark); text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--lagoon); outline-offset: 2px; border-radius: 4px; }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 236px; flex: none; background: var(--sea); color: var(--sea-text); display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; flex-direction: column; gap: 10px; padding: 6px 10px 22px; color: #fff; }
.brand-logo { display: block; width: 148px; height: auto; }
.brand-product { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 650; letter-spacing: .16em; text-transform: uppercase; color: var(--sun); }
.brand-product::before { content: ''; width: 14px; height: 2px; background: var(--sun); border-radius: 2px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--sea-text); font-size: 14px; text-decoration: none; }
.nav a svg { width: 17px; height: 17px; stroke: currentColor; opacity: .85; flex: none; }
.nav a:hover { background: var(--sea-2); color: #fff; }
.nav a.active { background: var(--sea-3); color: #fff; font-weight: 550; box-shadow: inset 3px 0 0 var(--sun); }
.nav .count { margin-left: auto; background: var(--sun); color: var(--sea); font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.nav-sep { height: 1px; background: var(--sea-2); margin: 12px 8px; }
.side-foot { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid var(--sea-2); font-size: 12px; display: flex; flex-direction: column; gap: 10px; }
.env-row { display: flex; align-items: center; gap: 8px; }
.env-pill { font-size: 11px; font-weight: 650; padding: 2px 8px; border-radius: 999px; background: var(--sun); color: var(--sea); }
.env-pill.prod { background: #2F7A55; color: #fff; }
.user-row { display: flex; align-items: center; gap: 10px; color: #fff; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--sea-3); display: grid; place-items: center; font-size: 12px; font-weight: 650; }
.user-row button { margin-left: auto; background: none; border: 0; color: var(--sea-text); cursor: pointer; padding: 6px; border-radius: 6px; }
.user-row button:hover { color: #fff; background: var(--sea-2); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page { padding: 26px 32px 56px; max-width: 1480px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 650; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 70ch; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 15px; font-weight: 650; }
.panel-head .sub { font-size: 12px; color: var(--muted); }
.panel-body { padding: 16px 18px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 550; cursor: pointer; white-space: nowrap; }
.btn svg { width: 15px; height: 15px; stroke: currentColor; }
.btn:hover { border-color: #C3CCD6; background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--lagoon); border-color: var(--lagoon); color: #fff; }
.btn.primary:hover { background: var(--lagoon-dark); }
.btn.danger { color: var(--deny-fg); border-color: #EBC3BE; }
.btn.danger:hover { background: var(--deny-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn.loading { pointer-events: none; opacity: .7; }
.btn.loading::after { content: ''; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.input, .select { height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 11px; background: var(--surface); font-size: 13px; min-width: 0; }
.input:focus, .select:focus { border-color: var(--lagoon); outline: none; box-shadow: 0 0 0 3px var(--lagoon-tint); }
.input.mono { font-family: var(--mono); font-size: 12px; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 10px; width: 16px; height: 16px; stroke: var(--muted); }
.search .input { padding-left: 32px; width: 300px; max-width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 550; color: var(--ink-2); }
.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.field .input, .field .select { width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px 16px; }
.form-grid.wide { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.form-section { padding: 18px; border-bottom: 1px solid var(--line-soft); }
.form-section:last-child { border-bottom: 0; }
.form-section h3 { margin: 0 0 4px; font-size: 14px; font-weight: 650; }
.form-section > p { margin: 0 0 14px; font-size: 12px; color: var(--muted); }

.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 34px; height: 20px; border-radius: 999px; background: #C5CEDA; position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + .track { background: var(--lagoon); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--lagoon); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.chip:hover { border-color: #BAC5D2; }
.chip[aria-pressed="true"] { background: var(--sea); border-color: var(--sea); color: #fff; }
.chip-label { font-size: 12px; color: var(--muted); margin: 0 4px 0 8px; }
.chip-label:first-child { margin-left: 0; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab { height: 42px; padding: 0 14px; border: 0; background: none; border-bottom: 2px solid transparent; color: var(--muted); font-size: 14px; cursor: pointer; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--lagoon); font-weight: 600; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 550; white-space: nowrap; line-height: 1.6; }
.badge.ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge.pend { background: var(--pend-bg); color: var(--pend-fg); }
.badge.deny { background: var(--deny-bg); color: var(--deny-fg); }
.badge.err { background: var(--err-bg); color: var(--err-fg); }
.badge.info { background: var(--info-bg); color: var(--info-fg); }
.badge.warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge.neutral { background: #ECEFF3; color: var(--ink-2); }
.dir { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.dir svg { width: 14px; height: 14px; stroke: currentColor; }
.dir.out { color: var(--lagoon); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: #2F8F57; } .dot.pend { background: #D99A1E; } .dot.deny { background: #C2412F; } .dot.idle { background: #97A3B1; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.live .dot { background: #2F8F57; box-shadow: 0 0 0 0 rgba(47,143,87,.5); animation: pulse 2s infinite; }
.live.off .dot { background: #97A3B1; animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(47,143,87,.45); } 70% { box-shadow: 0 0 0 7px rgba(47,143,87,0); } 100% { box-shadow: 0 0 0 0 rgba(47,143,87,0); } }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover td { background: #F2F5F9; }
table.data tbody tr.fresh td { animation: fresh 2.4s ease-out; }
@keyframes fresh { from { background: #F8F2DC; } to { background: transparent; } }
table.data .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--muted); gap: 8px; flex-wrap: wrap; }

/* ---------- decision clock (signature) ---------- */
.clock-board { display: flex; flex-direction: column; }
.clock-row { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(180px, 1.6fr) 110px; gap: 18px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.clock-row:last-child { border-bottom: 0; }
.clock-row:hover { background: #F7F9FB; }
.clock-row .what { min-width: 0; }
.clock-row .what strong { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clock-row .what span { font-size: 12px; color: var(--muted); }
.clock { position: relative; }
.clock-track { height: 10px; border-radius: 999px; background: #E3E8EF; overflow: hidden; position: relative; }
.clock-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #E3D59A, var(--sun)); border-radius: 999px; transition: width .6s ease; }
.clock.late .clock-fill { background: linear-gradient(90deg, #E58B6F, #C2412F); }
.clock.done .clock-fill { background: #A9D3B9; }
.clock-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 5px; }
.clock-left { text-align: right; }
.clock-left strong { display: block; font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.clock-left span { font-size: 12px; color: var(--muted); }
.clock-hero { padding: 22px 22px 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: end; border-bottom: 1px solid var(--line-soft); }
.clock-hero h2 { margin: 0; font-size: 20px; letter-spacing: -.015em; font-weight: 650; }
.clock-hero p { margin: 4px 0 0; color: var(--muted); max-width: 64ch; }
@media (max-width: 760px) { .clock-row { grid-template-columns: minmax(0, 1fr); gap: 8px; } .clock-left { text-align: left; } .clock-hero { grid-template-columns: 1fr; } }

/* ---------- stats strip ---------- */
.stats { margin-top: 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 18px; }
.stat { padding: 14px 18px; border-right: 1px solid var(--line-soft); }
.stat:last-child { border-right: 0; }
.stat .label { font-size: 12px; color: var(--muted); }
.stat .value { font-size: 22px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .note { font-size: 12px; color: var(--muted); }

/* ---------- chart ---------- */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 110px; padding: 6px 0 0; }
.bars .bar { flex: 1; display: flex; flex-direction: column-reverse; min-width: 4px; border-radius: 3px 3px 0 0; overflow: hidden; }
.bars .bar i { display: block; }
.bars .bar .b-in { background: #A9BCD1; }
.bars .bar .b-out { background: var(--lagoon); }
.bars .bar .b-err { background: #C2412F; }
.chart-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend .b-in-l { background: #A9BCD1; } .legend .b-out-l { background: var(--lagoon); } .legend .b-err-l { background: #C2412F; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---------- lists ---------- */
.route-list { display: flex; flex-direction: column; }
.route { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line-soft); }
.route:last-child { border-bottom: 0; }
.route .name { font-weight: 600; }
.route .meta { font-size: 12px; color: var(--muted); }
.route .num { text-align: right; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.alert-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line-soft); align-items: start; }
.alert-item:last-child { border-bottom: 0; }
.alert-item .t { font-weight: 600; }
.alert-item .b { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- detail ---------- */
.kv { display: grid; grid-template-columns: minmax(140px, auto) minmax(0, 1fr); }
.kv dt, .kv dd { padding: 9px 0; border-bottom: 1px solid var(--line-soft); margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; padding-right: 16px; }
.kv dd { text-align: right; word-break: break-all; }
.kv dt:last-of-type, .kv dd:last-of-type { border-bottom: 0; }
.timeline { list-style: none; margin: 0; padding: 4px 0; }
.timeline li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; padding: 0 18px; cursor: pointer; }
.timeline li:hover { background: #F7F9FB; }
.timeline .rail { display: flex; flex-direction: column; align-items: center; }
.timeline .node { width: 12px; height: 12px; border-radius: 50%; margin-top: 16px; border: 2px solid #fff; box-shadow: 0 0 0 1.5px currentColor; background: currentColor; flex: none; }
.timeline .line { width: 2px; flex: 1; background: var(--line); margin-top: 2px; }
.timeline li:last-child .line { background: transparent; }
.timeline .c-ok { color: #2F8F57; } .timeline .c-pend { color: #D99A1E; } .timeline .c-deny { color: #C2412F; } .timeline .c-err { color: #7A45A3; } .timeline .c-info { color: #3A6EA5; } .timeline .c-warn { color: #C46A1E; }
.timeline .body { padding: 11px 0 14px; min-width: 0; }
.timeline .body .t { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.timeline .body .d { font-size: 12px; color: var(--muted); margin-top: 2px; }
.timeline .when { padding-top: 12px; font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

.decision { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0; }
.decision > div { padding: 16px 18px; border-right: 1px solid var(--line-soft); }
.decision > div:last-child { border-right: 0; }
.decision .label { font-size: 12px; color: var(--muted); }
.decision .value { font-size: 20px; font-weight: 650; letter-spacing: -.015em; margin-top: 3px; font-variant-numeric: tabular-nums; }
.decision .note { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- drawer & code ---------- */
.scrim { position: fixed; inset: 0; background: rgba(16, 43, 70, .35); z-index: 40; animation: fade .15s ease; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100%); background: var(--surface); z-index: 50; display: flex; flex-direction: column; box-shadow: -12px 0 32px rgba(16,43,70,.18); animation: slide .2s ease; }
@keyframes slide { from { transform: translateX(24px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }
.drawer-head { padding: 18px 20px 12px; border-bottom: 1px solid var(--line-soft); }
.drawer-head .top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.drawer-head h2 { margin: 0; font-size: 18px; font-weight: 650; }
.drawer-body { flex: 1; overflow: auto; padding: 0 20px 20px; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 16px; padding: 14px 0; }
.meta-grid .label { font-size: 12px; color: var(--muted); }
.meta-grid .value { font-size: 13px; margin-top: 1px; word-break: break-all; }
.code-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; flex-wrap: wrap; }
pre.code { margin: 0; background: #0B1D30; color: #D5DFEA; border-radius: var(--radius); padding: 16px; font-family: var(--mono); font-size: 12px; line-height: 1.6; overflow: auto; max-height: 62vh; white-space: pre; }
pre.code .k { color: #8DB8E3; } pre.code .s { color: #DCCB7E; } pre.code .n { color: #B9A2E8; } pre.code .b { color: #F09A84; } pre.code .seg { color: #8DB8E3; font-weight: 600; }

/* ---------- endpoints ---------- */
.split { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1000px) { .split { grid-template-columns: minmax(0, 1fr); } }
.payer-list { display: flex; flex-direction: column; gap: 8px; }
.payer-pick { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.payer-pick:hover { border-color: #BAC5D2; }
.payer-pick[aria-current="true"] { border-color: var(--lagoon); box-shadow: 0 0 0 1px var(--lagoon); }
.payer-pick .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.payer-pick .name { font-weight: 600; }
.payer-pick .meta { font-size: 12px; color: var(--muted); }
.test-steps { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.test-step { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 8px; font-size: 13px; align-items: center; }
.test-step svg { width: 16px; height: 16px; }
.callout { padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
.callout.ok { background: var(--ok-bg); border-color: #C3E2CD; color: var(--ok-fg); }
.callout.bad { background: var(--deny-bg); border-color: #EBC3BE; color: var(--deny-fg); }

/* ---------- simulator ---------- */
.scenario-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.scenario { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 16px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); }
.scenario h3 { margin: 0; font-size: 15px; font-weight: 650; }
.scenario p { margin: 0; font-size: 13px; color: var(--ink-2); flex: 1; }
.scenario .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; }
.steps { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.steps li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; font-size: 12.5px; align-items: baseline; }
.steps .code-status { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 480px); }
.login-art { background: var(--sea); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art .brand { padding: 0; }
.login-art .brand-logo { width: 210px; }
.login-logo { display: none; width: 170px; margin-bottom: 8px; }
.login-art h1 { font-size: 34px; line-height: 1.15; letter-spacing: -.025em; margin: 0; max-width: 18ch; font-weight: 650; }
.login-art p { color: var(--sea-text); max-width: 46ch; font-size: 15px; }
.login-clock { display: flex; flex-direction: column; gap: 16px; max-width: 460px; }
.login-clock .row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 14px; align-items: center; font-size: 13px; color: var(--sea-text); }
.login-clock .clock-track { background: var(--sea-2); }
.login-form { background: var(--surface); padding: 48px 44px; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.login-form h2 { margin: 0; font-size: 22px; letter-spacing: -.015em; }
.login-form .error { color: var(--deny-fg); font-size: 13px; min-height: 18px; }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login-art { display: none; } .login-logo { display: block; } }

/* ---------- toast ---------- */
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--sea); color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 13px; box-shadow: 0 8px 24px rgba(16,43,70,.25); max-width: 380px; animation: slide .2s ease; }
.toast.bad { background: #8E2A20; }

/* ---------- responsive shell ---------- */
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; padding: 12px; }
  .brand { padding-bottom: 10px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-sep, .side-foot { display: none; }
  .page { padding: 18px 16px 40px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.code-tools .small svg, .page-head p svg { width: 14px; height: 14px; stroke: currentColor; vertical-align: -2px; }
.drawer-head .small svg { width: 14px; height: 14px; stroke: currentColor; vertical-align: -2px; }
.drawer-head .mono.small { margin-top: 6px; word-break: break-all; }
a.tab { display: inline-flex; align-items: center; text-decoration: none; }
a.tab:hover { text-decoration: none; }
.scenario .row-top { display: flex; }
.head-actions .btn svg, .payer-list .btn svg { flex: none; }
.kv { margin: 0; }
table.data td.mono, table.data .sub.mono { white-space: nowrap; }
table.data td { line-height: 1.35; }
table.data a.mono { white-space: nowrap; }
.chips .select { width: auto; max-width: 220px; height: 32px; }
table.data .dir { margin-right: 4px; }
.test-step svg { stroke: currentColor; flex: none; }
.scenario-grid { align-items: start; }
.steps li { grid-template-columns: minmax(0, 1fr) auto; row-gap: 2px; }
.steps li > span:nth-child(2) { grid-column: 1 / -1; order: 3; }
.steps li .badge { justify-self: start; }

/* ---------- assistant ---------- */
.ai-page { display: flex; flex-direction: column; height: 100vh; padding-bottom: 18px; }
.ai-page .page-head { flex: none; }
.ai-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.ai-log { flex: 1; min-height: 0; overflow-y: auto; padding: 26px 28px 30px; display: flex; flex-direction: column; gap: 24px; scroll-behavior: smooth; }
.ai-foot { flex: none; margin: 10px 4px 0; font-size: 12px; color: var(--muted); }

.ai-msg { display: flex; animation: fade .2s ease-out; }
.ai-msg.user { justify-content: flex-end; }
.ai-bubble { max-width: min(72%, 680px); background: var(--sea); color: #fff; padding: 10px 15px; border-radius: 16px 16px 4px 16px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.ai-msg.bot { gap: 14px; align-items: flex-start; max-width: 940px; }
.ai-avatar { flex: none; width: 32px; height: 32px; border-radius: 10px; background: var(--sea); display: grid; place-items: center; }
.ai-avatar svg { width: 17px; height: 17px; stroke: var(--sun); }
.ai-body { flex: 1; min-width: 0; padding-top: 4px; }

.ai-steps { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.ai-step { border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); font-size: 12.5px; overflow: hidden; }
.ai-step summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 9px; padding: 7px 10px; color: var(--ink-2); user-select: none; }
.ai-step summary::-webkit-details-marker { display: none; }
.ai-step summary:hover { background: #EEF2F6; }
.ai-step-ic { width: 22px; height: 22px; flex: none; border-radius: 6px; display: grid; place-items: center; background: var(--lagoon-tint); }
.ai-step-ic svg { width: 13px; height: 13px; stroke: var(--lagoon); }
.ai-step.err .ai-step-ic { background: var(--deny-bg); }
.ai-step.err .ai-step-ic svg { stroke: var(--deny-fg); }
.ai-step.running .ai-step-ic { animation: breathe 1.2s ease-in-out infinite; }
.ai-step-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.ai-step .meta { color: var(--muted); font-family: var(--mono); font-size: 11.5px; white-space: nowrap; }
.ai-chev svg { width: 14px; height: 14px; stroke: var(--muted); transition: transform .15s; display: block; }
.ai-step[open] .ai-chev svg { transform: rotate(90deg); }
pre.ai-sql { margin: 0; padding: 11px 13px; background: #0B1D30; color: #D5DFEA; font-family: var(--mono); font-size: 12px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-step pre.ai-sql { border-top: 1px solid var(--line); }
.ai-step-err { padding: 8px 13px; color: var(--deny-fg); background: var(--deny-bg); font-size: 12px; }
@keyframes breathe { 50% { opacity: .45; } }

.ai-thinking { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 13px; padding: 4px 0; }
.ai-thinking span { width: 6px; height: 6px; border-radius: 50%; background: var(--lagoon); animation: bounce 1.1s infinite ease-in-out; }
.ai-thinking span:nth-child(2) { animation-delay: .15s; }
.ai-thinking span:nth-child(3) { animation-delay: .3s; }
.ai-thinking em { font-style: normal; margin-left: 6px; }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .35; } 40% { transform: translateY(-4px); opacity: 1; } }

.md { font-size: 14px; line-height: 1.6; color: var(--ink); overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md p { margin: 0 0 10px; }
.md h3 { font-size: 15px; font-weight: 650; margin: 16px 0 6px; }
.md h4 { font-size: 13.5px; font-weight: 650; margin: 14px 0 4px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 20px; }
.md li { margin: 2px 0; }
.md li::marker { color: var(--muted); }
.md code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 5px; padding: 1px 5px; }
.md pre { margin: 0 0 10px; background: #0B1D30; color: #D5DFEA; border-radius: 9px; padding: 12px 14px; overflow: auto; }
.md pre code { background: none; border: 0; padding: 0; color: inherit; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.md strong { font-weight: 650; }
.md-table { margin: 4px 0 12px; border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
.md table { border-collapse: collapse; width: 100%; font-size: 13px; }
.md th { text-align: left; font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.md td { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.md tr:last-child td { border-bottom: 0; }
.md .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
a.ai-ref { font-family: var(--mono); font-size: 12px; }

.ai-error { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 9px; background: var(--deny-bg); color: var(--deny-fg); font-size: 13px; }
.ai-error svg { width: 15px; height: 15px; stroke: currentColor; flex: none; margin-top: 2px; }
.ai-actions { display: flex; align-items: center; gap: 10px; margin-top: 6px; margin-left: -10px; }
.ai-note { font-size: 12px; color: var(--muted); }
.ai-fb { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; }
.ai-fb .ai-note { margin-right: 4px; }
.ai-fb .btn.icon-only { width: 30px; padding: 0; justify-content: center; color: var(--muted); }
.ai-fb .btn.icon-only:hover, .ai-fb .btn.on { color: var(--lagoon); background: var(--lagoon-tint); }
.ai-fb-done { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }
.ai-fb-done svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.ai-fb-form { display: grid; gap: 6px; margin-top: 8px; max-width: 560px; }
.ai-fb-form textarea { width: 100%; font: inherit; font-size: 13px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
.ai-fb-buttons { display: flex; gap: 6px; justify-content: flex-end; }

.ai-welcome, .ai-setup { margin: auto; max-width: 760px; text-align: center; padding: 20px 8px; }
.ai-setup { padding: 48px 24px; text-align: left; max-width: 620px; }
.ai-setup .ai-hero-ic { margin: 0 0 14px; }
.ai-setup pre.ai-sql { border-radius: 9px; margin: 12px 0; }
.ai-hero-ic { width: 48px; height: 48px; border-radius: 14px; margin: 0 auto 14px; background: linear-gradient(140deg, var(--sea), #234A70); display: grid; place-items: center; box-shadow: 0 6px 18px rgba(16, 43, 70, .28); }
.ai-hero-ic svg { width: 24px; height: 24px; stroke: var(--sun); }
.ai-welcome h2, .ai-setup h2 { margin: 0 0 6px; font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.ai-welcome p, .ai-setup p { margin: 0 0 20px; color: var(--muted); }
.ai-setup p { margin-bottom: 8px; }
.ai-suggest { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; text-align: left; }
.ai-chip { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; font-size: 13px; color: var(--ink); line-height: 1.4; transition: border-color .15s, box-shadow .15s, transform .15s; }
.ai-chip:hover { border-color: var(--lagoon); box-shadow: 0 0 0 3px var(--lagoon-tint); transform: translateY(-1px); }
.ai-chip-group { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--sun-deep); }

.ai-composer { flex: none; display: flex; gap: 10px; align-items: flex-end; padding: 14px 16px; border-top: 1px solid var(--line-soft); background: var(--surface); }
.ai-composer textarea { flex: 1; resize: none; min-height: 46px; max-height: 180px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.45; background: var(--surface-2); transition: border-color .15s, box-shadow .15s, background .15s; }
.ai-composer textarea:focus { outline: none; border-color: var(--lagoon); background: var(--surface); box-shadow: 0 0 0 3px var(--lagoon-tint); }
.ai-send { width: 46px; height: 46px; padding: 0; justify-content: center; border-radius: 12px; }
.ai-send svg { width: 18px; height: 18px; }
.ai-send.stop { background: var(--sun-deep); border-color: var(--sun-deep); }
.ai-send.stop svg { fill: #fff; }
@media (max-width: 760px) {
  .ai-log { padding: 18px 14px; }
  .ai-bubble { max-width: 88%; }
}

/* ---------- documentation forms ---------- */
.input.textarea { height: auto; min-height: 64px; padding: 8px 11px; resize: vertical; line-height: 1.5; }
.form-answers td { vertical-align: top; }
.form-answers td.indent { padding-left: 28px; }
.form-answers .group-row td { background: var(--surface-2); font-weight: 650; font-size: 12.5px; color: var(--ink-2); }
.decision .value.small { font-size: 13.5px; font-weight: 600; letter-spacing: 0; word-break: break-all; }
.scenario .foot .acts { display: flex; gap: 6px; flex-wrap: nowrap; }

/* ---------- users and roles ---------- */
.user-row .who { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.user-row .who .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-row .role { font-size: 10px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--sun); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-row button + button { margin-left: 0; }
.scope-note { font-size: 11.5px; color: var(--sea-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge.gold { background: var(--gold-tint); color: var(--sun-deep); }
.drawer.narrow { width: min(560px, 100%); }
.panel-pad { padding-top: 18px; }
.form-actions { display: flex; gap: 10px; align-items: center; }
.error { color: var(--deny-fg); font-size: 13px; min-height: 18px; }
.roles, .scope-pick { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.roles legend, .scope-pick legend { padding: 0; margin-bottom: 4px; }
.role-opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.role-opt:hover { border-color: #C3CCD6; }
.role-opt:has(input:checked) { border-color: var(--lagoon); background: #F3F6FA; box-shadow: inset 3px 0 0 var(--sun); }
.role-opt input { margin-top: 3px; accent-color: var(--lagoon); }
.role-opt > span { display: flex; flex-direction: column; gap: 2px; }
.roles[disabled] .role-opt { cursor: default; opacity: .75; }
.check { display: flex; gap: 9px; align-items: center; font-size: 13px; padding: 6px 2px; cursor: pointer; }
.check input { accent-color: var(--lagoon); width: 15px; height: 15px; }
td.sees { font-size: 13px; }
td.sees svg { width: 14px; height: 14px; stroke: var(--muted); vertical-align: -2px; margin-right: 5px; }
.callout.gold { background: var(--gold-tint); border-color: #E8DDB2; color: var(--ink); }
.secret { margin-top: 10px; }
.secret-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.secret-row { display: flex; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 6px 6px 12px; }
.secret-row code { flex: 1; font-size: 14px; letter-spacing: .02em; color: var(--ink); }
.inline-field { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }

/* ---------- payer view ---------- */
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; color: var(--sun-deep); margin-bottom: 4px; }
.eyebrow svg { width: 14px; height: 14px; stroke: currentColor; }
.stat.alert .value { color: var(--deny-fg); }
.pv-meter { margin: 6px 0 4px; }
.pv-meter-track { height: 6px; border-radius: 999px; background: #E3E8EF; overflow: hidden; }
.pv-meter-fill { height: 100%; width: 0; border-radius: 999px; background: var(--ok-fg); }
.pv-meter.pend .pv-meter-fill { background: var(--sun); }
.pv-meter.deny .pv-meter-fill { background: #C2412F; }
td strong.late { color: var(--deny-fg); }
td strong.soon { color: var(--pend-fg); }
.pv-chart { display: flex; gap: 6px; align-items: stretch; height: 130px; }
.pv-day { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pv-bars { flex: 1; display: flex; gap: 2px; align-items: flex-end; }
.pv-bars i { flex: 1; display: block; border-radius: 3px 3px 0 0; min-height: 1px; }
.pv-bars .rcv, .pv-legend .rcv { background: #A9BCD1; }
.pv-bars .dec, .pv-legend .dec { background: var(--lagoon); }
.pv-day span { font-size: 10.5px; color: var(--muted); text-align: center; }
.pv-legend { margin-top: 10px; }
.pv-route { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pv-route .label { font-size: 12px; color: var(--muted); }
.pv-route .value { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
table.data.compact td, table.data.compact th { padding: 8px 14px; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.input:disabled, .select:disabled, textarea:disabled { background: var(--surface-2); color: var(--ink-2); cursor: default; }

/* sign-out and change-password buttons under the user's name */
.user-row .who { flex: 1; }
.user-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.user-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--sea-2); background: transparent; color: var(--sea-text); font: inherit; font-size: 12.5px; cursor: pointer; }
.user-actions button svg { width: 15px; height: 15px; stroke: currentColor; flex: none; }
.user-actions button:hover { background: var(--sea-2); color: #fff; }
.user-actions #logout { grid-column: 1 / -1; }
.user-actions #logout:hover { border-color: var(--sun); color: var(--sun); background: var(--sea-2); }
.user-actions button:focus-visible { outline: 2px solid var(--sun); outline-offset: 2px; }

/* ---------- sidebar search and badges ---------- */
.side-search { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 0 10px; height: 36px; border-radius: 8px; background: var(--sea-2); color: var(--sea-text); }
.side-search svg { width: 15px; height: 15px; stroke: currentColor; flex: none; }
.side-search input { flex: 1; min-width: 0; background: transparent; border: 0; color: #fff; font: inherit; font-size: 13px; outline: none; }
.side-search input::placeholder { color: var(--sea-text); opacity: .8; }
.side-search:focus-within { box-shadow: 0 0 0 2px var(--sun); }
.side-search kbd { font: 11px var(--mono); border: 1px solid var(--sea-3); border-radius: 4px; padding: 0 5px; color: var(--sea-text); }
.nav .count.crit { background: #E5533D; color: #fff; }

/* ---------- work queue ---------- */
.q-kinds { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.q-kind { position: relative; text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; font: inherit; color: var(--ink); overflow: hidden; }
.q-kind .n { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.q-kind .l { font-size: 12px; color: var(--muted); }
.q-kind .tone { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.q-kind .tone.deny, .q-kind .tone.err { background: #C2412F; }
.q-kind .tone.warn, .q-kind .tone.pend { background: var(--sun); }
.q-kind.zero { opacity: .55; }
.q-kind.zero .tone { background: transparent; }
.q-kind:hover { border-color: #C3CCD6; }
.q-kind.on { border-color: var(--lagoon); box-shadow: 0 0 0 2px var(--lagoon-tint, #E4EBF4); opacity: 1; }
.q-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.select.sm { height: 30px; font-size: 12.5px; }
.saved { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.q-bar .saved { margin-bottom: 0; }
.saved-chip { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); overflow: hidden; }
.saved-chip button { border: 0; background: none; font: inherit; font-size: 12.5px; padding: 5px 6px 5px 10px; cursor: pointer; display: inline-flex; gap: 5px; align-items: center; color: var(--ink-2); }
.saved-chip button svg { width: 13px; height: 13px; stroke: currentColor; }
.saved-chip .x { padding: 5px 10px 5px 4px; color: var(--muted); }
.saved-chip button:hover { color: var(--ink); }
.bulk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px; background: var(--sea); color: #fff; border-radius: var(--radius); }
.bulk strong { margin-right: 6px; }
.bulk .btn { background: var(--sea-2); border-color: var(--sea-3); color: #fff; }
.bulk .btn:hover { background: var(--sea-3); }
table.data td.cb, table.data th.cb { width: 36px; padding-right: 0; }
.q-title { font-weight: 600; margin-top: 5px; }
.sub.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 46ch; }
.sub.late { color: var(--deny-fg); font-weight: 600; }
.owner { display: inline-flex; align-items: center; gap: 7px; }
.avatar.xs { width: 22px; height: 22px; font-size: 10px; background: var(--lagoon); color: #fff; }
.q-head h3 { margin: 8px 0 2px; font-size: 17px; }
.q-head p { margin: 0; }
.q-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.resolve-row { display: flex; gap: 8px; }
.resolve-row .input { flex: 1; }
.notes h3 { font-size: 14px; margin: 6px 0 8px; }
.note-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.note-list li { padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius); font-size: 13px; border-left: 3px solid var(--line); }
.note-meta { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.note-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.note-form textarea, .textarea { width: 100%; height: auto; min-height: 56px; padding: 8px 11px; resize: vertical; font: inherit; font-size: 13px; }
.linklike { border: 0; background: none; padding: 0; color: var(--lagoon); cursor: pointer; text-decoration: underline; }

/* ---------- alerts ---------- */
.alert-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.alert-card { position: relative; display: flex; gap: 16px; align-items: flex-start; padding: 14px 16px 14px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow); overflow: hidden; }
.alert-card .sev-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--sun); }
.alert-card.critical .sev-bar { background: #C2412F; }
.alert-card.resolved, .alert-card.acknowledged { opacity: .8; }
.alert-card.resolved .sev-bar { background: #A9D3B9; }
.alert-main { flex: 1; min-width: 0; }
.alert-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.alert-title { font-weight: 650; font-size: 15px; }
.alert-detail { color: var(--ink-2); font-size: 13px; margin: 2px 0 4px; }
.alert-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.rule-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.channel { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 14px; align-items: start; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.channel .switch { margin-top: 26px; }
@media (max-width: 720px) { .channel { grid-template-columns: 1fr; } .channel .switch { margin-top: 0; } }

/* ---------- search ---------- */
.search-big { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow); margin-bottom: 18px; }
.search-big svg { width: 18px; height: 18px; stroke: var(--muted); flex: none; }
.search-big .input { flex: 1; border: 0; height: 40px; font-size: 15px; box-shadow: none; }
.h-sm { font-size: 14px; margin: 0 0 12px; }
.kinds-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 18px; font-size: 13px; }
.kinds-grid div { display: flex; flex-direction: column; }
.result-list { list-style: none; margin: 0; padding: 0; }
.result { display: grid; grid-template-columns: 82px minmax(0, 1fr) auto; gap: 14px; padding: 13px 18px; border-bottom: 1px solid var(--line-soft); cursor: pointer; align-items: start; }
.result:last-child { border-bottom: 0; }
.result:hover { background: #F7F9FB; }
.r-type { font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
.r-title { font-weight: 600; }
.r-match { margin-top: 5px; display: flex; gap: 5px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); }
.match { background: var(--gold-tint); color: var(--sun-deep); border-radius: 999px; padding: 1px 8px; font-weight: 600; }
.r-side { text-align: right; }

/* ---------- X12 explained ---------- */
.seg-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 10px; }
.seg-toggle button { border: 0; background: var(--surface); padding: 6px 12px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--ink-2); }
.seg-toggle button[aria-pressed="true"] { background: var(--sea); color: #fff; }
.x12 { display: flex; flex-direction: column; gap: 10px; }
.x12-ids { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); padding: 8px 12px; background: var(--surface-2); border-radius: var(--radius); }
.x12-ids b { color: var(--muted); font-weight: 600; margin-right: 3px; }
.reject { display: flex; flex-direction: column; gap: 8px; }
.reject-row { display: flex; gap: 10px; align-items: flex-start; color: var(--ink); }
.code-pill { flex: none; font: 600 11.5px var(--mono); background: #C2412F; color: #fff; border-radius: 6px; padding: 2px 7px; margin-top: 1px; }
.x12-table td { vertical-align: top; }
.x12-table tr.loop-start td { border-top: 2px solid var(--line); }
.x12-table tr.x12-bad td { background: var(--deny-bg); }
.seg-id { font: 650 12.5px var(--mono); color: var(--sea); }
.els { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.el { display: inline-flex; align-items: baseline; gap: 5px; padding: 2px 7px; border: 1px solid var(--line-soft); border-radius: 6px; background: var(--surface); font-size: 12px; max-width: 100%; }
.el-ref { font: 10.5px var(--mono); color: var(--muted); }
.el-name { color: var(--ink-2); }
.el-name:empty { display: none; }
.el-val { color: var(--ink); font-weight: 600; word-break: break-all; }
.el-mean { color: var(--sun-deep); font-weight: 600; }
.el-mean::before { content: '→ '; color: var(--muted); font-weight: 400; }

/* ---------- fix and resend ---------- */
.fix-field { padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius); }
.fix-field.flag { border-color: #EBC3BE; background: #FDF6F5; box-shadow: inset 3px 0 0 #C2412F; }
.fix-label { display: flex; gap: 8px; align-items: center; font-weight: 600; color: var(--ink); }
.fix-now { font-weight: 400; font-size: 12px; color: var(--ink-2); }
.field-error { color: var(--deny-fg); font-size: 12px; font-weight: 500; }
.field-error:empty { display: none; }

/* ---------- transactions: EDI filters ---------- */
.edi-filters { margin-bottom: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.edi-filters summary { cursor: pointer; padding: 10px 14px; font-size: 13px; font-weight: 600; display: flex; gap: 8px; align-items: center; list-style: none; }
.edi-filters summary::-webkit-details-marker { display: none; }
.edi-filters summary svg { width: 15px; height: 15px; stroke: currentColor; }
.edi-filters[open] summary { border-bottom: 1px solid var(--line-soft); }
.edi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 14px; padding: 14px; align-items: end; }
.check.rej { padding-bottom: 8px; }
.panel-body p svg, .small > svg, p.small svg { width: 14px; height: 14px; stroke: currentColor; vertical-align: -2px; }

/* ---------- new request (manual entry) ---------- */
.nr { display: flex; flex-direction: column; gap: 16px; max-width: 1080px; }
.nr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 18px; align-items: start; }
.nr-grid .span2 { grid-column: 1 / -1; }
.nr-urgency { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.nr-urgency legend { margin-bottom: 6px; }
.nr-urgency .role-opt:has(input[value="urgent"]:checked) { border-color: #C2412F; box-shadow: inset 3px 0 0 #C2412F; }
.input.invalid, .select.invalid, .textarea.invalid { border-color: #C2412F; box-shadow: 0 0 0 3px var(--deny-bg); }
.nr-bar { position: sticky; bottom: 0; z-index: 3; display: flex; align-items: center; gap: 14px; justify-content: space-between; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: 0 -6px 18px rgba(16, 43, 70, .08); }
.nr-bar-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nr-bar .error { min-height: 0; }
.nr-result { max-width: 760px; }

/* ---------- printable request ---------- */
.pr-page { max-width: 920px; }
.pr-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.pr-spacer { flex: 1; }
.pr-page > .callout { margin-bottom: 14px; }
.pr-doc { background: #fff; color: #12253A; border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow); padding: 34px 40px; display: flex; flex-direction: column; gap: 20px; font-size: 13.5px; }
.pr-head { display: grid; grid-template-columns: auto 1fr auto; gap: 22px; align-items: center; padding-bottom: 16px; border-bottom: 2px solid #102B46; }
.pr-logo { width: 130px; }
.pr-kind { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #8E7A2A; }
.pr-id { font-size: 20px; font-weight: 600; color: #102B46; }
.pr-sub { font-size: 12px; color: #5E6D7E; }
.pr-urg { font-size: 12px; font-weight: 700; letter-spacing: .06em; padding: 6px 12px; border: 1.5px solid #102B46; border-radius: 6px; color: #102B46; white-space: nowrap; }
.pr-urg.urgent { border-color: #9C2A1F; color: #9C2A1F; background: #FBEDEB; }
.pr-status { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 12px 14px; background: #F6F8FA; border: 1px solid #DCE2E9; border-radius: 8px; }
.pr-status > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pr-l { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #5E6D7E; }
.pr-sec h3 { font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #102B46; margin: 0 0 8px; padding-bottom: 5px; border-bottom: 1px solid #DCE2E9; }
.pr-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 20px; margin: 0; }
.pr-f { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pr-f dt { font-size: 11px; color: #5E6D7E; }
.pr-f dd { margin: 0; font-weight: 600; word-break: break-word; }
.pr-table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.pr-table th { text-align: left; font-size: 11px; color: #5E6D7E; font-weight: 600; padding: 6px 8px; border-bottom: 1px solid #DCE2E9; }
.pr-table td { padding: 8px; border-bottom: 1px solid #E9EDF2; font-weight: 600; }
.pr-dx { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.pr-tag { font-size: 10.5px; font-weight: 700; color: #8E7A2A; background: #F7F2DE; padding: 1px 6px; border-radius: 4px; margin-left: 6px; }
.pr-text { margin: 0; white-space: pre-wrap; line-height: 1.55; max-width: none; color: #12253A; }
.pr-sign { display: grid; grid-template-columns: 2fr 1fr; gap: 28px; padding-top: 22px; }
.pr-sign > div { display: flex; flex-direction: column; gap: 4px; }
.pr-line { border-bottom: 1px solid #12253A; height: 28px; }
.pr-foot { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: #5E6D7E; border-top: 1px solid #DCE2E9; padding-top: 10px; }
@media (max-width: 720px) { .pr-grid, .pr-status { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pr-head { grid-template-columns: 1fr; } .pr-doc { padding: 20px; } }

@media print {
  @page { size: letter; margin: 14mm; }
  body { background: #fff !important; }
  .sidebar, .no-print, .toasts { display: none !important; }
  .shell { display: block; }
  .page, .pr-page { padding: 0 !important; max-width: none; }
  .pr-doc { border: 0; box-shadow: none; padding: 0; border-radius: 0; gap: 11px; font-size: 12px; }
  .pr-head { padding-bottom: 10px; }
  .pr-logo { width: 110px; }
  .pr-status { padding: 8px 12px; }
  .pr-sec h3 { margin-bottom: 5px; padding-bottom: 3px; }
  .pr-grid { gap: 4px 18px; }
  .pr-table td, .pr-table th { padding: 5px 8px; }
  .pr-table { margin-bottom: 6px; }
  .pr-text { line-height: 1.45; }
  .pr-sign { padding-top: 10px; }
  .pr-sec, .pr-status, .pr-sign { break-inside: avoid; }
  .badge { border: 1px solid currentColor; }
}
.sim-section { margin: 26px 0 12px; }
.sim-section h2 { margin: 0 0 4px; font-size: 18px; }
.sim-section p { margin: 0; max-width: 80ch; }
.scenario.manual { border-top: 3px solid var(--sun); }
.sim-links { margin: 6px 0 0; }

/* ---------- provider view (formerly hospital view) ---------- */
.hv-rate { font-weight: 650; font-variant-numeric: tabular-nums; }
.hv-rate.ok { color: var(--ok-fg); }
.hv-rate.pend { color: var(--pend-fg); }
.hv-rate.deny { color: var(--deny-fg); }
.hv-list { list-style: none; margin: 0; padding: 0; }
.hv-list li { display: flex; gap: 12px; align-items: flex-start; padding: 11px 18px; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.hv-list li:last-child { border-bottom: 0; }
.hv-n { flex: none; min-width: 28px; height: 24px; padding: 0 7px; border-radius: 999px; background: var(--deny-bg); color: var(--deny-fg); font-weight: 700; font-size: 12px; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.hv-list .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.hv-kinds { list-style: none; margin: 0; padding: 0 18px 12px; display: flex; flex-direction: column; }
.hv-kinds li { display: flex; justify-content: space-between; padding: 7px 0; border-top: 1px solid var(--line-soft); font-size: 13.5px; }
.hv-kinds li span { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- EDI dashboard ---------- */
.c-navy { background: #2A62A3; } .c-light { background: #8DB3DE; } .c-gold { background: #D0A93A; } .c-red { background: #C2412F; }
.stat.warnv .value { color: var(--pend-fg); }
.ed-legend { margin-top: 10px; flex-wrap: wrap; }
.ed-svg { width: 100%; height: auto; display: block; }
.ed-svg .ed-hit:hover { fill: rgba(26, 70, 115, .06); }
.ed-hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ed-hbars li { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) 36px; gap: 12px; align-items: center; padding: 6px 8px; border-radius: 8px; }
.ed-hbars li.clickable { cursor: pointer; }
.ed-hbars li.clickable:hover, .ed-hbars li.clickable:focus-visible { background: #F2F5F9; outline: none; }
.ed-hb-label { font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ed-hb-label .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-hb-label .code-pill { margin-right: 4px; }
.ed-hb-track { display: flex; gap: 2px; height: 10px; background: #EEF1F5; border-radius: 4px; overflow: hidden; }
.ed-hb-track i { display: block; height: 100%; width: 0; }
.ed-hb-track i:last-child { border-radius: 0 4px 4px 0; }
.ed-hb-n { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.ed-unass { color: var(--sun-deep); }
.ed-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line-soft); }
.ed-bulk { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--ink-2); background: var(--lagoon-tint); border-radius: 8px; padding: 4px 4px 4px 12px; }
.ed-bulk.idle { background: transparent; color: var(--muted); }
.ed-bulk .select { height: 30px; font-size: 12.5px; }
table.data th.chk, table.data td.chk { width: 34px; padding-right: 0; }
.ed-owner { min-width: 170px; }
.ed-owner.none { color: var(--sun-deep); font-weight: 600; border-color: #E1CF84; background-color: var(--gold-tint); }
.ed-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 18px; margin: 18px 0; }
#assign { margin-top: 18px; scroll-margin-top: 16px; }
@media (max-width: 720px) { .ed-charts { grid-template-columns: 1fr; } .ed-bulk { margin-left: 0; width: 100%; } .ed-hbars li { grid-template-columns: minmax(0, 1fr) 80px 30px; } }
.ed-hbars li.on { background: var(--lagoon-tint); }

/* ---------- idle sign-out ---------- */
.idle-scrim { position: fixed; inset: 0; background: rgba(16, 43, 70, .45); display: grid; place-items: center; z-index: 1000; padding: 16px; }
.idle-dialog { background: var(--surface); border-radius: var(--radius-l); box-shadow: 0 12px 40px rgba(16, 43, 70, .25); padding: 24px; max-width: 420px; width: 100%; }
.idle-dialog h2 { margin: 0 0 8px; font-size: 18px; }
.idle-dialog p { margin: 0 0 18px; color: var(--ink-2); }
.idle-dialog strong { font-variant-numeric: tabular-nums; color: var(--ink); }
.idle-actions { display: flex; gap: 8px; justify-content: flex-end; }
.login-notice { background: var(--gold-tint); border: 1px solid #E1CF84; color: #5C4D12; border-radius: var(--radius); padding: 10px 14px; font-size: 13px; }

/* ---------- two-step sign-in ---------- */
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mfa-banner { display: flex; align-items: center; gap: 10px; padding: 9px 20px; background: var(--gold-tint); border-bottom: 1px solid #E8DDB2; color: var(--ink); font-size: 13px; }
.mfa-banner > svg { width: 18px; height: 18px; stroke: #8E7A2A; fill: none; stroke-width: 2; flex: none; }
.mfa-banner span { flex: 1; }
.mfa-banner.urgent { background: var(--deny-bg); border-color: #EBC3BE; }
.mfa-banner.urgent > svg { stroke: var(--deny-fg); }
.mfa-steps { margin: 0; padding-left: 20px; display: grid; gap: 14px; font-size: 13.5px; }
.mfa-steps li::marker { color: var(--lagoon); font-weight: 650; }
.mfa-qr { width: 176px; height: 176px; margin: 10px 0 6px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.mfa-qr svg { width: 100%; height: 100%; display: block; }
.mfa-key { display: inline-block; margin-top: 4px; padding: 6px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; font-size: 13px; letter-spacing: .06em; word-break: break-all; }
.mfa-confirm { margin-top: 8px; }
.code-input { font-size: 20px; letter-spacing: .18em; max-width: 210px; font-variant-numeric: tabular-nums; }
.rc-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface-2); }
.rc-list { columns: 2; margin: 0 0 10px; padding-left: 22px; font-size: 14px; }
.rc-list li { padding: 2px 0; }
.rc-list code { letter-spacing: .05em; }
.rc-actions { display: flex; gap: 8px; }
.mfa-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mfa-sep { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 6px; justify-items: start; }
.mfa-on { display: inline-flex; align-items: center; gap: 4px; color: var(--ok-fg); }
.mfa-on svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; }
.user-actions button span { white-space: nowrap; }

.transport-note { margin-bottom: 14px; }
.transport-note ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- audit log integrity ---------- */
.audit-integrity { margin-bottom: 14px; padding: 14px 16px; display: grid; gap: 8px; border-left: 4px solid var(--ok-fg); }
.audit-integrity.bad { border-left-color: var(--deny-fg); background: var(--deny-bg); }
.audit-integrity .ai-head { display: flex; gap: 10px; align-items: flex-start; }
.audit-integrity .ai-head > svg { width: 20px; height: 20px; flex: none; stroke: var(--ok-fg); fill: none; stroke-width: 2; margin-top: 1px; }
.audit-integrity.bad .ai-head > svg { stroke: var(--deny-fg); }
.audit-integrity .ai-head > div { flex: 1; display: grid; gap: 2px; font-size: 13px; }
.audit-integrity .ai-head strong { font-size: 14px; }
.audit-integrity .ai-problems { margin: 0; padding-left: 22px; font-size: 13px; color: var(--deny-fg); }
.audit-integrity .ai-foot { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); }
.audit-integrity .warn { color: #7A4E00; }
