/* ============================================================
   Wagenda — "Leash-Loop Checklist Board"
   Soft sage single-column screen, collar-tag strips,
   buckle bottom tabs. No icons, no check marks — dots only.
   ============================================================ */

:root {
  --sage: #e9eddf;
  --sage-deep: #d8dfc9;
  --cream: #f5ebdd;
  --ink: #2c332e;
  --ink-soft: #5d6a5f;
  --primary: #3c7a6b;          /* seafoam deep */
  --seafoam: #6fbfa4;          /* Due */
  --seafoam-soft: #dff0e7;
  --accent: #e46f51;           /* coral — Doing */
  --coral-soft: #fbe3da;
  --graphite: #4a4f54;         /* Done */
  --graphite-soft: #e2e4e6;
  --card: #fbf8f1;
  --line: #cfd8c6;
  --shadow: 0 6px 18px rgba(44, 51, 46, .10);
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(120% 60% at 50% 0%, #f0f2e6 0%, var(--sage) 62%, var(--sage-deep) 100%);
  color: var(--ink);
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

body {
  min-height: 100dvh;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- stacks ---------- */

#stacks {
  flex: 1;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 16px 0;
}

.stack { padding-bottom: 12px; }
.stack[hidden] { display: none; }

.stack-head { margin: 2px 2px 16px; }
.stack-kicker {
  margin: 0 0 2px;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
}
.stack-title {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: -.02em;
  color: var(--ink);
}

/* ---------- Loop board ---------- */

.loop-board {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px 16px 18px;
  border: 1px solid var(--line);
}

.board-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.board-title {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
  letter-spacing: -.01em;
  max-width: 55%;
}

.tallies {
  display: flex;
  gap: 8px;
}

.tally {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font: inherit;
  cursor: pointer;
}
.tally-due  { background: var(--seafoam-soft); border: 2px solid var(--seafoam); color: #23584a; }
.tally-done { background: var(--graphite-soft); border: 2px solid var(--graphite); color: var(--graphite); }
.tally:active { transform: scale(.94); }

.tally-num { font-size: 19px; font-weight: 700; line-height: 1; }
.tally-label { font-size: 8.5px; text-transform: uppercase; letter-spacing: .06em; }

.board-hint {
  margin: 12px 2px 10px;
  font-size: 11.5px;
  color: var(--ink-soft);
}

.next-due { display: flex; flex-direction: column; gap: 8px; }

/* ---------- collar-tag strips (shared) ---------- */

.strip {
  display: flex;
  align-items: stretch;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  min-height: 58px;
}

.strip-edge {
  width: 10px;
  flex: 0 0 10px;
}
.strip.stage-due   .strip-edge { background: var(--seafoam); }
.strip.stage-doing .strip-edge { background: var(--accent); }
.strip.stage-done  .strip-edge { background: var(--graphite); }

.strip-main {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 0;
  cursor: pointer;
  min-width: 0;
}
.strip-main:active { background: rgba(60, 122, 107, .07); }

/* buckle notch: small punched hole near the left of the tag */
.buckle-notch {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin-left: 10px;
  border-radius: 50%;
  background: var(--sage);
  border: 2.5px solid #b9c4ad;
}

.strip-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.strip-name {
  font-weight: 700;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.strip-meta {
  font-size: 11.5px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* stage edge button: dots + word, never a check mark */
.strip-stage {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  border-left: 1px dashed var(--line);
  background: none;
  font: inherit;
  flex: 0 0 66px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  padding: 6px 4px;
}
.strip-stage:active { background: rgba(60, 122, 107, .08); }

.dots { display: flex; gap: 4px; }
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1.6px solid #a8b3a0;
  background: transparent;
}
.dot.on-dot-due   { background: var(--seafoam); border-color: var(--seafoam); }
.dot.on-dot-doing { background: var(--accent);  border-color: var(--accent); }
.dot.on-dot-done  { background: var(--graphite); border-color: var(--graphite); }

.stage-word {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.stage-due   .stage-word { color: #2f6e5c; }
.stage-doing .stage-word { color: #b64f34; }
.stage-done  .stage-word { color: var(--graphite); }

/* ---------- coral add bar ---------- */

.add-bar {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  margin: 16px 0 4px;
  padding: 17px 18px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #fff7f2;
  font: inherit;
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: .01em;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(228, 111, 81, .32);
}
.add-bar:active { transform: translateY(1px); box-shadow: 0 4px 12px rgba(228, 111, 81, .3); }

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

.lanes { display: flex; flex-direction: column; gap: 14px; }

.lane {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 12px 12px;
}

.lane-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 2px 10px;
}
.lane-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.lane-due   .lane-dot { background: var(--seafoam); }
.lane-doing .lane-dot { background: var(--accent); }
.lane-done  .lane-dot { background: var(--graphite); }

.lane-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.lane-count {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-soft);
  background: var(--sage);
  border-radius: 999px;
  padding: 2px 9px;
}

.lane-rows { display: flex; flex-direction: column; gap: 8px; }

.lane-empty {
  margin: 4px 2px 2px;
  font-size: 12.5px;
  color: var(--ink-soft);
  font-style: italic;
}

/* ---------- Find ---------- */

.search-wrap { position: relative; margin-bottom: 8px; }

.search-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  padding: 15px 66px 15px 16px;
}
.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(60, 122, 107, .18);
}
.search-input::-webkit-search-cancel-button { display: none; }

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: var(--sage);
  color: var(--ink-soft);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.find-count {
  margin: 4px 4px 10px;
  font-size: 12px;
  color: var(--ink-soft);
}
.find-results { display: flex; flex-direction: column; gap: 8px; }

/* ---------- About / settings panel ---------- */

.about-panel {
  margin-top: 18px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
}
.about-title {
  margin: 0 0 8px;
  font-size: 14px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.about-copy { margin: 0 0 6px; font-size: 13.5px; line-height: 1.55; }
.about-meta { margin: 0 0 14px; font-size: 11.5px; color: var(--ink-soft); }
.about-actions { display: flex; flex-direction: column; gap: 8px; }

/* ---------- Add form (collar-tag panel) ---------- */

.tag-panel {
  position: relative;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 26px 16px 18px;
}
.tag-hole {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--sage);
  border: 2.5px solid #b9c4ad;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 2px 7px;
}
.req { color: var(--accent); }

.field input[type="text"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  padding: 14px 14px;
}
.field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(60, 122, 107, .16);
}
.field.invalid input { border-color: var(--accent); }
.field.invalid .field-error { display: block; }

.field-error {
  display: none;
  margin: 6px 2px 0;
  font-size: 12px;
  font-weight: 600;
  color: #b64f34;
}

.choice-row { display: flex; gap: 8px; }

.choice {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink-soft);
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  padding: 12px 4px;
  cursor: pointer;
  min-height: 46px;
}
.choice[aria-pressed="true"] { color: #fff; border-color: transparent; }
.choice.choice-due[aria-pressed="true"]     { background: var(--seafoam); }
.choice.choice-doing[aria-pressed="true"]   { background: var(--accent); }
.choice.choice-done[aria-pressed="true"]    { background: var(--graphite); }
.choice:not([aria-pressed="true"]):active   { background: var(--sage-deep); }

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 20px;
}

.btn {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 15.5px;
  font-weight: 700;
  padding: 15px 16px;
  cursor: pointer;
  min-height: 50px;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #f2f8f4; box-shadow: 0 6px 16px rgba(60, 122, 107, .28); }
.btn-ghost   { background: transparent; color: var(--ink-soft); border: 1.5px solid var(--line); }
.btn-danger  { background: transparent; color: #b64f34; border: 1.5px solid #e4a795; }

.danger-zone { margin-top: 14px; }
.danger-zone .btn { width: 100%; }

/* ---------- empty states (faint paw outline) ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 12px 16px;
  text-align: center;
}
.empty[hidden] { display: none; }
.empty svg { width: 62px; height: 62px; opacity: .5; }
.empty-prompt {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-soft);
  max-width: 240px;
  line-height: 1.5;
}

/* ---------- bottom tab bar (collar buckles) ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 10px 12px calc(env(safe-area-inset-bottom, 0px) + 12px);
  background: linear-gradient(to top, rgba(233, 237, 223, .98) 70%, rgba(233, 237, 223, 0));
  pointer-events: none;
}
#app .tabbar { max-width: 480px; margin: 0 auto; }

.tab {
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: 1;
  max-width: 104px;
  border: 1px solid #c3cdba;
  border-radius: 15px;
  background: var(--cream);
  color: var(--ink-soft);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 15px 4px 13px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: transform .18s ease, box-shadow .18s ease, color .18s ease;
}
.tab-hole {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sage-deep);
  border: 1.5px solid #aab5a1;
}

.tab.active {
  background: var(--primary);
  border-color: #2e5f53;
  color: #f2f8f4;
  transform: rotate(-4deg) translateY(-4px);
  box-shadow: 0 10px 20px rgba(44, 51, 46, .28);
}
.tab.active .tab-hole { background: var(--sage); border-color: rgba(255, 255, 255, .55); }
.tab:not(.active):active { transform: translateY(1px); }

/* spacer so content never hides under the fixed bar */
.tab-spacer { height: calc(78px + env(safe-area-inset-bottom, 0px)); flex: 0 0 auto; }

/* ---------- confirm dialog ---------- */

.dialog-veil {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(44, 51, 46, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.dialog-veil[hidden] { display: none; }

.dialog {
  width: 100%;
  max-width: 320px;
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 20px 16px 16px;
  box-shadow: 0 18px 40px rgba(44, 51, 46, .35);
}
.dialog-msg { margin: 0 0 16px; font-size: 15px; line-height: 1.5; font-weight: 600; }
.dialog-actions { display: flex; gap: 8px; }
.dialog-actions .btn { flex: 1; padding: 12px 8px; min-height: 46px; font-size: 14px; }

/* ---------- misc ---------- */

.hidden { display: none !important; }
