/* Devboard styles. Tokens follow the dataviz reference palette; dark mode is
   selected steps from the same ramps, not an automatic flip. The data-theme
   override wins over the OS setting in both directions. */

* { box-sizing: border-box; margin: 0; padding: 0; }

.viz-root {
  color-scheme: light;
  /* surfaces and ink */
  --page:           #f9f9f7;
  --surface-1:      #fcfcfb;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --hairline:       #e1e0d9;
  --border:         rgba(11, 11, 11, 0.10);
  /* sparkline: one blue ramp, history de-emphasized, current week accent */
  --spark-hist:     #86b6ef;
  --spark-accent:   #2a78d6;
  --accent:         #2a78d6;
  --accent-ink:     #ffffff;
  /* status palette (fixed, never themed) */
  --status-good:    #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical:#d03b3b;
  --wash-serious:   rgba(236, 131, 90, 0.12);
  --wash-warning:   rgba(250, 178, 25, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .viz-root {
    color-scheme: dark;
    --page:           #0d0d0d;
    --surface-1:      #1a1a19;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --hairline:       #2c2c2a;
    --border:         rgba(255, 255, 255, 0.10);
    --spark-hist:     #1c5cab;
    --spark-accent:   #3987e5;
    --accent:         #3987e5;
    --accent-ink:     #ffffff;
    --wash-serious:   rgba(236, 131, 90, 0.16);
    --wash-warning:   rgba(250, 178, 25, 0.16);
  }
}
:root[data-theme="dark"] .viz-root {
  color-scheme: dark;
  --page:           #0d0d0d;
  --surface-1:      #1a1a19;
  --text-primary:   #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted:     #898781;
  --hairline:       #2c2c2a;
  --border:         rgba(255, 255, 255, 0.10);
  --spark-hist:     #1c5cab;
  --spark-accent:   #3987e5;
  --accent:         #3987e5;
  --accent-ink:     #ffffff;
  --wash-serious:   rgba(236, 131, 90, 0.16);
  --wash-warning:   rgba(250, 178, 25, 0.16);
}

html, body { min-height: 100%; }
body {
  background: var(--page, #f9f9f7);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.viz-root {
  background: var(--page);
  color: var(--text-primary);
  min-height: 100vh;
  padding: 0 12px calc(32px + env(safe-area-inset-bottom));
  overflow-x: clip;
}

.shell { max-width: 640px; margin: 0 auto; }

.boot {
  color: var(--text-muted);
  text-align: center;
  padding: 48px 0;
}

/* ---- header ---- */
.topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 14px 2px 10px;
}
.topbar h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.topbar .spacer { flex: 1; }
.synced { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.actions { display: flex; gap: 8px; margin-left: auto; }
.iconbtn {
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-secondary);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  padding: 6px 10px;
  cursor: pointer;
}
.iconbtn:active { transform: scale(0.97); }
.iconbtn[disabled] { opacity: 0.5; }

/* ---- filter chips ---- */
.chips {
  display: flex;
  gap: 8px;
  padding: 2px 2px 14px;
  overflow-x: auto;
}
.chip {
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-secondary);
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  padding: 7px 14px;
  cursor: pointer;
  white-space: nowrap;
}
.chip .count {
  color: var(--text-muted);
  font-size: 12px;
  margin-left: 4px;
}
.chip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.chip.on .count { color: var(--accent-ink); opacity: 0.8; }

/* ---- cards ---- */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 14px 10px;
  margin-bottom: 12px;
}
.card.slim { padding: 10px 14px; display: flex; align-items: center; gap: 8px; }
.card.slim .name { font-size: 14px; font-weight: 600; }
.card.slim .why { color: var(--text-muted); font-size: 12px; margin-left: auto; }

.cardhead { display: flex; align-items: center; gap: 10px; }
.headmain { flex: 1; min-width: 0; }
.titlerow { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.logo {
  position: relative;
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  overflow: hidden;
  align-self: center;
  background: var(--page);
  border: 1px solid var(--hairline);
}
.logo .mono {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 700;
  color: var(--text-secondary);
}
.logo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--surface-1);
}
.dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
  align-self: center;
}
.name { font-size: 16px; font-weight: 700; }
.statusword { color: var(--text-secondary); font-size: 12px; }
.stage {
  color: var(--text-muted);
  font-size: 12px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 1px 8px;
}
.touched { color: var(--text-muted); font-size: 12px; margin-left: auto; }

