:root {
  font: 14px/1.5 system-ui, sans-serif;
  color: #172642;
  background: #f0f4fa;
  --line: #dce5f1;
  --muted: #465774;
  --blue: #214e9d;
}
* { box-sizing: border-box; }
body { margin: 0; }
.wrap { max-width: 1680px; margin-inline: auto; }
.top { background: #172a4a; color: white; }
.bar { min-height: 62px; padding: 8px 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.2rem; white-space: nowrap; }
.brand-mark { display: flex; align-items: end; justify-content: center; gap: 3px; width: 34px; height: 34px; padding-bottom: 8px; background: #a9caff; border-radius: 10px; }
.brand-mark i { width: 4px; height: 8px; border-radius: 2px; background: #172a4a; }
.brand-mark i:nth-child(2) { height: 13px; }
.brand-mark i:nth-child(3) { height: 18px; }
button, select, input { font: inherit; color: inherit; }
button, select { background: white; border: 1px solid #aab8cf; border-radius: 8px; padding: 7px 11px; }
button, summary { cursor: pointer; }
button:disabled { cursor: default; }
.bar-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.bar button { color: white; background: transparent; border-color: #7588aa; }
.bar button[value="connect"] { background: #d4e4ff; color: #172a4a; border-color: #d4e4ff; }
:focus-visible { outline: 3px solid #b66609; outline-offset: 2px; }
.layout { display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { align-self: start; padding: 22px 14px 20px; display: grid; gap: 14px; min-width: 0; }
.side-nav { display: grid; gap: 4px; }
.section-link { display: flex; align-items: center; gap: 10px; padding: 9px 12px; color: var(--muted); font-weight: 650; text-decoration: none; border-radius: 8px; }
.section-link[aria-current] { color: #153d7c; background: #dbe8fe; box-shadow: inset 3px 0 #3162ba; }
.section-link:hover { background: #e3edfc; }
.property-form { display: grid; gap: 7px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.property-form label { font-size: .84rem; font-weight: 650; }
.property-form select, .property-form input { width: 100%; min-width: 0; }
.property-form input { background: #f7faff; border: 1px solid #aab8cf; border-radius: 8px; padding: 7px 9px; }
.property-form small { color: var(--muted); }
.property-form button { justify-self: start; color: var(--blue); }
.account-list summary { font-weight: 650; }
.account-list form { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.account-list span { display: block; overflow-wrap: anywhere; margin-bottom: 5px; font-size: .88rem; }
main { min-width: 0; border-left: 1px solid var(--line); padding: 22px 28px 36px; }
.heading { margin-bottom: 14px; }
.heading h1 { font-size: clamp(1.4rem, 2.6vw, 1.85rem); line-height: 1.2; font-weight: 650; margin: 0; }
.heading p { color: var(--muted); overflow-wrap: anywhere; }
p { margin: .4em 0; }
h2 { margin: 0; font-size: 1.05rem; }
.muted { color: var(--muted); }
.surface { background: white; border: 1px solid var(--line); border-radius: 12px; }
.empty { padding: 24px; }
.primary { background: var(--blue); border-color: var(--blue); color: white; font-weight: 700; margin-top: 8px; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-bottom: 16px; }
.periods { display: flex; flex-wrap: wrap; overflow: hidden; border: 1px solid #bac9df; border-radius: 8px; background: white; }
.periods a, .report a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.periods a { padding: 7px 14px; }
.periods a + a { border-left: 1px solid var(--line); }
.periods a:focus-visible, .report a:focus-visible { outline-offset: -3px; }
.periods a[aria-current] { color: #153d7c; background: #dce9ff; font-weight: 700; }
.search-type { padding: 6px 11px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: .86rem; }
.chart { overflow: hidden; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.card { --metric: #2456bd; min-width: 0; border: 0; border-radius: 0; text-align: left; padding: 13px clamp(10px, 2vw, 24px); background: #f5f8fd; color: var(--muted); }
.card + .card { border-left: 1px solid #dce5f1; }
.card:focus-visible { outline-offset: -4px; }
.card.impressions { --metric: #6943a8; }
.card.ctr { --metric: #087558; }
.card.position { --metric: #9c461a; }
.card[aria-pressed="true"] { color: white; background: var(--metric); }
.card span { font-size: .86rem; display: flex; align-items: center; gap: 7px; }
.card span::before { content: ""; width: 12px; height: 12px; flex: 0 0 12px; box-sizing: border-box; border: 1px solid currentColor; border-radius: 3px; }
.card[aria-pressed="true"] span::before { content: "✓"; font-size: 10px; font-weight: 700; text-align: center; line-height: 10px; }
.card strong { display: block; font-size: clamp(1.25rem, 2.6vw, 1.95rem); margin-top: 2px; overflow-wrap: anywhere; }
.plot { padding: 16px 20px; }
.chart-head { display: flex; justify-content: space-between; align-items: start; flex-wrap: wrap; gap: 4px 12px; }
.chart-head p { font-size: .84rem; }
canvas { width: 100%; height: clamp(265px, 32vh, 355px); display: block; margin: 12px 0 6px; touch-action: pan-y; }
output, .daily summary { color: var(--muted); font-size: .85rem; }
.daily { margin-top: 8px; }
.daily .table-scroll { max-height: 280px; }
.report { margin-top: 16px; overflow: hidden; }
.report nav { display: flex; overflow-x: auto; border-bottom: 1px solid var(--line); }
.report a { flex: 1 0 auto; padding: 13px 14px 10px; text-align: center; border-bottom: 3px solid transparent; }
.report a:hover { background: #f0f5ff; }
.report a[aria-current] { color: #153d7c; border-color: var(--blue); background: #edf4ff; font-weight: 700; }
.report > p { padding: 0 14px; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: 10px 14px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; white-space: normal; overflow-wrap: anywhere; min-width: 145px; }
th { background: #f7faff; }
tbody tr:hover { background: #f2f6ff; }
.notice { background: #fff0df; padding: 12px; border-radius: 8px; overflow-wrap: anywhere; }
@media (max-width: 820px) {
  .bar { padding-inline: 14px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { padding: 12px 14px; gap: 10px; }
  .side-nav { grid-auto-flow: column; justify-content: start; }
  main { border-left: 0; padding: 12px 14px 24px; }
  canvas { height: 240px; }
}
@media (max-width: 520px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card:nth-child(3) { border-left: 0; }
  .card:nth-child(n+3) { border-top: 1px solid var(--line); }
  .plot { padding: 12px; }
  .periods a { padding-inline: 10px; }
}

.auth {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}
.auth-panel { width: min(100%, 420px); padding: clamp(20px, 5vw, 36px); }
.auth-panel h1 { margin: 18px 0 12px; font-size: 1.55rem; line-height: 1.2; }
.auth-panel form { display: grid; gap: 8px; margin-top: 20px; }
.auth-panel label { font-weight: 600; margin-top: 4px; }
.auth-panel input { min-width: 0; padding: 9px 11px; border: 1px solid #aab8c7; border-radius: 8px; font: inherit; }
