/* DigiCon SEO: minimal, corporate. One accent (navy), one typeface (IBM Plex Sans). */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/plex-sans-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/plex-sans-500.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/plex-sans-600.woff2") format("woff2"); }
:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e2e5ea;
  --border-strong: #cfd4db;
  --text: #17212e;
  --text-2: #5b6675;
  --muted: #8a93a0;
  --brand: #1e3a5f;
  --brand-ink: #ffffff;
  --brand-soft: #e9eef5;
  --link: #1d5c9f;
  --series-1: #2a78d6;
  --series-prev: #a3aab4;
  --grid: #edeff2;
  --good: #0b7a43;
  --bad: #c0362c;
  --rank-0: #1c5cab;
  --rank-1: #2a78d6;
  --rank-2: #5598e7;
  --rank-3: #86b6ef;
  --rank-4: #b6bcc5;
  --side-w: 272px;
  --radius: 8px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f141b;
    --surface: #161d26;
    --surface-2: #1d2631;
    --border: #27313d;
    --border-strong: #35414f;
    --text: #e8ecf1;
    --text-2: #a9b3bf;
    --muted: #7d8794;
    --brand: #2f5584;
    --brand-ink: #ffffff;
    --brand-soft: #1f2d3e;
    --link: #8fb8ec;
    --series-1: #3987e5;
    --series-prev: #5e6875;
    --grid: #222b36;
    --good: #4cc27c;
    --bad: #ef7b70;
    --rank-0: #9ec5f4;
    --rank-1: #6da7ec;
    --rank-2: #3987e5;
    --rank-3: #256abf;
    --rank-4: #4a5361;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; border-radius: 3px; }
.muted { color: var(--muted); }
h1, h2, h3 { font-weight: 600; margin: 0; }

/* ---------- shell ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w);
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 14px 14px; z-index: 20;
}
.main { margin-left: var(--side-w); padding: 28px 40px 72px; max-width: calc(1240px + var(--side-w)); }
body.no-nav .main { margin-left: 0; max-width: none; }

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; font-size: 16px; padding: 0 8px 18px; }
.brand:hover { text-decoration: none; }
.mark {
  width: 30px; height: 30px; border-radius: 6px; background: var(--brand); color: var(--brand-ink);
  display: inline-grid; place-items: center; font-size: 12px; font-weight: 600; letter-spacing: .02em;
}

.side-section { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.side-head { display: flex; flex-direction: column; padding: 16px 8px 10px; border-top: 1px solid var(--border); }
.side-head span:first-child { font-size: 13px; font-weight: 600; color: var(--text); }
.side-hint { font-size: 12px; color: var(--muted); }
.site-link {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 10px;
  padding: 8px 10px; border-radius: 6px; color: var(--text); margin-bottom: 2px; position: relative;
}
.site-link:hover { background: var(--surface-2); text-decoration: none; }
.site-link.on { background: var(--brand-soft); }
.site-link.on::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--brand); }
.site-link.paused { opacity: .6; }
.site-name { grid-column: 1; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-meta { grid-column: 1; display: flex; gap: 8px; font-size: 12px; color: var(--text-2); align-items: baseline; }
.site-meta .chg { font-size: 12px; }
.spark { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--muted); }
.site-link.on .spark { color: var(--series-1); }
.side-empty { font-size: 13px; color: var(--text-2); padding: 0 8px; }
.side-foot { border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.side-foot a { color: var(--text-2); padding: 7px 10px; border-radius: 6px; font-size: 14px; }
.side-foot a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.side-foot a.on { color: var(--text); background: var(--brand-soft); font-weight: 500; }

.mobilebar { display: none; }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }

@media (max-width: 900px) {
  .mobilebar {
    display: flex; position: sticky; top: 0; z-index: 30; align-items: center; justify-content: space-between;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px;
  }
  .mobilebar .brand { padding: 0; }
  .sidebar { top: 57px; width: min(320px, 88vw); transform: translateX(-100%); transition: transform .2s ease; }
  .nav-toggle:checked ~ .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(10, 16, 24, .35); }
  .sidebar > .brand { display: none; }
  .main { margin-left: 0; padding: 20px 16px 56px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* ---------- page head ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 26px; letter-spacing: -0.01em; line-height: 1.2; overflow-wrap: anywhere; }
.sub { color: var(--text-2); margin: 4px 0 0; font-size: 14px; }
.controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 7px; padding: 2px; }
.seg a { color: var(--text-2); padding: 5px 11px; border-radius: 5px; font-size: 13px; }
.seg a:hover { color: var(--text); text-decoration: none; }
.seg a.on { background: var(--brand); color: var(--brand-ink); }
.custom-range { position: relative; }
.custom-range summary { list-style: none; }
.custom-range summary::-webkit-details-marker { display: none; }
.range-form {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; display: flex; gap: 6px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; width: max-content; max-width: 90vw;
}
@media (max-width: 600px) { .range-form { right: auto; left: 0; } }

/* ---------- panels ---------- */
.panel, .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 16px; }
.panel-head h2, .card h2 { font-size: 15px; }
.card h2 { margin-bottom: 12px; }
.source { font-size: 12.5px; color: var(--muted); }
.panel.empty { padding: 32px; }
.panel.empty p { color: var(--text-2); max-width: 60ch; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .cols { grid-template-columns: 1fr; gap: 0; } }

