@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url(/fonts/schibsted-grotesk-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-display: swap;
  font-weight: 400 900;
  src: url(/fonts/schibsted-grotesk-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* Materiaal van een keuken: beton, graniet, papier */
  --stone: #E3E4E0;
  --stone-dot: #C8CBC5;
  --paper: #F7F7F4;
  --card: #FFFFFF;
  --graphite: #23262B;
  --ink-2: #5C615B;
  --line: #D3D5CF;
  --line-strong: #B9BCB5;
  --danger: #A3322A;

  --font: "Schibsted Grotesk", ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  --top-h: 56px;
  --r-sm: 6px;
  --r-md: 10px;
  --shadow-float: 0 1px 2px rgba(35, 38, 43, .08), 0 8px 24px rgba(35, 38, 43, .10);
  --shadow-item: 0 1px 1px rgba(35, 38, 43, .10), 0 3px 10px rgba(35, 38, 43, .08);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--graphite);
  background: var(--stone);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 2px solid var(--graphite); outline-offset: 2px; }

/* ---------- Knoppen en velden ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--card); font-weight: 560; font-size: 15px;
  white-space: nowrap;
}
.btn:hover { border-color: var(--graphite); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--graphite); border-color: var(--graphite); color: #fff; }
.btn-primary:hover { background: #3A3E45; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 14px; }
.btn-wide { width: 100%; }

.input {
  width: 100%; height: 44px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--card);
}
.input:focus { outline: none; border-color: var(--graphite); box-shadow: 0 0 0 1px var(--graphite); }
.input-sm { height: 34px; font-size: 14px; }
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.45; }

.field-label { display: block; margin: 0 0 8px; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.form-error { min-height: 20px; margin: 8px 0; font-size: 14px; color: var(--danger); }

/* ---------- Inloggen ---------- */
.login {
  min-height: 100%; display: grid; place-items: center; padding: 24px;
  background-color: var(--stone);
  background-image: radial-gradient(var(--stone-dot) 1px, transparent 1.2px);
  background-size: 24px 24px;
}
.login-card {
  width: 100%; max-width: 380px; padding: 32px 28px 28px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-float);
}
.login-title { margin: 0 0 28px; font-size: 34px; line-height: 1.05; font-weight: 720; letter-spacing: -0.025em; }
.who-list { display: grid; gap: 10px; }
.who-btn {
  display: flex; align-items: center; gap: 14px; width: 100%;
  height: 60px; padding: 0 16px;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  font-size: 18px; font-weight: 620; text-align: left;
}
.who-btn:hover { border-color: var(--who); box-shadow: inset 4px 0 0 var(--who); }
.who-swatch { width: 28px; height: 28px; border-radius: 4px; background: var(--who); color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 700; }

