/* Homefront — warm, speels, botanisch/retro */

@font-face {
  font-family: 'Fraunces';
  src: url('/fonts/fraunces.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Karla';
  src: url('/fonts/karla.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --paper: #f3ecdc;
  --paper-deep: #e9dfc8;
  --card: #fbf7ee;
  --ink: #2f3a2c;
  --ink-soft: #66705e;
  --ink-faint: #9aa08f;
  --line: #2f3a2c;
  --sage: #a9c4a0;
  --sage-pale: #dde8d4;
  --sage-deep: #557650;
  --clay: #dc9b7f;
  --clay-pale: #f3d9cb;
  --mustard: #e4c274;
  --mustard-pale: #f4e5bd;
  --sky: #b9cfd6;
  --shadow: 3px 3px 0 var(--line);
  --shadow-sm: 2px 2px 0 var(--line);
  --radius: 22px;
  --radius-sm: 14px;
  --serif: 'Fraunces', 'Georgia', serif;
  --sans: 'Karla', system-ui, sans-serif;
  --nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b231c;
    --paper-deep: #151c16;
    --card: #243025;
    --ink: #efe6d2;
    --ink-soft: #b9b8a4;
    --ink-faint: #848b7a;
    --line: #0e130f;
    --sage: #8fb185;
    --sage-pale: #2f4030;
    --sage-deep: #b5d3aa;
    --clay: #d99479;
    --clay-pale: #4a3229;
    --mustard: #d9b765;
    --mustard-pale: #483f25;
    --sky: #6f8f99;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
/* Papierkorrel */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.3 0 0 0 0 0.25 0 0 0 0 0.15 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { body::before { opacity: 0.18; } }

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
svg { display: block; }
[hidden] { display: none !important; }
.grow { flex: 1; min-width: 0; }

#app {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 18px) 18px calc(var(--nav-h) + var(--safe-b) + 28px);
}
body.no-nav #app { padding-bottom: 40px; }

/* ---------- typografie ---------- */
h1, h2, h3, .serif {
  font-family: var(--serif);
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
h1 { font-size: 2.1rem; line-height: 1.05; }
h2 { font-size: 1.35rem; line-height: 1.15; }
h3 { font-size: 1.1rem; }
.muted { color: var(--ink-soft); }
.tiny { font-size: 0.82rem; }
.eyebrow {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--ink-soft);
}

/* ---------- kop ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  min-height: 44px;
}
.topbar .grow { flex: 1; min-width: 0; }
.topbar h1 { font-size: 1.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wordmark {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--serif);
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
  font-weight: 700; font-size: 1.15rem;
  color: var(--sage-deep);
}
.wordmark svg { width: 26px; height: 26px; }

/* ---------- knoppen ---------- */
.icon-btn {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: transform .08s, box-shadow .08s;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:active, .btn:active, .tile:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--line); }
.icon-btn.plain { border: 0; box-shadow: none; background: transparent; }
.icon-btn.plain:active { transform: scale(.94); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--sage);
  color: #22301f;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: transform .08s, box-shadow .08s;
}
.btn svg { width: 20px; height: 20px; }
.btn.block { width: 100%; }
.btn.ghost { background: var(--card); color: var(--ink); }
.btn.clay { background: var(--clay); color: #2c1c14; }
.btn.danger { background: var(--clay-pale); color: var(--ink); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.link-btn {
  background: none; border: 0; padding: 6px 2px;
  color: var(--sage-deep); font-weight: 700;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px;
}

/* ---------- formulieren ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.input {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line);
  background: var(--card);
  outline: none;
  transition: box-shadow .12s;
}
.input:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--sage) 55%, transparent); }
.input::placeholder { color: var(--ink-faint); }

/* ---------- kaarten & tegels ---------- */
.card {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.greeting { margin: 8px 0 22px; position: relative; }
.greeting h1 { max-width: 80%; }
.greeting .date { margin-top: 6px; color: var(--ink-soft); font-weight: 500; }
.greeting .sprig {
  position: absolute; right: -6px; top: -14px;
  width: 104px; height: 118px;
  color: var(--sage-deep);
  opacity: .9;
  pointer-events: none;
}

.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.tile {
  position: relative;
  overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 150px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1.5px solid var(--line);
  box-shadow: var(--shadow);
  background: var(--card);
  text-decoration: none;
  color: var(--ink);
  transition: transform .08s, box-shadow .08s;
}
.tile.wide { grid-column: span 2; }
.tile.sage { background: var(--sage-pale); }
.tile.clay { background: var(--clay-pale); }
.tile.mustard { background: var(--mustard-pale); }
.tile.sky { background: color-mix(in srgb, var(--sky) 35%, var(--card)); }
.tile .tile-head { display: flex; align-items: center; gap: 10px; position: relative; z-index: 1; }
.tile .tile-icon {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--card);
}
.tile .tile-icon svg { width: 22px; height: 22px; }
.tile h2 { font-size: 1.2rem; }
.tile .tile-body { margin-top: 12px; position: relative; z-index: 1; flex: 1; }
.tile .big-num {
  font-family: var(--serif); font-variation-settings: 'SOFT' 100, 'WONK' 1;
  font-weight: 600; font-size: 2.4rem; line-height: 1;
}
.tile .deco {
  position: absolute; right: -14px; bottom: -16px;
  width: 92px; height: 92px;
  color: var(--sage-deep);
  opacity: .22;
  pointer-events: none;
}
.tile.clay .deco { color: #a65a3c; }
.tile.mustard .deco { color: #8e6c1d; }
.tile.wide.soon { min-height: 0; }
.tile.soon { box-shadow: none; border-style: dashed; background: transparent; }
.tile.soon .tile-icon { border-style: dashed; background: transparent; }
.stamp {
  position: absolute; top: 14px; right: 12px; z-index: 2;
  transform: rotate(6deg);
  padding: 3px 9px;
  border: 1.5px solid var(--ink-soft);
  border-radius: 7px;
  color: var(--ink-soft);
  font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
}
.peek { list-style: none; margin: 0; padding: 0; }
.peek li {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.peek li::before {
  content: ''; flex: none;
  width: 12px; height: 12px;
  border: 1.5px solid var(--ink); border-radius: 50%;
}
.peek .more { color: var(--ink-soft); font-size: .9rem; }
.peek .more::before { display: none; }

.quick-add { display: flex; gap: 8px; margin-top: 12px; position: relative; z-index: 1; }
.quick-add .input { min-height: 46px; padding: 10px 14px; }
.quick-add .icon-btn { background: var(--sage); }

/* ---------- lijsten-overzicht ---------- */
.list-cards { display: grid; gap: 12px; }
.list-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  text-decoration: none;
  transition: transform .08s, box-shadow .08s;
}
.list-card:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--line); }
.list-card .tile-icon {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--sage-pale);
}
.list-card .tile-icon svg { width: 24px; height: 24px; }
.list-card .grow { flex: 1; min-width: 0; }
.list-card h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-card .count {
  font-family: var(--serif); font-weight: 600; font-size: 1.4rem;
  min-width: 34px; text-align: right;
}
.list-card .chev { width: 20px; height: 20px; color: var(--ink-faint); }

/* ---------- één lijst ---------- */
.add-bar {
  position: sticky; top: calc(var(--safe-t) + 6px); z-index: 5;
  display: flex; gap: 8px;
  margin-bottom: 14px;
}
.add-bar .input { box-shadow: var(--shadow-sm); }
.add-bar .icon-btn { width: 52px; height: 52px; background: var(--sage); }

.staples { margin: 0 -18px 18px; padding: 2px 18px 6px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.staples::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 0 14px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--card);
  font-weight: 600; font-size: .95rem;
  white-space: nowrap;
}
.chip svg { width: 16px; height: 16px; }
.chip.on { background: var(--sage); color: #22301f; }
.chip.dashed { border-style: dashed; background: transparent; color: var(--ink-soft); }
.chip .x { margin-right: -4px; opacity: .7; }

.items { list-style: none; margin: 0; padding: 0; }
.item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 4px;
  border-bottom: 1.5px dashed color-mix(in srgb, var(--ink) 18%, transparent);
  animation: pop .18s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.check {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1.8px solid var(--line);
  background: var(--card);
  padding: 0;
}
.check svg { width: 18px; height: 18px; opacity: 0; transition: opacity .1s; }
.item.done .check { background: var(--sage); }
.item.done .check svg { opacity: 1; }
.item .txt { flex: 1; min-width: 0; background: none; border: 0; padding: 4px 0; text-align: left; }
.item .txt .t { display: block; font-weight: 600; overflow-wrap: anywhere; }
.item .txt .n { display: block; font-size: .88rem; color: var(--ink-soft); }
.item.done .txt .t { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--ink-faint); font-weight: 500; }
.who {
  flex: none;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  font-size: .72rem; font-weight: 800;
  color: #22301f;
}
.who.sage { background: var(--sage); }
.who.clay { background: var(--clay); color: #2c1c14; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 26px 0 4px;
}
.empty {
  text-align: center;
  padding: 34px 10px 20px;
  color: var(--ink-soft);
}
.empty svg { width: 120px; height: 120px; margin: 0 auto 10px; color: var(--sage-deep); opacity: .7; }
.empty .serif { font-size: 1.25rem; color: var(--ink); margin-bottom: 4px; }

