/* ─── Design tokens ──────────────────────────────────────────────── */
:root {
  --bg:        #f5efe4;
  --bg-card:   #fbf6ec;
  --bg-input:  #fdfaf2;
  --bg-deep:   #2a3a2e;
  --bg-gold:   #f5e9d2;

  --ink:       #2a3a2e;
  --ink-2:     #6a7a6a;
  --ink-3:     #8a7a5e;
  --ink-mute:  #a89878;

  --green:     #4a5f4a;
  --green-d:   #3a4f3a;
  --green-l:   #7a8c7a;
  --terra:     #c47556;
  --terra-d:   #a85e44;
  --gold:      #d8a878;
  --gold-d:    #b8804a;
  --rose:      #a8745f;
  --sage:      #a8b8a0;
  --rust:      #5d7a5d;

  --border:    #e2d6bd;
  --border-2:  #d9cfb8;
  --bone:      #faf6ec;

  --shadow:    0 1px 0 rgba(74,95,74,0.04), 0 8px 24px -16px rgba(74,95,74,0.18);
  --shadow-l:  0 12px 32px -16px rgba(74,95,74,0.28);

  --serif:     'Fraunces', Georgia, serif;
  --sans:      'DM Sans', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font: inherit;
  color: inherit;
}

.serif  { font-family: var(--serif); letter-spacing: -0.01em; }
.italic { font-family: var(--serif); font-style: italic; font-variation-settings: "SOFT" 100, "WONK" 1; }

/* ─── Boot screen ──────────────────────────────────────────────── */
.boot {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; min-height: 100dvh;
}
.boot-mark {
  font-family: var(--serif); font-size: 1.5rem; color: var(--ink-3);
  animation: fadePulse 1.6s ease-in-out infinite;
}
.boot-mark em { color: var(--terra); font-variation-settings: "SOFT" 100; }
@keyframes fadePulse { 0%,100% { opacity: 0.4; } 50% { opacity: 1; } }

/* ─── Login screen ──────────────────────────────────────────────── */
.login-page {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; min-height: 100dvh; padding: 24px;
}
.login-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 24px;
  box-shadow: var(--shadow-l); padding: 36px 28px;
  width: 100%; max-width: 380px;
}
.login-card .brand {
  font-family: var(--serif); font-size: 1.7rem; font-weight: 600;
  text-align: center; margin-bottom: 4px;
}
.login-card .brand em { color: var(--terra); font-variation-settings: "SOFT" 100; }
.login-card .sub {
  text-align: center; color: var(--ink-3); font-size: 0.85rem; margin-bottom: 24px;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.login-card label {
  display: block; font-size: 0.78rem; color: var(--ink-3);
  letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 6px;
}
.login-card input {
  width: 100%; padding: 16px 16px; border-radius: 14px;
  background: var(--bg-input); border: 1px solid var(--border-2); outline: none;
  margin-bottom: 16px; font-size: 16px;
  min-height: 52px; -webkit-appearance: none;
}
.login-card input:focus { border-color: var(--green); }
.login-card .error {
  color: var(--terra-d); font-size: 0.9rem; margin: -8px 0 14px; text-align: center;
}
.login-card .pw-row {
  position: relative; margin-bottom: 16px;
}
.login-card .pw-row input { margin-bottom: 0; padding-right: 70px; }
.login-card .pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: transparent; border: none; color: var(--ink-3);
  font-size: 0.85rem; font-weight: 500; padding: 10px 12px;
  cursor: pointer; border-radius: 8px;
}
.login-card .pw-toggle:active { background: var(--bg-input); }
.login-card .btn.big { min-height: 52px; font-size: 1rem; }
.login-card .btn[disabled] { opacity: 0.6; cursor: not-allowed; }

