/* Kiwitem (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: #f6f7f2; --panel: #fff; --sunken: #f1f3ec; --hover: #f1f5e8;
  --ink: #1f2937; --ink-2: #3f4a5a; --muted: #5d6877; --faint: #636e7c;
  --line: #e6e9e0; --line-strong: #d3d8ca;
  --accent: #497a12; --accent-hover: #3b6410; --accent-soft: #eaf4cf; --accent-ink: #3b6410;
  /* Kiwitem brand: forest action, cream on action, leaf/flesh highlights. */
  --action: #193821; --action-hover: #24492d; --on-action: #fff7e6; --leaf: #16a34a; --flesh: #a3e635;
  --good: #137a3f; --good-bg: #e6f5ec; --bad: #c2281d; --bad-bg: #fdecea;
  --warn: #8a5a06; --warn-bg: #fcf1d8; --info: #1d5fae; --info-bg: #e7f0fb;
  --r: 14px; --r-sm: 8px;
  --shadow-1: 0 2px 5px rgba(35, 42, 80, .025);
  --shadow-2: 0 16px 56px rgba(35, 42, 80, .14);
  --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.85rem; 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: 232px; flex: none; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--line); padding: 22px 14px 16px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 24px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand small { display: block; font-size: .78rem; color: var(--muted); margin-top: 2px; white-space: nowrap; }
.mark { display: block; flex: none; width: 34px; height: 34px; }
.wordmark { display: block; height: 22px; width: auto; }
.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: #e9f6f0; color: #23765a; }
.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: 2px; margin-bottom: 16px; }
.nav-label { padding: 0 12px 7px; font-size: .74rem; font-weight: 600; color: var(--faint); letter-spacing: .04em; }
.side nav a { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 7px 12px; 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; box-shadow: inset 3px 0 var(--accent); }
.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: 0 34px 36px; }
.main > * { max-width: none; }

