:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --border: #e3e8ef;
  --text: #1a1d23;
  --muted: #667085;
  --accent: #5e6ad2; /* Linear brand purple */
  --radius: 10px;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 10%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181d;
    --surface: #1e2127;
    --border: #2f333c;
    --text: #e6e8eb;
    --muted: #8b919e;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.skip-link {
  position: absolute;
  inset-inline-start: -9999px;
}
.skip-link:focus {
  inset-inline-start: 8px;
  inset-block-start: 8px;
  z-index: 10;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: var(--radius);
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: end;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  border-block-end: 1px solid var(--border);
}

.topbar__title { margin: 0; font-size: 1.05rem; font-weight: 600; }
.topbar__controls { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }

/* Layout rules using display: would otherwise beat the hidden attribute. */
[hidden] { display: none !important; }

/* Nothing but the title and the sign-in dialog until the server has served data. */
.signed-out .topbar__controls,
.signed-out .main { display: none; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field__label { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.field__input {
  padding: 7px 10px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.btn {
  padding: 8px 16px;
  font: inherit;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn:focus-visible, .field__input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.main { padding: 24px; max-width: 1400px; margin-inline: auto; }

.status { margin: 0 0 16px; color: var(--muted); font-size: 0.8rem; }
.status--error { color: #d92d20; }

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-block-end: 20px;
}

.kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.kpi__value { font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi__label { font-size: 0.72rem; color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-block-end: 20px;
}

.card {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card__title { margin: 0 0 14px; font-size: 0.8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.card__note { margin: -6px 0 14px; font-size: 0.78rem; color: var(--muted); }

.tabs { display: flex; gap: 4px; margin-block-end: 18px; border-block-end: 1px solid var(--border); }
.tab {
  padding: 9px 16px;
  border: 0;
  border-block-end: 2px solid transparent;
  margin-block-end: -1px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-block-end-color: var(--accent); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.bars { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.bars__row { display: grid; grid-template-columns: minmax(80px, 130px) 1fr 40px; gap: 10px; align-items: center; }
.bars__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.8rem; }
.bars__track { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.bars__fill { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bars__value { font-size: 0.8rem; text-align: end; color: var(--muted); font-variant-numeric: tabular-nums; }
.bars__empty { font-size: 0.8rem; color: var(--muted); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.table th { text-align: start; padding: 8px; color: var(--muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; border-block-end: 1px solid var(--border); }
.table td { padding: 9px 8px; border-block-end: 1px solid var(--border); vertical-align: middle; }
.table a { color: var(--accent); font-weight: 500; text-decoration: none; }
.table a:hover { text-decoration: underline; }
.table__title { max-width: 460px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table__date { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Stage columns are numeric and read best right-aligned and tabular. */
.table--perf .table__title { max-width: 280px; }
.table--perf th.num, .table--perf td.num { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.num--strong { font-weight: 600; }
.num--muted { color: var(--muted); }
.bars__fill--warn { background: #f79009; }
#perf-stages .bars__row { grid-template-columns: minmax(100px, 170px) 1fr 92px; }
.kpi__value--sm { font-size: 1.05rem; }
.kpi__sub { color: var(--muted); text-transform: none; letter-spacing: 0; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.7rem; font-weight: 500; background: var(--border); color: var(--text); }
.badge--completed { background: #d1fadf; color: #05603a; }
.badge--started { background: #fef0c7; color: #93370d; }
.badge--canceled { background: #fee4e2; color: #912018; }
.badge--backlog, .badge--unstarted, .badge--triage { background: var(--border); color: var(--muted); }

.auth::backdrop { background: rgb(0 0 0 / 45%); }
.auth {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.auth__form { display: flex; flex-direction: column; gap: 14px; padding: 24px; min-width: 300px; align-items: center; }
.auth__title { margin: 0; font-size: 1rem; }
.auth__hint { margin: 0; font-size: 0.78rem; color: var(--muted); text-align: center; }
.auth__error { margin: 0; font-size: 0.78rem; color: #d92d20; text-align: center; }

.user-chip { display: flex; align-items: center; gap: 8px; }
.user-chip__avatar { border-radius: 50%; }
.user-chip__email { font-size: 0.78rem; color: var(--muted); }
.btn--ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); padding: 6px 12px; }
.btn--ghost:hover { color: var(--text); filter: none; }
