:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e3e7ec;
  --text: #1c2733;
  --muted: #667085;
  --accent: #1f3a5f;
  --accent-soft: #e8eef6;
  --warm: #b7832f;
  --warm-soft: #fbf4e6;
  --ok: #15803d;
  --ok-soft: #e8f6ec;
  --warn: #b45309;
  --warn-soft: #fef5e7;
  --bad: #b91c1c;
  --bad-soft: #fdecec;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg);
  color: var(--text); line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1.08rem; margin: 0 0 .75rem; font-weight: 640; }
h3 { font-size: .95rem; margin: 0 0 .5rem; font-weight: 640; }
small, .muted { color: var(--muted); }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: .88em; }
pre { white-space: pre-wrap; font-family: inherit; margin: 0; }

/* Layout */
.layout { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.sidebar { background: #16263b; color: #cbd5e1; padding: 18px 12px; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.05rem;
  padding: 4px 10px 18px; }
.brand .dot { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe8b0,
  #d79b3b 60%, #8a5a17); box-shadow: 0 0 14px rgba(240, 190, 90, .55); }
.nav a { display: flex; align-items: center; justify-content: space-between; color: #cbd5e1; padding: 8px 10px;
  border-radius: 8px; margin-bottom: 2px; font-size: .93rem; }
.nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(255, 255, 255, .11); color: #fff; }
.nav .section { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #7d8ca3;
  padding: 14px 10px 6px; }
.nav .count { background: #d79b3b; color: #1b1b1b; border-radius: 999px; font-size: .72rem; padding: 0 7px;
  font-weight: 700; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 24px; display: flex;
  gap: 12px; align-items: center; position: sticky; top: 0; z-index: 20; }
.topbar form.search { flex: 1; max-width: 520px; }
.topbar .search input { width: 100%; }
.topbar .spacer { flex: 1; }
.content { padding: 22px 24px 60px; max-width: 1500px; width: 100%; }
.demo-banner { background: var(--warm-soft); color: #7a5414; border-bottom: 1px solid #f0dfbd; padding: 7px 24px;
  font-size: .87rem; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; justify-content: space-between;
  margin-bottom: 18px; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.menu-toggle { display: none; }

/* Cards & grids */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.stack > * + * { margin-top: 8px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

.stat { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; color: var(--text); }
.stat:hover { text-decoration: none; border-color: #c4ccd6; }
.stat .value { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.stat .label { color: var(--muted); font-size: .86rem; }
.stat.warn .value { color: var(--warn); }
.stat.bad .value { color: var(--bad); }
.stat.ok .value { color: var(--ok); }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 9px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px;
  justify-content: space-between; align-items: flex-start; }
.list li:last-child { border-bottom: 0; }
.list .meta { font-size: .84rem; color: var(--muted); }

/* Table */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .78rem; text-transform: uppercase;
  letter-spacing: .04em; padding: 9px 10px; border-bottom: 1px solid var(--border); background: var(--surface-2);
  white-space: nowrap; }
.table th a { color: inherit; }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:hover td { background: #fafbfc; }
.table tr.attention td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.table tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.table td.num, .table th.num { text-align: right; white-space: nowrap; }
.table tfoot td { font-weight: 600; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .76rem; font-weight: 600; padding: 2px 8px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.badge.status { color: #fff; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.grey { background: #eef0f3; color: #4b5563; }
.badge.demo { background: var(--warm-soft); color: #7a5414; }
.prio-spoed { background: var(--bad-soft); color: var(--bad); }
.prio-hoog { background: var(--warn-soft); color: var(--warn); }
.prio-normaal { background: #eef0f3; color: #4b5563; }
.prio-laag { background: #f3f4f6; color: #9ca3af; }
.state-klant { background: #e8eef6; color: #1f3a5f; }
.state-onbekend { background: var(--bad-soft); color: var(--bad); }
.state-intern { background: var(--warn-soft); color: var(--warn); }
.state-bevestigd { background: var(--ok-soft); color: var(--ok); }

/* Buttons & forms */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); padding: 7px 13px; border-radius: 8px; font-size: .9rem; font-weight: 550; cursor: pointer;
  text-decoration: none; line-height: 1.2; font-family: inherit; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #18304f; }
.btn.warm { background: var(--warm); border-color: var(--warm); color: #fff; }
.btn.danger { color: var(--bad); border-color: #f2c6c6; }
.btn.small { padding: 4px 9px; font-size: .82rem; }
.btn.link { border: 0; background: none; padding: 0; color: var(--accent); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.input, select.input, textarea.input { width: 100%; border: 1px solid #cfd6df; border-radius: 8px; padding: 7px 10px;
  font: inherit; font-size: .92rem; background: #fff; color: var(--text); }
.input:focus { outline: 2px solid #b9cbe2; border-color: #8aa6c8; }
textarea.input { resize: vertical; }
label { font-size: .84rem; font-weight: 600; color: #344054; display: block; margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.field .help { font-size: .78rem; color: var(--muted); margin-top: 3px; }
.field .error, .errorlist { color: var(--bad); font-size: .82rem; margin: 3px 0 0; padding: 0; list-style: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.check { width: 16px; height: 16px; vertical-align: middle; }
.check-row { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li, ul#id_items li, ul#id_documents li, ul#id_product_types li { list-style: none; }
ul[id^="id_"] { padding-left: 0; margin: 0; }
ul[id^="id_"] label { font-weight: 500; display: flex; gap: 6px; align-items: center; }
.inline-form { display: inline; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; align-items: end; }

/* Alerts */
.messages { list-style: none; margin: 0 0 14px; padding: 0; }
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; font-size: .92rem; border: 1px solid transparent; }
.alert.success { background: var(--ok-soft); color: #14532d; border-color: #c7e9d1; }
.alert.error { background: var(--bad-soft); color: #7f1d1d; border-color: #f3caca; }
.alert.warning { background: var(--warn-soft); color: #78350f; border-color: #f4dfba; }
.alert.info { background: var(--accent-soft); color: var(--accent); border-color: #cfdcec; }
.empty { text-align: center; color: var(--muted); padding: 22px 10px; font-size: .92rem; }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 13px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap;
  font-size: .92rem; font-weight: 550; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs .count { font-size: .75rem; background: #eef0f3; color: #4b5563; border-radius: 999px; padding: 0 6px;
  margin-left: 3px; }

/* Basisblok */
.basisblok { border-left: 4px solid var(--warm); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 5px 9px;
  font-size: .86rem; }
.chip b { font-weight: 600; }
.missing { background: var(--bad-soft); border-color: #f3caca; }

/* Specs */
.spec-group { margin-bottom: 14px; }
.spec-group h3 { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.spec-row { display: grid; grid-template-columns: 190px minmax(0, 1fr) 190px; gap: 10px; align-items: center;
  padding: 6px 0; border-bottom: 1px dashed var(--border); }
.spec-row label { margin: 0; }
.spec-row .req { color: var(--bad); }
.legend { display: flex; flex-wrap: wrap; gap: 8px; font-size: .8rem; }

/* Kanban */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kanban-col { flex: 0 0 260px; background: #eceff3; border-radius: var(--radius); padding: 10px; min-height: 120px; }
.kanban-col.drag-over { background: #dfe6ef; }
.kanban-col h3 { display: flex; justify-content: space-between; align-items: center; font-size: .86rem; }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px;
  margin-bottom: 8px; cursor: grab; font-size: .87rem; box-shadow: var(--shadow); }
.kanban-card.dragging { opacity: .5; }
.kanban-card .title { font-weight: 600; color: var(--text); display: block; }
.kanban-card .meta { color: var(--muted); font-size: .8rem; margin-top: 4px; }

/* Files */
.dropzone { border: 2px dashed #c3ccd8; border-radius: var(--radius); padding: 18px; text-align: center;
  color: var(--muted); background: var(--surface-2); transition: background .15s; }
.dropzone.over { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.folder-tree { list-style: none; padding-left: 0; margin: 0; font-size: .9rem; }
.folder-tree ul { list-style: none; padding-left: 16px; margin: 0; }
.folder-tree a { display: block; padding: 4px 6px; border-radius: 6px; color: var(--text); }
.folder-tree a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; font-size: .7rem;
  color: var(--muted); font-weight: 700; }
.preview-frame { width: 100%; height: 70vh; border: 1px solid var(--border); border-radius: 8px; }
.preview-img { max-width: 100%; max-height: 70vh; border-radius: 8px; border: 1px solid var(--border); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; border-left: 2px solid var(--border); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.timeline li.k-akkoord::before, .timeline li.k-betaling::before { border-color: var(--ok); }
.timeline li.k-webshop::before { border-color: var(--warm); }
.timeline .when { font-size: .78rem; color: var(--muted); }

/* Call mode */
.call-grid { display: grid; grid-template-columns: minmax(250px, 1fr) minmax(320px, 1.3fr) minmax(300px, 1.2fr);
  gap: 14px; align-items: start; }
.call-grid .card { margin-bottom: 12px; }
.script { white-space: pre-wrap; font-size: 1rem; line-height: 1.6; background: var(--warm-soft); border-radius: 8px;
  padding: 12px 14px; }
.question { display: flex; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--border); font-size: .95rem; }
.question input { margin-top: 3px; }
.autosave-status { font-size: .8rem; color: var(--muted); }
.autosave-status.ok { color: var(--ok); }
.autosave-status.bad { color: var(--bad); }
textarea.notes { min-height: 280px; font-size: 1rem; }

/* Calendar */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.calendar .dow { background: var(--surface-2); font-size: .76rem; text-transform: uppercase; color: var(--muted);
  padding: 6px; font-weight: 600; }
.calendar .day { background: var(--surface); min-height: 110px; padding: 5px; font-size: .8rem; }
.calendar .day.other { background: #fafbfc; color: #a0a8b4; }
.calendar .day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.calendar .num { font-weight: 600; margin-bottom: 3px; }
.cal-item { display: block; border-radius: 5px; padding: 2px 5px; margin-bottom: 2px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; color: #fff; font-size: .76rem; }
.cal-afspraak, .cal-showroom { background: #2563eb; }
.cal-ontwerp { background: #7c3aed; }
.cal-productie { background: #0d9488; }
.cal-levering { background: #b7832f; }
.cal-taak { background: #64748b; }
.cal-deadline { background: #b91c1c; }
.cal-overig { background: #475569; }

/* Login */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(160deg, #16263b, #27405f); }
.auth .card { width: 100%; max-width: 400px; padding: 28px; }
.auth .brand { color: var(--text); padding: 0 0 16px; }

.progress { height: 8px; background: #eceff3; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--ok); }
.reminders { position: relative; }
.reminders summary { list-style: none; cursor: pointer; }
.reminders summary::-webkit-details-marker { display: none; }
.reminders .panel { position: absolute; right: 0; top: 36px; width: 340px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, .12); padding: 12px;
  z-index: 50; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.hidden { display: none !important; }
.locked { opacity: .75; }

@media (max-width: 1100px) {
  .call-grid { grid-template-columns: 1fr 1fr; }
  .call-grid > :last-child { grid-column: 1 / -1; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -260px; width: 240px; z-index: 60; transition: left .2s; }
  body.menu-open .sidebar { left: 0; }
  .menu-toggle { display: inline-flex; }
  .split, .grid-2, .grid-3, .call-grid, .form-grid { grid-template-columns: 1fr; }
  .content { padding: 16px 14px 60px; }
  .topbar { padding: 8px 12px; }
  .spec-row { grid-template-columns: 1fr; gap: 4px; }
  .hide-mobile { display: none; }
}
@media print {
  .sidebar, .topbar, .actions, .demo-banner, .tabs { display: none !important; }
  .layout { display: block; }
}

/* Telefoon: zoekveld op een eigen regel, knoppen compact */
@media (max-width: 600px) {
  .topbar { flex-wrap: wrap; }
  .topbar form.search { order: 10; flex: 1 1 100%; max-width: none; }
  .topbar .user-name { display: none; }
  .card-head select.input { max-width: 100%; }
  .page-head .actions { width: 100%; }
}
