:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #efebe3;
  --ink: #1e1b15;
  --muted: #6b655a;
  --line: #e0d9cc;
  --accent: #b4472a;
  --accent-ink: #ffffff;
  --accent-soft: #f6e3dc;
  --ok: #2f7a4f;
  --ok-soft: #dff1e5;
  --warn: #8a5a00;
  --warn-soft: #fbefd2;
  --danger: #b3261e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(30, 27, 21, .06), 0 6px 20px rgba(30, 27, 21, .06);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17150f;
    --surface: #211e17;
    --surface-2: #2b271e;
    --ink: #f1ece2;
    --muted: #a69f90;
    --line: #3a3529;
    --accent: #e0714f;
    --accent-ink: #1a0f0a;
    --accent-soft: #3a221a;
    --ok: #7fd0a0;
    --ok-soft: #1d3326;
    --warn: #e9be62;
    --warn-soft: #3a2f14;
    --danger: #ff8a80;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
}

h1, h2, h3 { line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: 1.6rem; letter-spacing: -.02em; }
h2 { font-size: 1.1rem; }
p { margin: 0; }
a { color: var(--accent); }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px max(16px, env(safe-area-inset-left)) 12px max(16px, env(safe-area-inset-right));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); text-decoration: none; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 7px 7px 7px 2px;
  background: var(--accent); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .15);
}
.topnav { display: flex; gap: 8px; align-items: center; }

.page {
  max-width: 760px; margin: 0 auto;
  padding: 20px 16px calc(96px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 18px;
}

.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-tight { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.row-tight { display: flex; gap: 4px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}

/* Knoppen */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 999px; min-height: 44px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, .chip:focus-visible, a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: .875rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* Formulieren */
label.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .field-label { font-weight: 600; font-size: .9rem; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
input[type="text"], input[type="password"], input[type="url"], input[type="number"], textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
textarea { resize: vertical; min-height: 96px; line-height: 1.45; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .grid-2 { grid-template-columns: 1fr; } }
.counter { align-self: flex-end; font-size: .75rem; color: var(--muted); }
.price-input { position: relative; }
.price-input input { padding-left: 30px; }
.price-input::before { content: "€"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  appearance: none; font: inherit; font-size: .875rem; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 6px 12px; min-height: 36px;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip:disabled { opacity: .4; cursor: not-allowed; }

/* Meldingen */
.notice { border-radius: 12px; padding: 12px 14px; font-size: .92rem; border: 1px solid transparent; }
.notice.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.notice.error { background: var(--accent-soft); color: var(--danger); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.notice li + li { margin-top: 4px; }

.badge {
  display: inline-flex; align-items: center; font-size: .75rem; font-weight: 700; letter-spacing: .02em;
  padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted);
}
.badge.concept { background: var(--warn-soft); color: var(--warn); }
.badge.akkoord { background: var(--accent-soft); color: var(--accent); }
.badge.geplaatst { background: var(--ok-soft); color: var(--ok); }

/* Overzicht */
.listing-list { display: flex; flex-direction: column; gap: 10px; }
.listing-item {
  display: flex; gap: 12px; align-items: center; padding: 10px; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.listing-item:hover { border-color: var(--muted); }
.listing-item img, .thumb-empty { width: 68px; height: 68px; border-radius: 10px; object-fit: cover; background: var(--surface-2); flex: none; }
.listing-item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; padding: 36px 16px; }
.empty h2 { margin-bottom: 6px; }

/* Foto's */
.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px 16px; text-align: center;
  background: var(--surface); cursor: pointer; display: flex; flex-direction: column; gap: 6px; align-items: center;
}
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone strong { font-size: 1.05rem; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .tag {
  position: absolute; left: 6px; top: 6px; font-size: .7rem; font-weight: 700;
  background: rgba(20, 18, 14, .78); color: #fff; padding: 2px 7px; border-radius: 999px;
}
.photo .tools { position: absolute; inset: auto 4px 4px 4px; display: flex; justify-content: space-between; gap: 4px; }
.icon-btn {
  appearance: none; border: 0; width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
  background: rgba(20, 18, 14, .78); color: #fff; font-size: 15px; line-height: 1; display: grid; place-items: center;
}
.icon-btn:disabled { opacity: .3; cursor: default; }
.photo.add { display: grid; place-items: center; border-style: dashed; cursor: pointer; color: var(--muted); font-weight: 600; font-size: .85rem; text-align: center; padding: 6px; }

/* Vaste actiebalk */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.actionbar .inner { max-width: 760px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }
.actionbar .btn { white-space: normal; line-height: 1.2; }
.save-state { font-size: .8rem; color: var(--muted); min-width: 76px; }

/* Overdracht */
.steps { counter-reset: step; display: flex; flex-direction: column; gap: 14px; }
.step { position: relative; padding-left: 44px; }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%;
  background: var(--ink); color: var(--bg); font-weight: 700; display: grid; place-items: center; font-size: .9rem;
}
.step h2 { padding-top: 4px; margin-bottom: 8px; }
.copy-list { display: flex; flex-direction: column; }
.copy-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.copy-row:first-child { border-top: 0; padding-top: 0; }
.copy-row .label { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.copy-row .value { white-space: pre-wrap; overflow-wrap: anywhere; }
.copy-row .value.empty-value { color: var(--muted); font-style: italic; }
.copy-row .pick { font-size: .75rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }

.spinner {
  width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: .9rem; font-weight: 600;
  z-index: 10; max-width: calc(100vw - 32px); text-align: center; box-shadow: var(--shadow);
}

.login { max-width: 380px; margin: 8vh auto 0; width: 100%; }
