:root {
  --fg: #000;
  --bg: #fff;
  --mute: #666;
  --line: #d4d4d4;
  --soft: #f4f4f4;
  --err: #b00020;
  --ok: #111;
  --page: #f4f6fb;
  --accent: #256abf;
  --accent-dark: #1c5cab;
  --accent-soft: #e6f0fc;
  --ink-2: #52514e;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--fg);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
main { max-width: 720px; margin: 0 auto; padding: 14px 14px 60px; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 18px 0 8px; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
small, .muted { color: var(--mute); }
.lbl { color: var(--mute); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }

.top {
  position: sticky; top: 0; z-index: 5; color: #fff;
  background: linear-gradient(110deg, var(--accent-dark), #6250d6);
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
}
.top .brand { font-weight: 700; text-decoration: none; letter-spacing: .02em; }
.search-link { display: flex; padding: 4px; color: #fff; font-size: 1.15rem; }
.top nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; }
.top nav a { text-decoration: none; padding: 6px 10px; border-radius: 8px; color: #e6ecfa; white-space: nowrap; }
.top nav a.on { background: #fff; color: var(--accent-dark); font-weight: 600; }
.i, .ico { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.i { vertical-align: -.2em; }
.top nav .ico { display: none; }
.top nav .ico.always { display: inline-block; vertical-align: -.2em; }
.top nav .phone-only { display: none; }
/* Op telefoon: tabbalk onderaan, binnen bereik van de duim */
@media (max-width: 640px) {
  main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .search-link { margin-left: auto; padding: 8px; }
  .top nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; margin: 0; gap: 0; overflow: visible;
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
    padding: 4px 2px calc(4px + env(safe-area-inset-bottom));
    background: #fff; border-top: 1px solid #e4e8f1; box-shadow: 0 -2px 8px rgba(28, 92, 171, .08);
  }
  .top nav a { display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 48px; padding: 4px 0; color: var(--ink-2); font-size: .66rem; letter-spacing: -.01em; }
  .top nav a.on { background: var(--accent-soft); color: var(--accent-dark); }
  .top nav .ico, .top nav .ico.always { display: block; width: 24px; height: 24px; }
  .top nav a.on .ico { stroke-width: 2.3; }
  .top nav .phone-only { display: inline; }
  .top nav .desk-only { display: none; }
}

label { display: block; font-size: .85rem; color: var(--mute); margin: 10px 0 0; }
label.check { display: flex; gap: 8px; align-items: center; color: var(--fg); font-size: .95rem; margin-top: 12px; }
input, select, textarea, button, .btn {
  font: inherit; color: var(--fg);
}
input[type=text], input[type=date], input[type=time], input[type=password], input[type=email],
select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  min-height: 44px;
}
input[type=checkbox] { width: 20px; height: 20px; accent-color: #000; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > label { flex: 1 1 110px; }

button, .btn {
  display: inline-block; padding: 10px 16px; margin-top: 12px; min-height: 44px;
  border: 1px solid #000; border-radius: 8px; background: #fff; cursor: pointer;
  text-decoration: none; text-align: center;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; width: 100%; font-weight: 600; }
.row button.primary { width: auto; }
button.danger { color: var(--err); border-color: var(--err); }
button.link { border: 0; background: none; padding: 4px 0; min-height: 0; margin: 6px 0 0; color: var(--mute); text-decoration: underline; }
form.inline { display: inline; }
form.inline button.link { margin: 0 0 0 8px; }
.suggest { list-style: none; margin: 4px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.suggest button { display: block; width: 100%; margin: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: #fff; text-align: left; }
.suggest .credit { padding: 4px 10px; font-size: .7rem; color: var(--mute); }
.addr-hint { display: block; margin-top: 4px; }
.addr-hint:empty { display: none; }
.plain form { margin-bottom: 14px; }

.card { border: 1px solid #e4e8f1; border-radius: 14px; padding: 14px; margin: 12px 0; background: #fff; box-shadow: 0 1px 3px rgba(28, 92, 171, .07); }
.card h2, .card h3 { margin-top: 0; }
details.card > summary { cursor: pointer; list-style: none; padding: 2px 0; }
details.card > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 6px; }

.flash { padding: 10px 12px; border-radius: 8px; margin: 10px 0; border: 1px solid var(--line); background: var(--soft); }
.flash.error { border-color: var(--err); color: var(--err); background: #fff; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.stats > div { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stats .big { display: block; font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.modes { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; margin-top: 12px; padding: 4px; background: var(--accent-soft); border-radius: 12px; }
.modes button { margin: 0; padding: 10px 4px; border: 0; border-radius: 8px; background: none; color: var(--accent-dark); font-weight: 600; }
.modes button[aria-selected=true] { background: var(--accent); color: #fff; }

.timer.running { background: linear-gradient(135deg, var(--accent-dark), #6250d6); color: #fff; border-color: transparent; }
.timer.running .lbl, .timer.running .muted { color: #e6ecfa; }
.timer.running input { color: #000; }
.timer.running label { color: #e6ecfa; }
.timer.running button.primary { background: #fff; border-color: #fff; color: var(--accent-dark); }
.timer.running button.link { color: #e6ecfa; }

.meter { position: relative; display: block; height: 12px; border-radius: 999px; background: #cde2fb; }
.meter > span { display: block; height: 100%; min-width: 6px; border-radius: 999px; background: #2a78d6; }
.meter.done { background: #d5f0d5; }
.meter.done > span { background: #0ca30c; }
.meter > i { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: #0b0b0b; border-radius: 1px; }

.goal-strip { display: block; margin-top: 4px; padding: 12px 14px; border-radius: 14px; background: #fff; border: 1px solid #e4e8f1; text-decoration: none; }
.goal-strip .row-line { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.goal-strip strong { font-size: 1.25rem; }
.goal-strip small { color: var(--ink-2); }

.hero { margin-top: 4px; padding: 18px 16px; border-radius: 16px; background: #fff; border: 1px solid #e4e8f1; box-shadow: 0 1px 3px rgba(28, 92, 171, .07); }
.hero .lbl { color: var(--ink-2); }
.hero-value { font-size: 3.25rem; font-weight: 700; line-height: 1.1; margin: 6px 0 14px; }
.meter-text { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; color: var(--ink-2); font-size: .9rem; }
.meter-text strong { color: var(--fg); }
.hero-note { margin: 8px 0 0; color: var(--ink-2); font-size: .9rem; }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.kpi { padding: 12px; border-radius: 14px; background: #fff; border: 1px solid #e4e8f1; border-top: 3px solid; }
.kpi strong { display: block; font-size: 1.4rem; margin-top: 2px; }
.kpi .lbl { color: var(--ink-2); text-transform: none; letter-spacing: 0; }
.kpi.k1 { border-top-color: #2a78d6; }
.kpi.k2 { border-top-color: #eb6834; }
.kpi.k3 { border-top-color: #1baf7a; }
.kpi.k4 { border-top-color: #eda100; }

.chart { display: block; width: 100%; height: auto; font-size: 11px; }
.chart .grid { stroke: #e1e0d9; stroke-width: 1; }
.chart .baseline { stroke: #c3c2b7; stroke-width: 1; }
.chart .tick, .chart .month { fill: #6b6a65; font-variant-numeric: tabular-nums; }
.chart .month.now { fill: #0b0b0b; font-weight: 700; }
.chart .bar { fill: #86b6ef; }
.chart .bar.now { fill: #2a78d6; }
.chart .cap { fill: #0b0b0b; font-weight: 700; }
.chart .goal { stroke: #eb6834; stroke-width: 2; }
.chart .goal-label { fill: #0b0b0b; font-weight: 600; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.chart .hit { fill: transparent; cursor: pointer; outline: none; }
.chart .hit:hover, .chart .hit:focus { fill: rgba(42, 120, 214, .08); }
.chart-readout { margin: 0 0 6px; color: var(--ink-2); font-size: .9rem; min-height: 1.3em; }
.as-table { margin-top: 8px; font-size: .9rem; }
.as-table summary { cursor: pointer; color: var(--ink-2); }

.share { list-style: none; margin: 0; padding: 0; }
.share li { padding: 8px 0; }
.share li > div { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.share .name { min-width: 0; overflow-wrap: anywhere; }
.share .track { display: block; margin: 4px 0 2px; height: 10px; }
.share .track span { display: block; height: 100%; min-width: 4px; border-radius: 0 4px 4px 0; }
.small-note { font-size: .8rem; }

.to-bill { display: block; margin-top: 12px; padding: 14px 16px; border-radius: 14px; text-decoration: none; color: #fff; background: linear-gradient(135deg, #1c5cab, #6250d6); }
.to-bill > .billing-row:first-child { font-weight: 600; }
.to-bill > .billing-row:first-child strong { font-size: 1.5rem; }
.to-bill-row { display: flex; margin-top: 4px; font-size: .9rem; color: #e6ecfa; }
.to-bill-link { display: block; margin-top: 8px; font-size: .9rem; font-weight: 600; }
.billing-row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.btn.block { display: block; }
.check-row { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid var(--line); }
.check-row small { display: block; }
.dot { flex: none; width: 1.4em; height: 1.4em; line-height: 1.4em; border-radius: 50%; text-align: center; font-size: .8rem; font-weight: 700; background: var(--line); }
.dot.ok { background: #1baf7a; color: #fff; }
.dot.warn { background: #eda100; color: #000; }
.dot.bad { background: var(--err); color: #fff; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.check.pick { align-items: flex-start; font-size: .9rem; margin-top: 8px; }
.check.pick input { flex: none; }
.invoice-row small { display: block; }
.late { color: var(--err); font-weight: 600; }
.late-note { color: var(--err); font-weight: 600; margin: 4px 0 8px; }
.paid-list { margin: 12px 0; }
.paid-list summary, .card details summary { cursor: pointer; font-weight: 600; }
.invoice-detail-line { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.invoice-detail-line small { display: block; }
.invoice-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.invoice-row button.link { margin: 0; white-space: nowrap; }
.invoice-line { padding: 10px 0; border-bottom: 1px solid var(--line); }
.copy-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.copy-group strong { margin-left: auto; }
button.copy { min-height: 36px; margin: 0; padding: 6px 10px; border: 1px solid #c9dcf5; background: var(--accent-soft); font-size: .9rem; text-align: left; }
button.copy.wide { display: block; width: 100%; }
button.copy.copied, .btn-copy-all.copied { background: #d5f0d5; border-color: #0ca30c; }
button.copy.copied::after, .btn-copy-all.copied::after { content: " ✓"; }
.btn-copy-all { width: 100%; }
.total-line { padding-top: 10px; }
fieldset.plain-set { border: 0; margin: 0; padding: 0; min-width: 0; }

.client-search { margin: 4px 0 0; font-size: 1rem; width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.client-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.client-head h2 { margin: 0; }
.client-head a { color: var(--accent-dark); font-size: .9rem; white-space: nowrap; }
.client-card.off { opacity: .55; }
.end-card { margin-top: 12px; padding: 10px 0 0; border-top: 1px solid #e4e8f1; }
.end-card h3 { margin: 0; }
.contact { margin-top: 4px; }
.contact a, .contact-person { display: block; padding: 5px 0; text-decoration: none; overflow-wrap: anywhere; white-space: pre-line; }
.contact a { color: var(--accent-dark); }
.contact-person { color: var(--ink-2); }
.contact-notes { margin: 4px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--accent-soft); font-size: .9rem; white-space: pre-line; }
details.sub { margin: 4px 0 12px; }
details.sub summary { cursor: pointer; color: var(--ink-2); font-size: .9rem; }
.clock { font-size: 2.6rem; font-weight: 700; font-variant-numeric: tabular-nums; margin: 4px 0; }
.who { font-weight: 600; }

.list, .plain { list-style: none; margin: 0; padding: 0; }
.list li a {
  display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line);
  text-decoration: none; align-items: baseline;
}
.list .t { font-weight: 700; min-width: 48px; font-variant-numeric: tabular-nums; }
.list .d { display: flex; flex-direction: column; min-width: 0; }
.list small { overflow: hidden; text-overflow: ellipsis; }
.plain li { padding: 4px 0; }
.plain li.off { opacity: .5; }
.catalog > li { padding: 10px 0; border-bottom: 1px solid #e4e8f1; }
.catalog-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.catalog-line .price { font-variant-numeric: tabular-nums; white-space: nowrap; }
.catalog-line form.inline button.link { margin: 0; white-space: nowrap; }

.filter { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.filter select { grid-column: 1 / -1; margin: 0; }
.filter input { margin: 0; }
.filter button { grid-column: 1 / -1; margin: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chips a { border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; text-decoration: none; font-size: .9rem; }
.chips a.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.quick { margin: 10px 0 0; }
.quick button { width: auto; min-height: 40px; margin: 0; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: inherit; font: inherit; font-size: .9rem; }
.quick button[aria-pressed] { background: var(--accent); border-color: var(--accent); color: #fff; }
.list small + small { margin-top: 1px; }
.actions { display: flex; gap: 10px; }
.actions .btn { margin-top: 0; flex: 1; }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; color: var(--mute); text-transform: uppercase; }
.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.field-note { display: block; margin-top: 4px; }
.todo-strip { display: block; margin-top: 8px; padding: 10px 14px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; text-decoration: none; }
.todos { list-style: none; margin: 12px 0 0; padding: 0; }
.todos li { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.todo-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.todo-text small { display: block; color: var(--ink-2); }
.todos .late { color: var(--err); }
.todos.done .todo-text { color: var(--mute); text-decoration: line-through; }
button.tick { width: 28px; height: 28px; min-height: 0; margin: 0; padding: 0; border: 2px solid var(--accent); border-radius: 8px; background: #fff; color: var(--accent); font-weight: 700; line-height: 1; }
.todos form.inline button.link { margin: 0; white-space: nowrap; }
.ext-send { margin: 4px 0 12px; }
.ext-send button[disabled] { opacity: .5; }
.sheet-text { white-space: pre-wrap; font: inherit; font-size: .85rem; background: var(--soft, #f5f6f8); padding: 10px; border-radius: 8px; overflow-wrap: anywhere; }
.heat-stats { margin: 0 0 8px; font-size: .9rem; color: var(--ink-2); }
.heat-stats strong { color: var(--fg); font-variant-numeric: tabular-nums; }
.heat-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.heat { display: block; width: 100%; min-width: 620px; height: auto; }
.heat text { font-size: 10px; fill: #6b6a65; }
.heat rect { cursor: pointer; }
.heat rect.picked { stroke: var(--fg); stroke-width: 1.5; }
.heat .l0, .heat-legend .l0 { fill: #edf0f5; background: #edf0f5; }
.heat .l1, .heat-legend .l1 { fill: #bcd3f1; background: #bcd3f1; }
.heat .l2, .heat-legend .l2 { fill: #7eaae4; background: #7eaae4; }
.heat .l3, .heat-legend .l3 { fill: #3b7bcf; background: #3b7bcf; }
.heat .l4, .heat-legend .l4 { fill: #164a8c; background: #164a8c; }
.heat-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; margin-top: 6px; font-size: .85rem; color: var(--ink-2); }
.heat-legend { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.heat-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
@media (forced-colors: active) { .heat rect { stroke: CanvasText; stroke-width: .5; } }
.todo-strip > a { color: inherit; text-decoration: none; display: block; }
.todo-strip-item { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-weight: 400; color: var(--fg); overflow-wrap: anywhere; }
.todo-strip-item small { color: var(--ink-2); }
.todo-strip-item button.tick { flex: none; }
.todo-new summary { cursor: pointer; }
.todo-group { margin: 18px 0 0; font-size: 1rem; }
.todo-group small { color: var(--mute); font-weight: 400; }
.todo-group.late { color: var(--err); }
.todos li.prio .star { color: #c98a00; }
.todo-notes { margin: 4px 0 0; font-size: .9rem; color: var(--ink-2); white-space: normal; }
.todos.done .todo-text small { text-decoration: none; }
.due-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.due-quick button, .todo-actions button { width: auto; min-height: 36px; margin: 0; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: inherit; font-size: .85rem; }
.todo-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.todo-actions form.inline { display: contents; }
.todo-quick { display: flex; gap: 6px; align-items: stretch; margin-top: 10px; }
.todo-quick input[type=text] { flex: 1; margin: 0; }
.todo-quick input[type=date] { width: auto; margin: 0; }
.todo-quick button { width: auto; margin: 0; padding: 0 16px; }
.material-title { margin-top: 18px; }
[data-material-price][hidden], #material-loose[hidden] { display: none; }
.material-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.material-row small { display: block; }
.qr { width: 220px; max-width: 100%; margin: 8px 0; background: #fff; }
.qr svg { display: block; width: 100%; height: auto; }
.secret-key { font-family: ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.codes { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-family: ui-monospace, Consolas, monospace; font-size: .9rem; }
.recovery { border-color: #eda100; }
.project-band td { background: var(--accent-soft); font-weight: 700; }
.project-title { margin: 0 0 8px; font-size: 1.05rem; font-weight: 700; }
tfoot td { font-weight: 700; border-bottom: 0; border-top: 2px solid #000; }

.total > div { display: flex; justify-content: space-between; padding: 4px 0; }
.total .sum { border-top: 2px solid #000; margin-top: 6px; padding-top: 8px; font-size: 1.1rem; }

.login { max-width: 320px; margin: 18vh auto 0; padding: 0 16px; }
.login h1 { font-size: 2rem; }