/* ─── Header ───────────────────────────────────────────────────── */
.header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(245, 239, 228, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(218, 207, 184, 0.6);
}
.header-inner {
  max-width: 1024px; margin: 0 auto;
  padding: 12px 20px;
  display: flex; align-items: center; gap: 16px;
}
.header .brand {
  font-family: var(--serif); font-weight: 600; font-size: 1.1rem;
}
.header .brand em { color: var(--terra); font-variation-settings: "SOFT" 100; }
.header .who {
  margin-left: auto; font-size: 0.85rem; color: var(--ink-3);
  display: flex; align-items: center; gap: 12px;
}
.header .logout { color: var(--ink-3); font-size: 0.85rem; }
.header .logout:hover { color: var(--terra); }

.nav {
  display: flex; gap: 2px; overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.nav button {
  padding: 8px 12px; border-radius: 10px; font-size: 0.9rem; font-weight: 500;
  color: var(--ink-2); white-space: nowrap;
  display: flex; align-items: center; gap: 6px; transition: all 0.15s ease;
}
.nav button:hover { color: var(--green); }
.nav button.active { background: var(--bg-deep); color: var(--bone); }
.nav .ico { width: 16px; height: 16px; stroke-width: 2; }

@media (max-width: 600px) {
  .nav button .label { display: none; }
  .nav .ico { width: 18px; height: 18px; }
  .nav button { padding: 10px 12px; }
}

/* ─── Main ───────────────────────────────────────────────────────── */
main {
  max-width: 1024px; margin: 0 auto;
  padding: 28px 20px 64px;
}

.section-head { margin-bottom: 24px; animation: fadeIn 0.45s ease-out; }
.kicker {
  font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 8px;
}
h1.title, h2.title {
  font-family: var(--serif); font-size: 2rem; font-weight: 600; line-height: 1.1;
}
@media (min-width: 600px) { h1.title, h2.title { font-size: 2.4rem; } }
h2.title em { color: var(--green); font-variation-settings: "SOFT" 100; }
.sub-line {
  margin-top: 8px; font-size: 0.95rem; color: var(--ink-2);
}

/* ─── Cards ─────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.card.tight { padding: 12px 14px; }
.card.cushion { padding: 24px 22px; }

.empty {
  text-align: center; padding: 40px 20px;
  font-style: italic; color: var(--ink-3); font-size: 0.9rem;
}

/* ─── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; border-radius: 12px;
  font-size: 0.88rem; font-weight: 500;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}
.btn:active { transform: scale(0.98); }
.btn:hover  { filter: brightness(1.05); }

.btn.primary   { background: var(--green); color: var(--bone); border-color: var(--green-d); }
.btn.secondary { background: var(--bg-card); color: var(--ink); border-color: var(--border-2); }
.btn.accent    { background: var(--terra); color: var(--bone); border-color: var(--terra-d); }
.btn.ghost     { color: var(--ink-2); }
.btn.ghost:hover { color: var(--green); background: rgba(74,95,74,0.05); }
.btn.small     { padding: 6px 10px; font-size: 0.82rem; }
.btn.big       { padding: 14px 22px; font-size: 1rem; }

.btn .ico { width: 14px; height: 14px; stroke-width: 2; }

/* ─── Form fields ───────────────────────────────────────────────── */
.input, .select {
  padding: 10px 12px; border-radius: 12px;
  background: var(--bg-input); border: 1px solid var(--border-2);
  outline: none; color: var(--ink); font-size: 0.92rem;
  transition: border-color 0.15s;
}
.input:focus, .select:focus { border-color: var(--green); }

.field-grid { display: grid; gap: 8px; }
.field-grid.add-row { grid-template-columns: 1fr; }
@media (min-width: 600px) {
  .field-grid.add-row.shop  { grid-template-columns: 1fr 120px 140px auto; }
  .field-grid.add-row.clean { grid-template-columns: 1fr 1fr 130px auto; }
}

/* ─── Today / dashboard ─────────────────────────────────────────── */
.hero {
  margin-bottom: 32px; padding-top: 4px;
}
.hero .day {
  font-family: var(--serif); font-style: italic; color: var(--green);
  font-size: 3rem; line-height: 1; font-variation-settings: "SOFT" 100, "WONK" 1;
}
@media (min-width: 600px) { .hero .day { font-size: 4rem; } }
.hero .rest {
  font-family: var(--serif); color: var(--ink-2);
  font-size: 1.25rem; margin-top: 4px;
}

.tile-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
  margin-bottom: 24px;
}
@media (min-width: 600px) { .tile-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; } }

