:root {
  --bg: #ffffff;
  --panel: #f6f7f9;
  --fg: #16181d;
  --muted: #6b7280;
  --line: #e3e5ea;
  --accent: #ff6c00;
  --accent-fg: #ffffff;
  --danger: #c0392b;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15161a;
    --panel: #1d1f24;
    --fg: #edeef2;
    --muted: #9aa0ac;
    --line: #2c2f36;
    --danger: #ff7a6b;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Kop -------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.logo {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--accent);
  box-shadow: inset 0 0 0 3.5px var(--bg), 0 0 0 1px var(--accent);
}

h1 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }

.views { display: flex; gap: 4px; margin-left: 12px; }

.view {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.view.is-active { background: var(--panel); color: var(--fg); }

.pill {
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

/* Indeling --------------------------------------------------------- */

.layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  padding: 20px 22px 60px;
}

.layout[hidden] { display: none; }

@media (max-width: 820px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}

.sidebar {
  position: sticky;
  top: 66px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(100vh - 86px);
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

@media (max-width: 820px) {
  .sidebar { position: static; max-height: none; }
}

/* Velden ----------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 7px; }

.label { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }

input[type="text"], input[type="search"], input[type="number"], select {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Categoriezoeker -------------------------------------------------- */

.combo { position: relative; }

.combo input { padding-right: 28px; }

.combo-clear {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.combo-clear:hover { background: var(--line); color: var(--fg); }
.combo-clear[hidden] { display: none; }

.combo-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 290px;
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}

.combo-list[hidden] { display: none; }

.combo-option {
  padding: 7px 9px;
  border-radius: 7px;
  font-size: 13px;
  line-height: 1.35;
  cursor: pointer;
}

.combo-option:hover,
.combo-option.is-active { background: var(--panel); }

.combo-option .parent { display: block; color: var(--muted); font-size: 11.5px; }
.combo-option .self { font-weight: 600; }
.combo-option mark { background: rgba(255, 108, 0, 0.28); color: inherit; border-radius: 3px; }

.combo-empty { padding: 9px; color: var(--muted); font-size: 13px; }

.km { display: flex; align-items: center; gap: 6px; }
.km input { text-align: right; }
.km span { color: var(--muted); font-size: 13px; }

.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.check input { margin-top: 2px; accent-color: var(--accent); }

.hint { margin: 0; color: var(--muted); font-size: 12px; }

/* Knoppen ---------------------------------------------------------- */

button.primary, button.ghost {
  padding: 8px 15px;
  border-radius: 8px;
  font: inherit;
  font-weight: 620;
  cursor: pointer;
}

button.primary { border: 0; background: var(--accent); color: var(--accent-fg); }
button.ghost { border: 1px solid var(--line); background: var(--bg); color: var(--fg); }
button.block { width: 100%; }
button:disabled { opacity: 0.5; cursor: default; }

/* Facetten --------------------------------------------------------- */

.facets { display: flex; flex-direction: column; gap: 16px; }

.facet-title { margin-bottom: 6px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }

.facet-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  font-size: 13px;
  cursor: pointer;
}

.facet-option input { accent-color: var(--accent); }
.facet-option .count { margin-left: auto; color: var(--muted); font-size: 12px; }

/* Resultaten ------------------------------------------------------- */

.results { min-width: 0; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.summary { color: var(--muted); }
.summary strong { color: var(--fg); }

.pager { display: flex; align-items: center; gap: 10px; }
.pageinfo { color: var(--muted); font-size: 13px; white-space: nowrap; }

.notice {
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 108, 0, 0.35);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: rgba(255, 108, 0, 0.07);
}

.notice[hidden] { display: none; }
.notice b { display: block; margin-bottom: 3px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12); }

.card .thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--panel);
}

.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.card .tags {
  position: absolute;
  top: 7px;
  left: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.66);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}

