/* Dialog, menu and toast, ported from the prototype */
.scrim { position: fixed; inset: 0; background: rgba(10,12,16,.45); z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal { width: min(520px, 100%); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 20px; display: grid; gap: 14px; max-height: 100%; overflow: auto; }
.modal.wide { width: min(660px, 100%); }
.modal h2 { font-size: 19px; }
.modal p { margin: 0; color: var(--muted); }
.modal-body { display: grid; gap: 14px; min-width: 0; }
.modal .row { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal .banner { margin: 0; }
.modal .banner p { color: inherit; }
.banner { padding: 10px 12px; border-radius: 10px; font-size: 13px; }
.banner[hidden] { display: none; }
.banner.error { background: var(--warn-soft); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.field-error { font-size: 12px; color: var(--warn); }
.field input[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--warn); }

.menu { position: fixed; z-index: 100; min-width: 200px; max-width: calc(100vw - 16px); max-height: 320px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; display: grid; }
/* Account menu: the prototype's .menu (220 px wide, 8 px under the button); other menus keep min-width */
.menu.account-menu { width: 220px; }
.menu button { text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; display: flex; justify-content: space-between; gap: 12px; white-space: nowrap; }
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--accent); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu .mh { padding: 6px 10px 2px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }

.toast-stack { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; justify-items: center; max-width: calc(100% - 32px); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; background: var(--ink); color: var(--surface); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 500; max-width: 100%; }
.toast.success { background: var(--ok); color: #fff; }
.toast.error { background: var(--warn); color: #fff; }
.toast-action { background: none; border: 0; padding: 0; font-weight: 600; text-decoration: underline; color: inherit; }

/* Dropdown (Keuzemenu), switch and search field, ported from the prototype */
.dd { position: relative; display: inline-flex; min-width: 0; width: 100%; max-width: 280px; }
.ddbtn { height: 36px; display: inline-flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 10px 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); width: 100%; min-width: 0; text-align: left; white-space: nowrap; }
.field .dd .ddbtn, .fctl .dd .ddbtn { height: 38px; }
.ddbtn > span { overflow: hidden; text-overflow: ellipsis; }
.ddbtn svg { width: 16px; height: 16px; color: var(--muted); flex: none; transition: transform .15s; }
.ddbtn:hover, .ddbtn[aria-expanded="true"] { border-color: var(--ink); }
.ddbtn[aria-expanded="true"] svg { transform: rotate(180deg); }
.ddmenu { position: fixed; z-index: 100; max-width: calc(100vw - 16px); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; display: grid; max-height: 320px; overflow: auto; font: 14px/1.45 var(--font-ui); color: var(--ink); }
.ddopt { text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 6px; display: flex; justify-content: space-between; align-items: center; gap: 18px; white-space: nowrap; }
.ddopt:hover, .ddopt:focus { background: var(--surface-2); outline: none; }
.ddopt[aria-selected="true"] { font-weight: 600; }
.ddopt .ck svg { width: 15px; height: 15px; display: block; }

.toggle { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; cursor: pointer; height: 36px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r); padding: 0 10px; }
.toggle input[type=checkbox] { appearance: none; -webkit-appearance: none; width: 30px; height: 18px; border-radius: 9px; background: var(--line-strong); position: relative; flex: none; margin: 0; cursor: pointer; transition: background .15s; }
.toggle input[type=checkbox]::before { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.toggle input[type=checkbox]:checked { background: var(--ink); }
.toggle input[type=checkbox]:checked::before { transform: translateX(12px); }
.toggle input[type=checkbox]:focus-visible { outline: 2px solid var(--work); outline-offset: 2px; }

.search { position: relative; display: block; flex: 1 1 280px; min-width: 0; }
.search input { width: 100%; height: 36px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r); padding: 0 36px 0 34px; }
.search input::placeholder { color: var(--faint); }
.search > svg { position: absolute; left: 10px; top: 10px; width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
input[type=search]::-webkit-search-cancel-button, input[type=search]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
.sclear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border: 0; border-radius: 12px; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; padding: 0; }
.sclear[hidden] { display: none; }
/* A search field in a dialog form (no icon): room for the clear button */
.swrap { position: relative; display: block; }
.swrap input { padding-right: 34px; }
.sclear:hover { background: var(--line); color: var(--ink); }
.sclear svg { width: 13px; height: 13px; }
@media (max-width: 760px) { .dd { max-width: none; } }
.zoom { position: fixed; z-index: 95; width: 280px; padding: 10px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow), 0 0 0 1px var(--line); pointer-events: none; display: grid; gap: 8px; }
.zoom.wide { width: 380px; }
.zoom .zimg { border-radius: 8px; background: var(--img-bg); overflow: hidden; }
.zoom img { display: block; width: 100%; height: auto; max-height: 60vh; object-fit: contain; mix-blend-mode: multiply; }
.zoom .zcap { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.zoom .zcap b { color: var(--ink); font-weight: 600; display: block; }
.lbscrim { padding: 16px; z-index: 96; }
.lb { position: relative; margin: 0; width: min(560px, 100%); background: var(--surface); border-radius: 16px; padding: 14px; display: grid; gap: 10px; box-shadow: var(--shadow); }
.lbimg { position: relative; height: min(60vh, 420px); border-radius: 10px; background: var(--img-bg); }
.lbimg > img { position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px); object-fit: contain; mix-blend-mode: multiply; }
.lb figcaption { display: grid; gap: 2px; font-size: 13px; color: var(--muted); }
.lb figcaption b { color: var(--ink); font-size: 15px; }
.lbx { position: absolute; top: 18px; right: 18px; z-index: 1; background: var(--surface); }
@media (max-width: 760px) { .lbimg { height: 300px; } }

