/* SEO Radar — design tokens (validated data-viz palette, light+dark) */
:root {
  color-scheme: light;
  --surface-1:      #fcfcfb;
  --surface-2:      #f3f2ef;
  --page-plane:     #f9f9f7;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --gridline:       #e1e0d9;
  --baseline:       #c3c2b7;
  --border:         rgba(11, 11, 11, 0.10);
  --border-strong:  rgba(11, 11, 11, 0.16);

  --series-1: #2a78d6; /* blue   */
  --series-2: #eb6834; /* orange */
  --series-3: #1baf7a; /* aqua   */

  --good:     #0ca30c;
  --warning:  #fab219;
  --serious:  #ec835a;
  --critical: #d03b3b;
  --up:       #006300;
  --down:     #d03b3b;

  --radius-sm: 2px;
  --radius-md: 2px;
  --radius-lg: 3px;
  --sidebar-w: 232px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-1:      #1a1a19;
    --surface-2:      #212120;
    --page-plane:     #0d0d0d;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --gridline:       #2c2c2a;
    --baseline:       #383835;
    --border:         rgba(255, 255, 255, 0.10);
    --border-strong:  rgba(255, 255, 255, 0.16);

    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;

    --up:   #0ca30c;
    --down: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1:      #1a1a19;
  --surface-2:      #212120;
  --page-plane:     #0d0d0d;
  --text-primary:   #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted:     #898781;
  --gridline:       #2c2c2a;
  --baseline:       #383835;
  --border:         rgba(255, 255, 255, 0.10);
  --border-strong:  rgba(255, 255, 255, 0.16);

  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;

  --up:   #0ca30c;
  --down: #e66767;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page-plane);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--series-1); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Auth (no shell) ---- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 24px;
}
.auth-brand .mark {
  width: 28px; height: 28px;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--series-1), var(--series-3));
  flex-shrink: 0;
}

/* ---- Shell layout ---- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  padding: 6px 10px 20px;
}
.sidebar-brand .mark {
  width: 24px; height: 24px;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--series-1), var(--series-3));
  flex-shrink: 0;
}
.nav-group { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
}
.nav-item:hover { background: var(--surface-2); text-decoration: none; color: var(--text-primary); }
.nav-item.active { background: var(--surface-2); color: var(--text-primary); }
.nav-item .ico { width: 16px; text-align: center; opacity: 0.85; }
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }

.shell-main { flex: 1; min-width: 0; }
.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: var(--page-plane);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h1 { font-size: 15px; font-weight: 600; margin: 0; }
.breadcrumb { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.breadcrumb a { color: var(--text-secondary); }

main.content { padding: 28px; max-width: 1180px; margin: 0 auto; }
.page-desc { color: var(--text-secondary); font-size: 13.5px; margin: -6px 0 20px; max-width: 640px; }

/* ---- Primitives ---- */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 20px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}
.card h2 {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.card-head h2 { margin-bottom: 0; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

input, textarea, select {
  background: var(--page-plane);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid color-mix(in srgb, var(--series-1) 45%, transparent);
  outline-offset: 1px;
  border-color: var(--series-1);
}
label { font-size: 13px; color: var(--text-secondary); }

button {
  background: var(--series-1);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  transition: background .12s ease, opacity .12s ease;
}
button:hover { background: color-mix(in srgb, var(--series-1) 85%, black); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}
button.secondary:hover { background: var(--surface-2); }
button.ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 6px 10px;
}
button.ghost:hover { background: var(--surface-2); color: var(--text-primary); }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ---- Stat tiles ---- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.stat-tile { background: var(--surface-1); padding: 16px 18px; }
.stat-tile .label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.stat-tile .value { font-size: 26px; font-weight: 650; letter-spacing: -0.01em; }
.stat-tile .delta { font-size: 12.5px; margin-top: 4px; font-weight: 600; }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 3px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
}
.badge.on { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); background: color-mix(in srgb, var(--good) 10%, transparent); }
.badge.off { color: var(--text-muted); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.up   { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--text-muted); font-size: 13px; }
.error { color: var(--critical); margin-top: 8px; font-size: 13px; }

