:root {
  --bg: #F7F4EE; --surface: #FFFFFF; --surface-2: #EFEAE0;
  --border: #E1DACB; --border-lt: #EAE4D6;
  --ink: #262320; --ink-soft: #403A32; --muted: #8C8375;
  --accent: #262320; --accent-ink: #FFFFFF;
  --circle: #B9AF9C; --circle-done: #262320;
  --danger: #B5542E;
  --font-display: 'Quicksand', sans-serif;
  --font-body: 'Karla', sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: light; }
html[data-mode="dark"] { color-scheme: dark; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  transition: background 0.2s ease, color 0.2s ease;
}

button, input, textarea, select {
  font-family: var(--font-body);
  color: var(--ink);
}

.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(1rem + env(safe-area-inset-top)) 1.25rem 1rem; position: sticky; top: 0;
  background: var(--bg); z-index: 10;
  border-bottom: 1px solid var(--border-lt);
}
.app-header h1 {
  font-family: var(--font-display); font-size: 19px; font-weight: 700; margin: 0;
  display: flex; align-items: center; gap: 8px; color: var(--ink);
}
.logo-mark { width: 24px; height: 24px; color: var(--accent); flex-shrink: 0; }
.logo-mark svg { width: 100%; height: 100%; }

.header-actions { display: flex; gap: 8px; }
.icon-btn {
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 15px; color: var(--ink-soft);
}

main { max-width: 460px; margin: 0 auto; padding: 1.1rem 1.25rem 6rem; min-height: calc(100vh - 70px); }

.tagline {
  font-family: var(--font-display); font-style: italic; font-size: 14px;
  color: var(--muted); text-align: center; margin: 0.4rem 0 1.4rem; line-height: 1.5;
}

.add-btn {
  width: 100%; padding: 14px; border-radius: 14px; border: 1.5px dashed var(--border);
  background: var(--surface); color: var(--ink-soft); font-family: var(--font-body);
  font-size: 14.5px; font-weight: 600; cursor: pointer; margin-bottom: 1.6rem;
}
.add-btn:active { background: var(--surface-2); }

.section { margin-bottom: 1.6rem; }
.section-label {
  font-family: var(--font-body); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--muted); margin: 0 0 10px;
}
.section-title {
  font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--ink); margin: 0.2rem 0 1rem;
}

.empty-hint { font-size: 13px; color: var(--muted); font-style: italic; margin: 0; }

.action-list { display: flex; flex-direction: column; gap: 8px; }
.action-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border-lt);
  border-radius: 14px; padding: 0.8rem 0.9rem;
}
.action-circle {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--circle);
  background: transparent; cursor: pointer; flex-shrink: 0; padding: 0;
}
.action-circle:hover { border-color: var(--accent); }
.action-icon {
  width: 30px; height: 30px; border-radius: 9px; background: var(--highlight-soft); color: var(--highlight);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 6px;
}
.action-icon svg { width: 100%; height: 100%; }
.action-text { flex: 1; min-width: 0; }
.action-main { font-size: 14px; font-weight: 600; color: var(--ink); margin: 0; line-height: 1.4; }
.action-sub { font-size: 12px; color: var(--muted); margin: 2px 0 0; }
.action-delete { border: none; background: none; color: var(--muted); font-size: 15px; cursor: pointer; padding: 2px 4px; flex-shrink: 0; }

.evidence-link {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface-2); border: 1px solid var(--border-lt);
  border-radius: 14px; padding: 0.9rem 1.1rem; cursor: pointer;
  font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--ink-soft);
}
.evidence-count {
  background: var(--accent); color: var(--accent-ink); border-radius: 999px;
  min-width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-body); font-size: 12.5px; font-weight: 700; padding: 0 6px;
}

.evidence-list { display: flex; flex-direction: column; gap: 4px; }
.evidence-row {
  display: flex; gap: 12px; padding: 0.9rem 0; border-bottom: 1px solid var(--border-lt);
}
.evidence-date { font-size: 11.5px; color: var(--muted); width: 46px; flex-shrink: 0; padding-top: 2px; }
.evidence-body { flex: 1; min-width: 0; }
.evidence-main { font-size: 14px; font-weight: 600; color: var(--ink); margin: 0; line-height: 1.4; }
.evidence-note { font-size: 13px; color: var(--ink-soft); margin: 4px 0 0; line-height: 1.5; }
.evidence-context { font-size: 11.5px; color: var(--muted); margin: 5px 0 0; font-style: italic; }

