/* Steady - warm paper theme, white surfaces, amber accent.
   Tokens (unchanged): paper #f5f4f0, surfaces #fffdf9 / #ffffff, ink #1c1b1a,
   secondary #55524c, muted #8a867e, hairline rgba(28,27,26,0.09),
   amber #9a3412, amber line #d97706, heat steps #f3e2c7 #eec27f #dd8f2a #9a3412,
   good #3f6212, behind #991b1b.
   Soft warm gradients are used sparingly: hero, primary buttons, progress
   fills and done heatmap cells. White theme throughout. */

:root {
  --paper: #f5f4f0;
  --surface: #fffdf9;
  --surface-plain: #ffffff;
  --ink: #1c1b1a;
  --secondary: #55524c;
  --muted: #8a867e;
  --hairline: rgba(28, 27, 26, 0.09);
  --amber: #9a3412;
  --amber-line: #d97706;
  --heat-0: #f5f4f0;
  --heat-1: #f3e2c7;
  --heat-2: #eec27f;
  --heat-3: #dd8f2a;
  --heat-4: #9a3412;
  --good: #3f6212;
  --good-bg: rgba(63, 98, 18, 0.1);
  --behind: #991b1b;
  --behind-bg: rgba(153, 27, 27, 0.08);
  --grad-hero: linear-gradient(125deg, #e8912d 0%, #d97706 48%, #9a3412 100%);
  --grad-soft: linear-gradient(180deg, #fffdf9 0%, #fdf3e2 100%);
  --grad-bar: linear-gradient(90deg, #eec27f 0%, #d97706 55%, #9a3412 100%);
  --grad-done: linear-gradient(135deg, #dd8f2a 0%, #9a3412 100%);
  --shadow-card: 0 1px 3px rgba(28, 27, 26, 0.06), 0 4px 14px rgba(28, 27, 26, 0.05);
  --shadow-hover: 0 2px 6px rgba(28, 27, 26, 0.08), 0 10px 26px rgba(28, 27, 26, 0.1);
  --radius-control: 10px;
  --radius-card: 16px;
  --sidebar: 224px;
  --content-max: 1120px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

h1, h2, h3 { font-weight: 650; line-height: 1.3; margin: 0; }
h1 { font-size: 26px; letter-spacing: -0.01em; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }

p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

a { color: var(--amber); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font: inherit; color: inherit; }

button {
  background: var(--surface-plain);
  border: 1px solid rgba(28, 27, 26, 0.16);
  border-radius: var(--radius-control);
  color: var(--ink);
  cursor: pointer;
  font-weight: 550;
  padding: 8px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

button:hover { border-color: rgba(28, 27, 26, 0.35); box-shadow: var(--shadow-card); }
button:disabled { cursor: default; opacity: 0.5; }

button.primary {
  background: var(--grad-hero);
  border-color: transparent;
  color: #ffffff;
}
button.primary:hover { border-color: transparent; filter: brightness(1.06); }

button.danger { color: var(--behind); }
button.small { padding: 4px 10px; font-size: 14px; }

input, select, textarea {
  background: var(--surface-plain);
  border: 1px solid rgba(28, 27, 26, 0.16);
  border-radius: var(--radius-control);
  padding: 9px 12px;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--amber-line);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.18);
  outline: none;
}
input[type="checkbox"] { width: auto; }
textarea { min-height: 72px; resize: vertical; }

label {
  display: block;
  color: var(--secondary);
  font-size: 14px;
  font-weight: 550;
  margin-bottom: 4px;
}

.field { margin-bottom: 12px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; min-width: 0; }

.check-row {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.check-row label { margin-bottom: 0; }

.mono, .figure, .meta, .pct, .time, .streak {
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}
/* Small supporting text uses --secondary (not --muted) so it stays readable
   on white/paper. --muted is reserved for large decorative labels only. */
.meta { color: var(--secondary); font-size: 14px; }
.figure { font-variant-numeric: tabular-nums; }

/* App shell */
.app { display: flex; min-height: 100vh; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  width: var(--sidebar);
}

.wordmark {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-bottom: 6px;
}
.wordmark .dot { color: var(--amber-line); }
.sidebar-tag {
  color: var(--secondary);
  font-size: 14px;
  margin-bottom: 22px;
}

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  border-radius: var(--radius-control);
  color: var(--secondary);
  font-weight: 550;
  padding: 9px 12px;
}
.nav a:hover { background: var(--paper); text-decoration: none; }
.nav a.active {
  background: var(--grad-soft);
  border: 1px solid rgba(217, 119, 6, 0.35);
  color: var(--amber);
  font-weight: 650;
}

.sidebar-foot { margin-top: auto; }
.sidebar-foot button { width: 100%; }

.main { flex: 1; min-width: 0; padding: 26px 26px 40px; }
.content { margin: 0 auto; max-width: var(--content-max); }

.view-head {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: space-between;
  margin-bottom: 20px;
}
.view-head .meta { margin: 0; }
.view-sub { color: var(--secondary); font-size: 15px; margin: -12px 0 20px; }

.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
  padding: 18px;
}
.card h2 { margin-bottom: 4px; }
.card h3 { margin-bottom: 4px; }
.card .card-link { color: inherit; display: block; }
.card .card-link:hover { text-decoration: none; }
.card.clickable { transition: box-shadow 0.15s ease, transform 0.15s ease; }
.card.clickable:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.card.clickable:hover .card-title-link { color: var(--amber); }
.card-head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}
.card-head h2 { margin-bottom: 2px; }
.card-kicker {
  color: var(--amber);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.card-foot-link { font-size: 14px; font-weight: 600; }

/* Hero / now card */
.now-card {
  background: var(--grad-hero);
  border: none;
  border-radius: 20px;
  box-shadow: 0 8px 28px rgba(154, 52, 18, 0.28);
  color: #ffffff;
  margin-bottom: 16px;
  padding: 24px 26px;
}
.now-card .now-label {
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
  text-transform: uppercase;
}
.now-card h2 { font-size: 26px; margin-bottom: 8px; }
.now-card .meta { color: rgba(255, 255, 255, 0.88); }
.now-card .now-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.now-card .now-actions button.primary {
  background: #ffffff;
  border-color: #ffffff;
  color: var(--amber);
  font-size: 15px;
  padding: 10px 22px;
}
.now-card .now-actions button.ghost-light {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.6);
  color: #ffffff;
}
.now-card .now-actions button.ghost-light:hover { border-color: #ffffff; box-shadow: none; }
.now-card.flat {
  background: var(--surface);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-card);
  color: var(--ink);
}
.now-card.flat .now-label { color: var(--amber); }
.now-card.flat .meta { color: var(--secondary); }

/* Dashboard grid */
.dash-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(12, 1fr);
}
.dash-grid > * { min-width: 0; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }
.dash-grid .card { margin-bottom: 0; height: 100%; }

.stat-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 16px;
}
.stat-card {
  background: var(--grad-soft);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 16px 18px;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.stat-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.stat-card .stat-link { color: inherit; display: block; }
.stat-card .stat-link:hover { text-decoration: none; }
.stat-num { font-size: 34px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.1; }
.stat-num .unit { color: var(--secondary); font-size: 18px; font-weight: 600; }
.stat-label { color: var(--secondary); font-size: 14px; font-weight: 600; margin-top: 2px; }
.stat-sub { color: var(--secondary); font-size: 14px; margin-top: 4px; }
.stat-accent { color: var(--amber); }

/* Progress rings */
.ring-wrap { align-items: center; display: flex; gap: 14px; }
.ring { flex-shrink: 0; }
.ring-bg { fill: none; stroke: var(--heat-1); stroke-width: 7; }
.ring-fg {
  fill: none;
  stroke: var(--amber-line);
  stroke-linecap: round;
  stroke-width: 7;
  transform: rotate(-90deg);
  transform-origin: center;
}
.ring text { fill: var(--ink); font-size: 15px; font-weight: 700; }
.ring-lg text { font-size: 19px; }

.progress-line { margin: 12px 0 4px; }
.progress-track {
  background: #efe9dd;
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}
.progress-fill {
  background: var(--grad-bar);
  border-radius: 999px;
  height: 100%;
  transition: width 0.25s ease;
}
.progress-label { color: var(--secondary); font-size: 14px; margin-top: 8px; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list > li {
  align-items: center;
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 12px 0;
}
.list > li:first-child { border-top: none; padding-top: 0; }
.list > li:last-child { padding-bottom: 0; }
.list .item-main { flex: 1; min-width: 180px; }
.list .item-title { font-weight: 600; }
.list .item-title.done { color: var(--secondary); text-decoration: line-through; }
.list .item-sub { color: var(--secondary); font-size: 14px; }
.list .item-time {
  color: var(--amber);
  font-size: 14px;
  font-weight: 700;
  min-width: 52px;
}

/* Pace badges + status pills */
.pace { font-size: 14px; font-weight: 600; }
.pace.on-track { color: var(--good); }
.pace.behind { color: var(--behind); }
.pace.neutral { color: var(--secondary); }

.badge {
  border-radius: 999px;
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  padding: 3px 10px;
  white-space: nowrap;
}
.badge.on-track { background: var(--good-bg); color: var(--good); }
.badge.behind { background: var(--behind-bg); color: var(--behind); }
.badge.neutral { background: var(--paper); color: var(--secondary); }
.badge.amber { background: var(--heat-1); color: var(--amber); }

.empty { color: var(--secondary); padding: 12px 0; }

.error-line {
  background: var(--surface);
  border: 1px solid rgba(153, 27, 27, 0.3);
  border-radius: var(--radius-control);
  color: var(--behind);
  font-size: 14px;
  margin-bottom: 16px;
  padding: 8px 12px;
}
.error-line:empty { display: none; }

/* Goal cards */
.grid-goals {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}
.goal-card { display: flex; flex-direction: column; }
.goal-card .goal-top {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}
.goal-card .goal-top h2 { font-size: 18px; }
.goal-card .goal-top h2 a { color: inherit; }
.goal-card .goal-top h2 a:hover { color: var(--amber); text-decoration: none; }
.goal-card .goal-meta { color: var(--secondary); font-size: 14px; margin: 4px 0 12px; }
.goal-card .goal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.goal-stats {
  display: flex;
  gap: 20px;
  margin: 10px 0 4px;
}
.goal-stats .stat-num { font-size: 24px; }
.goal-stats .stat-label { font-size: 13px; }

.pace-chart { margin-top: 12px; }
.pace-chart svg { display: block; height: auto; width: 100%; }
.pace-chart .axis-labels {
  color: var(--secondary);
  display: flex;
  font-size: 13px;
  justify-content: space-between;
  margin-top: 2px;
}
.pace-legend {
  color: var(--secondary);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 4px 16px;
  margin-top: 6px;
}
.pace-legend .swatch { display: inline-block; height: 3px; margin-right: 6px; vertical-align: middle; width: 18px; }
.pace-legend .swatch.expected { background: #c9c2b4; }
.pace-legend .swatch.actual { background: var(--amber-line); }

/* Weekly heatmap (dashboard, last 7 days) */
.week-heat { display: flex; gap: 8px; margin-top: 12px; }
.week-day { flex: 1; min-width: 0; text-align: center; }
.week-day .wd-label { color: var(--secondary); font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.week-cell {
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  color: var(--secondary);
  display: flex;
  font-size: 15px;
  font-weight: 650;
  height: 44px;
  justify-content: center;
  width: 100%;
}
.week-cell.done {
  background: var(--grad-done);
  border-color: transparent;
  color: #ffffff;
}
.week-cell.today { border: 2px solid var(--amber-line); }
.week-cell.done.today { border-color: var(--amber); }
.week-legend { color: var(--secondary); font-size: 13px; margin-top: 10px; }

/* Long-history heatmap (Goals view) */
.heatmap {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 12px);
  gap: 2px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.heatmap .cell {
  border-radius: 2px;
  height: 12px;
  width: 12px;
}
.heatmap .cell.h0 { background: var(--heat-0); border: 1px solid var(--hairline); }
.heatmap .cell.h1 { background: var(--heat-1); }
.heatmap .cell.h2 { background: var(--heat-2); }
.heatmap .cell.h3 { background: var(--heat-3); }
.heatmap .cell.h4 { background: var(--heat-4); }
.heatmap-note { color: var(--secondary); font-size: 13px; margin-top: 6px; }

/* Tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tabs button { border-radius: 999px; }
.tabs button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface-plain);
}

.form-inline { display: flex; flex-wrap: wrap; gap: 8px; }
.form-inline input { flex: 1; min-width: 180px; }

.idea-brief {
  background: var(--paper);
  border-radius: var(--radius-control);
  color: var(--secondary);
  font-size: 14px;
  margin-top: 8px;
  padding: 10px 12px;
  white-space: pre-wrap;
}
.idea-decision { color: var(--secondary); font-size: 14px; margin-top: 8px; }

.status-pill {
  border: 1px solid rgba(28, 27, 26, 0.16);
  border-radius: 999px;
  color: var(--secondary);
  font-size: 13px;
  font-weight: 600;
  padding: 2px 10px;
  white-space: nowrap;
}

.kv { display: grid; gap: 10px; grid-template-columns: auto 1fr; }
.kv dt { color: var(--secondary); font-size: 14px; }
.kv dd { margin: 0; }
.status-ok { color: var(--good); font-weight: 600; }
.status-bad { color: var(--behind); font-weight: 600; }

.section { margin-bottom: 24px; }
.section > h2 { margin-bottom: 12px; }

.status-strip {
  color: var(--secondary);
  display: flex;
  flex-wrap: wrap;
  font-size: 14px;
  gap: 6px 20px;
  margin: 0 2px 16px;
}
.status-strip strong { color: var(--ink); }

/* Login */
.login-wrap {
  align-items: center;
  background: var(--grad-soft);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  box-shadow: var(--shadow-hover);
  padding: 32px 26px;
  width: 100%;
  max-width: 380px;
}
.login-card .wordmark { margin-bottom: 4px; text-align: center; }
.login-card .login-sub { color: var(--secondary); font-size: 14px; margin-bottom: 20px; text-align: center; }

/* Medium screens: dashboard stacks */
@media (max-width: 960px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .span-3, .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: span 12; }
  .dash-grid .card { height: auto; }
}

/* Phone: single column, top nav */
@media (max-width: 720px) {
  .app { display: block; }
  .sidebar {
    border-bottom: 1px solid var(--hairline);
    border-right: none;
    height: auto;
    padding: 12px 16px;
    position: static;
    width: auto;
  }
  .wordmark { margin-bottom: 2px; }
  .sidebar-tag { margin-bottom: 10px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav a { padding: 7px 10px; }
  .sidebar-foot { display: none; }
  .main { padding: 16px 16px 32px; }
  .field-row { flex-direction: column; gap: 0; }
  .now-card { padding: 18px; }
  .now-card h2 { font-size: 22px; }
  h1 { font-size: 23px; }
  .stat-num { font-size: 28px; }
  .week-cell { height: 40px; }
  .grid-goals { grid-template-columns: 1fr; }
}

/* Short screens: tighten vertical spacing, hero stays in one frame */
@media (max-height: 640px) {
  .sidebar { padding-top: 12px; padding-bottom: 12px; }
  .wordmark { margin-bottom: 2px; }
  .sidebar-tag { margin-bottom: 10px; }
  .main { padding-top: 16px; padding-bottom: 16px; }
  .card, .now-card, .stat-grid { margin-bottom: 12px; }
  .now-card { padding: 16px 20px; }
  .now-card h2 { font-size: 22px; }
}
