/* dashboard.css — desktop dashboard layout */

body.dashboard {
  display: grid;
  grid-template-columns: 228px 1fr;
  min-height: 100vh;
}

/* ── sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--line);
}
.sidebar .brand-logo {
  width: 100%;
  max-height: 64px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 5px 8px;
}
.sidebar .brand-mark {
  width: 34px; height: 34px; flex: none;
  border-radius: 7px;
  background: linear-gradient(160deg, var(--amber) 0%, #E08A00 100%);
  display: grid; place-items: center;
  color: #17130A; font-family: var(--font-head); font-weight: 800; font-size: 16px;
}
.sidebar .brand h1 { font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; line-height: 1.25; }
.sidebar .brand p { margin: 0; font-size: 10px; color: var(--ink-dim); letter-spacing: .08em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-dim);
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .03em;
  text-decoration: none;
  border-left: 2px solid transparent;
}
.nav a:hover { color: var(--ink); background: var(--panel-2); text-decoration: none; }
.nav a.active {
  color: var(--amber);
  background: var(--amber-dim);
  border-left-color: var(--amber);
}
.nav a .ico { width: 18px; text-align: center; flex: none; opacity: .9; }
.nav a.admin-only[hidden] { display: none; }

.sidebar .side-foot {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--ink-dim);
}
.sidebar .side-foot a { color: var(--ink-dim); }

/* ── topbar + content ──────────────────────────────────────────────────── */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.topbar h2 { font-size: 17px; font-weight: 700; letter-spacing: .02em; }
.badge-readonly {
  display: none;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
}
body[data-role="monteur"] .badge-readonly { display: inline-flex; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: auto;
}
.user-chip .avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 12px;
  color: var(--amber);
}
.user-chip .who { line-height: 1.15; }
.user-chip .who b { display: block; font-size: 13px; font-weight: 600; }
.user-chip .who span { font-size: 11px; color: var(--ink-dim); text-transform: capitalize; }

.content { padding: 22px 24px 40px; display: none; }
.content.active { display: block; }

/* role gating: management-only controls disappear for monteur */
body[data-role="monteur"] .beheer-only { display: none !important; }
body:not([data-role="admin"]) .admin-only { display: none !important; }

/* ── KPI strip ─────────────────────────────────────────────────────────── */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px 12px;
  overflow: hidden;
}
.kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--kpi-accent, var(--ink-dim));
}
.kpi .kpi-num {
  font-family: var(--font-head);
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.kpi .kpi-label { margin-top: 2px; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim); }
.kpi.k-amber { --kpi-accent: var(--amber); }
.kpi.k-red   { --kpi-accent: var(--red); }
.kpi.k-red .kpi-num { color: var(--red); }
.kpi.k-blue  { --kpi-accent: var(--blue); }
.kpi.k-green { --kpi-accent: var(--green); }

/* ── dashboard panels grid ─────────────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }
.dash-grid .span-2 { grid-column: 1 / -1; }

/* live feed */
.feed { display: flex; flex-direction: column; }
.feed-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.feed-item:last-child { border-bottom: 0; }
.feed-item .when { margin-left: auto; flex: none; color: var(--ink-dim); font-family: var(--font-mono); font-size: 11px; }
.feed-item.fresh { animation: feed-in .5s ease-out; }
@keyframes feed-in { from { background: var(--amber-dim); } }

/* ── toolbars boven tabellen ───────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.toolbar input[type="search"] { max-width: 260px; }
.toolbar select { width: auto; min-width: 140px; }
.toolbar input[type="date"] { width: auto; }

/* stock table article grouping */
tr.article-row td { background: var(--panel); font-weight: 600; }
tr.article-row td:first-child { border-left: 2px solid var(--amber); }
tr.loc-row td { color: var(--ink); }
tr.loc-row td:first-child { padding-left: 26px; }

/* detail drawer inside artikel-modal */
.subtable-title { margin: 6px 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); }

