:root {
  --font-display: 'Spectral', Georgia, serif;
  --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --bg: #f7f8f5;
  --surface: #ffffff;
  --surface-2: #e4e8e5;
  --ink: #171a18;
  --muted: #606862;
  --muted-2: #8a928c;
  --border: #d8ded9;
  --border-strong: #aeb9b1;
  --accent: #123d32;
  --accent-soft: #e2ece7;
  --signal: #a64b3c;
  --density: 1;
}

* { letter-spacing: 0 !important; }
body { background: #edf0ed; }
button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

.app-shell { background: var(--bg); }
.screen-body { padding-left: 16px; padding-right: 16px; }
.section-title, h1, h2, h3 { text-wrap: balance; }
.section-title { font-size: 19px; font-weight: 600; }

.hero-card,
.habit-card,
.stat-card,
.top-habit,
.heatmap,
.ninety-stat,
.habit-progress,
.edit-card,
.sync-status-card,
.sync-setup {
  border-radius: 6px;
  box-shadow: none;
}
.hero-card { border-top: 3px solid var(--accent); padding: 18px; }
.habit-list { gap: 7px; }
.habit-card { padding: 15px; border-color: var(--border); }
.habit-card.is-done { background: #eef5f1; border-color: #bfd0c6; }
.habit-main { align-items: center; gap: 12px; }
.habit-name { font-size: 14px; }
.habit-pts-num { font-size: 21px; }
.habit-group { color: #4e5a53; margin-bottom: 3px; }
.habit-symbol {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: #edf2ef;
  border: 1px solid #d5dfd9;
  border-radius: 6px;
}
.habit-card.is-done .habit-symbol { color: #fff; background: var(--accent); border-color: var(--accent); }
.addon-row { padding-left: 48px; }
.addon-chip { min-height: 36px; border-radius: 6px; background: #fbfcfa; }
.check-btn { border-radius: 6px !important; }
.footer-note { display: none; }

.icon-btn, .icon-btn-sm, .btn-primary, .btn-secondary, .btn-danger,
.add-btn, .form-input, .point-stepper, .point-stepper button,
.seg, .seg-btn, .sheet-row { border-radius: 6px; }
.icon-btn { width: 44px; height: 44px; }
.btn-primary, .btn-secondary, .btn-danger, .add-btn { min-height: 44px; }
.btn-primary { background: var(--accent); }
.btn-danger { color: var(--signal); border-color: #d9aaa2; }
.btn-danger:disabled { opacity: .38; cursor: not-allowed; }
.danger-confirm { width: 100%; margin-top: 4px; }

.bottom-nav { background: rgba(255,255,255,.96); }
.nav-brand { display: none; }
.nav-item { border-radius: 6px; min-height: 48px; }
.nav-item.is-active { color: var(--accent); }

.edit-card .habit-symbol { margin: 10px 0 10px 12px; }
.icon-picker { grid-template-columns: repeat(4, 1fr); gap: 8px; }
.icon-pick {
  aspect-ratio: auto;
  min-height: 52px;
  border-radius: 6px;
  background: #fff;
}
.icon-pick .habit-symbol { background: transparent; border: 0; }
.icon-pick.is-active { background: var(--accent-soft); border-color: var(--accent); }
.settings-block { margin-top: 22px; padding: 0; border-top: 1px solid var(--border); }
.settings-block + .settings-block { margin-top: 0; }
.settings-block summary { min-height: 48px; display: flex; align-items: center; font-weight: 500; color: var(--ink); }
.settings-note { margin: 0 0 6px; font-size: 12px; line-height: 1.5; color: var(--muted); }

.sync-block { gap: 14px; }
.sync-inline-status { min-height: 48px; align-items: center; padding: 8px 0; }
.sync-inline-status > div { flex: 1; }
.sync-inline-status small { color: var(--muted-2); font-size: 10px; }
.sync-dot { margin-top: 0; }
.sync-notice { padding: 10px 12px; background: #eef3f0; border-left: 3px solid var(--accent); font-size: 12px; color: var(--muted); }
.sync-notice.is-error { background: #faefed; border-left-color: var(--signal); color: #7e3328; }
.sync-diagnostics summary { color: var(--ink); }

.recovery-sheet { padding: 12px 20px max(22px, env(safe-area-inset-bottom)); }
.recovery-sheet h3 { margin: 4px 0 6px; font: 600 23px/1.2 var(--font-display); }
.recovery-sheet > p { margin: 0 0 18px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.recovery-kicker { color: var(--signal); font-size: 11px; font-weight: 600; text-transform: uppercase; }
.recovery-step { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--border); background: var(--surface); }
.recovery-step > strong { font-size: 14px; }
.recovery-step > span { font-size: 12px; color: var(--muted); line-height: 1.5; }
.recovery-step .form-label { margin: 4px 0 -3px; }
.recovery-cancel { width: 100%; min-height: 44px; margin-top: 8px; }

.sheet { border-radius: 8px 8px 0 0; }
.sheet-handle { border-radius: 2px; }
.heat-cell, .legend-cell, .ninety-cell { border-radius: 3px; }

@media (min-width: 600px) {
  body { display: block; padding: 0; background: #edf0ed; }
  .app-shell { height: 100dvh; max-width: none; border-radius: 0; box-shadow: none; overflow: hidden; }
  .screen { padding-bottom: 84px; }
}

@media (min-width: 900px) {
  .app-shell { grid-template-columns: 176px minmax(0, 1fr); }
  .screen { grid-column: 2; }
  .screen-body { max-width: 1120px; padding: 30px 38px 56px; }
  .today-layout { grid-template-columns: minmax(270px, 330px) minmax(520px, 1fr); gap: 42px; }
  .bottom-nav { padding: 24px 14px; gap: 3px; }
  .nav-brand { display: flex; align-items: center; gap: 11px; min-height: 58px; padding: 0 6px 18px; margin-bottom: 10px; border-bottom: 1px solid var(--border); }
  .brand-mark { display: block; flex: 0 0 auto; filter: drop-shadow(0 1px 1px rgba(16, 63, 52, .12)); }
  .brand-wordmark { color: var(--ink); font: 600 15px/1 var(--font-display); white-space: nowrap; }
  .nav-item { flex-direction: row; justify-content: flex-start; gap: 11px; padding: 10px 12px; min-height: 48px; }
  .nav-label { font-size: 13px; }
  .habit-list { border-top: 1px solid var(--border); }
  .habit-card { padding: 16px 6px; }
  .sheet { max-width: 520px; }
  .recovery-sheet { border-radius: 8px; margin-bottom: 24px; }
}

@media (max-width: 380px) {
  .screen-body { padding-left: 12px; padding-right: 12px; }
  .habit-card { padding: 13px 11px; }
  .habit-name { font-size: 13px; }
  .habit-symbol { width: 34px; height: 34px; flex-basis: 34px; }
}
