:root {
  color-scheme: light;
  --ink: #1d2528;
  --muted: #687477;
  --line: #dfe5e2;
  --paper: #f7f5ef;
  --surface: #ffffff;
  --teal: #1b7f79;
  --blue: #2f6cbd;
  --rose: #b9475e;
  --green: #557a35;
  --gold: #b2762e;
  --shadow: 0 18px 50px rgba(32, 43, 43, 0.11);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, textarea, input { font: inherit; }
code { font-size: 0.92em; }

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px;
  border-right: 1px solid var(--line);
  background: #fbfaf6;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: radial-gradient(circle at 32% 32%, #fff 0 12%, transparent 13%), linear-gradient(135deg, var(--teal), var(--blue));
}
.brand strong, .brand span { display: block; }
.brand span, .eyebrow, .metric-card small, .voice-panel p, .timeline-item p, .insight p, .muted { color: var(--muted); }

.nav { display: grid; gap: 6px; }
.nav-item {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 0 12px;
}
.nav-item.active, .nav-item:hover { background: #e8f0ed; color: var(--ink); }

.voice-panel {
  margin-top: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.voice-panel h2 { margin: 12px 0 6px; font-size: 18px; }
.voice-panel p { margin: 0 0 16px; line-height: 1.5; }
.voice-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(90deg, transparent 17px, #fff 17px 31px, transparent 31px), linear-gradient(var(--rose), var(--gold));
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.08);
}

.workspace { padding: 32px; }
.topbar { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 24px; }
.eyebrow { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: 0; text-transform: uppercase; }
h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: clamp(30px, 4vw, 48px); line-height: 1.05; }
h2 { font-size: 22px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  white-space: nowrap;
}
.status-pill span { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.status-pill.error span { background: var(--rose); }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.metric-card, .panel { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.metric-card { min-height: 138px; padding: 18px; }
.metric-card span, .metric-card small { display: block; }
.metric-card strong { display: block; margin: 12px 0 8px; font-size: 36px; line-height: 1; }
.mood { border-top: 4px solid var(--teal); }
.anxiety { border-top: 4px solid var(--rose); }
.energy { border-top: 4px solid var(--blue); }
.sleep { border-top: 4px solid var(--green); }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr); gap: 14px; }
.panel { padding: 20px; }
.panel-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 18px; }

.capture-panel label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 14px; }
textarea {
  width: 100%;
  min-height: 154px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: #fbfaf6;
  line-height: 1.5;
}

.parsed-preview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.parsed-preview div, .endpoint-box { min-height: 68px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fbfaf6; }
.parsed-preview span, .parsed-preview strong { display: block; }
.parsed-preview span { color: var(--muted); font-size: 12px; }
.parsed-preview strong { margin-top: 6px; font-size: 15px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.chips span { display: inline-flex; align-items: center; min-height: 30px; padding: 0 10px; border-radius: 999px; background: #edf1ef; color: #4f5d5f; font-size: 13px; }
.capture-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.primary-action, .secondary-action { min-height: 40px; border-radius: 8px; border: 1px solid transparent; padding: 0 14px; cursor: pointer; }
.primary-action { background: var(--ink); color: #fff; }
.secondary-action { background: #fff; border-color: var(--line); color: var(--ink); }


.token-control {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.token-control label {
  color: var(--muted);
  font-size: 14px;
}

.token-control input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fbfaf6;
}

.endpoint-box { display: grid; gap: 6px; align-content: center; }
.endpoint-box span { color: var(--teal); font-weight: 800; font-size: 12px; }
.endpoint-box code { font-size: 16px; overflow-wrap: anywhere; }

.timeline, .insight-list { display: grid; gap: 12px; }
.timeline-item { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.timeline-item:last-child { border-bottom: 0; padding-bottom: 0; }
.timeline-item time { color: var(--teal); font-weight: 700; }
.timeline-item strong, .timeline-item p, .insight p { margin: 0; }
.timeline-item p, .insight p { margin-top: 4px; line-height: 1.45; }
.insight { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 12px; align-items: center; padding: 12px; border-radius: 8px; background: #fbfaf6; }
.score { display: grid; place-items: center; min-height: 42px; border-radius: 8px; background: #e8f0ed; color: var(--teal); font-weight: 800; }

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .voice-panel { margin-top: 0; }
  .summary-grid, .content-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .workspace, .sidebar { padding: 18px; }
  .topbar, .panel-header { display: grid; }
  .status-pill { width: fit-content; }
  .nav, .summary-grid, .content-grid, .parsed-preview { grid-template-columns: 1fr; }
  .nav { display: flex; overflow-x: auto; padding-bottom: 4px; }
  .nav-item { flex: 0 0 auto; }
  .metric-card { min-height: 118px; }
}
