@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ============================================================
   1. Tokens
   ============================================================ */
:root {
  --font: 'Montserrat', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --bg: #f3f5f8;
  --card: #ffffff;
  --border: #e4e8ee;
  --border-strong: #cfd6e0;
  --text: #1f2733;
  --muted: #6b7684;
  --muted-2: #98a2b3;
  --primary: #1f6fe5;
  --primary-hover: #1859bd;
  --primary-soft: #e8f0fe;
  --accent: #f5842a;
  --accent-soft: #fff1e6;
  --green: #2fa84f;
  --green-dark: #1e8f3f;
  --green-soft: #e6f6ea;
  --red: #e0443a;
  --red-soft: #fdeceb;
  --yellow: #f2b90c;
  --yellow-soft: #fff8dc;
  --purple: #7c5cd6;
  --purple-soft: #efeafb;
  --nav-bg: #132238;
  --nav-text: #b7c3d6;
  --nav-active: #ffffff;
  --nav-w: 232px;
  --brand-gradient: linear-gradient(135deg, #0e9f6e 0%, #1f6fe5 100%);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 8px 24px rgba(16,24,40,.10);
  /* oude namen die her en der nog gebruikt worden */
  --orange: #f5842a;
  --blue: #1f6fe5;
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
h2 { font-size: 18px; font-weight: 700; line-height: 1.3; }
h3 { font-size: 14px; font-weight: 700; line-height: 1.35; }
h4 { font-size: 13px; font-weight: 700; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
strong, b { font-weight: 600; }
small { font-size: 12px; }
code, kbd { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: 12px; }
::selection { background: var(--primary-soft); }
.subtitle, .page-sub { color: var(--muted); font-size: 13px; }
.subtitle { margin-bottom: 20px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
img, svg, canvas { max-width: 100%; }

/* ============================================================
   2. App-schil: navigatie links + pagina
   ============================================================ */
.app-body { display: grid; grid-template-columns: var(--nav-w) 1fr; min-height: 100vh; }
.app-body > main { min-width: 0; }

.app-nav {
  background: var(--nav-bg);
  color: var(--nav-text);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column;
  padding: 18px 12px 16px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent;
}
.app-nav::-webkit-scrollbar { width: 6px; }
.app-nav::-webkit-scrollbar-track { background: transparent; }
.app-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 999px; }
.app-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.3); }

.app-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; margin-bottom: 8px; border-bottom: 1px solid rgba(255,255,255,.08); text-decoration: none; color: inherit; }
.app-brand:hover { text-decoration: none; }
.app-brand-mark { width: 32px; height: 32px; object-fit: contain; flex-shrink: 0; }
.app-brand-name { color: var(--nav-active); font-weight: 700; font-size: 14px; line-height: 1.2; }
.app-brand-sub { color: var(--nav-text); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }

.app-nav-list { list-style: none; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.app-nav-list a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--nav-text); font-weight: 500; font-size: 13px; text-decoration: none;
  position: relative; transition: background .15s, color .15s;
}
.app-nav-list a svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.app-nav-list a:hover { background: rgba(255,255,255,.05); color: var(--nav-active); text-decoration: none; }
.app-nav-list a.active { background: rgba(255,255,255,.06); color: var(--nav-active); font-weight: 600; }
.app-nav-list a.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.app-nav-list a.active svg { opacity: 1; }
.app-nav-foot { padding: 14px 8px 0; margin-top: 12px; border-top: 1px solid rgba(255,255,255,.08); font-size: 11px; color: rgba(183,195,214,.7); }

