/* ===============================================================
   Parts. Vormgeving geleend van technische onderdelencatalogi en
   de gegraveerde labeltjes op ladekasten: IBM Plex voor tekst en
   cijfers, koele grijzen, en één signatuurelement, de lade-tag.
   =============================================================== */

:root {
  --paper: #e7ebed;
  --surface: #ffffff;
  --surface-2: #f3f6f7;
  --ink: #10171d;
  --muted: #5d6b76;
  --line: #d5dce1;
  --line-soft: #e6ebee;
  --accent: #0d7c86;
  --accent-ink: #075a62;
  --accent-soft: #e0f0f1;
  --amber: #9c5b00;
  --amber-soft: #fbf0dd;
  --danger: #a32b1e;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(16, 23, 29, .06), 0 4px 14px rgba(16, 23, 29, .05);
  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --cond: "IBM Plex Sans Condensed", "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12181d;
    --surface: #1a2229;
    --surface-2: #202a32;
    --ink: #e7edf1;
    --muted: #9aabb6;
    --line: #2d3a44;
    --line-soft: #253039;
    --accent: #3fb6bf;
    --accent-ink: #7fd6dc;
    --accent-soft: #17343a;
    --amber: #e0a458;
    --amber-soft: #33280f;
    --danger: #e8776a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  padding-bottom: 4rem;
}

a { color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 14px;
}

/* --- Kop ------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.mark {
  display: flex;
  align-items: baseline;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}

.mark strong {
  font-family: var(--cond);
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.mark span {
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--muted);
  letter-spacing: .04em;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
}

.search input {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  font-family: var(--sans);
  font-size: 16px;
  padding: 10px 38px 10px 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
  min-height: 44px;
}

.search input:focus {
  background: var(--surface);
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search .glass,
.search .clear {
  position: absolute;
  color: var(--muted);
  line-height: 1;
}

.search input::-webkit-search-decoration,
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }

.search .glass { left: 12px; pointer-events: none; }

.search .clear {
  right: 6px;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 8px 10px;
  color: var(--muted);
}

/* --- Balk met totalen ------------------------------------------ */

.summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 18px;
  padding: 12px 0 10px;
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--muted);
  letter-spacing: .01em;
}

.summary b {
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.summary .spacer { flex: 1 1 auto; }

.select-sm {
  font-family: var(--mono);
  font-size: .76rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 10px;
  min-height: 36px;
  cursor: pointer;
}

.select-sm:hover { border-color: var(--accent); }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* --- Filterchips ----------------------------------------------- */

.chipbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 12px;
}

.chip {
  font-family: var(--mono);
  font-size: .76rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 13px;
  cursor: pointer;
  text-decoration: none;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color .12s, background .12s, color .12s;
}

.chip:hover { border-color: var(--accent); color: var(--accent-ink); }

.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .chip[aria-pressed="true"] { color: #0d1418; }
  .btn-primary, .btn-primary:hover { color: #0d1418; }
}

.chip small { opacity: .6; }

.chipgroup { display: none; }
.chipgroup.open { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }

.chipgroup-label {
  width: 100%;
  font-family: var(--mono);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin: 2px 0 -2px;
}

/* --- De lade-tag: het signatuurelement ------------------------- */

.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 4px 10px 4px 8px;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 0 100%);
  text-decoration: none;
  white-space: nowrap;
}

a.tag:hover { border-left-color: var(--accent-ink); background: var(--accent-soft); }

.tag.tag-empty { border-left-color: var(--line); color: var(--muted); }

/* --- Lijst ----------------------------------------------------- */

.list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.row {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  grid-template-areas:
    "thumb main qty"
    "thumb meta qty";
  align-items: center;
  gap: 2px 10px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
}

.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row.is-hidden { display: none; }

.row-thumb {
  grid-area: thumb;
  width: 52px;
  height: 52px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  display: grid;
  place-items: center;
}

.row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.row-thumb .placeholder {
  font-family: var(--mono);
  font-size: .62rem;
  color: var(--muted);
  letter-spacing: .08em;
}

.row-main { grid-area: main; min-width: 0; }