.summary { color: var(--text-secondary); font-size: 13px; margin-top: 6px; }

/* ---- activity row: sparkline + facts ---- */
.activity {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.spark { flex: none; display: block; }
.fact { color: var(--text-secondary); font-size: 12px; white-space: nowrap; }
.fact b { font-weight: 600; color: var(--text-primary); }
.ci { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.ci .ico { font-weight: 700; }
.activity.tappable { cursor: pointer; }
.actcaret { color: var(--text-muted); font-size: 11px; margin-left: auto; }

/* ---- activity panel: recent commits and open PRs ---- */
.actpanel {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--page);
  border: 1px solid var(--hairline);
  border-radius: 8px;
}
.daily { display: block; max-width: 100%; height: auto; margin: 2px 0 8px; }
.daily .charttick { font-size: 9px; fill: var(--text-muted); }
.daily .chartval { font-size: 9px; font-weight: 600; fill: var(--text-secondary); }
.actsub {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 4px 0 4px;
}
.actlist { list-style: none; margin: 0 0 4px; }
.actitem {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  padding: 3px 0;
}
.actitem.empty { color: var(--text-muted); }
.actitem .sha {
  flex: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--text-muted);
}
.actitem .cmsg {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}
.actitem .cwhen { flex: none; color: var(--text-muted); font-size: 12px; }
.actitem a {
  flex: 1;
  color: var(--accent);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.actitem .ci { flex: none; }

/* ---- blockers ---- */
.blocker {
  display: flex;
  gap: 8px;
  align-items: baseline;
  background: var(--wash-serious);
  border-left: 3px solid var(--status-serious);
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 10px;
  font-size: 13px;
}
.blocker .who {
  flex: none;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

/* ---- notices: advisory rows with a one-tap fix ---- */
.notice {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--wash-warning);
  border-left: 3px solid var(--status-warning);
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 10px;
  font-size: 13px;
}
.noticetext { flex: 1; }
/* Board-level variant sits between the chips and the first card. */
.boardnotice { margin: 0 0 14px; }
.notice a {
  flex: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

/* ---- steps ---- */
.steps { list-style: none; margin-top: 10px; border-top: 1px solid var(--hairline); }
.step { border-bottom: 1px solid var(--hairline); }
.steprow {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 2px;
  cursor: pointer;
}
.steptext { font-size: 14px; flex: 1; }
.step.done .steptext { color: var(--text-muted); text-decoration: line-through; }
.wheretag {
  flex: none;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 8px;
  margin-top: 1px;
  border: 1px solid var(--hairline);
  color: var(--text-secondary);
}
.wheretag.cloud { border-color: var(--accent); color: var(--accent); }
.stepactions {
  display: flex;
  gap: 8px;
  padding: 0 2px 10px;
  flex-wrap: wrap;
}
.stepactions a, .stepactions button {
  font: inherit;
  font-size: 13px;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-secondary);
}
.stepactions .primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.morecount { color: var(--text-muted); font-size: 12px; padding: 8px 2px; }
.editrow { padding: 8px 2px 4px; }
.editrow a {
  color: var(--text-muted);
  font-size: 12px;
  text-decoration: none;
}
.editrow a:active, .editrow a:hover { color: var(--accent); }

/* ---- sections ---- */
.sectionhead {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 18px 2px 8px;
}
.errnote { color: var(--status-critical); font-size: 12px; margin-top: 6px; }

/* ---- auth ---- */
.gate {
  text-align: center;
  padding: 80px 16px;
}
.gate h1 { font-size: 22px; margin-bottom: 6px; }
.gate p { color: var(--text-secondary); font-size: 14px; margin-bottom: 20px; }
.gate button {
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 10px;
  padding: 12px 22px;
  cursor: pointer;
}

/* ---- toast ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--page);
  font-size: 13px;
  border-radius: 999px;
  padding: 8px 16px;
  z-index: 10;
}
