/* Lettertype Assistant (SIL Open Font License), zelf geserveerd zodat er geen verbinding met Google nodig is */
@font-face { font-family: 'Assistant'; font-style: normal; font-weight: 200 800; font-display: swap; src: url(/fonts/assistant-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Assistant'; font-style: normal; font-weight: 200 800; font-display: swap; src: url(/fonts/assistant-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* Collegged huisstijl: navy + geel + lichtblauw, font Assistant (zoals collegged.nl) */
:root {
  --navy: #1e2945;
  --navy-2: #2a3760;
  --yellow: #ffbf3f;
  --yellow-dark: #f0a91a;
  --blue: #5cb3e6;
  --cream: #faf3ef;
  --bg: #f3f3f3;
  --surface: #ffffff;
  --text: #1e2945;
  --muted: #5d6680;
  --line: #e2e4ea;
  --green: #1f9d63;
  --green-bg: #e3f6ec;
  --red: #c8372d;
  --red-bg: #fbe7e5;
  --amber-bg: #fff3d6;
  --blue-bg: #e4f2fb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(30, 41, 69, .06), 0 4px 16px rgba(30, 41, 69, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Assistant, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0 0 .5rem; font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
a { color: var(--navy); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.loading { padding: 4rem; text-align: center; color: var(--muted); }

/* Header */
.topbar {
  background: var(--navy);
  color: #fff;
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner {
  max-width: 1560px; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center; gap: 1.25rem; min-height: 64px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: #fff; }
.brand-logo { width: 42px; height: 42px; object-fit: contain; }
.brand-name { font-weight: 800; font-size: 1.25rem; letter-spacing: .06em; }
.brand-sub { font-size: .8rem; color: var(--yellow); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; display: block; margin-top: -4px; }
.nav { display: flex; gap: .15rem; flex-wrap: nowrap; white-space: nowrap; }
@media (max-width: 1250px) { .nav { flex-wrap: wrap; } }
.nav a {
  color: #d5dbeb; text-decoration: none; font-weight: 600; padding: .45rem .7rem; border-radius: 999px;
}
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.nav a.active { color: var(--navy); background: var(--yellow); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .75rem; font-size: .9rem; }
.topbar-right .who { color: #d5dbeb; }

.container { max-width: 1560px; margin: 0 auto; padding: 24px 16px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head p { margin: .25rem 0 0; }

/* Buttons */
.btn {
  font: inherit; font-weight: 700; cursor: pointer; border: 2px solid transparent;
  padding: .55rem 1.1rem; border-radius: 999px; display: inline-flex; align-items: center; gap: .4rem;
  text-decoration: none; line-height: 1.2; white-space: nowrap;
}
.btn-primary { background: var(--yellow); color: var(--navy); }
.btn-primary:hover { background: var(--yellow-dark); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-2); }
.btn-ghost { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn-ghost:hover { background: var(--navy); color: #fff; }
.btn-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .35); padding: .35rem .9rem; }
.btn-light:hover { border-color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: .3rem .75rem; font-size: .85rem; }
.btn-link { background: none; border: 0; color: var(--navy); font: inherit; font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* Cards / panels */
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1.25rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .75rem; flex-wrap: wrap; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.25rem; border-top: 5px solid var(--blue); }
.kpi.yellow { border-top-color: var(--yellow); }
.kpi.navy { border-top-color: var(--navy); }
.kpi.green { border-top-color: var(--green); }
.kpi-label { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kpi-value { font-size: 1.9rem; font-weight: 800; margin: .2rem 0; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .9rem; color: var(--muted); }

.hero {
  background: var(--navy); color: #fff; border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.25rem;
  display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
  border: 34px solid rgba(92, 179, 230, .18);
}
.hero h1 { color: #fff; }
.hero p { margin: .25rem 0 0; color: #d5dbeb; max-width: 60ch; }
.hero .pct-badge { background: var(--yellow); color: var(--navy); border-radius: 18px; padding: .9rem 1.2rem; text-align: center; position: relative; z-index: 1; }
.pct-badge strong { display: block; font-size: 2rem; line-height: 1; }
.pct-badge span { font-size: .8rem; font-weight: 700; }

.info { background: var(--blue-bg); border-left: 4px solid var(--blue); padding: .9rem 1rem; border-radius: 8px; margin-bottom: 1.25rem; font-size: .95rem; }
.info strong { color: var(--navy); }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -1.25rem; padding: 0 1.25rem; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { padding: .6rem .6rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr:hover { background: #fafbfd; }
tfoot td { font-weight: 800; border-top: 2px solid var(--navy); border-bottom: 0; }
.card-name { font-weight: 700; }
.card-meta { font-size: .82rem; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }

.badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.badge-consignment { background: var(--blue-bg); color: #1e6a98; }
.badge-sold { background: var(--green-bg); color: var(--green); }
.badge-returned { background: #eceef3; color: var(--muted); }
.badge-open { background: var(--amber-bg); color: #8a5a00; }
.badge-paid { background: var(--green-bg); color: var(--green); }
.pos { color: var(--green); font-weight: 700; }
.neg { color: var(--red); font-weight: 700; }

/* Forms */
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
input, select, textarea {
  font: inherit; color: var(--text); background: #fff; border: 1.5px solid var(--line); border-radius: 10px;
  padding: .5rem .7rem; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(92, 179, 230, .25); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--navy); }
.filters input[type=search] { flex: 1 1 220px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1rem; }
.form-grid .full { grid-column: 1 / -1; }
label.field { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; font-weight: 700; }
label.field span.hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
textarea { min-height: 90px; resize: vertical; }
.error { color: var(--red); background: var(--red-bg); padding: .6rem .8rem; border-radius: 8px; white-space: pre-wrap; font-size: .9rem; }

.bulkbar {
  position: sticky; bottom: 16px; background: var(--navy); color: #fff; border-radius: 999px; padding: .5rem .6rem .5rem 1.2rem;
  display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; box-shadow: 0 8px 30px rgba(30, 41, 69, .35); margin-top: 1rem;
}
.bulkbar input { width: 80px; padding: .3rem .5rem; }

/* Breakdown in sell modal */
.breakdown { background: var(--cream); border-radius: 12px; padding: 1rem; margin-top: 1rem; }
.breakdown-row { display: flex; justify-content: space-between; padding: .25rem 0; font-variant-numeric: tabular-nums; }
.breakdown-row.total { border-top: 2px solid var(--navy); margin-top: .35rem; padding-top: .5rem; font-weight: 800; }
.bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; margin: .6rem 0 .4rem; background: #eee; }
.bar > div { height: 100%; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: middle; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--navy); position: relative; overflow: hidden; }
.login-wrap::before, .login-wrap::after { content: ''; position: absolute; border-radius: 50%; }
.login-wrap::before { width: 420px; height: 420px; border: 60px solid rgba(255, 191, 63, .9); top: -160px; right: -160px; }
.login-wrap::after { width: 300px; height: 300px; border: 44px solid rgba(92, 179, 230, .35); bottom: -110px; left: -90px; }
.login-card { background: #fff; border-radius: 20px; padding: 2rem; width: 100%; max-width: 400px; position: relative; z-index: 1; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.login-card .brand { color: var(--navy); margin-bottom: 1.25rem; }
.login-card .brand-sub { color: var(--muted); }
.login-card form { display: flex; flex-direction: column; gap: .9rem; }
.login-card .btn { justify-content: center; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 26, 44, .55); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 640px; padding: 1.5rem; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal.wide { max-width: 1100px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; gap: 1rem; }
.modal-close { background: none; border: 0; font-size: 1.6rem; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.25rem; flex-wrap: wrap; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(150%); background: var(--navy); color: #fff; padding: .7rem 1.2rem; border-radius: 999px; font-weight: 700; transition: transform .25s, opacity .25s; z-index: 200; max-width: calc(100% - 32px); opacity: 0; pointer-events: none; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.err { background: var(--red); }

.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs button { font: inherit; font-weight: 700; border: 1.5px solid var(--line); background: #fff; color: var(--muted); padding: .35rem .9rem; border-radius: 999px; cursor: pointer; }
.tabs button.active { background: var(--navy); border-color: var(--navy); color: #fff; }

.consignor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.consignor-card h3 { margin-bottom: .2rem; }
.stat-line { display: flex; justify-content: space-between; padding: .2rem 0; font-size: .92rem; border-bottom: 1px dashed var(--line); }
.stat-line:last-of-type { border-bottom: 0; }

@media (max-width: 720px) {
  h1 { font-size: 1.4rem; }
  .form-grid { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .topbar-inner { gap: .5rem; padding-top: .5rem; padding-bottom: .5rem; }
  .nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .bulkbar { border-radius: 16px; }
  .kpi-value { font-size: 1.5rem; }
}

.nav-count { background: var(--red); color: #fff; border-radius: 999px; padding: 0 .45rem; font-size: .75rem; margin-left: .2rem; }
.nav a.active .nav-count { background: var(--navy); color: var(--yellow); }
code { background: #fff; padding: .1rem .35rem; border-radius: 4px; font-size: .85em; word-break: break-all; }
td input { padding: .3rem .45rem; }
td:has(> .card-name) { min-width: 200px; }

.lookup { background: #f4f6fa; border-radius: 8px; padding: 10px 12px; }
.lookup input { font-size: 1.05rem; }
.lookup-hit, .lookup-opt { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.lookup-opt { width: 100%; text-align: left; background: #fff; border: 1px solid #d8dde6; border-radius: 6px; padding: 4px 8px; cursor: pointer; }
.lookup-opt:hover { border-color: #1f3a5f; }

.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .8rem 1rem; padding: 12px; border: 2px solid #1f3a5f; border-radius: 8px; }
.quick label.field { font-size: .95rem; }
.quick input, .quick select { font-size: 1.1rem; font-weight: 600; }
.lookup-url { display: block; margin-top: 10px; font-size: .8rem; color: var(--muted); }
.lookup-url input { width: 100%; margin-top: 4px; font-size: .9rem; }
label.field.check { flex-direction: column; }
label.field.check input { width: auto; margin-right: .4rem; }

/* Inkoop */
input.cell { width: 6.5rem; text-align: right; padding: .3rem .4rem; }
input.cell.narrow { width: 4rem; }
input.cell.is-manual { border-color: #e0a800; background: #fffbea; }
.add-line { display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-size: 1.1rem; }
.deal-total { position: sticky; bottom: 0; box-shadow: 0 -4px 12px rgba(0,0,0,.08); }
.deal-stats { display: flex; flex-wrap: wrap; gap: 1.5rem 2.5rem; align-items: flex-end; }
.deal-stats > div { display: flex; flex-direction: column; }
.deal-stats strong { font-size: 1.25rem; }
.deal-stats .big strong { font-size: 2rem; color: #1f3a5f; }
.deal-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-top: .9rem; }
.deal-actions label.field { width: 11rem; }

.cm-link { font-size: .8rem; font-weight: 600; margin-left: .4rem; white-space: nowrap; }

/* Kaartafbeeldingen */
.card-line { display: flex; align-items: center; gap: .6rem; }
.thumb { width: 36px; height: 50px; object-fit: cover; border-radius: 3px; flex: none; background: #e9ebf0; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); }
.thumb-empty { display: inline-block; }
.thumb-pop { position: fixed; z-index: 300; width: 240px; height: auto; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); pointer-events: none; background: #e9ebf0; }

/* Menu: consignatie en inkoop als aparte groepen */
.nav-group { align-self: center; margin: 0 .15rem 0 .8rem; padding: .1rem .45rem; border-radius: 4px; font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: rgba(255, 255, 255, .85); }
.nav-group.g-empty { padding: 0; margin: 0 .3rem; border-left: 1px solid rgba(255, 255, 255, .25); height: 1.2rem; }
.nav-group.g-consignatie { background: rgba(92, 179, 230, .35); }
.nav-group.g-inkoop { background: rgba(255, 191, 63, .35); margin-left: .8rem; }
.nav a.s-inkoop.active { background: #ff8a3d; color: #fff; }

/* Paginakleur per onderdeel: blauw = consignatie, oranje = inkoop */
main[data-section] { position: relative; border-top: 5px solid transparent; padding-top: 30px; }
main[data-section]::before { position: absolute; top: -5px; left: 16px; padding: 3px 12px 4px; border-radius: 0 0 8px 8px; font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #fff; }
main[data-section=consignatie] { border-top-color: var(--blue); }
main[data-section=consignatie]::before { content: 'Consignatie'; background: #2f8fc9; }
main[data-section=inkoop] { border-top-color: #ff8a3d; }
main[data-section=inkoop]::before { content: 'Inkoop'; background: #e8691a; }
main[data-section=inkoop] .btn-primary { background: #ff8a3d; color: #fff; }
main[data-section=inkoop] .deal-stats .big strong { color: #e8691a; }

/* ===== Mobiel: compacter en rustiger ===== */
@media (max-width: 720px) {
  body { font-size: 15px; }
  h1 { font-size: 1.25rem; }
  h2 { font-size: 1.1rem; }
  h3 { font-size: 1rem; }
  /* 16px in velden voorkomt dat iOS inzoomt bij focus */
  input, select, textarea { font-size: 16px; padding: .5rem .6rem; }
  .lookup input, .quick input, .quick select { font-size: 16px; }
  input[type=checkbox] { width: 22px; height: 22px; }

  .brand-logo { width: 32px; height: 32px; }
  .brand-name { font-size: 1.05rem; }
  .brand-sub { display: none; }
  .topbar-inner { min-height: 0; padding: .4rem 12px; row-gap: .25rem; }
  .topbar-right { font-size: .8rem; gap: .5rem; }
  .topbar-right .who { display: none; }
  .nav { gap: .1rem; padding-bottom: .2rem; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: .35rem .65rem; font-size: .85rem; flex: none; }
  .nav-group { display: none; }

  .container { padding: 12px 12px 48px; }
  main[data-section] { padding-top: 24px; }
  main[data-section]::before { left: 12px; font-size: .65rem; padding: 2px 10px 3px; }
  .page-head { margin-bottom: .75rem; gap: .5rem; }
  .page-head p { font-size: .85rem; }

  .panel { padding: .85rem; margin-bottom: .75rem; border-radius: 12px; }
  .panel-head { margin-bottom: .5rem; gap: .5rem; }
  .table-wrap { margin: 0 -.85rem; padding: 0 .85rem; }
  .info { padding: .6rem .75rem; font-size: .85rem; margin-bottom: .75rem; }

  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-bottom: .75rem; }
  .kpi { padding: .6rem .75rem; border-top-width: 4px; }
  .kpi-label { font-size: .68rem; letter-spacing: .03em; }
  .kpi-value { font-size: 1.2rem; margin: .1rem 0; }
  .kpi-sub { font-size: .75rem; }
  .hero { padding: 1rem; margin-bottom: .75rem; }
  .hero::after { display: none; }
  .hero .pct-badge { padding: .5rem .8rem; justify-self: start; }
  .pct-badge strong { font-size: 1.4rem; }

  /* Knoppen: ruim genoeg om te raken, maar niet groot */
  .btn { padding: .5rem .9rem; font-size: .9rem; min-height: 40px; justify-content: center; }
  .btn-sm { padding: .35rem .7rem; font-size: .8rem; min-height: 34px; }
  .btn-light { min-height: 0; padding: .3rem .7rem; }
  .btn-row { gap: .4rem; }

  .filters { gap: .4rem; margin-bottom: .6rem; }
  .filters > * { flex: 1 1 140px; }
  .filters input[type=search] { flex: 1 1 100%; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-bottom: .6rem; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: none; padding: .35rem .8rem; font-size: .85rem; }

  /* Tabellen: kleiner en compacter, horizontaal scrollbaar */
  table { font-size: .82rem; }
  th, td { padding: .45rem .4rem; }
  th { font-size: .66rem; }
  td:has(> .card-name) { min-width: 150px; }
  .card-meta { font-size: .74rem; }
  .badge { font-size: .7rem; padding: .1rem .45rem; }
  .thumb { width: 28px; height: 39px; }
  input.cell { width: 5rem; font-size: 14px; }
  input.cell.narrow { width: 3.2rem; }
  td input, td select { font-size: 14px; }

  .consignor-grid { grid-template-columns: 1fr; gap: .6rem; }
  .stat-line { font-size: .85rem; }

  /* Formulieren */
  .form-grid { gap: .6rem; }
  label.field { font-size: .8rem; gap: .2rem; }
  label.field span.hint { font-size: .72rem; }
  .quick { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 8px; gap: .5rem; }
  .quick label.field { font-size: .8rem; }
  .lookup { padding: 8px 10px; }
  .lookup-opt { padding: 6px 8px; }
  textarea { min-height: 64px; }

  /* Modals: bijna schermvullend als sheet, kop en knoppen blijven zichtbaar */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal, .modal.wide {
    max-width: none; border-radius: 16px 16px 0 0; padding: 1rem .9rem 0;
    max-height: 94vh; max-height: 94dvh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  .modal-head { position: sticky; top: 0; background: #fff; z-index: 2; margin: -1rem -.9rem .6rem; padding: .8rem .9rem .5rem; }
  .modal-head h2 { margin: 0; font-size: 1.05rem; }
  .modal-close { font-size: 1.8rem; padding: 0 .4rem; }
  .modal-foot {
    position: sticky; bottom: 0; background: #fff; z-index: 2; margin: .9rem -.9rem 0;
    padding: .6rem .9rem calc(.6rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); flex-wrap: nowrap;
  }
  .modal-foot .btn { flex: 1 1 auto; padding-left: .6rem; padding-right: .6rem; }
  .breakdown { padding: .7rem; margin-top: .7rem; }

  .bulkbar { bottom: 8px; padding: .4rem .6rem; gap: .4rem; font-size: .85rem; }
  .deal-stats { gap: .6rem 1.2rem; }
  .deal-stats strong { font-size: 1.05rem; }
  .deal-stats .big strong { font-size: 1.5rem; }
  .deal-actions label.field { width: 100%; }
  .deal-total { bottom: env(safe-area-inset-bottom); }
  .add-line { font-size: 1rem; }

  .toast { bottom: calc(16px + env(safe-area-inset-bottom)); font-size: .9rem; }
  .login-card { padding: 1.5rem 1.25rem; }
}

/* ===== Tablet (721–1100px) ===== */
@media (min-width: 721px) and (max-width: 1100px) {
  body { font-size: 15.5px; }
  .topbar-inner { gap: .5rem 1rem; min-height: 0; padding: .45rem 16px; }
  .brand-sub { display: none; }
  /* menu op één eigen rij, horizontaal scrollbaar i.p.v. over meerdere regels */
  .nav { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: .2rem; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: none; padding: .4rem .75rem; font-size: .92rem; }
  .nav-group { display: none; }
  .container { padding: 18px 16px 56px; }
  .panel { padding: 1rem; }
  .table-wrap { margin: 0 -1rem; padding: 0 1rem; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; }
  .kpi { padding: .9rem 1rem; }
  .kpi-value { font-size: 1.6rem; }
  .consignor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  table { font-size: .88rem; }
  th, td { padding: .5rem .45rem; }
  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; }
  .modal-backdrop { padding: 3vh 16px; }
  .modal.wide { max-width: 960px; }
  .modal { max-height: 94vh; overflow-y: auto; }
  .modal-head { position: sticky; top: 0; background: #fff; z-index: 2; margin: -1.5rem -1.5rem .75rem; padding: 1rem 1.5rem .5rem; border-radius: 18px 18px 0 0; }
  .modal-foot { position: sticky; bottom: 0; background: #fff; margin: 1rem -1.5rem -1.5rem; padding: .7rem 1.5rem; border-top: 1px solid var(--line); border-radius: 0 0 18px 18px; }
  .deal-actions label.field { width: 10rem; }
}

/* Aanraakschermen: geen hover-zoom, grotere vinger-doelen, geen tap-vertraging */
@media (hover: none) {
  .nav a, .tabs button, .btn, .modal-close, button { touch-action: manipulation; }
  .tabs button { min-height: 36px; }
}

/* Overal: lange tekst breekt i.p.v. de pagina te verbreden; geen horizontale paginascroll */
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
.hint, .lookup-opt span { overflow-wrap: anywhere; }
/* in tabellen nooit 'anywhere': dat laat de kaartkolom tot 1-2 letters samenknijpen */
.card-name, .card-meta { overflow-wrap: break-word; }
.card-line > div { min-width: 0; }
td:has(.card-line) { min-width: 190px; }
img { max-width: 100%; }

/* Grote schermen: net wat meer lucht */
@media (min-width: 1600px) { .container { padding-left: 24px; padding-right: 24px; } }

/* ===== Mobiel: tabellen als kaartjes (data-label zet app.js) ===== */
@media (max-width: 720px) {
  .table-wrap { overflow-x: visible; margin: 0; padding: 0; }
  table, tbody, tfoot, tr, td { display: block; width: 100%; }
  thead { display: none; }
  table { font-size: .88rem; }
  tbody tr, tfoot tr {
    border: 1px solid var(--line); border-radius: 10px; padding: .45rem .7rem; margin-bottom: .55rem; background: #fff;
  }
  tbody tr:hover { background: #fff; }
  td, th { border-bottom: 0; padding: .2rem 0; }
  td { display: flex; justify-content: space-between; align-items: center; gap: .75rem; text-align: right; min-height: 1.6rem; }
  td[data-label]::before {
    content: attr(data-label); flex: none; text-align: left; font-size: .68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  }
  /* kaartnaam bovenaan als kop, zonder label */
  td:has(.card-line), td:has(> .card-name) { display: block; text-align: left; min-width: 0; padding: .1rem 0 .35rem; border-bottom: 1px solid var(--line); margin-bottom: .2rem; }
  td:has(.card-line)::before, td:has(> .card-name)::before { display: none; }
  td:empty { display: none; }
  td:has(> .btn), td:has(> .btn-row) { justify-content: flex-end; flex-wrap: wrap; padding-top: .35rem; }
  td:has(> .btn)::before { display: none; }
  td .card-line { align-items: center; }
  td .card-meta { text-align: left; }
  td input.cell { width: 6rem; }
  td input[type=checkbox] { margin-left: auto; }
  tfoot tr { background: var(--cream); border-color: var(--navy); }
  tfoot td { border-top: 0; }
  td.num, th.num { white-space: normal; }
}
@media (max-width: 720px) { td:has(.card-line), td:has(> .card-name) { min-width: 0; } .card-line > div { flex: 1 1 0; } }

[hidden] { display: none !important; }
.bulk-panel .quick { margin-bottom: .75rem; align-items: end; }
.bulk-panel .quick .field > .btn { margin-top: .3rem; }

/* Inklapbaar bulkpaneel */
details.panel > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before { content: '▸'; color: var(--muted); transition: transform .15s; }
details.panel[open] > summary::before { transform: rotate(90deg); }

/* Zoekblok: label boven het invoerveld, veld over de volle breedte */
.lookup > label:not(.lookup-url) { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; font-weight: 700; }
.lookup > label:not(.lookup-url) .hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
.lookup > label:not(.lookup-url) > input { width: 100%; }

/* Melding bij geen verbinding */
#offline-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 90;
  max-width: calc(100vw - 24px); padding: 10px 16px; border-radius: 999px; background: #1e2945; color: #fff; font-weight: 700; font-size: .9rem;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); text-align: center; }
#offline-bar[hidden] { display: none !important; }

/* Prijzen bijwerken: korte groene flits bij een opgeslagen rij */
tr.saved td { background: #e8f6ec; transition: background .6s; }

/* Inkoopbon */
.bon { color: #1e2945; }
.bon-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.bon-head h1 { margin: 0; font-size: 1.6rem; }
.bon-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1rem; }
.bon-label { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #5d6680; margin-bottom: .2rem; }
.bon-table { width: 100%; border-collapse: collapse; }
.bon-table th, .bon-table td { padding: .45rem .5rem; border-bottom: 1px solid #d9dce6; text-align: left; vertical-align: top; }
.bon-table th.num, .bon-table td.num { text-align: right; }
.bon-table tfoot td { border-bottom: 0; font-size: 1.1rem; padding-top: .8rem; }
.bon-meta { font-size: .8rem; color: #5d6680; }
.bon-text { font-size: .85rem; color: #5d6680; margin: 1.2rem 0; }
.bon-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-top: 2.5rem; font-size: .85rem; color: #5d6680; }
.bon-line { border-bottom: 1px solid #1e2945; height: 2.2rem; margin-bottom: .3rem; }
@media (max-width: 720px) { .bon-parties, .bon-sign { grid-template-columns: 1fr; } }
@media print {
  body > *:not(#modal-root) { display: none !important; }
  body { background: #fff !important; }
  #modal-root .modal-backdrop { position: static; display: block; padding: 0; background: none; overflow: visible; }
  #modal-root .modal { box-shadow: none; max-width: none; padding: 0; border-radius: 0; }
  #modal-root .modal-head, #modal-root .modal-foot { display: none !important; }
  .bon-parties, .bon-sign { grid-template-columns: 1fr 1fr; }
}

/* Juridische pagina's (voorwaarden, privacy) en links ernaar */
.legal-links { color: var(--muted); margin: 1rem 0 0; }
.legal-links a { color: var(--muted); }
.legal-body { background: var(--bg); }
.legal { max-width: 800px; margin: 1.5rem auto 3rem; padding: 0 16px; }
.legal article { background: var(--surface); border-radius: 18px; padding: 1.5rem 1.75rem; box-shadow: 0 1px 3px rgba(30, 41, 69, .08); line-height: 1.6; }
.legal h1 { margin: 0 0 .2rem; font-size: 1.7rem; }
.legal h2 { margin: 1.6rem 0 .4rem; font-size: 1.1rem; }
.legal p, .legal li { margin: .5rem 0; }
.legal ul { padding-left: 1.2rem; }
.legal .legal-meta { color: var(--muted); margin: 0 0 1rem; }
.legal-table { width: 100%; border-collapse: collapse; margin: .6rem 0; }
.legal-table th, .legal-table td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
mark.todo { background: #ffe9a8; color: #6b4a00; padding: 0 .25em; border-radius: 4px; font-weight: 700; }
@media (max-width: 720px) { .legal article { padding: 1.1rem 1rem; } .legal-table, .legal-table tbody, .legal-table tr, .legal-table td, .legal-table thead { display: block; } .legal-table thead { display: none; } .legal-table td { border: 0; padding: .2rem 0; } .legal-table tr { border-bottom: 1px solid var(--line); padding: .5rem 0; } }