.row-title {
  margin: 0;
  font-size: .96rem;
  font-weight: 500;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.row-title a { color: inherit; text-decoration: none; }

.row-title a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.row-meta {
  grid-area: meta;
  margin: 2px 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 9px;
  font-size: .78rem;
  color: var(--muted);
  min-width: 0;
}

.row-meta .price-inline {
  font-family: var(--mono);
  font-size: .74rem;
  font-variant-numeric: tabular-nums;
}

.row-meta .tag { padding: 2px 8px 2px 6px; font-size: .68rem; }

.row-meta .code {
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--muted);
}

.row-meta .cat { color: var(--accent-ink); }

.row-side {
  grid-area: qty;
  cursor: default;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 2;
}

.row-price {
  font-family: var(--mono);
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
  min-width: 76px;
  text-align: right;
  display: none;
}

.row-loc { display: none; }

/* Aantal met plus en min, het meest gebruikte knopje bij de kast */

.stepper {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.stepper button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
  width: 34px;
  min-height: 40px;
  cursor: pointer;
  font-family: var(--mono);
}

.stepper button:hover { background: var(--accent-soft); color: var(--accent-ink); }
.stepper button:disabled { opacity: .3; cursor: default; background: none; }

.stepper .count {
  min-width: 38px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: .92rem;
  font-variant-numeric: tabular-nums;
  border-left: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  padding: 0 4px;
}

.stepper.is-low .count { color: var(--amber); background: var(--amber-soft); }
.stepper.is-out .count { color: var(--danger); }
.stepper.is-saving { opacity: .55; }

/* --- Knoppen --------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  font-size: .9rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover { border-color: var(--accent); color: var(--accent-ink); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }

.btn-danger { color: var(--danger); border-color: var(--line); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }

.btn-sm { min-height: 38px; padding: 7px 12px; font-size: .84rem; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px 0;
}

.actions .spacer { flex: 1 1 auto; }

/* --- Formulieren ----------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-top: 18px;
}

.card h1 {
  font-family: var(--cond);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: .01em;
  margin: 0 0 4px;
}

.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-family: var(--mono);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: 5px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  min-height: 46px;
}

.field input[type="file"] { padding: 9px; background: var(--surface-2); }

.field textarea { min-height: 150px; line-height: 1.55; resize: vertical; }

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field .hint { font-size: .78rem; color: var(--muted); margin-top: 5px; }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 16px; }

.checkline {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: .9rem;
  margin: 14px 0;
}

.checkline input { width: 20px; height: 20px; accent-color: var(--accent); }

/* --- Meldingen -------------------------------------------------- */

.notice {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 16px 0;
  font-size: .9rem;
}

.notice-bad { border-left-color: var(--danger); }
.notice-warn { border-left-color: var(--amber); }

.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}

.empty strong {
  display: block;
  font-family: var(--cond);
  font-size: 1.15rem;
  color: var(--ink);
  margin-bottom: 6px;
}

/* --- Detailpagina ---------------------------------------------- */

.detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px;
  justify-content: space-between;
}

.detail-title {
  font-family: var(--cond);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
}

.detail-code {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--muted);
  margin: 4px 0 0;
}

.specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 20px 0;
  padding: 16px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.spec dt {
  font-family: var(--mono);
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: 3px;
}

.spec dd {
  margin: 0;
  font-size: .98rem;
  font-variant-numeric: tabular-nums;
}

.notes {
  white-space: pre-wrap;
  font-size: .92rem;
  line-height: 1.6;
  color: var(--ink);
}

.photo {
  margin: 18px 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
}

.photo img { width: 100%; height: auto; display: block; }

/* --- Inlogscherm ------------------------------------------------ */

.login-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
}

.login-card .mark { justify-content: center; margin-bottom: 20px; }

/* --- Groter scherm ---------------------------------------------- */

@media (min-width: 720px) {
  .topbar-inner { grid-template-columns: auto minmax(0, 520px) 1fr; }
  .grid-2 { grid-template-columns: 1fr 1fr; }

  .row {
    grid-template-columns: 52px minmax(0, 1fr) 132px auto;
    grid-template-areas:
      "thumb main loc qty"
      "thumb meta loc qty";
    gap: 2px 16px;
  }

  .row-loc { grid-area: loc; display: block; }
  .row-price { display: inline; }
  .row-meta .price-inline, .row-meta .tag { display: none; }
  .row-side { justify-content: flex-end; }
  .stepper button { width: 36px; }
  .specs { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media print {
  .topbar, .chipbar, .actions, .stepper button { display: none; }
  .list { box-shadow: none; }
}
