/* SMR Portaal — stylesheet */

:root {
  --bg:      #f4f4f5;
  --surface: #ffffff;
  --border:  #e4e4e7;
  --text:    #18181b;
  --muted:   #71717a;
  --accent:  #2563eb;
  --pos:     #16a34a;
  --neg:     #dc2626;
  --row:     #f9f9fb;
  --nav-bg:     #ffffff;
  --nav-text:   #52525b;
  --nav-active: #18181b;
  --nav-hover:  #f4f4f5;
  --nav-border: #e4e4e7;
  --badge-active-bg:    #dcfce7; --badge-active-text:   #16a34a;
  --badge-inactive-bg:  #f4f4f5; --badge-inactive-text: #71717a;
  --badge-sales-bg:     #fef3c7; --badge-sales-text:    #92400e;
  --badge-sp-bg:        #ede9fe; --badge-sp-text:       #6d28d9;
  --income-bg: #dbeafe; --income-text: #1d4ed8;
  --cost-bg:   #fee2e2; --cost-text:   #b91c1c;
  --ok-bg:     #dcfce7; --ok-text:     #15803d;
  --err-bg:    #fee2e2; --err-text:    #b91c1c;
  --pill-bg: #d4d4d8;
  --tab-bg:  #e4e4e7; --tab-active-bg: #ffffff; --tab-active-text: #18181b;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,.07);
  --nav-w: 210px;
}

body.dark {
  --bg:      #09090b;
  --surface: #18181b;
  --border:  #27272a;
  --text:    #fafafa;
  --muted:   #71717a;
  --pos:     #4ade80;
  --neg:     #f87171;
  --row:     #1f1f22;
  --nav-bg:     #09090b;
  --nav-text:   #71717a;
  --nav-active: #fafafa;
  --nav-hover:  #18181b;
  --nav-border: #27272a;
  --badge-active-bg:    #14532d; --badge-active-text:   #4ade80;
  --badge-inactive-bg:  #27272a; --badge-inactive-text: #71717a;
  --badge-sales-bg:     #451a03; --badge-sales-text:    #fcd34d;
  --badge-sp-bg:        #2e1065; --badge-sp-text:       #c4b5fd;
  --income-bg: #1e3a5f; --income-text: #93c5fd;
  --cost-bg:   #450a0a; --cost-text:   #fca5a5;
  --ok-bg:     #14532d; --ok-text:     #4ade80;
  --err-bg:    #450a0a; --err-text:    #fca5a5;
  --pill-bg: #52525b;
  --tab-bg:  #27272a; --tab-active-bg: #18181b; --tab-active-text: #fafafa;
  --shadow: 0 1px 3px rgba(0,0,0,.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
}
body.font-small .content { zoom: 0.857; }
body.font-large  .content { zoom: 1.143; }

/* ── Shell ── */
.shell { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--nav-w);
  flex-shrink: 0;
  background: var(--nav-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 200;
  transition: transform .2s;
}

.sidebar-logo {
  padding: 18px 16px 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-align: center;
  color: var(--nav-active);
  border-bottom: 1px solid var(--nav-border);
  flex-shrink: 0;
}

.nav-section  { padding: 8px 0 2px; }
.nav-label    { padding: 4px 14px; font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.sidebar a {
  display: flex;
  align-items: center;
  padding: 7px 14px;
  color: var(--nav-text);
  text-decoration: none;
  font-size: 13px;
  transition: background .1s, color .1s;
}

.sidebar a:hover { background: var(--nav-hover); color: var(--nav-active); }
.sidebar a.active { color: var(--nav-active); background: var(--nav-hover); border-left: 2px solid var(--accent); padding-left: 12px; }

.nav-soon { display: block; padding: 7px 14px; font-size: 13px; color: var(--muted); opacity: .35; cursor: default; user-select: none; }
.soon     { font-size: 9px; padding: 1px 4px; border-radius: 99px; background: var(--nav-hover); color: var(--muted); margin-left: 4px; vertical-align: middle; text-transform: uppercase; letter-spacing: .04em; }

.sidebar-bottom { position: sticky; bottom: 0; margin-top: auto; border-top: 1px solid var(--nav-border); padding: 8px 0; background: var(--nav-bg); }
.sidebar-user   { padding: 8px 14px 4px; font-size: 11px; color: var(--muted); }
.sidebar-bottom a { font-size: 13px; }

.theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  cursor: pointer;
  user-select: none;
  transition: background .1s;
}
.theme-row:hover { background: var(--nav-hover); }
.theme-row span  { font-size: 13px; color: var(--nav-text); }

.fontsize-row {
  display: flex;
  align-items: baseline;
  gap: 2px;
  padding: 4px 14px 8px;
}
.fs-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--nav-text);
  line-height: 1;
  padding: 2px 5px;
  border-radius: 3px;
}
.fs-btn.active { color: var(--nav-active); font-weight: 700; }
.fs-btn:hover  { background: var(--nav-hover); }
.fs-s { font-size: 10px; }
.fs-m { font-size: 13px; }
.fs-l { font-size: 17px; }