.tile {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 18px;
  padding: 18px; text-align: left; transition: transform 0.15s; box-shadow: var(--shadow);
}
.tile:hover { transform: translateY(-2px); }
.tile-top { display: flex; justify-content: space-between; align-items: flex-start; }
.tile .num {
  font-family: var(--serif); font-weight: 600; font-size: 2rem; margin-top: 12px;
}
.tile .lbl {
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3);
  margin-top: 4px;
}
.tile .hint { font-size: 0.78rem; color: var(--ink-2); margin-top: 6px; }

.dinner-cta {
  background: var(--bg-deep); color: var(--bone); border-radius: 22px;
  padding: 24px 26px; display: flex; justify-content: space-between;
  align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px;
}
.dinner-cta .label { font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; color: #a8b8a0; }
.dinner-cta h3 { font-family: var(--serif); font-size: 1.7rem; margin-top: 6px; font-weight: 500; }
.dinner-cta h3 em { color: var(--gold); font-variation-settings: "SOFT" 100, "WONK" 1; }
.dinner-cta p { font-size: 0.88rem; color: #c0ccb8; margin-top: 6px; }

/* ─── List rows ─────────────────────────────────────────────────── */
.list .row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-top: 1px solid var(--border);
}
.list .row:first-child { border-top: none; }
.list .row .label-bar { width: 6px; height: 36px; border-radius: 3px; flex-shrink: 0; }
.list .row .body { flex: 1; min-width: 0; }
.list .row .body .name { font-size: 0.92rem; font-weight: 500; color: var(--ink); }
.list .row .body .meta { font-size: 0.76rem; color: var(--ink-3); margin-top: 1px; }
.list .row .body .meta em { color: var(--terra); font-style: normal; }
.list .row .x-btn {
  padding: 6px; border-radius: 8px; color: var(--ink-mute);
}
.list .row .x-btn:hover { background: rgba(0,0,0,0.04); color: var(--terra); }

.group-label {
  font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-3); margin: 18px 4px 8px;
}

/* ─── Shopping checkbox ─────────────────────────────────────────── */
.check-btn {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--border-2); background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.15s;
}
.check-btn.on { background: var(--green); border-color: var(--green); }
.check-btn .ico { width: 12px; height: 12px; stroke-width: 3; color: var(--bone); }

.row.done .name { text-decoration: line-through; color: var(--ink-mute); }

/* ─── Nelson ────────────────────────────────────────────────────── */
.nelson-hero {
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-gold) 100%);
  border: 1px solid var(--border); border-radius: 20px;
  box-shadow: var(--shadow); padding: 22px;
  display: flex; gap: 16px; margin-bottom: 24px;
}
.nelson-avatar {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--terra); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.nelson-avatar .ico { width: 32px; height: 32px; color: var(--bone); }
.nelson-hero h3 {
  font-family: var(--serif); font-size: 1.4rem; font-weight: 600;
}
.nelson-hero .breed { color: var(--ink-2); font-size: 0.88rem; }
.nelson-hero .note {
  font-style: italic; color: #6a5a4a; font-size: 0.9rem; margin-top: 10px;
}
.nelson-meta {
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; gap: 16px;
  font-size: 0.78rem; color: var(--ink-2);
}
.nelson-meta span { display: inline-flex; align-items: center; gap: 6px; }

.med-row .pill {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg-gold); display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.med-row .pill.given { background: var(--green); }
.med-row .pill .ico { width: 16px; height: 16px; color: var(--rose); }
.med-row .pill.given .ico { color: var(--bone); }

