/* ELVIS TRADE — «Атлас»: navy header, white surfaces, teal account charts.
   Шрифты: Manrope (заголовки), Onest (текст и цифры) — SIL Open Font License 1.1, лежат локально в fonts/. */

@font-face {
  font-family: 'Manrope'; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url('fonts/manrope-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Manrope'; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url('fonts/manrope-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Onest'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('fonts/onest-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Onest'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('fonts/onest-symbols.woff2') format('woff2');
  unicode-range: U+2190-2199, U+21E6-21F0, U+2218-2219, U+25A0-25FF;
}
@font-face {
  font-family: 'Onest'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('fonts/onest-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Токены ---------- */
:root {
  /* Existing component token names are kept for the remaining screens. */
  --sand: #F5F7F9;
  --sand-2: #EAF0F3;
  --sand-3: #B7C8CE;
  --paper: #F8FAFC;
  --card: #FFFFFF;
  --line: #E1E8ED;
  --line-soft: #EBF0F4;

  --ink: #183044;
  --ink-2: #596D7C;
  --ink-2b: #526775;
  --ink-3: #71818E;       /* stale and disabled values */

  --terra: #B14C4C;       /* losses, alerts and destructive actions */
  --terra-ink: #A13D3D;
  --terra-tint: #F9EDED;
  --terra-wash: #FCF5F5;
  --terra-line: #EBCBCB;

  --olive: #216756;       /* gains and confirmed running state */
  --olive-ink: #216756;
  --olive-tint: #E9F3EF;

  --ochre: #B7862C;       /* «долго держит убыток», пауза */
  --ochre-ink: #85601A;
  --ochre-tint: #F7EEDB;

  --taupe: #8BAAB9;
  --accent: #21656B;
  --header: #17354B;
  --header-ink: #FFFFFF;
  --header-muted: #C3D0DB;
  --nav-current: #E7B878;

  --r: 12px;
  --r-sm: 8px;
  --shadow: none;
  --shadow-lg: 0 20px 60px -20px rgba(23, 53, 75, .25);

  --font-head: 'Manrope', 'Ubuntu Sans', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font: 'Onest', 'Ubuntu Sans', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --wrap: 1384px;
  --pad: 32px;
  --topbar-h: 78px;
}

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--sand);
  color: var(--ink);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--font-head); margin: 0; color: var(--ink); }
p { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
img, svg { display: block; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.muted { color: var(--ink-2); }
.pos { color: var(--olive-ink); }
.neg { color: var(--terra-ink); }
.zero { color: var(--ink-2); }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--pad); }
[id] { scroll-margin-top: calc(var(--topbar-h) + 24px); }
[hidden] { display: none !important; }

/* ---------- Верхняя панель ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--header);
  color: var(--header-ink);
  border-bottom: 1px solid #29485D;
}
.topbar .wrap { height: var(--topbar-h); display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 12px; flex: none; }
.wordmark {
  text-decoration: none;
  font: 800 19px/1 var(--font-head);
  letter-spacing: .07em;
  color: var(--ink);
  white-space: nowrap;
}
.pb-short { display: none; }
.status-pill .short { display: none; }
.nav .lbl-short { display: none; }
.proto-badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px;
  border-radius: 999px; background: var(--sand-2); color: var(--ink-2b);
  font: 500 11.5px/1 var(--font); letter-spacing: .01em; white-space: nowrap;
}
.nav { display: flex; align-items: center; gap: 2px; height: 100%; }
.topbar .wordmark { color: var(--header-ink); }
.topbar :focus-visible { outline-color: var(--nav-current); }
.nav a {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  height: 100%; padding: 0 12px;
  color: var(--header-muted); text-decoration: none; font-weight: 400; font-size: 14px; white-space: nowrap;
}
.nav a:hover { color: var(--header-ink); }
.nav a[aria-current="page"] { color: var(--header-ink); font-weight: 500; }
.nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px;
  background: var(--nav-current); border-radius: 2px 2px 0 0;
}
.count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--terra); color: #fff;
  font: 700 12px/1 var(--font); font-variant-numeric: tabular-nums;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 9px; height: 36px; padding: 0 14px 0 12px;
  border-radius: 999px; background: var(--olive-tint); color: var(--olive-ink);
  font-weight: 500; font-size: 14px; white-space: nowrap;
}
.status-pill .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--olive);
  box-shadow: 0 0 0 3px rgba(107, 122, 58, .18);
}
.status-pill[data-state="paused"] { background: var(--ochre-tint); color: var(--ochre-ink); }
.status-pill[data-state="paused"] .dot { background: var(--ochre); box-shadow: 0 0 0 3px rgba(183, 134, 44, .2); }
.status-pill[data-state="stale"] { background: var(--terra-tint); color: var(--terra-ink); }
.status-pill[data-state="stale"] .dot { background: var(--terra); box-shadow: 0 0 0 3px rgba(182, 92, 58, .18); }
.user-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 4px;
  border: 0; background: transparent; border-radius: 999px; cursor: pointer; color: var(--ink-2);
  font-size: 14px; font-weight: 500;
}
.user-btn:hover { background: var(--sand-2); color: var(--ink); }
.avatar {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: #E4D9C8; color: var(--ink); font: 700 12.5px/1 var(--font-head); flex: none;
}
.avatar.av-e { background: #DCE2CC; }
.avatar.av-bot { background: #fff; border: 1px solid var(--sand-3); color: var(--ink-2); }
.user-menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; padding: 6px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg);
  display: none; z-index: 60;
}
.menu-pop.is-open { display: block; }
.menu-pop a, .menu-pop button {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 6px;
  text-decoration: none; color: var(--ink); background: none; border: 0; cursor: pointer; font-size: 14px; text-align: left;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--paper); }
.menu-pop .menu-meta { padding: 8px 10px 10px; font-size: 12.5px; color: var(--ink-2); border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--r-sm);
  border: 1px solid transparent; background: none; cursor: pointer;
  font: 600 14.5px/1 var(--font); white-space: nowrap; text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #45413C; }
.btn-secondary { background: #fff; border-color: var(--sand-3); color: var(--ink); }
.btn-secondary:hover { background: var(--paper); border-color: #CFC3B0; }
.btn-danger { background: var(--terra); color: #fff; }
.btn-danger:hover { background: var(--terra-ink); }
.btn-danger-outline { background: #fff; border-color: var(--terra-line); color: var(--terra-ink); }
.btn-danger-outline:hover { background: var(--terra-wash); border-color: var(--terra); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13.5px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .42; cursor: not-allowed; pointer-events: none; }
.link-danger {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 0;
  color: var(--terra-ink); font-weight: 500; font-size: 14px; text-decoration: none;
  background: none; border: 0; cursor: pointer;
}
.link-danger svg { width: 15px; height: 15px; }
.link-danger:hover { text-decoration: underline; text-underline-offset: 3px; }
.link-danger:disabled { opacity: .45; cursor: not-allowed; text-decoration: none; }
.text-link { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--sand-3); text-underline-offset: 3px; }
.text-link:hover { text-decoration-color: var(--ink); }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px;
  border: 0; background: none; cursor: pointer; color: var(--ink-2);
}
.icon-btn:hover { background: var(--sand-2); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- Каркас страницы ---------- */
main { padding: 32px 0 72px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-head h1 { font-size: 30px; line-height: 36px; font-weight: 700; letter-spacing: -.015em; }
.page-head .sub { margin-top: 8px; color: var(--ink-2); max-width: 760px; }
.page-meta { color: var(--ink-2); font-size: 13.5px; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.page-meta .live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--olive); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px; align-items: start; }
.grid-12.eq-row { align-items: stretch; }
.card-flex { display: flex; flex-direction: column; }
.card-flex > .chart { flex: 1; display: flex; flex-direction: column; }
.card-flex > .chart[hidden] { display: none; }
.card-flex > .chart > .period-panel { flex: 1; display: flex; flex-direction: column; }
.card-flex > .chart > .period-panel[hidden] { display: none; }
.card-flex .cgrid { flex: 1; grid-template-rows: minmax(268px, 1fr) auto; }
.card-flex .plot-donor { height: auto; }
.span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; }
.site-foot { padding: 0 0 40px; color: var(--ink-2); font-size: 12.5px; }
.site-foot .wrap { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); padding-top: 20px; }

