/* Van Emous huisstijl bovenop Bootstrap 5.3 — tokens uit het design system.
   Layout, grid, formulieren, tabellen en het mobiele menu komen uit Bootstrap;
   hier staan alleen de merkkleuren en de onderdelen die Bootstrap niet heeft. */
:root {
  --orange: #b95913;
  --orange-dark: #a24e11;
  --orange-tint: rgba(185, 89, 19, 0.1);
  --orange-tint-soft: rgba(185, 89, 19, 0.06);
  --orange-line: rgba(185, 89, 19, 0.35);
  --orange-focus: rgba(185, 89, 19, 0.25);
  --ink: #212121;
  --ink-muted: #5c6670;
  --white: #ffffff;
  --ultra-light: #f9faf5;
  --light: #f0f1ec;
  --blue: #dce4ee;
  --blue-light: #f1f4f8;
  --blue-dark: #a8bbd5;
  --line: rgba(0, 0, 0, 0.08);
  --control: #8f969c;
  --font-body: "Mukta", system-ui, -apple-system, sans-serif;
  --font-heading: "Kantumruy Pro", sans-serif;
  --radius-sm: 0.5rem;
  --radius-md: 1rem;
  --radius-lg: 1.25rem;
  --radius-pill: 50px;

  /* Bootstrap op de huisstijl zetten */
  --bs-body-font-family: var(--font-body);
  --bs-body-font-size: 1rem;
  --bs-body-line-height: 1.6;
  --bs-body-color: var(--ink);
  --bs-body-color-rgb: 33, 33, 33;
  --bs-body-bg: var(--ultra-light);
  --bs-heading-color: var(--ink);
  --bs-primary: #b95913;
  --bs-primary-rgb: 185, 89, 19;
  --bs-secondary-color: var(--ink-muted);
  --bs-border-color: var(--line);
  --bs-border-radius: var(--radius-sm);
  --bs-border-radius-lg: var(--radius-lg);
  --bs-border-radius-pill: var(--radius-pill);
  --bs-link-color: #b95913;
  --bs-link-color-rgb: 185, 89, 19;
  --bs-link-hover-color: #a24e11;
  --bs-link-hover-color-rgb: 162, 78, 17;
  --bs-focus-ring-color: var(--orange-focus);
  --bs-code-color: var(--ink);
}

html { font-variant-numeric: lining-nums tabular-nums; }
body { min-height: 100vh; }
h1, h2, h3 { font-family: var(--font-heading); font-weight: 500; line-height: 1.2; margin: 0 0 0.75rem; }
h1 { font-size: 2rem; line-height: 1.1; letter-spacing: -0.01em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; margin-top: 1.25rem; }
a { font-weight: 600; text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, .btn:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; box-shadow: none; }

/* ---------- app-layout: zijbalk (desktop) / uitschuifmenu (mobiel) ---------- */
.side-panel { --bs-offcanvas-width: 270px; --bs-offcanvas-bg: var(--white); }
.side .offcanvas-header img { width: 130px; }
.side .offcanvas-body { display: flex; flex-direction: column; gap: 0.25rem; }
.brand img { width: 170px; display: block; margin: 0 0.75rem 2rem; }
.side nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.side nav a, .side .logout { color: var(--ink); padding: 0.6rem 1rem; border-radius: var(--radius-pill); display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; white-space: nowrap; }
.side nav a:hover { background: var(--orange-tint-soft); text-decoration: none; }
.side nav a.active { background: var(--orange); color: var(--white); }
.side .logout { color: var(--ink-muted); }
.count { background: var(--orange-tint); color: var(--orange-dark); font-size: 0.75rem; padding: 0 0.5rem; border-radius: 999px; }
.active .count { background: var(--white); }