/* back link + nav buttons */
.back-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; color: var(--muted); cursor: pointer;
  margin-bottom: 0.9rem; background: none; border: none; padding: 0; font-family: var(--font-body);
}

.nav-row { display: flex; gap: 8px; margin-top: 1.1rem; justify-content: space-between; align-items: center; }
.nav-btn {
  padding: 11px 18px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  color: var(--ink-soft); font-size: 13.5px; font-weight: 600; cursor: pointer; font-family: var(--font-body);
}
.nav-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* wizard (add flow) */
.wizard-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 1.2rem; }
.wizard-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.wizard-dot.active { background: var(--accent); width: 20px; border-radius: 5px; }
.wizard-dot.past { background: var(--muted); }

.wizard-card {
  background: var(--surface); border: 1px solid var(--border-lt); border-radius: 18px; padding: 1.4rem 1.3rem;
}
.wizard-label {
  font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--ink); margin: 0 0 1rem; line-height: 1.35;
}
.wizard-card textarea, .overlay-card textarea {
  width: 100%; min-height: 110px; border: 1px solid var(--border-lt); background: var(--surface-2);
  border-radius: 12px; padding: 0.8rem 0.9rem; font-family: var(--font-body); font-size: 14px;
  line-height: 1.6; color: var(--ink); resize: vertical; outline: none;
}
.wizard-card textarea:focus, .overlay-card textarea:focus { border-color: var(--accent); }

.suggestion-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 8px; }
.chip-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 1rem; }
.chip {
  border: 1px solid var(--border); border-radius: 12px; padding: 9px 12px; font-size: 12.5px;
  color: var(--ink-soft); background: var(--surface-2); cursor: pointer; text-align: left; font-family: var(--font-body);
  line-height: 1.4;
}
.chip:hover { border-color: var(--accent); }

/* complete overlay */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.35);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
}
html[data-mode="dark"] .overlay { background: rgba(0,0,0,0.55); }
.overlay-card {
  width: 100%; max-width: 460px; background: var(--surface);
  border-radius: 22px 22px 0 0; padding: 1.5rem 1.3rem 1.8rem;
  border: 1px solid var(--border-lt); border-bottom: none;
}
.overlay-label {
  font-family: var(--font-display); font-size: 13px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 6px;
}
.overlay-prompt {
  font-family: var(--font-display); font-size: 19px; font-weight: 700; color: var(--ink); margin: 0 0 1rem; line-height: 1.35;
}
.mini-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 8px; }
.overlay-actions { display: flex; gap: 8px; margin-top: 1rem; justify-content: flex-end; }

/* settings */
.theme-panel { background: var(--surface); border: 1px solid var(--border-lt); border-radius: 16px; padding: 1rem 1.1rem; margin-bottom: 1.2rem; }
.mode-row { display: flex; gap: 8px; margin-bottom: 12px; }
.mode-btn {
  flex: 1; padding: 8px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--ink-soft); font-size: 12.5px; cursor: pointer; font-family: var(--font-body);
}
.mode-btn.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.settings-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.settings-tab { border: 1px solid var(--border); background: transparent; border-radius: 999px; padding: 5px 14px; font-size: 12px; color: var(--muted); cursor: pointer; font-family: var(--font-body); }
.settings-tab.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.swatch-row { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.swatch.active { border-color: var(--ink); }

.font-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.font-option { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; cursor: pointer; color: var(--ink-soft); }
.font-option.active { border-color: var(--accent); background: var(--surface-2); }
.font-option-label { font-size: 12px; font-family: var(--font-body); }

.backup-panel { display: flex; flex-direction: column; gap: 8px; }
.backup-hint { font-size: 12px; color: var(--muted); line-height: 1.6; margin: 0 0 4px; }
.backup-btn {
  display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); border-radius: 10px; padding: 9px; font-size: 13px;
  cursor: pointer; text-align: center; font-family: var(--font-body);
}
.backup-btn.secondary { background: var(--surface); color: var(--ink-soft); border-color: var(--border); }
.backup-status { font-size: 12px; color: var(--muted); min-height: 14px; margin: 0; }

.icon-btn[hidden] { display: none !important; }
.hidden { display: none !important; }

/* bottom tab nav */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-around;
  background: var(--surface); border-top: 1px solid var(--border-lt);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
