/* Monsoon cabinet and back office. System fonts, tokens for light and dark. */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eef1f5;
  --border: #dde2ea;
  --border-strong: #c5ccd8;
  --text: #19202b;
  --text-2: #4a5566;
  --muted: #6b7686;
  --accent: #2f6fde;
  --accent-strong: #1f58bd;
  --accent-soft: #e6eefc;
  --on-accent: #ffffff;
  --ok: #1d7a46;
  --ok-soft: #e3f4ea;
  --warn: #8a5a00;
  --warn-soft: #fff3d6;
  --bad: #b42318;
  --bad-soft: #fde8e6;
  --info: #1f58bd;
  --info-soft: #e6eefc;
  --neutral-soft: #eceff3;
  --focus: #2f6fde;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 2px 8px rgba(16, 24, 40, .06);
  --shadow-pop: 0 8px 28px rgba(16, 24, 40, .18);
  --imp: #6d28d9;
  --chart-line: #2f6fde;
  --chart-fill: rgba(47, 111, 222, .12);
  --chart-grid: #e6e9ef;
  --radius: 8px;
  --radius-sm: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1319;
    --surface: #171c24;
    --surface-2: #1c222c;
    --surface-3: #232a35;
    --border: #2c3441;
    --border-strong: #3b4555;
    --text: #e6e9ee;
    --text-2: #b9c1cd;
    --muted: #8d97a6;
    --accent: #5b93f5;
    --accent-strong: #7aa8f7;
    --accent-soft: #1c2a44;
    --on-accent: #0b1220;
    --ok: #4cc283;
    --ok-soft: #14301f;
    --warn: #f0b849;
    --warn-soft: #3a2c0c;
    --bad: #f47066;
    --bad-soft: #3d1715;
    --info: #7aa8f7;
    --info-soft: #1c2a44;
    --neutral-soft: #262d38;
    --focus: #7aa8f7;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-pop: 0 8px 28px rgba(0, 0, 0, .55);
    --imp: #a78bfa;
    --chart-line: #5b93f5;
    --chart-fill: rgba(91, 147, 245, .16);
    --chart-grid: #262d38;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1319;
  --surface: #171c24;
  --surface-2: #1c222c;
  --surface-3: #232a35;
  --border: #2c3441;
  --border-strong: #3b4555;
  --text: #e6e9ee;
  --text-2: #b9c1cd;
  --muted: #8d97a6;
  --accent: #5b93f5;
  --accent-strong: #7aa8f7;
  --accent-soft: #1c2a44;
  --on-accent: #0b1220;
  --ok: #4cc283;
  --ok-soft: #14301f;
  --warn: #f0b849;
  --warn-soft: #3a2c0c;
  --bad: #f47066;
  --bad-soft: #3d1715;
  --info: #7aa8f7;
  --info-soft: #1c2a44;
  --neutral-soft: #262d38;
  --focus: #7aa8f7;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-pop: 0 8px 28px rgba(0, 0, 0, .55);
  --imp: #a78bfa;
  --chart-line: #5b93f5;
  --chart-fill: rgba(91, 147, 245, .16);
  --chart-grid: #262d38;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  min-width: 320px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 8px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pad { padding: 8px 12px; }
.grow { flex: 1; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: 8px; top: 8px; z-index: 100; background: var(--surface); padding: 6px 10px; border-radius: var(--radius-sm); }

/* ---------------------------------------------------------------- shell */
.topbar {
  display: flex; align-items: center; gap: 16px;
  height: 56px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 650; font-size: 16px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: var(--on-accent); font-size: 15px; }
.brand-sub { font-weight: 500; color: var(--muted); font-size: 13px; border-left: 1px solid var(--border); padding-left: 8px; }
.header-balance { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; overflow: hidden; }
.hb { display: flex; flex-direction: column; padding: 4px 12px; border-radius: var(--radius-sm); color: var(--text); line-height: 1.2; }
.hb:hover { background: var(--surface-3); text-decoration: none; }
.hb-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.hb-value { font-weight: 600; font-size: 15px; white-space: nowrap; }
.hb-low .hb-value { color: var(--bad); }
.hb-warn { background: var(--bad-soft); color: var(--bad); padding: 4px 10px; border-radius: 99px; font-weight: 600; font-size: 12px; white-space: nowrap; }
.top-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.am { display: flex; flex-direction: column; line-height: 1.15; font-size: 13px; text-align: right; max-width: 200px; overflow: hidden; }
.staff-who { white-space: nowrap; }
.icon-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); width: 32px; height: 32px; border-radius: var(--radius-sm); cursor: pointer; font-size: 16px; line-height: 1; display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--surface-3); }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-btn { display: flex; gap: 6px; align-items: center; cursor: pointer; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); max-width: 240px; }
.menu-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 240px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 6px; display: flex; flex-direction: column; z-index: 30; }
.menu-pop a, .menu-pop button { text-align: left; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-3); text-decoration: none; }
.menu-head { display: flex; flex-direction: column; padding: 6px 10px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }

.imp-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 16px; background: var(--imp); color: #fff; font-size: 13px; position: sticky; top: 0; z-index: 25; }
:root[data-theme="dark"] .imp-banner { color: #120a26; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .imp-banner { color: #120a26; } }

.layout { display: flex; align-items: stretch; min-height: calc(100vh - 56px); }
.side { width: 196px; flex: none; background: var(--surface); border-right: 1px solid var(--border); padding: 12px 8px; }
.side ul { list-style: none; margin: 0; padding: 0; position: sticky; top: 68px; }
.nav-link { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; }
.nav-link:hover { background: var(--surface-3); text-decoration: none; color: var(--text); }
.nav-link.is-active { background: var(--accent-soft); color: var(--accent-strong); }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 12px 10px 4px; }
.main { flex: 1; min-width: 0; padding: 20px 24px 48px; }
.main:focus { outline: none; }
.main-public { max-width: 440px; margin: 0 auto; padding-top: 24px; }
.public-top { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; }

/* ---------------------------------------------------------------- page */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin-right: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.section { margin-top: 20px; }
.section-title { margin-bottom: 10px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card-title { margin-bottom: 12px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 20px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 0; margin: 0 0 8px; font-size: 13px; }
.crumbs li + li::before { content: "›"; color: var(--muted); margin-right: 4px; }
.crumbs span[aria-current] { color: var(--text-2); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 9px 14px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active { color: var(--accent-strong); border-bottom-color: var(--accent); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.empty p { margin-bottom: 10px; }
.empty.big { padding: 80px 16px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 28px; color: var(--muted); }
.spin { width: 16px; height: 16px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }
.notice { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 12px; border: 1px solid transparent; }
.notice-info { background: var(--info-soft); color: var(--text); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.notice-warn { background: var(--warn-soft); color: var(--text); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.notice-error { background: var(--bad-soft); color: var(--text); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.notice-ok { background: var(--ok-soft); color: var(--text); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover:not(:disabled) { background: var(--accent-soft); }
.btn-danger { background: var(--bad); color: #fff; }
:root[data-theme="dark"] .btn-danger { color: #1b0908; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-danger { color: #1b0908; } }
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); }
.btn-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.btn-light { background: rgba(255, 255, 255, .92); color: #2a1660; }
.btn.is-busy { opacity: .7; cursor: progress; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- forms */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field-inline { flex-direction: row; align-items: center; gap: 8px; }
.field label { font-weight: 500; font-size: 13px; color: var(--text-2); }
.req { color: var(--bad); }
.hint { font-size: 12px; color: var(--muted); margin: 0; }
.field-error { font-size: 12px; color: var(--bad); margin: 0; min-height: 0; }
.field-error:empty { display: none; }
.field-error.inline { display: inline; }
.form-error { color: var(--bad); font-weight: 500; }
.form-error:empty { display: none; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=url], input[type=date], input[type=datetime-local], input:not([type]), select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 6px 10px; min-height: 34px; width: 100%; min-width: 0;
}
textarea { resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--focus) 55%, transparent); outline-offset: 0; border-color: var(--focus); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-3); color: var(--muted); }
.has-error input, .has-error select, .has-error textarea, [aria-invalid=true] { border-color: var(--bad); }
.check, .radio { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.check input, .radio input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.radios { display: flex; gap: 6px; flex-wrap: wrap; }
.radio { border: 1px solid var(--border-strong); padding: 6px 12px; border-radius: var(--radius-sm); background: var(--surface); }
.radio:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio.is-disabled { opacity: .55; cursor: not-allowed; }
.input-group { display: flex; gap: 8px; align-items: stretch; }
.input-group > input, .input-group > select { flex: 1; }
.money-input { position: relative; }
.money-input::before { content: "$"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.money-input input { padding-left: 22px; font-variant-numeric: tabular-nums; }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0; min-width: 0; }
.fieldset legend { font-weight: 600; padding: 0 6px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding-top: 4px; }
.review-note { padding: 10px 14px; border-left: 3px solid var(--info); background: var(--info-soft); border-radius: var(--radius-sm); }
.review-note.is-hot { border-left-color: var(--warn); background: var(--warn-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 4px; min-height: 26px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-strong); font-size: 12px; }
.chip-x { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; padding: 0 4px; border-radius: 99px; }
.chip-x:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.multipick { display: flex; flex-direction: column; gap: 6px; }
.pick-list { max-height: 168px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.pick-item { display: flex; gap: 8px; align-items: center; padding: 4px 10px; cursor: pointer; font-size: 13px; }
.pick-item:hover { background: var(--surface-3); }
.pick-item.is-on { background: var(--accent-soft); }
.macro-bar { display: flex; gap: 4px; flex-wrap: wrap; }
.macro { font-family: var(--mono); font-size: 12px; padding: 2px 8px; border: 1px dashed var(--border-strong); border-radius: 99px; background: var(--surface-2); color: var(--text-2); cursor: pointer; }
.macro:hover { border-color: var(--accent); color: var(--accent); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table-wrap.no-max { max-height: none; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th, .table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); color: var(--text-2); font-weight: 600; font-size: 12px; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.actions { white-space: nowrap; text-align: right; }
.table td.actions .btn + .btn { margin-left: 4px; }
/* the actions column stays reachable while wide tables scroll */
.table td.actions, .table th.actions { --cell-bg: var(--surface); position: sticky; right: 0; background: var(--cell-bg); box-shadow: -1px 0 0 var(--border); z-index: 1; }
/* while columns are hidden beneath the sticky column (.more-right, set by
   dataTable), its left edge fades: a value there is never cut in half */
.table-wrap.more-right .table td.actions::before, .table-wrap.more-right .table th.actions::before { content: ""; position: absolute; top: 0; bottom: 0; left: -25px; width: 24px; background: linear-gradient(to right, transparent, var(--cell-bg) 80%); pointer-events: none; }
.table thead th.actions { --cell-bg: var(--surface-2); z-index: 3; }
.table tbody tr:hover td.actions { --cell-bg: var(--surface-2); }
/* the total row closes the table: in the flow, never pinned over the rows */
.table tfoot td { background: var(--surface-2); font-weight: 600; border-top: 1px solid var(--border-strong); border-bottom: 0; }
.table tfoot td.actions { --cell-bg: var(--surface-2); }
.table-compact th, .table-compact td { padding: 5px 8px; }
.table .state-row td { padding: 0; }
.table .state-row:hover td { background: transparent; }
.table tr.is-child td { background: var(--surface-2); }
.table tr.is-child td:first-child { padding-left: 28px; }
.table tr.is-muted td { color: var(--muted); }
.th-btn { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.th-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
th.num .th-btn { flex-direction: row-reverse; }
.sort-ind { font-size: 9px; color: var(--accent); min-width: 8px; }
.cell-sub { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.cell-name { font-weight: 500; color: var(--text); }
.cell-ellipsis { display: inline-block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.expander { all: unset; cursor: pointer; width: 18px; display: inline-block; text-align: center; color: var(--muted); }
.expander:focus-visible { outline: 2px solid var(--focus); border-radius: 3px; }
.inline-edit { all: unset; cursor: pointer; border-bottom: 1px dashed var(--border-strong); font-variant-numeric: tabular-nums; }
.inline-edit:hover { color: var(--accent); border-bottom-color: var(--accent); }
.inline-edit:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.inline-form { display: inline-flex; gap: 4px; align-items: center; }
.inline-form input { width: 96px; min-height: 28px; padding: 3px 6px; text-align: right; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 10px; }
.pager-info { color: var(--muted); font-size: 13px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 500; white-space: nowrap; line-height: 20px; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-neutral { background: var(--neutral-soft); color: var(--text-2); }
.badge-muted { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.badge-am { background: color-mix(in srgb, var(--imp) 18%, transparent); color: var(--imp); }
.pending-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); margin-right: 4px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.zone-id { all: unset; font-family: var(--mono); font-size: 12.5px; letter-spacing: .02em; cursor: copy; padding: 1px 4px; border-radius: 4px; white-space: nowrap; color: var(--text); }
.zone-id:hover { background: var(--accent-soft); color: var(--accent-strong); }
.zone-id:focus-visible { outline: 2px solid var(--focus); }
.copy-field { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 6px 6px 10px; min-width: 0; }
.copy-field code { flex: 1; overflow-wrap: anywhere; }
.pos { color: var(--ok); }
.neg { color: var(--bad); }

/* ---------------------------------------------------------------- range, seg */
.range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.seg-btn { border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: 13px; padding: 6px 12px; cursor: pointer; border-right: 1px solid var(--border); white-space: nowrap; }
.seg-btn:last-child { border-right: 0; }
.seg-btn:hover { background: var(--surface-3); }
.seg-btn.is-active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.range-custom { display: none; align-items: center; gap: 6px; }
.range-custom.is-open { display: inline-flex; }
.range-custom input { width: 150px; }
.range-tz { font-size: 12px; }

/* ---------------------------------------------------------------- modal, toast */
.modal-back { position: fixed; inset: 0; background: rgba(10, 14, 20, .5); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); color: var(--text); border-radius: 10px; box-shadow: var(--shadow-pop); width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; border: 1px solid var(--border); }
.modal-wide { width: min(820px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 16px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--text); color: var(--surface); box-shadow: var(--shadow-pop); max-width: 380px; transition: opacity .4s; }
.toast-bad { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; }

/* ---------------------------------------------------------------- auth */
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 24px; box-shadow: var(--shadow); }
.auth-card h1 { margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); margin-bottom: 18px; }
.auth-links { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; font-size: 13px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- creatives */
.creatives { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.creative { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.creative-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.push-preview { display: flex; gap: 10px; padding: 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); align-items: flex-start; min-width: 0; }
.push-preview img.icon { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; background: var(--surface-3); }
.push-preview .pp-text { min-width: 0; flex: 1; }
.push-preview .pp-title { font-weight: 600; overflow-wrap: anywhere; }
.push-preview .pp-desc { color: var(--text-2); font-size: 13px; overflow-wrap: anywhere; }
.push-preview img.image { display: block; width: 100%; max-height: 150px; object-fit: cover; border-radius: 6px; margin-top: 8px; background: var(--surface-3); }
.version { border-top: 1px dashed var(--border); padding-top: 8px; font-size: 13px; }
.upload-row { display: flex; gap: 8px; align-items: center; }
.upload-row input[type=file] { font-size: 12px; max-width: 220px; }
.thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; border: 1px solid var(--border); background: var(--surface-3); }

/* ---------------------------------------------------------------- chart */
.chart { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px 4px; margin-bottom: 14px; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; color: var(--text-2); }
.chart svg { display: block; width: 100%; height: 180px; }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis-text { fill: var(--muted); font-size: 10.5px; font-family: var(--font); }
.chart .line { fill: none; stroke: var(--chart-line); stroke-width: 1.5; }
.chart .area { fill: var(--chart-fill); stroke: none; }
.chart .hover-line { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .dot { fill: var(--chart-line); }
.chart-tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 6px 10px; font-size: 12px; box-shadow: var(--shadow-pop); white-space: nowrap; z-index: 3; }
.chart-tip strong { display: block; margin-bottom: 2px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 99px; padding: 2px 4px 2px 10px; font-size: 12.5px; }
.report-controls { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 14px; }
.toolbar select { width: auto; min-width: 160px; }
.cell-campaign { min-width: 180px; max-width: 280px; }
.report-controls .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.report-controls select, .report-controls input { width: auto; min-width: 120px; }
.report-meta { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.diff-old { text-decoration: line-through; color: var(--muted); overflow-wrap: anywhere; }
.diff-new { color: var(--text); overflow-wrap: anywhere; }
.mod-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.secret { font-family: var(--mono); letter-spacing: .05em; }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .layout { flex-direction: column; }
  .side { width: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 4px 8px; overflow-x: auto; }
  .side ul { display: flex; gap: 2px; position: static; }
  .nav-group { display: none; }
  .nav-link { white-space: nowrap; }
  .main { padding: 14px 16px 40px; }
  .topbar { height: auto; min-height: 56px; flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .header-balance { order: 3; flex-basis: 100%; }
  .am { display: none; }
  .grid-2, .grid-3, .form-grid, .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .table-wrap { max-height: none; }
  .menu-who { max-width: 120px; }
  .table td.actions, .table th.actions { position: static; box-shadow: none; }
  .table-wrap.more-right .table td.actions::before, .table-wrap.more-right .table th.actions::before { content: none; }
  .seg { flex-wrap: wrap; }
  .range-custom input { width: 140px; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .brand-name { display: none; }
}

.actor { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.actor-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.report-table td:first-child, .report-table th:first-child { min-width: 240px; }