/* zone groepen (locaties) */
.zone-block { margin-bottom: 20px; }
.zone-block > h3 { margin-bottom: 8px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); }

/* instellingen: user table roles */
select.role-select { width: 130px; }

/* pagination */
.pager { display: flex; align-items: center; gap: 10px; margin-top: 12px; }

/* ══ LABELS PRINT ═══════════════════════════════════════════════════════ */
#print-root { display: none; }

@media print {
  body.printing-labels > *:not(#print-root) { display: none !important; }
  body.printing-labels { display: block; background: #fff; }
  body.printing-labels #print-root { display: block; }

  .label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1mm;
    background: #fff;
    color: #000;
    overflow: hidden;
    page-break-inside: avoid;
    text-align: center;
  }
  .label svg { max-width: 100%; }
  .label .label-code { font-family: var(--font-mono); font-weight: 600; }
  .label .label-name { font-family: var(--font-head); font-weight: 600; }

  /* article label follows the WACS layout: SKU big top-left, description
     below, barcode bottom-right, stock location bottom-left */
  .label.label-article {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto 1fr;
    column-gap: 2mm;
    align-items: start;
    text-align: left;
  }
  .label-article .label-sku {
    grid-column: 1 / -1;
    font-family: var(--font-head);
    font-weight: 800;
    line-height: 1.05;
  }
  .label-article .label-name {
    grid-column: 1 / -1;
    font-weight: 400;
    line-height: 1.15;
  }
  .label-article .label-loc {
    grid-column: 1;
    grid-row: 3;
    align-self: end;
    font-family: var(--font-mono);
    white-space: nowrap;
  }
  .label-article svg {
    grid-column: 2;
    grid-row: 3;
    justify-self: end;
    align-self: center;
  }

  /* roll 38×90 mm: one label per page */
  #print-root.fmt-roll .label {
    width: 90mm;
    height: 38mm;
    padding: 2mm 3mm;
    page-break-after: always;
  }
  #print-root.fmt-roll .label-article .label-sku { font-size: 17pt; }
  #print-root.fmt-roll .label-article .label-name { font-size: 9.5pt; }
  #print-root.fmt-roll .label-article .label-loc { font-size: 9pt; }
  #print-root.fmt-roll .label .label-name { font-size: 9pt; }
  #print-root.fmt-roll .label .label-code { font-size: 8pt; }
  #print-root.fmt-roll .label.label-location .label-code { font-size: 16pt; }
  #print-root.fmt-roll .label .label-zone { font-size: 8pt; color: #333; }

  /* A4 sheet 3×8 = 24 labels (70×36 mm cells) */
  #print-root.fmt-a4 { display: grid !important; grid-template-columns: repeat(3, 70mm); justify-content: center; }
  #print-root.fmt-a4 .label {
    width: 70mm;
    height: 36mm;
    padding: 2mm;
    border: .1mm dotted #bbb;
  }
  #print-root.fmt-a4 .label-article .label-sku { font-size: 13pt; }
  #print-root.fmt-a4 .label-article .label-name { font-size: 8pt; }
  #print-root.fmt-a4 .label-article .label-loc { font-size: 7.5pt; }
  #print-root.fmt-a4 .label .label-name { font-size: 8pt; }
  #print-root.fmt-a4 .label .label-code { font-size: 7pt; }
  #print-root.fmt-a4 .label.label-location .label-code { font-size: 14pt; }
  #print-root.fmt-a4 .label .label-zone { font-size: 7pt; color: #333; }
}

/* ── responsive fallback (dashboard is desktop-first) ─────────────────── */
@media (max-width: 860px) {
  body.dashboard { grid-template-columns: 64px 1fr; }
  .sidebar .brand h1, .sidebar .brand p, .nav a span.txt, .side-foot { display: none; }
  .nav a { justify-content: center; padding: 10px 0; }
  .content, .topbar { padding-left: 14px; padding-right: 14px; }
}
