:root {
  --brand: #004AAD;        /* ODM navy */
  --brand-deep: #003481;
  --brand-tint: #E6EEF8;
  --accent: #FF751F;       /* ODM orange */
  --accent-text: #ad5015;
  --ink: #0B1A30;
  --muted: #4A5568;
  --line: #D7DDE7;
  --bg: #EEF1F7;
  --card: #FFFFFF;
  --good: #1E7F4F;  --good-bg: #E3F4EA;
  --warn: #9A6200;  --warn-bg: #FFF1D6;
  --bad:  #B42318;  --bad-bg:  #FDE7E5;
  --none: #8A94A6;  --none-bg: #F1F3F7;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(11,26,48,.06), 0 4px 16px rgba(11,26,48,.05);
  --head: 'Host Grotesk', Inter, system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #5B9BFF; --brand-deep: #8DB8FF; --brand-tint: #14233D;
    --accent: #FF8A3D; --accent-text: #FFB282;
    --ink: #E8EDF5; --muted: #A3AEC2; --line: #2A3448;
    --bg: #0C1220; --card: #141C2E;
    --good: #5BD69A; --good-bg: #123526;
    --warn: #F3BE5A; --warn-bg: #3A2C0E;
    --bad: #FF8A80; --bad-bg: #3F1714;
    --none: #7C879B; --none-bg: #1B2438;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 Inter, system-ui, -apple-system, sans-serif;
}
h1, h2, h3 { font-family: var(--head); line-height: 1.2; margin: 0 0 12px; }
h2 { font-size: 17px; font-weight: 600; }
a { color: var(--brand); }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.big { font-family: var(--head); font-size: 28px; font-weight: 700; line-height: 1.15; margin: 4px 0; font-variant-numeric: tabular-nums; }

