/* ============ Roberts Supplementen ============ */
:root {
  --bg: #f4f5f0;
  --surface: #ffffff;
  --surface2: #f8f9f5;
  --text: #1c2420;
  --text-dim: #5c6a62;
  --border: #e1e5dc;
  --accent: #1c7a4d;
  --accent-soft: #e3f2e9;
  --accent-text: #ffffff;
  --amber: #b7791f;
  --amber-soft: #fdf3e0;
  --red: #c0392b;
  --red-soft: #fdeceb;
  --blue: #2563a8;
  --blue-soft: #e7f0fa;
  --shadow: 0 1px 3px rgba(20, 30, 24, .08), 0 4px 14px rgba(20, 30, 24, .06);
  --shadow-lg: 0 8px 40px rgba(20, 30, 24, .18);
  --radius: 14px;
}
:root[data-theme="dark"] {
  --bg: #121814;
  --surface: #1b231e;
  --surface2: #202a24;
  --text: #e6ebe7;
  --text-dim: #96a49b;
  --border: #2c3830;
  --accent: #3dae76;
  --accent-soft: #1e3529;
  --accent-text: #0c1510;
  --amber: #ddab54;
  --amber-soft: #35290f;
  --red: #e07466;
  --red-soft: #3a1c17;
  --blue: #6aa4dd;
  --blue-soft: #16283c;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.45;
}
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); }

/* ============ LOGIN ============ */
.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: radial-gradient(1200px 800px at 70% -10%, var(--accent-soft), transparent), var(--bg);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 40px 32px;
  width: 100%; max-width: 380px;
  text-align: center;
}
.login-icon { font-size: 44px; margin-bottom: 10px; }
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-sub { color: var(--text-dim); font-size: 14px; margin-bottom: 24px; }
.login-card input {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--surface2); font-size: 16px;
  margin-bottom: 12px; outline: none;
}
.login-card input:focus { border-color: var(--accent); }
.login-card button {
  width: 100%; padding: 12px;
  background: var(--accent); color: var(--accent-text);
  border: none; border-radius: 10px; font-weight: 600; font-size: 15px;
}
.login-card button:disabled { opacity: .6; }
.login-error { color: var(--red); font-size: 13px; margin-top: 10px; }
.login-card-minimal { padding: 22px; }
.login-card-minimal input { margin-bottom: 0; }

/* ============ TOPBAR ============ */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; gap: 10px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; white-space: nowrap; }
.brand-icon { font-size: 20px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: none; border-radius: 10px;
  padding: 9px 14px; font-size: 14px; font-weight: 600;
}
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--text-dim); padding: 9px; }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

.copy-group { position: relative; display: flex; }
.copy-group .btn-primary { border-radius: 10px 0 0 10px; }
.btn-caret { border-radius: 0 10px 10px 0 !important; border-left: 1px solid rgba(255,255,255,.25) !important; padding: 9px 10px; }
:root[data-theme="dark"] .btn-caret { border-left-color: rgba(0,0,0,.2) !important; }
.copy-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  overflow: hidden; min-width: 240px;
}
.copy-menu button {
  display: block; width: 100%; text-align: left;
  background: none; border: none; padding: 11px 14px; font-size: 14px; color: var(--text);
}
.copy-menu button:hover { background: var(--surface2); }

/* ============ SUMMARY STRIP ============ */
.summary-strip {
  max-width: 1180px; margin: 14px auto 0;
  padding: 0 16px;
  display: flex; gap: 8px; flex-wrap: wrap;
}
.sum-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 13px;
  font-size: 13px; font-weight: 600; color: var(--text-dim);
  cursor: pointer; transition: all .15s;
}
.sum-chip:hover { border-color: var(--accent); color: var(--text); }
.sum-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.sum-chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.sum-chip strong { color: var(--text); }
.sum-chip.cost { cursor: default; }
.sum-chip.cost:hover { border-color: var(--border); color: var(--text-dim); }

/* ============ CONTROLS ============ */
.controls { max-width: 1180px; margin: 12px auto 0; padding: 0 16px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: none; background: transparent; color: var(--text-dim);
  padding: 8px 13px; border-radius: 9px; font-size: 14px; font-weight: 600;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--text); color: var(--bg); }
