@font-face { font-family: 'Visby Round CF'; src: url(fonts/VisbyRoundCF-Regular.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Visby Round CF'; src: url(fonts/VisbyRoundCF-Medium.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Visby Round CF'; src: url(fonts/VisbyRoundCF-Bold.woff2) format('woff2'); font-weight: 700; font-display: swap; }

/* OneXillium-huisstijl */
:root {
  --navy: #0C2340; --paars: #6558B1; --mint: #B5E3D8; --lila: #D8D7DF;
  --page: #F8F8FA; --surface: #FFFFFF; --surface-2: #F1F0F5;
  --ink: #0C2340; --muted: #5E6276; --line: #E4E3EA;
  --accent: #6558B1; --accent-ink: #FFFFFF; --accent-wash: #F1EFFA;
  --ok-bg: #DDF2EC; --ok-ink: #0C4A3C; --err-bg: #FBE9EC; --err-ink: #8A1C2B;
  --focus: 0 0 0 3px rgba(101, 88, 177, .35);
  --radius: 14px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--page); color: var(--ink);
  font: 400 16px/1.45 'Visby Round CF', system-ui, -apple-system, 'Segoe UI', sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}

.bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.logo { height: 26px; width: auto; }
.tech {
  font: inherit; font-size: 14px; font-weight: 500; color: var(--ink); background: var(--surface-2);
  border: 0; border-radius: 999px; padding: 6px 12px; cursor: pointer; max-width: 55vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; }
h1 { font-size: 24px; font-weight: 700; margin: 0 0 6px; letter-spacing: -.01em; }
h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin: 0 0 12px; }
.muted { color: var(--muted); margin: 0 0 16px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.narrow { max-width: 440px; margin: 8vh auto 0; }
.center { text-align: center; }

form { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; }
.opt { color: var(--muted); font-weight: 400; }
.hint { color: var(--muted); font-weight: 400; font-size: 13px; }
input, select, textarea {
  font: inherit; font-size: 17px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--lila); border-radius: 10px; padding: 12px 14px; width: 100%;
}
textarea { resize: vertical; min-height: 48px; }
/* Tijdvelden: iOS/iPadOS tekent ze anders (gecentreerd, lager als ze leeg zijn); gelijk trekken met de andere velden */
input[type="time"] {
  -webkit-appearance: none; appearance: none; display: block; text-align: left;
  min-height: calc(17px * 1.45 + 26px); line-height: 1.45;
}
input[type="time"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
input[type="time"]::-webkit-datetime-edit { padding: 0; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: none; box-shadow: var(--focus); border-color: var(--accent); }
#ticketRef { font-size: 26px; font-weight: 700; letter-spacing: .04em; text-align: center; }

button.primary, button.secondary {
  font: inherit; font-size: 17px; font-weight: 700; border-radius: 12px; padding: 14px 18px; cursor: pointer; min-height: 52px; width: 100%;
}
button.primary { background: var(--accent); color: var(--accent-ink); border: 0; }
button.primary:active { filter: brightness(.92); }
button.primary[disabled] { opacity: .6; cursor: progress; }
button.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--lila); }
button.link { font: inherit; font-size: 15px; font-weight: 500; background: none; border: 0; padding: 4px 0; color: var(--accent); cursor: pointer; }

.ticket-head, #vTicket .column { max-width: 780px; margin-left: auto; margin-right: auto; }
.ticket-head { margin-bottom: 16px; }
.ticket-head h1 { margin-top: 6px; }
.column { display: flex; flex-direction: column; gap: 16px; }
.doc-title { font-size: 20px; margin: 12px 0 0; }
.stack-form { display: flex; flex-direction: column; gap: 14px; }

