:root {
  --bg: #f5f5f4;
  --surface: #ffffff;
  --border: #e3e7ee;
  --text: #1d1d1b;
  --muted: #4b5563;
  --accent: #d42027;
  --accent-strong: #a8141a;
  --banner: #1d1d1b;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Figtree", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}
a { color: inherit; text-decoration: none; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

.trial-banner { background: var(--banner); color: #fff; text-align: center; font-size: 14px; padding: 9px 16px; }

/* Bovenbalk */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: 0 1px 2px rgba(0,0,0,.03); position: relative; z-index: 10; }
.topbar-inner { display: flex; align-items: center; gap: 24px; height: 56px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.logo-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 7px; background: var(--accent); color: #fff; font-size: 18px; }
.nav-main, .nav-right { display: flex; align-items: center; gap: 22px; font-size: 14px; color: #374151; white-space: nowrap; }
.logo { white-space: nowrap; }
.nav-main a:hover, .nav-right a:hover, .dropdown summary:hover { color: var(--accent-strong); }
.nav-right { margin-left: auto; }
.search { flex: 0 1 260px; display: flex; align-items: center; gap: 8px; border: 1px solid #d1d5db; border-radius: 6px; padding: 0 10px; height: 34px; color: #9ca3af; }
.search svg { width: 16px; height: 16px; flex: none; }
.search input { border: 0; outline: 0; width: 100%; font: inherit; font-size: 14px; background: transparent; color: var(--text); }
.search:focus-within { border-color: var(--accent); }
.menu-toggle { display: none; margin-left: auto; background: none; border: 0; font-size: 22px; cursor: pointer; }

.dropdown { position: relative; }
.dropdown summary { list-style: none; cursor: pointer; }
.dropdown summary::-webkit-details-marker { display: none; }
.caret { font-size: 11px; color: #6b7280; }
.dropdown-menu { position: absolute; top: calc(100% + 12px); left: 0; min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,.08); padding: 6px; max-height: 70vh; overflow: auto; }
.dropdown-right { left: auto; right: 0; min-width: 160px; }
.dropdown-menu a, .dropdown-menu button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 5px; font: inherit; font-size: 14px; background: none; border: 0; cursor: pointer; color: inherit; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg); }

/* Dashboard */
.page-title { font-size: 26px; font-weight: 700; margin: 40px 0 28px; }
.tile-section { margin-bottom: 36px; }
.tile-section h2 { font-size: 18px; font-weight: 600; margin: 0 0 14px; }
.tile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.tile { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px 18px; transition: border-color .15s, box-shadow .15s; }
.tile:hover { border-color: #e8a3a5; box-shadow: 0 4px 14px rgba(212,32,39,.10); }
.tile-icon { font-size: 15px; line-height: 1.6; }
.tile-body { display: flex; flex-direction: column; gap: 3px; }
.tile-title { color: var(--accent); font-weight: 600; font-size: 16px; }
.tile-desc { color: var(--muted); font-size: 13.5px; }
.tile.is-disabled { pointer-events: none; opacity: .75; }
.badge { display: inline-block; vertical-align: middle; background: #fde8e8; color: var(--accent-strong); font-size: 10.5px; font-weight: 700; letter-spacing: .03em; padding: 2px 6px; border-radius: 4px; margin-left: 4px; }

/* Inloggen */
.auth-box { max-width: 400px; margin: 70px auto; }
.auth-box h1 { text-align: center; font-size: 22px; margin: 18px 0 22px; }
.logo-center { justify-content: center; font-size: 18px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.form label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 14px; }
.form input { display: block; width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 6px; font: inherit; }
.form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.btn { width: 100%; padding: 10px; border: 0; border-radius: 6px; background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--accent-strong); }
.alert { background: #fdecec; color: #9b1c1c; padding: 10px 12px; border-radius: 6px; font-size: 14px; }

@media (max-width: 1020px) {
  .tile-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar-inner { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; gap: 12px; }
  .menu-toggle { display: block; }
  .nav-main, .nav-right, .search { display: none; }
  body.nav-open .nav-main, body.nav-open .nav-right { display: flex; flex-direction: column; align-items: flex-start; width: 100%; gap: 10px; margin: 0; }
  body.nav-open .search { display: flex; flex-basis: 100%; }
  .dropdown-menu { position: static; box-shadow: none; margin-top: 6px; }
}
@media (max-width: 560px) {
  .tile-grid { grid-template-columns: 1fr; }
  .page-title { margin-top: 24px; }
}

/* ===== Order Analytics ===== */
:root { --accent-bar: #d42027; --blue-bar: #3b82f6; --gray-bar: #94a3b8; --good: #16a34a; --bad: #dc2626; }
.muted { color: #6b7280; }
.small { font-size: 12.5px; }
.empty { color: #6b7280; font-size: 14px; padding: 8px 0; }
.oa-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 40px 0 22px; }
.oa-title { margin: 0 0 4px; }
.oa-head p { margin: 0; font-size: 13.5px; }
.periods { display: flex; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.periods a { padding: 6px 9px; font-size: 12.5px; color: #374151; }
.periods a:hover { background: var(--bg); }
.periods a.on { background: var(--accent-bar); color: #fff; font-weight: 600; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-top: 2px solid var(--border); border-radius: 8px; padding: 18px 16px 16px; }
.kpi.is-good { border-top-color: #4ade80; }
.kpi.is-bad { border-top-color: #f87171; }
.kpi-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: #4b5563; }
.kpi-value { font-size: 21px; font-weight: 700; margin-top: 14px; }
.chg { font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 4px; text-transform: none; letter-spacing: 0; white-space: nowrap; }
.chg.good { color: var(--good); background: #e9f9ee; }
.chg.bad { color: var(--bad); background: #fdecec; }

.card h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card .sub { margin: 2px 0 0; font-size: 12.5px; color: #6b7280; }
section.card, .grid-2 > .card, .grid-3 > .card { padding: 20px; margin-bottom: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 18px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.card-flush { padding: 0 !important; overflow: hidden; }
.card-head.pad { padding: 20px 20px 0; }
.chart-wrap { position: relative; height: 300px; margin-top: 12px; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; flex: none; }
.seg button, .seg a { border: 0; background: var(--surface); font: inherit; font-size: 12px; padding: 5px 10px; cursor: pointer; color: #4b5563; }
.seg button + button, .seg a + a { border-left: 1px solid var(--border); }
.seg .on { background: #eef0f4; color: var(--text); font-weight: 600; }

.bars-pct .bar-row { margin-bottom: 12px; }
.bar-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 5px; }
.bar-top .muted { white-space: nowrap; font-size: 12px; }
.bar-track { height: 7px; background: #eef0f4; border-radius: 4px; overflow: hidden; }
.bar-track .bar-fill { height: 100%; border-radius: 4px; }
.bars-chart .bar-row { display: grid; grid-template-columns: 170px 1fr; align-items: center; gap: 12px; margin-bottom: 7px; }
.bar-label { text-align: right; font-size: 12.5px; color: #374151; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-area { display: flex; align-items: center; gap: 6px; border-left: 1px solid #9ca3af; padding: 2px 0; }
.bar-area .bar-fill { height: 13px; border-radius: 0 3px 3px 0; }
.bar-area .bar-fill.outlined { box-shadow: inset 0 0 0 1px #d1d5db; }
.bar-val { font-size: 11.5px; color: #6b7280; white-space: nowrap; }
.avg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; border-top: 1px solid var(--border); margin-top: 18px; padding-top: 16px; text-align: center; font-size: 12.5px; }
.avg-grid strong { display: block; font-size: 13px; margin-top: 2px; }

.table-scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: #6b7280; font-weight: 600; padding: 10px 20px; border-bottom: 1px solid var(--border); background: #fafbfc; white-space: nowrap; }
.tbl td { padding: 12px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; white-space: nowrap; }
.item-cell { display: flex; align-items: center; gap: 12px; }
.item-cell img { width: 52px; height: 40px; object-fit: contain; flex: none; }
.item-cell a:hover { color: var(--accent-strong); text-decoration: underline; }
.stock { color: var(--accent-strong); font-weight: 600; }
.pill-bad { color: var(--bad); border: 1px solid #fca5a5; background: #fef2f2; border-radius: 999px; font-size: 11.5px; padding: 2px 8px; }
.more { display: block; text-align: center; padding: 14px; font-size: 13px; color: var(--accent-strong); border-top: 1px solid var(--border); }

.donut { --p: 0; width: 120px; height: 120px; margin: 22px auto; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent-bar) calc(var(--p) * 1%), #eef0f4 0); }
.donut > div { width: 96px; height: 96px; border-radius: 50%; background: var(--surface); display: grid; place-content: center; text-align: center; }
.donut strong { font-size: 20px; }
.donut span { font-size: 12px; color: #6b7280; }
.stat-list { margin: 0; font-size: 14px; }
.stat-list > div { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; }
.stat-list > div.sep { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 12px; }
.stat-list dd { margin: 0; font-weight: 600; display: flex; gap: 8px; align-items: center; }

@media (max-width: 1020px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .grid-3 { grid-template-columns: 1fr; }
  .kpi-value { font-size: 18px; }
  .bars-chart .bar-row { grid-template-columns: 110px 1fr; }
  .chart-wrap { height: 240px; }
  .oa-head { margin-top: 24px; }
}

/* ===== Store inventory ===== */
.inv-title { margin-bottom: 18px; }
.inv-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; font-size: 13.5px; }
.inv-bar .muted { display: flex; align-items: center; gap: 8px; }
.btn-light { display: inline-block; border: 1px solid #d1d5db; background: var(--surface); border-radius: 6px; padding: 4px 10px; font-size: 13px; font-weight: 600; color: var(--text); }
.btn-light:hover { border-color: var(--accent); }
.inv-actions { display: flex; align-items: center; gap: 18px; }
.link-btn { background: none; border: 0; font: inherit; font-size: 13.5px; color: #374151; cursor: pointer; padding: 0; }
.link-btn:hover { color: var(--accent-strong); }
.settings-menu { padding: 10px 12px; min-width: 180px; }
.settings-menu label { display: flex; gap: 8px; align-items: center; font-size: 13.5px; padding: 4px 0; cursor: pointer; }

.filters { padding: 20px; margin-bottom: 18px; }
.f-row { display: grid; gap: 12px; margin-bottom: 12px; }
.f-top { grid-template-columns: 1fr 170px 170px; }
.f-3 { grid-template-columns: repeat(3, 1fr); }
.f-4 { grid-template-columns: repeat(4, 1fr); }
.filters input[type=search], .filters select, .filters input[type=number] {
  width: 100%; height: 34px; border: 1px solid #d1d5db; border-radius: 6px; padding: 0 10px; font: inherit; font-size: 13.5px; background: var(--surface); color: var(--text); min-width: 0; }
.filters select:focus, .filters input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.filters fieldset { border: 1px solid var(--border); border-radius: 6px; padding: 4px 12px 12px; margin: 0; display: flex; align-items: center; gap: 6px; color: #6b7280; min-width: 0; }
.filters legend { font-size: 12.5px; color: #374151; padding: 0 2px; }
.f-buttons { display: flex; justify-content: flex-end; align-items: center; gap: 16px; font-size: 13.5px; }
.btn-inline { width: auto; padding: 8px 18px; }

.inv-card { padding: 0 20px 8px; margin-bottom: 14px; }
.inv-tabs { display: flex; border-bottom: 1px solid var(--border); overflow-x: auto; }
.inv-tabs a { flex: 1; text-align: center; padding: 16px 12px 12px; font-size: 13.5px; color: #4b5563; border-bottom: 2px solid transparent; white-space: nowrap; }
.inv-tabs a.on { color: var(--accent-strong); border-bottom-color: var(--accent); font-weight: 600; }
.inv-total { display: grid; grid-template-columns: 1fr 1fr 1fr; background: #eef0f4; margin: 18px 0 0; border-radius: 4px; font-size: 14px; }
.inv-total > * { padding: 12px 8px; text-align: center; line-height: 1.5; }
.inv-total > strong { text-align: left; align-self: center; font-size: 15px; }
.inv-total > div + div, .inv-total > strong + div { border-left: 2px solid #fff; }
.inv-total small { color: #6b7280; font-size: 11.5px; margin-left: 4px; }
.inv-tbl th { background: none; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text); padding: 12px 8px; }
.inv-tbl th a.on, .inv-tbl th a:hover { color: var(--accent-strong); }
.inv-tbl td { padding: 10px 8px; }
.inv-tbl .item-cell a { font-size: 13.5px; }
.tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.tag { font-size: 11px; border-radius: 4px; padding: 1px 6px; }
.tag-gray { background: #eef0f4; color: #374151; }
.tag-red { background: #fdecec; color: var(--bad); }
.tag-plain { border: 1px solid var(--border); color: #4b5563; }
.diff.low { color: #2563eb; }
.diff.high { color: #c2410c; }
.inv-tbl.hide-condition .col-condition, .inv-tbl.hide-qty .col-qty, .inv-tbl.hide-price .col-price,
.inv-tbl.hide-avg .col-avg, .inv-tbl.hide-diff .col-diff, .inv-tbl.hide-value .col-value { display: none; }
.pager { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; padding: 14px 0 10px; border-top: 1px solid var(--border); }
.pager nav { display: flex; gap: 4px; }
.pager a, .pager .gap { min-width: 30px; height: 30px; display: grid; place-items: center; border-radius: 5px; font-size: 13px; padding: 0 6px; }
.pager a { border: 1px solid var(--border); }
.pager a.on { background: var(--accent-bar); border-color: var(--accent-bar); color: #fff; font-weight: 600; }
.legend { margin: 0 0 40px; }

@media (max-width: 760px) {
  .f-top, .f-3, .f-4 { grid-template-columns: 1fr 1fr; }
  .f-top input[type=search] { grid-column: 1 / -1; }
  .inv-total { grid-template-columns: 1fr 1fr; }
  .inv-total > strong { grid-column: 1 / -1; padding-bottom: 0; }
  .inv-total > strong + div { border-left: 0; }
  .inv-card { padding: 0 12px 8px; }
}

/* ===== Account en Guides ===== */
.alert-ok { background: #e9f9ee; color: #166534; }
.link { color: var(--accent-strong); text-decoration: underline; }
.account-grid { grid-template-columns: 1fr 1fr; }
.guide { max-width: 760px; }
.guide .card { margin-bottom: 16px; font-size: 14.5px; }
.guide p { margin: 8px 0; color: #374151; }
.guide pre { background: #f4f6fa; border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; overflow-x: auto; font-size: 13px; }
.guide code { background: #f4f6fa; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
@media (max-width: 760px) { .account-grid { grid-template-columns: 1fr; } }
.settings-card { margin-bottom: 18px; }
.settings-card h3 { margin-bottom: 12px; }
.settings-card h4 { margin: 20px 0 6px; font-size: 14px; }
.settings-card .form select { display: block; width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 6px; font: inherit; background: var(--surface); }
.settings-card .form input:disabled { background: #f4f6fa; color: #6b7280; }
.help { margin: -8px 0 14px; }
.help-list { padding-left: 18px; color: #374151; margin: 0; }
.help-list li { margin-bottom: 4px; }
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.limit-form { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 16px; }
.link-btn.danger { color: var(--bad); }
.flash { margin-top: 18px; }

/* ===== BrickBrix-huisstijl ===== */
.topbar { border-top: 3px solid var(--accent); }
.logo-img { width: 34px; height: 34px; object-fit: contain; flex: none; }
.logo-text { font-size: 18px; font-weight: 700; letter-spacing: -.01em; color: #1d1d1b; }
.logo-text b { color: var(--accent); font-weight: 800; }
.logo-auth { flex-direction: column; gap: 10px; }
.logo-auth img { width: 78px; height: auto; }
.logo-auth .logo-text { font-size: 26px; }
.tile-title { color: var(--text); }
.tile:hover .tile-title { color: var(--accent); }
.btn { letter-spacing: .01em; }
