:root {
  --ink: #15212B; --ink-2: #2E3D45; --muted: #4F5F67; --muted-2: #6B7A80;
  --ground: #F2F4F3; --surface: #FFFFFF; --surface-2: #F7F9F8;
  --line: #D8DFDE; --line-2: #E3E8E7; --input: #C7D0CF;
  --teal: #0D6863; --teal-hover: #09504C; --teal-soft: #DDEFEC; --mint: #4DB8AE; --bar: #9CC9C3;
  --dark: #0F1B22; --on-dark: #E4EBE9; --on-dark-2: #C9D3D2;
  --mcr: #A0620C; --good: #256B41; --good-bg: #E1F1E6; --bad: #9A3A27; --bad-bg: #F7E3DE; --warn-bg: #FAF0DC; --warn-ink: #5C3F0B;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --word: "Bricolage Grotesque", var(--sans);
  --radius: 10px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--ground); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--teal); }
[hidden] { display: none !important; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; }
.brand__word { font-family: var(--word); font-weight: 700; font-size: 21px; letter-spacing: -0.02em; }
.h1 { font-size: 1.6rem; line-height: 1.15; margin: 0; letter-spacing: -0.015em; text-wrap: balance; }
.h2 { font-size: 1.15rem; margin: 0; letter-spacing: -0.01em; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: .85rem; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack--tight { gap: 6px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 8px; padding: 9px 16px; font-weight: 600; font-size: .95rem; border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn--primary { background: var(--teal); color: #fff; }
.btn--primary:hover { background: var(--teal-hover); }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--input); }
.btn--ghost:hover { border-color: var(--ink-2); }
.btn--dark { background: var(--dark); color: #fff; }
.btn--sm { padding: 6px 11px; font-size: .85rem; }
.btn--block { width: 100%; padding: 11px 16px; }
.btn[disabled] { opacity: .55; cursor: default; }
.linkbtn { background: none; border: 0; color: var(--teal); cursor: pointer; padding: 0; font-weight: 600; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; min-width: 0; }
.field input, .field select, select, input[type=search], input[type=email], input[type=text] {
  font: inherit; font-size: .95rem; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--ink);
  background: var(--surface); border: 1px solid var(--input); border-radius: 8px; padding: 9px 11px; width: 100%; }
.note-box { background: var(--warn-bg); color: var(--warn-ink); border-radius: 8px; padding: 10px 12px; font-size: .85rem; margin: 0; }

/* ---- auth page ---- */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.auth__wrap { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.auth__card { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.auth__card--clerk { background: none; border: 0; padding: 0; display: flex; justify-content: center; }
.auth__foot { text-align: center; }

/* ---- app shell ---- */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top__inner { max-width: 1120px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 14px; }
.top__org { color: var(--muted); font-size: .9rem; padding-left: 14px; border-left: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--teal-soft); color: var(--teal); white-space: nowrap; }
.badge--free { background: var(--line-2); color: var(--ink-2); }
.badge--warn { background: var(--warn-bg); color: var(--warn-ink); }
.meter { display: inline-flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.meter__bar { width: 64px; height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.meter__bar i { display: block; height: 100%; background: var(--teal); }
.meter__bar i.full { background: var(--bad); }
.menu { position: relative; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--dark); color: #fff; border: 0; font-weight: 700; font-size: .85rem; cursor: pointer; }
.menu__pop { position: absolute; right: 0; top: 42px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(15,27,34,.12); min-width: 230px; padding: 6px; display: flex; flex-direction: column; }
.menu__pop .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.menu__pop button, .menu__pop a { text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; cursor: pointer; color: var(--ink); text-decoration: none; font-size: .92rem; }
.menu__pop button:hover, .menu__pop a:hover { background: var(--surface-2); }

.tabs { max-width: 1120px; margin: 0 auto; padding: 0 20px; display: flex; gap: 2px; overflow-x: auto; }
.tabs a { font-weight: 600; font-size: .95rem; color: var(--muted); text-decoration: none; padding: 10px 12px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--teal); border-bottom-color: var(--teal); }
.tabs a .lock { font-size: .72rem; margin-left: 4px; color: var(--muted-2); font-weight: 500; }

.main { max-width: 1120px; margin: 0 auto; padding: 22px 20px 64px; display: flex; flex-direction: column; gap: 16px; }
.demo { background: var(--warn-bg); color: var(--warn-ink); border-radius: 8px; padding: 9px 14px; font-size: .86rem; }

/* ---- lookup (from the prototype) ---- */
.query { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; grid-template-columns: 2fr 1.2fr; gap: 12px 16px; }
.query .row2 { grid-column: 1/-1; display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 6px 11px; cursor: pointer; font-size: .85rem; }
.seg button[aria-pressed="true"] { background: var(--teal-soft); color: var(--teal); font-weight: 600; }
.seglbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin-right: 6px; }
.segwrap { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.ref { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ref div { background: var(--surface); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ref .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.ref .v { font-family: var(--mono); font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.ref .n { font-size: .8rem; color: var(--muted); }
.ref .v.mcr { color: var(--mcr); }
.groups { display: flex; flex-direction: column; gap: 12px; }
.grp { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ghead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ghead h2 { margin: 0; font-size: 1.02rem; }
.ghead .meta { color: var(--muted); font-size: .82rem; }
.tbl { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; text-align: right; padding: 6px 14px; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
td { padding: 8px 14px; border-top: 1px solid var(--line-2); text-align: right; font-variant-numeric: tabular-nums; vertical-align: middle; }
td.num { font-family: var(--mono); font-size: .9rem; white-space: nowrap; }
td.big { font-weight: 500; font-size: .98rem; }
.lname { display: flex; flex-direction: column; gap: 2px; }
.lname small { color: var(--muted); font-size: .78rem; }
.pill { display: inline-block; font-family: var(--mono); font-size: .8rem; padding: 2px 7px; border-radius: 999px; background: var(--teal-soft); color: var(--teal); }
.pill.lo { background: transparent; color: var(--bad); border: 1px solid var(--bad); }
.pill.hi { background: transparent; color: var(--good); border: 1px solid var(--good); }
.flag { font-size: .72rem; color: var(--bad); border: 1px solid currentColor; border-radius: 4px; padding: 0 5px; margin-left: 6px; white-space: nowrap; }
.scale { position: relative; height: 16px; min-width: 150px; }
.scale .rng { position: absolute; top: 6px; height: 4px; background: var(--bar); border-radius: 2px; }
.scale .med { position: absolute; top: 2px; width: 3px; height: 12px; background: var(--teal); border-radius: 1px; }
.scale .mt { position: absolute; top: 0; width: 0; height: 16px; border-left: 2px dashed var(--mcr); }
.more { background: none; border: 0; color: var(--teal); padding: 8px 14px; cursor: pointer; text-align: left; font-size: .85rem; }
.note { font-size: .84rem; color: var(--muted); padding: 8px 14px; border-top: 1px solid var(--line-2); }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 22px; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .8rem; color: var(--muted); align-items: center; }
.legend i { display: inline-block; vertical-align: middle; margin-right: 6px; }
.lg-r { width: 24px; height: 4px; background: var(--bar); border-radius: 2px; }
.lg-m { width: 3px; height: 12px; background: var(--teal); }
.lg-t { width: 0; height: 12px; border-left: 2px dashed var(--mcr); }
.results { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.results:empty { display: none; }
.hit { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 2px 12px; text-align: left; background: none; border: 0; border-top: 1px solid var(--line-2); padding: 9px 14px; cursor: pointer; color: var(--ink); }
.hit:first-child { border-top: 0; }
.hit:hover { background: var(--teal-soft); }
.hit b { color: var(--teal); font-weight: 600; }
.hit small { color: var(--muted); font-size: .8rem; grid-column: 1/-1; }
.hit .cnt { font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.chead { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.chead h2 { margin: 0; font-size: 1.2rem; }
.chead .meta, .docs { color: var(--muted); font-size: .86rem; }
.codes { display: flex; flex-wrap: wrap; gap: 6px; }
.codes button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 5px 11px; cursor: pointer; font-size: .85rem; }
.codes button[aria-pressed="true"] { background: var(--teal-soft); color: var(--teal); border-color: var(--teal); font-weight: 600; }
.vs { font-family: var(--mono); font-size: .85rem; }
.vs.up { color: var(--good); } .vs.down { color: var(--bad); }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; }

/* ---- paywall, cards ---- */
.wall { background: var(--dark); color: var(--on-dark); border-radius: 14px; padding: 26px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.wall h2 { margin: 0; color: #fff; font-size: 1.25rem; }
.wall p { margin: 0; color: var(--on-dark-2); max-width: 60ch; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.card--current { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal) inset; }
.card--dark { background: var(--dark); color: var(--on-dark); border-color: var(--dark); }
.card--dark .muted { color: var(--on-dark-2); }
.plans { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; max-width: 760px; }
.price { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; }
.price small { font-size: .85rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.card--dark .price small { color: var(--on-dark-2); }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: .92rem; }
.checks li { padding-left: 22px; position: relative; }
.checks li::before { content: ""; position: absolute; left: 2px; top: 6px; width: 10px; height: 6px; border-left: 2px solid var(--teal); border-bottom: 2px solid var(--teal); transform: rotate(-45deg); }
.card--dark .checks li::before { border-color: var(--mint); }
.card .btn { margin-top: auto; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.list__row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.list__row:first-child { border-top: 0; }
.list__row .who { flex: 1; min-width: 180px; overflow-wrap: anywhere; }
.tag { font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--dark); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: .9rem; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,.2); max-width: calc(100vw - 32px); }

@media (max-width: 860px) {
  .plans { grid-template-columns: 1fr; }
  .top__org, .meter { display: none; }
}
@media (max-width: 700px) {
  .query { grid-template-columns: 1fr; }
  .ref { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .top__inner, .tabs, .main { padding-left: 16px; padding-right: 16px; }
  .brand__word { font-size: 19px; }
  #upgrade-btn { display: none; }
}

/* ---- rate table v2: one table, aligned columns, insurer groups ---- */
.rt-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
.rt { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.rt col.c-net { width: 31%; } .rt col.c-n { width: 11%; } .rt col.c-med { width: 10%; } .rt col.c-x { width: 12%; } .rt col.c-rng { width: 15%; } .rt col.c-scale { width: 21%; }
.rt thead th { position: sticky; top: 0; background: var(--surface-2); border-bottom: 1px solid var(--line); padding: 10px 16px; font-size: .68rem; z-index: 1; }
.rt th.l, .rt td.l { text-align: left; }
.rt td { padding: 10px 16px; border-top: 1px solid var(--line-2); }
.rt .rt-gh td { background: var(--surface); border-top: 1px solid var(--line); padding: 14px 16px 8px; }
.rt tbody:first-of-type .rt-gh td { border-top: 0; }
.rt tbody.rt-g tr:not(.rt-gh):not(.rt-more) td:first-child { padding-left: 52px; }
.rt tbody.rt-g tr:not(.rt-gh):hover td { background: #FAFCFB; }
.rt .rt-gh + tr td { border-top: 0; }
.rt .rt-more td { padding: 2px 16px 10px 44px; border-top: 0; }
.rt td.rng { color: var(--ink-2); font-size: .84rem; }
.ins { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ins b { font-size: 1rem; }
.ins .meta { color: var(--muted); font-size: .8rem; margin-left: auto; white-space: nowrap; }
.ins--row { gap: 10px; }
.ins-badge { flex: none; width: 26px; height: 26px; border-radius: 7px; color: #fff; font-weight: 700; font-size: .66rem; letter-spacing: .02em; display: inline-grid; place-items: center; vertical-align: middle; }
.rt .scale { position: relative; height: 18px; min-width: 120px; }
.rt .scale .track { position: absolute; left: 0; right: 0; top: 8px; height: 2px; background: var(--line-2); border-radius: 1px; }
.rt .scale .rng { position: absolute; top: 6px; height: 6px; background: var(--bar); border-radius: 3px; }
.rt .scale .med { position: absolute; top: 4px; width: 10px; height: 10px; margin-left: -5px; background: var(--teal); border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px var(--teal); }
.rt .scale .mt { position: absolute; top: 0; height: 18px; border-left: 2px dashed var(--mcr); }
.lg-m { width: 9px !important; height: 9px !important; border-radius: 50%; }
.ct td:first-child { min-width: 220px; }
.empty .ins-badge { width: 22px; height: 22px; font-size: .6rem; margin-right: 4px; }

/* ---- modal ---- */
.modal { position: fixed; inset: 0; background: rgba(15,27,34,.45); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal__box { background: var(--surface); border-radius: 14px; padding: 24px; width: 100%; max-width: 440px; box-shadow: 0 24px 60px rgba(15,27,34,.3); }
.ins-badge--sm { font-size: .5rem; letter-spacing: 0; }

/* clinic: add-code form, contract list, clinician view */
.addcode { display: inline-flex; gap: 6px; align-items: center; }
.addcode input { width: 7.5em; padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; font: inherit; font-size: .85rem; background: var(--surface); color: var(--ink); }
.linkbtn.small { font-size: .78rem; padding: 0; margin-top: 2px; text-align: left; }
tr.sub td { background: var(--teal-soft); padding: 6px 14px; }
.clist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .84rem; }
.clist li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; }
.clist li .muted { grid-column: 1/-1; font-size: .78rem; }

/* market: code entry */
.codebox { margin: 0; }
.codebox__row { display: flex; gap: 8px; }
.codebox__row input { font-family: var(--mono); font-size: 1.15rem !important; letter-spacing: .08em !important; text-transform: uppercase; max-width: 9em; }
.codebox__row .btn { white-space: nowrap; }
.codebox__hint { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: .84rem; color: var(--ink-2, var(--muted)); min-height: 1.2em; }
.codebox__hint.bad { color: var(--down, #9a3a27); }
.addcode input { font-family: var(--mono); text-transform: uppercase; }
.addcode input::placeholder, .codebox__row input::placeholder { text-transform: none; font-family: inherit; letter-spacing: 0; }

.query--3 { grid-template-columns: 2fr 1fr auto; align-items: start; }
@media (max-width: 760px) { .query--3 { grid-template-columns: 1fr; } }

.query--4 { grid-template-columns: 2fr 1fr auto auto; align-items: start; }
@media (max-width: 860px) { .query--4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .query--4 { grid-template-columns: 1fr; } }
/* more options */
.more-opts { flex-basis: 100%; }
.more-opts summary { cursor: pointer; font-size: .82rem; color: var(--teal); font-weight: 600; width: max-content; }
/* other plans */
.rt-sep td { background: var(--line-2, #eef1f0); color: var(--muted); font-size: .8rem; font-weight: 600; padding: 8px 14px; }
.more--others { display: block; margin: 10px 0 0; }
/* loading */
.loading { display: flex; align-items: center; gap: 10px; padding: 18px 14px; color: var(--muted); font-size: .9rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--teal); animation: spin 0.8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }
/* phone: market table keeps network, median and vs Medicare */
@media (max-width: 640px) {
  .rt { table-layout: auto; }
  .rt col { width: auto !important; }
  .rt th:nth-child(2), .rt td:nth-child(2), .rt th:nth-child(5), .rt td:nth-child(5), .rt th:nth-child(6), .rt td:nth-child(6) { display: none; }
  .rt { min-width: 0 !important; width: 100%; }
  .rt-wrap { overflow-x: auto; }
  .rt td, .rt th { padding-left: 8px; padding-right: 8px; }
  .ref { grid-template-columns: 1fr 1fr !important; }
}

/* home */
.home-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.home-tool { text-decoration: none; color: var(--ink); gap: 8px; transition: border-color .15s, box-shadow .15s; }
.home-tool:hover { border-color: var(--teal, #0D6863); box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.home-tool b { font-size: 1.05rem; }
.home-recent { width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; cursor: pointer; font: inherit; color: var(--ink); }
.home-recent:hover { background: var(--surface-2); }
.h2s { font-size: 1.05rem; margin: 0; }
.note-bar { background: var(--warn-bg, #fff7e6); color: var(--warn-ink, #6b4b00); border-radius: 10px; padding: 10px 14px; font-size: .92rem; }
@media (max-width: 760px) { .home-tools { grid-template-columns: 1fr; } }
.badge .narrow { display: none; }
@media (max-width: 480px) { .badge .wide { display: none; } .badge .narrow { display: inline; } }

/* code baskets */
.basketbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: -6px 0 14px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.basketbar .seglbl { display: inline; margin: 0; }
.basketbar select { width: auto; flex: 0 1 340px; min-width: 0; max-width: 100%; font: inherit; padding: 6px 10px; border: 1px solid var(--input); border-radius: 8px; background: var(--surface); color: var(--ink); }
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(15, 27, 34, .45); display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.modal__card { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 14px; padding: 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .4); }
.modal__card h2 { margin: 0; font-size: 1.2rem; }
.blist { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line-2); border-radius: 10px; }
.blist li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.blist li:first-child { border-top: 0; }
.blist li > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.blist small { color: var(--muted); font-family: var(--mono); font-size: .78rem; }
.bform { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; border-top: 1px solid var(--line-2); }
.bform textarea { font: inherit; font-family: var(--mono); padding: 8px 10px; border: 1px solid var(--input); border-radius: 8px; resize: vertical; }
.bform .bad, #bmsg.bad { color: var(--bad); }
.linkbtn.danger { color: var(--bad); }
.bmatrix table { width: 100%; border-collapse: collapse; }
.bmatrix th, .bmatrix td { padding: 9px 12px; border-top: 1px solid var(--line-2); text-align: right; white-space: nowrap; vertical-align: top; }
.bmatrix th:first-child, .bmatrix td:first-child { text-align: left; white-space: normal; min-width: 200px; }
.bmatrix thead th { font-size: .78rem; color: var(--muted); font-weight: 600; border-top: 0; }
.bmatrix thead .linkbtn { font-family: var(--mono); font-size: .85rem; }
.bmatrix td.num { font-family: var(--mono); font-size: .9rem; }
.bmatrix tr.bm-mcr td { background: var(--warn-bg, #FAF0DC); color: var(--mcr, #A0620C); font-weight: 600; }
.bmatrix tr.bm-mcr small { color: var(--muted); font-weight: 400; }

/* operator overview */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi span { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.kpi b { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 90px; padding-top: 10px; }
.spark i { flex: 1; background: var(--teal, #0D6863); border-radius: 2px 2px 0 0; min-width: 2px; opacity: .85; }
.spark-x { display: flex; justify-content: space-between; padding-top: 6px; }
.admt th, .admt td { padding: 9px 12px; border-top: 1px solid var(--line-2); text-align: left; white-space: nowrap; }
.admt thead th { font-size: .78rem; color: var(--muted); border-top: 0; }
.admt .r { text-align: right; font-variant-numeric: tabular-nums; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.chip--trial { background: #E4F1EF; color: #0D6863; }
.chip--paid { background: #DDF2E2; color: #1C6B32; }
.chip--ended { background: #FBEAE6; color: #A33A22; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

