/* SUMA Clearinghouse console. Same design system as the 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;
  --c-ok: #2F8F57; --c-partial: #D99A1E; --c-deny: #C2412F; --c-pending: #A9BCD1;
  --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; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- 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; overflow-y: auto; }
.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-label { font-size: 10.5px; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; color: #7F93A8; padding: 14px 10px 6px; }
.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 .count.bad { background: #E58B6F; color: #fff; }
.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; flex-wrap: wrap; }
.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; }
.user-row .who { min-width: 0; display: flex; flex-direction: column; }
.user-row .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row .who .role { color: var(--sea-text); font-size: 11px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--sea-3); display: grid; place-items: center; font-size: 12px; font-weight: 650; flex: none; }
.user-row button { margin-left: auto; background: none; border: 0; color: var(--sea-text); cursor: pointer; padding: 6px; border-radius: 6px; }
.user-row button svg { width: 17px; height: 17px; stroke: currentColor; display: block; }
.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: 72ch; }
.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); }
.page > .panel + .panel, .page > .panel + .stats, .page > .panel + .grid-2, .page > .stats + .panel, .page > .grid-2 + .panel, .page > .scenario-grid + .panel, .page > .panel + .scenario-grid { margin-top: 18px; }
.stack > .panel + .panel { margin-top: 0; }
.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; }
.grid-even { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 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; text-decoration: none; }
.btn:hover { text-decoration: none; }
.btn svg { width: 15px; height: 15px; stroke: currentColor; flex: none; }
.btn:hover { border-color: #C3CCD6; background: var(--surface-2); color: var(--ink); }
.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, .textarea { height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 11px; background: var(--surface); font-size: 13px; min-width: 0; }
.textarea { height: auto; min-height: 76px; padding: 8px 11px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--lagoon); outline: none; box-shadow: 0 0 0 3px var(--lagoon-tint); }
.input.mono, .textarea.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: 280px; 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, .field .textarea { width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px 16px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 6px; flex-wrap: wrap; }
.error { color: var(--deny-fg); font-size: 13px; min-height: 18px; }

.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; }
.chips .select { width: auto; max-width: 240px; height: 32px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }

.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); }
.badge.gold { background: var(--gold-tint); color: var(--sun-deep); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: var(--c-ok); } .dot.pend { background: var(--c-partial); } .dot.deny { background: var(--c-deny); } .dot.idle { background: #97A3B1; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.live .dot { background: var(--c-ok); animation: pulse 2s infinite; }
@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); } }
.chan { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.chan svg { width: 14px; height: 14px; stroke: currentColor; }

/* ---------- 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; }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; line-height: 1.35; }
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 .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
table.data td.num, table.data th.num { text-align: right; }
table.data td.mono { white-space: nowrap; }
.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; }

/* ---------- stats strip ---------- */
.stats { 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); display: flex; align-items: center; gap: 6px; }
.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); }

/* ---------- outcome bar & chart (signature) ---------- */
.outcome { padding: 20px 22px 18px; border-bottom: 1px solid var(--line-soft); }
.outcome h2 { margin: 0; font-size: 20px; letter-spacing: -.015em; font-weight: 650; }
.outcome p { margin: 4px 0 14px; color: var(--muted); max-width: 70ch; }
.outcome-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: #E3E8EF; }
.outcome-bar i { display: block; height: 100%; transition: width .6s ease; }
.seg-ok { background: var(--c-ok); } .seg-partial { background: var(--c-partial); } .seg-deny { background: var(--c-deny); } .seg-pending { background: var(--c-pending); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); flex-wrap: wrap; margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding: 6px 0 0; }
.bars .bar { flex: 1; display: flex; flex-direction: column-reverse; min-width: 6px; border-radius: 3px 3px 0 0; overflow: hidden; background: transparent; }
.bars .bar i { display: block; }
.bars .bar.empty-bar { background: #EEF1F5; }
.chart-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }

/* ---------- envelope tree (file detail) ---------- */
.envelope { padding: 6px 0; }
.env-level { border-left: 2px solid var(--line); margin-left: 18px; padding-left: 16px; }
.env-node { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 18px 10px 0; }
.env-tag { font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: var(--sea); background: var(--lagoon-tint); border-radius: 6px; text-align: center; padding: 3px 0; }
.env-node.top { padding-left: 18px; grid-template-columns: 44px minmax(0, 1fr) auto; }
.env-node .t { font-weight: 600; }
.env-node .d { font-size: 12px; color: var(--muted); margin-top: 1px; }
.env-node .acks { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.errs { list-style: none; margin: 0 0 10px; padding: 0 18px 0 0; display: flex; flex-direction: column; gap: 6px; }
.errs li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 9px; padding: 9px 12px; font-size: 13px; }
.errs li.warning { background: #FFFBF0; border-color: #F2E3B8; }
.errs li.error { background: #FDF5F4; border-color: #F1D3CF; }
.errs .where { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.errs .codes { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ---------- detail ---------- */
.kv { display: grid; grid-template-columns: minmax(130px, auto) minmax(0, 1fr); margin: 0; }
.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; overflow-wrap: anywhere; }
.kv dt:last-of-type, .kv dd:last-of-type { border-bottom: 0; }
.list-rows { display: flex; flex-direction: column; }
.list-row { 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); }
.list-row:last-child { border-bottom: 0; }
.list-row .name { font-weight: 600; }
.list-row .meta { font-size: 12px; color: var(--muted); }
.list-row.clickable { cursor: pointer; }
.list-row.clickable:hover { background: #F7F9FB; }
.check-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 12px 18px; border-bottom: 1px solid var(--line-soft); }
.check-row:last-child { border-bottom: 0; }
.check-row .ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px; }
.check-row .ic svg { width: 13px; height: 13px; stroke: #fff; stroke-width: 2.6; }
.check-row .ic.ok { background: var(--c-ok); } .check-row .ic.bad { background: var(--c-deny); } .check-row .ic.off { background: #97A3B1; }
.check-row .t { font-weight: 600; }
.check-row .d { font-size: 12px; color: var(--muted); margin-top: 2px; }
.check-row .v { font-size: 12px; color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; }

.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); }
.callout.gold { background: var(--gold-tint); border-color: #EADFB3; color: #5E4E12; }
.callout strong { display: block; margin-bottom: 2px; }
.secret { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-top: 8px; }
.secret code { font-family: var(--mono); font-size: 12.5px; background: #fff; border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; word-break: break-all; }

/* ---------- 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; }
.drawer.narrow { width: min(520px, 100%); }
@keyframes slide { from { transform: translateX(24px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }
.drawer-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line-soft); display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.drawer-head h2 { margin: 0; font-size: 18px; font-weight: 650; }
.drawer-head p { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.drawer-body { flex: 1; overflow: auto; padding: 18px 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.code-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; 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: 68vh; white-space: pre; }
pre.code .seg { color: #8DB8E3; font-weight: 600; }
pre.code .env { color: var(--sun); font-weight: 600; }

/* ---------- simulator ---------- */
.scenario-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; align-items: start; }
.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 .expect { font-size: 12px; color: var(--muted); }
.scenario .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; }
.scenario .acts { display: flex; gap: 6px; }

/* ---------- 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; gap: 32px; }
.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: 48ch; font-size: 15px; }
.login-env { max-width: 470px; font-family: var(--mono); font-size: 12.5px; }
.login-env .row { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--sea-2); color: var(--sea-text); }
.login-env .row:last-child { border-bottom: 0; }
.login-env .row b { color: var(--sun); font-weight: 600; }
.login-env .row.l2 { padding-left: 18px; } .login-env .row.l3 { padding-left: 36px; }
.login-env .ack { font-size: 11px; font-family: var(--font); font-weight: 650; padding: 1px 8px; border-radius: 999px; background: #1F5A3D; color: #CDEFD9; }
.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; }
@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-label, .side-foot { display: none; }
  .page { padding: 18px 16px 40px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.user-row button + button { margin-left: 0; }

/* ---------- role picker ---------- */
fieldset.roles { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
fieldset.roles legend { margin-bottom: 6px; padding: 0; }
.role-opt { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 13px; }
.role-opt input { margin: 3px 0 0; accent-color: var(--lagoon); }
.role-opt:hover { border-color: #BAC5D2; }
.role-opt:has(input:checked) { border-color: var(--lagoon); box-shadow: 0 0 0 1px var(--lagoon); background: #F5F8FC; }
fieldset.roles:disabled .role-opt { cursor: default; opacity: .75; }
.stat .value.mono { font-size: 15px; font-weight: 600; letter-spacing: 0; margin-top: 6px; overflow-wrap: anywhere; }
#faults .input { width: 84px; }

/* ---------- payers ---------- */
.form-section { display: flex; flex-direction: column; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--line-soft); }
.form-section:last-of-type { border-bottom: 0; }
.form-section h3 { margin: 0; font-size: 13px; font-weight: 650; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); }
.seg-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg-toggle label { position: relative; cursor: pointer; }
.seg-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-toggle span { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 13.5px; background: var(--surface); }
.seg-toggle span svg { width: 18px; height: 18px; stroke: currentColor; flex: none; }
.seg-toggle input:checked + span { border-color: var(--lagoon); box-shadow: 0 0 0 1px var(--lagoon) inset; font-weight: 600; }
.seg-toggle input:focus-visible + span { outline: 2px solid var(--lagoon); outline-offset: 2px; }
details.more { border: 1px dashed var(--line); border-radius: var(--radius); padding: 10px 12px; }
details.more summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); }
details.more[open] summary { margin-bottom: 12px; }
ul.checks { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
ul.checks li { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; overflow-wrap: anywhere; }
ul.checks svg { width: 16px; height: 16px; flex: none; margin-top: 1px; stroke: currentColor; }
.select.sm { height: 30px; font-size: 12.5px; max-width: 260px; }
.bad-text { color: var(--deny-fg); }
.review-row { grid-template-columns: auto minmax(0, 1fr) auto; }
.route-arrow { display: inline-flex; align-items: center; gap: 6px; }
.route-arrow svg { width: 14px; height: 14px; stroke: var(--muted); }
.src-tag { font-size: 12px; font-weight: 600; color: var(--ink-2); }
@media (max-width: 640px) { .seg-toggle { grid-template-columns: 1fr; } .review-row { grid-template-columns: 1fr; } }

/* ---------- business rules ---------- */
fieldset.cond { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 14px; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
fieldset.cond legend { padding: 0 6px; font-size: 13px; font-weight: 650; color: var(--ink-2); }
.rule-summary { margin: 0 0 12px; font-size: 14.5px; font-weight: 600; line-height: 1.45; }
blockquote.quote { margin: 0; padding: 8px 14px; border-left: 3px solid var(--sun); background: var(--surface-2); font-size: 13.5px; color: var(--ink-2); }
.doc-row { grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; }
.doc-row > svg { width: 20px; height: 20px; stroke: var(--muted); margin-top: 2px; }
.callout strong svg { width: 15px; height: 15px; stroke: currentColor; vertical-align: -2px; }

/* ---------- paper claims ---------- */
.tab-count { display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 11.5px; font-weight: 600; line-height: 18px; text-align: center; }
.tab-count:empty { display: none; }
table.data th.check-col, table.data td.check-col { width: 34px; padding-right: 0; }
table.data td.check-col input, table.data th.check-col input { width: 16px; height: 16px; accent-color: var(--lagoon); cursor: pointer; }
table.data td .sub svg { width: 12px; height: 12px; stroke: currentColor; vertical-align: -1px; }
.box-no { display: inline-block; min-width: 26px; margin-right: 6px; padding: 0 5px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line-soft); font: 600 11px/17px var(--mono, ui-monospace, monospace); color: var(--ink-2); text-align: center; }
.paper-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.field.is-edited .input, .field.is-edited .select { border-color: var(--sun); box-shadow: 0 0 0 1px var(--sun) inset; background: #FFFCF2; }
.edited { font-size: 11px; font-weight: 600; color: #7A6413; background: var(--gold-tint); border-radius: 4px; padding: 0 5px; cursor: help; }
table.lines-edit td { padding: 6px 6px; }
table.lines-edit th { padding: 8px 6px; white-space: normal; min-width: 64px; }
table.lines-edit th .sub { font-weight: 400; max-width: 120px; }
table.lines-edit .input.sm { height: 30px; font-size: 12.5px; width: 100%; min-width: 58px; padding: 0 6px; }
.save-bar { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: 0 -4px 16px rgba(20, 32, 54, .08); z-index: 5; }
.h1-sub { font-size: 16px; font-weight: 500; margin-left: 6px; }
ul.plain { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
ol.steps { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.linkish { border: 0; background: none; padding: 0; color: var(--lagoon); font: inherit; text-decoration: underline; cursor: pointer; }
.paper-top { margin-bottom: 18px; }
.paper-top .list-row strong.num { font-variant-numeric: tabular-nums; }
.field-label { display: flex; align-items: flex-start; gap: 0; line-height: 1.35; }
.field-label .box-no { flex: none; margin-top: -1px; }
table.lines-edit .input.sm.w-date { min-width: 96px; }
table.lines-edit .input.sm.w-wide { min-width: 120px; }
.paper-top .panel-body p { margin: 0; }

/* ---------- assistant ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.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-welcome, .ai-setup { margin: auto; max-width: 820px; 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: inherit; font-size: 13px; color: var(--ink); line-height: 1.4; text-align: left; 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: inherit; 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%; }
}

/* ---------- dashboard ---------- */
.dash .head-actions .select { width: auto; max-width: 260px; }
.dash .head-actions .input[type=month] { width: 160px; }
.dash-take { margin: 0 0 14px; font-size: 15px; color: var(--ink-2); max-width: 90ch; }
.dash-take b { color: var(--ink); font-weight: 650; }
.dash-kpis .stat .value { font-size: 26px; }
.dash-chg { display: block; font-size: 12px; font-variant-numeric: tabular-nums; margin: 2px 0; }
.dash-chg.good { color: var(--ok-fg); } .dash-chg.bad { color: var(--deny-fg); }
.dash-chg .muted { font-weight: 400; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 18px; margin-bottom: 18px; align-items: stretch; }
.dash-section { margin-bottom: 18px; }
.dash .panel-body { position: relative; }
.dash-chart { min-height: 230px; }
.dash-chart svg { display: block; overflow: visible; }
.dash-chart .grid { stroke: var(--line-soft); stroke-width: 1; }
.dash-chart .tick { font-size: 11px; fill: var(--muted); font-family: var(--font); }
.dash-chart .end { font-size: 12px; font-weight: 600; font-family: var(--font); }
.dash-chart .hit { fill: transparent; }
.dash-chart .rule { stroke: var(--muted); stroke-width: 1; }
.dash-chart polyline { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dash-chart rect.s-ok, .sw.s-ok { fill: var(--c-ok); background: var(--c-ok); }
.dash-chart rect.s-wait, .sw.s-wait { fill: var(--c-pending); background: var(--c-pending); }
.dash-chart rect.s-deny, .sw.s-deny { fill: var(--c-deny); background: var(--c-deny); }
.dash-chart rect.s-held, .sw.s-held { fill: var(--c-partial); background: var(--c-partial); }
.dash-chart rect.s-paper, .sw.s-paper { fill: var(--sun-deep); background: var(--sun-deep); }
.dash-chart polyline.s-line-a, .dash-chart .dot.s-line-a { stroke: var(--lagoon); } .dash-chart text.s-line-a, .dash-chart .dot.s-line-a, .sw.s-line-a { fill: var(--lagoon); background: var(--lagoon); }
.dash-chart polyline.s-line-b { stroke: var(--c-ok); } .dash-chart text.s-line-b, .dash-chart .dot.s-line-b, .sw.s-line-b { fill: var(--c-ok); background: var(--c-ok); }
.dash-chart .dot { stroke: var(--surface); stroke-width: 2; }
.dash-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.dash-tip { position: absolute; z-index: 3; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); box-shadow: 0 4px 16px rgba(16, 43, 70, .14); padding: 7px 10px; font-size: 12px; white-space: nowrap; }
.dash-tip .t { color: var(--muted); margin-bottom: 3px; }
.dash-tip div { display: flex; align-items: center; gap: 2px; }
.dash-tip b { margin-left: auto; padding-left: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dash-bars { display: flex; flex-direction: column; gap: 12px; }
.dash-bar-top { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.dash-bar-top > span:last-child { white-space: nowrap; }
.dash-track { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 4px; }
.dash-track i { display: block; height: 100%; border-radius: 4px; }
.dash-tag { margin-right: 8px; font-size: 11px; padding: 0 7px; }
.dash-foot { margin: 4px 0 0; max-width: 100ch; }
.dash-note { margin: -6px 0 12px; }
.dash table.data { min-width: 720px; }
.dash-more { border-top: 1px solid var(--line-soft); padding: 10px 18px; }

/* ---------- radiology and lab results ---------- */
.res .stats .value.bad { color: var(--deny-fg); }
.res .stats .value.warn { color: var(--warn-fg); }
.res .head-actions .select { width: auto; max-width: 260px; }
.res .toolbar .input[type=search] { width: 260px; max-width: 100%; height: 32px; }
.res-tabs { margin: 0; padding: 0 12px; }
.badge.quiet { background: var(--surface-2); color: var(--ink-2); }
.res-table td { vertical-align: middle; }
.res-name { font-weight: 600; }
.res-unread .res-name::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--lagoon); margin-right: 7px; vertical-align: 1px; }
table.data tr.res-crit td:first-child { box-shadow: inset 3px 0 0 var(--c-deny); }
.bad-text { color: var(--deny-fg); font-weight: 600; }
.res-top { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.res-back { font-weight: 600; font-size: 13px; }
.res-head { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.res-title { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.res-title h1 { margin: 0 6px 0 0; font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
.res-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 24px; font-size: 13px; }
.res-k { font-size: 12px; color: var(--muted); }
.res-v { font-weight: 600; }
.res-grid .sub { font-size: 12px; color: var(--muted); }
.res-alert { display: flex; gap: 10px; align-items: flex-start; border-radius: var(--radius); padding: 11px 14px; font-size: 13px; }
.res-alert svg { width: 18px; height: 18px; stroke: currentColor; flex: none; margin-top: 1px; }
.res-alert.bad { background: var(--deny-bg); color: #7A2117; }
.res-alert.ok { background: var(--ok-bg); color: var(--ok-fg); }
.res-alert.warn { background: var(--warn-bg); color: var(--warn-fg); }
.res-alert.info { background: var(--info-bg); color: var(--info-fg); margin-bottom: 14px; }
.res-cols { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; margin-bottom: 18px; }
.res-col { flex: 1 1 460px; min-width: 0; }
.res > section.panel { margin-bottom: 18px; }
.res-report { display: flex; flex-direction: column; gap: 14px; }
.res-sec h3 { margin: 0 0 3px; font-size: 11.5px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.res-sec p { margin: 0; white-space: pre-line; line-height: 1.55; }
.res-sec.impression p { font-weight: 600; }
.res-note { background: var(--deny-bg); color: #7A2117; border-radius: var(--radius); padding: 10px 14px; font-size: 13px; }
.res-note p { margin: 0; }
.res-sign { border-top: 1px solid var(--line-soft); padding-top: 10px; font-size: 12px; color: var(--muted); }
.res-viewer { display: flex; align-items: center; gap: 14px; border-radius: var(--radius); background: #0B1D30; color: #fff; padding: 18px; text-decoration: none; }
.res-viewer:hover { text-decoration: none; color: #fff; background: #102B46; outline: 2px solid var(--sun); }
.res-viewer strong { display: block; font-size: 14px; }
.res-viewer .sub { display: block; color: #B3C1D0; font-size: 12.5px; margin-top: 2px; }
.res-viewer-ic { width: 46px; height: 46px; border-radius: 10px; background: #18395A; display: grid; place-items: center; flex: none; }
.res-viewer-ic svg { width: 26px; height: 26px; stroke: var(--sun); }
.res-viewer-go { margin-left: auto; }
.res-viewer-go svg { width: 18px; height: 18px; stroke: #B3C1D0; }
.res-noimg { display: flex; gap: 10px; background: var(--warn-bg); color: var(--warn-fg); border-radius: var(--radius); padding: 12px 14px; }
.res-noimg svg { width: 18px; height: 18px; stroke: currentColor; flex: none; }
.res-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; margin: 14px 0 0; font-size: 12.5px; }
.res-dl dt { color: var(--muted); }
.res-dl dd { margin: 0; overflow-wrap: anywhere; }
.res .panel-head .btn svg { width: 14px; height: 14px; }
table.data.res-lab tr.res-crit td { background: #FDF1EF; }
table.data.res-lab tr.res-abn td { background: #FFF8F1; }
.res-val { font-weight: 650; font-variant-numeric: tabular-nums; }
.res-raw summary { cursor: pointer; padding: 12px 18px; font-size: 13px; color: var(--lagoon); }
.res-raw pre { margin: 0 18px 18px; }
.res-trail { list-style: none; margin: 0; padding: 16px 18px 4px; display: flex; flex-direction: column; gap: 12px; font-size: 13px; }
.res-trail li { display: grid; grid-template-columns: 12px minmax(0, 1fr); column-gap: 10px; }
.res-trail li::before { content: ''; width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; background: var(--c-pending); grid-row: span 2; }
.res-trail li.ok::before { background: var(--c-ok); } .res-trail li.bad::before { background: var(--c-deny); }
.res-trail span { color: var(--muted); font-size: 12px; }
.res-ack { margin-bottom: 18px; }
.res-ack h2 { margin: 0 0 4px; font-size: 16px; }
.res-ack form { display: flex; flex-direction: column; gap: 10px; border-color: #EBC3BE; }
@media print {
  .sidebar, .res-top .head-actions, .res-raw, .res-ack { display: none !important; }
  .res-viewer { display: none; }
}
.sim-hl7-intro { margin-top: 0; }
.sim-hl7 { margin-bottom: 18px; }
.sim-hl7 .scenario-grid { margin-bottom: 14px; }
.hl7-editor { border-top: 1px solid var(--line-soft); margin-top: 18px; padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.hl7-editor-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-end; }
.hl7-editor-head h3 { margin: 0; font-size: 15px; }
.hl7-editor-head p { margin: 3px 0 0; max-width: 80ch; }
.hl7-editor .textarea { min-height: 280px; height: auto; padding: 10px 12px; white-space: pre; overflow: auto; line-height: 1.6; resize: vertical; }
.hl7-editor-foot { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.check-row { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; }
.check-row input { width: 16px; height: 16px; accent-color: var(--lagoon); }
.hl7-out-title { margin: 6px 0 0; font-size: 13px; color: var(--muted); font-weight: 600; }
.hl7-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.hl7-card.bad { border-color: #EBC3BE; background: #FFFBFA; }
.hl7-card-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hl7-card-head .btn { margin-left: auto; }
.hl7-problems { margin: 0; padding-left: 18px; color: var(--deny-fg); font-size: 13px; }
.hl7-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 0; font-size: 12.5px; }
.hl7-dl dt { color: var(--muted); }
.hl7-dl dd { margin: 0; overflow-wrap: anywhere; }
.hl7-values td, .hl7-values th { padding: 6px 10px; }
pre.code.hl7-ack { max-height: 160px; font-size: 11.5px; padding: 10px 12px; }

/* ---------- organizations and users ---------- */
.scrim.stacked { z-index: 60; }
.drawer.stacked { z-index: 70; }
.users-toolbar { border-bottom: 1px solid var(--line-soft); }
.users-note { margin: 10px 16px 0; }
.hosp-head { margin-top: 10px; }
.tab svg { width: 15px; height: 15px; stroke: currentColor; vertical-align: -2px; margin-right: 2px; }
.mypayer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 18px; margin-bottom: 18px; align-items: start; }
.mypayer .callout { margin-bottom: 18px; }
.stats .value.warn { color: var(--warn-fg); }
.stats .value.bad { color: var(--deny-fg); }
.mypayer-upload { border-top: 1px solid var(--line-soft); }
.mypayer-upload h3 { margin: 0 0 2px; font-size: 14px; }
.mypayer-upload .input[type=file] { height: auto; padding: 6px; }

/* Lab and Radiology dashboards */
.dash-chart rect.s-normal, .sw.s-normal { fill: var(--lagoon); background: var(--lagoon); }
.dash-chart rect.s-abnormal, .sw.s-abnormal { fill: var(--c-partial); background: var(--c-partial); }
.dash-chart rect.s-critical, .sw.s-critical { fill: var(--c-deny); background: var(--c-deny); }
.dash-chart rect.s-advanced, .sw.s-advanced { fill: var(--c-partial); background: var(--c-partial); }
.dash-chart rect.s-other, .sw.s-other { fill: var(--lagoon); background: var(--lagoon); }
.rdash .dash-bar-top .num b { color: var(--ink); font-weight: 650; }
.rdash td .sub { font-size: 12px; color: var(--muted); }

.sim-batch .batch-stats { margin: 14px 0; box-shadow: none; }
.sim-batch .batch-detail { margin-top: 12px; }
.sim-batch .batch-detail summary { cursor: pointer; font-size: 13px; color: var(--muted); padding: 6px 0; }

/* ======================================================================
   SUMA PCX additions: universal claim form, claim page, remittance,
   code lists, X12 ⇄ JSON.
   ====================================================================== */
.h1-es { font-size: 17px; font-weight: 500; }
.span-all { grid-column: 1 / -1; }
.contents { display: contents; }
.small-value { font-size: 15px !important; font-family: var(--mono); letter-spacing: -.01em; }

/* Section letters A–F of the universal form */
.sec-letter { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 9px; border-radius: 6px; background: var(--sea); color: #fff; font-size: 12px; font-weight: 700; vertical-align: 1px; }

/* Universal form: fields with English, Spanish and the PCX-CLM element */
.uform { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.uform > div { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.uform .panel { margin: 0; }
.uform-side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 12px; }
.sticky { position: sticky; top: 16px; }
.uf { gap: 4px; }
.uf-label { display: grid; grid-template-columns: 1fr auto; column-gap: 8px; align-items: baseline; }
.uf-label .es { grid-column: 1; font-size: 11.5px; font-weight: 400; font-style: italic; color: var(--muted); }
.uf-label .el { grid-column: 2; grid-row: 1 / span 2; align-self: end; font-size: 10px; color: #8B98A7; white-space: nowrap; }
.req { color: var(--c-deny); font-weight: 700; }
.pair { display: grid; grid-template-columns: 64px 1fr; gap: 8px; }
.form-sec { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 14px; margin: 4px 0 0; }
.form-sec legend { padding: 0 6px; font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.check-inline { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.check-inline input { width: 16px; height: 16px; accent-color: var(--lagoon); }

.total-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--sea); color: #fff; }
.total-box .label { font-size: 12px; color: var(--sea-text); }
.total-box b { font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 52vh; overflow-y: auto; }
.check-list li { padding: 7px 9px; border-radius: var(--radius-s); font-size: 12.5px; line-height: 1.35; display: flex; gap: 8px; align-items: baseline; }
.check-list li .mono { font-size: 10.5px; flex: none; opacity: .85; }
.check-list li.bad { background: var(--deny-bg); color: var(--deny-fg); }
.check-list li.warn { background: var(--pend-bg); color: var(--pend-fg); }

/* Damage lines editor */
.line-editor td { vertical-align: top; padding-top: 8px; padding-bottom: 8px; }
.line-editor .input, .line-editor .select { height: 32px; font-size: 13px; }
.line-editor .select { min-width: 120px; }
.line-editor .line-desc { margin-top: 6px; }
.num-in { width: 84px; text-align: right; }
.unit-in { width: 58px; text-transform: uppercase; }
.line-editor input[data-k="itemCode"] { font-family: var(--mono); font-size: 12px; min-width: 130px; text-transform: uppercase; }

.doc-editor { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.doc-row-edit { display: grid; grid-template-columns: minmax(0, 1fr) 160px auto; gap: 8px; align-items: center; }
.doc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.doc-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 12.5px; background: var(--surface-2); }
.doc-chip b { font-family: var(--mono); font-size: 11px; color: var(--lagoon); }
.sup-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) minmax(0, 1fr) auto auto; gap: 8px; align-items: center; margin-bottom: 8px; }

/* Claim page */
.form-view .kv dt { color: var(--muted); font-size: 13px; }
.claim-callout { margin-bottom: 16px; }
.callout-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.total-row td { font-weight: 650; background: var(--surface-2); }
tr.adjusted td { background: #FFFBF0; }

.timeline { list-style: none; margin: 0; padding: 4px 0 0; }
.tl-item { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; position: relative; padding-bottom: 18px; }
.tl-item:not(:last-child)::before { content: ''; position: absolute; left: 13.5px; top: 28px; bottom: 2px; width: 1px; background: var(--line); }
.tl-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--info-bg); color: var(--info-fg); }
.tl-dot svg { width: 14px; height: 14px; stroke: currentColor; }
.tl-item.ok .tl-dot { background: var(--ok-bg); color: var(--ok-fg); }
.tl-item.deny .tl-dot { background: var(--deny-bg); color: var(--deny-fg); }
.tl-item.warn .tl-dot, .tl-item.pend .tl-dot { background: var(--pend-bg); color: var(--pend-fg); }
.tl-item.gold .tl-dot { background: var(--gold-tint); color: var(--sun-deep); }
.tl-title { font-weight: 650; font-size: 13.5px; }
.tl-text { font-size: 13px; color: var(--ink-2); }
.tl-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* Remittance: claimed − adjustments = paid */
.rmt-panel { margin-top: 18px; }
.rmt-summary { display: flex; flex-direction: column; gap: 10px; }
.rmt-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rmt-flow > div:not(.op) { display: flex; flex-direction: column; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); min-width: 110px; }
.rmt-flow .label { font-size: 11px; color: var(--muted); }
.rmt-flow b { font-size: 16px; font-variant-numeric: tabular-nums; }
.rmt-flow .op { font-size: 18px; color: var(--muted); font-weight: 600; }
.rmt-flow > .paid { background: var(--ok-bg) !important; border-color: #C3E2CD !important; }
.rmt-flow > .paid b { color: var(--ok-fg); }
.rmt-preview { display: flex; flex-direction: column; gap: 10px; }
.rmt-preview pre.code, .rmt-preview pre { max-height: 260px; overflow: auto; }
.pay-table .input { height: 30px; width: 96px; text-align: right; }

/* Users and directory forms */
.org-sub, .org-ins { grid-column: 1 / -1; }

/* Code lists */
.codes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.codes-grid .panel { margin: 0; }
.codes-table td:first-child { width: 90px; white-space: nowrap; }

/* X12 ⇄ JSON */
.convert-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 12px; }
.convert-grid .panel { margin: 0; }
.convert-box { width: 100%; min-height: 460px; font-size: 12px; line-height: 1.5; white-space: pre; }
.x12-in { min-height: 160px; font-size: 12px; }

.audit-detail { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 1100px) {
  .uform, .convert-grid { grid-template-columns: 1fr; }
  .uform-side { position: static; }
}
.form-view .kv { grid-template-columns: 170px minmax(0, 1fr); }
.form-view .kv dd { text-align: left; }
.line-editor .select { min-width: 0; width: 150px; }
.line-editor input[data-k="itemCode"], .line-editor .line-desc { min-width: 0; width: 150px; }
.line-editor th, .line-editor td { padding-left: 6px; padding-right: 6px; }
.line-editor { font-size: 12.5px; }
.line-editor th { font-size: 11px; white-space: normal; line-height: 1.25; }
.line-editor .select[data-k="category"] { width: 112px; }
.line-editor .select[data-k="room"] { width: 96px; }
.line-editor input[data-k="itemCode"], .line-editor .line-desc { width: 128px; }
.line-editor .num-in { width: 72px; padding-left: 6px; padding-right: 6px; }
.line-editor .unit-in { width: 50px; padding-left: 6px; padding-right: 6px; }
.table-wrap { overflow-x: auto; }
table.data.line-editor th { font-size: 11px; white-space: normal; line-height: 1.25; padding: 8px 6px; }
table.data.line-editor td { padding: 8px 6px; }
table.data.line-editor td:first-child, table.data.line-editor th:first-child { padding-left: 14px; }