/* Header */
.top { background: #0B1A30; color: #fff; position: sticky; top: 0; z-index: 10; }
.top-inner { max-width: 1200px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.mark { background: var(--accent); color: #0B1A30; font-family: var(--head); font-weight: 700; font-size: 13px; padding: 6px 8px; border-radius: 8px; letter-spacing: .04em; }
.brand-title { font-family: var(--head); font-weight: 700; font-size: 17px; }
.brand-sub { font-size: 12px; color: #A9B7CF; }
.tabs { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  background: none; border: 0; color: #C9D3E4; font: 500 14px Inter, sans-serif;
  padding: 8px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.tabs button:hover { background: rgba(255,255,255,.08); color: #fff; }
.tabs button[aria-selected="true"] { background: rgba(255,255,255,.14); color: #fff; box-shadow: inset 0 -2px 0 var(--accent); }
.user { font-size: 12px; color: #A9B7CF; }
@media (max-width: 720px) {
  .top-inner { gap: 6px 12px; padding-bottom: 6px; }
  .tabs { order: 3; flex-basis: 100%; margin: 0 -6px; }
  .tabs button { padding: 8px 10px; }
  .user { margin-left: auto; }
}

main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.grid { display: grid; gap: 16px; }
.grid > .card { margin-bottom: 0; }
.grid.two { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); margin-bottom: 16px; }
.grid.two > div > .card + .card { margin-top: 16px; }
.grid.two.tight { grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 0; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.hero { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.deals-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 900px) {
  .grid.hero { grid-template-columns: 1fr 1fr; }
  .grid.two, .grid.three, .deals-layout { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .grid.hero { grid-template-columns: 1fr; }
  .grid.two.tight { grid-template-columns: 1fr; }
  .big { font-size: 24px; }
}

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar select { width: auto; min-width: 0; max-width: calc(100% - 96px); }
.icon-btn { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; font-size: 16px; }
.icon-btn:hover { border-color: var(--brand); }
.icon-btn:disabled { opacity: .4; cursor: default; }

/* Grade */
.grade-card { display: flex; gap: 16px; align-items: center; }
.grade {
  width: 76px; height: 76px; flex: none; border-radius: 16px; display: grid; place-items: center;
  font-family: var(--head); font-size: 44px; font-weight: 700; background: var(--none-bg); color: var(--none);
}
.grade.A { background: var(--good-bg); color: var(--good); }
.grade.B { background: var(--brand-tint); color: var(--brand); }
.grade.C { background: var(--warn-bg); color: var(--warn); }
.grade.D, .grade.F { background: var(--bad-bg); color: var(--bad); }

.bar { height: 8px; background: var(--brand-tint); border-radius: 99px; overflow: hidden; margin: 8px 0 6px; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .4s; }
.pos { color: var(--good); } .neg { color: var(--bad); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; }
tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 600; border-top: 2px solid var(--line); }
.metrics .pbar { height: 6px; background: var(--none-bg); border-radius: 99px; overflow: hidden; min-width: 60px; }
.metrics .pbar span { display: block; height: 100%; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad  { background: var(--bad-bg);  color: var(--bad); }
.chip.none { background: var(--none-bg); color: var(--none); }
.fill-good { background: var(--good); } .fill-warn { background: var(--warn); } .fill-bad { background: var(--bad); }
.del { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; padding: 4px 6px; border-radius: 6px; }
.del:hover { color: var(--bad); background: var(--bad-bg); }

/* Heat map */
.heat td, .heat th { text-align: center; white-space: nowrap; }
.heat td:first-child, .heat th:first-child { text-align: left; }
.heat td.cell { font-size: 13px; font-weight: 600; border: 2px solid var(--card); border-radius: 6px; }
.cell.good { background: var(--good-bg); color: var(--good); }
.cell.warn { background: var(--warn-bg); color: var(--warn); }
.cell.bad  { background: var(--bad-bg);  color: var(--bad); }
.cell.none { background: var(--none-bg); color: var(--none); font-weight: 400; }

/* Funnel */
.funnel .step { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px 10px; margin-bottom: 10px; }
.funnel .label { font-size: 14px; }
.funnel .val { font-weight: 600; font-variant-numeric: tabular-nums; }
.funnel .fbar { grid-column: 1 / -1; height: 10px; background: var(--brand-tint); border-radius: 99px; overflow: hidden; }
.funnel .fbar span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.funnel .conv { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }

.notes h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 12px 0 4px; }
.notes h3:first-child { margin-top: 0; }
.notes p { margin: 0; white-space: pre-wrap; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; }
.field small { color: var(--muted); font-size: 12px; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--card); width: 100%;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 38px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.form-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.week-field { width: 200px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 16px; margin: 8px 0; }
.fields input { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.notice { background: var(--brand-tint); color: var(--ink); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 12px; }
.actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.btn { font: 600 14px Inter, sans-serif; border-radius: 8px; padding: 10px 18px; cursor: pointer; border: 1px solid transparent; }
.btn.primary { background: var(--accent); color: #0B1A30; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.primary:disabled { opacity: .6; cursor: default; }
.btn.ghost { background: none; border-color: var(--line); color: var(--muted); }
.btn.ghost:hover { color: var(--bad); border-color: var(--bad); }
.status { font-size: 13px; color: var(--muted); }
.status.ok { color: var(--good); } .status.err { color: var(--bad); }
.targets-input { max-width: 120px; }
.empty { color: var(--muted); }

/* Charts */
.chart { width: 100%; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font: 11px Inter, sans-serif; fill: var(--muted); }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .actual { stroke: var(--accent); stroke-width: 3; fill: none; }
.chart .actual-dot { fill: var(--accent); }
.chart .plan { stroke: var(--brand); stroke-width: 2; fill: none; stroke-dasharray: 6 4; }
.chart .goal { stroke: var(--good); stroke-width: 1.5; stroke-dasharray: 2 4; }
.chart .gbar { fill: var(--brand); }
.chart .gbar.A { fill: var(--good); } .chart .gbar.C { fill: var(--warn); } .chart .gbar.D, .chart .gbar.F { fill: var(--bad); }
.chart .glabel { font-weight: 700; fill: var(--ink); font-size: 12px; }
.legend { display: flex; gap: 6px 14px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.key { display: inline-block; width: 18px; height: 3px; border-radius: 2px; margin-right: -8px; vertical-align: middle; }
.key.actual { background: var(--accent); } .key.plan { background: var(--brand); } .key.goal { background: var(--good); }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #0B1A30; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; transition: .2s; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--bad); }
