/* Kleuren: licht als basis, donker via het systeem of via de instelling (data-theme). */
:root {
  --bg: #f6f1e7; --card: #fffaf0; --text: #2b2520; --muted: #7a6f62; --line: #e6dccb; --soft: #efe7d8; --sidebar: #efe7d8;
  --ok: #2f7d4f; --bad: #b93a32; --warn: #a8700a; --accent: #c2562f; --accent-text: #fff; --accent-ink: color-mix(in srgb, var(--accent) 86%, #000);
  --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100; --c5: #e87ba4; --c6: #008300; --c7: #6250d6; --c8: #e34948;
  --shadow: 0 1px 2px rgb(70 50 20 / .05), 0 6px 18px rgb(70 50 20 / .06);
  --pad: 18px; --gap: 14px; --radius: 16px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    --bg: #1a1613; --card: #231e1a; --text: #efe6d8; --muted: #a89b8a; --line: #352d26; --soft: #2c2520; --sidebar: #1f1a16;
    --ok: #6cc08b; --bad: #ee7b6f; --warn: #e0aa4a; --accent-ink: color-mix(in srgb, var(--accent) 62%, #fff);
    --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181; --c6: #0ca30c; --c7: #9085e9; --c8: #e66767;
    --shadow: 0 1px 2px rgb(0 0 0 / .35);
    color-scheme: dark;
  }
}
:root[data-theme=dark] {
  --bg: #1a1613; --card: #231e1a; --text: #efe6d8; --muted: #a89b8a; --line: #352d26; --soft: #2c2520; --sidebar: #1f1a16;
  --ok: #6cc08b; --bad: #ee7b6f; --warn: #e0aa4a; --accent-ink: color-mix(in srgb, var(--accent) 62%, #fff);
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181; --c6: #0ca30c; --c7: #9085e9; --c8: #e66767;
  --shadow: 0 1px 2px rgb(0 0 0 / .35);
  color-scheme: dark;
}
:root[data-density=compact] { --pad: 13px; --gap: 10px; --radius: 12px; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
:root[data-density=compact] body { font-size: 14px; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, p { margin: 0; }
.muted { color: var(--muted); }
.pad { padding: 24px 16px; }
.small { font-size: 13px; }
.ink { color: var(--text); }
.icon { flex: none; vertical-align: -3px; }
kbd { font: 600 11.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--soft); color: var(--muted); white-space: nowrap; }
.ok-text { color: var(--ok); } .bad-text { color: var(--bad); } .warn-text { color: var(--warn); }

/* ---------- Indeling: menu links, inhoud rechts ---------- */
body:not(.login) { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 6px; padding: 18px 12px 14px; background: var(--sidebar); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text); padding: 2px 8px 12px; }
.brand:hover { text-decoration: none; }
.searchbtn { display: flex; align-items: center; gap: 9px; width: 100%; font: inherit; font-size: 14px; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; margin-bottom: 8px; }
.searchbtn span { flex: 1; text-align: left; }
.searchbtn:hover { border-color: var(--muted); }
#nav { display: grid; gap: 2px; }
#nav a, .navbtn { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: var(--muted); font: inherit; font-weight: 600; font-size: 14.5px; background: none; border: 0; width: 100%; text-align: left; cursor: pointer; }
#nav a:hover, .navbtn:hover { background: var(--soft); color: var(--text); text-decoration: none; }
#nav a.on { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-ink); }
.side-foot { margin-top: auto; display: grid; gap: 2px; border-top: 1px solid var(--line); padding-top: 8px; }
.navbtn:disabled { opacity: .6; }
.spin .icon { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
main { width: 100%; max-width: 1240px; margin: 0 auto; padding: 26px 28px 48px; min-width: 0; }
#tabbar { display: none; }

/* ---------- Bouwstenen ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 600; font-size: 14px; padding: 8px 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; min-height: 38px; white-space: nowrap; }
.btn:hover { background: var(--soft); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--soft); color: var(--text); }
.btn.danger { color: var(--bad); }
.btn.wide { width: 100%; }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 18px; }
.page-head h1 { font-size: 27px; letter-spacing: -.02em; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar { display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.toolbar input[type=search] { flex: 1 1 220px; max-width: 360px; }
.notice { padding: 12px 14px; margin-bottom: var(--gap); font-size: 14px; border-left: 4px solid var(--warn); }
.notice b { display: block; margin-bottom: 2px; }
.notice.bad { border-left-color: var(--bad); }
.empty { text-align: center; padding: 48px 20px; }
.empty h2 { margin-bottom: 6px; font-size: 19px; }
.empty .btn { margin-top: 16px; }
.count { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 99px; background: var(--soft); color: var(--muted); font-size: 11.5px; text-align: center; letter-spacing: 0; vertical-align: 1px; }
.swatch { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }
.more { display: inline-block; margin-top: 10px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.pill.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 13%, transparent); }
.pill.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 15%, transparent); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: inherit; font-size: 13.5px; font-weight: 600; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; }
.chip span { font-weight: 400; margin-left: 2px; }
.chip:hover { color: var(--text); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 5px; }
.hint { font-weight: 400; color: var(--muted); font-size: 13px; display: block; margin-top: 2px; }
input[type=text], input[type=password], input[type=url], input[type=search], input[type=date], textarea, select { font: inherit; padding: 8px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); min-height: 38px; max-width: 100%; }
dialog input:not([type=checkbox]):not([type=radio]), dialog textarea, dialog select { width: 100%; background: var(--bg); }
textarea { resize: vertical; min-height: 62px; display: block; }
input:focus-visible, textarea:focus-visible, select:focus-visible, .btn:focus-visible, .chip:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 9px; font-weight: 600; margin: 0; }
input[type=checkbox] { width: 19px; height: 19px; accent-color: var(--accent); flex: none; margin: 0; }
.error { color: var(--bad); font-size: 14px; }

/* ---------- Kerncijfers ---------- */
.tiles { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.tile { padding: 15px var(--pad); min-width: 0; }
.tile-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.tile-value { font-size: 26px; font-weight: 700; margin: 3px 0 2px; white-space: nowrap; letter-spacing: -.02em; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.delta { font-size: 12.5px; font-weight: 700; letter-spacing: 0; padding: 2px 7px; border-radius: 99px; }
.delta.up { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.delta.down { color: var(--bad); background: color-mix(in srgb, var(--bad) 13%, transparent); }
.progress { height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; margin: 6px 0; }
.progress i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
td, .tile-value, .stat, .side { font-variant-numeric: tabular-nums; }

/* ---------- Secties en rijen ---------- */
.sections { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); align-items: start; }
.section { padding: var(--pad); min-width: 0; }
.section.full, .tiles.full { grid-column: 1 / -1; }
.section h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 12px; }
.section h4 { margin: 14px 0 6px; font-size: 14px; }
.section h4:first-of-type { margin-top: 0; }
.item { padding: 9px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.item:first-of-type { border-top: 0; padding-top: 0; }
.item .main { min-width: 0; flex: 1; }
.item .main > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .side { flex: none; text-align: right; font-size: 13px; color: var(--muted); }
.rowbtn { width: 100%; font: inherit; color: inherit; background: none; border: 0; border-top: 1px solid var(--line); text-align: left; cursor: pointer; }
.rowbtn:first-of-type { border-top: 0; }
.rowbtn:hover .main > :first-child { text-decoration: underline; }
a.rowbtn:hover { text-decoration: none; }
a.alert { color: var(--text); justify-content: flex-start; }
a.alert:hover { text-decoration: none; }
a.alert:hover .main { text-decoration: underline; }
a.alert .main { white-space: normal; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; }
.stat { font-size: 24px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.stats { display: flex; gap: 26px; flex-wrap: wrap; margin-bottom: 14px; }
.stats:last-child { margin-bottom: 0; }
.share { height: 4px; border-radius: 99px; background: var(--soft); margin-top: 6px; overflow: hidden; }
.share i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* ---------- Vandaag ---------- */
.today { display: grid; gap: var(--gap); grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }

/* ---------- Projecten ---------- */
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.pcard { display: block; padding: var(--pad); color: var(--text); border-top: 4px solid var(--c, var(--accent)); transition: transform .12s, box-shadow .12s; }
.pcard:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 8px 26px rgb(0 0 0 / .1); }
.pcard-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.pcard h2 { font-size: 18px; }
.rows { display: grid; gap: 7px; font-size: 14px; }
.row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.row > span:first-child { color: var(--muted); flex: none; }
.row > span:last-child { text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.detail-head h1 { font-size: 26px; display: flex; align-items: center; gap: 10px; letter-spacing: -.02em; }
.detail-head .dot { width: 14px; height: 14px; }
.back { display: inline-block; margin-bottom: 6px; font-size: 14px; }
.bar { display: flex; gap: 1px; height: 18px; margin-top: 7px; }
.bar i { flex: 1; border-radius: 2px; background: var(--ok); min-width: 1px; }
.bar i.down { background: var(--bad); }
.note { white-space: pre-wrap; }

/* ---------- Grafieken en tabellen ---------- */
.charts { display: grid; gap: var(--gap); grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: var(--gap); }
.charts .wide { grid-column: span 2; }
.chart-box { position: relative; height: 270px; }
.chart-box.small { height: 220px; }
.as-table { margin-top: 12px; }
details summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted); }
details .dlg-inner { display: grid; gap: 14px; margin-top: 14px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; font-weight: 600; }
td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: top; }
tbody tr:first-child td { border-top: 0; }
table.flat th, table.flat td { padding-left: 0; }
table.flat th:last-child, table.flat td:last-child { padding-right: 0; }
.r { text-align: right; white-space: nowrap; }
.sort { font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.sort:hover, .sort.on { color: var(--text); }
tr.click { cursor: pointer; }
tbody tr:hover { background: color-mix(in srgb, var(--soft) 60%, transparent); }
.show-m { display: none; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }

/* ---------- Taken ---------- */
.task { display: flex; align-items: flex-start; gap: 11px; padding: 8px 0; border-top: 1px solid var(--line); }
.task:first-of-type { border-top: 0; }
.task input { margin-top: 2px; }
.task-text { font: inherit; color: inherit; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; display: grid; gap: 1px; min-width: 0; flex: 1; }
.task-text:hover > span:first-child { text-decoration: underline; }
.task.done .task-text > span:first-child { text-decoration: line-through; color: var(--muted); }
.task.prio-low .task-text > span:first-child { color: var(--muted); }
.flag { color: var(--bad); margin-right: 5px; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; }
.quick input[type=text] { flex: 1 1 220px; }
.done-list { margin-top: 16px; }

/* ---------- Planning ---------- */
.plan { display: grid; gap: var(--gap); grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); align-items: start; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-dow { text-align: center; font-size: 11.5px; color: var(--muted); padding: 4px 0; text-transform: uppercase; }
.cal-cell { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font: inherit; font-size: 13.5px; color: var(--text); background: none; border: 1px solid transparent; border-radius: 10px; cursor: pointer; padding: 0; }
.cal-cell:hover { background: var(--soft); }
.cal-cell.today { font-weight: 700; color: var(--accent-ink); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.cal-cell.sel { border-color: var(--accent); }
.cal-cell.blank { cursor: default; }
.dots { display: flex; gap: 2px; height: 5px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 12px; }
.legend i, .kdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.event { justify-content: flex-start; color: var(--text); padding-left: 0; padding-right: 0; }
.event .main { display: grid; gap: 1px; }
.daybox { flex: none; width: 44px; padding: 5px 0; border-radius: 10px; background: var(--soft); text-align: center; font-size: 11px; color: var(--muted); text-transform: uppercase; line-height: 1.15; }
.daybox b { display: block; font-size: 16px; color: var(--text); }
.daybox.late { background: color-mix(in srgb, var(--bad) 13%, transparent); }

/* ---------- Notities en snelkoppelingen ---------- */
.notes { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); align-items: start; }
.notes.mini { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.notecard { position: relative; display: grid; gap: 6px; padding: 14px; text-align: left; font: inherit; color: var(--text); cursor: pointer; border-top: 4px solid var(--nc, var(--line)); background: color-mix(in srgb, var(--nc, var(--card)) 9%, var(--card)); }
.notecard:hover { box-shadow: 0 8px 24px rgb(0 0 0 / .1); }
.notetext { white-space: pre-wrap; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; font-size: 14px; }
.notes.mini .notetext { -webkit-line-clamp: 4; }
.pinned { position: absolute; top: 10px; right: 10px; color: var(--muted); }
.linkgroup { margin-bottom: 10px; }
.linkgroup:last-child { margin-bottom: 0; }
.linkrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 5px; }
.linkchip { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--card); overflow: hidden; }
.linkchip a { display: flex; align-items: center; gap: 8px; padding: 7px 11px; color: var(--text); font-weight: 600; font-size: 14px; }
.linkchip a:hover { background: var(--soft); text-decoration: none; }
.linkchip button { border: 0; border-left: 1px solid var(--line); background: none; color: var(--muted); padding: 0 8px; align-self: stretch; cursor: pointer; }
.linkchip button:hover { background: var(--soft); color: var(--text); }
.fav { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-ink); font-size: 11.5px; font-weight: 700; }

