@font-face {
  font-family: 'Space Grotesk';
  font-weight: 700;
  src: url('fonts/SpaceGrotesk-Bold.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  font-weight: 400;
  src: url('fonts/Inter-Regular.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  font-weight: 600;
  src: url('fonts/Inter-SemiBold.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-weight: 400;
  src: url('fonts/JetBrainsMono-Regular.ttf') format('truetype');
  font-display: swap;
}

:root {
  /* content pane */
  --bg: #eef2f0;
  --surface: #ffffff;
  --surface-2: #e6ece9;
  --ink: #16292b;
  --ink-dim: #4b6163;
  --line: #d7e0dc;
  --accent: #c1553a;
  --accent-ink: #ffffff;
  --accent-2: #2f7d74;
  --warn: #9a6a1f;
  --warn-bg: #f4e6cf;
  --shadow: 0 1px 2px rgba(22, 41, 43, 0.06), 0 8px 24px rgba(22, 41, 43, 0.05);

  /* sidebar: deliberately stays a dark console panel in both themes */
  --sidebar-bg: #0e2023;
  --sidebar-ink: #eaf2f0;
  --sidebar-ink-dim: #8fa6a4;
  --sidebar-line: #1c3639;
  --sidebar-active-bg: rgba(226, 118, 92, 0.14);
  --sidebar-active-ink: #e2765c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1a1c;
    --surface: #112628;
    --surface-2: #17302f;
    --ink: #eaf2f0;
    --ink-dim: #9db3b1;
    --line: #1f3a3d;
    --accent: #e2765c;
    --accent-ink: #16292b;
    --accent-2: #59bcae;
    --warn: #e0b56c;
    --warn-bg: #2c2412;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    --sidebar-bg: #081416;
    --sidebar-line: #142a2c;
    --sidebar-ink-dim: #7d9694;
  }
}

:root[data-theme="dark"] {
  --bg: #0b1a1c;
  --surface: #112628;
  --surface-2: #17302f;
  --ink: #eaf2f0;
  --ink-dim: #9db3b1;
  --line: #1f3a3d;
  --accent: #e2765c;
  --accent-ink: #16292b;
  --accent-2: #59bcae;
  --warn: #e0b56c;
  --warn-bg: #2c2412;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  --sidebar-bg: #081416;
  --sidebar-line: #142a2c;
  --sidebar-ink-dim: #7d9694;
}

:root[data-theme="light"] {
  --bg: #eef2f0;
  --surface: #ffffff;
  --surface-2: #e6ece9;
  --ink: #16292b;
  --ink-dim: #4b6163;
  --line: #d7e0dc;
  --accent: #c1553a;
  --accent-ink: #ffffff;
  --accent-2: #2f7d74;
  --warn: #9a6a1f;
  --warn-bg: #f4e6cf;
  --shadow: 0 1px 2px rgba(22, 41, 43, 0.06), 0 8px 24px rgba(22, 41, 43, 0.05);
  --sidebar-bg: #0e2023;
  --sidebar-line: #1c3639;
  --sidebar-ink-dim: #8fa6a4;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  min-height: 100vh;
}

/* ---- app shell ---- */

.shell {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.sidebar {
  flex: none;
  width: 232px;
  background: var(--sidebar-bg);
  color: var(--sidebar-ink);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px;
}

.brand .mark {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.brand .tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sidebar-ink-dim);
}

nav.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

nav.nav-group .group-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sidebar-ink-dim);
  padding: 10px 8px 4px;
}

nav.nav-group a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--sidebar-ink-dim);
  text-decoration: none;
  font-size: 13.5px;
  transition: background-color 0.12s ease, color 0.12s ease;
}

nav.nav-group a:hover {
  background: rgba(234, 242, 240, 0.06);
  color: var(--sidebar-ink);
}

nav.nav-group a.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-ink);
  font-weight: 600;
}

nav.nav-group a .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
  flex: none;
}

.sidebar-foot {
  margin-top: auto;
  padding: 10px 8px 0;
  border-top: 1px solid var(--sidebar-line);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--sidebar-ink-dim);
}

main.content {
  flex: 1;
  min-width: 0;
  padding: 48px 32px 80px;
}

.wrap {
  max-width: 900px;
  margin: 0 auto;
}

@media (max-width: 780px) {
  body { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding: 14px 16px;
  }
  .brand { padding: 0; }
  nav.nav-group { flex-direction: row; }
  nav.nav-group .group-label { display: none; }
  .sidebar-foot { display: none; }
  main.content { padding: 32px 20px 60px; }
}

/* ---- shared type / header ---- */

.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-2);
}

header.page {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 36px;
}

h1 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 700;
  margin: 0;
  text-wrap: balance;
  letter-spacing: -0.01em;
}

h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
}

.subhead {
  color: var(--ink-dim);
  max-width: 62ch;
  margin: 0;
}

/* ---- shared components ---- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.card-head h2, .card-head h3 {
  font-size: 15px;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card-head .meta {
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
  color: var(--ink-dim);
  font-size: 13px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.stat-value .accent { color: var(--accent); }
.stat-value .accent2 { color: var(--accent-2); }

.stat-note {
  font-size: 12.5px;
  color: var(--ink-dim);
}

.segbar {
  width: 100%;
  height: 28px;
  display: block;
  border-radius: 7px;
}

.legend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 14px;
  font-size: 13px;
}

.legend .item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-dim);
}

.legend .swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: none;
}

.legend strong {
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-weight: 400;
}

.table-scroll {
  overflow-x: auto;
  margin: 0 -4px 4px;
  padding: 0 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  font-size: 13.5px;
}

thead th {
  text-align: left;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding: 0 14px 10px 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

tbody td {
  padding: 13px 14px 13px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: none; }

td.num {
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.week-cell {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  white-space: nowrap;
}

.week-cell .date {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 400;
  font-size: 11.5px;
  color: var(--ink-dim);
  margin-top: 2px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.chip.warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.notes-cell {
  color: var(--ink-dim);
  max-width: 34ch;
}

.link-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: inherit;
}

.link-card .go {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  color: var(--accent-2);
  white-space: nowrap;
  flex: none;
}

.link-card:hover .go { text-decoration: underline; }

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 28px 24px;
  color: var(--ink-dim);
  font-size: 13.5px;
  text-align: left;
}

.empty-state strong {
  display: block;
  color: var(--ink);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  margin-bottom: 4px;
}

footer.page {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12.5px;
  color: var(--ink-dim);
  padding-top: 24px;
}

footer.page a { color: var(--accent-2); }

@media (prefers-reduced-motion: no-preference) {
  .stat-card, .card {
    animation: rise 0.4s ease both;
  }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}
