[hidden] { display: none !important; }

:root {
  --navy: #12355b;
  --navy-2: #0c2742;
  --accent: #1f8a70;
  --accent-soft: #e3f3ee;
  --blue: #2d6cdf;
  --amber: #d98e04;
  --amber-soft: #fdf3dc;
  --red: #c8442f;
  --red-soft: #fbe7e3;
  --green: #1f8a70;
  --green-soft: #e3f3ee;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1c2733;
  --muted: #64748b;
  --line: #e3e8ef;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.45; }
a { color: var(--blue); }
button, select, input { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; }

.layout { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #dbe5f1; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 20px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark {
  width: 40px; height: 40px; border-radius: 10px; background: #fff; color: var(--navy);
  display: grid; place-items: center; font-weight: 800; font-size: 13px; letter-spacing: -.3px;
}
.brand-name { color: #fff; font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 12px; opacity: .7; }
.nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .5; padding: 14px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  color: #dbe5f1; text-decoration: none; font-weight: 500;
}
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: rgba(255,255,255,.13); color: #fff; }
.nav-badge { margin-left: auto; font-size: 11px; background: rgba(255,255,255,.16); padding: 1px 7px; border-radius: 99px; }
.nav-badge:empty { display: none; }
.sidebar-foot { padding: 14px 20px; font-size: 12px; opacity: .75; display: flex; gap: 8px; align-items: center; border-top: 1px solid rgba(255,255,255,.08); }
.demo-pill { background: var(--amber); color: #2a1d00; font-weight: 700; padding: 1px 8px; border-radius: 99px; font-size: 11px; }

.ico { width: 18px; height: 18px; display: inline-block; background: currentColor; flex: none;
  -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
.ico-grid { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='3' y='3' width='7' height='7' rx='1.5'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1.5'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1.5'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1.5'/%3E%3C/svg%3E"); }
.ico-plug { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M9 2v6M15 2v6M6 8h12v4a6 6 0 0 1-12 0V8zM12 18v4'/%3E%3C/svg%3E"); }
.ico-truck { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M1 5h13v11H1zM14 9h4l4 4v3h-8z'/%3E%3Ccircle cx='5.5' cy='18.5' r='2'/%3E%3Ccircle cx='17.5' cy='18.5' r='2'/%3E%3C/svg%3E"); }
.ico-box { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M21 8l-9-5-9 5 9 5 9-5zM3 8v8l9 5 9-5V8M12 13v8'/%3E%3C/svg%3E"); }
.ico-hash { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 9h16M4 15h16M10 3L8 21M16 3l-2 18'/%3E%3C/svg%3E"); }
.ico-euro { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M18 6.5A7 7 0 1 0 18 17.5M4 10h10M4 14h10'/%3E%3C/svg%3E"); }
.ico-list { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01'/%3E%3C/svg%3E"); }

/* ---------- Top bar ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px; background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 28px; position: sticky; top: 0; z-index: 5;
}
.topbar-title { font-weight: 700; font-size: 17px; }
.topbar-right { margin-left: auto; display: flex; gap: 16px; align-items: center; }
.period { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
.period select, .field select, .field input, .search {
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; min-height: 36px;
}
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.menu-btn { display: none; }
.icon-btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; width: 36px; height: 36px; cursor: pointer; }

/* ---------- View ---------- */
.view { padding: 26px 28px 48px; max-width: 1440px; width: 100%; outline: none; }
.loading { color: var(--muted); padding: 40px 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 16px; }
.cols-2 { grid-template-columns: 1.6fr 1fr; }
.cols-2e { grid-template-columns: 1fr 1fr; }
.mb { margin-bottom: 16px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 0; }
.card-head h2 { font-size: 15px; }
.card-head .sub { color: var(--muted); font-size: 12px; }
.card-body { padding: 14px 18px 18px; }
.card-body.flush { padding: 10px 0 4px; }

.kpi { padding: 16px 18px; position: relative; }
.kpi-label { color: var(--muted); font-size: 12.5px; font-weight: 500; display: flex; gap: 6px; align-items: center; }
.kpi-value { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -.5px; }
.kpi-foot { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi.off .kpi-value { color: #b6c0cc; font-size: 15px; font-weight: 600; letter-spacing: 0; margin-top: 12px; }
.src { font-size: 10.5px; font-weight: 700; color: var(--muted); background: #eef2f6; border-radius: 5px; padding: 0 5px; letter-spacing: .03em; }
.delta-up { color: var(--green); font-weight: 600; }
.delta-down { color: var(--red); font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 14px; cursor: pointer;
  font-weight: 600; display: inline-flex; gap: 6px; align-items: center; text-decoration: none; color: var(--text); min-height: 36px;
}
.btn:hover { background: #f7f9fb; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #197560; }
.btn-danger { color: var(--red); }
.btn-sm { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--blue); cursor: pointer; font-weight: 600; }

/* ---------- Status ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-green { background: var(--green-soft); color: var(--green); }
.b-amber { background: var(--amber-soft); color: #9a6500; }
.b-red { background: var(--red-soft); color: var(--red); }
.b-blue { background: #e6eefc; color: var(--blue); }
.b-grey { background: #eef2f6; color: var(--muted); }

.status-strip { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 16px; }
.status-strip strong { margin-right: 6px; }
.chip { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px 3px 6px; font-size: 12.5px; background: #fff; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #c2cad4; }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafcff; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-size: 11px; fill: #7b8796; }
.chart .grid-line { stroke: #edf1f5; }
.chart .area { fill: url(#areaGrad); }
.hbars { display: grid; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: 140px 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.hbar-track { background: #eef2f6; border-radius: 99px; height: 10px; overflow: hidden; }
.hbar-fill { background: var(--accent); height: 100%; border-radius: 99px; width: 0; transition: width .5s ease; }
.hbar-fill.alt { background: var(--blue); }
.hbar-fill.warn { background: var(--amber); }
.hbar-val { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 70px; text-align: right; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.status-bars { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: #eef2f6; margin: 6px 0 12px; }
.status-bars span { display: block; height: 100%; }
.sb-Geleverd { background: var(--green); }
.sb-Onderweg { background: var(--blue); }
.sb-Gepland { background: #9fb3c8; }
.sb-Vertraagd { background: var(--red); }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 34px 20px; color: var(--muted); }
.empty-ico { width: 46px; height: 46px; border-radius: 12px; margin: 0 auto 12px; background: #eef2f6; display: grid; place-items: center; color: #8a97a8; }
.empty-ico .ico { width: 22px; height: 22px; }
.empty h3 { color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty p { margin: 0 auto 14px; max-width: 420px; }
.empty-page { padding: 60px 20px; }

/* ---------- Connectors ---------- */
.conn-summary { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); margin-bottom: 22px; }
.conn-group { margin-bottom: 26px; }
.conn-group h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.conn-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.conn { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.conn.connected { border-color: #bfe3d7; }
.conn-top { display: flex; gap: 12px; align-items: flex-start; }
.conn-logo { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #fff; background: #7b8796; flex: none; letter-spacing: .02em; }
.conn-logo.c-Logistiek { background: var(--navy); }
.conn-logo.c-Verkoop { background: var(--blue); }
.conn-logo.c-Financieel { background: var(--accent); }
.conn-logo.c-Overig { background: #6d5bd0; }
.conn-title { font-weight: 700; font-size: 15px; }
.conn-ds { color: var(--muted); font-size: 13px; }
.conn-top .badge { margin-left: auto; }
.conn-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; font-size: 12.5px; background: #f8fafc; border-radius: 8px; padding: 10px 12px; }
.conn-meta dt { color: var(--muted); }
.conn-meta dd { margin: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.conn-feeds { font-size: 12px; color: var(--muted); }
.conn-feeds b { color: var(--accent); }
.conn-new { border: 2px dashed #cfd8e3; box-shadow: none; background: transparent; align-items: center; justify-content: center; text-align: center; min-height: 230px; cursor: pointer; color: var(--muted); }
.conn-new:hover { border-color: var(--accent); color: var(--accent); background: #fbfefd; }
.conn-new .plus { font-size: 30px; line-height: 1; font-weight: 300; }

/* ---------- Modal ---------- */
.modal { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(15, 30, 50, .25); color: var(--text); }
.modal::backdrop { background: rgba(12, 28, 48, .45); }
.modal-head { padding: 20px 22px 0; display: flex; gap: 12px; align-items: center; }
.modal-head h2 { font-size: 17px; }
.modal-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.modal-body { padding: 18px 22px; display: grid; gap: 14px; }
.modal-foot { padding: 14px 22px 20px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); }
.modal-foot .left { margin-right: auto; }
.field { display: grid; gap: 5px; }
.field label { font-weight: 600; font-size: 13px; }
.field .hint { color: var(--muted); font-size: 12px; }
.field input, .field select { width: 100%; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.test-result { border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.test-result.ok { background: var(--green-soft); color: #145c4b; }
.test-result.fail { background: var(--red-soft); color: #8f2a1b; }
.test-result ul { margin: 6px 0 0; padding-left: 18px; }
.steps { list-style: none; padding: 0; margin: 4px 0; display: grid; gap: 10px; }
.steps li { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.steps li::before { content: ""; width: 18px; height: 18px; border-radius: 50%; border: 2px solid #cfd8e3; flex: none; }
.steps li.busy { color: var(--text); }
.steps li.busy::before { border-color: var(--accent); border-right-color: transparent; animation: spin .8s linear infinite; }
.steps li.done { color: var(--text); }
.steps li.done::before { background: var(--accent); border-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }
.form-error { color: var(--red); font-size: 13px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--navy-2); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); font-size: 13.5px; max-width: 360px; animation: toast-in .2s ease; }
.toast.error { background: var(--red); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Activity ---------- */
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: grid; grid-template-columns: 130px 120px 1fr; gap: 14px; padding: 11px 18px; border-bottom: 1px solid var(--line); align-items: center; }
.activity li:last-child { border-bottom: 0; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 18px 0; }
.toolbar .search { min-width: 240px; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }

@media (max-width: 1100px) {
  .cols-2, .cols-2e { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 20; width: 260px; transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-block; }
  .topbar { padding: 0 16px; }
  .view { padding: 18px 16px 40px; }
  .period span { display: none; }
  .activity li { grid-template-columns: 1fr; gap: 4px; }
  .hbar-row { grid-template-columns: 100px 1fr auto; }
}