/* ---------- Карточки ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-pad { padding: 24px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 20px 24px 16px;
}
.card-head h2 { font-size: 18px; line-height: 24px; font-weight: 700; letter-spacing: -.005em; }
.card-head .hint { color: var(--ink-2); font-size: 13.5px; }
.card-head-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-foot { padding: 14px 24px; border-top: 1px solid var(--line-soft); color: var(--ink-2); font-size: 13.5px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.divider { height: 1px; background: var(--line-soft); }

/* ---------- Полоса «ждут решения» ---------- */
.notice {
  display: flex; align-items: center; gap: 12px; padding: 13px 18px 13px 16px; margin-bottom: 24px;
  border-radius: var(--r); background: var(--terra-tint); border: 1px solid var(--terra-line); color: var(--terra-ink);
  font-weight: 500;
}
.notice svg { width: 18px; height: 18px; flex: none; }
.notice-link { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--terra-ink); font-weight: 600; text-decoration: none; white-space: nowrap; }
.notice-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.notice-link svg { width: 16px; height: 16px; }

/* ---------- Ключевые цифры ---------- */
.figures { display: grid; grid-template-columns: 1.55fr repeat(4, minmax(0, 1fr)); }
.fig { padding: 22px 24px 24px; min-width: 0; }
.fig + .fig { border-left: 1px solid var(--line-soft); }
.fig-label { color: var(--ink-2); font-size: 14px; font-weight: 500; margin-bottom: 10px; white-space: nowrap; }
.fig-value {
  font: 700 28px/1.1 var(--font-head); letter-spacing: -.02em; white-space: nowrap; color: var(--ink);
}
.fig-value.pos { color: var(--olive); }
.fig-value.neg { color: var(--terra); }
.fig-hero .fig-value { font-size: 44px; letter-spacing: -.025em; }
.fig-sub { margin-top: 10px; color: var(--ink-2); font-size: 13.5px; white-space: nowrap; }
.fig-sub b { color: var(--ink); font-weight: 600; }
.figures-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------- Шкалы ---------- */
.meters { display: grid; grid-template-columns: 1.55fr 1fr; gap: 24px; margin-top: 24px; }
.meter { padding: 20px 24px 22px; }
.meter-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.meter-label { font-weight: 500; color: var(--ink); }
.meter-value { font: 700 22px/1 var(--font-head); letter-spacing: -.01em; white-space: nowrap; }
.track { position: relative; height: 10px; border-radius: 5px; background: var(--sand-2); overflow: hidden; display: flex; gap: 2px; }
.track .seg { height: 100%; border-radius: 0; }
.track .seg:first-child { border-radius: 5px 0 0 5px; }
.seg-ink { background: #4A4641; }
.seg-paused {
  background: repeating-linear-gradient(135deg, #B9AE9C 0 3px, #D9D0C2 3px 6px);
}
.track.olive { background: var(--olive-tint); }
.seg-olive { background: var(--olive); border-radius: 5px !important; }
.meter-notes { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; color: var(--ink-2); font-size: 13.5px; }
.meter-notes .key { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.meter-notes .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.meter-notes b { color: var(--ink); font-weight: 600; }
.meter-scale { position: relative; height: 16px; margin-top: 6px; color: var(--ink-2); font-size: 11.5px; }
.meter-scale span { position: absolute; transform: translateX(-50%); }
.meter-scale span:first-child { transform: none; }
.meter-scale span:last-child { transform: translateX(-100%); }

/* ---------- Переключатель периода ---------- */
.seg-ctl { display: inline-flex; padding: 3px; gap: 2px; background: var(--sand-2); border-radius: 9px; }
.seg-ctl button {
  height: 30px; padding: 0 13px; border: 0; border-radius: 7px; background: transparent; cursor: pointer;
  color: var(--ink-2b); font-size: 13.5px; font-weight: 500; white-space: nowrap;
}
.seg-ctl button:hover { color: var(--ink); }
.seg-ctl button[aria-pressed="true"] { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(70, 55, 35, .12), 0 0 0 1px rgba(70, 55, 35, .04); }

/* ---------- Графики ---------- */
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 0 24px 12px; color: var(--ink-2); font-size: 13px; }
.chart-legend .key { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.key-line { width: 18px; height: 0; border-top: 2px solid var(--ink); border-radius: 2px; }
.key-line.taupe { border-top-color: var(--taupe); }
.key-line.dashed { border-top-style: dashed; border-top-color: var(--taupe); }
.key-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.key-bars i { width: 5px; border-radius: 2px 2px 0 0; display: block; }
.key-bars i:nth-child(1) { height: 11px; background: var(--olive); }
.key-bars i:nth-child(2) { height: 7px; background: var(--terra); border-radius: 0 0 2px 2px; align-self: flex-start; margin-top: 5px; }
.key-wash { width: 14px; height: 10px; border-radius: 2px; background: rgba(182, 92, 58, .14); border: 1px solid rgba(182, 92, 58, .25); }

.chart { position: relative; padding: 4px 24px 20px; }
.chart:focus-visible { outline-offset: -4px; border-radius: var(--r); }
.cgrid { display: grid; grid-template-columns: 64px minmax(0, 1fr); }
.yaxis { position: relative; color: var(--ink-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.yaxis span { position: absolute; right: 12px; transform: translateY(-50%); white-space: nowrap; }
.plot { position: relative; }
.plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.plot-line { height: 232px; }
.plot-bars { height: 96px; margin-top: 30px; }
.plot-donor { height: 268px; }
.xaxis { position: relative; height: 26px; color: var(--ink-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.xaxis span { position: absolute; top: 9px; transform: translateX(-50%); white-space: nowrap; }
.xaxis span.edge-l { transform: none; }
.xaxis span.edge-r { transform: translateX(-100%); }
.end-dot {
  position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
  background: var(--ink); box-shadow: 0 0 0 2px #fff; pointer-events: none;
}
.end-dot.taupe { background: var(--taupe); }
.end-label {
  position: absolute; transform: translate(-100%, -50%); margin-left: -12px; padding: 3px 8px;
  border-radius: 6px; background: #fff; border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(70, 55, 35, .06);
  font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none;
}
.end-label small { font-weight: 400; color: var(--ink-2); font-size: 12px; margin-right: 4px; }
.end-label.below { transform: translate(-100%, 0); margin: 10px 0 0 6px; }
.end-label.above { transform: translate(-100%, -100%); margin: -10px 0 0 6px; }
.cgrid > .yaxis { grid-column: 1; }
.cgrid > .c2 { grid-column: 2; }
.cgrid > .r1 { grid-row: 1; }
.cgrid > .r2 { grid-row: 2; }
.cgrid > .r3 { grid-row: 3; }
.cgrid > .r12 { grid-row: 1 / 3; }
.hits { position: relative; z-index: 2; }
.hit { position: absolute; top: 0; bottom: 0; }
.xhair { position: absolute; top: 0; height: 0; width: 0; border-left: 1px solid rgba(43, 43, 43, .35); pointer-events: none; display: none; z-index: 1; }
.chart.is-hover .xhair { display: block; }
.tip {
  position: absolute; z-index: 5; min-width: 196px; padding: 10px 12px; pointer-events: none;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lg);
  font-size: 13px; display: none;
}
.chart.is-hover .tip { display: block; }
.tip-title { color: var(--ink-2); font-size: 12px; margin-bottom: 6px; }
.tip-row { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 8px; padding: 2px 0; }
.tip-row .k { width: 14px; height: 0; border-top: 2px solid var(--ink); }
.tip-row .k.taupe { border-top-color: var(--taupe); }
.tip-row .k.dashed { border-top: 2px dashed var(--taupe); }
.tip-row .k.kbar { height: 10px; border: 0; border-radius: 2px; background: var(--sand-3); width: 6px; justify-self: center; }
.tip-row .k.kbar.pos { background: var(--olive); }
.tip-row .k.kbar.neg { background: var(--terra); }
.tip-row .l { color: var(--ink-2); }
.tip-row .v { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.bar { transition: opacity .12s; }
.chart.is-hover .bar { opacity: .55; }
.chart.is-hover .bar.is-on { opacity: 1; }
.chart-table { padding: 0 24px 20px; }
.chart-table .table-scroll { max-height: 360px; overflow: auto; border: 1px solid var(--line-soft); border-radius: 8px; }
.period-panel[hidden] { display: none; }
.view-toggle { border: 0; background: none; cursor: pointer; color: var(--ink-2); font-size: 13.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; padding: 6px 4px; }
.view-toggle:hover { color: var(--ink); }
.view-toggle svg { width: 16px; height: 16px; }

/* ---------- Таблицы ---------- */
.table-scroll { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th {
  text-align: left; font-weight: 500; font-size: 12.5px; color: var(--ink-2); white-space: nowrap;
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: #fff;
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 24px; }
.table th:last-child, .table td:last-child { padding-right: 24px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .c { text-align: center; }
.table tfoot td { border-top: 1px solid var(--line); border-bottom: 0; background: var(--paper); font-weight: 600; padding-top: 13px; padding-bottom: 13px; }
.table tfoot td:first-child { border-bottom-left-radius: var(--r); }
.table tfoot td:last-child { border-bottom-right-radius: var(--r); }
.table.compact td { padding-top: 11px; padding-bottom: 11px; }
.row-link { cursor: pointer; }
.row-link:hover td { background: var(--paper); }
.row-link a.donor-name { text-decoration: none; }
.row-link:hover a.donor-name { text-decoration: underline; text-decoration-color: var(--sand-3); text-underline-offset: 3px; }
.donor-name { font-weight: 600; color: var(--ink); white-space: nowrap; }
.donor-cell { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-paused td { color: var(--ink-2); }
.row-paused .donor-name { color: var(--ink-2); }
.row-loss td { background: var(--terra-wash); }
.row-loss td:first-child { box-shadow: inset 3px 0 0 var(--terra); }
.chev { color: var(--sand-3); width: 16px; height: 16px; }
.row-link:hover .chev { color: var(--ink-2); }
.share-cell { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.minibar { width: 56px; height: 4px; border-radius: 2px; background: var(--sand-2); overflow: hidden; flex: none; }
.minibar i { display: block; height: 100%; background: #6B655D; border-radius: 2px; }
.grid-cell { white-space: nowrap; }
.grid-cell .sym { font-weight: 500; }
.grid-cell .n { color: var(--ink-2); }
.dash { color: var(--sand-3); }
.lossgrids { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; white-space: nowrap; }
.lossgrids .bad { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; background: var(--terra-tint); color: var(--terra-ink); font-weight: 600; }
.lossgrids .ok { display: inline-grid; place-items: center; min-width: 22px; height: 22px; color: var(--ink-2); }
.lossgrids .of { color: var(--ink-2); }
th.sortable { cursor: pointer; user-select: none; }
th.sortable .th-in { display: inline-flex; align-items: center; gap: 4px; }
th.num .th-in { justify-content: flex-end; }
.sort { display: inline-flex; flex-direction: column; gap: 1px; color: var(--sand-3); }
.sort svg { width: 8px; height: 5px; }
th[aria-sort] { color: var(--ink); }
th[aria-sort="descending"] .sort .dn, th[aria-sort="ascending"] .sort .up { color: var(--ink); }
.th-sub { display: block; font-size: 11.5px; color: var(--ink-2); font-weight: 400; margin-top: 1px; }
.spark { width: 104px; height: 30px; overflow: visible; }
.cmp-table th, .cmp-table td { padding-left: 12px; padding-right: 12px; }
.cmp-table th.wrap { white-space: normal; line-height: 1.3; min-width: 96px; max-width: 120px; }
.cmp-table th.wrap .th-in { display: inline; }
.cmp-table .spark { width: 92px; }

/* ---------- Чипы ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap; line-height: 1;
}
.chip svg { width: 12px; height: 12px; }
.chip .cdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-terra { background: var(--terra-tint); color: var(--terra-ink); }
.chip-ochre { background: var(--ochre-tint); color: var(--ochre-ink); }
.chip-olive { background: var(--olive-tint); color: var(--olive-ink); }
.chip-neutral { background: #EFE9DF; color: var(--ink-2b); }
.chip-outline { background: #fff; border: 1px solid var(--sand-3); color: var(--ink-2b); }
.chip-lg { height: 28px; padding: 0 12px; font-size: 13.5px; }
.flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.flag-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }
.fl-item { display: inline-flex; gap: 8px; align-items: center; }

/* ---------- Формы ---------- */
.field { display: grid; gap: 6px; }
.field label, .field .label { font-size: 13.5px; font-weight: 500; color: var(--ink); }
.input {
  height: 44px; width: 100%; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--sand-3); background: #fff; color: var(--ink); font-size: 15px;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: #9C968E; }
.input:hover { border-color: #CFC3B0; }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(43, 43, 43, .08); }
.input.is-error { border-color: var(--terra); box-shadow: 0 0 0 3px rgba(182, 92, 58, .12); }
.field-hint { font-size: 13px; color: var(--ink-2); }
.field-error { font-size: 13px; color: var(--terra-ink); font-weight: 500; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: 0; text-align: center; width: 96px; font: 700 18px/1 var(--font-head); font-variant-numeric: tabular-nums; }
.input-group .step {
  width: 44px; border: 1px solid var(--sand-3); background: #fff; cursor: pointer; color: var(--ink);
  display: grid; place-items: center; font-size: 18px;
}
.input-group .step:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); border-right: 0; }
.input-group .step:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; border-left: 0; }
.input-group .step:hover { background: var(--paper); }
.input-suffix { position: relative; }
.input-suffix .input { padding-right: 40px; font: 700 20px/1 var(--font-head); font-variant-numeric: tabular-nums; height: 52px; }
.input-suffix .sfx { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-2); font-weight: 600; }
.check { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.check input { appearance: none; -webkit-appearance: none; flex: none; width: 20px; height: 20px; margin: 1px 0 0; border: 1.5px solid #BDB2A1; border-radius: 5px; background: #fff; display: grid; place-items: center; cursor: pointer; }
.check input:checked { background: var(--ink); border-color: var(--ink); }
.check input:checked::after { content: ""; width: 10px; height: 6px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: translateY(-1px) rotate(-45deg); }
.check .ct { font-size: 14.5px; }
.check .ct small { display: block; color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; flex: none; width: 40px; height: 24px; border-radius: 999px; background: var(--sand-3); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s; }
.switch input:checked { background: var(--ink); }
.switch input:checked::after { transform: translateX(16px); }
.switch .st { font-size: 14.5px; }
.switch .st small { display: block; color: var(--ink-2); font-size: 13px; margin-top: 2px; }

/* ---------- Модальные окна ---------- */
dialog.modal {
  width: min(540px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0;
  border-radius: 14px; background: #fff; color: var(--ink); box-shadow: var(--shadow-lg); overflow: auto;
}
dialog.modal::backdrop { background: rgba(236, 229, 217, .74); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
dialog.modal[open] { animation: pop .16s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 24px 24px 4px; }
.modal-head h2 { font-size: 20px; line-height: 28px; font-weight: 700; letter-spacing: -.01em; }
.modal-head .close { margin: -6px -8px 0 0; }
.modal-body { padding: 8px 24px 4px; }
.modal-body > * + * { margin-top: 16px; }
.modal-lead { color: var(--ink); font-size: 15px; }
.modal-note { color: var(--ink-2); font-size: 13.5px; display: flex; gap: 8px; align-items: flex-start; }
.modal-note svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 12px; padding: 20px 24px 24px; }
.modal-danger .modal-head h2 { color: var(--terra-ink); }
.compare-head { display: grid; grid-template-columns: 1fr auto; padding: 10px 0 0; color: var(--ink-2); font-size: 12px; letter-spacing: .01em; }
.compare-head + .compare-row { border-top: 0; }
.compare { background: var(--paper); border: 1px solid var(--line-soft); border-radius: var(--r); padding: 4px 16px; }
.compare-row { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 16px; padding: 11px 0; }
.compare-row + .compare-row { border-top: 1px solid var(--line-soft); }
.compare-row .cl { color: var(--ink-2); font-size: 14px; }
.compare-row .cv { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; font-size: 14.5px; }
.compare-row .was { color: var(--ink-2); }
.compare-row .arr { color: var(--ink-2); margin: 0 6px; }
.compare-row .now { font-weight: 700; color: var(--ink); }
.summary-box { border-radius: var(--r); padding: 14px 16px; background: var(--terra-wash); border: 1px solid var(--terra-line); }
.summary-box .big { font: 700 17px/1.35 var(--font-head); color: var(--ink); }
.summary-box .big .neg { color: var(--terra-ink); }
.summary-box .small { color: var(--ink-2); font-size: 13.5px; margin-top: 4px; }
.warn-line { color: var(--terra-ink); font-size: 13.5px; font-weight: 500; display: none; }
.warn-line.is-on { display: block; }
.confirm-word { font-weight: 700; letter-spacing: .06em; color: var(--ink); background: var(--sand-2); padding: 1px 6px; border-radius: 4px; }

/* ---------- Нижняя панель (телефон) ---------- */
.tabbar { display: none; }
.sheet-menu a, .sheet-menu button {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 4px; border: 0; background: none;
  border-bottom: 1px solid var(--line-soft); text-decoration: none; color: var(--ink); font-size: 16px; cursor: pointer; text-align: left;
}
.sheet-menu svg { width: 20px; height: 20px; color: var(--ink-2); }
.sheet-menu > :last-child { border-bottom: 0; }

/* ---------- Уведомления ---------- */
.toast-host { position: fixed; right: 24px; bottom: 24px; z-index: 120; display: grid; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; min-width: 280px; max-width: 420px; padding: 12px 16px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg);
  font-size: 14px; animation: pop .18s ease-out;
}
.toast .tdot { width: 8px; height: 8px; border-radius: 50%; background: var(--olive); flex: none; }
.toast.warn .tdot { background: var(--ochre); }
.toast.danger .tdot { background: var(--terra); }

/* ---------- Исполнитель не отвечает ---------- */
.stale-banner {
  display: none; align-items: center; gap: 12px; margin-bottom: 24px; padding: 14px 18px;
  background: #fff; border: 1px solid var(--terra-line); border-left: 4px solid var(--terra); border-radius: var(--r);
  color: var(--ink); box-shadow: var(--shadow);
}
.stale-banner svg { width: 20px; height: 20px; color: var(--terra); flex: none; }
.stale-banner b { color: var(--terra-ink); font-weight: 600; }
.is-stale .stale-banner { display: flex; }
.is-stale [data-live] { color: var(--ink-3) !important; }
.is-stale [data-live] .pos, .is-stale [data-live] .neg, .is-stale [data-live].pos, .is-stale [data-live].neg { color: var(--ink-3) !important; }
.is-stale .lossgrids .bad { background: var(--sand-2); color: var(--ink-3); }
.is-stale .chart .plot, .is-stale .spark, .is-stale .track, .is-stale .ladder { filter: grayscale(1); opacity: .5; }
.is-stale .page-meta .live-dot { background: var(--terra); }

/* ---------- Счёт: таблица доноров ---------- */
.donors-table .col-share { width: 150px; }
.paused-chip { height: 22px; padding: 0 8px; font-size: 12px; }

/* ---------- Донор ---------- */
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; margin-bottom: 12px; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.crumbs .sep { color: var(--sand-3); }
.donor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.donor-title { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.donor-title h1 { font-size: 36px; line-height: 44px; font-weight: 800; letter-spacing: -.02em; }
.donor-meta { margin-top: 6px; color: var(--ink-2); font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 0; }
.donor-meta span + span::before { content: "·"; margin: 0 8px; color: #B3A996; }
.l-short { display: none; }
.dfacts .fv small .sep { margin-right: 0; }
.donor-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 14px; flex: none; }
.donor-actions .btns { display: flex; gap: 10px; }
.danger-sep { display: flex; align-items: center; gap: 12px; }
.danger-sep::before { content: ""; width: 24px; height: 1px; background: var(--terra-line); }
.grid-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 0 24px; }
.grid-hero .gname { font: 700 22px/1.25 var(--font-head); letter-spacing: -.01em; }
.grid-hero .gname .side { color: var(--ink-2); font-weight: 600; }
.grid-hero .gsub { color: var(--ink-2); font-size: 14px; margin-top: 4px; }
.grid-hero .gres { text-align: right; flex: none; }
.grid-hero .gres .v { font: 700 26px/1.1 var(--font-head); color: var(--terra); letter-spacing: -.02em; }
.grid-hero .gres .s { font-size: 13px; color: var(--terra-ink); margin-top: 4px; }
.grid-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 18px 24px 20px; }
.grid-facts .fl { color: var(--ink-2); font-size: 12.5px; margin-bottom: 4px; }
.grid-facts .fv { font-size: 14.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid-facts .fv b { font-weight: 600; }
.ladder { position: relative; margin: 0 24px 18px; height: 54px; }
.ladder .rail { position: absolute; left: 0; right: 0; top: 26px; height: 2px; background: var(--sand-2); border-radius: 1px; }
.ladder .gap { position: absolute; top: 25px; height: 4px; background: rgba(182, 92, 58, .28); border-radius: 2px; }
.ladder .tick { position: absolute; top: 19px; width: 2px; height: 16px; margin-left: -1px; background: #B9AE9C; border-radius: 1px; }
.ladder .avg { position: absolute; top: 15px; width: 2px; height: 24px; margin-left: -1px; background: var(--ink); border-radius: 1px; }
.ladder .now { position: absolute; top: 21px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--terra); box-shadow: 0 0 0 2px #fff; }
.ladder .lab { position: absolute; font-size: 11.5px; color: var(--ink-2); white-space: nowrap; transform: translateX(-50%); font-variant-numeric: tabular-nums; }
.ladder .lab.top { top: 0; }
.ladder .lab.bot { top: 40px; }
.ladder .lab b { color: var(--ink); font-weight: 600; }
.ladder .lab.now-l { color: var(--terra-ink); }
.ladder .lab.now-l b { color: var(--terra-ink); }
.deals-table .c-open { white-space: nowrap; }
.other-deals { padding: 12px 24px 16px; color: var(--ink-2); font-size: 13.5px; border-top: 1px solid var(--line-soft); }
.reason-list { list-style: none; margin: 0; padding: 0 24px 8px; }
.reason-list li { padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.reason-list li:last-child { border-bottom: 0; }
.reason-list .rl1 { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.reason-list .rt { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.reason-list .rd { color: var(--ink-2); font-size: 13px; margin-top: 3px; }
.grid-summary { display: flex; flex-wrap: wrap; gap: 4px 0; }
.grid-summary span + span::before { content: "·"; margin: 0 8px; color: #B3A996; }
.grid-summary b { color: var(--ink); font-weight: 600; }
.more-btn { border: 0; background: none; cursor: pointer; color: var(--ink); font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; }
.more-btn svg { width: 14px; height: 14px; transition: transform .15s; }
.more-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.older[hidden] { display: none; }

/* ---------- Ждут решения ---------- */
.decision-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.decision { display: flex; flex-direction: column; }
.decision-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px 16px; }
.decision-top h2 { font-size: 21px; line-height: 28px; font-weight: 700; letter-spacing: -.01em; }
.decision-top h2 .ins { font-weight: 600; color: var(--ink-2); }
.wait { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2b); font-size: 13.5px; font-weight: 500; white-space: nowrap; background: var(--paper); border: 1px solid var(--line-soft); height: 28px; padding: 0 10px; border-radius: 999px; }
.wait svg { width: 14px; height: 14px; }
.dfacts { display: grid; grid-template-columns: 1.4fr 1fr 0.8fr; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.dfacts > div { padding: 14px 24px; }
.dfacts > div + div { border-left: 1px solid var(--line-soft); }
.dfacts .fl { color: var(--ink-2); font-size: 12.5px; margin-bottom: 4px; }
.dfacts .fv { font: 600 17px/1.3 var(--font); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dfacts .fv small { font: 400 13.5px/1 var(--font); color: var(--ink-2); margin-left: 4px; }
.shift { display: flex; align-items: flex-start; gap: 12px; padding: 16px 24px; }
.shift .sic { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.shift .sic svg { width: 18px; height: 18px; }
.shift.bad .sic { background: var(--terra-tint); color: var(--terra-ink); }
.shift.good .sic { background: var(--olive-tint); color: var(--olive-ink); }
.shift .sv { font-weight: 600; font-size: 15.5px; font-variant-numeric: tabular-nums; }
.shift.bad .sv { color: var(--terra-ink); }
.shift.good .sv { color: var(--olive-ink); }
.shift .sl { color: var(--ink-2); font-weight: 500; }
.shift .sd { color: var(--ink-2); font-size: 13.5px; margin-top: 2px; }
.partial { margin: 0 24px 4px; padding: 10px 12px; border-radius: 8px; background: var(--ochre-tint); color: var(--ochre-ink); font-size: 13.5px; font-weight: 500; display: flex; gap: 8px; align-items: flex-start; }
.partial svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.decision-foot { margin-top: auto; display: flex; gap: 12px; padding: 16px 24px 24px; }
.decision-foot .btn { flex: 1; height: 44px; }
.pause-hint { display: none; padding: 0 24px 16px; margin-top: -8px; color: var(--ochre-ink); font-size: 13px; }
.is-paused .pause-hint { display: block; }
.decision.is-done .decision-foot .btn { display: none; }
.decision .done-line { display: none; margin: 0 24px 24px; padding: 12px 14px; border-radius: 8px; background: var(--olive-tint); color: var(--olive-ink); font-weight: 500; font-size: 14px; }
.decision.is-done .done-line { display: block; }
.decision.is-done .done-line.cancel { background: var(--sand-2); color: var(--ink-2b); }

/* ---------- Журнал ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.fchip {
  height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--sand-3); background: #fff;
  color: var(--ink-2b); font-weight: 500; font-size: 14px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px;
}
.fchip:hover { border-color: #CFC3B0; color: var(--ink); }
.fchip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.fchip .fc { font-size: 12px; opacity: .7; font-variant-numeric: tabular-nums; }
.jday { padding: 14px 24px 8px; font: 700 13px/1 var(--font-head); color: var(--ink-2); letter-spacing: .01em; border-bottom: 1px solid var(--line-soft); background: var(--paper); }
.jday:first-child { border-radius: var(--r) var(--r) 0 0; }
.jrow { display: grid; grid-template-columns: 56px 150px minmax(0, 1fr) 210px 170px; align-items: center; gap: 16px; padding: 14px 24px; border-bottom: 1px solid var(--line-soft); }
.jgroup .jrow:last-child { border-bottom: 0; }
.jgroup + .jgroup .jday { border-top: 1px solid var(--line-soft); border-radius: 0; }
.jtime { color: var(--ink-2); font-variant-numeric: tabular-nums; font-size: 14px; }
.jwho { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 14px; min-width: 0; }
.jwho .avatar svg { width: 14px; height: 14px; }
.jwhat { min-width: 0; }
.jwhat .t { font-size: 14.5px; }
.jwhat .d { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.jchange { font-variant-numeric: tabular-nums; font-size: 14px; white-space: nowrap; }
.jchange .was { color: var(--ink-2); }
.jchange .arr { color: var(--ink-2); margin: 0 6px; }
.jchange .now { font-weight: 600; }
.jkind { justify-self: end; }
.jrow[hidden], .jgroup[hidden] { display: none; }

/* ---------- Настройки ---------- */
.settings-layout {
  display: grid; grid-template-columns: minmax(0, 800px) minmax(260px, 1fr); gap: 24px; align-items: start;
  grid-template-areas: "lot side" "depo side" "pw side" "demo side" "gap ." "danger .";
}
.ga-depo { grid-area: depo; }
.ga-lot { grid-area: lot; } .ga-pw { grid-area: pw; } .ga-demo { grid-area: demo; }
.ga-gap { grid-area: gap; } .ga-danger { grid-area: danger; } .ga-side { grid-area: side; }
.side-note { align-self: start; }
code { white-space: nowrap; font-size: .95em; }
.how { margin: 0; padding: 0 24px 20px 44px; color: var(--ink-2); font-size: 14px; }
.how li + li { margin-top: 12px; }
.how li::marker { color: var(--ink-2); font-weight: 600; }
.how b { color: var(--ink); font-weight: 600; }
.set-card .card-pad > * + * { margin-top: 16px; }
.set-row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.set-desc { color: var(--ink-2); font-size: 14px; max-width: 620px; }
.set-current { display: flex; align-items: baseline; gap: 8px; }
.set-current .v { font: 700 28px/1 var(--font-head); letter-spacing: -.02em; }
.set-current .u { color: var(--ink-2); }
.pw-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.demo-card { background: transparent; border: 1px dashed #CDBFAA; box-shadow: none; }
.demo-card .card-head h2 { font-size: 15px; color: var(--ink-2b); }
.demo-card .card-pad { padding-top: 4px; }
.demo-card .card-pad > * + * { margin-top: 14px; }
.demo-tag { font: 600 11px/1 var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2b); background: var(--sand-2); padding: 5px 8px; border-radius: 4px; }
.danger-zone { border-color: var(--terra-line); }
.danger-zone .card-head { border-bottom: 1px solid var(--terra-line); background: var(--terra-wash); border-radius: var(--r) var(--r) 0 0; padding-bottom: 18px; }
.danger-zone .card-head h2 { color: var(--terra-ink); display: flex; align-items: center; gap: 10px; }
.danger-zone .card-head h2 svg { width: 18px; height: 18px; }
.danger-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.danger-row .dt { font-weight: 600; }
.danger-row .dd { color: var(--ink-2); font-size: 14px; margin-top: 4px; max-width: 520px; }
.danger-gap { height: 24px; }

/* ---------- Вход ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 40px 16px; }
.login-card { width: min(420px, 100%); padding: 40px 36px 32px; }
.login-card .wordmark { font-size: 22px; }
.login-card h1 { font-size: 24px; line-height: 32px; margin: 28px 0 6px; letter-spacing: -.01em; }
.login-card .sub { color: var(--ink-2); font-size: 14.5px; margin-bottom: 24px; }
.login-card form > * + * { margin-top: 16px; }
.login-card .btn { height: 48px; font-size: 15.5px; margin-top: 24px; }
.login-hint { display: flex; gap: 10px; align-items: flex-start; margin-top: 20px; padding: 12px 14px; border-radius: 8px; background: var(--paper); border: 1px solid var(--line-soft); color: var(--ink-2b); font-size: 13.5px; }
.login-hint svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.login-foot { margin-top: 20px; text-align: center; color: var(--ink-2); font-size: 12.5px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 48px; }
.pw-wrap .icon-btn { position: absolute; right: 4px; top: 4px; }

/* ---------- Средства ниже суммы для расчёта долей (демо) ---------- */
.warn-strip {
  display: flex; align-items: center; gap: 12px; margin-bottom: 24px; padding: 12px 14px 12px 16px;
  border-radius: var(--r); background: var(--ochre-tint); border: 1px solid #EAD7AE; color: var(--ochre-ink); font-size: 14.5px;
}
.warn-strip > svg { width: 18px; height: 18px; flex: none; }
.warn-strip .ws-text { flex: 1; min-width: 0; }
.warn-strip .ws-text b { font-weight: 600; }
.warn-strip .btn { flex: none; border-color: #E3CB98; color: var(--ink); }

/* ---------- Сайт со второй ноды (демо) ---------- */
.banner-ochre { border-color: #EAD7AE; border-left-color: var(--ochre); }
.banner-ochre svg { color: var(--ochre-ink); }
.banner-ochre b { color: var(--ochre-ink); }
.is-stale .standby-banner { display: none; }
.standby-banner { display: none; }
.is-standby .standby-banner { display: flex; }
.is-stale.is-standby .standby-banner { display: none; }
.status-pill[data-state="standby"] { background: var(--ochre-tint); color: var(--ochre-ink); }
.status-pill[data-state="standby"] .dot { background: var(--ochre); box-shadow: 0 0 0 3px rgba(183, 134, 44, .2); }

/* ---------- Вход: неверный пароль ---------- */
.form-alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 8px;
  background: var(--terra-wash); border: 1px solid var(--terra-line); color: var(--terra-ink); font-size: 14px; font-weight: 500;
}
.form-alert svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.login-card .btn:disabled { opacity: .55; }

/* ---------- Сумма для расчёта долей ---------- */
.depo-table { max-height: 236px; overflow: auto; border: 1px solid var(--line-soft); border-radius: 8px; }
.depo-table .table th { position: sticky; top: 0; z-index: 1; padding-top: 8px; padding-bottom: 8px; }
.depo-table .table td { padding-top: 7px; padding-bottom: 7px; font-size: 13.5px; }
.depo-table .table th:first-child, .depo-table .table td:first-child { padding-left: 14px; }
.depo-table .table th:last-child, .depo-table .table td:last-child { padding-right: 14px; }
.depo-table .was { color: var(--ink-2); }
.depo-table .arr { color: var(--ink-2); margin: 0 6px; }
.depo-table .now { font-weight: 600; }
.depo-table .row-paused td { color: var(--ink-2); }

/* ---------- Вход ждёт, а донор на паузе ---------- */
.lock-line { display: flex; gap: 8px; align-items: flex-start; margin: -8px 24px 18px; color: var(--ochre-ink); font-size: 13.5px; font-weight: 500; }
.lock-line svg { width: 14px; height: 14px; flex: none; margin-top: 3px; }

/* ---------- Строка «Без донора» ---------- */
.row-nodonor td { background: var(--paper); }
.row-nodonor .donor-name { color: var(--ink); }
.nd-sub { display: block; max-width: 230px; color: var(--ink-2); font-size: 12.5px; line-height: 1.35; margin-top: 2px; font-weight: 400; }
.row-nodonor .c-go { text-align: right; }
.donor-title .chip-terra { font-size: 13px; }

/* ---------- Средняя ширина ---------- */
@media (max-width: 1240px) {
  .pb-long { display: none; }
  .pb-short { display: inline; }
  .topbar .wrap { gap: 20px; }
  .user-btn .uname { display: none; }
}
@media (max-width: 1100px) {
  :root { --pad: 24px; }
  .fig-value { font-size: 24px; }
  .fig-hero .fig-value { font-size: 40px; }
  .donor-meta .mult { flex-basis: 100%; }
  .donor-meta .mult::before { content: none; }
  .nav .lbl-long { display: none; }
  .nav .lbl-short { display: inline; }
  .status-pill .long { display: none; }
  .status-pill .short { display: inline; }
  .figures { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fig-hero { grid-column: 1 / -1; border-bottom: 1px solid var(--line-soft); }
  .fig-hero + .fig { border-left: 0; }
  .figures .fig:nth-child(n+3) { border-left: 1px solid var(--line-soft); }
  .figures { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-12 > [class*="span-"] { grid-column: 1 / -1; }
  .settings-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "lot" "depo" "pw" "side" "demo" "gap" "danger"; }
  .nav a { padding: 0 9px; font-size: 14.5px; }
  .jrow { grid-template-columns: 52px 140px minmax(0, 1fr) 180px; }
  .jkind { display: none; }
}

/* ---------- Телефон ---------- */
/* ---------- Планшет и телефон: компактная шапка, нижняя панель разделов ---------- */
@media (max-width: 1199px) {
  :root { --topbar-h: 56px; }
  .nav, .user-menu { display: none; }
  .topbar .wrap { gap: 10px; }
  .wordmark { font-size: 16px; letter-spacing: .06em; }
  .brand { flex-direction: column; align-items: flex-start; gap: 3px; }
  .proto-badge { height: auto; padding: 0; background: none; font-size: 10.5px; letter-spacing: .02em; color: var(--ink-2); }
  .pb-long { display: inline; }
  .pb-short { display: none; }
  .topbar-right { gap: 8px; }
  .status-pill { height: 32px; padding: 0 10px; font-size: 13px; gap: 7px; }
  .topbar .btn-pause { height: 32px; padding: 0 10px; font-size: 13.5px; }
  .topbar .btn-pause svg { width: 14px; height: 14px; }
  main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .site-foot { display: none; }
  .figures-4 { grid-template-columns: 1fr 1fr; }
  .figures-4 .fig:nth-child(even) { border-left: 1px solid var(--line-soft) !important; }
  .figures-4 .fig:nth-child(odd) { border-left: 0 !important; }
  .figures-4 .fig:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 55;
    height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  }
  .tabbar a, .tabbar button {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--ink-2); text-decoration: none; font-size: 11.5px; font-weight: 500; border: 0; background: none; cursor: pointer; padding: 0;
  }
  .tabbar .ti { display: grid; place-items: center; width: 52px; height: 28px; border-radius: 14px; }
  .tabbar svg { width: 21px; height: 21px; }
  .tabbar [aria-current="page"] { color: var(--ink); font-weight: 600; }
  .tabbar [aria-current="page"] .ti { background: var(--sand-2); }
  .tabbar .tcount { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px; background: var(--terra); color: #fff; font: 700 10.5px/17px var(--font); text-align: center; box-shadow: 0 0 0 2px #fff; }
  .toast-host { left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); }
  .toast { min-width: 0; max-width: none; }
}

@media (max-width: 719px) {
  :root { --pad: 16px; }
  body { font-size: 15px; }
  .status-pill .long { display: none; }
  .status-pill .short { display: inline; }
  main { padding-top: 20px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
  .page-head h1 { font-size: 24px; line-height: 30px; }
  .page-head .page-meta { order: 0; }
  .grid-2, .grid-12 { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .grid-12 > [class*="span-"] { grid-column: auto; }
  .card-pad { padding: 18px 16px; }
  .card-head { padding: 16px 16px 12px; }
  .card-foot { padding: 12px 16px; }
  .notice { margin-bottom: 16px; padding: 12px 14px; font-size: 14.5px; }
  .stale-banner { margin-bottom: 16px; padding: 12px 14px; font-size: 14px; align-items: flex-start; }

  .figures, .figures-4 { grid-template-columns: 1fr 1fr; }
  .fig { padding: 16px; }
  .fig-hero { grid-column: 1 / -1; border-bottom: 1px solid var(--line-soft); }
  .fig + .fig { border-left: 0; }
  .figures .fig:nth-child(n+2) { border-left: 0; }
  .figures .fig:nth-child(odd):not(.fig-hero) { border-left: 1px solid var(--line-soft); }
  .figures .fig:nth-child(n+4) { border-top: 1px solid var(--line-soft); }
  .fig-label { font-size: 13px; margin-bottom: 6px; }
  .fig-value { font-size: 21px; }
  .fig-hero .fig-value { font-size: 36px; }
  .fig-sub { font-size: 12.5px; white-space: normal; }
  .meters { grid-template-columns: 1fr; gap: 16px; margin-top: 16px; }
  .meter { padding: 16px; }
  .meter-value { font-size: 19px; }

  .chart-legend { padding: 0 16px 10px; gap: 6px 14px; font-size: 12.5px; }
  .chart { padding: 0 12px 14px 4px; }
  .cgrid { grid-template-columns: 50px minmax(0, 1fr); }
  .yaxis { font-size: 11px; }
  .yaxis span { right: 8px; }
  .plot-line { height: 168px; }
  .plot-bars { height: 72px; margin-top: 24px; }
  .plot-donor { height: 200px; }
  .xaxis { font-size: 11px; }
  .xaxis .minor { display: none; }
  .end-label { display: none; }
  .chart-table { padding: 0 16px 16px; }
  .seg-ctl button { padding: 0 11px; height: 30px; }

  .table { font-size: 13.5px; }
  .table th { padding: 9px 12px; }
  .table td { padding: 12px; }
  .table th:first-child, .table td:first-child { padding-left: 16px; }
  .table th:last-child, .table td:last-child { padding-right: 16px; }
  .sticky-first th:first-child, .sticky-first td:first-child { position: sticky; left: 0; z-index: 1; background: #fff; box-shadow: 1px 0 0 var(--line-soft); }
  .sticky-first .row-paused td:first-child { background: #fff; }

  /* Таблица доноров на главной превращается в список */
  .donors-table thead { display: none; }
  .donors-table, .donors-table tbody, .donors-table tfoot { display: block; }
  .donors-table tr {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 3px 10px; padding: 11px 16px;
    grid-template-areas: "name name float" "share grid fixed" "loss loss loss";
    border-bottom: 1px solid var(--line-soft); align-items: baseline;
  }
  .donors-table tbody tr:last-child { border-bottom: 0; }
  .donors-table td { display: block; padding: 0 !important; border: 0 !important; background: none !important; }
  .donors-table td.c-name { grid-area: name; }
  .donors-table td.c-float { grid-area: float; font-weight: 600; font-size: 15px; }
  .donors-table td.c-share { grid-area: share; }
  .donors-table td.c-grid { grid-area: grid; font-size: 13px; color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .donors-table td.c-grid.no-grid { visibility: hidden; }
  .donors-table td.c-fixed { grid-area: fixed; font-size: 12.5px; }
  .donors-table td.c-loss { grid-area: loss; display: none; text-align: left; margin-top: 4px; font-size: 12.5px; }
  .donors-table td.c-loss.has-loss { display: block; }
  .donors-table td.c-go { display: none; }
  .donors-table td[data-m]::before { content: attr(data-m); color: var(--ink-2); font-weight: 400; margin-right: 4px; font-size: 12.5px; }
  .donors-table .share-cell { justify-content: flex-start; }
  .donors-table .share-cell .num { font-size: 13px; color: var(--ink-2); }
  .donors-table .minibar { display: none; }
  .donors-table .grid-cell .sym { font-weight: 500; color: var(--ink); }
  .donors-table .lossgrids { justify-content: flex-start; }
  .donors-table .lossgrids .bad { height: 20px; min-width: 20px; }
  .donors-table tfoot tr { background: var(--paper); border-radius: 0 0 var(--r) var(--r); border-bottom: 0; }
  .donors-table tfoot td.c-share, .donors-table tfoot td.c-grid { display: none; }
  .donors-table .row-loss td:first-child { box-shadow: none; }
  .donors-table .row-nodonor { background: var(--paper); }
  .donors-table .row-nodonor td.c-share { display: none; }
  .donors-table .row-nodonor td.c-grid { grid-column: 1 / 3; grid-row: 2; }
  .donors-table .row-nodonor .nd-sub { max-width: none; }
  .donors-table .row-nodonor td.c-go { display: block; grid-area: loss; justify-self: end; margin-top: 6px; }
  .donors-table .row-nodonor .nd-sub { font-size: 12px; }
  .warn-strip { flex-wrap: wrap; align-items: flex-start; margin-bottom: 16px; font-size: 14px; }
  .warn-strip .ws-text { flex-basis: calc(100% - 30px); }
  .warn-strip .btn { margin-left: 30px; }
  .lock-line { margin: -6px 16px 14px; }
  .depo-table th:nth-child(2), .depo-table td:nth-child(2) { display: none; }
  .depo-table { max-height: 200px; }
  .paused-chip { height: 20px; padding: 0 7px; font-size: 11.5px; }

  .crumbs { margin-bottom: 8px; }
  .donor-head { flex-direction: column; gap: 16px; margin-bottom: 16px; }
  .donor-title h1 { font-size: 28px; line-height: 34px; }
  .donor-meta { font-size: 13px; }
  .donor-meta .mult { flex-basis: 100%; }
  .donor-meta .mult::before { content: none; }
  .grid-summary { display: block; }
  .grid-summary > span { display: block; }
  .grid-summary span + span::before { content: none; }
  .card-flex .cgrid { grid-template-rows: minmax(200px, 1fr) auto; }
  .deals-table thead, .grids-table thead, .decided thead { display: none; }
  .deals-table, .deals-table tbody, .grids-table, .grids-table tbody, .decided, .decided tbody { display: block; }
  .deals-table tr {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 10px; align-items: center;
    grid-template-areas: "lot price res" "open open act"; padding: 12px 16px; border-bottom: 1px solid var(--line-soft);
  }
  .deals-table td, .grids-table td { display: block; padding: 0 !important; border: 0 !important; }
  .deals-table .c-lot { grid-area: lot; font-weight: 600; text-align: left; }
  .deals-table .c-price { grid-area: price; text-align: left; color: var(--ink-2); }
  .deals-table .c-price::before { content: attr(data-m) " "; }
  .deals-table .c-res { grid-area: res; font-weight: 600; }
  .deals-table .c-open { grid-area: open; color: var(--ink-2); font-size: 13px; }
  .deals-table .c-act { grid-area: act; }
  .grids-table tr {
    display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 3px 6px; align-items: baseline;
    grid-template-areas: "ins ins ins res" "o c n n"; padding: 11px 16px; border-bottom: 1px solid var(--line-soft);
  }
  .grids-table tr[hidden] { display: none; }
  .grids-table .row-loss td:first-child { box-shadow: none; }
  .grids-table .row-loss { box-shadow: inset 3px 0 0 var(--terra); background: var(--terra-wash); }
  .grids-table td { background: none !important; }
  .grids-table .c-ins { grid-area: ins; font-weight: 500; }
  .grids-table .c-res { grid-area: res; }
  .grids-table .c-o { grid-area: o; color: var(--ink-2); font-size: 13px; }
  .grids-table .c-c { grid-area: c; color: var(--ink-2); font-size: 13px; }
  .grids-table .c-c::before { content: attr(data-m) " "; }
  .grids-table .c-n { grid-area: n; text-align: left; color: var(--ink-2); font-size: 13px; }
  .grids-table .c-n::before { content: "· "; }
  .decided tr { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 0; row-gap: 4px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
  .decided tr::after { content: ""; flex-basis: 100%; order: 4; height: 0; }
  .decided tr:last-child { border-bottom: 0; }
  .decided td { display: block; padding: 0 !important; border: 0 !important; }
  .decided .c-d { order: 1; }
  .decided .c-s { order: 2; }
  .decided .c-s::before { content: "\00a0·\00a0"; color: var(--ink-2); }
  .decided .c-dec { order: 3; margin-left: auto; padding-left: 8px !important; align-self: center; }
  .decided .c-t { order: 5; }
  .decided .c-who { order: 6; }
  .decided .c-det { order: 7; flex: 1 1 0; min-width: 0; }
  .decided .c-t, .decided .c-who, .decided .c-det { font-size: 13px; color: var(--ink-2); line-height: 1.5; }
  .decided .c-who::before, .decided .c-det::before { content: "\00a0·\00a0"; }
  .decided .c-who.empty { display: none; }
  .l-long { display: none; }
  .l-short { display: inline; }
  .dfacts { grid-template-columns: 1.15fr 1fr 1fr; }
  .dfacts > div { padding: 12px; }
  .dfacts > div:first-child { padding-left: 16px; }
  .dfacts > div:nth-child(3) { grid-column: auto; border-left: 1px solid var(--line-soft); border-top: 0; }
  .dfacts .fv small { display: block; margin: 2px 0 0; font-size: 12.5px; }
  .dfacts .fv small .sep { display: none; }
  .shift .sl { display: block; font-size: 12.5px; font-weight: 500; margin-bottom: 2px; }
  .cmp-table th:first-child, .cmp-table td:first-child { max-width: 156px; min-width: 132px; white-space: normal; }
  .cmp-table .donor-cell { gap: 4px 8px; }
  .cmp-table .donor-name { white-space: normal; }
  .flag-legend { display: block; }
  .fl-item { display: block; margin-bottom: 10px; line-height: 1.6; }
  .fl-item .chip { margin-right: 6px; vertical-align: 1px; }
  .cmp-table .flags .chip { height: auto; min-height: 20px; padding: 3px 8px; font-size: 11px; white-space: normal; line-height: 1.25; }
  .donor-actions { align-items: stretch; width: 100%; }
  .donor-actions .btns { width: 100%; }
  .donor-actions .btns .btn { flex: 1; padding: 0 10px; }
  .danger-sep { justify-content: center; }
  .grid-hero { padding: 0 16px; }
  .grid-hero .gname { font-size: 19px; }
  .grid-hero .gres .v { font-size: 22px; }
  .grid-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 14px 16px 16px; gap: 12px; }
  .ladder { margin: 0 16px 16px; }
  .other-deals { padding: 12px 16px 14px; }
  .reason-list { padding: 0 16px 6px; }
  .deals-table .btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }

  .decision-grid { grid-template-columns: 1fr; gap: 16px; }
  .decision-top { padding: 16px 16px 12px; }
  .decision-top h2 { font-size: 18px; line-height: 24px; }
  .dfacts .fv { font-size: 15.5px; }
  .shift { padding: 14px 16px; }
  .partial { margin: 0 16px 4px; }
  .decision-foot { padding: 14px 16px 16px; }
  .pause-hint { padding: 0 16px 14px; }

  .filters { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(-1 * var(--pad)) 16px; padding: 0 var(--pad); scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .jday { padding: 12px 16px 8px; }
  .jrow { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "who time" "what what" "change change"; gap: 6px 12px; padding: 12px 16px; }
  .jtime { grid-area: time; justify-self: end; font-size: 13px; }
  .jwho { grid-area: who; font-size: 13.5px; }
  .jwho .avatar { width: 24px; height: 24px; font-size: 11px; }
  .jwhat { grid-area: what; }
  .jchange { grid-area: change; font-size: 13.5px; }
  .jchange:empty { display: none; }
  .jkind { display: none; }

  .pw-grid { grid-template-columns: 1fr; }
  .settings-layout { gap: 16px; }
  .how { padding: 0 16px 16px 36px; }
  .danger-row { flex-direction: column; align-items: stretch; gap: 16px; }
  .set-row .btn { flex: 1; }

  dialog.modal {
    width: 100%; max-width: none; margin: auto 0 0; border-radius: 16px 16px 0 0;
    max-height: calc(100vh - 24px); padding-bottom: env(safe-area-inset-bottom);
  }
  dialog.modal[open] { animation: sheet .2s ease-out; }
  @keyframes sheet { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
  .modal-head { padding: 20px 16px 4px; }
  .modal-head h2 { font-size: 19px; line-height: 26px; }
  .modal-body { padding: 8px 16px 4px; }
  .modal-foot { padding: 16px 16px 20px; flex-direction: column-reverse; gap: 10px; }
  .modal-foot .btn { width: 100%; height: 46px; }
  .sheet-grip { width: 36px; height: 4px; border-radius: 2px; background: var(--sand-3); margin: 8px auto 0; }

}
@media (min-width: 720px) { .sheet-grip { display: none; } .only-mobile { display: none !important; } }
@media (max-width: 719px) { .only-desktop { display: none !important; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Live account (S5): approved Atlas composition. */
.account-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px;
  grid-template-areas: "heading heading" "hero metrics" "chart allocation" "donors donors";
  align-items: start;
}
.account-content { display: contents; }
.account-layout > *, .account-content > * { min-width: 0; }
.account-heading { grid-area: heading; }
.account-head { display: block; margin: 0 0 2px; }
.account-head h1 { font-family: var(--font); font-size: 28px; font-weight: 600; letter-spacing: -.035em; }
.account-head .page-meta { margin-top: 6px; white-space: normal; font-size: 12px; }
.account-heading .stale-banner { display: flex; margin: 16px 0 0; }
#banners .stale-banner, #errors .stale-banner { display: flex; }
.account-hero { grid-area: hero; display: flex; align-items: center; gap: 24px; padding: 24px 26px; min-height: 166px; }
.account-hero-main { min-width: 0; }
.account-hero .fig { padding: 0; }
.account-hero .fig-label { font-weight: 400; font-size: 13px; margin-bottom: 8px; }
.account-hero .fig-sub:empty { display: none; }
.account-amount { font: 400 clamp(30px, 4vw, 53px)/1.12 var(--font); letter-spacing: -.045em; overflow-wrap: anywhere; white-space: normal; }
.account-gain { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; }
.account-return { padding: 4px 7px; border-radius: 5px; background: var(--sand-2); color: inherit; font: 500 12px/1.25 var(--font); letter-spacing: 0; }
.account-gain.pos .account-return { background: var(--olive-tint); }
.account-gain.neg .account-return { background: var(--terra-tint); }
.account-start { margin-left: auto; max-width: 220px; text-align: right; color: var(--ink-2); font-size: 12px; line-height: 1.7; }
.account-start b { display: block; color: var(--ink); font-size: 16px; font-weight: 500; margin: 3px 0; }
.account-metrics { grid-area: metrics; padding-top: 1px; }
.account-metrics .fig { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 3px 10px; padding: 13px 0; border: 0; border-bottom: 1px solid var(--line); }
.account-metrics .fig-label { font-size: 13px; font-weight: 400; margin: 0; }
.account-metrics .fig-value { font: 500 17px/1.4 var(--font); letter-spacing: -.01em; }
.account-metrics .fig-sub { flex-basis: 100%; margin: 0; font-size: 11px; }
.account-chart-card { grid-area: chart; }
.account-chart-card .card-head { padding: 20px 24px 14px; }
.account-layout h2 { font: 500 15px/1.5 var(--font); letter-spacing: -.01em; }
.account-chart-card .chart-legend { font-size: 12px; }
.account-chart-card .seg-ctl { background: transparent; padding: 0; }
.account-chart-card .seg-ctl button { min-height: 44px; padding: 0 10px; font-size: 12px; }
.account-chart-card .seg-ctl button[aria-pressed="true"] { background: var(--sand); box-shadow: none; }
.account-allocation { grid-area: allocation; background: var(--sand-2); border-radius: var(--r); padding: 22px; }
.account-allocation h2 { margin-bottom: 20px; }
.allocation-bar { width: 100%; height: 9px; border-radius: 3px; overflow: hidden; margin-bottom: 17px; background: var(--line); }
.allocation-trading { fill: var(--accent); }
.allocation-paused { fill: var(--taupe); }
.allocation-reserve { fill: #CCD9E0; }
.allocation-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 12px; font-size: 13px; }
.allocation-row b { font-weight: 500; }
.account-exposure { margin-top: 22px; padding-top: 18px; border-top: 1px solid #CFDCE4; font-size: 12px; }
.account-exposure b { display: block; font-size: 27px; line-height: 1.4; font-weight: 500; margin: 7px 0; }
.account-exposure p { color: var(--ink-2); line-height: 1.7; }
.account-table-card { grid-area: donors; overflow: hidden; }
.account-table-card .card-head { padding: 20px 24px; }
.account-table-card .hint { font-size: 12px; }
.account-donors { width: 100%; min-width: 730px; }
.account-donors th { font-size: 12px; font-weight: 400; }
.account-donors td { vertical-align: top; padding-top: 15px; padding-bottom: 15px; font-size: 13px; }
.account-donors th, .account-donors td { text-align: right; }
.account-donors th:first-child, .account-donors td:first-child { text-align: left; }
.account-donors td:first-child > a { text-decoration: none; font-weight: 500; }
.account-donors td:first-child > a:hover { text-decoration: underline; text-underline-offset: 4px; }
.donor-initial { display: inline-grid; place-items: center; width: 27px; height: 27px; margin: -3px 10px -3px 0; border-radius: 8px; background: var(--sand-2); color: var(--ink-2); font-size: 11px; }
.account-donors summary, .chart-data summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.cell-note { display: block; color: var(--ink-2); margin-top: 4px; }
.account-position { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 8px 0; }
.account-chart { padding: 0 20px 20px; }
.account-plot { display: block; width: 100%; height: auto; overflow: visible; }
.account-plot > path { stroke: var(--accent); stroke-width: 2.8; }
.chart-axis { font: 14px Onest, sans-serif; fill: var(--ink-2); }
.chart-data { margin-top: 12px; }
.chart-data table { width: 100%; }
.empty-state { padding: 18px; color: var(--ink-2); }
.action-result { font-weight: 600; }
.user-menu { display: flex; align-items: center; gap: 8px; }
.topbar .user-menu { color: var(--header-muted); font-size: 13px; }
.topbar .btn { background: transparent; border-color: #6A8294; color: var(--header-ink); min-height: 44px; }
.topbar .btn:hover { background: #29485D; border-color: var(--header-muted); }
.topbar .btn:disabled { opacity: .7; }
.topbar .status-pill[data-state="ok"] { background: transparent; color: #BFE0D2; font-size: 12px; padding: 0; }
.topbar .status-pill[data-state="ok"]::before { content: ""; width: 7px; height: 7px; background: #8DC1B0; border-radius: 50%; flex: none; }
.status-pill[data-state="unknown"] { color: var(--ochre-ink); background: var(--ochre-tint); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 800px) {
  .account-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; grid-template-areas: "heading" "hero" "metrics" "chart" "allocation" "donors"; }
  .account-hero { padding: 22px; min-height: 0; }
  .account-amount { font-size: clamp(30px, 8vw, 45px); }
  .account-start { font-size: 11px; max-width: 165px; }
  .account-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .account-metrics .fig { display: block; padding: 0 0 10px; }
  .account-metrics .fig-label { font-size: 12px; white-space: normal; }
  .account-metrics .fig-value { font-size: 15px; margin-top: 5px; white-space: normal; overflow-wrap: anywhere; }
  .account-metrics .fig-sub { margin-top: 5px; }
  .account-chart-card .card-head { gap: 10px; flex-wrap: wrap; padding: 18px 16px 8px; }
  .account-chart-card .seg-ctl { flex-wrap: wrap; }
  .account-chart-card .chart-legend { padding: 0 16px 12px; line-height: 1.6; }
  .account-allocation { padding: 20px; }
  .account-exposure { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; margin-top: 16px; padding-top: 14px; }
  .account-exposure b { font-size: 22px; margin: 0; }
  .account-exposure p { flex-basis: 100%; }
}
@media (max-width: 600px) {
  .account-chart { padding: 0 10px 12px; }
  .account-hero { flex-wrap: wrap; gap: 18px; }
  .account-start { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; flex-basis: 100%; max-width: none; margin: 0; padding-top: 14px; border-top: 1px solid var(--line); text-align: left; }
  .account-start b { margin: 0; font-size: 13px; }
  .account-start > span:last-child { flex-basis: 100%; }
  .account-hero .fig-sub:empty { display: none; }
  .chart-axis { font-size: 32px; }
  .account-plot > path { stroke-width: 4; }
  .user-menu .uname { display: none; }
  .btn-pause { max-width: 155px; white-space: normal; }
}
@media (max-width: 1199px) {
  :root { --topbar-h: 112px; }
  .topbar .wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; height: auto; min-height: var(--topbar-h); padding-top: 8px; padding-bottom: 8px; }
  .topbar .brand { grid-column: 1; grid-row: 1; }
  .topbar-right { display: contents; }
  .topbar .status-pill { grid-column: 1; grid-row: 2; justify-self: start; max-width: 100%; }
  .topbar .btn-pause { grid-column: 2; grid-row: 2; justify-self: end; min-height: 44px; font-size: 12px; }
  .topbar .user-menu { grid-column: 2; grid-row: 1; justify-self: end; }
  .topbar .user-menu .uname { display: none; }
  .topbar .user-menu .btn { font-size: 12px; padding: 0 10px; min-height: 44px; }
}
.chart-readout { min-height: 2.8em; font-size: 13px; color: var(--ink); padding: 0 12px; }
.account-plot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
