:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #1c2030;
  --muted: #6b7286;
  --border: #e4e7ef;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef0ff;
  --success: #0f9d6b;
  --success-soft: #e6f7f0;
  --danger: #dc3545;
  --danger-soft: #fdecee;
  --warning: #b7791f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 24, 40, .05), 0 4px 16px rgba(20, 24, 40, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }

.container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 16px; }
main.container { padding-top: 24px; padding-bottom: 48px; }

/* Navbar */
.navbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.navbar .container { display: flex; align-items: center; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 1.15rem; color: var(--text); display: flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.brand-dot { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--primary), #8b5cf6); display: inline-block; }
.nav-toggle { margin-left: auto; background: none; border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; font-size: 1.1rem; cursor: pointer; }
.nav-links { display: none; width: 100%; flex-direction: column; gap: 4px; padding-bottom: 12px; }
.nav-links.open { display: flex; }
.nav-links a, .nav-links button.link { color: var(--text); padding: 8px 10px; border-radius: 8px; font-weight: 500; }
.nav-links a:hover, .nav-links button.link:hover { background: var(--primary-soft); text-decoration: none; }
.nav-links form { margin: 0; }
button.link { background: none; border: 0; font: inherit; cursor: pointer; text-align: left; width: 100%; }
.nav-search { display: flex; gap: 6px; width: 100%; order: 3; padding-bottom: 12px; }
.nav-search input { flex: 1; }

@media (min-width: 860px) {
  .nav-toggle { display: none; }
  .nav-search { order: 0; width: auto; flex: 1; max-width: 380px; padding: 0; margin-left: 16px; }
  .nav-links { display: flex !important; flex-direction: row; width: auto; margin-left: auto; padding: 0; align-items: center; }
  button.link { width: auto; }
}

/* Forms & buttons */
input, select, textarea {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.hint { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.error { color: var(--danger); font-size: .85rem; margin-top: 4px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.checkbox input { width: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
  background: var(--primary); color: #fff; transition: background .15s;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn-outline { background: #fff; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #fbd5da; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #0b855a; }
.btn-sm { padding: 6px 10px; font-size: .85rem; }
.btn-block { width: 100%; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 20px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }

.product-card { display: flex; flex-direction: column; overflow: hidden; }
.product-card .thumb { aspect-ratio: 4 / 3; background: #f0f2f7; display: flex; align-items: center; justify-content: center; }
.product-card .thumb img { width: 100%; height: 100%; object-fit: contain; padding: 12px; }
.product-card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-card .title { font-weight: 700; color: var(--text); }
.product-card .actions { margin-top: auto; padding-top: 8px; display: flex; gap: 8px; }
.product-card .actions > * { flex: 1; }
.product-card .actions form { display: flex; }
.product-card .actions form .btn { flex: 1; }
.placeholder { color: var(--muted); font-size: 2.2rem; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--primary-soft); color: var(--primary); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: #fdf3e1; color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

.price { font-size: 1.2rem; font-weight: 800; }
.price-from { color: var(--muted); font-size: .85rem; }
.muted { color: var(--muted); }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 20px; font-weight: 500; }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-danger { background: var(--danger-soft); color: var(--danger); }

/* Page header */
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 20px; }

/* Filters */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: #fff; color: var(--text); font-size: .88rem; font-weight: 500; }
.chip.active, .chip:hover { background: var(--primary); color: #fff; border-color: var(--primary); text-decoration: none; }

/* Product detail */
.product-detail { display: grid; gap: 24px; }
.product-detail .image { background: #fff; border-radius: var(--radius); border: 1px solid var(--border); aspect-ratio: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.product-detail .image img { width: 100%; height: 100%; object-fit: contain; padding: 20px; }
@media (min-width: 860px) { .product-detail { grid-template-columns: 380px 1fr; } }

.offer-list { display: flex; flex-direction: column; gap: 10px; }
.offer { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; align-items: center; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.offer.cheapest { border: 2px solid var(--success); background: var(--success-soft); }
.offer.unavailable { opacity: .55; }
.offer .store { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.offer .store img { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: #fff; border: 1px solid var(--border); padding: 3px; }
.offer .meta { font-size: .85rem; color: var(--muted); }
.offer .total { text-align: right; }
.offer .cta { grid-column: 1 / -1; }
@media (min-width: 640px) {
  .offer { grid-template-columns: 1fr auto auto; }
  .offer .cta { grid-column: auto; }
}

/* Stats */
.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 24px; }
.stat .label { color: var(--muted); font-size: .85rem; font-weight: 600; }
.stat .value { font-size: 1.8rem; font-weight: 800; }

/* Wishlist rows */
.wish-row { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.wish-row:last-child { border-bottom: 0; }
.wish-row img, .wish-row .ph { width: 64px; height: 64px; object-fit: contain; border-radius: 10px; background: #f0f2f7; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.wish-row .info { flex: 1; min-width: 160px; }
.wish-row .price-col { text-align: right; min-width: 120px; }
.wish-row form { margin: 0; }

/* Tables (admin) */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafbfd; }
td.actions { white-space: nowrap; text-align: right; }
td.actions form { display: inline; }
.admin-tabs { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }

.auth-box { max-width: 420px; margin: 24px auto; }
.form-box { max-width: 680px; }
.row-2 { display: grid; gap: 0 16px; }
@media (min-width: 640px) { .row-2 { grid-template-columns: 1fr 1fr; } }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.pagination-wrap { margin-top: 24px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pager span[aria-disabled] { opacity: .45; cursor: default; }
/* Meerdere lijsten */
.list-grid { margin-bottom: 8px; }
.list-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; color: var(--text); transition: transform .15s, box-shadow .15s; }
.list-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 24px rgba(20, 24, 40, .1); }
.list-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.list-desc { margin: 0; font-size: .88rem; }
.list-thumbs { display: flex; gap: 6px; min-height: 52px; align-items: center; }
.list-thumbs img, .list-thumbs .ph { width: 52px; height: 52px; object-fit: contain; border-radius: 10px; background: #f0f2f7; display: flex; align-items: center; justify-content: center; padding: 4px; }
.list-card-foot { display: flex; justify-content: space-between; align-items: baseline; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.list-card-new { align-items: center; justify-content: center; text-align: center; border-style: dashed; box-shadow: none; min-height: 190px; color: var(--primary); }
.share-box { margin-bottom: 24px; }
.share-link { display: flex; gap: 8px; margin-top: 14px; }
.share-link input { font-size: .9rem; background: var(--bg); }
.shared-hero { margin-bottom: 24px; background: linear-gradient(135deg, var(--primary-soft), #fff); }
.list-toggles { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.list-toggles form { margin: 0; }
button.chip { cursor: pointer; font: inherit; font-size: .88rem; }
.add-form { display: flex; gap: 6px; margin-top: 6px; }
.add-form select { flex: 1; min-width: 0; padding: 6px 8px; font-size: .85rem; }
.add-form .btn { flex-shrink: 0; }
.add-form:not(:has(select)) .btn { flex: 1; }

/* Gekocht afvinken */
.wish-row.is-bought img, .wish-row.is-bought .ph { opacity: .45; }
.wish-row.is-bought .info > a { text-decoration: line-through; color: var(--muted) !important; }
.buy-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; justify-content: flex-end; }
.buy-details summary { list-style: none; }
.buy-details summary::-webkit-details-marker { display: none; }
.buy-details[open] summary { display: none; }
.buy-form { display: flex; gap: 6px; }
.buy-form input { padding: 6px 10px; font-size: .88rem; min-width: 0; width: 170px; }
@media (max-width: 639px) {
  .buy-actions { width: 100%; justify-content: stretch; }
  .buy-actions > *, .buy-details, .buy-form { flex: 1; }
  .buy-details summary { width: 100%; }
  .buy-form input { width: auto; flex: 1; }
}

.custom-preview { max-height: 140px; max-width: 220px; object-fit: contain; border-radius: 10px; border: 1px solid var(--border); background: #fff; padding: 6px; margin-bottom: 16px; }
.btn:disabled { opacity: .6; cursor: wait; }

/* Feed (home) */
.feed-filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.feed-filters::-webkit-scrollbar { display: none; }
.feed-filters .chip { flex-shrink: 0; }
.feed { display: grid; gap: 22px 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px) { .feed { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 960px) { .feed { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 26px 18px; } }
@media (min-width: 1180px) { .feed { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.feed-card { min-width: 0; }
.feed-media { position: relative; border-radius: 18px; overflow: visible; }
.feed-img { display: flex; align-items: center; justify-content: center; aspect-ratio: 3 / 4; background: #ececee; border-radius: 18px; overflow: hidden; }
.feed-img img { width: 100%; height: 100%; object-fit: contain; padding: 14%; mix-blend-mode: multiply; transition: transform .3s ease; }
.feed-card:hover .feed-img img { transform: scale(1.04); }

.feed-pill { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; align-items: center; gap: 7px; font-size: .78rem; font-weight: 600; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.35); pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-pill img, .feed-pill-dot { width: 26px; height: 26px; border-radius: 50%; background: #fff; object-fit: contain; padding: 2px; flex-shrink: 0; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.feed-pill-dot { display: inline-flex; align-items: center; justify-content: center; color: var(--text); text-shadow: none; font-size: .75rem; }

.feed-add { position: absolute; right: 10px; bottom: 10px; margin: 0; }
.feed-plus { width: 38px; height: 38px; border-radius: 50%; border: 0; background: #fff; color: var(--text); font-size: 1.35rem; line-height: 1; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.15); transition: transform .15s, background .15s; list-style: none; }
.feed-plus::-webkit-details-marker { display: none; }
.feed-plus:hover { transform: scale(1.08); text-decoration: none; }
.feed-plus.is-on { background: var(--primary); color: #fff; font-size: 1rem; }
.feed-menu { position: absolute; right: 0; bottom: 46px; min-width: 190px; background: #fff; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.18); padding: 6px; z-index: 5; }
.feed-menu-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 6px 10px 4px; }
.feed-menu form { margin: 0; }
.feed-menu button { width: 100%; text-align: left; background: none; border: 0; font: inherit; font-size: .9rem; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--text); }
.feed-menu button:hover { background: var(--primary-soft); }

.feed-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 10px 4px 0; color: var(--text); font-weight: 500; font-size: .95rem; line-height: 1.3; min-height: 2.6em; }
.feed-title:hover { text-decoration: none; color: var(--primary); }
.feed-price { margin: 6px 4px 0; color: var(--muted); font-size: .9rem; }
.feed-sentinel { grid-column: 1 / -1; height: 1px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--text); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: .9rem; opacity: 0; transition: .25s; z-index: 50; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.feed-loading { text-align: center; color: var(--muted); padding: 24px; }

.price-chart { margin-bottom: 24px; }
.price-chart svg { width: 100%; height: 140px; margin-top: 12px; display: block; overflow: visible; }
.price-chart-legend { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: .85rem; color: var(--muted); flex-wrap: wrap; }
.price-chart-legend strong { color: var(--text); }

.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 24px 16px 40px; }
