:root {
  /* Huisstijl Van Gestel Kozijnen & Glas (overgenomen van vangestelkozijnen.nl) */
  --bg: #f9fafb; --panel: #ffffff; --ink: #151e28; --muted: #6b7887; --line: #dbe1e8; --line2: #eef1f4;
  --brand: #17304f; --brand2: #23456e; --accent: #ee862b; --accent-ink: #ffffff; --link: #1f4f8a; --mint: #dcefe3;
  --ok: #2f8a63; --warn: #b7791f; --bad: #d64545; --info: #2b6cb0;
  --s-nog: #9aa5ae; --s-voorlopig: #ee862b; --s-levering: #c97a2b; --s-klant: #8e6bbf; --s-def: #2f8a63;
  --s-uitv: #1f4f8a; --s-controle: #6b8e23; --s-klaar: #5f6b73; --s-blok: #d64545;
  --radius: 8px; --shadow: 0 1px 2px rgba(21,30,40,.06), 0 2px 8px rgba(21,30,40,.05);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: var(--link); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 1.35rem; margin: 0 0 .25rem; } h2 { font-size: 1.1rem; margin: 0 0 .6rem; } h3 { font-size: 1rem; margin: .2rem 0 .5rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .tiny { font-size: .75rem; } .pad { padding: 1rem; } .right { text-align: right; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; } .grow { flex: 1; } .col { display: flex; flex-direction: column; gap: .4rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .6rem; }

#testbanner { background: repeating-linear-gradient(45deg, #fff3cd, #fff3cd 12px, #ffe8a1 12px, #ffe8a1 24px); color: #6b4e00; text-align: center; font-size: .8rem; padding: .25rem; font-weight: 600; }
header#top { position: sticky; top: 0; z-index: 30; background: var(--brand); color: #fff; display: flex; align-items: center; gap: 1rem; padding: 0 1rem; height: 52px; }
header .brand { color: #fff; font-weight: 800; letter-spacing: .1px; white-space: nowrap; display: flex; align-items: center; gap: .5rem; } header .brand span { color: var(--accent); font-weight: 600; }
header .brand img { height: 34px; background: #fff; border-radius: 4px; padding: 2px; }
#nav { display: flex; gap: .15rem; overflow-x: auto; flex: 1; scrollbar-width: none; }
#nav a { color: #d5e1e8; padding: .4rem .65rem; border-radius: 6px; white-space: nowrap; font-size: .92rem; }
#nav a.active, #nav a:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.top-right { display: flex; gap: .7rem; align-items: center; font-size: .85rem; white-space: nowrap; }
button.link { background: none; border: 0; color: #d5e1e8; cursor: pointer; padding: 0; font: inherit; } button.link:hover { color: #fff; text-decoration: underline; }
main#app { padding: 1rem; max-width: 1700px; margin: 0 auto; }
#bottomnav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--panel); border-top: 1px solid var(--line); display: flex; z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
#bottomnav a { flex: 1; text-align: center; padding: .55rem .2rem; font-size: .78rem; color: var(--muted); }
#bottomnav a.active { color: var(--brand); font-weight: 700; }
#bottomnav a .ic { display: block; font-size: 1.2rem; line-height: 1.3; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.card + .card { margin-top: 1rem; }
.card h2 .count { font-weight: 400; color: var(--muted); font-size: .9rem; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: .25rem .8rem; font-size: .93rem; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.pill { display: inline-flex; align-items: center; gap: .3rem; border-radius: 999px; padding: .12rem .55rem; font-size: .76rem; font-weight: 600; background: var(--line2); color: var(--ink); white-space: nowrap; }
#syncpill.ok { background: #d9f2e3; color: var(--ok); } #syncpill.pending { background: #fff1cf; color: #8a5a00; } #syncpill.busy { background: #dbe9f8; color: var(--info); }
.pill.ok { background: #d9f2e3; color: var(--ok); } .pill.warn { background: #fff1cf; color: #8a5a00; } .pill.bad { background: #fadbd8; color: var(--bad); } .pill.info { background: #dbe9f8; color: var(--info); } .pill.sim { background: #efe3fb; color: #6b3fa0; }
.status { color: #fff; } .status.nog_in_te_plannen { background: var(--s-nog); } .status.voorlopig_gereserveerd { background: var(--s-voorlopig); color: #3b2a00; } .status.wacht_op_levering { background: var(--s-levering); }
.status.wacht_op_klantbevestiging { background: var(--s-klant); } .status.definitief_ingepland { background: var(--s-def); } .status.in_uitvoering { background: var(--s-uitv); } .status.uitgevoerd_wacht_op_controle { background: var(--s-controle); }
.status.afgerond { background: var(--s-klaar); } .status.geblokkeerd { background: var(--s-blok); }

button, .btn { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 6px; padding: .42rem .8rem; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; text-decoration: none; }
button:hover, .btn:hover { border-color: #b7c2cb; text-decoration: none; } button:disabled { opacity: .5; cursor: default; }
button.primary, .btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); } button.primary:hover, .btn.primary:hover { background: var(--brand2); }
button.accent, .btn.accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; } button.accent:hover { filter: brightness(.95); }
button.danger { color: var(--bad); border-color: #efc3bd; } button.small, .btn.small { padding: .2rem .5rem; font-size: .82rem; }
button.big { padding: .75rem 1rem; font-size: 1.05rem; width: 100%; justify-content: center; }
input, select, textarea { font: inherit; border: 1px solid #c9d2d9; border-radius: 6px; padding: .42rem .55rem; background: #fff; color: var(--ink); max-width: 100%; }
textarea { width: 100%; min-height: 80px; resize: vertical; } input:focus, select:focus, textarea:focus { outline: 2px solid #9cc3e0; border-color: #6fa3c8; }
label.f { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; color: var(--muted); } label.f > input, label.f > select, label.f > textarea { color: var(--ink); font-size: .95rem; }
label.chk { display: inline-flex; gap: .4rem; align-items: center; font-size: .92rem; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .7rem; }
.form .wide { grid-column: 1 / -1; }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; } table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; border-bottom: 1px solid var(--line); padding: .35rem .4rem; }
table.t td { border-bottom: 1px solid var(--line2); padding: .4rem; vertical-align: top; } table.t tr:hover td { background: #fafbfc; }
.scrollx { overflow-x: auto; }
.notice { border-left: 4px solid var(--info); background: #eef5fb; padding: .55rem .8rem; border-radius: 4px; font-size: .9rem; margin: .5rem 0; }
.notice.warn { border-color: var(--warn); background: #fff7e6; } .notice.bad { border-color: var(--bad); background: #fdecea; } .notice.ok { border-color: var(--ok); background: #eaf7ef; } .notice.sim { border-color: #6b3fa0; background: #f5eefc; }
.list { list-style: none; padding: 0; margin: 0; } .list li { padding: .5rem 0; border-bottom: 1px solid var(--line2); } .list li:last-child { border-bottom: 0; }
.empty { color: var(--muted); font-style: italic; padding: .4rem 0; }
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; } .tabs a { padding: .5rem .8rem; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--ink); border-color: var(--brand); font-weight: 600; text-decoration: none; }

/* ---------- planbord ---------- */
.toolbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .7rem; }
.toolbar .weeklabel { font-weight: 700; font-size: 1.05rem; min-width: 220px; }
.board { --namew: 170px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; max-height: calc(100vh - 170px); box-shadow: var(--shadow); }
.board-grid { display: grid; min-width: 1100px; }
.bh { position: sticky; top: 0; z-index: 5; background: #f8fafb; border-bottom: 1px solid var(--line); padding: .35rem .5rem; font-size: .82rem; font-weight: 600; }
.bh.today { background: #fff8e3; } .bh.holiday { color: var(--bad); } .bh .hours { display: flex; justify-content: space-between; font-weight: 400; color: var(--muted); font-size: .68rem; margin-top: 2px; }
.bn { position: sticky; left: 0; z-index: 4; background: #fff; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line2); padding: .4rem .5rem; font-size: .86rem; }
.bn .team { font-size: .72rem; color: var(--muted); } .bn.extern { background: #fbf8f2; }
.bh.corner { left: 0; z-index: 6; position: sticky; }
.cell { position: relative; border-left: 1px solid var(--line2); border-bottom: 1px solid var(--line2); min-height: 66px; background-image: linear-gradient(to right, transparent calc(100% - 1px), var(--line2) 1px); }
.cell.today { background-color: #fffcf2; } .cell.nonwork { background-color: #f6f6f6; }
.cell .gridline { position: absolute; top: 0; bottom: 0; width: 1px; background: #f0f2f4; pointer-events: none; }
.blk { position: absolute; border-radius: 5px; padding: 2px 5px 2px 6px; font-size: .74rem; line-height: 1.2; overflow: hidden; cursor: grab; color: #10202a; border: 1px solid rgba(0,0,0,.15); border-left: 4px solid var(--s-nog); background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.08); touch-action: none; user-select: none; }
.blk b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blk .ln { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.blk.voorlopig { background: repeating-linear-gradient(135deg, #fff, #fff 6px, #fbf3df 6px, #fbf3df 12px); border-style: dashed; }
.blk.conflict { outline: 2px solid var(--bad); } .blk.warn::after { content: "!"; position: absolute; top: 1px; right: 4px; font-weight: 800; color: var(--warn); }
.blk.dragging { opacity: .85; cursor: grabbing; z-index: 20; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.blk .rz { position: absolute; right: 0; top: 0; bottom: 0; width: 8px; cursor: ew-resize; }
.blk.readonly { cursor: pointer; }
.absence { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(45deg, rgba(120,120,120,.12), rgba(120,120,120,.12) 5px, rgba(120,120,120,.04) 5px, rgba(120,120,120,.04) 10px); border-left: 2px solid #999; font-size: .68rem; color: #555; padding: 2px 4px; pointer-events: none; }
.absence.pending { border-left-style: dashed; }
.legend { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .6rem; }
.side { position: fixed; top: 52px; right: 0; bottom: 0; width: min(440px, 100vw); background: #fff; border-left: 1px solid var(--line); box-shadow: -6px 0 24px rgba(0,0,0,.12); z-index: 40; overflow-y: auto; padding: 1rem; }
.side .close { float: right; }
.conflict-list li { color: var(--bad); } .warn-list li { color: #8a5a00; }

/* ---------- weekplanning mobiel + mijn werk ---------- */
.day { margin-bottom: 1rem; } .day > h3 { position: sticky; top: 52px; background: var(--bg); padding: .4rem 0; margin: 0; z-index: 3; }
.wk-item { background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--s-nog); border-radius: 6px; padding: .55rem .7rem; margin: .35rem 0; }
.wk-item.mine { border-color: #b8d7ea; box-shadow: 0 0 0 2px #dbeefa inset; }
.wk-item.voorlopig { border-left-style: dashed; }
.wk-item .t { font-weight: 700; } .wk-item .who { font-size: .82rem; color: var(--muted); }
.job-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .9rem; margin-bottom: .8rem; box-shadow: var(--shadow); }
.job-card .time { font-weight: 800; font-size: 1.1rem; } .job-card .actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .4rem; margin-top: .6rem; }
.job-card .actions .btn, .job-card .actions button { justify-content: center; }

/* ---------- klantkaart ---------- */
.cust-head { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 1rem; }
.cust-head .big { font-size: 1.4rem; font-weight: 700; }
.timeline { list-style: none; margin: 0; padding: 0; } .timeline li { border-left: 2px solid var(--line); padding: .2rem 0 .7rem .9rem; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: .45rem; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.timeline li.telefoon::before { background: var(--info); } .timeline li.email::before { background: #6b3fa0; } .timeline li.notitie::before { background: var(--accent); } .timeline li.systeem::before { background: #999; }
.timeline .meta { font-size: .78rem; color: var(--muted); } .timeline .body { white-space: pre-wrap; font-size: .9rem; }

/* ---------- werkbon / handtekening ---------- */
.sigpad { width: 100%; height: 220px; border: 2px dashed #9fb0bd; border-radius: 8px; background: #fff; touch-action: none; display: block; }
.signview { max-width: 760px; margin: 0 auto; }
.savestate { font-size: .8rem; font-weight: 600; } .savestate.local { color: #8a5a00; } .savestate.syncing { color: var(--info); } .savestate.saved { color: var(--ok); }
.photos { display: flex; flex-wrap: wrap; gap: .4rem; } .photos img { width: 92px; height: 92px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

/* ---------- dialogen en meldingen ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(20,30,40,.45); z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 1rem; overflow-y: auto; }
.modal { background: #fff; border-radius: 10px; width: min(720px, 100%); box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.modal header { padding: .9rem 1rem; border-bottom: 1px solid var(--line); font-weight: 700; display: flex; justify-content: space-between; }
.modal .mb { padding: 1rem; } .modal footer { padding: .8rem 1rem; border-top: 1px solid var(--line); display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; }
#toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: .4rem; align-items: center; }
.toast { background: #1f2d36; color: #fff; padding: .55rem .9rem; border-radius: 8px; font-size: .9rem; box-shadow: 0 4px 14px rgba(0,0,0,.25); max-width: 90vw; }
.toast.bad { background: var(--bad); } .toast.ok { background: var(--ok); }
.login { max-width: 380px; margin: 10vh auto; } .login .card { padding: 1.5rem; } .login h1 { margin-bottom: 1rem; }

@media (max-width: 820px) {
  :root { font-size: 15.5px; }
  main#app { padding: .7rem .7rem 5rem; }
  header#top { gap: .5rem; } #nav { display: none; } .top-right #whoami { display: none; }
  .cust-head { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 120px 1fr; }
  .side { top: 0; z-index: 70; }
}
@media print { header#top, #bottomnav, .toolbar, button { display: none !important; } }

/* ---------- v0.2: sheet, uren, inmeten, berichten ---------- */
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center; margin-left: 3px; }
#bottomnav a { position: relative; } #bottomnav a .badge { position: absolute; top: 2px; left: 55%; }
.sheet-wrap { overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); max-height: calc(100vh - 190px); -webkit-overflow-scrolling: touch; }
table.sheet { border-collapse: separate; border-spacing: 0; font-size: .78rem; min-width: 100%; }
table.sheet th, table.sheet td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px 5px; vertical-align: top; min-width: 112px; max-width: 160px; }
table.sheet thead th { position: sticky; top: 0; background: var(--brand); color: #fff; z-index: 3; font-weight: 600; white-space: nowrap; text-align: left; }
table.sheet thead th.today { background: var(--accent); }
table.sheet th.name, table.sheet td.name { position: sticky; left: 0; background: #fff; z-index: 2; min-width: 74px; max-width: 90px; font-weight: 700; }
table.sheet thead th.name { z-index: 4; background: var(--brand); }
table.sheet tr.me td { background: #fff7ef; } table.sheet tr.me td.name { background: #ffeedd; }
table.sheet td.today { background: #fffaf3; }
table.sheet .job { display: block; padding: 2px 0; color: var(--ink); text-decoration: none; line-height: 1.25; }
table.sheet .job + .job { border-top: 1px dashed var(--line); }
table.sheet .job.voorlopig { color: #8a5300; font-style: italic; }
table.sheet .job .t { color: var(--muted); font-size: .7rem; }
table.sheet .off { color: var(--muted); font-weight: 600; text-transform: lowercase; }
table.sheet tr.team td { background: var(--line2); font-weight: 700; color: var(--muted); font-size: .72rem; }
.daycard { background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--accent); border-radius: 10px; padding: .75rem; margin-bottom: .6rem; box-shadow: var(--shadow); }
.daycard .top { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.daycard .hrs { font-weight: 800; font-size: 1.1rem; } .daycard .ot { color: var(--accent); font-weight: 700; } .daycard .ot.neg { color: var(--bad); }
.timepair { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: .5rem 0; }
.timepair input { font-size: 1.15rem; padding: .5rem; width: 100%; }
.saldo { font-size: 2.2rem; font-weight: 800; color: var(--brand); } .saldo.neg { color: var(--bad); }
.flag { font-size: .82rem; padding: .25rem .5rem; border-radius: 5px; margin: .15rem 0; } .flag.hoog { background: #fde8e8; color: #9b1c1c; } .flag.middel { background: #fff3e0; color: #8a5300; } .flag.info { background: #eef4fb; color: #1f4f8a; }
.signedbadge { background: var(--mint); color: #1d5a3f; font-weight: 700; border-radius: 5px; padding: .15rem .5rem; font-size: .8rem; }
.win { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .8rem; margin-bottom: .8rem; box-shadow: var(--shadow); }
.win h3 { margin: 0 0 .4rem; display: flex; gap: .5rem; align-items: center; } .win h3 .nr { background: var(--brand); color: #fff; border-radius: 6px; padding: 0 .5rem; }
.win .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .5rem; }
.win input.prefilled { background: #f2f6fb; } .win input.need { border-color: var(--accent); }
.win .sub { border-top: 1px dashed var(--line); margin-top: .6rem; padding-top: .5rem; }
.thumbs { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0; } .thumbs figure { margin: 0; text-align: center; font-size: .65rem; color: var(--muted); }
.thumbs img { width: 76px; height: 76px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.alarm { background: #fde8e8; border: 2px solid var(--bad); color: #7f1d1d; border-radius: 8px; padding: .7rem; font-weight: 600; margin: .5rem 0; }
.msg { padding: .6rem .2rem; border-bottom: 1px solid var(--line2); cursor: pointer; } .msg.unread .s { font-weight: 800; } .msg .m { font-size: .78rem; color: var(--muted); }
.msg.unread::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px; }
.item { display: flex; gap: .6rem; align-items: flex-start; padding: .45rem 0; border-bottom: 1px solid var(--line2); } .item input[type=checkbox] { width: 22px; height: 22px; margin-top: 2px; flex: none; }
.health td:first-child { font-weight: 600; }
@media (max-width: 820px) { table.sheet th, table.sheet td { min-width: 96px; } .win .grid { grid-template-columns: 1fr 1fr; } }
/* voorkom horizontaal scrollen op telefoons: invoervelden passen zich aan de kolom aan */
label.f { min-width: 0; } label.f > input, label.f > select, label.f > textarea { width: 100%; min-width: 0; }
.form > *, .grid3 > *, .grid2 > *, .win .grid > * { min-width: 0; }
@media (max-width: 820px) { .win .grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .grid3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .toolbar select { max-width: 46vw; } .kv { grid-template-columns: 105px minmax(0, 1fr); } }
@media (max-width: 820px) { html { scroll-padding-top: 64px; scroll-padding-bottom: 96px; } }
#bottomnav a { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
@media (max-width: 820px) { header#top { padding: 0 .6rem; } .top-right { min-width: 0; gap: .4rem; } #syncpill { max-width: 38vw; overflow: hidden; text-overflow: ellipsis; } header .brand span { display: none; } }
@media (min-width: 821px) { #bottomnav { display: none !important; } }
@media (min-width: 821px) { header#top { height: auto; min-height: 52px; flex-wrap: wrap; padding-top: .3rem; padding-bottom: .3rem; } #nav { flex-wrap: wrap; overflow: visible; } }

/* v0.2.1: brede tabellen scrollen op de telefoon binnen hun eigen kader i.p.v. de hele pagina */
@media (max-width: 820px) { table.t { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; } }
