/* CTO Dashboard — dark, single committed theme. No external fonts or assets. */

:root {
  color-scheme: dark;
  --bg:        #101216;
  --surface:   #171a20;
  --surface-2: #1d2128;
  --line:      #262b34;
  --line-soft: #1f242c;
  --ink:       #e9ecf1;
  --ink-2:     #aab2c0;
  --ink-3:     #78818f;

  --s1: #3987e5;  /* blue    */
  --s2: #d95926;  /* orange  */
  --s3: #199e70;  /* aqua    */
  --s4: #c98500;  /* yellow  */
  --s5: #d55181;  /* magenta */
  --s7: #9085e9;  /* violet  */
  --s8: #e66767;  /* red     */

  --good: #199e70;
  --warn: #c98500;
  --bad:  #e66767;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
a { color: inherit; }
small { font-size: 11px; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.muted { color: var(--ink-2); }
.warn  { color: var(--warn); }

/* ── top bar ───────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: wrap; gap: 14px;
  align-items: center; justify-content: space-between;
  padding: 14px 24px;
  background: rgba(16,18,22,.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 17px; }
.brand .sub { color: var(--ink-3); font-size: 12px; }
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--s1); box-shadow: 0 0 0 4px rgba(57,135,229,.15);
}
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.segmented a {
  padding: 5px 11px; border-radius: 7px; font-size: 12px;
  color: var(--ink-2); text-decoration: none; white-space: nowrap;
}
.segmented a.on { background: var(--s1); color: #fff; }

.chip {
  font-size: 11.5px; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink-2); background: var(--surface);
  text-decoration: none; white-space: nowrap;
}
.chip.ok   { border-color: rgba(25,158,112,.4); color: #74d3ae; }
.chip.warn { border-color: rgba(201,133,0,.45); color: #e2ab3e; }
.chip.plain:hover { color: var(--ink); border-color: var(--ink-3); }

/* ── layout ────────────────────────────────────────────────────────────── */
main { max-width: 1440px; margin: 0 auto; padding: 8px 24px 64px; }
.band { margin-top: 34px; }
.band-head { margin-bottom: 14px; }
.band-head h2 { font-size: 15px; letter-spacing: .01em; }
.band-head p { margin: 5px 0 0; font-size: 12.5px; max-width: 78ch; color: var(--ink-2); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card.wide { width: 100%; overflow: hidden; }

/* ── stat tiles ────────────────────────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; }
.tile {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 15px; box-shadow: var(--shadow);
}
.tile-label { font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .07em; }
.tile-value { font-size: 27px; font-weight: 600; margin-top: 7px; letter-spacing: -0.02em; }
.tile-value small { font-size: 14px; color: var(--ink-2); font-weight: 500; margin-left: 1px; }
.tile-hint { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; }
.tile.tone-good { border-color: rgba(25,158,112,.35); }
.tile.tone-warn { border-color: rgba(201,133,0,.4); }
.tile.tone-bad  { border-color: rgba(230,103,103,.4); }

.delta { font-size: 12px; font-weight: 500; margin-left: 4px; vertical-align: 3px; }
.delta.good { color: #74d3ae; }
.delta.bad  { color: #f08c8c; }
.delta.flat { color: var(--ink-3); }

/* ── charts ────────────────────────────────────────────────────────────── */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line-soft); stroke-width: 1; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .ax   { fill: var(--ink-3); font-size: 9.5px; font-family: inherit; }
.chart .bar  { transition: opacity .12s ease; }
.chart .bar:hover { opacity: .78; }
.spark { width: 96px; height: 24px; display: block; margin-left: auto; }

.legend { display: flex; gap: 16px; margin-top: 10px; padding-left: 34px; flex-wrap: wrap; }
.lg { font-size: 11.5px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.lg i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

/* ── teams ─────────────────────────────────────────────────────────────── */
.grid-teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 14px; }
.card.team { border-top: 2px solid var(--accent); }
.card.team header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card.team h3 { font-size: 14px; }
.tag {
  font-size: 10.5px; color: var(--ink-3); border: 1px solid var(--line);
  padding: 2px 7px; border-radius: 999px; white-space: nowrap;
}
.tag.soft { margin-left: 6px; color: var(--ink-3); }
.tag.soft.warn { color: var(--warn); border-color: rgba(201,133,0,.4); }
.tag.live { color: #74d3ae; border-color: rgba(25,158,112,.45); }

.team-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 8px; margin-bottom: 14px; }
.team-nums div b { display: block; font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
.team-nums div span { font-size: 11px; color: var(--ink-3); }
.team-nums div.warn b { color: var(--warn); }
.card.team .foot { margin: 10px 0 0; font-size: 11.5px; color: var(--ink-3); }

/* ── sprint ────────────────────────────────────────────────────────────── */
.sprint-now {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft);
  display: grid; grid-template-columns: 1fr 260px auto; gap: 14px; align-items: center;
}
.sprint-now b { font-weight: 600; margin: 0 8px; }
.meter { height: 7px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 999px; }
.meter-cap { font-size: 11.5px; color: var(--ink-3); margin-top: 5px; }

/* ── tables ────────────────────────────────────────────────────────────── */
.people-block { margin-bottom: 14px; border-left: 2px solid var(--accent); }
.people-block h3 { font-size: 13px; margin-bottom: 10px; color: var(--ink); }

table { width: 100%; border-collapse: collapse; }
table.people th, table.attn th {
  text-align: left; font-size: 10.5px; font-weight: 500; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-3); padding: 6px 10px; border-bottom: 1px solid var(--line);
}
table.people td, table.attn td {
  padding: 9px 10px; border-bottom: 1px solid var(--line-soft); font-size: 13px; vertical-align: middle;
}
table.people tr:last-child td, table.attn tr:last-child td { border-bottom: 0; }
.num { text-align: right; white-space: nowrap; }
th.num { text-align: right; }
tr.ext { opacity: .7; }

.av {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 10.5px; font-weight: 600; color: var(--ink-2); margin-right: 9px;
}
.nm { font-weight: 500; }

.kind {
  display: inline-block; font-size: 10.5px; padding: 2px 8px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
}
.k-blocked    { background: rgba(230,103,103,.16); color: #f08c8c; }
.k-overdue    { background: rgba(217,89,38,.16);   color: #eb8b63; }
.k-priority   { background: rgba(201,133,0,.16);   color: #e2ab3e; }
.k-stale      { background: rgba(144,133,233,.16); color: #b3aaf1; }
.k-unassigned { background: rgba(57,135,229,.16);  color: #7fb1ef; }
.key a { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--s1); text-decoration: none; white-space: nowrap; }
.key a:hover { text-decoration: underline; }
.sum { max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.why { white-space: nowrap; font-size: 12px; }
.empty { color: var(--ink-3); margin: 6px 2px; }

/* ── footer ────────────────────────────────────────────────────────────── */
.page-foot { margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--line); }
.page-foot p { font-size: 12px; max-width: 92ch; }
.warn-line { color: var(--warn); }

/* ── login ─────────────────────────────────────────────────────────────── */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card {
  width: 100%; max-width: 340px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px; padding: 30px 26px; box-shadow: var(--shadow);
}
.login-mark { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--s1); margin-bottom: 14px; }
.login-card h1 { font-size: 20px; }
.login-card p { margin: 5px 0 22px; font-size: 12.5px; }
.login-card input, .login-card button {
  width: 100%; padding: 11px 13px; border-radius: 9px; font: inherit; font-size: 14px;
}
.login-card input {
  background: var(--bg); border: 1px solid var(--line); color: var(--ink); margin-bottom: 10px;
}
.login-card input:focus { outline: none; border-color: var(--s1); }
.login-card button { background: var(--s1); color: #fff; border: 0; cursor: pointer; font-weight: 500; }
.login-card button:hover { filter: brightness(1.08); }
.login-error { margin-top: 12px; font-size: 12.5px; color: #f08c8c; }

/* ── responsive ────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  main { padding: 8px 16px 48px; }
  .topbar { padding: 12px 16px; }
  .sprint-now { grid-template-columns: 1fr; }
  table.people, table.attn { display: block; overflow-x: auto; white-space: nowrap; max-width: 100%; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .team-nums { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sum { max-width: 30ch; }
}

.grid-slack { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; align-items: start; }
.grid-slack h3 { font-size: 13px; margin-bottom: 10px; }
.small-note { font-size: 11.5px; margin: -4px 0 10px; }
@media (max-width: 1050px) { .grid-slack { grid-template-columns: 1fr; } }

/* Grid and flex children default to min-width:auto, so a wide table refuses to shrink
   and pushes the whole page sideways on a phone. Let them shrink and scroll inside. */
.card, .tile, .grid-teams > *, .grid-slack > *, .tiles > * { min-width: 0; }
.card { overflow: hidden; }
.people-block, .card.wide { overflow-x: auto; }
table.people, table.attn { max-width: 100%; }