/* ---------- page ---------- */
.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.top p { margin: 7px 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; overflow: clip; }
.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, .table-panel > .table-frame > .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 { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; box-shadow: var(--shadow-1); min-width: 0; }
.stat > span { display: block; color: var(--muted); font-size: .88rem; }
.stat b { display: block; font-size: 2rem; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.035em; margin-top: 10px; 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: #f3f9e3; border-color: #dcebb8; }
.stat.accent b { color: var(--accent-ink); }
.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: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: #fff; min-height: 40px; 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: 550; min-height: 40px; padding: 8px 15px;
  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(--action); border-color: var(--action); color: var(--on-action); box-shadow: 0 2px 4px #19382120; }
button.primary:hover, .btn.primary:hover { background: var(--action-hover); border-color: var(--action-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-topscroll { position: sticky; top: 0; z-index: 3; overflow-x: auto; overflow-y: hidden; height: 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.table-topscroll > div { height: 1px; }
.table-topscroll::-webkit-scrollbar { height: 10px; }
.table-topscroll::-webkit-scrollbar-thumb { background: #c4c9d4; border-radius: 999px; border: 2px solid var(--panel); }
.table-topscroll::-webkit-scrollbar-thumb:hover { background: #a3aab8; }
.table-topscroll[hidden] { display: none; }
.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: 14px 16px; 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: #f8f9fc; }
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: 860px; }
.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; }
.route-chain { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 26px; }
.route-chain li { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); }
.route-chain li + li::before { content: "→"; position: absolute; left: -19px; color: var(--faint); }
.route-chain li.chain-end { border-style: dashed; }
.order-cell { display: inline-flex; align-items: center; gap: 4px; }
.order-cell form { display: inline; }
.order-cell .order-no { min-width: 20px; text-align: center; }
.order-cell button { min-width: 28px; padding: 0 6px; }
.group-row td { background: var(--sunken); font-weight: 600; color: var(--ink-2); font-size: .86rem; }
.tabs-count { margin-left: 4px; color: var(--faint); font-weight: 400; }
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-group + .plan-group { margin-top: 18px; }
.plan-group h3 { margin: 0 0 10px; font-size: .9rem; font-weight: 600; color: var(--ink-2); display: flex; align-items: baseline; gap: 2px; }
.plan-off { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; }
.plan-off > summary { cursor: pointer; font-weight: 600; color: var(--ink-2); display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.plan-off > summary small { font-weight: 400; color: var(--faint); }
.plan-off[open] > summary { margin-bottom: 14px; }
.plan-off .plan { min-height: 0; padding: 14px; }
.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: radial-gradient(ellipse at 15% 15%, #e8f4c8 0, transparent 45%), radial-gradient(ellipse at 85% 85%, #fff2d6 0, transparent 45%), #f6f7f2; }
.center .alert { max-width: 380px; width: 100%; }
.login { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 20px; padding: 36px; box-shadow: var(--shadow-2); }
.login .brand { padding: 0 0 4px; }
.login h1 { font-size: 1.65rem; margin: 8px 0 2px; }
.login input { width: 100%; }
.login .captcha { display: flex; gap: 10px; align-items: center; }
.login .captcha input { flex: 1; min-width: 0; }
.login .captcha img { flex: none; height: 42px; width: 120px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #f6f8fa; }
.login .captcha-new { align-self: flex-end; margin-top: -8px; font-size: .88rem; color: var(--muted); }

/* 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; }
.tier-ios { --tier-accent: #0f766e; }
.tier-managed { --tier-accent: #9333ea; }
.tier-claude { --tier-accent: #c2410c; }
.tier-grok { --tier-accent: #111827; }
[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: 0 22px 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: 0 16px 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; } }

/* Order handling: progress steps and the current stuck point. */
.order-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.order-head h2 { margin: 0; }
.order-no { font-size: 1rem; overflow-wrap: anywhere; }
.stuck { margin: 14px 0 10px; padding: 10px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--panel); }
.stuck p { margin: 4px 0 0; }
.stuck.blocked, .stuck.failed { background: var(--warn-bg); border-color: #f0dfb4; color: var(--warn); }
.stuck.current { background: var(--info-bg); border-color: #cddff5; color: var(--info); }
.stuck.done { background: var(--good-bg); border-color: #c5e6d1; color: var(--good); }
.evidence { margin: 8px 0 12px; padding-left: 20px; color: var(--muted); font-size: .9rem; }
.steps { list-style: none; margin: 12px 0 8px; padding: 0; }
.step { position: relative; padding: 0 0 14px 26px; border-left: 2px solid var(--line); margin-left: 7px; }
.step:last-child { border-left-color: transparent; padding-bottom: 0; }
.step::before { content: ""; position: absolute; left: -8px; top: 2px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); background: var(--panel); }
.step.done::before { background: var(--good); border-color: var(--good); }
.step.current::before { background: var(--info); border-color: var(--info); }
.step.blocked::before { background: var(--warn); border-color: var(--warn); }
.step.failed::before { background: var(--bad); border-color: var(--bad); }
.step.skipped, .step.waiting { color: var(--muted); }
.step-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.step p { margin: 2px 0 0; font-size: .9rem; overflow-wrap: anywhere; }
.step.blocked p { color: var(--warn); }
.step.failed p { color: var(--bad); }
@media (prefers-reduced-motion: no-preference) { .step::before { transition: background .12s; } }

/* Holder import keeps source and row-level feedback within the current panel. */
.holder-import textarea { width:100%; box-sizing:border-box; font-family:var(--font-mono,monospace); resize:vertical; }
.holder-import .table { max-height:420px; overflow:auto; }
.holder-import td:last-child { min-width:200px; max-width:420px; white-space:normal; overflow-wrap:anywhere; }
.holder-import .field-note { overflow-wrap:anywhere; }
.holder-import input[type="file"] { max-width:100%; }

/* Workspace chrome and shared component refinements. */
.workspace-bar { display:flex; justify-content:space-between; align-items:center; gap:16px; min-height:62px; margin-bottom:28px; border-bottom:1px solid var(--line); color:var(--muted); font-size:.84rem; }
.workspace-location { display:flex; align-items:center; gap:12px; min-width:0; }
.workspace-product { font-weight:650; color:var(--ink-2); letter-spacing:.01em; }
.workspace-divider { color:#bcc3b4; }
.workspace-caption { font-size:.78rem; white-space:nowrap; }
.sidebar-toggle { display:none; }
.top-actions > [data-refresh] { background:var(--panel); border-color:var(--line); }
.task-tabs { gap:6px; padding:4px; background:#eceee6; border:0; border-radius:10px; width:fit-content; max-width:100%; }
.task-tabs a { border:0; border-radius:7px; padding:8px 15px; font-size:.9rem; }
.task-tabs a[aria-current=page] { background:var(--panel); box-shadow:0 1px 4px #1f29370c; }
.panel-head h2 { letter-spacing:-.015em; }
.panel-head p { line-height:1.65; }
.section-title { margin:26px 0 12px; font-size:.9rem; color:var(--ink-2); }
.panel > .stats { gap:0; background:var(--sunken); border:1px solid var(--line); border-radius:10px; padding:16px 0; }
.panel > .stats .stat { background:transparent; border:0; border-right:1px solid var(--line-strong); border-radius:0; padding:0 18px; box-shadow:none; }
.panel > .stats .stat:last-child { border-right:0; }
.panel > .stats .stat b { font-size:1.65rem; margin-top:7px; }
.filters { gap:12px; }
.table-panel > .filters { background:var(--panel); padding-top:20px; padding-bottom:20px; }
.table-panel > .table + .table, .table-panel > .table-frame + .table-frame { margin-top:16px; }
.table tbody tr { transition:background .12s; }
.table tbody tr:hover td { background:#f7faef; }
.tag { padding:3px 9px; font-size:.78rem; line-height:1.5; }
.chip { padding:2px 8px; }
.empty-state { padding:52px 20px; }
.empty-symbol { width:48px; height:48px; border-radius:14px; margin-bottom:16px; }
.empty-state p { max-width:440px; margin:8px auto 16px; line-height:1.7; }
.plan { padding:20px; min-height:156px; }
.plan:hover { border-color:var(--accent); box-shadow:0 4px 16px #497a120c; }
.plan:has(> input:checked) { background:#f5f9ea; }
.plan .price { margin:18px 0 8px; font-size:1.65rem; }
.side-form { padding:24px; }
.sum { padding:16px; }
.exchange-steps { gap:0; padding:14px 20px; border:1px solid var(--line); border-radius:var(--r); background:var(--panel); counter-reset:exchange; }
.exchange-steps li { counter-increment:exchange; display:flex; align-items:center; gap:8px; border-bottom:0; padding:4px 8px; }
.exchange-steps li::before { content:counter(exchange); display:inline-grid; place-items:center; flex:none; width:26px; height:26px; border-radius:50%; background:var(--sunken); color:var(--muted); font-size:.8rem; }
.exchange-steps li[aria-current=step]::before { color:#fff; background:var(--accent); }
.exchange-guide { padding:26px 12px; }
.exchange-guide > p { margin-top:14px; line-height:1.8; }
.exchange-form { box-shadow:0 8px 28px #1f293705; }
.fx-item { background:var(--panel); padding:20px; }
.fx-item b { font-size:1.8rem; letter-spacing:-.025em; }
.dialog-head { padding:20px 24px; }
.dialog-body { padding:24px; gap:18px; }
dialog.action-dialog::backdrop { background:rgba(28,32,57,.4); backdrop-filter:blur(3px); }
.login .brand { margin-bottom:2px; }
.login button.wide { min-height:46px; margin-top:4px; }
.center .alert { max-width:420px; }
@media (min-width:1600px) { .main { padding-left:44px; padding-right:44px; } }
@media (max-width:1100px) { .stat { padding:18px; } }
@media (max-width:820px) {
  .side { position:relative; padding:16px; }
  .side .brand { padding:0 96px 0 0; min-height:34px; justify-content:flex-start; }
  .side .env-badge { margin-left:6px; }
  .sidebar-toggle { display:inline-flex; position:absolute; top:17px; right:16px; min-height:34px; padding:5px 10px; font-size:.84rem; }
  .side nav { display:grid; overflow:visible; padding-top:20px; }
  .side.sidebar-ready:not([data-menu-open=true]) nav, .side.sidebar-ready:not([data-menu-open=true]) .who { display:none; }
  .side .nav-group { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:5px; margin-bottom:10px; }
  .side .nav-label { display:flex; grid-column:1/-1; padding:4px 8px; }
  .side nav a { min-height:40px; background:transparent; }
  .side nav a .ico { display:block; }
  .side .who { padding-top:14px; border-top:1px solid var(--line); }
  .workspace-bar { min-height:48px; margin-bottom:20px; gap:8px; }
  .workspace-caption { display:none; }
  .top { margin-bottom:20px; align-items:flex-start; }
  .top h1 { font-size:1.55rem; }
  .stat { padding:16px; }
  .stat b { margin-top:8px; font-size:1.6rem; }
  .stat > span { font-size:.82rem; }
  .panel > .stats { gap:16px 0; }
  .panel > .stats .stat { padding:0 12px; }
  .panel > .stats .stat:nth-child(2n) { border-right:0; }
  .panel > .stats .stat b { font-size:1.4rem; }
  .exchange-steps { padding:12px 6px; }
  .exchange-steps li { flex-direction:column; gap:6px; padding:0 2px; text-align:center; }
  .exchange-form, .side-form { padding:20px; }
  .plan { padding:16px; min-height:140px; }
  .login { padding:28px; }
  .task-tabs { width:100%; }
  .workspace-location { overflow-wrap:anywhere; }
}
@media (prefers-reduced-motion:reduce) { .table tbody tr { transition:none; } }

/* Laptop fit: row actions wrap instead of widening the table, and the action
   column stays pinned to the visible edge when a wide table still scrolls. */
.row-actions { flex-wrap:wrap; row-gap:6px; }
td:has(> .row-actions > *) { min-width:124px; }
.table:has(.usage) td:has(> .row-actions > *) { min-width:164px; }
.cdk-cell .cdk-code { min-width:17ch; }
.env-badge { white-space:nowrap; }
.table:has(td > .row-actions > *) tr > :last-child, .price-table tr > :last-child { position:sticky; right:0; z-index:1; background:var(--panel); box-shadow:inset 1px 0 var(--line); }
.table:has(td > .row-actions > *) thead tr > :last-child, .price-table thead tr > :last-child { background:#f8f9fc; }
.table:has(td > .row-actions > *) tbody tr:hover > :last-child, .price-table tbody tr:hover > :last-child { background:#f7faef; }
.price-table tr.is-dirty > :last-child { background:#f4faf8; }
.table { scrollbar-width:thin; }
@media (max-width:1440px) {
  .side { width:212px; padding-left:12px; padding-right:12px; }
  .main { padding:0 24px 32px; }
  th, td { padding:12px 10px; }
  .note-form input { width:104px; }
  .usage { min-width:120px; }
  .wrap { max-width:220px; }
}
@media (max-width:1180px) {
  .side { width:196px; }
  .side nav a { padding:7px 10px; gap:8px; font-size:.92rem; }
  .main { padding:0 18px 28px; }
  th, td { padding:10px 10px; }
  td { font-size:.9rem; }
  .row-actions .btn.sm, .row-actions button.sm { padding:3px 8px; }
  .top h1 { font-size:1.6rem; }
  .note-form input { width:96px; }
}
@media (max-width:820px) {
  .side { width:100%; }
  .table:has(td > .row-actions > *) tr > :last-child, .price-table tr > :last-child { box-shadow:inset 1px 0 var(--line), -6px 0 8px -6px rgba(35,42,80,.12); }
}

/* Long unbroken tokens (batch names, hashes) must not squeeze table columns
   to a few characters: links in cells break only when a word cannot fit, and
   batch names are truncated with the full name in the tooltip. */
.table td a { overflow-wrap:break-word; }
.table td.wrap { min-width:10em; }
.clip { display:inline-block; max-width:190px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; vertical-align:bottom; }
.clip.sm { max-width:120px; }
.time-cell { min-width:8.5em; }

/* Collapsible desktop sidebar (icon rail). Phones keep the drop-down menu. */
.side-collapse { display:flex; justify-content:flex-start; gap:10px; width:100%; min-height:36px; margin:8px 0 10px; padding:7px 12px; border:0; background:transparent; color:var(--muted); font-weight:500; font-size:.9rem; }
.side-collapse:hover { background:var(--hover); color:var(--ink); }
.side-collapse .ico { width:18px; height:18px; transition:transform .15s; }
@media (min-width:821px) {
  .side { transition:width .15s, padding .15s; }
  html.side-collapsed .side { width:68px; padding-left:10px; padding-right:10px; }
  html.side-collapsed .brand { justify-content:center; padding:2px 0 24px; }
  html.side-collapsed .brand > span, html.side-collapsed .env-badge { display:none; }
  html.side-collapsed .nav-label { display:none; }
  html.side-collapsed .nav-group { margin-bottom:10px; padding-bottom:10px; border-bottom:1px solid var(--line); }
  html.side-collapsed .nav-group:last-child { border-bottom:0; }
  html.side-collapsed .side nav a { justify-content:center; padding:7px 0; }
  html.side-collapsed .side nav a span { display:none; }
  html.side-collapsed .side-collapse { justify-content:center; padding:7px 0; }
  html.side-collapsed .side-collapse span { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
  html.side-collapsed .side-collapse .ico { transform:rotate(180deg); }
  html.side-collapsed .who { flex-direction:column; gap:6px; padding-left:0; padding-right:0; }
  html.side-collapsed .who-name { display:none; }
}
@media (max-width:820px) { .side-collapse { display:none; } }
@media (prefers-reduced-motion:reduce) { .side, .side-collapse .ico { transition:none; } }

/* Wide tables: long order numbers and cost details wrap inside their column. */
.order-col { min-width:13em; max-width:20em; }
.table td.order-col > a { overflow-wrap:anywhere; }
.cost-col { min-width:13em; }
.cost-col .tag { white-space:nowrap; }
/* Floating row menus (positioned by console.js). */
.menu-list.floating { position:fixed; right:auto; z-index:40; }
td:has(details.menu[open]) { z-index:30 !important; }
/* Foldable sidebar groups. */
button.nav-label { display:flex; align-items:center; justify-content:space-between; width:100%; min-height:0; margin:0; border:0; border-radius:6px; background:none; font:inherit; font-size:.74rem; font-weight:600; color:var(--faint); letter-spacing:.04em; padding:2px 12px 7px; cursor:pointer; text-align:left; }
button.nav-label:hover { background:none; color:var(--ink-2); }
button.nav-label::after { content:""; width:6px; height:6px; margin-right:2px; border-right:1.5px solid currentColor; border-bottom:1.5px solid currentColor; transform:rotate(45deg); transition:transform .15s; }
.nav-group.folded button.nav-label::after { transform:rotate(-45deg); }
html:not(.side-collapsed) .nav-group.folded > a:not(.on) { display:none; }
@media (max-width:820px) { .nav-group.folded > a:not(.on) { display:none; } }
@media (prefers-reduced-motion:reduce) { button.nav-label::after { transition:none; } }

/* Redemption records: fixed column widths and a cost summary; the page scrolls
   as a whole (no inner scroll box), the table only scrolls sideways if narrow. */
.records-summary { display:grid; grid-template-columns:repeat(auto-fit, minmax(200px, 1fr)); gap:12px; padding:0 20px 20px; }
.records-summary .stat { padding:14px 16px; box-shadow:none; }
.records-summary .stat b { font-size:1.45rem; margin-top:6px; }
.records-summary .stat b.sm { font-size:1.15rem; }
.records-summary .stat b.neg { color:var(--bad); }
.records-summary .stat b.pos { color:var(--good); }
.records-table table { min-width:1120px; }
.records-table:has(th.cost-col) table { min-width:1360px; }
.records-table .order-col { min-width:0; max-width:none; width:13.5em; }
.records-table td.order-col > a { font-family:var(--mono); font-size:.82rem; }
.records-table .owner-col { width:15.5em; max-width:15.5em; }
.records-table td.owner-col a { overflow-wrap:anywhere; }
.records-table .cost-col { width:18em; min-width:18em; }
.records-table .cost-col .sub { font-size:.8rem; }
@media (max-width:820px) { .records-summary { padding:0 16px 16px; } }
.period-presets { margin: 0 0 14px; }
.upstream-tabs { margin: 0 0 16px; }
/* USDT 充值 */
.num-input { width: 7.5em; text-align: right; }
.net-choices { border: 0; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.net-choices legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.net-choice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; background: var(--panel); }
.net-choice:has(input:checked) { border-color: var(--accent, #497a12); box-shadow: 0 0 0 1px var(--accent, #497a12); }
.net-choice { flex-direction: row; }
.net-choice input { margin-top: 3px; width: auto; flex: none; min-height: 0; }
.net-choice span { display: flex; flex-direction: column; gap: 2px; }
.net-choice small { color: var(--muted); }
.topup-preview { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: baseline; padding: 10px 0; }
.topup-preview small { color: var(--muted); flex-basis: 100%; }
.pay-exact { border: 2px solid var(--accent); border-radius: var(--r); padding: 14px 16px; margin: 0 0 12px; background: var(--accent-soft); display: flex; flex-direction: column; gap: 6px; }
.pay-exact > span { font-weight: 600; color: var(--accent-ink); }
.pay-exact-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pay-exact-row b { font-size: 2rem; font-variant-numeric: tabular-nums; letter-spacing: .02em; color: var(--ink); overflow-wrap: anywhere; }
.pay-exact-token { font-weight: 600; color: var(--ink-2); }
.pay-exact-row button { margin-left: auto; }
.pay-exact small { color: var(--muted); }
.pay-rules ul { margin: 6px 0 0; padding-left: 1.2em; }
.pay-rules li { margin: 3px 0; }

/* ---------- 2026-11-21 usability pass ---------- */
/* Wide-table top scrollbar lives in a frame with its table (see console.js). */
.table-frame { min-width: 0; }
.table-panel > .table-frame > .table-topscroll { border-top: 1px solid var(--line); }
/* Quick date ranges and the export link share one row, inset like filters. */
.filter-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 14px; }
.filter-sub .period-presets { margin: 0; }
.filter-sub .spacer { flex: 1; }
.table-panel > .filter-sub, .table-panel > .period-presets { margin: 0 20px 16px; }
.panel:not(.table-panel) > .records-summary { padding: 0; margin-bottom: 16px; }
.seg.period-presets { flex-wrap: wrap; }
/* Row "more" menus sit next to compact buttons without growing the row. */
.row-actions details.menu > summary { width: 28px; height: 28px; }
@media (max-width:820px) {
  .table-panel > .filter-sub, .table-panel > .period-presets { margin: 0 16px 14px; }
}
/* A labelled field (caption above the input) beside buttons: line the
   buttons up with the input, not with the middle of label + input. */
.mini:has(> label:not(.check)), .mini:has(> form > label:not(.check)) { align-items: flex-end; }
