/* Layout: top bar → period toolbar → KPI cards → (status table | teams) → tabbed list. Teal-tinted neutrals, one accent. */
:root {
  --bg: #F3F6F6;
  --surface: #FFFFFF;
  --surface-2: #F7F9F9;
  --line: #E1E8E7;
  --line-strong: #CBD6D5;
  --fg: #0E1E1D;
  --fg-2: #33504D;
  --muted: #667B79;
  --accent: #0F766E;
  --accent-fg: #FFFFFF;
  --accent-soft: #E3F3F1;
  --focus: #14B8A6;
  --shadow: 0 1px 2px rgba(14, 30, 29, .06), 0 1px 1px rgba(14, 30, 29, .03);
  --shadow-lg: 0 20px 50px -12px rgba(14, 30, 29, .28);

  /* status colors: text / background */
  --s-launch: #047857;   --s-launch-bg: #DDF5EA;
  --s-proc: #A15C07;     --s-proc-bg: #FDF0D5;
  --s-none: #52606D;     --s-none-bg: #EBEFF2;
  --s-stop: #B42318;     --s-stop-bg: #FDE3E1;
  --s-extra: #0E7490;    --s-extra-bg: #DDF3F8;
  --s-filled: #1D4ED8;   --s-filled-bg: #E1EAFE;
  --s-nolaunch: #BE185D; --s-nolaunch-bg: #FCE4EF;
  --s-daily: #6D28D9;    --s-daily-bg: #EEE6FD;
  --s-notgiven: #9A3412; --s-notgiven-bg: #FDEADB;

  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --r: 12px;
  --r-sm: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C1312; --surface: #131C1B; --surface-2: #17211F; --line: #22302E; --line-strong: #31423F;
    --fg: #E4EEEC; --fg-2: #B9CBC8; --muted: #869A97; --accent: #2CC4B0; --accent-fg: #062A26; --accent-soft: #123532;
    --focus: #5EEAD4; --shadow: 0 1px 2px rgba(0,0,0,.35); --shadow-lg: 0 24px 60px -12px rgba(0,0,0,.7);
    --s-launch: #4ADE9B; --s-launch-bg: #0F2E22; --s-proc: #F5B94A; --s-proc-bg: #33260C; --s-none: #A7B4BF; --s-none-bg: #1F2830;
    --s-stop: #F8857B; --s-stop-bg: #3A1513; --s-extra: #5ACFE6; --s-extra-bg: #0C2C33; --s-filled: #8AB0FF; --s-filled-bg: #17244A;
    --s-nolaunch: #F48BBE; --s-nolaunch-bg: #3A1228; --s-daily: #B79BFA; --s-daily-bg: #261A44; --s-notgiven: #FBA672; --s-notgiven-bg: #3A1F0E;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0C1312; --surface: #131C1B; --surface-2: #17211F; --line: #22302E; --line-strong: #31423F;
  --fg: #E4EEEC; --fg-2: #B9CBC8; --muted: #869A97; --accent: #2CC4B0; --accent-fg: #062A26; --accent-soft: #123532;
  --focus: #5EEAD4; --shadow: 0 1px 2px rgba(0,0,0,.35); --shadow-lg: 0 24px 60px -12px rgba(0,0,0,.7);
  --s-launch: #4ADE9B; --s-launch-bg: #0F2E22; --s-proc: #F5B94A; --s-proc-bg: #33260C; --s-none: #A7B4BF; --s-none-bg: #1F2830;
  --s-stop: #F8857B; --s-stop-bg: #3A1513; --s-extra: #5ACFE6; --s-extra-bg: #0C2C33; --s-filled: #8AB0FF; --s-filled-bg: #17244A;
  --s-nolaunch: #F48BBE; --s-nolaunch-bg: #3A1228; --s-daily: #B79BFA; --s-daily-bg: #261A44; --s-notgiven: #FBA672; --s-notgiven-bg: #3A1F0E;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; }
h2 { font-size: 15px; letter-spacing: -.005em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brand-lg { font-size: 22px; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; background: var(--accent); flex: none;
  background-image:
    linear-gradient(var(--accent-fg), var(--accent-fg)), linear-gradient(var(--accent-fg), var(--accent-fg)), linear-gradient(var(--accent-fg), var(--accent-fg));
  background-size: 3px 7px, 3px 11px, 3px 15px;
  background-position: 7px 13px, 12px 9px, 17px 5px;
  background-repeat: no-repeat;
}
.brand-lg .brand-mark { width: 32px; height: 32px; background-size: 4px 9px, 4px 14px, 4px 19px; background-position: 8px 16px, 14px 11px, 20px 6px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: var(--r-sm); border: 1px solid transparent; background: none; cursor: pointer; font-weight: 500; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-ghost { border-color: var(--line-strong); background: var(--surface); }
.btn-ghost:hover { border-color: var(--muted); }
.btn-icon { width: 36px; padding: 0; color: var(--fg-2); }
.btn-icon:hover { background: var(--surface-2); color: var(--fg); }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: progress; }

.select {
  height: 36px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); min-width: 0;
}
.select-lg { height: 40px; font-weight: 600; padding-right: 28px; }
.grow { flex: 1 1 220px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 32px 28px; display: grid; gap: 14px; box-shadow: var(--shadow-lg);
}
.login-card p { margin: -6px 0 6px; }
.field { display: grid; gap: 6px; font-weight: 500; font-size: 13px; color: var(--fg-2); }
.field input { height: 42px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); font-size: 15px; color: var(--fg); }
.form-error { margin: 0; color: var(--s-stop); font-size: 13px; }