.nav-tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; cursor: pointer; color: var(--muted);
  padding: 4px 10px; font-family: var(--font-body);
}
.nav-tab-icon { width: 21px; height: 21px; }
.nav-tab-icon svg { width: 100%; height: 100%; }
.nav-tab-label { font-size: 10.5px; font-weight: 600; }
.nav-tab.active { color: var(--highlight); }

/* suggestion chip icon (inside wizard) */
.chip { display: flex; align-items: flex-start; gap: 8px; }
.chip-icon { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; color: var(--highlight); }
.chip-icon svg { width: 100%; height: 100%; }

/* ideas tab */
.ideas-intro { font-size: 13px; color: var(--muted); line-height: 1.6; margin: 0 0 1.2rem; }
.ideas-section-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; font-weight: 700;
  margin: 1.4rem 0 0.8rem; padding-top: 0.6rem;
}
.ideas-section-label.hard { color: var(--muted); }
.ideas-section-label.good { color: var(--highlight); border-top: 1px solid var(--border-lt); }
.idea-group { margin-bottom: 1rem; }
.idea-group-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
  width: 100%; background: none; border: none; padding: 0; cursor: pointer; text-align: left;
}
.idea-group-chevron {
  margin-left: auto; color: var(--muted); font-size: 18px; transition: transform 0.15s ease;
  transform: rotate(90deg);
}
.idea-group-chevron.open { transform: rotate(-90deg); }
.idea-guide {
  font-size: 12.5px; line-height: 1.65; color: var(--ink-soft);
  background: var(--surface-2); border-radius: 10px; padding: 0.7rem 0.85rem;
  margin: 0 0 8px;
}
.idea-group-icon {
  width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  padding: 5px; flex-shrink: 0;
}
.idea-group-icon.hard { background: var(--surface-2); color: var(--muted); }
.idea-group-icon.good { background: var(--highlight-soft); color: var(--highlight); }
.idea-group-icon svg { width: 100%; height: 100%; }
.idea-group-title { font-size: 13.5px; font-weight: 700; color: var(--ink); margin: 0; }
.idea-chip-col { display: flex; flex-direction: column; gap: 6px; }
.idea-chip {
  text-align: left; border: 1px solid var(--border-lt); background: var(--surface);
  border-radius: 10px; padding: 8px 10px; font-size: 12.5px; color: var(--ink-soft);
  cursor: pointer; font-family: var(--font-body); line-height: 1.4;
}
.idea-chip.good:hover, .idea-chip.good:active { border-color: var(--highlight); }
.idea-chip.hard:hover, .idea-chip.hard:active { border-color: var(--muted); }

/* log tab */
.log-empty { display: flex; flex-direction: column; align-items: center; padding: 2rem 0 1rem; }
.log-illustration { width: 100%; max-width: 260px; height: auto; margin-bottom: 1rem; }
.log-empty-text { font-size: 13px; color: var(--muted); font-style: italic; margin: 0; }
.log-quote {
  text-align: center; font-family: var(--font-display); font-style: italic; font-size: 14px;
  color: var(--muted); margin: 1.5rem 0 0; padding-top: 1rem; border-top: 1px solid var(--border-lt);
}
.evidence-icon {
  width: 24px; height: 24px; border-radius: 7px; background: var(--surface-2); color: var(--muted);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; padding: 5px; margin-top: 1px;
}
.evidence-icon svg { width: 100%; height: 100%; }

/* install section (More tab) */
.install-card {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border-lt); border-radius: 14px;
  padding: 0.9rem 1rem; margin-bottom: 1rem;
}
.install-card.installed { background: var(--highlight-soft); }
.install-card.muted .install-sub { color: var(--muted); }
.install-icon { width: 22px; height: 22px; color: var(--highlight); flex-shrink: 0; }
.install-icon svg { width: 100%; height: 100%; }
.install-title { font-size: 14px; font-weight: 700; color: var(--ink); margin: 0; }
.install-sub { font-size: 12px; color: var(--ink-soft); margin: 3px 0 0; line-height: 1.5; }

/* iOS install steps (inside overlay) */
.ios-steps { display: flex; flex-direction: column; gap: 10px; margin: 1rem 0; }
.ios-step {
  display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; color: var(--ink-soft); line-height: 1.5;
}
.ios-step-num {
  width: 22px; height: 22px; border-radius: 50%; background: var(--highlight); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