/* headline metrics: one ruled row, not a grid of cards */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric { padding: 2px 20px; border-left: 1px solid var(--border); min-width: 0; }
.metric:first-child { border-left: 0; padding-left: 0; }
.m-label { font-size: 13px; color: var(--text-2); }
.m-value { font-size: 28px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.25; margin: 2px 0 4px; }
.m-change { font-size: 13px; }
.m-hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
@media (max-width: 760px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { padding: 12px 14px; border-left: 0; border-top: 1px solid var(--border); }
  .metric:nth-child(odd) { padding-left: 0; }
  .metric:nth-child(even) { border-left: 1px solid var(--border); }
  .metric:nth-child(-n+2) { border-top: 0; padding-top: 0; }
  .m-value { font-size: 23px; }
}

.chg { font-weight: 500; white-space: nowrap; }
.chg.good { color: var(--good); }
.chg.bad { color: var(--bad); }
.chg.flat, .chg.none { color: var(--muted); }

.notice { background: var(--brand-soft); border-left: 3px solid var(--brand); padding: 10px 14px; border-radius: 4px; color: var(--text-2); font-size: 14px; margin: 0 0 16px; }
.foot-note { font-size: 12.5px; color: var(--muted); margin: 12px 0 0; }

/* ---------- chart ---------- */
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--text-2); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 16px; height: 0; border-top: 2px solid var(--series-1); display: inline-block; }
.swatch.prev { border-top: 2px dashed var(--series-prev); }
.tabs { display: flex; flex-wrap: wrap; gap: 2px 18px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs button {
  border: 0; background: none; font: inherit; font-size: 14px; color: var(--text-2); cursor: pointer;
  padding: 6px 0 9px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--brand); font-weight: 500; }
.chart-box { position: relative; height: 300px; }
@media (max-width: 600px) { .chart-box { height: 230px; } }