.pill {
  width: 28px; height: 16px;
  border-radius: 99px;
  background: var(--pill-bg);
  position: relative;
  flex-shrink: 0;
  transition: background .2s;
}
.pill::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
body.dark .pill { background: var(--accent); }
body.dark .pill::after { transform: translateX(12px); }

/* ── Overlay ── */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 199; }
.overlay.open { display: block; }

/* ── Main ── */
.main { margin-left: var(--nav-w); flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ── Topbar ── */
.topbar {
  height: 48px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.hamburger { display: none; background: none; border: none; color: var(--text); font-size: 18px; cursor: pointer; padding: 2px 4px; line-height: 1; flex-shrink: 0; }
.topbar-title { font-weight: 600; font-size: 14px; }
.topbar-user  { font-size: 12px; color: var(--muted); margin-left: auto; }

/* ── Content ── */
.content { padding: 22px; }

/* ── Standalone (login, setup, changepass) ── */
.standalone {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 340px;
  box-shadow: var(--shadow);
}
.box h1  { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.box .sub { font-size: 12px; color: var(--muted); margin-bottom: 22px; }

/* ── Forms ── */
.field { margin-bottom: 13px; }
.field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 5px;
}

input[type=text], input[type=password], input[type=number],
input[type=email], select, textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
  appearance: none;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.note { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 13px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
  transition: opacity .1s, background .1s;
}
.btn-primary   { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { opacity: .85; }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-ghost  { background: transparent; color: var(--muted); border-color: transparent; }
.btn-ghost:hover  { background: var(--border); color: var(--text); }
.btn-danger { background: transparent; color: var(--neg); border-color: var(--border); }
.btn-danger:hover { background: var(--cost-bg); border-color: var(--neg); }
.btn-sm   { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; }
.btn-row  { display: flex; gap: 8px; margin-top: 4px; }
.btn:disabled { cursor: default; opacity: .5; }

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}
.page-title { display: flex; align-items: center; gap: 8px; }
.page-title h1 { font-size: 17px; font-weight: 600; }
.page-title p  { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Star */
.star {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  padding: 0;
  flex-shrink: 0;
  transition: color .15s, transform .15s;
}
.star:hover { color: var(--text); transform: scale(1.15); }
.star.active { color: #f59e0b; }

.nav-star {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  padding: 0;
  line-height: 1;
  opacity: .45;
  transition: opacity .15s, color .15s;
  flex-shrink: 0;
}
.nav-star:hover { opacity: 1; color: var(--text); }
.nav-star.active { color: #f59e0b; opacity: 1; }

/* ── Cards ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card + .card { margin-top: 14px; }
.card-header { padding: 11px 15px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-header h2 { font-size: 13px; font-weight: 600; }
.card-body { padding: 15px; }

/* ── Stats ── */
.stats { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.stat { flex: 1; min-width: 100px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 15px; box-shadow: var(--shadow); }
.stat-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
.stat-value { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-value.neg { color: var(--neg); }
.stat-value.pos { color: var(--pos); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 8px 14px; font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--row); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.num.pos { color: var(--pos); }
.num.neg { color: var(--neg); }
.summary-row td { font-weight: 600; background: var(--bg); }
.summary-row:hover td { background: var(--bg) !important; }
.row-inactive { opacity: .5; }
.row-inactive:hover { opacity: .7; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 99px; font-size: 11px; font-weight: 500; white-space: nowrap; }
.b-active   { background: var(--badge-active-bg);   color: var(--badge-active-text); }
.b-inactive { background: var(--badge-inactive-bg); color: var(--badge-inactive-text); }
.b-sp       { background: var(--badge-sp-bg);       color: var(--badge-sp-text); }
.b-income   { background: var(--income-bg);         color: var(--income-text); }
.b-cost     { background: var(--cost-bg);           color: var(--cost-text); }
.b-admin    { background: #3b0764; color: #d8b4fe; }
.b-manager  { background: #172554; color: #93c5fd; }
.b-sales    { background: var(--badge-sales-bg); color: var(--badge-sales-text); }
.b-driver   { background: var(--badge-inactive-bg); color: var(--badge-inactive-text); }

/* ── Sale status badges ── */
.b-pending  { background: #fef9c3; color: #854d0e; }
.b-queued   { background: #fff3cd; color: #856404; }
.b-imported { background: #dbeafe; color: #1e40af; }
.b-archived { background: var(--badge-inactive-bg); color: var(--badge-inactive-text); }
.b-error    { background: #fde8e8; color: #b91c1c; }
body.dark .b-pending  { background: #422006; color: #fde68a; }
body.dark .b-queued   { background: #3d2e00; color: #fde68a; }
body.dark .b-imported { background: #1e3a5f; color: #93c5fd; }
body.dark .b-error    { background: #3b0000; color: #fca5a5; }

/* ── Balance bar ── */
.balance-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 17px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}
.bl-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.bl-value { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── Section divider ── */
.section-divider { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 9px 14px 5px; border-top: 1px solid var(--border); }

/* ── Alerts ── */
.alert { padding: 9px 13px; border-radius: var(--radius); font-size: 12.5px; margin-bottom: 14px; }
.alert-info  { background: var(--income-bg); color: var(--income-text); }
.alert-ok    { background: var(--ok-bg);     color: var(--ok-text); }
.alert-error { background: var(--err-bg);    color: var(--err-text); }

/* ── Misc ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.muted  { color: var(--muted); }
.sm     { font-size: 12px; }
.actions { display: flex; gap: 5px; }
.back { font-size: 12px; color: var(--muted); text-decoration: none; display: inline-block; margin-bottom: 12px; }
.back:hover { color: var(--text); }
.filter-row { display: flex; gap: 8px; align-items: center; }
.filter-row label { font-size: 12px; color: var(--muted); }
select.year { width: auto; padding: 5px 8px; font-size: 13px; }
.driver-code-muted { color: var(--muted); font-weight: 400; font-size: 15px; }
code { font-family: "SF Mono","Fira Code",monospace; font-size: 12px; }

/* ── Collapsible card (details/summary) ── */
details.card > summary { list-style: none; cursor: pointer; user-select: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary.card-header { border-bottom: none; }
details.card[open] > summary.card-header { border-bottom: 1px solid var(--border); }

/* ── Pill tabs (verkoop module) ── */
.pill-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 0 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  position: sticky;
  top: 48px; /* below topbar */
  background: var(--bg);
  z-index: 10;
}
.pill-tab {
  padding: 6px 16px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background .1s, color .1s, border-color .1s;
}
.pill-tab:hover { background: var(--tab-bg); color: var(--text); }
.pill-tab.active {
  background: var(--tab-active-bg);
  color: var(--tab-active-text);
  border-color: var(--border);
  box-shadow: var(--shadow);
}

/* ── Client banner (verkoop invoer) ── */
.client-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--income-bg);
  color: var(--income-text);
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 13.5px;
  font-weight: 500;
}
.client-banner-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.event-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  outline: none;
  min-width: 0;
}
.event-input::placeholder { color: var(--muted); font-weight: 400; }

.last-added {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--ok-bg);
  color: var(--ok-text);
  border-radius: var(--radius);
  font-size: 13px;
  word-break: break-word;
}

/* ── Client picker ── */
.client-picker {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 14px;
  overflow: hidden;
}
.client-picker-search {
  padding: 10px;
  border-bottom: 1px solid var(--border);
}
.client-picker-search input { margin: 0; }
.client-picker-list {
  max-height: 220px;
  overflow-y: auto;
}
.client-picker-item {
  padding: 9px 14px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.client-picker-item:last-child { border-bottom: none; }
.client-picker-item:hover { background: var(--row); }
.client-picker-meta { font-size: 11px; color: var(--muted); margin-top: 1px; }

/* ── Sales group-header row ── */
.group-header td {
  background: var(--tab-bg);
  padding: 5px 12px;
  font-size: 12px;
  border-top: 1px solid var(--border);
}

/* ── Productnr autocomplete dropdown ── */
.pnr-dropdown {
  position: fixed;
  z-index: 9999;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  min-width: 260px;
  max-width: 420px;
  max-height: 220px;
  overflow-y: auto;
}
.pnr-item {
  display: flex;
  flex-direction: column;
  padding: 7px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  gap: 1px;
}
.pnr-item:last-child { border-bottom: none; }
.pnr-item:hover { background: var(--row); }
.pnr-code { font-weight: 600; font-size: 13px; }
.pnr-desc { color: var(--muted); font-size: 11px; }

/* Product name below productnr in sales list */
.pnr-name {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.3;
}

/* ── Status filter row ── */
.status-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.status-filter label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.status-filter select { width: auto; }

/* ── Responsive ── */
@media (max-width: 720px) {
  .sidebar { transform: translateX(calc(-1 * var(--nav-w))); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.25); }
  .main { margin-left: 0; }
  .hamburger { display: block; }
  .content { padding: 14px; }
  .form-grid { grid-template-columns: 1fr; }
.balance-bar { flex-direction: column; gap: 10px; align-items: flex-start; }
  .balance-bar > div:last-child { text-align: left; }
}