.topbar { position: sticky; top: 0; z-index: 1020; background: var(--white); border-bottom: 1px solid var(--line); padding: 0.6rem 1rem; display: flex; align-items: center; gap: 0.75rem; }
.topbar img { width: 120px; display: block; }
.topbar .menu-btn { border: 1px solid var(--line); background: var(--white); border-radius: var(--radius-pill); padding: 0.45rem 0.9rem; display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; color: var(--ink); }
.topbar .menu-btn svg { width: 20px; height: 20px; }
.topbar .count { margin-left: auto; }

.app-main { flex: 1; min-width: 0; }
.content { padding: 1.25rem 1rem 2rem; max-width: 1400px; }

@media (min-width: 992px) {
  .app { display: flex; min-height: 100vh; }
  .side { width: 240px; flex: none; position: sticky; top: 0; height: 100vh; background: var(--white); border-right: 1px solid var(--line); padding: 1.5rem 1rem; display: flex; flex-direction: column; }
  .side-panel { display: flex; flex-direction: column; }
  .side .offcanvas-body { flex-grow: 1; overflow-y: auto; }
  .content { padding: 2rem 2.5rem; }
}

/* ---------- paginakop en hulpklassen ---------- */
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.head h1 { margin: 0; overflow-wrap: anywhere; }
.kicker { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--orange); }
.label { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }
.muted { color: var(--ink-muted); }
.empty { color: var(--ink-muted); padding: 1rem 0; margin: 0; }
.hint { font-size: 0.875rem; color: var(--ink-muted); margin: 0.3rem 0 0; }
.actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-top: 1.25rem; }
.head .actions, .card-top .actions { margin: 0; }
form.inline { display: inline; }
.search input { width: 260px; }

@media (max-width: 767.98px) {
  h1 { font-size: 1.6rem; }
  .head { flex-direction: column; align-items: stretch; }
  .head .actions > * { flex: 1 1 auto; }
  .head .actions .btn, .head .actions .form-select { width: 100%; }
  .head .actions .search { flex-basis: 100%; }
  .search input { width: 100%; }
}