.controls-row2 { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.search-wrap {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 0 12px; color: var(--text-dim);
}
.search-wrap input {
  flex: 1; border: none; background: none; outline: none;
  padding: 9px 0; font-size: 14px; min-width: 40px;
}
#sort-select {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 8px; font-size: 13px; outline: none; max-width: 150px;
}
.timing-sort {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px; font-size: 13px;
  color: var(--text-dim); white-space: nowrap;
}
.timing-sort:hover { color: var(--text); }
.timing-sort.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.view-toggle { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.view-toggle button {
  border: none; background: none; padding: 8px 12px; font-size: 15px; color: var(--text-dim);
}
.view-toggle button.active { background: var(--text); color: var(--bg); }

/* ============ CARDS GRID ============ */
.content { max-width: 1180px; margin: 16px auto 90px; padding: 0 16px; }
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .12s, box-shadow .12s;
  cursor: pointer; position: relative;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card.dimmed { opacity: .62; filter: saturate(.35); }
.card-photo {
  height: 150px; background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.card-photo img { width: 100%; height: 100%; object-fit: cover; }
.card-photo .no-photo { font-size: 40px; opacity: .3; }
.card-badges { position: absolute; top: 8px; left: 8px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.badge {
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  backdrop-filter: blur(4px);
}
.badge.flag { background: var(--amber-soft); color: var(--amber); }
.badge.dup { background: var(--amber-soft); color: var(--amber); }
.badge.timing { background: var(--blue-soft); color: var(--blue); }
.badge.food { background: var(--accent-soft); color: var(--accent); }
.card-body { padding: 12px 14px 10px; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.card-title { font-size: 15.5px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.card-title .note-ind { font-size: 12px; opacity: .55; }
.card-brand { font-size: 12.5px; color: var(--text-dim); }
.card-dose { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.card-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.price-tag { font-size: 13px; font-weight: 700; color: var(--accent); }
.order-link {
  margin-left: auto; font-size: 12px; font-weight: 600;
  color: var(--blue); text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 8px; border-radius: 7px; background: var(--blue-soft);
}
.order-link:hover { filter: brightness(1.05); text-decoration: underline; }
.order-link.broken { background: var(--amber-soft); color: var(--amber); }
.card-status {
  display: flex; border-top: 1px solid var(--border);
}
.card-status button {
  flex: 1; border: none; background: none; padding: 8px 2px;
  font-size: 11.5px; font-weight: 700; color: var(--text-dim);
  border-right: 1px solid var(--border);
}
.card-status button:last-child { border-right: none; }
.card-status button:hover { background: var(--surface2); }
.card-status button.on.st-active { background: var(--accent-soft); color: var(--accent); }
.card-status button.on.st-paused { background: var(--amber-soft); color: var(--amber); }
.card-status button.on.st-stopped { background: var(--red-soft); color: var(--red); }
.card-status button.on.st-wishlist { background: var(--blue-soft); color: var(--blue); }
.promote-btn {
  border: none; width: 100%; padding: 9px;
  background: var(--accent-soft); color: var(--accent);
  font-weight: 700; font-size: 13px; border-top: 1px solid var(--border);
}

.empty-state {
  text-align: center; color: var(--text-dim); padding: 60px 20px;
  font-size: 15px;
}
.empty-state .big { font-size: 44px; margin-bottom: 10px; opacity: .5; }

/* ============ LIST VIEW ============ */
.list { display: flex; flex-direction: column; gap: 8px; }
.list-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px 12px; cursor: pointer;
  transition: box-shadow .12s;
}
.list-row:hover { box-shadow: var(--shadow-lg); }
.list-row.dimmed { opacity: .62; filter: saturate(.35); }
.list-thumb {
  width: 54px; height: 54px; border-radius: 11px;
  background: var(--surface2); flex-shrink: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.list-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.list-badges { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.list-sub { font-size: 12.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-sub.dim b { font-weight: 700; }
.list-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.list-status { border-top: none; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.list-status button { padding: 7px 10px; }
.promote-btn.list-promote { width: auto; border-top: none; border-radius: 9px; padding: 8px 13px; }
@media (max-width: 640px) {
  .list-row { flex-wrap: wrap; }
  .list-main { min-width: 60%; }
  .list-right { width: 100%; justify-content: flex-end; }
}

/* ============ SCHEDULE VIEW ============ */
.schedule { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.sched-col {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.sched-head {
  padding: 12px 14px; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border-bottom: 1px solid var(--border);
}
.sched-head .cnt { margin-left: auto; color: var(--text-dim); font-weight: 600; font-size: 12.5px; }
.sched-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.sched-item:last-child { border-bottom: none; }
.sched-item:hover { background: var(--surface2); }
.sched-thumb {
  width: 38px; height: 38px; border-radius: 9px; object-fit: cover;
  background: var(--surface2); flex-shrink: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.sched-thumb img, .prod-thumb img {
  width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block;
}
.sched-info { min-width: 0; }
.sched-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sched-dose { font-size: 12px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sched-item .badge { margin-left: auto; flex-shrink: 0; }
.sched-empty { padding: 18px 14px; color: var(--text-dim); font-size: 13px; text-align: center; }

/* ============ FAB ============ */
.fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 30;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: var(--accent-text);
  border: none; font-size: 28px; font-weight: 400;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: center;
}
.fab:hover { filter: brightness(1.08); }

/* ============ MODAL ============ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 16, 12, .55);
  display: flex; align-items: flex-end; justify-content: center;
  overflow-y: auto; padding: 0;
}
.modal {
  background: var(--surface); width: 100%; max-width: 640px;
  border-radius: 20px 20px 0 0;
  max-height: 92vh; overflow-y: auto;
  padding: 20px 20px 30px;
  animation: slideUp .18s ease-out;
}
@media (min-width: 700px) {
  .modal-backdrop { align-items: center; padding: 30px; }
  .modal { border-radius: 20px; max-height: 86vh; }
}
@keyframes slideUp { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }

.modal h2 { font-size: 19px; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.modal h3 { font-size: 14px; margin: 20px 0 8px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.modal-close {
  float: right; border: none; background: var(--surface2);
  border-radius: 50%; width: 32px; height: 32px; font-size: 16px; color: var(--text-dim);
}
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin-bottom: 4px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: 9px;
  background: var(--surface2); outline: none; font-size: 14.5px;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 64px; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1.5px solid var(--border); background: var(--surface2);
  border-radius: 999px; padding: 6px 13px; font-size: 13px; font-weight: 600;
  color: var(--text-dim);
}
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip.on.warn { background: var(--amber-soft); border-color: var(--amber); color: var(--amber); }
.chip.on.danger { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.chip.on.info { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }

.prod-card {
  border: 1.5px solid var(--border); border-radius: 12px;
  padding: 12px; margin-bottom: 10px; background: var(--surface2);
}
.prod-card.enabled { border-color: var(--accent); }
.prod-head { display: flex; align-items: flex-start; gap: 10px; }
.prod-thumb {
  width: 52px; height: 52px; border-radius: 10px; object-fit: cover;
  background: var(--surface); flex-shrink: 0; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  overflow: hidden;
}
.prod-title { font-weight: 700; font-size: 14px; }
.prod-sub { font-size: 12.5px; color: var(--text-dim); }
.prod-head .switch-wrap { margin-left: auto; }
.prod-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.prod-actions .mini {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 8px; padding: 5px 10px; font-size: 12.5px; font-weight: 600; color: var(--text-dim);
}
.prod-actions .mini:hover { color: var(--text); border-color: var(--text-dim); }
.prod-actions .mini.danger { color: var(--red); }

.switch {
  position: relative; width: 42px; height: 24px;
  background: var(--border); border-radius: 999px; border: none;
  transition: background .15s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; background: #fff; border-radius: 50%;
  transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch.on { background: var(--accent); }
.switch.on::after { left: 21px; }

.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn { flex: 1; justify-content: center; padding: 12px; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1.5px solid var(--border); }
.btn-danger-ghost { background: none; color: var(--red); border: 1.5px solid var(--red-soft); }
.btn-danger-ghost:hover { background: var(--red-soft); }

.dup-warning {
  background: var(--amber-soft); color: var(--amber);
  border-radius: 10px; padding: 9px 13px; font-size: 13px; font-weight: 600;
  margin-bottom: 12px;
}

/* settings */
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--border);
  font-size: 14.5px;
}
.seg { display: flex; background: var(--surface2); border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.seg button { border: none; background: none; padding: 7px 12px; font-size: 13px; font-weight: 600; color: var(--text-dim); }
.seg button.on { background: var(--text); color: var(--bg); }

.bryan-list { font-size: 13.5px; }
.bryan-group { font-weight: 700; margin: 14px 0 6px; color: var(--accent); }
.bryan-item { padding: 3px 0; color: var(--text-dim); display: flex; gap: 6px; }
.bryan-item .have { color: var(--accent); font-weight: 700; }

.log-item { font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--border); color: var(--text-dim); }
.log-item b { color: var(--text); }

/* ============ TOAST ============ */
.toast-wrap {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
  width: max-content; max-width: calc(100vw - 32px);
}
.toast {
  background: var(--text); color: var(--bg);
  border-radius: 12px; padding: 11px 16px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 14px;
  animation: slideUp .18s ease-out;
}
.toast button {
  border: none; background: none; color: inherit;
  font-weight: 800; font-size: 14px; text-decoration: underline;
}

/* mobiel */
@media (max-width: 560px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .card-photo { height: 110px; }
  .card-body { padding: 10px 11px 8px; }
  .card-title { font-size: 14px; }
  .copy-label { display: none; }
  .brand-name { font-size: 14px; }
  .order-link .store-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
  .controls-row2 { flex-wrap: wrap; }
  .search-wrap { min-width: 100%; order: -1; }
}