/* ---------- Bovenbalk ---------- */
.app { position: fixed; inset: 0; }
.topbar {
  position: absolute; top: 0; left: 0; right: 0; height: var(--top-h); z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 12px 0 8px; padding-top: env(safe-area-inset-top);
  height: calc(var(--top-h) + env(safe-area-inset-top));
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.board-btn {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  height: 40px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: transparent;
}
.board-btn:hover, .board-btn[aria-expanded="true"] { background: var(--stone); }
.board-name { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { width: 16px; height: 16px; flex: none; color: var(--ink-2); }
.board-count { font-size: 13px; color: var(--ink-2); white-space: nowrap; }

.filter-select {
  height: 34px; padding: 0 30px 0 10px; max-width: 170px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); background-color: var(--card);
  font-size: 14px; font-weight: 520;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%235C615B' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 14px;
}
.legend { display: flex; gap: 12px; font-size: 13px; color: var(--ink-2); }
.legend-item { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend-dot { width: 10px; height: 10px; border-radius: 2px; background: var(--who); }
.me-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 0; flex: none;
  background: var(--who, var(--graphite)); color: #fff; font-weight: 700; font-size: 14px;
}
.me-btn:hover { box-shadow: 0 0 0 3px var(--stone); }

.popover {
  position: absolute; top: calc(var(--top-h) + env(safe-area-inset-top) - 4px); z-index: 40;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-float); padding: 8px;
}
.board-menu { left: 8px; width: 300px; max-width: calc(100vw - 16px); }
.me-menu { right: 8px; width: 240px; padding: 14px; }
.me-text { margin: 0 0 12px; font-size: 14px; color: var(--ink-2); }
.me-text strong { color: var(--graphite); }
.board-list { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow: auto; }
.board-list button {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%;
  height: 40px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: transparent;
  font-size: 15px; font-weight: 540; text-align: left;
}
.board-list button:hover { background: var(--stone); }
.board-list button[aria-current="true"] { font-weight: 700; box-shadow: inset 3px 0 0 var(--graphite); }
.board-list .n { font-size: 13px; color: var(--ink-2); font-weight: 450; }
.menu-label { margin: 2px 10px 0; font-size: 13px; color: var(--ink-2); }
.menu-sep { height: 1px; background: var(--line); margin: 8px 2px; }
.menu-form { display: flex; gap: 6px; padding: 6px 2px 2px; }
.menu-danger {
  width: 100%; margin-top: 6px; height: 36px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--danger); font-size: 14px; font-weight: 560; text-align: left; padding: 0 10px;
}
.menu-danger:hover { background: #F3E4E2; }
.menu-danger.confirm { background: var(--danger); color: #fff; text-align: center; }

/* ---------- Canvas ---------- */
.viewport {
  position: absolute; left: 0; right: 0; bottom: 0; top: calc(var(--top-h) + env(safe-area-inset-top));
  overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none;
  background-color: var(--stone);
  background-image: radial-gradient(var(--stone-dot) 1px, transparent 1.2px);
  background-size: 24px 24px;
  cursor: default;
}
.viewport.panning { cursor: grabbing; }
.viewport:focus { outline: none; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }

.item {
  position: absolute; background: var(--card);
  box-shadow: var(--shadow-item);
  cursor: grab; touch-action: none;
  transition: opacity .15s ease;
}
.item.dragging { cursor: grabbing; box-shadow: 0 4px 10px rgba(35,38,43,.14), 0 18px 40px rgba(35,38,43,.16); }
.item.dim { opacity: .16; }
.item.selected { outline: 2px solid var(--graphite); outline-offset: 3px; }
.item.chosen { outline: 3px solid var(--graphite); outline-offset: 0; }
.item.chosen.selected { outline-offset: 3px; }

.item img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.item.photo { background: #EDEEEA; }

/* De plakstrook: laat zien wie het heeft neergezet */
.tape {
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  min-width: 52px; height: 20px; padding: 0 8px;
  background: var(--who); color: #fff; opacity: .94;
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
  pointer-events: none;
}

.note-body {
  width: 100%; height: 100%; padding: 22px 18px 16px; overflow: hidden;
  font-size: 17px; line-height: 1.4; font-weight: 470; white-space: pre-wrap; word-wrap: break-word;
  background: var(--card);
}
.note-body.empty { color: var(--ink-2); font-style: normal; }

.caption {
  position: absolute; left: 0; right: 0; top: 100%;
  padding: 8px 10px 9px; background: var(--card);
  font-size: 13.5px; line-height: 1.35; color: var(--graphite);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  border-top: 1px solid #EEEFEB;
  pointer-events: none;
}

.badges {
  position: absolute; left: 8px; bottom: 8px; display: flex; gap: 4px; pointer-events: none;
}
.vote-chip {
  height: 22px; padding: 0 7px 0 5px; border-radius: 11px;
  display: flex; align-items: center; gap: 4px;
  background: var(--who); color: #fff; font-size: 11.5px; font-weight: 650;
  box-shadow: 0 0 0 1.5px rgba(255,255,255,.9);
}
.vote-chip svg { width: 12px; height: 12px; }
.note .badges { bottom: 8px; }

.chosen-tag {
  position: absolute; right: 8px; top: 8px;
  height: 24px; padding: 0 9px 0 7px; border-radius: 4px;
  display: flex; align-items: center; gap: 5px;
  background: var(--graphite); color: #fff; font-size: 12px; font-weight: 650;
  pointer-events: none;
}
.chosen-tag svg { width: 12px; height: 12px; }

.handle {
  position: absolute; right: -9px; bottom: -9px; width: 18px; height: 18px;
  background: var(--card); border: 2px solid var(--graphite); border-radius: 3px;
  cursor: nwse-resize; display: none; touch-action: none;
}
.item.selected .handle { display: block; }
.item.photo.has-caption .handle { bottom: -9px; }

.empty {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%);
  width: min(420px, calc(100% - 48px)); text-align: center; pointer-events: none;
}
.empty-title { margin: 0 0 6px; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.empty-text { margin: 0; color: var(--ink-2); }

.drop-hint {
  position: absolute; inset: 12px; border: 2px dashed var(--graphite); border-radius: var(--r-md);
  display: grid; place-items: center; font-weight: 620; font-size: 17px;
  background: rgba(247, 247, 244, .7); pointer-events: none;
}

/* ---------- Onderbalk en zoom ---------- */
.dock {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 20;
  display: flex; gap: 8px; padding: 6px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-float);
}
.dock-btn { height: 44px; }

.zoom {
  position: absolute; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 20;
  display: flex; align-items: center;
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-float); overflow: hidden;
}
.zoom-btn, .zoom-level { height: 40px; border: 0; background: transparent; display: grid; place-items: center; }
.zoom-btn { width: 40px; }
.zoom-btn svg { width: 16px; height: 16px; }
.zoom-level { min-width: 52px; font-size: 13px; font-weight: 560; font-variant-numeric: tabular-nums; }
.zoom-btn:hover, .zoom-level:hover { background: var(--stone); }
.zoom-btn + .zoom-btn, .zoom-level + .zoom-btn, #zoom-fit { border-left: 1px solid var(--line); }

/* ---------- Paneel ---------- */
.panel {
  position: absolute; z-index: 25;
  top: calc(var(--top-h) + env(safe-area-inset-top) + 12px); right: 12px;
  width: 320px; max-height: calc(100% - var(--top-h) - 100px); overflow: auto;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-float);
  padding: 14px 16px 12px;
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.panel-by { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); padding-top: 4px; }
.panel-by strong { color: var(--graphite); font-weight: 650; }
.panel-by .dot { width: 12px; height: 12px; border-radius: 2px; background: var(--who); flex: none; }
.icon-btn { width: 34px; height: 34px; border: 0; border-radius: var(--r-sm); background: transparent; display: grid; place-items: center; flex: none; }
.icon-btn:hover { background: var(--stone); }
.icon-btn svg { width: 16px; height: 16px; }

