@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;700&display=swap");

:root {
  --bg: #e9e7e2;
  --bg-2: #dedbd4;
  --panel: #f6f5f2;
  --ink: #17181a;
  --ink-2: #4a4c50;
  --ink-3: #85878b;
  --line: #c9c6be;
  --line-2: #d9d6cf;
  --accent: #570154;
  --accent-2: #74136f;
  --brand-purple: #570154;
  --brand-yellow: #ffe800;
  --accent-ink: #fff;
  --yellow: #ffe800;
  --green: #1f9d55;
  --blue: #2563eb;
  --red: #d92d20;
  --violet: #a05bc8;
  --teal: #0e7490;
  --radius: 4px;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.04), 0 6px 18px -10px rgba(0, 0, 0, 0.25);
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --display: "Montserrat", system-ui, sans-serif;
  --narrow: "Montserrat", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--display);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
/* subtle concrete texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .18 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body > * { position: relative; z-index: 1; }

a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  height: 60px;
  background: var(--brand-purple);
  color: #fff;
  border-bottom: 4px solid var(--brand-yellow);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 900;
  letter-spacing: -0.02em;
  font-size: 20px;
}
.brand b { color: var(--brand-yellow); }
.brand img { display: block; height: 40px; width: auto; }
.brand small {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a {
  text-decoration: none;
  font-family: var(--narrow);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 13px;
  padding: 8px 12px;
  color: rgba(255, 255, 255, 0.78);
  border-radius: var(--radius);
}
.nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }
.nav a.active { color: var(--brand-purple); background: var(--brand-yellow); }
.topbar .spacer { flex: 1; }

.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
}
.live .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(31, 157, 85, 0.7);
  animation: pulse 2s infinite;
}
.live.offline .dot { background: var(--red); animation: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(31, 157, 85, 0.6); }
  70% { box-shadow: 0 0 0 9px rgba(31, 157, 85, 0); }
  100% { box-shadow: 0 0 0 0 rgba(31, 157, 85, 0); }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px solid var(--ink);
  background: var(--panel);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 2px 2px 0 var(--ink);
  white-space: nowrap;
}
.btn:hover { background: #fff; }
.btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.btn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--ink); }
.btn.primary:hover { background: var(--accent-2); }
.btn.dark { background: var(--ink); color: #fff; }
.btn.ghost { box-shadow: none; border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(0,0,0,.06); }
.topbar .btn { border-color: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.08); color: #fff; box-shadow: none; }
.topbar .btn:hover { background: rgba(255, 255, 255, 0.18); }
.topbar .btn.primary { background: var(--brand-yellow); border-color: var(--brand-yellow); color: var(--brand-purple); }
.btn[disabled] { opacity: 0.55; cursor: wait; }
.btn.sm { padding: 5px 10px; font-size: 12px; }

/* ---------- KPI strip ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  border-bottom: 1.5px solid var(--ink);
  background: var(--panel);
}
.kpi {
  padding: 14px 20px 12px;
  border-right: 1px solid var(--line);
  position: relative;
}
.kpi:last-child { border-right: 0; }
.kpi .label {
  font-family: var(--narrow);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
  display: flex; align-items: center; gap: 7px;
}
.kpi .value {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 34px;
  line-height: 1.05;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.kpi.alert .value { color: var(--accent); }
.swatch { width: 9px; height: 9px; border-radius: 2px; display: inline-block; flex: none; }

/* ---------- status colours ---------- */
.st-nieuw { --c: var(--accent); }
.st-picken { --c: var(--blue); }
.st-wacht_op_voorraad { --c: var(--yellow); }
.st-ingepakt { --c: var(--teal); }
.st-verzonden { --c: var(--green); }
.st-geannuleerd { --c: var(--ink-3); }
.swatch { background: var(--c, var(--ink-3)); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  white-space: nowrap;
}
.pill.solid { background: var(--c, var(--ink)); border-color: var(--c, var(--ink)); color: #fff; }
.st-wacht_op_voorraad.pill.solid { color: var(--ink); }

/* ---------- forms ---------- */
.field { display: grid; gap: 5px; }
.field label {
  font-family: var(--narrow);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.input, textarea.input, select.input {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 11px;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}
.input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(255, 232, 0, 0.5); }
textarea.input { resize: vertical; min-height: 70px; }

/* ---------- drawer ---------- */
.scrim {
  position: fixed; inset: 0; background: rgba(40, 0, 38, 0.4);
  opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 40;
}
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(560px, 100vw);
  background: var(--panel);
  border-left: 2px solid var(--ink);
  z-index: 50;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head {
  padding: 18px 22px 14px;
  border-bottom: 1.5px solid var(--ink);
  display: flex; align-items: flex-start; gap: 12px;
}
.drawer-body { padding: 18px 22px 40px; overflow: auto; flex: 1; }
.drawer h2 { margin: 0; font-size: 26px; font-weight: 900; letter-spacing: -0.02em; }
.section-title {
  font-family: var(--narrow);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  margin: 22px 0 8px;
  display: flex; align-items: center; gap: 10px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: var(--radius);
  font-weight: 600; font-size: 14px; opacity: 0; transition: all 0.25s; z-index: 100;
  border-left: 4px solid var(--brand-yellow);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.banner {
  margin: 16px 22px 0;
  border: 1.5px solid var(--ink);
  background: var(--yellow);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  display: flex; gap: 12px; align-items: flex-start;
}
.banner b { font-weight: 800; }
.banner.red { background: #ffd9d4; }

.empty {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 22px 14px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
}

.skeleton {
  background: linear-gradient(90deg, var(--line-2) 0%, #ebe9e4 50%, var(--line-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
  border-radius: var(--radius);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.muted { color: var(--ink-3); }
.mono { font-family: var(--mono); }
kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line); border-bottom-width: 2px; padding: 0 5px; border-radius: 3px; background: #fff; }

@media (max-width: 720px) {
  .topbar { padding: 0 12px; gap: 10px; }
  .brand small, .live span { display: none; }
  .brand img { height: 32px; }
  .nav { margin-left: 0; }
  .nav a { padding: 7px 8px; font-size: 12px; }
  .kpi .value { font-size: 26px; }
}

/* Links styled as buttons, and hidden buttons */
a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.btn[hidden] { display: none !important; }
