:root {
  color-scheme: light;
  --bg: #edf2f8;
  --panel: #fcfdff;
  --ink: #142339;
  --muted: #546782;
  --line: #d9e2ee;
  --blue: #124da3;
  --soft: #e5eefc;
  --green: #12644d;
  --amber: #855611;
  --red: #a53c51;
  --shadow: 0 3px 10px #152c4909;
  --board: #142744;
  --board-line: #3d5270;
  --board-text: #f2f8ff;
  --board-muted: #abbed8;
  --trend: #81d9ff;
  --goal: #b3c5ee;
  --radius: 16px;
}
:root[data-theme=dark] {
  color-scheme: dark;
  --bg: #0b1422;
  --panel: #121e30;
  --ink: #eaf1fc;
  --muted: #a1b4cf;
  --line: #2b3b54;
  --blue: #9bc5ff;
  --soft: #213758;
  --green: #8eddbf;
  --amber: #f4c585;
  --red: #ffa5ae;
  --shadow: none;
  --board: #142744;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--interface-font, "Inter", "Segoe UI", sans-serif);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
main, body > header { width: min(100%, 1050px); margin-inline: auto; padding-inline: clamp(14px, 3vw, 34px); }
body > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  gap: 12px;
  padding-block: 10px;
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark { display: block; flex: none; width: 40px; height: 40px; }
.brand-name { font-size: 25px; font-weight: 760; letter-spacing: -.065em; }
.brand-sig { color: var(--blue); }
#mode { color: var(--muted); font-size: 11px; }
#mode:not(:empty)::before {
  content: ""; display: inline-block; margin-right: 6px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--blue); vertical-align: 2px;
}
main { min-width: 0; padding-bottom: calc(98px + env(safe-area-inset-bottom)); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.035em; }
h1 { font-size: clamp(26px, 3vw, 36px); font-weight: 730; }
h2 { font-size: clamp(19px, 2.25vw, 24px); font-weight: 680; }
button, input, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button { border: 0; background: none; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 3px;
}
button:disabled { opacity: .65; cursor: wait; }
[hidden] { display: none !important; }
.heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 18px 0 13px; }
.heading-meta { display: flex; align-items: center; gap: 10px; }
#stamp { color: var(--muted); font-size: 12px; }
#stamp span::after { content: " ·"; }
#stamp time { white-space: nowrap; }
#refresh, .linehead button, .account-heading button { color: var(--blue); font-size: 13px; font-weight: 650; }
#refresh { min-height: 40px; padding: 6px 12px; background: var(--soft); border-radius: 9px; }
.tools { display: flex; gap: 8px; margin-bottom: 14px; }
.tools label {
  display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 0 10px;
  border: 1px solid var(--line); background: var(--panel); border-radius: 10px;
  color: var(--muted); font-size: 12px;
}
.tools select {
  min-width: 0; padding: 8px 4px; border: 0; background: var(--panel);
  color: var(--ink); font-size: 14px; font-weight: 640;
}
.weekly-board {
  display: grid;
  grid-template-columns: minmax(200px, .9fr) minmax(0, 2.1fr);
  gap: clamp(18px, 3vw, 36px);
  padding: clamp(19px, 3vw, 30px);
  border: 1px solid #354b6c;
  border-radius: var(--radius);
  background: radial-gradient(ellipse at 78% 110%, #24496d 0%, transparent 66%), var(--board);
  box-shadow: 0 9px 24px #09172b23;
  color: var(--board-text);
}
.weekly-summary { align-self: center; }
.weekly-summary h2 { color: var(--board-muted); font-size: 15px; font-weight: 570; letter-spacing: -.015em; }
.weekly-value {
  display: block; margin: 2px 0 10px; font-size: clamp(52px, 6.9vw, 85px);
  font-weight: 670; letter-spacing: -.075em; line-height: 1;
}
.target-label { color: var(--board-muted); font-size: 13px; }
.target-label b { color: var(--board-text); font-weight: 630; }
.target-delta {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 9px;
  padding: 4px 8px; border-radius: 6px; font-weight: 620; font-size: 12px;
}
.target-delta.over { background: #623f50; color: #ffdde0; }
.target-delta.under { background: #1d4a4d; color: #b3f5d5; }
.weekly-chart { min-width: 0; padding-left: clamp(14px, 2vw, 24px); border-left: 1px solid var(--board-line); }
.chart-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-left: 2px; }
.chart-heading h3 { font-size: 13px; font-weight: 650; letter-spacing: 0; }
.goal-key { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--board-muted); }
.goal-key::before { content: ""; width: 15px; height: 0; border-top: 1px dashed var(--goal); }
.cpl-figure {
  display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: 6px;
  margin: 9px 0 0; color: var(--board-muted); font-size: 11px;
}
.cpl-y { position: relative; }
.cpl-y span { position: absolute; right: 0; transform: translateY(-50%); }
.cpl-y::before { content: attr(data-width); visibility: hidden; }
.cpl-plot { position: relative; height: 132px; margin-inline: 4px; }
.cpl-plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.cpl-x { position: relative; grid-column: 2; margin: 6px 4px 0; min-height: 1.55em; }
.cpl-x span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.cpl-hit {
  position: absolute; inset: 0 auto 0 var(--x); width: 13%; padding: 0;
  transform: translateX(-50%); border-radius: 5px;
}
.cpl-hit:is(:hover,:focus) { background: #81d9ff14; }
.cpl-hit:focus-visible { outline-color: var(--trend); outline-offset: -2px; }
.cpl-tip {
  display: none; position: absolute; z-index: 1; bottom: 72%; left: 50%;
  width: max-content; transform: translateX(-50%); border-radius: 6px;
  background: #eef7ff; color: #142744; font-size: 11px; font-weight: 620; padding: 4px 7px; pointer-events: none;
}
.cpl-hit:is(:focus,:hover) .cpl-tip { display: block; }
.cpl-hit:first-of-type .cpl-tip { transform: none; }
.cpl-hit:last-of-type .cpl-tip { right: 50%; left: auto; transform: none; }
.cpl-empty { padding: 22px 2px; color: var(--board-muted); font-size: 13px; }
.period-summary {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  margin-top: 13px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); box-shadow: var(--shadow);
}
.period-counters, .account-summary { min-width: 0; padding: 14px 16px; }
.account-summary { border-left: 1px solid var(--line); }
.period-summary h2 { font-size: 14px; font-weight: 650; letter-spacing: -.015em; }
.period-summary h2 span { color: var(--muted); font-weight: 470; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 10px 0 0; }
.metrics div + div { border-left: 1px solid var(--line); padding-left: 10px; }
.metrics dt { color: var(--muted); font-size: 11px; }
.metrics dd { margin: 2px 0 0; font-size: clamp(20px, 3vw, 28px); line-height: 1.13; font-weight: 680; letter-spacing: -.055em; }
.account-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.account-heading button { padding: 0; }
.account-states { display: flex; gap: 5px; margin-top: 10px; flex-wrap: wrap; }
.account-states button {
  flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 40px;
  padding: 4px 7px; border: 1px solid var(--line); border-radius: 8px; font-size: 11px;
}
.account-states strong { color: var(--ink); font-size: 14px; margin-left: 3px; }
.state-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.good { color: var(--green); } .warn { color: var(--amber); } .bad { color: var(--red); }
.surface, .rankings, .box, details, .menurow, .tile {
  border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow);
}
.surface, .rankings { padding: 16px; border-radius: var(--radius); }
.rankings { margin-top: 14px; }
.linehead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.linehead button { min-height: 36px; padding: 2px 0 2px 5px; }
.ranking-controls { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.ranking-controls > span { color: var(--muted); font-size: 11px; }
.rank-selector { display: inline-flex; gap: 1px; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.rank-selector button { min-height: 32px; padding: 3px 9px; border-radius: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.rank-selector button[aria-pressed=true] { color: var(--blue); background: var(--panel); box-shadow: var(--shadow); }
.adlist > p { color: var(--muted); padding: 12px 0; }
.rank-header { display: none; }
.adrow {
  display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 2px 8px;
  min-height: 55px; padding: 8px 4px; width: 100%; text-align: left; border-top: 1px solid var(--line);
}
.adname { min-width: 0; }
.adname strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adname small, .row-price small { display: block; color: var(--muted); font-size: 11px; }
.rank-spend, .rank-leads { display: none; }
.row-price { grid-column: 2; grid-row: 1/3; text-align: right; white-space: nowrap; }
.row-price strong { font-size: 16px; letter-spacing: -.035em; }
.row-price.within strong { color: var(--green); }
.row-price.outside strong { color: var(--red); }
.pill {
  display: inline-flex; justify-self: start; align-items: center; gap: 5px; font-size: 11px;
  font-weight: 600; line-height: 1.3; border-radius: 6px; padding: 3px 6px;
}
.pill::before { content: ""; width: 5px; height: 5px; flex: none; border-radius: 50%; background: currentColor; }
.pill.on { color: var(--green); background: color-mix(in srgb,var(--green) 9%,var(--panel)); }
.pill.idle { color: var(--amber); background: color-mix(in srgb,var(--amber) 9%,var(--panel)); }
.pill.off { color: var(--red); background: color-mix(in srgb,var(--red) 9%,var(--panel)); }
.winners, .menurow {
  display: flex; width: 100%; align-items: center; gap: 8px;
  min-height: 46px; padding: 9px 13px; border-radius: 10px; text-align: left; font-weight: 590;
}
.winners { justify-content: space-between; margin-top: 10px; background: var(--soft); color: var(--blue); font-size: 13px; }
.overview-extras { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-top: 14px; }
details { border-radius: 11px; margin: 6px 0; }
summary { padding: 10px 13px; cursor: pointer; font-weight: 550; }
details > p, details > .event { padding: 10px 14px; }
.box { border-radius: 10px; overflow: auto; margin-top: 8px; }
details .box { margin: 0; border: 0; box-shadow: none; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
td, th { text-align: right; padding: 8px 11px; white-space: nowrap; border-bottom: 1px solid var(--line); }
tr:last-child td { border: 0; }
td:first-child, th:first-child { text-align: left; }
th { background: var(--bg); color: var(--muted); font-size: 12px; font-weight: 600; }
th button, td button { min-height: 34px; padding: 2px; }
td button { color: var(--blue); text-align: left; }
.event { padding: 12px; border-bottom: 1px solid var(--line); }
.event small { display: block; color: var(--muted); }
.dock {
  position: fixed; z-index: 4; bottom: max(8px,env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  width: min(500px,calc(100% - 22px)); display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); padding: 4px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 5px 25px #0a23452d;
}
.dock button {
  display: grid; place-items: center; align-content: center; gap: 3px; padding: 5px 0;
  min-height: 47px; border-radius: 10px; color: var(--muted); font-size: 11px; font-weight: 570;
}
.dock svg, .menurow svg {
  width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.dock button:is([aria-current=true],[aria-current=page]) { background: var(--soft); color: var(--blue); font-weight: 680; }
dialog {
  position: fixed; width: min(600px,95vw); max-height: 84dvh; padding: 18px;
  border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: var(--panel); box-shadow: 0 16px 64px #081e3d38;
}
dialog::backdrop { background: #07152578; }
dialog form { text-align: right; }
dialog form button { min-height: 40px; padding: 8px 12px; border-radius: 9px; background: var(--bg); }
dialog h2 { margin: 6px 0 12px; }
.grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.tile { border-radius: 10px; padding: 10px; overflow-wrap: anywhere; }
.tile small, .tile b { display: block; }
.tile small { color: var(--muted); font-size: 12px; }
.themes { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 11px; }
.theme-option { padding: 7px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); text-align: left; }
.theme-option[aria-pressed=true] { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.theme-preview { display: block; width: 100%; height: auto; max-height: 100px; border-radius: 6px; }
.theme-caption { display: flex; align-items: center; justify-content: space-between; gap: 3px; padding: 5px 3px 2px; font-size: 13px; }
.theme-check { color: var(--blue); }
.profile-tools { margin-top: 16px; }
.menurow { margin: 7px 0; }
.tool-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--soft); color: var(--blue); }
.menu-chevron { margin-left: auto; color: var(--muted); }
.rules-pane { display: grid; gap: 13px; }
.rules-pane p { margin: 12px 0; max-width: 72ch; color: var(--muted); }
.rules-pane h3 { margin: 17px 0 7px; font-size: 16px; }
.rules-pane dl { margin: 10px 0 0; }
.rules-pane dl div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.rules-pane dd { margin: 0; font-weight: 640; }
@media (min-width: 701px) {
  .rank-header, .adrow { grid-template-columns: minmax(155px,1.5fr) minmax(95px,.55fr) repeat(3,minmax(48px,.33fr)); gap: 10px; padding-inline: 8px; }
  .rank-header { display: grid; padding-block: 6px; color: var(--muted); text-align: right; font-size: 11px; }
  .rank-header span:nth-child(-n+2) { text-align: left; }
  .adrow > .row-price { grid-row: auto; grid-column: auto; }
  .rank-spend, .rank-leads { display: block; text-align: right; }
  .compact-leads, .row-price small { display: none; }
}
@media (max-width: 700px) {
  .weekly-board { grid-template-columns: minmax(0,1fr); gap: 13px; padding: 15px 14px; }
  .weekly-summary {
    display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 2px 5px;
  }
  .weekly-summary h2 { grid-column: 1; font-size: 13px; }
  .weekly-value { grid-column: 1; grid-row: 2; margin: 2px 0 0; font-size: clamp(43px, 11.5vw, 65px); }
  .target-label { grid-column: 2; grid-row: 1; justify-self: end; }
  .target-delta { grid-column: 2; grid-row: 2; justify-self: end; margin: 0; font-size: 11px; }
  .weekly-chart { padding: 9px 0 0; border-left: 0; border-top: 1px solid var(--board-line); }
  .cpl-plot { height: 105px; }
  .cpl-x { font-size: 9px; }
  .period-summary, .overview-extras { grid-template-columns: 1fr; }
  .account-summary { border-left: 0; border-top: 1px solid var(--line); }
  .period-counters, .account-summary { padding: 10px 12px; }
  .account-states { margin-top: 6px; }
  .account-states button { min-height: 36px; }
  .rankings, .surface { padding: 12px; }
  .adname strong { font-size: 13px; }
  .rules-pane .box :is(td,th) { padding: 7px 6px; font-size: 12px; }
}
@media (max-width: 600px) {
  .heading { margin: 12px 0 10px; }
  .heading-meta { gap: 6px; }
  #stamp { font-size: 10px; line-height: 1.3; text-align: right; }
  #stamp span { display: block; }
  #stamp span::after { content: none; }
  #refresh { padding-inline: 7px; font-size: 11px; }
  .tools { gap: 6px; margin-bottom: 10px; }
  .tools label { flex: 1; align-content: center; display: grid; min-width: 0; gap: 0; font-size: 10px; }
  .tools select { width: 100%; padding: 0; font-size: 13px; }
  dialog { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 16px 16px 0 0; padding: 14px 14px max(20px,env(safe-area-inset-bottom)); }
  .grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dock button { font-size: 10px; }
}
@media (min-width: 1080px) {
  body { display: grid; grid-template-columns: 169px minmax(0,1fr); }
  body > header {
    grid-column: 1/-1; width: 100%; min-height: 67px; background: var(--panel);
    padding-inline: clamp(18px, 2.9vw, 35px);
  }
  main { grid-column: 2; grid-row: 2; width: min(100%, 1340px); padding-bottom: 36px; }
  .dock {
    position: sticky; grid-column: 1; grid-row: 2; align-self: start; top: 18px;
    left: auto; width: auto; transform: none; display: grid; grid-template-columns: 1fr;
    gap: 2px; margin: 18px 0 0 clamp(14px,2.1vw,28px); padding: 4px; box-shadow: none;
  }
  .dock button { display: flex; justify-content: flex-start; gap: 8px; padding: 7px 9px; min-height: 42px; font-size: 12px; }
}
@media (hover: hover) {
  .adrow:hover, .menurow:hover, summary:hover, .account-states button:hover { background: var(--soft); }
  .dock button:hover, .rank-selector button:hover { color: var(--blue); }
}
@media (prefers-reduced-motion: no-preference) {
  .dock button, .adrow, .rank-selector button { transition: background-color .14s ease, color .14s ease; }
  dialog[open] { animation: sheet-open .17s ease-out; }
  @keyframes sheet-open { from { opacity: .5; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
}