/* ---------- shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px max(16px, calc((100vw - 1320px) / 2)); background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
}
.topbar-meta { color: var(--muted); font-size: 12.5px; flex: 1 1 auto; min-width: 0; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.banner { background: var(--s-proc-bg); color: var(--s-proc); padding: 10px 16px; text-align: center; font-size: 13px; font-weight: 500; }
.main { max-width: 1320px; margin: 0 auto; padding: 20px 16px 48px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.main > *, #dash > * { min-width: 0; }
#dash { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.period { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.custom-range { display: flex; align-items: center; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--fg-2); font-size: 13px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.count-chip { display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 12px; text-align: center; }

/* ---------- KPI cards ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 18px 16px; box-shadow: var(--shadow);
  display: grid; gap: 14px; min-width: 0;
}
.kpi-head { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; flex: none; }
.kpi-name { font-weight: 600; font-size: 15px; }
.kpi-sub { color: var(--muted); font-size: 12px; }
.kpi-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.kpi-num b { display: block; font-size: 28px; line-height: 1.05; font-weight: 700; letter-spacing: -.02em; }
.kpi-num span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.25; }
.kpi-num.work b { color: var(--s-launch); }
.kpi-num.stop b { color: var(--s-stop); }
.stack { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--surface-2); gap: 2px; }
.stack i { display: block; height: 100%; min-width: 3px; }
.kpi-total { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.kpi-total .kpi-sub, .kpi-total .kpi-num span { color: color-mix(in srgb, var(--bg) 65%, transparent); }
.kpi-total .kpi-num.work b { color: color-mix(in srgb, var(--s-launch) 55%, var(--bg)); }
.kpi-total .kpi-num.stop b { color: color-mix(in srgb, var(--s-stop) 55%, var(--bg)); }
.kpi-total .stack { background: color-mix(in srgb, var(--bg) 15%, transparent); }
.kpi-total .avatar { background: var(--accent); color: var(--accent-fg); }

/* ---------- panels ---------- */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 960px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; overflow: hidden; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 18px 10px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-weight: 600; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap;
}
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; }
.tbl-summary td:first-child, .tbl-summary th:first-child { padding-left: 18px; }
.tbl-summary td:last-child, .tbl-summary th:last-child { padding-right: 18px; }
.tbl-summary tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line-strong); }
.tbl-summary .zero { color: var(--line-strong); }
.share { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.share-bar { width: 90px; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; flex: none; }
.share-bar i { display: block; height: 100%; border-radius: 99px; }
.share em { font-style: normal; min-width: 44px; text-align: right; color: var(--fg-2); }

/* status pill */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 99px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
  color: var(--c); background: var(--cb);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
select.pill { border: 0; appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 22px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 12px) 52%, calc(100% - 8px) 52%; background-size: 4px 4px; background-repeat: no-repeat; background-color: var(--cb); }
select.pill option { color: var(--fg); background: var(--surface); }
.manual { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; font-size: 11px; color: var(--muted); }
.manual button { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-size: 11px; text-decoration: underline; }

