/* ============================================================
   COMMAND DECK — reset, shell, typography
   Every value here comes from tokens.css. No literals.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html, body, h1, h2, h3, h4, p, figure, blockquote, dl, dd,
ul, ol, fieldset, legend { margin: 0; padding: 0; }

ul[class], ol[class] { list-style: none; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: var(--leading-base);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--d-fast) var(--e-out);
}
a:hover { color: var(--accent-hover); }

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--r-sm);
}

/* Numerals are monospace everywhere so columns of times line up. */
.num, .mono, time, td.num, .stat-value, .clock-face {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-tight);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: var(--sp-2);
  left: var(--sp-2);
  z-index: var(--z-toast);
  padding: var(--sp-2) var(--sp-4);
  background: var(--accent);
  color: var(--text-inverse);
  border-radius: var(--r-sm);
  font-weight: var(--weight-bold);
  transform: translateY(-200%);
  transition: transform var(--d-fast) var(--e-out);
}
.skip-link:focus { transform: translateY(0); }

/* ---------------- Application shell ---------------- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-surface-1);
  border-right: 1px solid var(--border-subtle);
  padding: var(--sp-5) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding-inline: var(--sp-2);
}

.brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: var(--accent);
  color: var(--text-inverse);
  border-radius: var(--r-sm);
  font-family: var(--font-num);
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-name {
  font-weight: var(--weight-bold);
  font-size: var(--text-base);
  letter-spacing: var(--tracking-tight);
}
.brand-org {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.nav { display: flex; flex-direction: column; gap: var(--sp-1); }

.nav-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
  padding: var(--sp-3) var(--sp-2) var(--sp-1);
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  border-left: 2px solid transparent;
  transition:
    background var(--d-fast) var(--e-out),
    color var(--d-fast) var(--e-out),
    border-color var(--d-fast) var(--e-out);
}
.nav-link:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.nav-link[aria-current="page"] {
  background: var(--accent-wash);
  color: var(--accent);
  border-left-color: var(--accent);
}

.nav-badge {
  min-width: 20px;
  padding: 0 var(--sp-1);
  border-radius: var(--r-full);
  background: var(--status-late);
  color: var(--text-inverse);
  font-family: var(--font-num);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-align: center;
}

.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: var(--sp-3); }

.who {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
}
.who-meta { min-width: 0; line-height: 1.3; }
.who-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.who-role {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

/* ---------------- Main column ---------------- */

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--header-h);
  border-bottom: 1px solid var(--border-subtle);
  background: color-mix(in oklab, var(--bg-base) 88%, transparent);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: 0 var(--sp-6);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

.topbar-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
}
.topbar-meta {
  display: flex; align-items: center; gap: var(--sp-4);
  font-size: var(--text-sm); color: var(--text-secondary);
}

.content {
  padding: var(--sp-8) var(--sp-6) var(--sp-16);
  max-width: var(--shell-max);
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.page-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
}
.page-sub { color: var(--text-secondary); font-size: var(--text-sm); }

.section-title {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
  font-weight: var(--weight-bold);
}

/* ---------------- Auth shell ---------------- */

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--sp-6);
  background:
    radial-gradient(
      ellipse 70% 55% at 50% -10%,
      var(--accent-wash),
      transparent 70%
    ),
    var(--bg-base);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--r-xl);
  padding: var(--sp-8);
  box-shadow: var(--elev-3);
}

.auth-head { text-align: center; margin-bottom: var(--sp-8); }
.auth-head .brand-mark { margin: 0 auto var(--sp-4); width: 44px; height: 44px; }
.auth-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
}
.auth-sub { color: var(--text-secondary); font-size: var(--text-sm); margin-top: var(--sp-1); }
.auth-foot {
  margin-top: var(--sp-6);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* ---------------- Responsive ---------------- */

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--sp-3);
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    padding: var(--sp-3) var(--sp-4);
  }
  .nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--sp-1);
    order: 3;
    width: 100%;
  }
  .nav-label { display: none; }
  .nav-link { border-left: none; border-bottom: 2px solid transparent; }
  .nav-link[aria-current="page"] { border-bottom-color: var(--accent); }
  .sidebar-footer { margin-top: 0; margin-left: auto; }
  .who { padding: var(--sp-2); }
  .who-meta { display: none; }
  .content { padding: var(--sp-6) var(--sp-4) var(--sp-12); }
  .topbar { padding: 0 var(--sp-4); }
  .topbar-meta .hide-sm { display: none; }
}

@media (max-width: 560px) {
  .page-head { align-items: flex-start; }
  .topbar-title { font-size: var(--text-base); }
}