.panel-section { padding: 12px 0; border-top: 1px solid var(--line); }
.panel-section:first-of-type { border-top: 0; }
.panel-h { display: block; margin: 0 0 10px; font-size: 14px; font-weight: 650; }

.vote-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.vote-btn {
  height: 44px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--card);
  display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 580; font-size: 14px;
}
.vote-btn svg { width: 15px; height: 15px; }
.vote-btn:hover { border-color: var(--graphite); }
.vote-btn[aria-pressed="true"] { background: var(--who); border-color: var(--who); color: #fff; }
.vote-others { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; font-size: 14px; color: var(--ink-2); }
.vote-others li { display: flex; align-items: center; gap: 8px; }
.vote-others .dot { width: 10px; height: 10px; border-radius: 2px; background: var(--who); }
.vote-others strong { color: var(--graphite); font-weight: 600; }

.chosen-btn {
  width: 100%; height: 46px; border-radius: var(--r-sm);
  border: 1px solid var(--graphite); background: var(--card);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 620; font-size: 15px;
}
.chosen-btn svg { width: 16px; height: 16px; }
.chosen-btn[aria-pressed="true"] { background: var(--graphite); color: #fff; }
.chosen-sub { margin: 8px 0 0; font-size: 13px; color: var(--ink-2); text-align: center; }

.panel-actions { display: grid; gap: 4px; }
.move { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--ink-2); }
.move .filter-select { max-width: 180px; flex: 1; }
.move-label { white-space: nowrap; }

.toast {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 50;
  max-width: calc(100% - 32px);
  padding: 10px 14px; border-radius: 8px;
  background: var(--graphite); color: #fff; font-size: 14px; font-weight: 520;
  box-shadow: var(--shadow-float);
}

/* ---------- Mobiel ---------- */
@media (max-width: 720px) {
  .legend, .board-count { display: none; }
  .board-name { font-size: 19px; max-width: 44vw; }
  .filter-select { max-width: 120px; }
  .dock { left: 12px; transform: none; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .dock-btn span { font-size: 14px; }
  .dock-btn { padding: 0 12px; }
  .zoom { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .zoom-level, #zoom-out, #zoom-in { display: none; }
  #zoom-fit { border-left: 0; width: 46px; height: 46px; }
  .panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto;
    max-height: 64vh; border-radius: 14px 14px 0 0; border-bottom: 0;
    padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  }
  .panel::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 0 auto 8px; }
  .toast { bottom: auto; top: calc(var(--top-h) + env(safe-area-inset-top) + 10px); }
}
@media (max-width: 380px) {
  .dock-btn svg { display: none; }
}

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