/* Design tokens: light blue */
:root {
  --bg: #EEF2F9;
  --surface: #FFFFFF;
  --border: #E2E8F5;
  --text: #0F172A;
  --muted: #64748B;
  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --accent-soft: #EAF1FF;
  --danger: #DC2626;
  --success: #16A34A;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* Layout */
#app {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), #38BDF8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  flex: none;
  box-shadow: var(--shadow);
}

.brand-name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

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

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 24px;
  width: fit-content;
  box-shadow: var(--shadow);
}

.tab-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 18px;
  cursor: pointer;
  border-radius: 999px;
  transition: color 0.15s, background 0.15s;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

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

/* Form controls */
input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  resize: vertical;
  min-height: 100px;
  max-height: 240px;
}

button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border: none;
  border-radius: 999px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 22px;
  cursor: pointer;
  transition: opacity 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

button.primary:hover { opacity: 0.92; }
button.primary:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

button.secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 20px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

button.secondary:hover { border-color: var(--accent); background: var(--accent-soft); }

/* Section labels */
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 12px;
}

/* Goals list */
.goal-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.goal-number {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  min-width: 20px;
  padding-top: 12px;
}

.btn-remove-goal {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  padding: 10px 4px;
  line-height: 1;
}

.btn-remove-goal:hover { color: var(--danger); }

.btn-add-goal {
  background: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
  padding: 8px 14px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  margin-top: 4px;
  transition: border-color 0.15s, color 0.15s;
}

.btn-add-goal:hover { border-color: var(--accent); color: var(--accent); }

/* Entry cards */
.entry-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.empty-state {
  color: var(--muted);
  font-size: 13px;
  padding: 12px 0;
}

.entry-accomplishment {
  font-size: 14px;
  margin-bottom: 8px;
}

.entry-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.tag {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 9px;
}

.goal-badge {
  font-size: 11px;
  color: var(--muted);
  background: var(--bg);
  border-radius: 999px;
  padding: 2px 9px;
}

.entry-date {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
}

/* Rollup output */
#narrative-output {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.8;
  margin-top: 16px;
  min-height: 120px;
}

/* Utility */
.row { display: flex; gap: 10px; align-items: center; }
.mt-12 { margin-top: 12px; }
.mt-20 { margin-top: 20px; }
.mt-28 { margin-top: 28px; }
.text-muted { color: var(--muted); font-size: 13px; }
.hidden { display: none !important; }

#status-msg {
  font-size: 13px;
  min-height: 20px;
  margin-top: 8px;
}

.status-ok { color: var(--success); }
.status-err { color: var(--danger); }

/* Spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Week filter row */
.filter-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}

.filter-row input {
  width: 140px;
}

select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  cursor: pointer;
}
