/* 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: 34px; height: 34px; }
.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:not(.thumb-empty):hover { position: relative; z-index: 5; transform: scale(3.2); transform-origin: left center; box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }

/* 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; }