/* list table */
.tabs { display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  border: 0; background: none; padding: 10px 12px 12px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center;
}
.tab:hover { color: var(--fg); }
.tab[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }
.tab b { font-weight: 600; font-size: 11.5px; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); color: var(--fg-2); }
.tab[aria-selected="true"] b { background: var(--accent-soft); color: var(--accent); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.filters .select { flex: 0 1 180px; }
.filters .grow { flex: 1 1 240px; }
.table-scroll { max-height: 70vh; overflow: auto; }
.tbl-list th { position: sticky; top: 0; z-index: 1; }
.tbl-list td { font-size: 13px; }
.tbl-list tbody tr:hover td { background: var(--surface-2); }
.tbl-list .c-date { white-space: nowrap; color: var(--fg-2); }
.tbl-list .c-offer { min-width: 260px; max-width: 360px; }
.tbl-list .c-offer b { display: block; font-weight: 600; }
.tbl-list .c-offer span { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl-list .c-team { min-width: 170px; }
.tbl-list .c-cap { white-space: nowrap; font-weight: 600; }
.tbl-list .c-comment { min-width: 220px; max-width: 320px; color: var(--fg-2); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
tr.open .clamp { -webkit-line-clamp: unset; }
.geo { display: inline-block; font-weight: 700; font-size: 12px; letter-spacing: .04em; padding: 2px 6px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line); }
.src { font-size: 12px; color: var(--fg-2); }
.tier { display: inline-block; margin-left: 6px; font-size: 10.5px; font-weight: 700; padding: 0 5px; border-radius: 4px; vertical-align: 1px; }
.tier-A { background: var(--s-launch-bg); color: var(--s-launch); }
.tier-B { background: var(--s-filled-bg); color: var(--s-filled); }
.tier-C { background: var(--s-daily-bg); color: var(--s-daily); }
.mgr { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.mgr i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.nodate { color: var(--s-proc); font-weight: 600; font-size: 12px; }
.list-foot { padding: 10px 14px; margin: 0; border-top: 1px solid var(--line); }
.empty-row td { text-align: center; padding: 40px 12px; color: var(--muted); }

/* teams list */
.teams { list-style: none; margin: 0; padding: 4px 18px 16px; display: grid; gap: 10px; }
.teams li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; }
.teams .t-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.teams .t-n { font-weight: 700; }
.teams .t-bar { grid-column: 1 / -1; display: flex; height: 6px; border-radius: 99px; overflow: hidden; background: var(--surface-2); gap: 1px; }
.teams .t-bar i { display: block; height: 100%; }

/* empty */
.empty { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r); padding: 48px 20px; text-align: center; display: grid; justify-items: center; gap: 10px; }
.empty p { max-width: 460px; margin: 0 0 8px; }
.empty-art { display: flex; align-items: flex-end; gap: 6px; height: 46px; margin-bottom: 8px; }
.empty-art span { width: 12px; border-radius: 4px; background: var(--accent-soft); border: 1px solid var(--line-strong); }
.empty-art span:nth-child(1) { height: 40%; } .empty-art span:nth-child(2) { height: 70%; } .empty-art span:nth-child(3) { height: 100%; background: var(--accent); border-color: var(--accent); }

/* modal & toast */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(6, 14, 13, .5); display: grid; place-items: center; padding: 16px; }
.modal-card { width: 100%; max-width: 560px; background: var(--surface); border-radius: 16px; padding: 24px; box-shadow: var(--shadow-lg); display: grid; gap: 16px; border: 1px solid var(--line); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.diff { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.diff div { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; }
.diff b { display: block; font-size: 22px; }
.diff span { font-size: 12px; color: var(--muted); }
.warn { background: var(--s-proc-bg); color: var(--s-proc); border-radius: var(--r-sm); padding: 10px 12px; font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 500; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px); }
.toast.err { background: var(--s-stop); color: #fff; }

@media (max-width: 640px) {
  .topbar-meta { order: 3; flex-basis: 100%; }
  .topbar-actions { margin-left: auto; }
  .btn-ghost span { display: none; }
  .kpi-num b { font-size: 24px; }
  .filters .select { flex: 1 1 140px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- upload modal extras ---------- */
.modal-actions { align-items: center; flex-wrap: wrap; }
.spacer { flex: 1 1 auto; }
.btn-link { padding: 0 4px; color: var(--s-stop); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.btn-link:hover { filter: brightness(1.2); }
.diff-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 480px) { .diff-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- notes column ---------- */
.tbl-list tbody tr[data-key] { cursor: pointer; }
.tbl-list .c-notes { min-width: 170px; max-width: 240px; color: var(--fg-2); }
.note-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 1px 7px 1px 5px; border-radius: 99px; margin-bottom: 3px; }
.note-chip svg { width: 13px; height: 13px; }
.note-add { font-size: 12px; color: var(--muted); opacity: 0; transition: opacity .15s; }
.tbl-list tbody tr:hover .note-add { opacity: 1; }

/* ---------- drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 40; background: rgba(6, 14, 13, .38); display: flex; justify-content: flex-end; }
.drawer-panel {
  width: min(520px, 100%); height: 100%; overflow-y: auto; background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg); padding: 20px 22px 32px; display: grid; align-content: start; gap: 16px;
  animation: slideIn .18s ease-out;
}
@keyframes slideIn { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.dr-head { display: flex; gap: 12px; align-items: flex-start; }
.dr-title { flex: 1; min-width: 0; }
.dr-title h2 { font-size: 19px; line-height: 1.25; }
.dr-title p { margin: 4px 0 0; }
.dr-status { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.dr-status .manual { margin-left: 0; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin: 0; padding: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); }
.facts dt { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 2px; }
.facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.dr-full { overflow-wrap: anywhere; margin-top: -6px; }
.dr-sec { display: grid; gap: 10px; }
.dr-sec h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-2); display: flex; align-items: center; gap: 8px; }
blockquote { margin: 0; padding: 10px 12px; border-left: 3px solid var(--line-strong); background: var(--surface-2); border-radius: 0 var(--r-sm) var(--r-sm) 0; white-space: pre-wrap; }
blockquote span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 2px; }
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.notes li { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; }
.notes li.muted { border-style: dashed; text-align: center; }
.n-meta { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; }
.n-meta span { color: var(--muted); }
.n-meta button { margin-left: auto; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0; }
.n-meta button:hover, .n-meta button[data-confirm="1"] { color: var(--s-stop); }
.notes p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-form { display: grid; gap: 8px; }
.note-form textarea { width: 100%; resize: vertical; min-height: 76px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--fg); font: inherit; }
.note-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
@media (max-width: 560px) { .drawer-panel { padding: 16px; } .facts { grid-template-columns: minmax(0, 1fr); } }

/* =================== v3: палитры =================== */
:root[data-palette="indigo"] { --bg:#F4F5FB; --surface:#FFFFFF; --surface-2:#F7F8FC; --line:#E2E5F0; --line-strong:#CBD0E1; --fg:#0F1222; --fg-2:#3A4060; --muted:#6B7194; --accent:#4F46E5; --accent-fg:#FFFFFF; --accent-soft:#ECEBFE; --focus:#818CF8; }
:root[data-palette="graphite"] { --bg:#F4F4F5; --surface:#FFFFFF; --surface-2:#FAFAFA; --line:#E4E4E7; --line-strong:#D4D4D8; --fg:#09090B; --fg-2:#3F3F46; --muted:#71717A; --accent:#18181B; --accent-fg:#FAFAFA; --accent-soft:#EFEFF1; --focus:#71717A; }
:root[data-palette="ocean"] { --bg:#F2F6F9; --surface:#FFFFFF; --surface-2:#F6F9FB; --line:#DDE6EE; --line-strong:#C5D3DF; --fg:#0B1B2A; --fg-2:#2F4A63; --muted:#62788D; --accent:#0369A1; --accent-fg:#FFFFFF; --accent-soft:#E0F0FA; --focus:#38BDF8; }
@media (prefers-color-scheme: dark) {
  :root[data-palette="indigo"]:not([data-theme="light"]) { --bg:#0D0F1A; --surface:#141726; --surface-2:#191C2E; --line:#252A40; --line-strong:#343A56; --fg:#E6E8F5; --fg-2:#BCC1DA; --muted:#8A90AE; --accent:#A5B4FC; --accent-fg:#12153A; --accent-soft:#232858; --focus:#C7D2FE; }
  :root[data-palette="graphite"]:not([data-theme="light"]) { --bg:#0A0A0B; --surface:#141416; --surface-2:#1A1A1D; --line:#27272A; --line-strong:#3A3A3F; --fg:#FAFAFA; --fg-2:#D4D4D8; --muted:#A1A1AA; --accent:#F4F4F5; --accent-fg:#18181B; --accent-soft:#26262A; --focus:#A1A1AA; }
  :root[data-palette="ocean"]:not([data-theme="light"]) { --bg:#08121B; --surface:#0F1B26; --surface-2:#13212E; --line:#1F3142; --line-strong:#2C4358; --fg:#E3EEF6; --fg-2:#B6CADB; --muted:#8299AD; --accent:#5BC0F0; --accent-fg:#04263A; --accent-soft:#11324A; --focus:#7DD3FC; }
}
:root[data-palette="indigo"][data-theme="dark"] { --bg:#0D0F1A; --surface:#141726; --surface-2:#191C2E; --line:#252A40; --line-strong:#343A56; --fg:#E6E8F5; --fg-2:#BCC1DA; --muted:#8A90AE; --accent:#A5B4FC; --accent-fg:#12153A; --accent-soft:#232858; --focus:#C7D2FE; }
:root[data-palette="graphite"][data-theme="dark"] { --bg:#0A0A0B; --surface:#141416; --surface-2:#1A1A1D; --line:#27272A; --line-strong:#3A3A3F; --fg:#FAFAFA; --fg-2:#D4D4D8; --muted:#A1A1AA; --accent:#F4F4F5; --accent-fg:#18181B; --accent-soft:#26262A; --focus:#A1A1AA; }
:root[data-palette="ocean"][data-theme="dark"] { --bg:#08121B; --surface:#0F1B26; --surface-2:#13212E; --line:#1F3142; --line-strong:#2C4358; --fg:#E3EEF6; --fg-2:#B6CADB; --muted:#8299AD; --accent:#5BC0F0; --accent-fg:#04263A; --accent-soft:#11324A; --focus:#7DD3FC; }

/* =================== v3: шапка и меню =================== */
.topbar { gap: 12px; }
a.brand { color: inherit; text-decoration: none; }
.topbar-meta { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.topbar-meta b { color: var(--fg); font-size: 15px; font-weight: 600; }
.nav-wrap { position: fixed; inset: 0; z-index: 45; background: rgba(6, 14, 13, .38); }
.nav {
  position: absolute; top: 0; left: 0; bottom: 0; width: min(320px, 88vw); background: var(--surface); border-right: 1px solid var(--line);
  box-shadow: var(--shadow-lg); padding: 14px 12px 16px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto;
  animation: navIn .18s ease-out;
}
@keyframes navIn { from { transform: translateX(-20px); opacity: .6; } to { transform: none; opacity: 1; } }
.nav-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 10px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.nav-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 10px; border-radius: 10px; color: var(--fg); text-decoration: none; }
.nav-item svg { width: 20px; height: 20px; flex: none; margin-top: 1px; color: var(--muted); }
.nav-item b { display: block; font-weight: 600; }
.nav-item small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--accent-soft); }
.nav-item.active svg, .nav-item.active b { color: var(--accent); }
:root[data-palette="graphite"] .nav-item.active b, :root[data-palette="graphite"] .nav-item.active svg { color: var(--fg); }
.nav-sec { margin-top: 12px; padding: 12px 8px 4px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.palettes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.pal { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 500; color: var(--fg); }
.pal[aria-checked="true"] { border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); }
.pal-sw { width: 18px; height: 18px; border-radius: 50%; flex: none; border: 1px solid rgba(0,0,0,.12); }
.nav-sec .btn { justify-self: start; }
.nav-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nav-foot .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.page > * { min-width: 0; }

/* =================== v3: менеджеры на сводке =================== */
.mgr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 16px; }
.mgr-panel { padding: 16px 18px 18px; display: grid; gap: 14px; border-top: 3px solid var(--mc); }
.mp-head { display: flex; align-items: center; gap: 10px; }
.mp-head > div { flex: 1; min-width: 0; }
.mp-head h2 { font-size: 16px; }
.mp-body { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 18px; align-items: center; }
@media (max-width: 520px) { .mp-body { grid-template-columns: minmax(0, 1fr); justify-items: center; } .mp-body .lg-list { width: 100%; } }
.donut { width: 150px; height: 150px; display: block; }
.dn-seg { transition: opacity .15s; }
.donut:hover .dn-seg { opacity: .45; }
.donut .dn-seg:hover { opacity: 1; }
.dn-num { font: 700 24px var(--font); fill: var(--fg); letter-spacing: -.02em; }
.dn-cap { font: 500 10.5px var(--font); fill: var(--muted); }
.donut-empty { width: 150px; height: 150px; border-radius: 50%; border: 15px solid var(--surface-2); display: grid; place-items: center; text-align: center; padding: 6px; }
.lg-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.lg-list li { display: grid; grid-template-columns: 10px minmax(0, 1fr) 70px 30px 48px; gap: 8px; align-items: center; font-size: 13px; }
.lg-list li.zero { opacity: .42; }
.lg-list .dot { width: 9px; height: 9px; border-radius: 50%; }
.lg-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.lg-bar i { display: block; height: 100%; border-radius: 99px; }
.lg-list b { text-align: right; font-weight: 700; }
.lg-list em { font-style: normal; text-align: right; color: var(--muted); font-size: 12px; }

/* =================== v3: динамика =================== */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--fg-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.trend { padding: 4px 18px 6px 10px; }
.tr-plot { display: grid; grid-template-columns: 34px minmax(0, 1fr); height: 240px; }
.tr-y { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; padding: 0 8px 22px 0; font-size: 11px; color: var(--muted); }
.tr-y span { line-height: 0; }
.tr-area { position: relative; display: grid; grid-template-rows: minmax(0, 1fr) 22px; }
.tr-grid { position: absolute; inset: 0 0 22px; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.tr-grid i { display: block; border-top: 1px dashed var(--line); }
.tr-grid i:last-child { border-top: 1px solid var(--line-strong); }
.tr-cols { position: relative; display: flex; align-items: flex-end; gap: 3px; }
.tr-col { position: relative; flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; border-radius: 4px; }
.tr-col:hover { background: color-mix(in srgb, var(--fg) 5%, transparent); }
.tr-col.we .tr-stack { opacity: .78; }
.tr-stack { width: min(100%, 34px); display: flex; flex-direction: column-reverse; gap: 2px; }
.tr-stack i { display: block; min-height: 2px; }
.tr-stack i:last-child { border-radius: 4px 4px 0 0; }
.tr-stack i:first-child { border-radius: 0 0 1px 1px; }
.tr-stack i:only-child { border-radius: 4px 4px 1px 1px; }
.tr-val { position: absolute; left: 0; right: 0; text-align: center; font-size: 10.5px; font-weight: 600; color: var(--fg-2); pointer-events: none; }
.tr-x { display: flex; gap: 3px; }
.tr-x span { flex: 1 1 0; text-align: center; font-size: 11px; color: var(--muted); padding-top: 5px; white-space: nowrap; overflow: visible; }
.tip-pop { position: fixed; z-index: 70; pointer-events: none; background: var(--surface); color: var(--fg); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 10px 12px; font-size: 12.5px; min-width: 170px; display: grid; gap: 4px; }
.tip-pop b { font-weight: 600; margin-bottom: 2px; }
.tip-pop div { display: flex; align-items: center; gap: 6px; }
.tip-pop div i { width: 9px; height: 9px; border-radius: 3px; }
.tip-pop div span { margin-left: auto; font-weight: 600; }
.tip-pop .tip-total { border-top: 1px solid var(--line); padding-top: 4px; margin-top: 2px; font-weight: 600; }

/* =================== v3: команды и менеджеры =================== */
.tbl-teams tbody tr { cursor: pointer; }
.tbl-teams tbody tr:hover td { background: var(--surface-2); }
.tbl-teams td { font-size: 13px; }
.tbl-teams .num.ok { color: var(--s-launch); font-weight: 600; }
.tbl-teams .num.bad { color: var(--s-stop); font-weight: 600; }
.tbl-teams .zero { color: var(--line-strong); font-weight: 400; }
.stack-sm { height: 6px; min-width: 120px; }
.panel-head .select { flex: 0 1 240px; }
.panel.pad { padding: 18px; display: grid; gap: 14px; align-content: start; }
.mgr-form { display: grid; gap: 14px; }
.field small { font-weight: 400; font-size: 12px; line-height: 1.35; }
.field input[readonly] { background: var(--surface-2); color: var(--muted); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.sw { width: 30px; height: 30px; border-radius: 50%; background: var(--sw); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); cursor: pointer; }
.sw[aria-checked="true"] { box-shadow: 0 0 0 2px var(--fg); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.nowrap { white-space: nowrap; }
.tbl-mgrs td { font-size: 13.5px; }
.unknown { border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 8px; }
.unknown h3 { font-size: 14px; }
.unknown p { margin: 0; }
.unknown ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 14px; }
.unknown li { display: flex; align-items: center; gap: 8px; }

.mgr-note { margin: -4px 18px 10px; }
.btn-icon.btn-sm { width: 32px; height: 32px; }
