:root {
  color-scheme: light;
  --page: #f1f3f4;
  --surface: #fcfcfb;
  --ink: #14171a;
  --ink-2: #50555b;
  --ink-3: #7b8187;
  --line: #dcdfe1;
  --line-soft: #e9ebec;
  --accent: #2a78d6;
  --anno-g: #b45309;
  --anno-m: #6d4bc4;
  --accent-ink: #1c5cab;
  --good: #0ca30c;
  --bad: #d03b3b;
  --band-1: #104281;
  --band-2: #256abf;
  --band-3: #5598e7;
  --band-4: #86b6ef;
  --url-1: #2a78d6;
  --url-2: #eb6834;
  --url-3: #1baf7a;
  --url-other: #b4b8bc;
  --display: "Bricolage Grotesque", "Geist", system-ui, sans-serif;
  --body: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
}
/* Light is the default. Dark is opt-in from Settings. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #111213;
  --surface: #1a1a19;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --ink-3: #8f8e86;
  --line: #313231;
  --line-soft: #262726;
  --accent: #3987e5;
  --anno-g: #f0a23b;
  --anno-m: #a48bf0;
  --accent-ink: #86b6ef;
  --bad: #e66767;
  --band-1: #b7d3f6;
  --band-2: #6da7ec;
  --band-3: #2a78d6;
  --band-4: #184f95;
  --url-1: #3987e5;
  --url-2: #d95926;
  --url-3: #199e70;
  --url-other: #5a5c5b;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 400 14px/1.45 var(--body); font-variant-numeric: tabular-nums;
}
h1, h2, h3 { font-family: var(--display); font-weight: 650; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 26px; line-height: 1.15; }
h2 { font-size: 17px; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Shell */
.top {
  display: flex; align-items: center; gap: 28px; padding: 0 24px; height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font: 650 18px var(--display); letter-spacing: -0.02em; color: var(--ink); }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; align-self: stretch; }
.nav a {
  display: flex; align-items: center; padding: 0 12px; color: var(--ink-2); font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.top .spacer { flex: 1; }
.stamp { color: var(--ink-3); font-size: 13px; }

.filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 24px;
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.filters label { display: flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 13px; }
select, input[type="text"], input[type="search"], input[type="password"], textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px;
}
select { padding-right: 26px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; background: none; padding: 6px 11px; cursor: pointer; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }

main { max-width: 1320px; margin: 0 auto; padding: 28px 24px 80px; }
.head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.sub { color: var(--ink-2); margin: 4px 0 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.panel + .panel, .grid + .panel, .panel + .grid, .tiles + .panel { margin-top: 16px; }
.panel > h2 { margin-bottom: 4px; }
.panel > .sub { margin: 0 0 14px; font-size: 13px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }

.btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 6px 12px;
  cursor: pointer; font-weight: 500;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
.muted { color: var(--ink-3); }
.note { color: var(--ink-2); font-size: 13px; }
.error { color: var(--bad); }

/* Stat tiles */
.tiles { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.tile .label { color: var(--ink-2); font-size: 13px; }
.tile .value { font: 650 30px/1.1 var(--display); letter-spacing: -0.02em; margin-top: 6px; }
.tile .delta { margin-top: 6px; font-size: 13px; color: var(--ink-2); min-height: 19px; }

/* Change indicators: the arrow carries the colour, the number stays ink. */
.chg { white-space: nowrap; }
.chg i { font-style: normal; font-size: 10px; margin-right: 3px; position: relative; top: -1px; }
.chg.up i { color: var(--good); }
.chg.down i { color: var(--bad); }
.chg.flat { color: var(--ink-3); }

/* Tables */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
th { font-weight: 500; color: var(--ink-2); font-size: 13px; white-space: nowrap; border-bottom-color: var(--line); }
th.num, td.num { text-align: right; }
th button { all: unset; cursor: pointer; }
th button:hover { color: var(--ink); }
th button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
th .dir { display: inline-block; width: 10px; color: var(--accent-ink); }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
tr.paused { color: var(--ink-3); }
td.kw a { color: var(--ink); font-weight: 500; }
td.kw a:hover { color: var(--accent-ink); }
.pos { font-weight: 600; font-size: 15px; }
.chip {
  display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; font-size: 12px;
  color: var(--ink-2); margin: 2px 4px 0 0; line-height: 19px; white-space: nowrap;
}
.badge { font-size: 12px; color: var(--ink-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-left: 6px; white-space: nowrap; }
.url { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; color: var(--ink-2); }

/* Rank rail: log scale from 1 (left) to 100 (right). */
.rail { position: relative; width: 132px; height: 18px; }
.rail::before { content: ""; position: absolute; left: 0; right: 0; top: 8px; height: 2px; background: var(--line); border-radius: 1px; }
.rail .tick { position: absolute; top: 5px; width: 1px; height: 8px; background: var(--ink-3); opacity: .55; }
.rail .tail { position: absolute; top: 7px; height: 4px; border-radius: 2px; opacity: .5; }
.rail .tail.up { background: var(--good); }
.rail .tail.down { background: var(--bad); }
.rail .was { position: absolute; top: 5px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; border: 1.5px solid var(--ink-3); background: var(--surface); }
.rail .now { position: absolute; top: 3px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.railhead { position: relative; width: 132px; height: 14px; font-size: 11px; color: var(--ink-3); }
.railhead span { position: absolute; transform: translateX(-50%); }
.railhead span:first-child { transform: none; }
.railhead span:last-child { transform: translateX(-100%); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
.bulk { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; margin-bottom: 12px;
  border: 1px solid var(--accent); border-radius: 8px; background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 12px; color: var(--ink-2); font-size: 13px; }

/* Charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { font: 12px var(--body); fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.chart .ptitle { fill: var(--ink-2); font-weight: 500; }
.chart .gridline { stroke: var(--line-soft); stroke-width: 1; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--accent); opacity: .28; }
.chart .bar { fill: var(--accent); opacity: .8; }
.chart .cross { stroke: var(--ink-3); stroke-width: 1; }
.chart .hot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart .incomplete { fill: var(--ink-3); opacity: .08; }
.chart .dlabel { fill: var(--ink-2); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; background: var(--sw); }
.tip {
  position: fixed; z-index: 10; pointer-events: none; background: var(--ink); color: var(--surface);
  border-radius: 6px; padding: 8px 10px; font-size: 12px; line-height: 1.5; max-width: 320px;
  box-shadow: 0 4px 14px rgb(0 0 0 / .18);
}
.tip b { font-weight: 600; }
.tip .row { display: flex; justify-content: space-between; gap: 16px; }
.tip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.spark { display: block; }
.spark path { fill: none; stroke: var(--ink-2); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: var(--accent); }

.strip { display: flex; height: 14px; border-radius: 3px; overflow: hidden; background: var(--line-soft); }
.strip div { height: 100%; }

/* Movers */
.mover { display: grid; grid-template-columns: minmax(0, 1fr) 132px 64px 118px; gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.mover:last-child { border-bottom: 0; }
.mover a { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Forms */
.login { max-width: 380px; margin: 14vh auto 0; }
.login h1 { margin-bottom: 6px; }
.formrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
textarea { width: 100%; min-height: 150px; resize: vertical; }
.empty { text-align: center; padding: 48px 16px; color: var(--ink-2); }
.empty h2 { margin-bottom: 6px; color: var(--ink); }
.back { display: inline-block; margin-bottom: 10px; font-size: 13px; }
progress { width: 220px; accent-color: var(--accent); }

@media (prefers-reduced-motion: no-preference) {
  .rail .now, .rail .tail { transition: left .25s ease, width .25s ease; }
}
@media (max-width: 700px) {
  .top { gap: 12px; padding: 0 14px; overflow-x: auto; }
  .filters { padding: 10px 14px; }
  main { padding: 18px 14px 60px; }
}

/* Rail inner track keeps the end dots inside the cell. */
.rail .in, .railhead .in { position: absolute; left: 7px; right: 7px; top: 0; bottom: 0; }
.tip .sw { vertical-align: middle; }
.grid > .panel { margin-top: 0; }
td.kw { min-width: 220px; }

/* Tiles share the row evenly whether there are four or five. */
@media (min-width: 901px) { .tiles { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); } }
.grid + .grid { margin-top: 16px; }

/* A value with its change shown directly beneath it. */
.stack { display: inline-flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.stack .chg { font-size: 12px; margin-top: 2px; }
th .hint { display: block; font-weight: 400; font-size: 11px; color: var(--ink-3); }
.themebtn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; margin-left: -12px; white-space: nowrap; }
.mover > span { text-align: right; white-space: nowrap; }
.mover.mhead { font-size: 12px; color: var(--ink-3); padding: 0 0 6px; border-bottom-color: var(--line); }
.mover.mhead > span:first-child { text-align: left; }
.mover a .muted { margin-left: 4px; }
.chart .simline { stroke-dasharray: 1 6; stroke-width: 2.4; }
.simmark { color: var(--ink-3); margin-right: 1px; }
.spark .simline { stroke-dasharray: 0.5 3; stroke-width: 1.6; }
input[type="date"] { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }

.mover .pos { font-size: 14px; }
.urlbadge { cursor: help; }
.menuwrap { position: relative; display: inline-block; }
.iconbtn { border: 0; background: none; color: var(--ink-3); padding: 6px; border-radius: 6px; cursor: pointer; line-height: 0; }
.iconbtn:hover, .iconbtn[aria-expanded="true"] { color: var(--ink); background: var(--line-soft); }
.menu { position: absolute; right: 0; top: 100%; z-index: 5; min-width: 150px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px; box-shadow: 0 6px 18px rgb(0 0 0 / .14); display: flex; flex-direction: column; }
.menu button { border: 0; background: none; text-align: left; padding: 7px 10px; border-radius: 5px; cursor: pointer; white-space: nowrap; }
.menu button:hover { background: var(--line-soft); }
.menu button.danger { color: var(--bad); }

/* Competing URLs tooltip: one line per URL, figures aligned in columns. */
.tip:has(.urltip) { max-width: 520px; }
.urltip { width: 460px; max-width: 80vw; }
.urlgrid { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; column-gap: 18px; row-gap: 4px; margin-top: 8px; align-items: baseline; }
.urlgrid .h { opacity: .65; font-size: 11px; padding-bottom: 2px; }
.urlgrid .n { text-align: right; font-weight: 600; white-space: nowrap; }
.urlgrid .h.n { font-weight: 400; }
.urlgrid .u { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.urltip .more { opacity: .65; margin-top: 6px; }

/* Tag filter menu */
.tagmenu { left: 0; right: auto; min-width: 250px; padding: 10px; gap: 8px; }
.tagmenu .seg { align-self: flex-start; }
.tagmenu .seg button { padding: 5px 10px; }
.taglist { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; }
.taglist label { display: flex; align-items: center; gap: 8px; padding: 4px 4px; border-radius: 5px; color: var(--ink); font-size: 14px; cursor: pointer; }
.taglist label:hover { background: var(--line-soft); }
.taglist .muted { margin-left: auto; font-size: 12px; }
.menu button.clear { color: var(--ink-2); }
.menu button:disabled { opacity: .45; cursor: default; }
/* Click rate editor */
.ctrgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 16px; margin: 12px 0 16px; }
.ctrgrid label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--ink-2); }
.ctrgrid .muted { font-size: 12px; }
.pctbox { display: flex; align-items: center; gap: 4px; color: var(--ink); }
.pctbox input { width: 92px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }
.notranking { color: var(--ink-3); font-weight: 400; font-size: 13px; white-space: nowrap; }
.tile .value .notranking { font-size: 20px; font-family: var(--body); letter-spacing: 0; }
#kwbody { margin-top: 16px; }

/* Share of impressions bar in the Locations table. */
.sharebar { position: relative; height: 18px; background: var(--line-soft); border-radius: 3px; min-width: 120px; }
.sharebar div { height: 100%; background: var(--accent); opacity: .8; border-radius: 3px 0 0 3px; }
.sharebar span { position: absolute; right: 6px; top: 0; line-height: 18px; font-size: 12px; color: var(--ink-2); }
tr.current td.kw a { color: var(--accent-ink); }

/* Help marks */
.help {
  display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; margin-left: 5px;
  border: 1px solid var(--ink-3); border-radius: 50%; color: var(--ink-3); font: 600 10px/1 var(--body);
  cursor: help; vertical-align: 1px; user-select: none; flex: none; letter-spacing: 0;
}
.help:hover, .help:focus-visible { color: var(--surface); background: var(--ink-2); border-color: var(--ink-2); }
h2 .help { vertical-align: 3px; }
.thflex { display: flex; align-items: center; }
.filters > .help { margin-left: -4px; }
#loc-table.collapsed tr.extra { display: none; }

.panelhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.seg.small button { padding: 3px 9px; font-size: 12px; }

/* Navigation and filters stay in view while the page scrolls. */
.stickybar { position: sticky; top: 0; z-index: 8; box-shadow: 0 1px 0 var(--line), 0 4px 10px rgb(0 0 0 / .04); }
.stickybar .filters { border-bottom: 0; }
.movers.collapsed .mover.extra { display: none; }
.movers .mover:last-child { border-bottom: 0; }

/* FAQ */
.faq { max-width: 860px; }
.faq .panel > h2 { margin-bottom: 8px; }
.faq details { border-top: 1px solid var(--line-soft); }
.faq details:first-of-type { border-top: 0; }
.faq summary { cursor: pointer; padding: 12px 2px; font-weight: 500; list-style: none; display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--ink-3); font-size: 18px; line-height: 1; flex: none; }
.faq details[open] summary::after { content: "\2212"; }
.faq summary:hover { color: var(--accent-ink); }
.faq .answer { padding: 0 2px 14px; color: var(--ink-2); max-width: 70ch; line-height: 1.6; }
.faq .answer p { margin: 0 0 10px; }
.faq .answer ul { margin: 0 0 10px; padding-left: 20px; }
.faq .answer li { margin-bottom: 4px; }
.faq .answer b { color: var(--ink); font-weight: 600; }
code { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--line-soft); padding: 1px 5px; border-radius: 4px; }
.chart .anno { opacity: .1; pointer-events: none; }
.chart .anno.g { fill: var(--anno-g); } .chart .anno.m { fill: var(--anno-m); }
.chart .annoline { stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.chart .annoline.g { stroke: var(--anno-g); } .chart .annoline.m { stroke: var(--anno-m); }
.chart .annomark { stroke: var(--surface); stroke-width: 1; pointer-events: none; }
.chart .annomark.g { fill: var(--anno-g); } .chart .annomark.m { fill: var(--anno-m); }
.am { display: inline-block; flex: none; width: 9px; height: 9px; margin-right: 7px; }
.am.g { background: var(--anno-g); clip-path: polygon(0 10%, 100% 10%, 50% 95%); }
.am.m { background: var(--anno-m); border-radius: 50%; width: 8px; height: 8px; }
.annotip { display: flex; align-items: baseline; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line-soft); max-width: 260px; }
.annotip small { color: var(--ink-3); }
.annolist { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 13px; }
.annolist li { display: flex; align-items: baseline; }
label.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; margin-right: 14px; }
tr.dim td { opacity: .5; }
.btn.small { padding: 3px 9px; font-size: 12px; }
/* Tiles share three rows (title, figure, note) so figures line up across a row
   however many lines each title or note takes. Titles sit at the top. */
.tiles { row-gap: 0; }
.tile { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 0; margin-bottom: 16px; }
.tile .label { align-self: start; }
.tile .value { align-self: end; }
.tiles + .panel { margin-top: 0; }

/* ---------- report ---------- */
.reportbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.reportbar .sub { margin: 0; }
.report { max-width: 1000px; margin: 0 auto; }
.reporthead { margin-bottom: 18px; }
.reporthead h1 { margin: 0; }
.reportsite { font: 600 17px var(--display); margin: 4px 0 6px; }
.report table { width: 100%; }
.reportfoot { margin-top: 16px; }
@page { size: A4; margin: 12mm; }
@media print {
  :root { color-scheme: light; }
  body { background: #fff; }
  .stickybar, .noprint, .help, #tip, .seg { display: none !important; }
  #view { padding: 0; max-width: none; }
  .report { max-width: none; }
  .report .panel, .report .tile { break-inside: avoid; box-shadow: none; }
  .report .tiles { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  .report .tile .value { font-size: 22px; }
  .report .grid { grid-template-columns: 1fr 1fr; }
  .report tr { break-inside: avoid; }
  .report a { color: inherit; text-decoration: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- AI analysis ---------- */
.aiout { max-width: 78ch; line-height: 1.55; }
.aiout h3 { font: 650 16px var(--display); margin: 20px 0 6px; }
.aiout h3:first-child { margin-top: 4px; }
.aiout p { margin: 0 0 10px; }
.aiout ul { margin: 0 0 10px; padding-left: 20px; }
.aiout li { margin-bottom: 5px; }
.aitext { width: 100%; font: inherit; line-height: 1.5; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: inherit; resize: vertical; }
.synopsis .aiout { max-width: none; }
#syn-panel { max-width: 1000px; margin: 0 auto 16px; }

/* ---------- keywords table ---------- */
/* The tick box and keyword stay put while the rest scrolls sideways. Number
   columns share one width: the label wraps and its help mark sits beside it. */
.kwtable { border-collapse: separate; border-spacing: 0; }
.kwtable th { vertical-align: bottom; }
.kwtable th:nth-child(-n+2), .kwtable td:nth-child(-n+2) { position: sticky; z-index: 2; background: var(--surface); }
.kwtable th:nth-child(1), .kwtable td:nth-child(1) { left: 0; width: 38px; min-width: 38px; max-width: 38px; box-sizing: border-box; }
.kwtable th:nth-child(2), .kwtable td:nth-child(2) { left: 38px; box-shadow: 1px 0 0 var(--line); }
.kwtable th.num, .kwtable td.num { padding-left: 8px; padding-right: 8px; }
.kwtable th.num { width: 98px; min-width: 98px; max-width: 98px; box-sizing: border-box; white-space: normal; line-height: 1.25; }
.kwtable td.num { white-space: nowrap; }
.kwtable .thwrap { display: flex; justify-content: flex-end; align-items: flex-end; gap: 2px; }
.kwtable th.num .thwrap button { text-align: right; min-width: 0; }
.kwtable th.num .thwrap .help { flex: none; margin-left: 2px; }
.kwtable th .dir { width: auto; }
.kwtable tbody tr:hover td:nth-child(-n+2) { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.kwtable th:not(.num) .thwrap { justify-content: flex-start; }
.topscroll { overflow-x: auto; overflow-y: hidden; }
.topscroll > div { height: 1px; }
.topscroll[hidden] { display: none; }
/* Both keyword table scrollbars are drawn the same way and stay visible. */
.topscroll { margin-bottom: 4px; }
.topscroll::-webkit-scrollbar, #kw-wrap::-webkit-scrollbar { height: 10px; }
.topscroll::-webkit-scrollbar-track, #kw-wrap::-webkit-scrollbar-track { background: var(--line-soft); border-radius: 5px; }
.topscroll::-webkit-scrollbar-thumb, #kw-wrap::-webkit-scrollbar-thumb { background: var(--ink-3); border-radius: 5px; }
.topscroll::-webkit-scrollbar-thumb:hover, #kw-wrap::-webkit-scrollbar-thumb:hover { background: var(--ink-2); }
@supports not selector(::-webkit-scrollbar) {
  .topscroll, #kw-wrap { scrollbar-width: thin; scrollbar-color: var(--ink-3) var(--line-soft); }
}

/* ---------- sign-in and users ---------- */
.authform { display: grid; gap: 12px; margin: 14px 0 6px; }
.authform label, .userform label { display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); }
.authform input, .userform input[type=text], .userform input[type=email], .userform select { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); }
.login details { margin-top: 14px; }
.login summary { cursor: pointer; }
.who { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userform { display: grid; gap: 12px; max-width: 520px; padding: 6px 0; }
.userform label.check { display: inline-flex; grid-template-columns: none; color: var(--ink); }
.sitepick { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px 10px; margin: 0; }
.sitepick legend { font-size: 13px; color: var(--ink-2); padding: 0 4px; }
.sitepick[hidden] { display: none; }
.useracts { white-space: nowrap; }
.useracts .btn { margin-left: 4px; }
.btn.danger { color: var(--bad); }
.linkbox { border: 1px solid var(--accent); border-radius: 8px; padding: 4px 14px 12px; margin-bottom: 14px; background: color-mix(in srgb, var(--accent) 6%, transparent); }
.kwtable.ro th:nth-child(1), .kwtable.ro td:nth-child(1) { width: 0; min-width: 0; max-width: 0; padding: 0; overflow: hidden; }
.kwtable.ro th:nth-child(2), .kwtable.ro td:nth-child(2) { left: 0; }

/* ---------- Optimoze Analytics additions ---------- */
.brand2 { color: var(--accent-ink); }
.filters .spacer { flex: 1; }
.panelhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.headacts { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.gnote { margin: -8px 0 16px; }
.okmsg { color: var(--good); font-weight: 500; }
.fetched { margin-top: 18px; text-align: right; color: var(--ink-3); }
code { font-size: 12px; background: var(--line-soft); padding: 1px 5px; border-radius: 4px; word-break: break-all; }
.chart .cmpline { stroke-dasharray: 5 4; stroke-width: 1.6; }
.legend span.dashed::before { height: 2px; width: 14px; background: repeating-linear-gradient(90deg, var(--sw) 0 4px, transparent 4px 7px); vertical-align: middle; }
td.lbl { max-width: 420px; }
.path { display: inline-block; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.sharecell { white-space: nowrap; font-size: 12px; color: var(--ink-2); }
.sharecell span { display: inline-block; width: 42px; text-align: right; }
.sharebar { display: inline-block; vertical-align: middle; width: 70px; height: 6px; border-radius: 3px; background: var(--line-soft); overflow: hidden; }
.sharebar div { height: 100%; background: var(--accent); opacity: .75; }
.tile .label .help { margin-left: 4px; }
@media print {
  #view .panel, #view .tile { break-inside: avoid; box-shadow: none; }
  #view .tiles { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  #view .tile .value { font-size: 22px; }
  #view .grid { grid-template-columns: 1fr 1fr; }
  #view tr { break-inside: avoid; }
  .pager, .headacts, .toolbar { display: none !important; }
}
@media (min-width: 901px) { .tiles { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); } }
.tile .value { font-size: 27px; }