.page { padding: 24px 32px 48px; max-width: 1480px; width: 100%; }
.page.page-narrow { max-width: 1100px; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-header h1 { margin-bottom: 2px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Oude navigatiebalk (blijft werken zolang een pagina 'm nog heeft) */
.navbar { background: var(--nav-bg); padding: 0 24px; height: 52px; display: flex; align-items: center; gap: 4px; }
.navbar .brand { color: #fff; font-weight: 700; font-size: 15px; margin-right: auto; }
.navbar a { color: var(--nav-text); text-decoration: none; padding: 6px 12px; border-radius: var(--radius-sm); font-weight: 500; }
.navbar a:hover, .navbar a.active { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.container { max-width: 1100px; margin: 28px auto; padding: 0 24px; }
.app-body .container { margin: 0; padding: 0; max-width: none; }

/* ============================================================
   3. Kaarten
   ============================================================ */
.card, .section {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 24px; margin-bottom: 16px;
}
.card-compact { padding: 14px 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-header > div { min-width: 0; }
.card-title { font-size: 14px; font-weight: 700; }
.card-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card-body { min-width: 0; }
.section h3 { margin-bottom: 14px; }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.section-header h3 { margin-bottom: 0; }
.section-hint { color: var(--muted); font-size: 12px; font-weight: 400; }

/* ============================================================
   KPI-tegels
   ============================================================ */
.kpi-row, .dash-stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi, .dash-stat {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; min-width: 0;
}
.kpi-label, .dash-stat-label { font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.kpi-value, .dash-stat-value { font-size: 28px; font-weight: 700; line-height: 1.1; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -.01em; margin-bottom: 4px; word-break: break-word; }
.kpi-sub, .dash-stat-sub { font-size: 12px; color: var(--muted); }
.kpi-blue .kpi-value, .kpi-blue .dash-stat-value { color: var(--primary); }
.kpi-green .kpi-value, .kpi-green .dash-stat-value, .dash-stat-green .dash-stat-value, .dash-stat-green .kpi-value { color: var(--green); }
.kpi-orange .kpi-value, .kpi-orange .dash-stat-value { color: var(--accent); }
.kpi-red .kpi-value, .kpi-red .dash-stat-value { color: var(--red); }
.kpi-purple .kpi-value, .kpi-purple .dash-stat-value { color: var(--purple); }
.kpi-delta { font-weight: 600; }
.kpi-delta.up { color: var(--green); }
.kpi-delta.down { color: var(--red); }
.kpi.kpi-solid-green, .kpi.kpi-solid-blue { border-color: transparent; }
.kpi.kpi-solid-green { background: var(--green); }
.kpi.kpi-solid-blue { background: var(--primary); }
.kpi-solid-green .kpi-label, .kpi-solid-blue .kpi-label, .kpi-solid-green .kpi-sub, .kpi-solid-blue .kpi-sub { color: rgba(255,255,255,.85); }
.kpi-solid-green .kpi-value, .kpi-solid-blue .kpi-value { color: #fff; }
.dash-stat-accent { border-left: 3px solid var(--primary); }
.dash-stat-green { border-left: 3px solid var(--green); }

/* ============================================================
   Fase-balk (chevrons)
   ============================================================ */
.stage-bar { display: flex; gap: 2px; margin-bottom: 16px; }
.stage {
  flex: 1; height: 30px; display: flex; align-items: center; justify-content: center;
  padding: 0 14px 0 20px; background: #e6eaf0; color: var(--muted);
  font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%);
  transition: filter .15s;
}
.stage:first-child { clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); padding-left: 14px; border-radius: 4px 0 0 4px; }
.stage:last-child { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 12px 50%); border-radius: 0 4px 4px 0; }
.stage:only-child { clip-path: none; border-radius: 4px; }
.stage.done { background: var(--green); color: #fff; }
.stage.current { background: var(--green-dark); color: #fff; font-weight: 700; }
.stage.lost { background: var(--red); color: #fff; }
.stage-bar.blue .stage.done { background: var(--primary); }
.stage-bar.blue .stage.current { background: var(--primary-hover); }
.stage[onclick] { cursor: pointer; }
.stage[onclick]:hover { filter: brightness(.94); }

/* ============================================================
   Tabbladen
   ============================================================ */
.tabs, .tab-nav, .subtab-nav { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tab-nav { padding: 0; max-width: none; margin: 0 0 16px; }
.tab, .tab-btn, .subtab-btn {
  background: none; border: none; cursor: pointer;
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .15s, border-color .15s; text-decoration: none; white-space: nowrap;
}
.tab:hover, .tab-btn:hover, .subtab-btn:hover { color: var(--text); text-decoration: none; }
.tab.active, .tab-btn.active, .subtab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs.orange .tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { min-width: 0; }

/* ============================================================
   Pills en badges
   ============================================================ */
.pill, .badge, .stat {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: var(--radius-pill);
  background: var(--bg); color: var(--muted); line-height: 1.4; white-space: nowrap;
}
.badge { text-transform: none; }
.pill-green, .badge.ok, .stat.ok, .badge.action-found { background: var(--green-soft); color: var(--green-dark); }
.pill-blue, .badge.monthly, .stat.info, .badge.action-create { background: var(--primary-soft); color: var(--primary-hover); }
.pill-orange, .stat.warn { background: var(--accent-soft); color: #c2611a; }
.pill-red, .badge.error, .stat.err, .badge.action-update { background: var(--red-soft); color: #b8342b; }
.pill-grey, .badge.skipped { background: #eceff3; color: var(--muted); }
.pill-purple, .badge.annual { background: var(--purple-soft); color: #5b3fb3; }
.pill-yellow, .badge.afwijkend { background: var(--yellow-soft); color: #8a6508; }
.badge.afwijkend { cursor: help; }
.badge.pkg { background: #e3f7f4; color: #1f6f66; }
.pill-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-count { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; background: var(--primary-soft); color: var(--primary-hover); padding: 1px 8px; border-radius: var(--radius-pill); margin-left: 4px; vertical-align: middle; }
.badge-count:empty { display: none; }
.timeon-id { display: inline-flex; align-items: center; background: var(--bg); color: var(--muted); padding: 3px 10px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 600; }
.badge-mrr, .cust-mrr { display: inline-flex; align-items: center; background: var(--green-soft); color: var(--green-dark); font-weight: 600; border-radius: var(--radius-pill); }
.badge-mrr { font-size: 12px; padding: 3px 10px; }
.cust-mrr { font-size: 11px; padding: 1px 7px; }
.stats-bar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.stat { padding: 5px 12px; font-size: 12px; }

/* ============================================================
   Avatars
   ============================================================ */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--brand-gradient); color: #fff;
  font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; letter-spacing: .02em; text-transform: uppercase; user-select: none;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.avatar-square { border-radius: 8px; background: var(--green); }

/* ============================================================
   Knoppen
   ============================================================ */
.btn, .btn-primary, .btn-secondary, .btn-accent, .btn-ghost, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; line-height: 1; cursor: pointer;
  border: 1px solid transparent; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn svg, .btn-primary svg, .btn-secondary svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); text-decoration: none; color: #fff; }
.btn-primary:disabled, .btn:disabled, .btn-secondary:disabled { background: #c9d1dc; border-color: #c9d1dc; color: #fff; cursor: not-allowed; }
.btn-secondary { background: var(--card); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg); text-decoration: none; color: var(--text); }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { background: #dd7220; border-color: #dd7220; color: #fff; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.btn-danger { background: var(--card); color: var(--red); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--red-soft); border-color: #f0b3ae; color: #b8342b; text-decoration: none; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }
.btn-xs { height: 24px; padding: 0 8px; font-size: 11px; border-radius: 5px; }
.btn-lg { height: 42px; padding: 0 24px; font-size: 14px; }
.btn-block { width: 100%; }
.icon-btn { width: 32px; height: 32px; border-radius: 50%; border: none; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.btn-link { background: none; border: none; padding: 0; color: var(--muted); font-size: 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.btn-link:hover { color: var(--text); }
.btn-link-inline { color: var(--primary); font-weight: 600; cursor: pointer; text-decoration: underline; }
.btn-link-inline input { display: none; }

/* ============================================================
   Formulieren
   ============================================================ */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 12px; }
.form-row label, .field { display: flex; flex-direction: column; gap: 5px; font-size: 11px; font-weight: 600; color: var(--muted); min-width: 0; }
.form-row label:empty { display: none; }
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]), select, textarea {
  height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--card); color: var(--text); font-size: 13px; font-weight: 400; width: 100%; min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
select { padding-right: 28px; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7684' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; cursor: pointer; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:disabled, select:disabled, textarea:disabled { background: var(--bg); color: var(--muted); cursor: not-allowed; }
input[type=checkbox], input[type=radio] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; vertical-align: middle; }
input[type=date] { padding-right: 6px; }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-calc { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.add-form { background: var(--bg); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.add-form input:not([type=checkbox]), .add-form select, .add-form textarea { background: var(--card); }
.field-inline { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 600; color: var(--muted); }
.field-inline input, .field-inline select { width: auto; }
.search { padding-left: 32px !important; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.5' y2='16.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 10px center; }
.search-input { width: 100%; margin-bottom: 10px; }
.options { margin: 12px 0; }
.toggle-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.toggle-text { color: var(--muted); }
.toggle-small { display: inline-flex; align-items: center; cursor: pointer; }
.toggle-small input { display: none; }
.toggle-small span { width: 34px; height: 20px; background: #cfd6e0; border-radius: 10px; display: block; transition: background .2s; position: relative; }
.toggle-small span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle-small input:checked + span { background: var(--green); }
.toggle-small input:checked + span::after { transform: translateX(14px); }

/* ============================================================
   Lijsten links (sidebar) en lijstitems
   ============================================================ */
.sidebar {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px; position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto;
  scrollbar-width: thin;
}
.sidebar h2 { font-size: 14px; margin-bottom: 10px; padding: 0 4px; }
.list-item, .customer-item {
  padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; margin-bottom: 4px;
  border: 1px solid transparent; transition: background .15s, border-color .15s;
}
.list-item:hover, .customer-item:hover { background: var(--bg); }
.list-item.active, .customer-item.active { background: var(--primary-soft); border-left: 3px solid var(--primary); color: var(--text); }
.customer-item.active { font-weight: 600; color: var(--primary-hover); }
.list-item-title { font-weight: 600; margin-bottom: 3px; }
.list-item-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.customer-list { min-width: 0; }

/* ============================================================
   Tabellen
   ============================================================ */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { background: transparent; }
th { font-weight: 600; color: var(--muted); font-size: 11px; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg); }
tbody tr.error td:first-child { border-left: 3px solid var(--red); }
tbody tr.ok td:first-child { border-left: 3px solid var(--green); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
.table-numbered tbody { counter-reset: rij; }
.table-numbered td.rownum { width: 36px; color: var(--muted-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.table-numbered td.rownum::before { counter-increment: rij; content: counter(rij); }
table a { color: var(--primary); text-decoration: none; }
table a:hover { text-decoration: underline; }
.kolom-marge { color: var(--muted); }
.marge-bedrag { font-weight: 600; color: var(--green); white-space: nowrap; }
.marge-bedrag em { font-style: normal; font-weight: 400; font-size: 11px; color: var(--muted); }
.marge-bedrag.verlies { color: #b8342b; }
.marge-uitleg { margin-top: 8px; font-size: 11px; color: var(--muted); }
.korting-badge { display: inline-block; font-size: 11px; font-weight: 600; color: #8a6508; background: var(--yellow-soft); border-radius: 4px; padding: 1px 6px; cursor: help; }
.sub-domein { display: inline-block; margin-left: 6px; font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: 11px; color: var(--muted); background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; }
.subs-table { margin-top: 4px; }

/* ============================================================
   Layout-hulpjes
   ============================================================ */
.split { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.split-3 { display: grid; grid-template-columns: 300px 1fr 340px; gap: 20px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.beheer-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.crm-layout { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
.detail-panel { min-height: 400px; min-width: 0; }
.detail-header { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 24px; margin-bottom: 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.detail-header h2 { font-size: 18px; flex: 1; min-width: 0; }
.aside { min-width: 0; }

/* ============================================================
   Verkoopkansen ("next best offers")
   ============================================================ */
.offers-card .offer { border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px; background: var(--card); transition: box-shadow .15s; }
.offers-card .offer:hover { box-shadow: var(--shadow); }
.offer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.offer-title { font-weight: 600; }
.offer-price { color: var(--primary); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.offer-reason { font-size: 12px; color: var(--muted); margin-top: 4px; }
.relevance { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.relevance-bar { flex: 1; height: 6px; background: var(--bg); border-radius: var(--radius-pill); overflow: hidden; }
.relevance-bar span { display: block; height: 100%; background: var(--green); border-radius: var(--radius-pill); transition: width .3s; }
.relevance-pct { font-weight: 600; color: var(--green-dark); font-variant-numeric: tabular-nums; }
.offer-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.offer.dismissed { opacity: .55; border-left-color: var(--border-strong); }
.offers-hidden-toggle { font-size: 12px; color: var(--muted); cursor: pointer; margin-top: 4px; }

/* ============================================================
   Tijdlijn
   ============================================================ */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.timeline-item { position: relative; margin-bottom: 14px; }
.timeline-item::before { content: ''; position: absolute; left: -20px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--border); }
.timeline-item.green::before { background: var(--green); }
.timeline-item.orange::before { background: var(--accent); }
.timeline-item.red::before { background: var(--red); }
.timeline-time { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.timeline-body { font-size: 13px; }

/* ============================================================
   Berichten (ticket-conversatie)
   ============================================================ */
.thread { display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; gap: 12px; align-items: flex-start; }
.msg-body { flex: 1; min-width: 0; background: var(--bg); border-radius: var(--radius); padding: 10px 14px; }
.msg-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.msg-meta strong { color: var(--text); font-weight: 600; }
.msg-text { white-space: pre-wrap; word-break: break-word; }
.msg.mine .msg-body { background: var(--primary-soft); }
.composer { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 16px; }
.composer textarea { margin-bottom: 10px; }
.comment { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px; background: var(--card); }
.comment-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.comment textarea, .reply-box textarea { width: 100%; }

/* ============================================================
   Diversen
   ============================================================ */
.empty-state { background: var(--card); border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 48px 24px; text-align: center; color: var(--muted); }
.empty-state svg { width: 40px; height: 40px; stroke: var(--muted-2); fill: none; stroke-width: 1.5; margin-bottom: 10px; }
.empty-state p { margin: 0; }
.warnings { background: var(--yellow-soft); border: 1px solid #f0d77a; border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px; color: #6e5305; font-size: 13px; }
.callout { background: var(--primary-soft); border-left: 3px solid var(--primary); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px; font-size: 13px; }
.callout-red { background: var(--red-soft); border-left-color: var(--red); }
.callout-green { background: var(--green-soft); border-left-color: var(--green); }
.chip { display: inline-flex; align-items: center; gap: 4px; background: #eceff3; color: var(--muted); font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: var(--radius-sm); }
.chip-x { cursor: pointer; opacity: .7; font-weight: 700; }
.chip-x:hover { opacity: 1; color: var(--red); }
.divider { height: 1px; background: var(--border); margin: 16px 0; border: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.loading { color: var(--muted); padding: 12px; font-size: 13px; }
.muted-hint { color: var(--muted); font-size: 12px; margin-top: 8px; }
.price-up { color: var(--red); font-weight: 600; }
.price-down { color: var(--green); font-weight: 600; }
.price-change-hint { font-size: 11px; color: var(--muted); }
.result-card { overflow-x: auto; }

/* Dropzone */
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 36px; text-align: center; transition: border-color .2s, background .2s; cursor: pointer; background: var(--bg); }
.dropzone:hover, .dropzone.drag-over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone-sm { padding: 14px; }
.drop-icon { font-size: 36px; margin-bottom: 10px; }
.or { color: var(--muted); margin: 8px 0; }
.file-name { margin-top: 10px; color: var(--primary); font-weight: 600; }
.file-name:empty { display: none; }

/* Preview flow (facturatie) */
.preview-header-card { margin-bottom: 16px; }
.preview-title-row { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.preview-title-row h2 { font-size: 17px; }
.confirm-bar { display: flex; gap: 10px; margin: 20px 0; flex-wrap: wrap; }

/* Dashboard/grafieken */
.dashboard { padding: 0; }
.dash-charts { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 24px; }
.dash-chart-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 22px; min-width: 0; }
.dash-chart-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 14px; color: var(--text); }
.dash-chart-card canvas { max-height: 220px; }
.marge-box { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; background: var(--green-soft); border: 1px solid #c4ebcf; border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 12px; font-size: 12px; }
.marge-box strong { font-weight: 700; font-variant-numeric: tabular-nums; }
.marge-green { color: var(--green-dark); font-weight: 600; }
.marge-pct { background: var(--green); color: #fff; font-weight: 700; font-size: 11px; padding: 2px 10px; border-radius: var(--radius-pill); }
.marge-pos { color: var(--green); font-weight: 600; }
.marge-neg { color: var(--red); font-weight: 600; }

/* Import-herinnering */
.import-reminder { display: flex; align-items: center; gap: 14px; background: var(--yellow-soft); border: 1px solid #f0d77a; border-radius: var(--radius); padding: 14px 20px; margin: 0 0 20px; }
.import-reminder-icon { font-size: 24px; flex-shrink: 0; color: #b47f06; }
.import-reminder strong { display: block; font-size: 14px; margin-bottom: 2px; color: #6e5305; }
.import-reminder span { font-size: 12px; color: #7a5f0a; }
.import-reminder .btn-primary { margin-left: auto; height: 34px; font-size: 12px; }

/* Rapportfilters */
.rapport-filters { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.rapport-filters label { display: flex; flex-direction: column; gap: 5px; font-size: 11px; font-weight: 600; color: var(--muted); }
.rapport-filters select { min-width: 150px; width: auto; }

/* Pakketkiezer */
.pkg-picker { margin-bottom: 16px; }
.pkg-picker-title { font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.pkg-picker-hint { font-weight: 400; }
.pkg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.pkg-card { position: relative; display: block; background: var(--card); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s; }
.pkg-card:hover { border-color: var(--primary); }
.pkg-card input { position: absolute; top: 10px; right: 10px; accent-color: var(--primary); cursor: pointer; }
.pkg-card:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: var(--primary-soft); }
.pkg-body { display: flex; flex-direction: column; gap: 2px; padding-right: 18px; }
.pkg-naam { font-weight: 700; font-size: 13px; color: var(--text); }
.pkg-prijs { font-weight: 700; font-size: 15px; color: var(--primary); font-variant-numeric: tabular-nums; }
.pkg-termijn { font-size: 11px; color: var(--muted); }
.pkg-permaand { font-size: 11px; font-weight: 600; color: var(--green); }
.pkg-marge { font-size: 11px; color: var(--muted); }
.pkg-card-vrij .pkg-naam { color: var(--muted); }
.pkg-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.pkg-tab { background: var(--card); border: 1px solid var(--border-strong); border-radius: var(--radius-pill); padding: 5px 14px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.pkg-tab:hover { border-color: var(--primary); color: var(--primary); }
.pkg-tab.actief { background: var(--primary); border-color: var(--primary); color: #fff; }
.domain-field input { text-transform: lowercase; }

/* Pijplijn */
.pipeline-board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; align-items: start; }
.pipeline-col { background: #e9edf2; border-radius: var(--radius); padding: 12px; min-height: 140px; }
.pipeline-col h3 { font-size: 11px; margin-bottom: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.deal-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 12px; margin-bottom: 8px; }
.deal-card .waarde { color: var(--green-dark); font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }

/* ============================================================
   Publieke pagina's (klantportaal en ondertekenen)
   ============================================================ */
.public-wrap { max-width: 760px; margin: 40px auto; padding: 0 20px; }
.public-brand { background: var(--brand-gradient); color: #fff; border-radius: var(--radius); padding: 24px 28px; margin-bottom: 16px; box-shadow: var(--shadow-lg); }
.public-brand h1, .public-brand .wordmark { font-size: 22px; font-weight: 700; color: #fff; margin: 0; letter-spacing: -.01em; }
.public-brand p, .public-brand .wordmark-sub { color: rgba(255,255,255,.85); font-size: 13px; margin: 4px 0 0; }
.code-input { font-size: 24px !important; letter-spacing: 6px !important; text-align: center; text-transform: uppercase; height: 56px !important; font-weight: 600; }
.doc-frame { width: 100%; height: 560px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; display: block; }
.sign-pad { background: var(--card); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 12px; position: relative; }
.sign-pad canvas { display: block; width: 100%; height: 160px; background: #fff; border-radius: var(--radius-sm); touch-action: none; }
.sign-pad::after { content: ''; position: absolute; left: 28px; right: 28px; bottom: 44px; border-bottom: 1px dashed var(--border-strong); pointer-events: none; }
.price-summary { display: flex; flex-direction: column; gap: 6px; }
.price-summary .price-line { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.price-summary .price-line span:last-child { font-variant-numeric: tabular-nums; }
.price-summary .price-total { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; font-weight: 700; color: var(--primary); font-size: 15px; }

/* ============================================================
   Responsief
   ============================================================ */
@media (max-width: 1100px) {
  :root { --nav-w: 64px; }
  .app-nav { padding: 14px 8px; }
  .app-brand { justify-content: center; padding: 4px 0 14px; }
  .app-brand-name, .app-brand-sub, .app-nav-list a span, .app-nav-foot { display: none; }
  .app-nav-list a { justify-content: center; padding: 12px 0; }
  .app-nav-list a.active::before { left: -8px; }
  .page { padding: 20px 20px 40px; }
  .split, .split-3, .grid-2, .grid-3, .beheer-layout, .crm-layout, .dash-charts { grid-template-columns: 1fr; }
  .pipeline-board { grid-template-columns: repeat(2, 1fr); }
  .sidebar { position: static; max-height: none; }
}
@media (max-width: 700px) {
  .app-body { grid-template-columns: 1fr; }
  .app-nav { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: 8px 10px; }
  .app-brand { padding: 0 8px 0 0; margin: 0; border: none; border-right: 1px solid rgba(255,255,255,.08); }
  .app-nav-list { flex-direction: row; gap: 0; }
  .app-nav-list a.active::before { display: none; }
  .pipeline-board { grid-template-columns: 1fr; }
  .page { padding: 16px 14px 32px; }
  .kpi-row, .dash-stat-row { grid-template-columns: repeat(2, 1fr); }
}