/* Counter (Teller) and count input, ported from the prototype. .mctr carries is-pending / is-loading;
   a row grid can place .ctrwrap and .zero in their own cells with .mctr { display: contents }. */
.mctr { display: inline-flex; gap: 8px; align-items: center; }
.ctrwrap { position: relative; display: inline-block; }
.ctr { display: inline-grid; grid-template-columns: 34px 66px 34px; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--r); overflow: hidden; height: 32px; background: var(--surface); }
.ctr button { border: 0; background: transparent; height: 100%; font-size: 18px; line-height: 1; color: var(--muted); }
.ctr button:hover { background: var(--surface-2); color: var(--ink); }
.ctr button.pri { background: var(--ink); color: var(--surface); }
.ctr button.pri:hover { background: var(--ink); filter: brightness(1.25); }
.ctr button[disabled] { opacity: .3; cursor: default; }
.ctr output { white-space: nowrap; text-align: center; font: 500 13px var(--font-mono); height: 100%; display: flex; align-items: center; justify-content: center; gap: 1px; border-inline: 1px solid var(--line); }
.ctr output small { color: var(--faint); font-size: 11px; }
.ctr:not(.ro) output { cursor: text; }
.ctr:not(.ro) output:hover { background: var(--surface-2); }
.ctr .qwrap { display: flex; align-items: center; justify-content: center; height: 100%; border-inline: 1px solid var(--line); background: var(--sel); font: 500 13px var(--font-mono); }
.ctr .qwrap small { color: var(--faint); font-size: 11px; }
.qedit { width: 30px; border: 0; padding: 0; background: transparent; font: 600 13px var(--font-mono); text-align: right; -moz-appearance: textfield; appearance: textfield; }
.qedit::-webkit-inner-spin-button, .qedit::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.qedit:focus { outline: none; }
.ctr.ro { grid-template-columns: 66px; border-style: dashed; background: transparent; }
.ctrwrap.bad .ctr { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ctrwrap.bad .qwrap { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.qmsg { position: absolute; bottom: calc(100% + 6px); right: 0; z-index: 6; white-space: nowrap; font-size: 12px; font-weight: 500; color: var(--accent); background: var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 6px; padding: 3px 8px; box-shadow: var(--shadow); }
.mctr.is-pending .ctr output { background: color-mix(in srgb, var(--pending) 18%, var(--surface)); color: var(--pending); }
.mctr.is-loading .ctr output { opacity: .5; }
.zero { width: 32px; height: 32px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); display: grid; place-items: center; }
.zero:hover { color: var(--ok); border-color: var(--ok); }
.zero[disabled] { visibility: hidden; }
.zero svg { width: 16px; height: 16px; }
@media (max-width: 760px) {
  .ctr { grid-template-columns: 40px 64px 40px; height: 40px; }
  .zero { width: 40px; height: 40px; }
}

/* Segmented choice (knoppenrij) */
.seg { display: grid; gap: 6px; justify-items: start; }
.segctl { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-strong); border-radius: var(--r); overflow: hidden; background: var(--surface); max-width: 100%; }
.segctl label { position: relative; cursor: pointer; }
.segctl label + label { border-left: 1px solid var(--line-strong); }
.segctl input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segctl span { display: block; padding: 8px 14px; font-weight: 500; white-space: nowrap; }
.segctl label:hover span { background: var(--surface-2); }
.segctl input:checked + span { background: var(--ink); color: var(--surface); }
.segctl input:focus-visible + span { outline: 2px solid var(--work); outline-offset: -3px; }
.fhint { font-size: 12.5px; color: var(--muted); }
/* Dialog form: a label column and a control column per row (Staat wijzigen, Set toevoegen), two fields side by side */
.form { display: grid; gap: 12px; }
.frow { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; align-items: start; }
.flbl { font-size: 13px; font-weight: 600; color: var(--muted); padding-top: 9px; }
.fctl { display: grid; gap: 6px; min-width: 0; justify-items: start; }
.fctl > .dd, .fctl > select { width: 100%; max-width: 280px; }
.fctl .segctl span { padding: 8px 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.segexp:empty { display: none; }
@media (max-width: 760px) {
  .seg { justify-items: stretch; width: 100%; }
  .segctl { display: flex; width: 100%; }
  .segctl label { flex: 1 1 0; }
  .segctl span { padding: 8px 6px; text-align: center; white-space: normal; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .frow { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .flbl { padding-top: 0; }
}

/* Suggestion field list */
.ddh { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 4px 10px 2px; }
.ddopt.is-active { background: var(--surface-2); }
.sgopt[aria-selected="true"] { font-weight: inherit; }

/* Date field and calendar, ported from the prototype */
.dwrap { position: relative; display: block; }
.dwrap input { padding-right: 38px; font-variant-numeric: tabular-nums; }
.dbtn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); display: grid; place-items: center; padding: 0; }
.dbtn:hover { background: var(--surface-2); color: var(--ink); }
.dbtn svg { width: 18px; height: 18px; }
.dpick { position: fixed; z-index: 100; width: 272px; max-width: calc(100vw - 16px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 10px; font: 14px/1.45 var(--font-ui); color: var(--ink); }
.dph { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dph b { font-weight: 600; text-transform: capitalize; }
.dpn { width: 30px; height: 30px; border: 0; border-radius: 6px; background: none; font-size: 18px; color: var(--muted); }
.dpn:hover { background: var(--surface-2); color: var(--ink); }
.dpg { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dpw span { font-size: 11px; font-weight: 600; color: var(--faint); text-align: center; padding: 4px 0; text-transform: lowercase; }
.dpd { height: 34px; border: 0; border-radius: 6px; background: none; font-variant-numeric: tabular-nums; }
.dpd:hover, .dpd:focus { background: var(--surface-2); outline: none; }
.dpd.today { box-shadow: inset 0 0 0 1px var(--line-strong); }
.dpd.sel { background: var(--ink); color: var(--surface); }
.dpf { display: flex; justify-content: flex-end; padding-top: 6px; border-top: 1px solid var(--line); margin-top: 6px; }
.dpf .linkbtn { background: none; border: 0; padding: 4px 6px; border-radius: 6px; font-weight: 600; color: var(--ink); text-decoration: underline; }
.dpf .linkbtn:hover { background: var(--surface-2); }

/* Pager */
.pager { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-top: 14px; }
.pgbtns { display: flex; gap: 10px; align-items: center; }
.pgsize { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; white-space: nowrap; }
.pgsize .ddbtn { width: auto; min-width: 72px; }
@media (max-width: 760px) {
  .pager { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "nav nav" "count size"; gap: 10px; }
  .pgbtns { grid-area: nav; justify-content: space-between; }
  .pgbtns .btn { width: 44px; height: 40px; justify-content: center; font-size: 18px; }
  .pglbl { display: none; }
  .pgcount { grid-area: count; align-self: center; }
  .pgsize { grid-area: size; }
}
