/* Avergona: clean and quiet (D15). No decoration competing with content.
   Mobile-first single column; tablet and desktop center the same column. */

:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --text: #1c1c1a;
  --muted: #6b6b66;
  --border: #e4e2dd;
  --accent: #2f6f4f;
  --accent-contrast: #ffffff;
  --gold: #b8860b;
  --level1: #cfe3d6;
  --level2: #8fc4a4;
  --tabbar-h: 64px;
  --fab-size: 56px;
  --radius: 14px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.4;
}

.view {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px calc(var(--tabbar-h) + 24px);
  min-height: 100vh;
}

.tap-target {
  min-height: 44px;
  min-width: 44px;
}

/* Tab bar: fixed to the bottom, thumb-reachable. */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--tabbar-h);
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  max-width: 640px;
  margin: 0 auto;
}

.tab {
  flex: 1;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.tab.is-active {
  color: var(--accent);
  font-weight: 600;
}

/* Quick-add fab, always present, above the tab bar. */
.fab {
  position: fixed;
  right: 20px;
  bottom: calc(var(--tabbar-h) + 16px);
  width: var(--fab-size);
  height: var(--fab-size);
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

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

.card-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
}

.card-body {
  margin: 0 0 16px;
  color: var(--muted);
}

.card-celebrate { border-color: var(--accent); }
.card-closed .card-body { margin-bottom: 0; }
.card-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-style: italic;
}
.card-golden { border-color: var(--gold); }
.card-golden .card-title { color: var(--gold); }

.review-trigger { width: 100%; }

/* Buttons */
.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 15px;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

/* Today: focus list */
.focus-count {
  color: var(--muted);
  margin: 0 0 12px;
}

.focus-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}

.focus-item + .focus-item {
  margin-top: 8px;
}

.check {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 16px;
  color: var(--text);
  cursor: pointer;
}

.focus-item.is-done .check {
  color: var(--muted);
  text-decoration: line-through;
  background: var(--bg);
}

.screen-title { margin: 0 0 8px; }
.screen-body { color: var(--muted); }

/* Capture overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.overlay[hidden] {
  display: none;
}

.sheet {
  width: 100%;
  max-width: 640px;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px 16px calc(env(safe-area-inset-bottom, 0px) + 20px);
}

.sheet-title { margin: 0 0 16px; }

.field-title {
  width: 100%;
  font-size: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
}

.field-due {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.field-due input { display: block; margin-top: 4px; }

.field-destination {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 16px;
}

/* Same class of bug as .overlay[hidden] above: an author rule with equal
   specificity to the UA [hidden] default wins the cascade regardless of
   source order, so a plain `hidden` attribute silently loses without this
   explicit override (found in A2/A5 hand-walks, fixed here in A6). */
.field-destination[hidden] { display: none; }

.sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Plan sheet */
.plan-suggested {
  color: var(--muted);
  margin: 0 0 8px;
}

.plan-notice {
  color: var(--accent);
  font-size: 13px;
  margin: 0 0 12px;
}

.plan-notice[hidden] { display: none; }

.plan-empty {
  color: var(--muted);
  margin: 0 0 16px;
}

.plan-groups {
  max-height: 50vh;
  overflow-y: auto;
  margin-bottom: 4px;
}

.plan-group + .plan-group { margin-top: 16px; }

.plan-group-title {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.plan-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.plan-item + .plan-item { margin-top: 8px; }

.plan-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-item .check { flex: 1; }

.plan-item .check[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
}

.plan-shrink {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px;
}

.plan-edit {
  display: flex;
  gap: 8px;
  flex: 1;
}

.plan-edit-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
}

/* Review sheet */
.review-oneaway {
  color: var(--accent);
  font-size: 13px;
  margin: 0 0 12px;
}

.review-oneaway[hidden] { display: none; }

.review-freeze {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 12px;
}

.review-freeze[hidden] { display: none; }

/* Inbox screen */
.inbox-group + .inbox-group { margin-top: 20px; }

.inbox-group-title {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.inbox-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.inbox-item + .inbox-item { margin-top: 8px; }

.inbox-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.inbox-item-title { display: block; margin-bottom: 8px; }

.inbox-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.inbox-actions button {
  border: none;
  background: none;
  color: var(--accent);
  font-size: 13px;
  padding: 4px 0;
  cursor: pointer;
}

.inbox-edit { display: flex; gap: 8px; }

.inbox-edit-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
}

/* History screen */
.history-streak { font-size: 16px; margin: 0 0 16px; }

.heatmap {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 3px;
  margin-bottom: 20px;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--border);
}

.heatmap-cell.level-1 { background: var(--level1); }
.heatmap-cell.level-2 { background: var(--level2); }
.heatmap-cell.level-3 { background: var(--accent); }
.heatmap-cell.is-golden { background: var(--gold); }
.heatmap-cell.is-freeze { background: var(--bg); border: 2px solid var(--accent); }

.history-weekly { margin-bottom: 16px; }

.weekly-list {
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: 14px;
}

.weekly-list li + li { margin-top: 4px; }

.history-bests, .history-milestone { color: var(--muted); margin: 0 0 8px; }

/* Settings screen */
.settings-group { margin-bottom: 24px; }

.settings-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.settings-times {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.settings-line { color: var(--muted); margin: 0 0 8px; }

.settings-import {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
}

.settings-about { color: var(--muted); font-size: 13px; margin-top: 24px; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161614;
    --surface: #201f1c;
    --text: #ececea;
    --muted: #9a9a94;
    --border: #34332e;
    --accent: #4f9c72;
    --accent-contrast: #06140d;
    --level1: #234a34;
    --level2: #3a7856;
  }
}

@media (min-width: 720px) {
  .view { padding-top: 32px; }
}
