@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@500&display=swap');

:root {
  --bg: #F3F6F4;
  --surface: #FFFFFF;
  --ink: #1E2A24;
  --muted: #5C6B62;
  --border: #DCE3DE;
  --accent: #2F5D50;
  --accent-soft: #E4EDE9;
  --green: #4C9A6A;
  --green-soft: #E1F0E5;
  --yellow: #D99A2B;
  --yellow-soft: #FBF0DC;
  --red: #C85A46;
  --red-soft: #FBE6E1;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}

h1, h2, h3 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  margin: 0;
  color: var(--ink);
}

.mono {
  font-family: 'IBM Plex Mono', monospace;
}

/* ---------- Header ---------- */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.app-header h1 {
  font-size: 20px;
  letter-spacing: -0.01em;
}

.app-header .subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.week-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 6px 6px 14px;
}

.week-nav button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.week-nav button:hover { background: var(--accent); color: white; }
.week-nav button:disabled { opacity: 0.35; cursor: default; }
.week-nav button:disabled:hover { background: var(--accent-soft); color: var(--accent); }

.week-nav .label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  min-width: 64px;
  text-align: center;
}

/* ---------- Signature: liikennevalo ---------- */

.signal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
}

.signal {
  background: #1B2420;
  border-radius: 10px;
  padding: 8px 7px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.signal .dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #2B3630;
  transition: background 0.3s, box-shadow 0.3s;
}

.signal .dot.lit-red { background: var(--red); box-shadow: 0 0 10px 1px rgba(200,90,70,0.7); }
.signal .dot.lit-yellow { background: var(--yellow); box-shadow: 0 0 10px 1px rgba(217,154,43,0.7); }
.signal .dot.lit-green { background: var(--green); box-shadow: 0 0 10px 1px rgba(76,154,106,0.7); }

.signal-text .status-label {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 16px;
}
.signal-text .status-desc {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

/* ---------- Cards / sections ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 12px;
}

.goal-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
}
.goal-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Exercise list ---------- */

.exercise-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.exercise-row:last-child { border-bottom: none; }

.exercise-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.exercise-row .ex-name {
  flex: 1;
  font-size: 14.5px;
}
.exercise-row .ex-category {
  font-size: 11px;
  color: var(--muted);
  display: block;
}

.exercise-row input.ex-note {
  width: 110px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
  font-family: 'IBM Plex Mono', monospace;
  background: var(--bg);
}

.add-exercise {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.add-exercise input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13.5px;
  font-family: inherit;
}
.add-exercise button {
  border: none;
  background: var(--accent);
  color: white;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13.5px;
  cursor: pointer;
}

/* ---------- Daily accordion ---------- */

.day-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
}

.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  background: var(--bg);
}

.day-head .day-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 14.5px;
}

.day-head .day-meta {
  font-size: 12px;
  color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
}

.day-body {
  padding: 14px;
  display: none;
  border-top: 1px solid var(--border);
}
.day-card.open .day-body { display: block; }
.day-card.open .day-head { background: var(--accent-soft); }

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.field label {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 4px;
}

.field input[type="number"], .field input[type="text"], .field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: 'IBM Plex Mono', monospace;
  background: var(--bg);
  color: var(--ink);
}

.pain-legend {
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 8px;
}

.checkbox-row {
  display: flex;
  gap: 18px;
  margin-bottom: 10px;
  font-size: 13.5px;
}
.checkbox-row label { display: flex; align-items: center; gap: 6px; }

.save-day {
  border: none;
  background: var(--ink);
  color: white;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13.5px;
  cursor: pointer;
  width: 100%;
}
.save-day.saved { background: var(--green); }

/* ---------- Summary footer ---------- */

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.summary-stat {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px 14px;
}
.summary-stat .value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 22px;
  font-weight: 500;
}
.summary-stat .label {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

/* ---------- Onboarding modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(30, 42, 36, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 360px;
  width: 100%;
}
.modal h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 17px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
}
.modal p { font-size: 13.5px; color: var(--muted); margin: 8px 0 16px; }
.modal input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 10px;
  font-family: inherit;
}
.modal button {
  width: 100%;
  border: none;
  background: var(--accent);
  color: white;
  border-radius: 8px;
  padding: 10px;
  font-size: 14.5px;
  cursor: pointer;
}

.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
