/* Forge Ahead — styles
   Adapted from forge-ahead-prototype.html. Same custom properties, same palette.
   No red, no urgency styling, ever. Due dates are always small/muted text. */

:root {
  --ink-teal: #0F2E2E;
  --deep-teal: #1B4B4B;
  --orange: #E8641C;
  --cream: #F2E9DC;
  --sage: #7FA894;
  --ember: #C98A5E;

  --radius: 10px;
  --radius-sm: 6px;
}

[data-theme="dark"] {
  --bg: var(--ink-teal);
  --surface: #163B3B;
  --surface-raised: #1D4646;
  --border: rgba(242, 233, 220, 0.10);
  --border-strong: rgba(242, 233, 220, 0.18);
  --text-primary: #F2E9DC;
  --text-secondary: rgba(242, 233, 220, 0.62);
  --text-tertiary: rgba(242, 233, 220, 0.38);
  --accent: var(--orange);
  --sidebar-bg: #0C2626;
  --input-bg: rgba(242, 233, 220, 0.06);
}

[data-theme="light"] {
  --bg: var(--cream);
  --surface: #FFFDF9;
  --surface-raised: #FFFFFF;
  --border: rgba(27, 75, 75, 0.12);
  --border-strong: rgba(27, 75, 75, 0.22);
  --text-primary: #16302F;
  --text-secondary: rgba(22, 48, 47, 0.64);
  --text-tertiary: rgba(22, 48, 47, 0.40);
  --accent: var(--orange);
  --sidebar-bg: #EAE0D0;
  --input-bg: rgba(27, 75, 75, 0.05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  height: 100%;
}

body {
  display: flex;
  min-height: 100vh;
  transition: background 0.25s ease, color 0.25s ease;
}

::selection { background: var(--orange); color: #fff; }

a { color: inherit; }

.display {
  font-family: 'Fraunces', serif;
  font-optical-sizing: auto;
}

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

button { font-family: 'Inter', sans-serif; }

/* ---------- Password gate ---------- */

.pw-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  background: var(--bg);
}

.pw-card {
  width: 100%;
  max-width: 320px;
  padding: 36px 32px;
  text-align: center;
}

.pw-wordmark {
  font-size: 26px;
  font-weight: 500;
  margin-bottom: 6px;
}

.pw-wordmark span { color: var(--accent); }

.pw-tagline {
  font-size: 12.5px;
  color: var(--text-tertiary);
  margin-bottom: 30px;
  letter-spacing: 0.02em;
}

.pw-card input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 16px;
  color: var(--text-primary);
  font-size: 14.5px;
  font-family: 'Inter', sans-serif;
  outline: none;
  margin-bottom: 12px;
}

.pw-card input:focus { border-color: var(--accent); }
.pw-card input::placeholder { color: var(--text-tertiary); }

.pw-card .btn-primary { width: 100%; padding: 13px 20px; }

.pw-message {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--text-tertiary);
  min-height: 16px;
}

/* ---------- Sidebar ---------- */

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 18px;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
}

.wordmark {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 0 6px;
  margin-bottom: 4px;
}

.wordmark span { color: var(--accent); }

.tagline {
  font-size: 11.5px;
  color: var(--text-tertiary);
  padding: 0 6px;
  margin-bottom: 26px;
  letter-spacing: 0.02em;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  margin-bottom: 22px;
}

.search-box input {
  border: none;
  background: none;
  outline: none;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  width: 100%;
}

.search-box input::placeholder { color: var(--text-tertiary); }

.search-box svg { flex-shrink: 0; opacity: 0.5; }

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  text-align: left;
  font-family: 'Inter', sans-serif;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item svg { flex-shrink: 0; opacity: 0.75; }

.nav-item:hover {
  background: var(--input-bg);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(232, 100, 28, 0.13);
  color: var(--text-primary);
  font-weight: 500;
}

.nav-item.active svg { opacity: 1; stroke: var(--accent); }

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  gap: 8px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 12px;
  color: var(--text-secondary);
  font-size: 12.5px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}

.theme-toggle:hover { border-color: var(--border-strong); }

.refresh-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 9px;
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
}

.refresh-btn:hover { border-color: var(--border-strong); color: var(--text-primary); }
.refresh-btn.spinning svg { animation: spin 0.7s linear; }

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

/* ---------- Main ---------- */

.main {
  margin-left: 232px;
  flex: 1;
  padding: 40px 48px 80px;
  max-width: 900px;
}

.view { display: none; }
.view.active { display: block; animation: fadein 0.2s ease; }

