:root {
  --bg: #0a0a0b;
  --surface: #141416;
  --surface2: #1c1c1f;
  --border: #2a2a2e;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --accent: #22c55e;
  --accent-dim: #166534;
  --warn: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, 'Cascadia Code', monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--sans); line-height: 1.5; }

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand h1 {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 400;
  margin: 0 0 0.15rem;
}

.brand p { margin: 0; color: var(--muted); font-size: 0.8rem; }

.nav { display: flex; flex-direction: column; gap: 0.35rem; margin: 1.5rem 0; }
.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
}
.nav-btn:hover { background: var(--surface2); color: var(--text); }
.nav-btn.active { background: var(--surface2); border-color: var(--border); color: var(--text); }

.disclaimer {
  font-size: 0.75rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  margin-top: 1rem;
}

.main { padding: 1.5rem 2rem 3rem; max-width: 1200px; }

.view { display: none; }
.view.active { display: block; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
}
.stat .v { font-size: 1.75rem; font-weight: 700; font-family: var(--serif); }
.stat .l { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat.accent .v { color: var(--accent); }

h2 { font-family: var(--serif); font-weight: 400; font-size: 1.75rem; margin: 0 0 0.5rem; }
.lead { color: var(--muted); max-width: 60ch; margin-bottom: 1.5rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { text-align: left; padding: 0.55rem 0.65rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; font-size: 0.75rem; text-transform: uppercase; }
tr:hover td { background: var(--surface2); }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}
.badge-success { background: var(--accent-dim); color: var(--accent); }
.badge-info { background: #1e3a5f; color: var(--info); }
.badge-warn { background: #422006; color: var(--warn); }
.badge-danger { background: #450a0a; color: var(--danger); }
.badge-neutral { background: var(--surface2); color: var(--muted); }

.chart-wrap { overflow-x: auto; margin: 1rem 0; }
.chart { width: 100%; max-width: 720px; height: auto; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .target { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.chart .actual { fill: none; stroke: var(--info); stroke-width: 2; stroke-dasharray: 6 4; }
.chart .ytick, .chart .xtick { fill: var(--muted); font-size: 10px; }

.week-list { display: flex; flex-direction: column; gap: 0.5rem; }
.week-item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 0.75rem;
  align-items: start;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.week-item:hover, .week-item.selected { background: var(--surface2); border-color: #3f3f46; }
.week-num { font-weight: 700; color: var(--accent); font-size: 0.9rem; }
.week-focus { font-weight: 600; font-size: 0.9rem; }
.week-meta { font-size: 0.75rem; color: var(--muted); }

.checklist label {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.9rem;
}
.checklist input { margin-top: 0.25rem; accent-color: var(--accent); }

.metrics-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}
.metrics-form label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.8rem; color: var(--muted); }
.metrics-form input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.55rem 0.65rem;
  font-size: 1rem;
}
.metrics-form input:focus { outline: 2px solid var(--accent); border-color: transparent; }

.btn {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
}
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }

.progress-bar {
  height: 8px;
  background: var(--surface2);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.5rem 0;
}
.progress-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.3s; }

@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .main { padding: 1rem; }
}