/* ---------- navigatie onderaan ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 0 14px calc(var(--safe-b) + 10px);
  pointer-events: none;
}
.nav-inner {
  pointer-events: auto;
  max-width: 420px; margin: 0 auto;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-around;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
}
.nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 64px; padding: 6px 10px;
  border-radius: 999px;
  text-decoration: none;
  font-size: .74rem; font-weight: 700;
  color: var(--ink-soft);
}
.nav a svg { width: 24px; height: 24px; }
.nav a.active { color: var(--ink); }
.nav a.active svg { color: var(--sage-deep); }
.nav a.active .pill { background: var(--sage-pale); }
.nav .pill { padding: 3px 14px; border-radius: 999px; transition: background .15s; }

/* ---------- bottom sheet ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: color-mix(in srgb, #10160f 45%, transparent);
  animation: fade .15s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  max-width: 560px; margin: 0 auto;
  max-height: 88dvh; overflow-y: auto;
  padding: 10px 20px calc(var(--safe-b) + 22px);
  border-radius: 28px 28px 0 0;
  border: 1.5px solid var(--line); border-bottom: 0;
  background: var(--paper);
  animation: up .2s cubic-bezier(.2, .8, .3, 1);
}
@keyframes up { from { transform: translateY(40%); opacity: 0; } }
.sheet .grabber { width: 44px; height: 5px; border-radius: 9px; background: var(--ink-faint); margin: 0 auto 16px; opacity: .6; }
.sheet h2 { margin-bottom: 16px; }
.sheet .actions { display: grid; gap: 10px; margin-top: 8px; }
.icon-picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 18px; }
.icon-picker button {
  aspect-ratio: 1; display: grid; place-items: center;
  border-radius: 14px; border: 1.5px solid var(--line); background: var(--card);
}
.icon-picker button svg { width: 22px; height: 22px; }
.icon-picker button.on { background: var(--sage); box-shadow: var(--shadow-sm); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; z-index: 60;
  bottom: calc(var(--nav-h) + var(--safe-b) + 24px);
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 36px);
  padding: 12px 18px;
  text-align: center;
  border-radius: 16px;
  border: 1.5px solid var(--line);
  background: var(--ink); color: var(--paper);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  animation: up .2s ease-out;
}

/* ---------- login ---------- */
.login {
  min-height: calc(100dvh - 60px);
  display: flex; flex-direction: column; justify-content: center;
}
.login .hero { text-align: center; margin-bottom: 26px; }
.login .hero svg { width: 150px; height: 150px; margin: 0 auto 6px; color: var(--sage-deep); }
.login .hero h1 { font-size: 2.6rem; }
.login .hero p { margin: 6px 0 0; color: var(--ink-soft); }
.divider {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0; color: var(--ink-faint); font-size: .85rem; font-weight: 700;
}
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1.5px dashed currentColor; }
.err { color: #b4492b; font-weight: 700; margin: 0 0 12px; min-height: 1.2em; }
@media (prefers-color-scheme: dark) { .err { color: #f0a284; } }

/* ---------- instellingen ---------- */
.settings { display: grid; gap: 16px; }
.settings .row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1.5px dashed color-mix(in srgb, var(--ink) 18%, transparent); }
.settings .row:last-child { border-bottom: 0; }
.settings .row .grow { flex: 1; min-width: 0; }
.settings .row svg { width: 22px; height: 22px; }
.me { display: flex; align-items: center; gap: 14px; }
.me .who { width: 52px; height: 52px; font-size: 1.2rem; }

.spinner {
  width: 28px; height: 28px; margin: 60px auto;
  border-radius: 50%;
  border: 3px solid var(--sage-pale); border-top-color: var(--sage-deep);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