.tag.sponsored { background: var(--accent); }
.tag.trader { background: #2d6cdf; }

.card .body { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 12px; }
.card .title { font-weight: 620; line-height: 1.35; }
.card .price { font-weight: 700; }
.card .meta { color: var(--muted); font-size: 12.5px; }

/* Gevolgde zoekopdrachten ------------------------------------------ */

.watches { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }

.watch { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.watch:last-child { border-bottom: 0; }
.watch .name { font-weight: 620; font-size: 13px; word-break: break-word; }
.watch .sub { color: var(--muted); font-size: 12px; }
.watch .sub.error { color: var(--danger); }
.watch .row { display: flex; gap: 10px; margin-top: 5px; }

.linkbtn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}

.linkbtn:hover { color: var(--fg); }
.linkbtn.danger:hover { color: var(--danger); }

.unread-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* Staande foto's mogen de kaart niet oprekken. */
.card .thumb img { position: absolute; inset: 0; }

/* Web-app: inloggen ------------------------------------------------- */

[hidden] { display: none !important; }

.login {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 16px;
}

.login-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 360px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.login-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.logo-big { width: 40px; height: 40px; border-radius: 10px; }
.login-card .primary { margin-top: 10px; }
.error-text { margin: 4px 0 0; color: var(--danger); font-size: 13px; }

input[type="password"], textarea {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}

textarea { resize: vertical; }

/* Web-app: kop ------------------------------------------------------ */

.topbar { padding-top: calc(12px + env(safe-area-inset-top)); }
.logo { box-shadow: none; background: none; }

@media (max-width: 820px) {
  .topbar { padding-left: 16px; padding-right: 16px; gap: 10px; }
  .topbar h1 { display: none; }
  .views { margin-left: 0; flex: 1; justify-content: space-between; }
  .view { padding: 6px 10px; }
  .layout { padding: 16px 16px 60px; }
  .toolbar { flex-wrap: wrap; }
}

/* Web-app: filters inklappen op de telefoon ------------------------- */

.mobile-only { display: none; }

@media (max-width: 820px) {
  .mobile-only { display: block; margin-bottom: 12px; }
  #toggle-watches { margin-bottom: 0; }
  .sidebar.is-collapsed { display: none; }
}

/* Web-app: gevolgde zoekopdrachten ---------------------------------- */

.watch { display: flex; flex-direction: column; gap: 5px; }
.watch.is-off .watch-name { color: var(--muted); }
.watch .sub { word-break: break-word; }
.watch .row { flex-wrap: wrap; row-gap: 3px; }

.watch-head { display: flex; align-items: center; gap: 7px; }
.watch-head input[type="checkbox"] { flex: none; margin: 0; accent-color: var(--accent); }

input[type="text"].watch-name {
  flex: 1;
  min-width: 0;
  padding: 2px 5px;
  margin-left: -5px;
  border-color: transparent;
  background: transparent;
  font-weight: 620;
}

input[type="text"].watch-name:hover,
input[type="text"].watch-name:focus { border-color: var(--line); background: var(--bg); }

.interval { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.interval select { width: auto; padding: 3px 6px; }
.watch .check input { margin-top: 3px; }
.notice.compact { margin-bottom: 4px; padding: 9px 11px; font-size: 13px; }
.notice-actions { margin-top: 10px; }
.card .origin { color: var(--accent); }
.tag.reserved { background: #6b7280; }
.tag.ai-yes { background: #1f8a4c; }
.tag.ai-no { background: #9b2c2c; }
.tag.ai-unknown { background: #6b7280; }
.card .ai-reason { color: var(--fg); font-style: italic; }
.ai-question { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.ai-question input { padding: 4px 7px; font-size: 13px; }
.toolbar .check { align-items: center; white-space: nowrap; }
.card.is-reserved .thumb img { opacity: 0.55; }
.card.is-reserved .price { color: var(--muted); }

/* Web-app: instellingen --------------------------------------------- */

.settings {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.panel h2 { margin: 0; font-size: 15px; font-weight: 650; }
.panel a { color: var(--accent); }
.panel > .ghost { align-self: flex-start; }

.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 7px; }

.plain-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.plain-list:empty { display: none; }
.plain-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 13px; }
.plain-list .sub { color: var(--muted); font-size: 12px; }
.plain-list .sub.error { color: var(--danger); }

.snippet {
  margin: 0;
  padding: 9px 11px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-size: 12px;
}

code { font-size: 12px; }
