:root { --primary: #1764ee; --primary-dark: #1046b5; --ink: #102444; --background: #f2f5fa; --tint: #e8f0ff; --accent: #ffb74a; --secondary: var(--primary); --secondary-tint: var(--tint); --border: #d7e1f0; --muted: #60718b; }
html[data-site=stadhuis] { --primary: #c32b65; --primary-dark: #99204e; --ink: #402438; --background: #faf2f6; --tint: #fce4ed; --accent: #ffaf70; --secondary: #a72b65; --secondary-tint: #faeaf1; --border: #efd8e0; --muted: #826778; }
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); font: 16px/1.55 'Segoe UI', system-ui, sans-serif; background: var(--background); }
button, input, select { font: inherit; }
a { color: inherit; }
header { background: var(--ink); color: white; border-bottom: 1px solid #ffffff20; }
.header-inner { max-width: 1200px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 32px; }
.brand { display: flex; gap: 14px; align-items: center; text-decoration: none; font-weight: 800; font-size: 22px; }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--primary); font-size: 36px; letter-spacing: -.08em; padding-right: 4px; }
.brand img { width: 92px; height: 44px; object-fit: contain; }
.stadhuis-logo { display: none; }
html[data-site=stadhuis] .stadhuis-logo { display: block; }
html[data-site=stadhuis] .broek-logo { display: none; }
header nav { display: flex; gap: 10px; }
header nav a { text-decoration: none; padding: 10px 16px; font-size: 14px; font-weight: 700; border-radius: 10px; }
header nav a:last-child { background: #ffffff16; border: 1px solid #ffffff20; }
header nav a:hover { background: #ffffff25; }
main { max-width: 1120px; margin: auto; padding: 36px 32px 56px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(28px, 4vw, 46px); line-height: 1.12; letter-spacing: -.035em; font-weight: 850; }
h2 { font-size: 24px; line-height: 1.2; letter-spacing: -.02em; }
h3 { font-size: 21px; line-height: 1.3; }
p { color: var(--muted); }
.home-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 8px 0 32px; }
.site-switch { display: flex; position: relative; isolation: isolate; padding: 5px; background: white; border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 8px 24px #10244408; }
.site-switch button { z-index: 1; flex: 1; width: 145px; background: transparent; color: var(--muted); border: 0; padding: 12px 18px; margin: 0; font-size: 14px; transition: color .3s; }
.site-switch button[aria-pressed=true] { color: white; }
.site-switch button:hover { background: transparent; transform: none; }
.switch-indicator { position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc((100% - 10px) / 2); border-radius: 11px; background: var(--primary); transition: transform .65s cubic-bezier(.34,1.3,.45,1), background-color .5s; box-shadow: 0 5px 12px #10244420; }
html[data-site=stadhuis] .switch-indicator { transform: translateX(100%); }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.action-card { padding: 30px; border: 1px solid var(--border); border-radius: 22px; color: var(--ink); background: white; box-shadow: 0 12px 34px #10244408; }
.action-card.plan { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1.5fr; gap: 24px; align-items: center; }
.card-heading { display: flex; align-items: center; gap: 16px; margin-bottom: 30px; }
.action-card.plan .card-heading { margin: 0; }
.action-card h2 { font-size: 27px; }
.module-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--tint); color: var(--primary); }
.module-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.studio { border-top: 5px solid var(--primary); }
.apartment { border-top: 5px solid var(--secondary); }
.apartment .module-icon { background: var(--secondary-tint); color: var(--secondary); }
.card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card-actions a { display: flex; justify-content: space-between; gap: 8px; align-items: center; border: 1px solid var(--border); padding: 18px; min-height: 72px; border-radius: 12px; text-decoration: none; font-size: 14px; font-weight: 750; background: var(--background); transition: background .2s, transform .2s, box-shadow .2s; }
.card-actions a:first-child { background: var(--primary); color: white; border-color: var(--primary); }
.apartment .card-actions a:first-child { background: var(--secondary); border-color: var(--secondary); }
.card-actions a:hover { transform: translateY(-3px); box-shadow: 0 8px 18px #10244414; }
.card-actions a span { font-size: 22px; }
.page-title { margin: 8px 0 28px; }
form, .table-container { background: white; border: 1px solid var(--border); border-radius: 20px; padding: 32px; box-shadow: 0 14px 40px #18365d10; }
.section-heading { margin-bottom: 20px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; margin-bottom: 32px; }
.field { min-width: 0; }
label { display: block; font-size: 14px; font-weight: 700; }
input:not([type=radio]):not([type=hidden]):not([type=file]), select { width: 100%; min-width: 0; min-height: 49px; padding: 12px 14px; margin-top: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--background); color: var(--ink); }
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--tint); outline: none; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 20px; background: var(--primary); color: white; border: 1px solid transparent; border-radius: 10px; padding: 13px 20px; min-height: 48px; font-weight: 750; text-decoration: none; cursor: pointer; transition: background .18s, transform .18s; }
button:hover, .button:hover { background: var(--primary-dark); transform: translateY(-1px); }
button:disabled { opacity: .55; cursor: wait; transform: none; }
.button-quiet { background: var(--tint); color: var(--primary); }
.button-quiet:hover { background: var(--border); }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.room-list { display: grid; gap: 12px; }
details { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
summary { display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--tint); cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
.room-number { color: var(--primary); font-size: 12px; font-weight: 800; }
.room-title { font-weight: 800; font-size: 19px; }
.room-count { margin-left: auto; font-size: 12px; color: var(--muted); }
.room-toggle { display: grid; place-items: center; background: white; color: var(--primary); width: 30px; height: 30px; border-radius: 9px; font-size: 24px; line-height: 1; }
details[open] .room-toggle { transform: rotate(45deg); }
.inspection-row { display: grid; grid-template-columns: minmax(120px, 1fr) auto auto minmax(180px, 2.2fr); gap: 12px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--border); }
.inspection-row > span { font-weight: 700; font-size: 14px; }
.inspection-row .choice { display: flex; align-items: center; gap: 7px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; font-weight: 600; cursor: pointer; }
.choice:has(input:checked) { background: var(--primary); color: white; border-color: var(--primary); }
.inspection-row input[type=radio] { accent-color: var(--primary); width: 18px; height: 18px; margin: 0; }
.explanation { font-size: 11px; color: var(--muted); }
.inspection-row input[type=text] { margin-top: 4px; min-height: 42px; font-size: 14px; padding: 8px 12px; }
.extra-fields { margin-top: 24px; padding: 24px; border-radius: 14px; background: var(--tint); }
.attachment-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 20px; }
.attachment-card { padding: 24px; background: var(--background); border: 1px solid var(--border); border-radius: 16px; min-width: 0; }
.attachment-card h3 { margin-bottom: 18px; }
canvas { display: block; width: 550px; max-width: 100%; height: auto; aspect-ratio: 550 / 300; background: white; border: 2px dashed var(--border); border-radius: 10px; touch-action: none; }
#clear-button { margin-top: 12px; font-size: 13px; padding: 8px 14px; min-height: 42px; }
#previewContainer { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.photo { position: relative; max-width: 100%; }
.photo img { display: block; max-width: 150px; max-height: 150px; border-radius: 10px; }
.photo button { position: absolute; right: 4px; top: 4px; padding: 2px 9px; min-height: 30px; background: #ac2346; border-radius: 8px; }
#status { white-space: pre-wrap; overflow-wrap: anywhere; }
#status:not(:empty) { margin-top: 24px; padding: 16px; border-radius: 12px; background: var(--tint); color: var(--ink); }
.form-finish { display: flex; justify-content: flex-end; padding-top: 24px; }
.form-finish button { min-width: 180px; }
dialog { border: 1px solid var(--border); border-top: 6px solid var(--primary); border-radius: 22px; padding: 32px; max-width: min(480px, calc(100vw - 32px)); box-shadow: 0 30px 80px #0004; color: var(--ink); }
dialog h2 { margin-bottom: 12px; }
dialog p { margin-bottom: 24px; }
dialog button { margin-right: 8px; }
dialog::backdrop { background: #102444aa; backdrop-filter: blur(4px); }
#cancelButton { background: var(--tint); color: var(--primary); }
.schedule-form { max-width: 850px; border-top: 4px solid var(--primary); }
.schedule-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.table-container { overflow-x: auto; padding: 0; }
#order-help { margin: -10px 0 16px; font-size: 14px; }
#order-status:not(:empty) { margin-bottom: 16px; padding: 12px 16px; background: var(--tint); color: var(--ink); border-radius: 10px; }
#order-status[data-error=true] { background: #ffedf1; color: #992b48; }
td.row-order { width: 60px; padding: 10px; }
td .drag-handle { width: 44px; min-height: 44px; padding: 8px; color: var(--primary); background: var(--tint); border: 1px solid var(--border); cursor: grab; touch-action: none; user-select: none; }
td .drag-handle svg { fill: currentColor; pointer-events: none; }
td .drag-handle:hover { background: var(--border); transform: none; }
td .drag-handle:active { cursor: grabbing; }
td .drag-handle:disabled { cursor: default; opacity: .45; }
tr.is-dragging { outline: 2px solid var(--primary); outline-offset: -2px; opacity: .7; background: var(--tint); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 20px; border-bottom: 1px solid var(--border); text-align: left; }
th { color: white; background: var(--primary); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
tbody tr:nth-child(even) { background: var(--tint); }
tbody tr:last-child td { border-bottom: 0; }
td form { border: 0; padding: 0; box-shadow: none; background: transparent; }
td button { background: var(--primary); color: white; border-color: var(--primary); padding: 8px 12px; font-size: 12px; min-height: 42px; }
td button:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
main > nav .button-quiet { background: white; color: var(--primary); border-color: var(--primary); }
main > nav .button-quiet:hover { background: var(--primary); color: white; }
main > nav { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
@media (max-width: 900px) { .dashboard-grid { gap: 18px; } .action-card { padding: 22px; } .action-card.plan { grid-template-columns: 1fr; } }
@media (max-width: 680px) {
  .header-inner { padding: 16px 18px; gap: 8px; }
  .brand { font-size: 18px; gap: 10px; }
  .brand-mark { width: 38px; height: 38px; font-size: 29px; border-radius: 11px; }
  .brand img { width: 64px; height: 34px; }
  header nav a { padding: 9px 10px; font-size: 11px; }
  header nav a:first-child { display: none; }
  main { padding: 24px 16px 32px; }
  .home-heading { flex-direction: column; align-items: stretch; gap: 20px; margin: 0 0 24px; }
  .site-switch button { width: auto; }
  .dashboard-grid { grid-template-columns: 1fr; gap: 16px; }
  .action-card { padding: 24px; border-radius: 18px; }
  .action-card h2 { font-size: 25px; }
  .card-heading { margin-bottom: 22px; }
  .action-card.plan { display: block; }
  .action-card.plan .card-heading { margin-bottom: 22px; }
  .card-actions a { padding: 14px; min-height: 64px; font-size: 13px; }
  .page-title h1 { font-size: 29px; }
  form { padding: 20px 16px; border-radius: 18px; }
  .field-grid { gap: 18px; grid-template-columns: minmax(0, 1fr); margin-bottom: 30px; }
  .section-heading h2 { font-size: 20px; }
  summary { gap: 10px; padding: 14px 12px; }
  .room-title { font-size: 16px; }
  .room-count { display: none; }
  .room-toggle { margin-left: auto; flex-shrink: 0; }
  .inspection-row { grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; padding: 14px 12px; }
  .inspection-row .choice { padding: 9px; font-size: 12px; }
  .inspection-row .explanation { grid-column: 1 / -1; }
  .extra-fields { padding: 18px; }
  .attachment-grid { grid-template-columns: 1fr; gap: 16px; }
  .attachment-card { padding: 20px; }
  .form-finish button { width: 100%; }
  th, td { padding: 14px; }
  main > nav .button { flex: 1 1 auto; font-size: 13px; }
}

body, header, .action-card, .module-icon, .card-actions a { transition: background-color .5s, border-color .5s, color .4s, transform .2s, box-shadow .2s; }
.list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.list-toolbar h1 { font-size: clamp(26px, 3vw, 36px); }
.record-count { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 9px; margin-left: 8px; background: var(--tint); color: var(--primary); border-radius: 9px; vertical-align: middle; font-size: 15px; letter-spacing: 0; }
.save-confirmation { padding: 14px 18px; margin: 0 0 20px; background: #e4f4eb; color: #21643c; border: 1px solid #b9dec8; border-radius: 10px; font-size: 14px; }
#save-status:not(:empty) { margin-bottom: 18px; padding: 14px; background: #ffedf1; color: #992b48; border-radius: 10px; }
@media (max-width: 680px) {
  .list-toolbar { flex-direction: column; align-items: stretch; }
  .table-container { border: 0; background: none; box-shadow: none; overflow: visible; }
  table, tbody { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody { display: grid; gap: 14px; }
  tbody tr, tbody tr:nth-child(even) { display: block; padding: 16px; background: white; border: 1px solid var(--border); border-radius: 14px; }
  td { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 8px 0; border: 0; overflow-wrap: anywhere; }
  td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; padding-top: 2px; }
  td:first-child { font-weight: 750; }
  td[data-label=Naam] { font-weight: 750; }
  td[colspan] { display: block; }
  td.row-actions { display: block; margin-top: 8px; border-top: 1px solid var(--border); padding-top: 14px; }
  td.row-actions button { width: 100%; }
  td.row-order { display: flex; justify-content: flex-end; width: auto; padding: 0 0 6px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }

.comments-field { grid-column: 1 / -1; }

#uploadModal { width: 320px; text-align: center; border-top: 0; padding: 28px; border-radius: 16px; }
#uploadModal h2 { font-size: 21px; margin-bottom: 8px; }
#uploadModal p { font-size: 14px; margin-bottom: 0; }
.send-visual { width: 92px; height: 92px; margin: 0 auto 16px; color: var(--primary); }
.send-visual svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.send-sheet rect { fill: var(--tint); }
.send-sheet { animation: send-sheet 1.4s ease-in-out infinite; }
.send-arrow { animation: send-arrow 1.4s ease-in-out infinite; }
.send-stadhuis, .send-complete { display: none; }
html[data-site=stadhuis] .send-broekbeheer { display: none; }
html[data-site=stadhuis] .send-stadhuis { display: block; }
.send-ring { stroke-dasharray: 140 62; transform-origin: 50px 50px; animation: send-ring 1.8s linear infinite; }
.send-check { stroke-dasharray: 48; stroke-dashoffset: 48; animation: send-check 1.8s ease-in-out infinite; }
#uploadModal[data-state=success] .send-broekbeheer, #uploadModal[data-state=success] .send-stadhuis { display: none; }
#uploadModal[data-state=success] .send-complete { display: block; animation: send-done .4s ease-out both; }
@keyframes send-sheet { 0% { transform: translateY(15px); opacity: 0; } 25%, 55% { opacity: 1; } 100% { transform: translateY(-25px); opacity: 0; } }
@keyframes send-arrow { 0%, 100% { opacity: .3; } 50% { opacity: 1; transform: translateY(-4px); } }
@keyframes send-ring { to { transform: rotate(360deg); } }
@keyframes send-check { 0%, 15% { stroke-dashoffset: 48; opacity: 0; } 55%, 85% { stroke-dashoffset: 0; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes send-done { from { transform: scale(.75); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .send-visual * { animation: none !important; } .send-check { stroke-dashoffset: 0; } }

html[data-site=stadhuis] [data-broekbeheer-only] { display: none; }
.vaststelling { grid-column: 1 / -1; }
.vaststelling .card-actions { grid-template-columns: minmax(0, 1fr); }
.document-body { padding: 24px; border: 1px solid var(--border); border-radius: 14px; margin-bottom: 24px; }
.document-body p { color: var(--ink); white-space: pre-line; margin-bottom: 14px; }
.document-body p:last-child { margin-bottom: 0; }
.document-signature { max-width: 600px; }

.document-page .page-title h1, .document-body { overflow-wrap: anywhere; }
@media (max-width: 680px) { .document-body { padding: 16px; } }

input[type=date] { display: block; max-width: 100%; min-width: 0; -webkit-appearance: none; appearance: none; }
input[type=date]::-webkit-date-and-time-value { min-width: 0; text-align: left; }
input[type=date]::-webkit-datetime-edit { min-width: 0; padding: 0; }

.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.dialog-actions button, .dialog-actions .button { margin: 0; flex: 1 1 auto; }

@media (max-width: 680px) {
  #name, #address, #adress, #email, #date { min-height: 42px; padding: 9px 12px; margin-top: 6px; font-size: 16px; }
  .field-grid:not(.extra-fields) { gap: 14px; }
  #signature-pad { width: 100%; height: 230px; aspect-ratio: auto; }
  .schedule-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .schedule-actions button, .schedule-actions .button { min-width: 0; min-height: 44px; padding: 10px 7px; font-size: clamp(12px, 3.5vw, 14px); white-space: nowrap; }
}