/* ---------- kaarten en kerncijfers ---------- */
.card { --bs-card-spacer-y: 1.5rem; --bs-card-spacer-x: 1.5rem; --bs-card-border-color: var(--line); --bs-card-border-radius: var(--radius-lg); --bs-card-inner-border-radius: calc(var(--radius-lg) - 1px); --bs-card-bg: var(--white); margin-bottom: 1.5rem; }
.card-body > :last-child { margin-bottom: 0; }
.card-grid > * > .card { margin-bottom: 0; height: 100%; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.card-top h2 { margin: 0; }
.card-top .actions { gap: 0.5rem; }
@media (max-width: 575.98px) {
  .card { --bs-card-spacer-y: 1.1rem; --bs-card-spacer-x: 1rem; }
}

.kpi { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.25rem 1.5rem; height: 100%; }
.kpi .value { font-family: var(--font-heading); font-weight: 600; font-size: 2rem; line-height: 1.1; margin: 0.35rem 0 0.15rem; white-space: nowrap; }

/* ---------- knoppen ---------- */
.btn { --bs-btn-font-family: var(--font-body); --bs-btn-font-weight: 600; --bs-btn-font-size: 15px; --bs-btn-line-height: 1.1; --bs-btn-padding-x: 1.4rem; --bs-btn-padding-y: 0.72rem; --bs-btn-border-radius: var(--radius-pill); --bs-btn-focus-box-shadow: 0 0 0 0.25rem var(--orange-focus); display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; white-space: nowrap; }
.btn-sm { --bs-btn-padding-x: 0.9rem; --bs-btn-padding-y: 0.45rem; --bs-btn-font-size: 14px; --bs-btn-border-radius: var(--radius-pill); }
.btn-primary { --bs-btn-color: #fff; --bs-btn-bg: #b95913; --bs-btn-border-color: #b95913; --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #a24e11; --bs-btn-hover-border-color: #a24e11; --bs-btn-active-color: #fff; --bs-btn-active-bg: #8f450f; --bs-btn-active-border-color: #8f450f; --bs-btn-disabled-color: #fff; --bs-btn-disabled-bg: #b95913; --bs-btn-disabled-border-color: #b95913; }
.btn-outline-primary { --bs-btn-color: #b95913; --bs-btn-bg: #fff; --bs-btn-border-color: var(--orange-line); --bs-btn-hover-color: #b95913; --bs-btn-hover-bg: var(--orange-tint-soft); --bs-btn-hover-border-color: #b95913; --bs-btn-active-color: #b95913; --bs-btn-active-bg: var(--orange-tint); --bs-btn-active-border-color: #b95913; --bs-btn-disabled-color: #b95913; --bs-btn-disabled-bg: #fff; --bs-btn-disabled-border-color: var(--orange-line); }
.btn-outline-secondary { --bs-btn-color: var(--ink-muted); --bs-btn-bg: #fff; --bs-btn-border-color: rgba(0, 0, 0, 0.12); --bs-btn-hover-color: var(--ink); --bs-btn-hover-bg: var(--light); --bs-btn-hover-border-color: rgba(0, 0, 0, 0.2); --bs-btn-active-color: var(--ink); --bs-btn-active-bg: var(--light); --bs-btn-active-border-color: rgba(0, 0, 0, 0.2); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--ink-muted); font: 600 0.8rem var(--font-body); cursor: pointer; text-decoration: underline; }

/* ---------- formulieren ---------- */
.form-label { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.3rem; }
.form-control, .form-select { --bs-border-color: var(--control); font-size: 16px; line-height: 1.4; padding-top: 0.6rem; padding-bottom: 0.6rem; padding-left: 0.9rem; color: var(--ink); }
.form-control { padding-right: 0.9rem; }
.form-control-sm, .form-select-sm { font-size: 15px; padding-top: 0.45rem; padding-bottom: 0.45rem; padding-left: 0.6rem; }
.form-control-sm { padding-right: 0.6rem; }
textarea.form-control { min-height: 110px; resize: vertical; }
textarea.form-control-sm { min-height: 42px; }
input[type=file].form-control { border-style: dashed; }
.form-control:focus, .form-select:focus { border-color: var(--orange); box-shadow: 0 0 0 0.25rem var(--orange-focus); }
.form-check-input { border-color: var(--control); }
.form-check-input:checked { background-color: var(--orange); border-color: var(--orange); }
.form-check-input:focus { border-color: var(--orange); box-shadow: 0 0 0 0.25rem var(--orange-focus); }
.form-check-label { font-weight: 400; }

/* ---------- tabellen ---------- */
.table { --bs-table-bg: transparent; --bs-table-color: var(--ink); --bs-table-border-color: var(--line); --bs-table-hover-bg: var(--orange-tint-soft); --bs-table-hover-color: var(--ink); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: 0.7rem 0.75rem; vertical-align: top; }
.table > thead th { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); padding-top: 0.5rem; padding-bottom: 0.5rem; white-space: nowrap; }
.table > tbody > tr:last-child > * { border-bottom-width: 0; }
tr.link { cursor: pointer; }
.num { text-align: right; white-space: nowrap; }
.thumb-sm { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: var(--blue); display: block; }
tr.unread td { font-weight: 600; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); margin-right: 0.4rem; vertical-align: middle; }

/* mobiel: elke tabelrij wordt een blokje met label · waarde */
@media (max-width: 767.98px) {
  .table-stack thead { display: none; }
  .table-stack > tbody > tr { display: block; padding: 0.8rem 0; border-bottom: 1px solid var(--line); }
  .table-stack > tbody > tr:last-child { border-bottom: 0; }
  .table-stack > tbody > tr > td { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 0.1rem 0; border: 0; text-align: right; box-shadow: none; }
  .table-stack > tbody > tr > td::before { content: attr(data-label); flex: none; text-align: left; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }
  .table-stack > tbody > tr > td.stack-title { display: block; text-align: left; padding-bottom: 0.3rem; }
  .table-stack > tbody > tr > td.stack-title::before { content: none; }
  .table-stack > tbody > tr > td:empty { display: none; }
  .table-stack > tbody > tr.link:active { background: var(--orange-tint-soft); }
}

/* ---------- labels / statussen ---------- */
.chip { display: inline-block; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.15rem 0.65rem; border-radius: 999px; background: var(--blue); color: var(--ink); white-space: nowrap; }
.chip.nieuw, .chip.concept { background: var(--orange-tint); color: var(--orange-dark); }
.chip.offerte, .chip.verzonden { background: var(--blue-dark); }
.chip.gewonnen, .chip.geaccepteerd { background: var(--orange); color: var(--white); }
.chip.verloren, .chip.afgewezen { background: var(--light); color: var(--ink-muted); }

.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; align-items: center; }
.filters a { padding: 0.35rem 0.9rem; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); background: var(--white); font-size: 0.9rem; white-space: nowrap; }
.filters a:hover { border-color: var(--orange-line); text-decoration: none; }
.filters a.on { background: var(--orange); border-color: var(--orange); color: var(--white); }
.filters a.on .muted { color: inherit; }
@media (max-width: 767.98px) {
  /* filterknoppen horizontaal schuiven in plaats van vijf regels hoog */
  .filters { flex-wrap: nowrap; overflow-x: auto; margin-left: -1rem; margin-right: -1rem; padding: 0 1rem 0.25rem; scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .filters > * { flex: none; }
}

.flash { padding: 0.8rem 1.2rem; border-radius: var(--radius-md); background: var(--blue-light); border: 1px solid var(--blue); margin-bottom: 1rem; }
.flash.error { background: var(--orange-tint-soft); border-color: var(--orange-line); }

/* ---------- grafieken ---------- */
.bars { display: flex; flex-direction: column; gap: 0.6rem; }
.bar { display: grid; grid-template-columns: minmax(80px, 110px) 1fr 40px; gap: 0.75rem; align-items: center; color: var(--ink); font-weight: 400; }
.bar > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.bar:hover { text-decoration: none; color: var(--orange); }
.bar .track { display: block; background: var(--blue-light); border-radius: 999px; height: 10px; overflow: hidden; }
.bar .fill { display: block; background: var(--orange); height: 100%; border-radius: 999px; }
.cols { display: flex; align-items: flex-end; gap: 6px; height: 170px; }
.cols > div { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; font-size: 0.75rem; color: var(--ink-muted); }
.cols .c { width: 100%; background: var(--orange); border-radius: 6px 6px 0 0; min-height: 2px; }

/* ---------- contact- en relatiepagina ---------- */
dl.props { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.4rem 1rem; margin: 0; }
dl.props dt { color: var(--ink-muted); font-weight: 400; }
dl.props dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 0.8rem 0; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border: 0; }
.timeline .meta { font-size: 0.8125rem; color: var(--ink-muted); margin-bottom: 0.15rem; }
.timeline .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.file { border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; font-size: 0.8rem; background: var(--white); }
.file .thumb { aspect-ratio: 1; background: var(--blue); display: flex; align-items: center; justify-content: center; color: var(--ink); font-weight: 600; text-transform: uppercase; overflow: hidden; }
.file img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file .name { padding: 0.35rem 0.5rem 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.file form { padding: 0 0.5rem 0.35rem; }
.file .muted { padding: 0 0.5rem 0.35rem; font-size: 0.8rem; }
.viewer-frame { aspect-ratio: 16 / 10; min-height: 320px; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; background: var(--blue); }
.viewer-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
details summary { cursor: pointer; font-family: var(--font-heading); font-size: 1.3rem; font-weight: 500; }
details[open] summary { margin-bottom: 1rem; }
.mailbody { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.7; }
.members { display: grid; }
.member { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.member:last-child { border-bottom: 0; }

/* taken */
.task { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.task:last-of-type { border-bottom: 0; }
.task.done > div:first-of-type, .task.done .title { text-decoration: line-through; color: var(--ink-muted); }
.check { flex: none; width: 22px; height: 22px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--orange); background: var(--white); cursor: pointer; padding: 0; }
.check:hover, .task.done .check { background: var(--orange); }
.overdue { color: var(--orange-dark); font-weight: 600; }

/* contact/relatie op mobiel: gegevens bovenaan, de 3D-weergave en de rest daaronder */
@media (max-width: 991.98px) {
  .stack { display: flex; flex-direction: column; margin: 0; }
  .stack > * { display: contents; }
  .stack .o-1 { order: -3; }
  .stack .o-2 { order: -2; }
  .stack .o-3 { order: -1; }
  .viewer-frame { aspect-ratio: 4 / 5; min-height: 0; max-height: 70vh; }
}

/* ---------- offerte-editor ---------- */
.lines > :not(caption) > * > * { padding: 0.4rem 0.3rem; vertical-align: middle; }
.lines textarea.form-control { height: 42px; }
.totals { margin-left: auto; width: 320px; max-width: 100%; margin-top: 1rem; }
.totals td { padding: 0.3rem 0.75rem; border: 0; }
.totals tr.grand td { font-family: var(--font-heading); font-weight: 600; font-size: 1.2rem; border-top: 1px solid var(--line); padding-top: 0.6rem; }
@media (max-width: 767.98px) {
  /* elke regel als blokje: product en omschrijving breed, de getallen twee aan twee */
  .lines thead { display: none; }
  .lines, .lines > tbody { display: block; }
  .lines > tbody > tr { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 0.75rem; padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
  .lines > tbody > tr > td { display: block; padding: 0; border: 0; }
  .lines > tbody > tr > td::before { content: attr(data-label); display: block; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 0.15rem; }
  .lines > tbody > tr > td:nth-child(-n+2) { grid-column: 1 / -1; }
  .lines .amt { text-align: left; font-weight: 600; align-self: end; }
  .lines .del-cell { text-align: right; align-self: end; }
  .lines .del-cell::before { content: none; }
  .lines .del { font-size: 0.9rem; }
  .lines .del::after { content: " verwijderen"; }
}

code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; background: var(--blue-light); border-radius: var(--radius-sm); }
code { padding: 0.1rem 0.35rem; word-break: break-all; color: var(--ink); }
pre { padding: 1rem; overflow-x: auto; }

/* ---------- inloggen ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth { width: 100%; max-width: 420px; }
.auth .card { --bs-card-spacer-y: 2rem; --bs-card-spacer-x: 2rem; }
.auth img { width: 200px; margin-bottom: 1.5rem; }

/* ---------- portaal ---------- */
.portal-top { background: var(--white); border-bottom: 1px solid var(--line); padding: 1rem 0; }
.portal-top img { width: 160px; display: block; }
.portal-main { padding-top: 2rem; padding-bottom: 2rem; }

/* ---------- dialoog ---------- */
.dialog { border: 0; border-radius: var(--radius-lg); padding: 1.75rem; width: min(480px, calc(100vw - 32px)); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); }
.dialog::backdrop { background: rgba(255, 255, 255, 0.6); backdrop-filter: blur(2px); }

/* ---------- beweging (huisstijl: lift 4–6px met shadow-hover en oranje rand, beeld schaalt 1.03–1.06) ---------- */
.fx-wait .content, .fx-wait .portal-main, .fx-wait .auth { opacity: 0; }
.kpi, .file, a.bar, .btn, .side nav a { transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.6s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.4s, background-color 0.25s, color 0.25s; }
.kpi:hover, .file:hover { transform: translateY(-5px); box-shadow: 0 1.25rem 2.5rem -1rem rgba(0, 0, 0, 0.18); border-color: var(--orange-line); }
.file img { transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1); }
.file:hover img { transform: scale(1.05); }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.side nav a:not(.active):hover { transform: translateX(4px); }
a.bar:hover .fill { background: var(--orange-dark); }
tr.link td { transition: background-color 0.2s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