/* ---------- Instellingen ---------- */
.settings { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); align-items: start; }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.setrow:first-of-type { border-top: 0; padding-top: 0; }
.setrow.tight { padding: 7px 0; }
.setctl { display: flex; gap: 4px; align-items: center; }
.setctl input[type=text] { width: 170px; }
.setcheck { padding: 7px 0; font-weight: 500; }
.seg { display: inline-flex; background: var(--soft); border-radius: 10px; padding: 3px; }
.seg button { font: inherit; font-size: 13.5px; font-weight: 600; padding: 6px 12px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches label { margin: 0; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; width: 28px; height: 28px; border-radius: 50%; background: var(--c); cursor: pointer; border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--line); }
.swatches input:checked + span { box-shadow: 0 0 0 2px var(--text); }
.swatches input:focus-visible + span { box-shadow: 0 0 0 2px var(--accent); }

/* ---------- Vensters ---------- */
dialog { border: 1px solid var(--line); border-radius: 18px; background: var(--card); color: var(--text); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: 0 24px 70px rgb(0 0 0 / .3); }
dialog::backdrop { background: rgb(8 10 14 / .5); backdrop-filter: blur(2px); }
.dlg-body { padding: 20px; display: grid; gap: 14px; }
.dlg-body h2 { font-size: 19px; }
.dlg-foot { display: flex; justify-content: space-between; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--card); }
.dlg-foot .right { display: flex; gap: 8px; margin-left: auto; }
dialog.palette { margin-top: 12vh; width: min(620px, calc(100vw - 24px)); }
.pal-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.pal-head input { flex: 1; border: 0 !important; background: none !important; padding: 0 !important; font-size: 16px; min-height: 0; outline: none !important; }
#pal-list { padding: 6px; max-height: 52vh; overflow-y: auto; }
.pal-item { display: flex; align-items: center; gap: 11px; width: 100%; font: inherit; color: var(--text); background: none; border: 0; border-radius: 10px; padding: 10px; text-align: left; cursor: pointer; }
.pal-item .main { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-item .icon { color: var(--muted); }
.pal-item.on, .pal-item:hover { background: var(--soft); }
.morelist { display: grid; gap: 2px; }
.morelist a, .morelist button { display: flex; align-items: center; gap: 12px; padding: 12px 8px; border-radius: 10px; font: inherit; font-weight: 600; color: var(--text); background: none; border: 0; text-align: left; cursor: pointer; }
.morelist a:hover, .morelist button:hover { background: var(--soft); text-decoration: none; }

#toast { position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 14px; transition: .2s; max-width: calc(100vw - 32px); z-index: 20; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Inloggen ---------- */
body.login { display: grid; place-items: center; min-height: 100dvh; padding: 16px; }
.login-card { width: min(340px, 100%); padding: 26px; display: grid; gap: 10px; justify-items: start; }
.login-card h1 { font-size: 22px; margin-bottom: 8px; }
.login-card label { margin: 0; }
.login-card input { width: 100%; }

/* ---------- Smaller scherm ---------- */
@media (max-width: 1100px) {
  .charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .charts .wide { grid-column: 1 / -1; }
  .plan { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  body:not(.login) { display: block; }
  .sidebar { display: none; }
  main { padding: calc(16px + env(safe-area-inset-top)) 14px calc(92px + env(safe-area-inset-bottom)); }
  #tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: var(--sidebar); border-top: 1px solid var(--line); }
  #tabbar a, #tabbar button { flex: 1; display: grid; justify-items: center; gap: 3px; padding: 6px 2px; font: inherit; font-size: 11.5px; font-weight: 600; color: var(--muted); background: none; border: 0; cursor: pointer; }
  #tabbar a:hover { text-decoration: none; }
  #tabbar .on { color: var(--accent-ink); }
  #toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .page-head h1 { font-size: 23px; }
  .today, .charts { grid-template-columns: 1fr; }
  .charts .wide { grid-column: auto; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-value { font-size: 21px; }
  .sections, .settings { grid-template-columns: 1fr; }
  .hide-m { display: none; }
  .show-m { display: inline; }
  th, td { padding: 10px 12px; }
  .chart-box { height: 230px; }
  .toolbar input[type=search] { max-width: none; flex-basis: 100%; }
  .page-head kbd { display: none; }
  dialog.sheet { margin-bottom: 0; width: 100vw; max-width: none; border-radius: 18px 18px 0 0; }
  dialog.palette { margin-top: 5vh; }
}
@media print {
  .sidebar, #tabbar, .btn, .toolbar, .filters { display: none !important; }
  body:not(.login) { display: block; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ---------- Papier: koppen en cijfers in een schreefletter ---------- */
h1, .brand, .tile-value, .stat, .pcard h2, .dlg-body h2, .empty h2, .daybox b, .cal-head b, .notecard b { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; }
.page-head h1, .detail-head h1 { font-size: 31px; font-weight: 600; }
.tile-value { font-size: 28px; }
.brand { font-size: 19px; }
.section h3 { letter-spacing: .08em; }
.btn, .chip, .seg button, #nav a, .navbtn { letter-spacing: 0; }
@media (max-width: 820px) { .page-head h1, .detail-head h1 { font-size: 26px; } .tile-value { font-size: 23px; } }