.hint { border-bottom: 1px dotted var(--text-muted); cursor: help; }
h2.hint, span.hint { display: inline-block; }
label.hint { border-bottom: none; }

.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

.site-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 4px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}
.site-card:last-child { border-bottom: none; }
.site-card:hover { text-decoration: none; }
.site-card:hover .site-domain { color: var(--series-1); }
.site-domain { font-weight: 600; font-size: 14px; }
.site-meta { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.site-arrow { color: var(--text-muted); font-size: 15px; }

.project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 12px;
}
.project-name { font-weight: 700; font-size: 15px; }

/* ---- Charts ---- */
.chart-wrap { position: relative; height: 260px; }
.chart-legend { display: flex; gap: 18px; margin-top: 12px; flex-wrap: wrap; }
.chart-legend .item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-secondary); }
.chart-legend .swatch { width: 10px; height: 10px; border-radius: 3px; }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 20px;
}
.modal {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 620px;
  max-height: 84vh;
  overflow: auto;
  padding: 22px 24px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.modal-title { font-size: 15px; font-weight: 650; }
.modal-close { background: transparent; color: var(--text-muted); border: none; font-size: 18px; padding: 2px 8px; }
.modal-close:hover { background: var(--surface-2); color: var(--text-primary); }

/* ---- Roadmap kanban ---- */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.kanban-col h2 { display: flex; align-items: center; gap: 8px; }
.kanban-col h2 .count { background: var(--surface-2); color: var(--text-secondary); border-radius: 3px; padding: 1px 8px; font-size: 11px; }
.roadmap-item { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: 10px; background: var(--page-plane); }
.roadmap-item .title { font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.roadmap-item .desc { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 8px; white-space: pre-line; }
.roadmap-item .meta { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }
.roadmap-item .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.roadmap-item .actions button { padding: 4px 9px; font-size: 11.5px; font-weight: 500; }
.roadmap-item.done { opacity: .8; }
.roadmap-item.done .title { text-decoration: line-through; text-decoration-color: var(--text-muted); }

/* ---- Guide / docs ---- */
.doc { max-width: 760px; font-size: 14px; line-height: 1.7; color: var(--text-secondary); }
.doc h2 { text-transform: none; letter-spacing: 0; font-size: 20px; color: var(--text-primary); margin: 0 0 6px; }
.doc h3 { font-size: 15px; color: var(--text-primary); margin: 22px 0 8px; }
.doc h3:first-child { margin-top: 0; }
.doc p { margin: 0 0 12px; }
.doc ol, .doc ul { margin: 0 0 14px; padding-left: 22px; }
.doc li { margin-bottom: 6px; }
.doc code { background: var(--surface-2); padding: 1px 6px; border-radius: 2px; font-size: 12.5px; color: var(--text-primary); }
.doc pre { background: var(--surface-2); padding: 12px 14px; border-radius: var(--radius-sm); overflow-x: auto; font-size: 12.5px; margin: 0 0 14px; }
.doc pre code { background: none; padding: 0; }
.doc .callout { border-left: 3px solid var(--series-1); background: color-mix(in srgb, var(--series-1) 8%, transparent); padding: 10px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 0 0 14px; font-size: 13px; }
.doc a { font-weight: 500; }
/* ---- Tabs ---- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 22px; padding-bottom: 0; }
.tab-btn {
  background: transparent; color: var(--text-secondary); border: none;
  padding: 10px 14px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  border-bottom: 2px solid transparent; border-radius: 0; margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text-primary); background: transparent; }
.tab-btn.active { color: var(--series-1); border-bottom-color: var(--series-1); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

@media (max-width: 960px) {
  .kanban { grid-template-columns: 1fr; }
}

/* ---- Filter bar ---- */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-bar select { min-width: 130px; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; padding: 10px 14px; }
  .nav-group { flex-direction: row; flex: none; }
  .sidebar-foot { border: none; margin: 0 0 0 auto; padding: 0; }
  main.content { padding: 18px; }
}