@keyframes fadein {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-header { margin-bottom: 28px; }

.view-title {
  font-size: 28px;
  font-weight: 500;
  margin: 0 0 6px;
}

.view-sub {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  max-width: 56ch;
}

/* ---------- Weekly banner ---------- */

.weekly-banner {
  background: linear-gradient(135deg, rgba(232,100,28,0.10), rgba(127,168,148,0.08));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.weekly-banner .icon {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(232,100,28,0.15);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.weekly-banner-text { flex: 1; }
.weekly-banner-text strong { font-weight: 600; font-size: 14px; }
.weekly-banner-text p { margin: 2px 0 0; font-size: 13px; color: var(--text-secondary); }

.banner-actions { display: flex; gap: 8px; flex-shrink: 0; }

.btn-text {
  background: none; border: none; color: var(--text-secondary);
  font-size: 13px; cursor: pointer; padding: 6px 10px; font-family: 'Inter', sans-serif;
}
.btn-text:hover { color: var(--text-primary); }

.btn-ghost {
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 13px;
  padding: 6px 13px;
  border-radius: 20px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}
.btn-ghost:hover { border-color: var(--accent); }

/* ---------- Quick add ---------- */

.quick-add {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
}

.quick-add input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 16px;
  color: var(--text-primary);
  font-size: 14.5px;
  font-family: 'Inter', sans-serif;
  outline: none;
}

.quick-add input:focus { border-color: var(--accent); }
.quick-add input::placeholder { color: var(--text-tertiary); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.6; cursor: default; filter: none; }

/* ---------- Sections ---------- */

.section { margin-bottom: 32px; }

.section-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-tertiary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-label .count {
  background: var(--input-bg);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
}

.item-list { display: flex; flex-direction: column; gap: 8px; }

.item-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 15px;
  transition: opacity 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.item-card:hover { border-color: var(--border-strong); }

.item-card.completing {
  opacity: 0;
  transform: translateX(6px);
}

.checkbox {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--text-tertiary);
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: none;
  padding: 0;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.checkbox:hover { border-color: var(--accent); }

.item-body { flex: 1; min-width: 0; }

.item-title { font-size: 14.5px; line-height: 1.4; }

.item-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
  flex-wrap: wrap;
}

.tag {
  font-size: 11.5px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.tag.trigger { color: var(--sage); }

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot.fade-1 { background: rgba(201,138,94,0.35); box-shadow: 0 0 6px rgba(201,138,94,0.25); }
.dot.fade-2 { background: rgba(201,138,94,0.6); box-shadow: 0 0 8px rgba(201,138,94,0.4); }
.dot.fade-3 { background: rgba(201,138,94,0.9); box-shadow: 0 0 10px rgba(201,138,94,0.55); }

.item-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.item-card:hover .item-actions { opacity: 1; }

.icon-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  border-radius: 4px;
}
.icon-btn:hover { color: var(--text-primary); background: var(--input-bg); }

.empty-state {
  padding: 28px 20px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13.5px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

/* ---------- Inline error ---------- */

.inline-error {
  font-size: 12.5px;
  color: var(--text-tertiary);
  padding: 8px 2px;
}

/* ---------- Notes ---------- */

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.note-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 130px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.note-card textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  resize: none;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
}

.note-card .note-remove {
  position: absolute;
  top: 10px; right: 10px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.note-card:hover .note-remove { opacity: 1; }

.note-add-card {
  border: 1px dashed var(--border-strong);
  background: none;
  border-radius: var(--radius);
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  color: var(--text-tertiary);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
}
.note-add-card:hover { color: var(--text-primary); border-color: var(--accent); }

/* ---------- Routines ---------- */

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

.glow {
  width: 38px; height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}

.glow::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201,138,94,var(--glow-strength,0.3)) 0%, transparent 70%);
}

.glow-core {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--ember);
  opacity: var(--glow-strength, 0.3);
}

.routine-body { flex: 1; }
.routine-title { font-size: 14.5px; margin-bottom: 3px; }
.routine-freq { font-size: 12px; color: var(--text-tertiary); }

.btn-small {
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 7px 14px;
  border-radius: 18px;
  font-size: 12.5px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
}
.btn-small:hover { border-color: var(--accent); }
.btn-small.done { background: rgba(232,100,28,0.15); border-color: var(--accent); color: var(--accent); }

/* ---------- Goals ---------- */

.pillar-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.pillar-tab {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}

.pillar-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

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

.goal-title { font-size: 15px; font-weight: 500; margin-bottom: 10px; }

.sub-checklist { display: flex; flex-direction: column; gap: 7px; }

.sub-item { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-secondary); }

.sub-item.done { color: var(--text-tertiary); text-decoration: line-through; }

.sub-checkbox {
  width: 14px; height: 14px;
  border-radius: 4px;
  border: 1.5px solid var(--text-tertiary);
  cursor: pointer;
  flex-shrink: 0;
  background: none;
  padding: 0;
}
.sub-checkbox.checked { background: var(--accent); border-color: var(--accent); }

/* ---------- History ---------- */

.history-day { margin-bottom: 26px; }

.history-date {
  font-size: 12.5px;
  color: var(--text-tertiary);
  margin-bottom: 10px;
  font-family: 'IBM Plex Mono', monospace;
}

.history-item {
  font-size: 13.5px;
  color: var(--text-secondary);
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.history-item:last-child { border-bottom: none; }

.history-item svg { flex-shrink: 0; opacity: 0.5; }

.history-reflection {
  margin-top: 4px;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* ---------- Upcoming ---------- */

.bucket { margin-bottom: 26px; }

.bucket-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-tertiary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bucket-label .count {
  background: var(--input-bg);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
  text-transform: none;
  letter-spacing: normal;
}

/* ---------- Edit modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 46, 46, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
}

.modal-title {
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 16px;
}

.modal-field { margin-bottom: 14px; }

.modal-field label {
  display: block;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal-field input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
}

.modal-field input:focus { border-color: var(--accent); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

@media (max-width: 780px) {
  .sidebar { position: static; width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .main { margin-left: 0; padding: 24px 20px 60px; }
  body { flex-direction: column; }
  .notes-grid { grid-template-columns: 1fr; }
}