/* ─── Cleaning ──────────────────────────────────────────────────── */
.label-bar.overdue   { background: var(--terra); }
.label-bar.due-soon  { background: var(--gold); }
.label-bar.fresh     { background: var(--sage); }
.meta.overdue        { color: var(--terra); }

/* ─── Calendar legend ───────────────────────────────────────────── */
.legend {
  display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 18px;
}
.legend-item {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.78rem; color: var(--ink-2);
}
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }

/* ─── Dinners ───────────────────────────────────────────────────── */
.view-toggle {
  display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
}
.view-toggle .grow { flex: 1; }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip {
  padding: 5px 12px; border-radius: 999px; font-size: 0.78rem;
  background: var(--bg-input); color: var(--ink-2);
  border: 1px solid var(--border-2); transition: all 0.15s;
}
.chip.on { background: var(--green); color: var(--bone); border-color: var(--green); }

.meal-tags {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px;
  font-size: 0.7rem; color: var(--ink-3);
}
.meal-tags .tag {
  padding: 2px 7px; border-radius: 4px; background: var(--bg-gold);
}

/* ─── Wheel ─────────────────────────────────────────────────────── */
.wheel-wrap {
  display: flex; flex-direction: column; align-items: center;
}
.wheel-stage {
  position: relative; width: min(420px, 100%);
}
.wheel-pointer {
  position: absolute; left: 50%; top: -6px;
  transform: translateX(-50%); z-index: 10;
}
.wheel-svg {
  width: 100%; height: auto;
  filter: drop-shadow(0 12px 24px rgba(42,58,46,0.25));
  transition: transform 4.2s cubic-bezier(0.17, 0.67, 0.12, 0.99);
}
.wheel-svg.idle { transition: none; }

.winner-card {
  margin-top: 24px;
  background: var(--bg-deep); color: var(--bone); border-radius: 20px;
  padding: 24px 28px; text-align: center; min-width: 280px;
  animation: fadeIn 0.5s ease-out;
}
.winner-card .label {
  font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: #a8b8a0; margin-bottom: 8px;
}
.winner-card .name {
  font-family: var(--serif); font-style: italic;
  font-size: 1.8rem; color: var(--gold);
  font-variation-settings: "SOFT" 100, "WONK" 1;
}
.winner-card .tags-line { font-size: 0.78rem; color: #c0ccb8; margin-top: 6px; }
.winner-card .actions { margin-top: 18px; display: flex; gap: 8px; justify-content: center; }
.winner-card .btn.ghost { color: #c0ccb8; }
.winner-card .btn.ghost:hover { color: var(--bone); background: rgba(255,255,255,0.08); }

/* ─── Modal & toasts ────────────────────────────────────────────── */
.toast-wrap {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--bg-deep); color: var(--bone);
  padding: 10px 18px; border-radius: 12px; font-size: 0.88rem;
  box-shadow: var(--shadow-l); animation: toastIn 0.3s ease-out;
}
@keyframes toastIn {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.notif-bar {
  background: var(--gold); color: var(--ink);
  padding: 12px 20px; text-align: center; font-size: 0.88rem;
  display: flex; gap: 10px; justify-content: center; align-items: center;
}
.notif-bar .btn { background: var(--bg-deep); color: var(--bone); }

.settings-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row .lbl { font-size: 0.92rem; }
.settings-row .desc { font-size: 0.78rem; color: var(--ink-3); margin-top: 2px; }

/* ─── Anim ──────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.45s ease-out; }

footer {
  text-align: center; padding: 24px 20px;
  color: var(--ink-mute); font-size: 0.78rem;
}

/* ─── Utility ───────────────────────────────────────────────────── */
.row-spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack-sm > * + * { margin-top: 6px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-xs { font-size: 0.78rem; }
.text-sm { font-size: 0.88rem; }
.text-mute { color: var(--ink-3); }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.w-full { width: 100%; }
