/* SubOps console design system. One stylesheet for every admin and partner page.
   Sections: tokens · base · shell · page · controls · data · overlays · features · responsive */

/* ---------- tokens ---------- */
:root {
  --bg: #f5f6f8; --panel: #fff; --sunken: #f3f4f6; --hover: #f0f2f4;
  --ink: #14181f; --ink-2: #3b424d; --muted: #68707d; --faint: #9aa1ac;
  --line: #e3e6ea; --line-strong: #cfd4da;
  --accent: #1c5b5a; --accent-hover: #164948; --accent-soft: #e6f2f0; --accent-ink: #14494a;
  --good: #137a3f; --good-bg: #e6f5ec; --bad: #c2281d; --bad-bg: #fdecea;
  --warn: #8a5a06; --warn-bg: #fcf1d8; --info: #1d5fae; --info-bg: #e7f0fb;
  --r: 12px; --r-sm: 8px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-2: 0 8px 28px rgba(16, 24, 40, .12);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.55;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; overflow-wrap: anywhere; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h1 { font-size: 1.5rem; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 650; }
p { margin: 0 0 10px; }
code { font-family: var(--mono); font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::placeholder { color: var(--faint); opacity: 1; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.skip { position: fixed; top: -100px; left: 16px; background: var(--panel); padding: 10px 14px; z-index: 50; border: 2px solid var(--accent); border-radius: var(--r-sm); }
.skip:focus { top: 12px; }
.sub { color: var(--muted); font-size: .86rem; }
.hint, .field-note { color: var(--muted); font-size: .86rem; margin: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.wrap { max-width: 300px; overflow-wrap: anywhere; }
.positive { color: var(--good); } .negative, .neg { color: var(--bad); }
.mono { font-family: var(--mono); }
.spacer { flex: 1; }
.gap-top { margin-top: 12px; }
.flush { margin-bottom: 0; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: 236px; flex: none; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px 12px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand small { display: block; font-size: .78rem; color: var(--muted); margin-top: 2px; }
.mark { display: block; flex: none; width: 36px; height: auto; }
.wordmark { display: block; height: 14px; aspect-ratio: 837/162; background: var(--ink);
  -webkit-mask: url(logo-wordmark.png) left center/contain no-repeat; mask: url(logo-wordmark.png) left center/contain no-repeat; }
.env-badge { margin-left: auto; font-size: .68rem; font-weight: 650; letter-spacing: .04em; padding: 2px 7px; border-radius: 6px; background: var(--sunken); color: var(--muted); }
.env-badge.prod { background: var(--accent-soft); color: var(--accent); }
.side nav { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; scrollbar-color: #d8dce1 transparent; }
.nav-group { display: flex; flex-direction: column; gap: 1px; margin-bottom: 10px; }
.nav-label { padding: 0 10px 6px; font-size: .74rem; font-weight: 600; color: var(--faint); letter-spacing: .04em; }
.side nav a { display: flex; align-items: center; gap: 10px; min-height: 33px; padding: 5px 10px; border-radius: var(--r-sm); color: var(--ink-2); font-size: .96rem; }
.side nav a .ico { color: var(--faint); }
.side nav a:hover { background: var(--hover); text-decoration: none; }
.side nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side nav a.on .ico { color: var(--accent); }
.who { display: flex; align-items: center; gap: 10px; padding: 12px 6px 0; border-top: 1px solid var(--line); }
.who form { margin: 0; }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.who-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.who-name small { display: block; color: var(--muted); font-size: .76rem; font-weight: 400; }
.main { flex: 1; min-width: 0; padding: 28px 36px 40px; }
.main > * { max-width: 1480px; }

/* ---------- page ---------- */
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.top p { margin: 4px 0 0; color: var(--muted); }
.top-actions, .header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.crumb { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .9rem; margin-bottom: 8px; }
.crumb .ico { width: 15px; height: 15px; }
.task-tabs { display: flex; gap: 4px; margin: 0 0 20px; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.task-tabs::-webkit-scrollbar { display: none; }
.task-tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.task-tabs a:hover { color: var(--ink); text-decoration: none; }
.task-tabs a[aria-current=page] { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.task-tabs .count { margin-left: 6px; font-size: .78rem; padding: 0 6px; border-radius: 999px; background: var(--sunken); color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin: 0 0 16px; box-shadow: var(--shadow-1); }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: .9rem; }
.panel-head .top-actions { margin-left: auto; }
.table-panel { padding: 0; overflow: hidden; }
.table-panel > .panel-head, .table-panel > .filters, .table-panel > .hint, .table-panel > h2 { margin: 0; padding: 16px 20px; }
.table-panel > .panel-head + .filters { padding-top: 0; }
.table-panel > .table { border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.table-panel > .pager { padding: 10px 20px; border-top: 1px solid var(--line); margin: 0; }
.table-panel > .hint { border-top: 1px solid var(--line); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.grid2 > .panel { margin: 0; }
.grid2 { margin-bottom: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow-1); min-width: 0; }
.stat > span { display: block; color: var(--muted); font-size: .88rem; }
.stat b { display: block; font-size: 1.55rem; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em; margin-top: 4px; overflow-wrap: anywhere; }
.stat small { display: block; color: var(--muted); font-size: .8rem; margin-top: 4px; }
.stat .inline-unit { display: inline; margin-left: 4px; font-size: .85rem; font-weight: 400; }
.stat.accent { background: linear-gradient(135deg, #e9f4f2, #f4f1fb); border-color: #d5e6e3; }
.alert { display: block; padding: 10px 14px; border-radius: var(--r-sm); margin: 0 0 16px; border: 1px solid transparent; }
.alert.ok { background: var(--good-bg); color: var(--good); border-color: #c5e6d1; }
.alert.err { background: var(--bad-bg); color: var(--bad); border-color: #f5cdc8; }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: #f0dfb4; }
.alert.info { background: var(--info-bg); color: var(--info); border-color: #cddff5; }
.alert a { color: inherit; text-decoration: underline; }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }
.empty-state { text-align: center; padding: 40px 16px; }
.empty-state h3 { font-size: 1rem; }
.empty-state p { color: var(--muted); margin: 6px 0 14px; }
.empty-symbol { display: grid; place-items: center; width: 40px; height: 40px; margin: 0 auto 12px; border-radius: 12px; color: var(--accent); background: var(--accent-soft); font-size: 1.3rem; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: flex-end; padding: 12px 0; color: var(--muted); }
.page-footer { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 32px; font-size: .78rem; color: var(--faint); }

/* ---------- controls ---------- */
label { display: flex; flex-direction: column; gap: 5px; color: var(--ink-2); font-size: .9rem; font-weight: 500; }
label small { color: var(--muted); font-weight: 400; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--ink); padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: #fff; min-height: 36px; max-width: 100%; }
textarea { width: 100%; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #b4bac3; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input[type=checkbox], input[type=radio] { min-height: 0; width: 16px; height: 16px; padding: 0; accent-color: var(--accent); flex: none; }
input:disabled, input[readonly] { background: var(--sunken); color: var(--ink-2); }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 500; min-height: 36px; padding: 6px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, border-color .12s, color .12s; touch-action: manipulation; }
button:hover, .btn:hover { background: var(--hover); text-decoration: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover, .btn.primary:hover { background: var(--accent-hover); }
button.danger, .btn.danger { color: var(--bad); border-color: #eab8b2; }
button.danger:hover { background: var(--bad-bg); }
button.ghost, .btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
button.ghost:hover, .btn.ghost:hover { background: var(--hover); }
button.sm, .btn.sm { min-height: 30px; padding: 3px 10px; font-size: .88rem; border-radius: 7px; }
button.wide { width: 100%; min-height: 42px; }
button.link { border: 0; background: none; padding: 0; min-height: 0; color: var(--accent); }
.icon-btn { min-height: 32px; width: 32px; padding: 0; border-color: transparent; background: transparent; color: var(--muted); }
.icon-btn:hover { color: var(--ink); }
.btn .ico, button .ico { width: 16px; height: 16px; }
.form { display: flex; flex-direction: column; gap: 14px; max-width: 520px; }
.form.inline { flex-direction: row; flex-wrap: wrap; align-items: flex-end; max-width: none; }
.form button { align-self: flex-start; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px 16px; align-items: end; }
.form-grid input:not([type=checkbox]), .form-grid select { width: 100%; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
fieldset { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px 16px 16px; margin: 0 0 14px; min-width: 0; }
legend { padding: 0 6px; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.filters label { min-width: 150px; }
.filters .grow { flex: 1 1 220px; }
.filters .grow input { width: 100%; }
.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; color: var(--ink); cursor: pointer; }
.mini { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mini form { margin: 0; }
.row-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: nowrap; }
.row-actions form { margin: 0; }
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--sunken); border-radius: 9px; flex-wrap: wrap; }
.seg button, .seg a { border: 0; background: transparent; min-height: 28px; padding: 2px 12px; border-radius: 7px; color: var(--ink-2); font-size: .9rem; display: inline-flex; align-items: center; }
.seg a:hover { text-decoration: none; color: var(--ink); }
.seg button.on, .seg a.on, .seg a[aria-current=page] { background: #fff; color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); }
/* checkbox switch (inside forms that are saved in bulk) */
.switch { display: inline-block; position: relative; width: 36px; height: 20px; cursor: pointer; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: #cfd4da; transition: background .12s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .12s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
/* one-click toggle (submits immediately) */
.toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 28px; padding: 0; border: 0; background: none; color: var(--ink-2); font-size: .88rem; }
.toggle:hover { background: none; }
.toggle::before { content: ""; width: 34px; height: 20px; border-radius: 999px; background: #cfd4da; transition: background .12s; flex: none;
  background-image: radial-gradient(circle at 10px 10px, #fff 7.5px, transparent 8px); }
.toggle[aria-checked=true]::before { background-color: var(--accent); background-image: radial-gradient(circle at 24px 10px, #fff 7.5px, transparent 8px); }
.toggle[aria-checked=true] { color: var(--ink); }
.stepper { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; background: #fff; }
.stepper input { flex: 1; min-width: 0; border: 0; border-radius: 0; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { appearance: none; }
.stepper button { flex: none; width: 38px; padding: 0; border: 0; border-left: 1px solid var(--line); border-radius: 0; font-size: 1.05rem; }
.price-input { width: 104px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- data ---------- */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; font-size: .82rem; font-weight: 500; white-space: nowrap; background: var(--sunken); color: var(--ink-2); }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.tag.plain::before { display: none; }
.tag.good { background: var(--good-bg); color: var(--good); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.info { background: var(--info-bg); color: var(--info); }
.tag.muted { background: var(--sunken); color: var(--muted); }
.table { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overscroll-behavior-x: contain; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-weight: 600; color: var(--muted); font-size: .82rem; white-space: nowrap; background: #fafbfc; }
td { font-size: .93rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbfc; }
td b { font-weight: 600; }
td a:not(.btn) { font-weight: 500; }
td form { margin: 0; }
.cell-main { font-weight: 600; color: var(--ink); }
.cdk-code { font-family: var(--mono); overflow-wrap: anywhere; user-select: all; }
.facts, .provider-facts { margin: 0; }
.provider-facts > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.provider-facts > div:last-child { border: 0; }
.provider-facts dt { color: var(--muted); }
.provider-facts dd { margin: 0; text-align: right; overflow-wrap: anywhere; max-width: 65%; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px 20px; margin: 0; }
.kv dt { color: var(--muted); font-size: .84rem; }
.kv dd { margin: 2px 0 0; font-weight: 550; overflow-wrap: anywhere; }
.service-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.service-row:last-child { border: 0; }
.service-row small { display: block; color: var(--muted); font-size: .84rem; }
.json-view, pre.code { white-space: pre-wrap; overflow-wrap: anywhere; font: .86rem/1.6 var(--mono); background: #0f1720; color: #e2e8f0; padding: 14px 16px; border-radius: var(--r-sm); margin: 0; }
.code-block { position: relative; margin: 10px 0 14px; }
.code-block > button { position: absolute; top: 8px; right: 8px; background: #1e293b; border-color: #334155; color: #cbd5e1; }
.code-block > button:hover { background: #334155; }
.eyebrow { display: block; color: var(--accent); font-size: .74rem; letter-spacing: .08em; font-weight: 650; margin-bottom: 8px; }

/* ---------- overlays ---------- */
dialog.action-dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100% - 32px)); max-height: 88dvh; color: var(--ink); background: var(--panel); box-shadow: var(--shadow-2); overscroll-behavior: contain; }
dialog.action-dialog.wide { width: min(760px, calc(100% - 32px)); }
dialog.action-dialog::backdrop { background: rgba(15, 23, 32, .45); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.dialog-head h2 { overflow-wrap: anywhere; }
.dialog-body { padding: 20px; display: grid; gap: 14px; }
.dialog-body .form, .dialog-body form { max-width: none; }
.dialog-body input:not([type=checkbox]):not([type=radio]), .dialog-body select { width: 100%; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 6px; }
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 1px solid var(--line-strong); border-radius: 7px; color: var(--ink-2); background: #fff; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary:hover { background: var(--hover); }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 168px; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-2); display: grid; gap: 1px; }
.menu-list a, .menu-list button { display: flex; justify-content: flex-start; width: 100%; min-height: 32px; padding: 5px 10px; border: 0; border-radius: 6px; background: none; color: var(--ink); font-weight: 400; font-size: .92rem; }
.menu-list a:hover, .menu-list button:hover { background: var(--hover); text-decoration: none; }
.menu-list .danger { color: var(--bad); }
.menu-list hr { margin: 4px 0; }
details.fold { border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); margin-bottom: 16px; box-shadow: var(--shadow-1); }
details.fold > summary { cursor: pointer; padding: 14px 20px; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "▸"; color: var(--muted); transition: transform .12s; }
details.fold[open] > summary::before { transform: rotate(90deg); }
details.fold > summary small { font-weight: 400; color: var(--muted); }
details.fold > .fold-body { padding: 4px 20px 20px; }
.savebar { position: sticky; bottom: 12px; z-index: 5; display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-2); }
.savebar > span { flex: 1; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 60; padding: 8px 16px; border-radius: 999px; background: #14181f; color: #fff; font-size: .9rem; box-shadow: var(--shadow-2); }

/* ---------- features ---------- */
/* copyable credential fields */
.copy-field { display: flex; align-items: stretch; gap: 0; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--sunken); overflow: hidden; }
.copy-field input { flex: 1; min-width: 0; border: 0; border-radius: 0; background: transparent; font-family: var(--mono); font-size: .92rem; }
.copy-field button, .copy-field .btn { border: 0; border-left: 1px solid var(--line-strong); border-radius: 0; background: #fff; }
.copy-field form { display: flex; margin: 0; }
.cred { display: grid; gap: 16px; }
.cred-row { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px 16px; align-items: center; }
.cred-row > span:first-child { color: var(--muted); font-size: .9rem; }
.cred-row .field-note { grid-column: 2; }
/* pricing table */
.tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.tools .filters { margin: 0; flex: 1 1 320px; }
.bulk { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bulk #bulk-value { width: 96px; }
.price-table { min-width: 980px; }
.price-table td { vertical-align: top; }
.price-row.is-dirty td { background: #f4faf8; }
.cost-auto { font-weight: 600; font-variant-numeric: tabular-nums; }
.cost-cell .price-input { margin-top: 6px; }
.route-line { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; padding: 0 8px; border-radius: 6px; background: var(--sunken); color: var(--ink-2); font-size: .82rem; line-height: 1.7; white-space: nowrap; }
.chip.accent { background: var(--accent-soft); color: var(--accent-ink); }
.rank { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 6px; background: var(--sunken); color: var(--muted); font-size: .82rem; font-weight: 600; }
.rank.first { background: var(--accent); color: #fff; }
tr.is-off td { color: var(--faint); }
tr.is-off .cell-main { color: var(--muted); }
/* step flow (funding pipeline, BIN selection) */
.flow { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0 0 4px; counter-reset: flow; }
.flow li { counter-increment: flow; flex: 1 1 150px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fafbfc; font-size: .88rem; color: var(--ink-2); }
.flow li::before { content: counter(flow); display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 6px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .74rem; font-weight: 650; }
.flow li b { color: var(--ink); }
.flow li small { display: block; color: var(--muted); margin-top: 4px; }
/* generate */
.gen { display: grid; grid-template-columns: minmax(0, 1fr) clamp(320px, 26vw, 420px); gap: 16px; align-items: start; }
.gen .panel { margin: 0; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.plan-grid .empty-state { grid-column: 1 / -1; }
.plan { position: relative; display: block; border: 1px solid var(--line); border-radius: var(--r); padding: 14px; background: #fff; cursor: pointer; font-weight: 400; color: inherit; transition: border-color .12s, box-shadow .12s; }
.plan:hover { border-color: #b4bac3; }
.plan > input { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.plan:has(> input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan:has(> input:checked)::after { content: "✓"; position: absolute; top: 10px; right: 10px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .74rem; display: grid; place-items: center; }
.plan:has(> input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.plan.off { cursor: not-allowed; background: #fafbfc; }
.plan.off > :not(input) { opacity: .6; }
.plan p { margin: 8px 0 0; padding-top: 8px; border-top: 1px dashed var(--line); color: var(--muted); font-size: .84rem; }
.pill { display: inline-block; white-space: nowrap; padding: 1px 10px; border-radius: 999px; font-size: .84rem; font-weight: 600; background: #e3f5ef; color: #0b7a5e; }
.price { margin-top: 8px; font-size: 1.3rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.price small { font-size: .8rem; font-weight: 400; color: var(--muted); margin-left: 2px; }
.closed { margin-top: 8px; color: var(--muted); line-height: 1.95rem; }
.side-form { position: sticky; top: 18px; display: flex; flex-direction: column; gap: 14px; }
.side-form input, .side-form select { width: 100%; }
.chosen { display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.sum { margin: 0; padding: 12px 14px; border-radius: var(--r-sm); background: var(--sunken); }
.sum div { display: flex; justify-content: space-between; padding: 3px 0; font-size: .92rem; }
.sum dt { color: var(--muted); }
.sum dd { margin: 0; font-variant-numeric: tabular-nums; }
.sum .total { margin: 6px 0; padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sum .total dt { color: var(--ink); font-weight: 600; }
.sum .total dd { font-size: 1.15rem; font-weight: 650; }
#batch-codes { display: block; width: 100%; height: 280px; font: .92rem/1.8 var(--mono); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px; background: var(--sunken); }
.action-page { max-width: 880px; }
/* rates */
.fx-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 16px 0; }
.fx-item { background: #fafbfc; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px 16px; }
.fx-item span, .fx-item small { display: block; color: var(--muted); font-size: .84rem; }
.fx-item b { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; margin: 4px 0; }
.cost-breakdown { max-width: 720px; margin-top: 20px; }
.bin-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; min-width: 480px; }
.bin-inline label { font-size: .8rem; }
.bin-inline .check { align-self: flex-end; min-height: 36px; }
.bin-inline input:not([type=checkbox]) { width: 86px; }
/* overview */
.overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.overview-grid > .panel { margin: 0; }
.upstream-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.section-title { margin: 22px 0 10px; }
/* exchange wizard */
.exchange-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0; margin: 0 0 24px; list-style: none; gap: 10px; }
.exchange-steps li { border-bottom: 2px solid var(--line); padding: 8px 0; color: var(--muted); font-size: .9rem; }
.exchange-steps li[aria-current=step] { color: var(--accent); border-color: var(--accent); font-weight: 650; }
.exchange-layout { display: grid; grid-template-columns: minmax(240px, .7fr) minmax(0, 1.3fr); gap: 36px; max-width: 1100px; }
.exchange-guide { padding: 20px 0; }
.exchange-guide h2 { font-size: clamp(1.5rem, 2.2vw, 2.1rem); line-height: 1.35; }
.exchange-guide > p, .exchange-guide li p { color: var(--muted); }
.exchange-guide ol { padding-left: 20px; margin: 24px 0; }
.exchange-guide li p { margin: 4px 0 14px; }
.exchange-form { padding: 28px; }
.exchange-form .form { max-width: none; }
.exchange-form h2 { font-size: 1.3rem; margin-bottom: 10px; }
.exchange-form input:not([type=checkbox]) { width: 100%; }
.exchange-form textarea { font-family: var(--mono); min-height: 160px; }
.exchange-form .check { align-items: flex-start; }
.exchange-form #exchange-feedback:empty { display: none; }
.exchange-product { padding: 12px 14px; background: var(--accent-soft); color: var(--accent-ink); border-radius: var(--r-sm); }
/* login */
.center { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; gap: 12px; background: linear-gradient(135deg, #e9f4f2 0%, #f1eefb 60%, #fbeef4 100%); }
.center .alert { max-width: 380px; width: 100%; }
.login { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; padding: 28px; box-shadow: var(--shadow-2); }
.login .brand { padding: 0 0 4px; }
.login h1 { font-size: 1.25rem; }
.login input { width: 100%; }

/* product tiers: one accent per tier, overridable per product (--tier-accent) */
.tier-go { --tier-accent: #64748b; }
.tier-plus { --tier-accent: #10a37f; }
.tier-pro { --tier-accent: #7c3aed; }
.tier-max { --tier-accent: #b45309; }
.tier-business { --tier-accent: #1d5fae; }
.tier-codex { --tier-accent: #ea580c; }
.tier-upgrade { --tier-accent: #4f46e5; }
.tier-half { --tier-accent: #db2777; }
.tier-custom { --tier-accent: #1c5b5a; }
[class*="tier-"] .pill, .pill[class*="tier-"] { background: color-mix(in srgb, var(--tier-accent) 13%, #fff); color: color-mix(in srgb, var(--tier-accent) 85%, #000); }
.plan[class*="tier-"] { border-top: 3px solid var(--tier-accent); }
.plan[class*="tier-"] .price { color: color-mix(in srgb, var(--tier-accent) 80%, #000); }
.plan.tier-max { background: linear-gradient(180deg, color-mix(in srgb, var(--tier-accent) 7%, #fff), #fff 60%); }
.plan.tier-pro { background: linear-gradient(180deg, color-mix(in srgb, var(--tier-accent) 5%, #fff), #fff 55%); }
.plan .badge { position: absolute; top: 12px; right: 12px; padding: 0 8px; border-radius: 6px; font-size: .76rem; font-weight: 650; line-height: 1.7; color: #fff; background: var(--tier-accent, var(--accent)); }
.plan:has(> input:checked) .badge { right: 38px; }
.plan.off .badge { display: none; }
.tier-preview { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tier-preview .plan { display: inline-block; min-width: 200px; cursor: default; }
.tier-preview .price { display: block; }

/* batch usage */
.usage { min-width: 150px; }
.usage-label { display: flex; align-items: baseline; gap: 2px; font-variant-numeric: tabular-nums; }
.usage-pct { margin-left: auto; color: var(--muted); font-size: .84rem; }
.usage-bar { display: flex; height: 6px; margin-top: 5px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.usage-bar i { display: block; width: 0; height: 100%; }
.usage-bar .ok { background: var(--good); }
.usage-bar .busy { background: var(--info); }
/* card list */
.cdk-cell { display: flex; align-items: center; gap: 4px; }
.cdk-cell .icon-btn { width: 28px; min-height: 28px; }
.note-form { margin: 0; }
.note-form input { width: 150px; min-height: 30px; padding: 4px 8px; font-size: .88rem; }
.note-form input.saved { border-color: var(--good); }
.selection-bar { border-top: 1px solid var(--line); background: #fafbfc; align-items: center; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .main { padding: 22px 20px 32px; }
  .gen { grid-template-columns: 1fr; }
  .side-form { position: static; }
  .overview-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; }
  .brand { padding-bottom: 8px; }
  .side nav { display: flex; gap: 4px; overflow-x: auto; margin: 0; padding: 0 0 4px; }
  .nav-group { flex-direction: row; margin: 0; gap: 4px; }
  .nav-label { display: none; }
  .side nav a { white-space: nowrap; min-height: 34px; background: var(--sunken); }
  .side nav a .ico { display: none; }
  .who { border: 0; padding: 8px 0 0; }
  .main { padding: 16px 14px 28px; }
  h1 { font-size: 1.3rem; }
  .panel { padding: 16px; }
  .table-panel { padding: 0; }
  .table-panel > .panel-head, .table-panel > .filters, .table-panel > .hint, .table-panel > h2 { padding: 14px 16px; }
  .filters label { min-width: 0; flex: 1 1 140px; }
  .filters input, .filters select { width: 100%; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat b { font-size: 1.25rem; }
  .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exchange-layout { grid-template-columns: 1fr; gap: 0; }
  .exchange-guide ol { display: none; }
  .exchange-steps li { font-size: .76rem; }
  .cred-row { grid-template-columns: 1fr; }
  .cred-row .field-note { grid-column: 1; }
  .fx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bin-inline { min-width: 0; }
  .savebar { bottom: 8px; flex-wrap: wrap; }
}
@media (max-width: 400px) { .plan-grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