/* Ticketgegevens: ingeklapt, want het formulier is het belangrijkste */
details.info summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
details.info summary::-webkit-details-marker { display: none; }
details.info summary h2 { margin: 0; }
details.info summary::after { content: '▾'; color: var(--accent); }
details.info[open] summary::after { content: '▴'; }
details.info summary .muted { margin: 0; font-size: 14px; flex: 1; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info-grid { display: grid; gap: 14px; margin-top: 14px; }
@media (min-width: 700px) { .info-grid { grid-template-columns: 1fr 1fr; } }
#tParts:not(:empty) { margin-top: 14px; }

/* Formuliersecties */
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-head .link { white-space: nowrap; }
.note { font-size: 13px; color: var(--muted); margin: -6px 0 12px; }
.fields { display: grid; gap: 14px; }
@media (min-width: 700px) { .fields { grid-template-columns: 1fr 1fr; } .fields > .wide { grid-column: 1 / -1; } }
.group-label { font-size: 14px; font-weight: 500; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip, .seg button {
  font: inherit; font-size: 15px; font-weight: 500; color: var(--ink); background: var(--surface);
  border: 1px solid var(--lila); border-radius: 14px; padding: 9px 14px; min-height: 42px; cursor: pointer; text-align: left;
}
.chip[aria-pressed="true"], .seg button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip[aria-pressed="true"]::before { content: '✓ '; }
.seg { display: inline-flex; gap: 6px; flex-shrink: 0; }
.seg button { min-width: 58px; text-align: center; padding: 8px 12px; }
.seg button.nee[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); }
.jn-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; }
.jn-row:first-child { border-top: 0; padding-top: 0; }
.toestel { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.toestel:first-child { border-top: 0; padding-top: 0; }
.toestel label { font-size: 13px; }
.toestel-head { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 700; }
@media (min-width: 700px) { .toestel { grid-template-columns: 3fr 3fr 2fr 2fr; } }
button.scan {
  font: inherit; font-size: 14px; font-weight: 500; color: var(--accent); background: var(--accent-wash);
  border: 0; border-radius: 999px; padding: 8px 14px; min-height: 38px; cursor: pointer;
}
.toestel .remove { grid-column: 1 / -1; justify-self: start; font-size: 14px; }
button.add {
  font: inherit; font-size: 15px; font-weight: 500; color: var(--accent); background: var(--accent-wash);
  border: 1px dashed var(--accent); border-radius: 12px; padding: 12px; width: 100%; margin-top: 10px; cursor: pointer; min-height: 48px;
}
.terms { font-size: 12.5px; color: var(--muted); margin: 0; line-height: 1.4; }
.sticky-submit { position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); margin-top: 16px; box-shadow: 0 6px 20px rgba(12, 35, 64, .22); }
.invalid { border-color: var(--err-ink) !important; }

dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 15px; }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 500; white-space: pre-line; overflow-wrap: anywhere; }
ul.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
ul.plain a { color: var(--accent); font-weight: 500; overflow-wrap: anywhere; }
.qty { display: inline-block; min-width: 2.2em; font-weight: 700; }

.sig-label { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; font-weight: 500; margin-bottom: -6px; }
.sig-wrap {
  position: relative; height: 240px; border: 2px dashed var(--lila); border-radius: 12px; background: #FFFFFF; overflow: hidden;
}
.sig-wrap.signed { border-style: solid; border-color: var(--accent); }
.sig-wrap::after { content: ''; position: absolute; left: 20px; right: 20px; bottom: 48px; border-bottom: 1px solid var(--lila); pointer-events: none; }
/* touch-action: none, anders scrolt iPad/iPhone de pagina in plaats van te tekenen */
.sig-wrap canvas {
  display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
.sig-hint { position: absolute; inset: auto 0 18px; text-align: center; color: var(--muted); font-size: 14px; pointer-events: none; }
@media (min-width: 900px) { .sig-wrap { height: 280px; } }

.check {
  width: 72px; height: 72px; margin: 4px auto 16px; border-radius: 50%; background: var(--ok-bg); color: var(--ok-ink);
  display: grid; place-items: center; font-size: 36px; font-weight: 700;
}
#vDone .card { display: flex; flex-direction: column; gap: 12px; }
#vDone .muted { overflow-wrap: anywhere; }

#toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 10; max-width: 520px; margin: 0 auto;
  padding: 14px 16px; border-radius: 12px; background: var(--err-bg); color: var(--err-ink); font-weight: 500; box-shadow: 0 6px 24px rgba(12, 35, 64, .18);
}
#toast.ok { background: var(--ok-bg); color: var(--ok-ink); }

[hidden] { display: none !important; }