/* ---------- bar lists ---------- */
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.bar-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 5px; }
.bar-val { font-weight: 500; white-space: nowrap; }
.bar-val .muted { font-weight: 400; }
.bar-val .chg { margin-left: 6px; font-size: 13px; }
.bar-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.track { height: 8px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.fill { height: 100%; background: var(--series-1); border-radius: 0 2px 2px 0; min-width: 2px; }
.fill.rank-0 { background: var(--rank-0); }
.fill.rank-1 { background: var(--rank-1); }
.fill.rank-2 { background: var(--rank-2); }
.fill.rank-3 { background: var(--rank-3); }
.fill.rank-4 { background: var(--rank-4); }
.mini-bar { display: flex; align-items: center; gap: 8px; }
.mini-bar .track { flex: 1; min-width: 60px; }
.mini-bar span { font-size: 12.5px; color: var(--text-2); min-width: 34px; text-align: right; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table-wrap.tall { max-height: 520px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 12px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
th:first-child, td:first-child { padding-left: 0; text-align: left; }
th:last-child, td:last-child { padding-right: 0; }
thead th { font-size: 12.5px; font-weight: 500; color: var(--text-2); position: sticky; top: 0; background: var(--surface); border-bottom-color: var(--border-strong); }
tbody th { font-weight: 400; }
tbody tr:hover > * { background: var(--surface-2); }
tfoot th, tfoot td { font-weight: 600; border-bottom: 0; border-top: 1px solid var(--border-strong); }
table.compact th, table.compact td { padding-top: 7px; padding-bottom: 7px; }
.wrap-cell { white-space: normal; overflow-wrap: anywhere; min-width: 160px; }
.row-site { display: block; font-size: 12px; color: var(--muted); }
.pos-move { color: var(--text-2); }
.share-col { min-width: 150px; }
tr.muted > * { color: var(--muted); }

/* ---------- forms & buttons ---------- */
input[type=text], input[type=password], input[type=date], input[type=number], input[type=file], select, textarea {
  font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 6px; padding: 7px 10px; max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--series-1); outline-offset: 0; border-color: transparent; }
select { cursor: pointer; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 14px; font-weight: 500; line-height: 1.3;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); padding: 7px 14px; border-radius: 6px; cursor: pointer;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand); filter: brightness(1.15); }
.btn-sm { font-size: 13px; padding: 5px 11px; }
.btn-danger { color: var(--bad); }
.inline { display: inline; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 14px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.sel-sm { padding: 4px 6px; font-size: 13px; }

/* settings layout */
.grid { display: grid; gap: 16px; }
.grid > .card { margin-bottom: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g3 { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .g2 { grid-template-columns: 1fr; } }

/* ---------- misc ---------- */
.flash { padding: 12px 14px; border-radius: 6px; margin-bottom: 18px; border: 1px solid var(--border); background: var(--surface); font-size: 14px; }
.flash-ok { border-left: 3px solid var(--good); }
.flash-err { border-left: 3px solid var(--bad); }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.status-dot.ok { background: var(--good); }
.status-dot.no { background: var(--bad); }
.status-dot.warn { background: #c98500; }
pre.log { background: var(--surface-2); padding: 12px; border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; margin: 0; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 13px; overflow-wrap: anywhere; }
details > summary { cursor: pointer; color: var(--text-2); font-weight: 500; }
.steps { padding-left: 20px; margin: 0; }
.steps li { margin-bottom: 8px; }

.auth-box { max-width: 380px; margin: 12vh auto 0; }
.auth-box .brand { padding: 0 0 18px; }
.auth-box h1 { font-size: 20px; margin-bottom: 14px; }
.auth-box input { width: 100%; }

.tag { display: inline-block; font-size: 11px; font-weight: 500; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; margin-left: 4px; vertical-align: 1px; }
.site-link.on .tag { background: var(--surface); }

/* 8-metric panels wrap into a second ruled row */
.metrics .metric:nth-child(4n+1) { border-left: 0; padding-left: 0; }
.metrics .metric:nth-child(n+5) { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 16px; }
@media (max-width: 760px) {
  .metrics .metric:nth-child(4n+1) { padding-left: 0; }
  .metrics .metric:nth-child(n+5) { margin-top: 0; padding-top: 12px; }
}
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 600px) { .split { grid-template-columns: 1fr; } }
.split .wrap-cell { min-width: 0; }
.split table { table-layout: auto; }
