/* Light, soft and friendly (inspired by visual day planners), still calm: no confetti, motion only when the
   device allows it. Status is always written out as text too, never shown by colour alone.
   Colours per list/area: classes c-<name> set --tile (background) and --ink (text on it). */

:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --text: #2b2a33;
  --muted: #736e7c;
  --line: #ece6dd;
  --accent: #6c63d9;
  --accent-ink: #ffffff;
  --accent-soft: #eeecfc;
  --focus: #4b43b8;
  --shadow: 0 1px 2px rgba(43, 42, 51, 0.05), 0 4px 14px rgba(43, 42, 51, 0.06);
  --radius: 18px;
  --radius-small: 12px;
  --tab-height: 4.25rem;
  --tile: #f1ece4;
  --ink: #5b5348;
  color-scheme: light;
}

.c-lucht    { --tile: #dcebfa; --ink: #2f5d8a; }
.c-munt     { --tile: #d6f1e4; --ink: #24694c; }
.c-lavendel { --tile: #e6e0fa; --ink: #4f3f9e; }
.c-perzik   { --tile: #fde2d2; --ink: #8a4a26; }
.c-boter    { --tile: #fbefc4; --ink: #7a5e10; }
.c-roos     { --tile: #f9dbe4; --ink: #8c3653; }
.c-salie    { --tile: #e0ead6; --ink: #46613a; }
.c-zand     { --tile: #f1ece4; --ink: #5b5348; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.5;
}
body.signed-in { padding-bottom: calc(var(--tab-height) + env(safe-area-inset-bottom) + 5rem); }

main, .foot { max-width: 40rem; margin: 0 auto; padding: 0 1rem; }
main { padding-top: 1.25rem; }

h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.01em; margin: 0.25rem 0 0.25rem; }
h2 { font-size: 1.05rem; font-weight: 700; margin: 1.75rem 0 0.6rem; }
.date, .subtitle { display: block; color: var(--muted); font-size: 1rem; font-weight: 500; margin: 0 0 1rem; }
h1 .date { display: inline; margin-left: 0.4rem; }

a { color: var(--accent); text-underline-offset: 0.15em; }
small, .hint { color: var(--muted); }
.hint { font-size: 0.95rem; margin-top: 0; }
.empty { color: var(--muted); padding: 0.5rem 0; }
.crumb { margin: 0; font-size: 0.95rem; }
.crumb a { text-decoration: none; }
.status { color: var(--muted); margin-top: 0; }
.more-links { margin-top: 2rem; font-size: 0.95rem; text-align: center; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- tab bar (bottom, on every screen size) ------------------------------------------------------------------ */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around;
  height: calc(var(--tab-height) + env(safe-area-inset-bottom));
  padding: 0.35rem 0.25rem env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, 0.96); border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem;
  color: var(--muted); text-decoration: none; font-size: 0.75rem; font-weight: 600; border-radius: 14px;
}
.tabbar svg { width: 1.6rem; height: 1.6rem; }
.tabbar a[aria-current="page"] { color: var(--accent); }
.tabbar a[aria-current="page"] svg { background: var(--accent-soft); border-radius: 10px; padding: 0.1rem 0.6rem; width: 2.8rem; }

@media (min-width: 48rem) {
  .tabbar { left: 50%; right: auto; transform: translateX(-50%); width: 34rem; bottom: 1rem; height: var(--tab-height);
            padding-bottom: 0.35rem; border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
}

/* --- floating + button and the capture sheet --------------------------------------------------------------------- */

.fab {
  position: fixed; z-index: 21; right: 1.1rem; bottom: calc(var(--tab-height) + env(safe-area-inset-bottom) + 1rem);
  width: 3.75rem; height: 3.75rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px rgba(108, 99, 217, 0.35);
  text-decoration: none;
}
.fab svg { width: 1.8rem; height: 1.8rem; }
@media (min-width: 48rem) { .fab { right: calc(50% - 19rem); bottom: calc(var(--tab-height) + 2rem); } }

dialog.sheet {
  width: 100%; max-width: 36rem; margin: auto auto 0; padding: 1.25rem 1.1rem calc(1.25rem + env(safe-area-inset-bottom));
  border: 0; border-radius: 24px 24px 0 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
dialog.sheet::backdrop { background: rgba(43, 42, 51, 0.28); }
@media (min-width: 48rem) { dialog.sheet { margin: auto; border-radius: 24px; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.sheet-head h2 { margin: 0; }
.capture-title { font-size: 1.15rem; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0; border: 0; padding: 0; }
.chips label { margin: 0; }
.chips input { position: absolute; opacity: 0; }
.chips span {
  display: inline-flex; align-items: center; gap: 0.3rem; min-height: 2.5rem; padding: 0.35rem 0.9rem;
  border-radius: 999px; background: var(--bg); border: 1px solid var(--line); cursor: pointer;
}
.chips input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--focus); font-weight: 600; }
.chips input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

/* --- forms and buttons --------------------------------------------------------------------------------------------- */

input, select, textarea, button { font: inherit; color: inherit; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%; min-height: 3rem; padding: 0.6rem 0.9rem;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-small);
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; }

button, a.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 2.9rem; padding: 0.45rem 1.1rem; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px;
  color: var(--text); text-decoration: none; font-weight: 600;
}
button:hover, a.button:hover { border-color: var(--accent); }
button.primary, a.button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.quiet, a.button.quiet { background: none; border-color: transparent; color: var(--accent); padding-inline: 0.6rem; }
button.quiet:hover, a.button.quiet:hover { background: var(--accent-soft); }
button.link { background: none; border: 0; min-height: auto; padding: 0 0.25rem; color: inherit; text-decoration: underline; font-weight: 700; }
button.block { width: 100%; }

form { margin: 0 0 0.75rem; }
form.inline { display: inline; margin: 0; }
label { display: block; margin-bottom: 0.9rem; font-weight: 600; font-size: 0.95rem; }
label input, label select, label textarea { margin-top: 0.3rem; font-weight: 400; }
label.check-label { display: flex; gap: 0.7rem; align-items: center; font-weight: 500; }
input[type="checkbox"], input[type="radio"] { width: 1.3rem; height: 1.3rem; accent-color: var(--accent); flex: none; }
fieldset { border: 0; padding: 0; margin: 0 0 0.9rem; }
legend { margin-bottom: 0.5rem; font-weight: 600; font-size: 0.95rem; }
.two { display: grid; gap: 0 0.9rem; grid-template-columns: 1fr 1fr; }

.card-form { padding: 1.1rem; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); margin-top: 1.25rem; }
.card-form h2 { margin-top: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.9rem 0; }
.danger-zone { margin-top: 1.5rem; text-align: center; }

/* colour swatches and emoji suggestions in edit forms */
.swatches { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.swatches label { margin: 0; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; width: 2.4rem; height: 2.4rem; border-radius: 50%; background: var(--tile); border: 2px solid transparent; cursor: pointer; }
.swatches input:checked + span { border-color: var(--ink); box-shadow: inset 0 0 0 3px var(--surface); }
.swatches input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.icon-picks { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.4rem 0 1.25rem; }
.icon-picks button { min-height: 2.5rem; width: 2.5rem; padding: 0; font-size: 1.25rem; border-radius: 12px; }

/* --- messages (toasts) ------------------------------------------------------------------------------------------- */

.toasts {
  position: fixed; z-index: 30; left: 1rem; right: 1rem; bottom: calc(var(--tab-height) + env(safe-area-inset-bottom) + 5.5rem);
  display: grid; gap: 0.5rem; max-width: 30rem; margin: 0 auto; pointer-events: none;
}
.message {
  pointer-events: auto; display: flex; gap: 0.6rem; align-items: center; justify-content: space-between; flex-wrap: wrap;
  margin: 0; padding: 0.75rem 1rem; border-radius: 16px; background: var(--text); color: #fff; box-shadow: var(--shadow);
}
.message a { color: #fff; font-weight: 700; }
.message.error { background: #fff4ec; color: #6b3414; border: 1px solid #f6d3bb; }
.message.error a { color: #6b3414; }
.message.error::before { content: "Let op:"; font-weight: 700; }
.inline-message { position: static; margin: 0 0 1rem; }
.message.leaving { opacity: 0; transition: opacity 0.3s; }

/* --- cards: entries ---------------------------------------------------------------------------------------------- */

ul.cards, ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }

.entry {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background: var(--tile); touch-action: pan-y;
}
.entry .swipe-hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between;
                     padding: 0 1.25rem; font-weight: 700; color: var(--ink); }
.entry .swipe-inner {
  position: relative; display: flex; gap: 0.8rem; align-items: center; padding: 0.7rem 0.75rem 0.7rem 0.7rem;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
}
.tile {
  flex: none; width: 2.9rem; height: 2.9rem; border-radius: 14px; display: grid; place-items: center;
  background: var(--tile); color: var(--ink); font-size: 1.4rem; font-weight: 800; line-height: 1;
}
.entry-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.entry-text a { color: var(--text); text-decoration: none; font-weight: 600; }
.entry-text a::after { content: ""; position: absolute; inset: 0; }  /* the whole card opens the entry */
.meta { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.2rem; }
.pill { font-size: 0.78rem; padding: 0.05rem 0.55rem; border-radius: 999px; background: var(--bg); color: var(--muted); font-weight: 600; }
.pill.colored { background: var(--tile); color: var(--ink); }
.entry form.inline { position: relative; z-index: 1; }  /* buttons above the full-card link */

button.check {
  flex: none; width: 2.9rem; height: 2.9rem; min-height: 0; padding: 0; border: 0; background: none; border-radius: 50%;
}
button.check::before {
  content: ""; display: block; width: 1.7rem; height: 1.7rem; margin: auto; border-radius: 50%;
  border: 2.5px solid var(--ink); background: var(--surface);
}
button.check:hover::before { background: var(--tile); }
.entry.completing button.check::before { background: var(--ink); box-shadow: inset 0 0 0 4px var(--surface); }
button.icon-button { min-height: 2.6rem; width: 2.6rem; padding: 0; border-radius: 50%; border-color: transparent; background: var(--bg); color: var(--muted); }
button.icon-button svg { width: 1.3rem; height: 1.3rem; }

@media (prefers-reduced-motion: no-preference) {
  .entry .swipe-inner { transition: transform 0.2s ease; }
  .entry.dragging .swipe-inner { transition: none; }
  .entry.completing { animation: fade-out 0.35s ease forwards 0.15s; }
  @keyframes fade-out { to { opacity: 0; transform: scale(0.98); } }
}

/* --- today: timeline and tiles ----------------------------------------------------------------------------------- */

ul.timeline { list-style: none; margin: 0; padding: 0 0 0 0.25rem; position: relative; }
ul.timeline::before { content: ""; position: absolute; left: 3.35rem; top: 0.5rem; bottom: 0.5rem; width: 2px; background: var(--line); }
ul.timeline li { position: relative; display: flex; gap: 0.9rem; align-items: center; margin-bottom: 0.6rem; }
ul.timeline .when { flex: none; width: 2.8rem; text-align: right; color: var(--muted); font-size: 0.85rem; font-weight: 700; font-variant-numeric: tabular-nums; }
ul.timeline .slot {
  flex: 1; min-width: 0; display: flex; gap: 0.75rem; align-items: center; position: relative;
  padding: 0.65rem 0.75rem; border-radius: var(--radius); background: var(--tile); color: var(--ink);
}
ul.timeline .slot a { color: inherit; font-weight: 700; text-decoration: none; }
ul.timeline .slot a::after { content: ""; position: absolute; inset: 0; }
ul.timeline .slot form { position: relative; z-index: 1; }
ul.timeline .slot .tile { background: rgba(255, 255, 255, 0.65); width: 2.5rem; height: 2.5rem; font-size: 1.2rem; }
ul.timeline .what { flex: 1; min-width: 0; overflow-wrap: anywhere; }
ul.timeline .what small { display: block; color: inherit; opacity: 0.8; }
.label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 800; opacity: 0.75; display: block; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.7rem; list-style: none; padding: 0; margin: 0; }
.tiles a {
  display: flex; flex-direction: column; gap: 0.6rem; min-height: 7.5rem; padding: 0.9rem; border-radius: var(--radius);
  background: var(--tile); color: var(--ink); text-decoration: none; font-weight: 700;
}
.tiles .big { font-size: 1.8rem; line-height: 1; }
.tiles small { color: inherit; opacity: 0.8; font-weight: 600; margin-top: auto; }
.tiles.row { grid-auto-flow: column; grid-auto-columns: 8.5rem; grid-template-columns: none; overflow-x: auto; padding-bottom: 0.25rem; }
.tiles.row a { min-height: 6rem; }

.suggestion { margin-top: 1.5rem; padding: 1rem 1.1rem; border-radius: var(--radius); background: var(--accent-soft); }
.suggestion h2 { margin: 0 0 0.4rem; color: var(--focus); }
.suggestion p { margin: 0.25rem 0; }

.page-head { display: flex; gap: 0.9rem; align-items: center; margin-bottom: 0.75rem; }
.page-head .tile { width: 3.5rem; height: 3.5rem; font-size: 1.8rem; border-radius: 18px; }
.page-head h1 { margin: 0; }

details.panel { margin: 0.9rem 0; padding: 0.4rem 1.1rem; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
details.panel > summary { cursor: pointer; padding: 0.55rem 0; font-weight: 700; color: var(--text); }
details.panel[open] > summary { margin-bottom: 0.5rem; }
details.panel.small { background: none; box-shadow: none; padding: 0; }
details.panel.small > summary { color: var(--accent); font-weight: 600; }

.area h2 { display: flex; gap: 0.5rem; align-items: center; }
.week-nav { display: flex; justify-content: space-between; gap: 1rem; margin: 1rem 0 0; font-weight: 600; }
.agenda-day h2 { margin-top: 1.5rem; }
.panel-box { padding: 0.5rem 1.1rem; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.active-summary ul { padding-left: 1.2rem; }
ul.plain li { padding: 0.7rem 0.9rem; background: var(--surface); border-radius: var(--radius-small); box-shadow: var(--shadow); }

/* --- login and footer ------------------------------------------------------------------------------------------- */

.foot { margin-top: 3rem; padding-bottom: 1rem; font-size: 0.85rem; color: var(--muted); text-align: center; }
.foot a { color: var(--muted); }

table { display: block; overflow-x: auto; border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.45rem 0.5rem 0.45rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }

/* quick menu (sheet per card, and on the detail page) */
.quick { margin: 0 0 0.9rem; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.quick-grid button { justify-content: flex-start; border-radius: var(--radius-small); }
.pick-day { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.pick-day input { flex: 1; min-width: 0; }
.list-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.35rem; }
.list-chips button { background: var(--tile); color: var(--ink); border-color: transparent; min-height: 2.6rem; }
.list-chips button[aria-pressed="true"] { border-color: var(--ink); }
.label + .list-chips { margin-top: 0.5rem; }
.quick .label { color: var(--muted); }
a.icon-button { display: inline-grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%; background: var(--bg); color: var(--muted); position: relative; z-index: 1; }
a.icon-button svg { width: 1.3rem; height: 1.3rem; }
.saved-note { color: var(--muted); font-size: 0.9rem; min-height: 1.4rem; }
.js .autosave-button { display: none; }

/* simple rows (out of view, finished, trash) */
ul.plain li.row-item { display: flex; gap: 0.75rem; align-items: center; }
li.row-item .entry-text a::after { content: none; }

/* list and area choice as coloured chips */
.list-pick span { background: var(--tile); color: var(--ink); border-color: transparent; }
.list-pick input:checked + span { background: var(--tile); color: var(--ink); border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

/* help with starting */
.big-step { font-size: 1.25rem; font-weight: 700; line-height: 1.4; margin: 0.25rem 0 0.5rem; }
.first-step-card { margin: 1rem 0; padding: 1rem 1.1rem; border-radius: var(--radius); background: var(--tile); color: var(--ink); }
.first-step-card .label { color: inherit; }
.first-step-card p { margin: 0.2rem 0 0.75rem; font-weight: 700; font-size: 1.1rem; }
a.button.block { width: 100%; }

/* shared projects: always visibly marked as shared */
.invite-card { margin: 0 0 1rem; padding: 1rem 1.1rem; border-radius: var(--radius); background: var(--accent-soft); }
.invite-card p { margin: 0.2rem 0; }
.shared-banner { padding: 0.7rem 0.9rem; border-radius: var(--radius-small); background: var(--tile); color: var(--ink); font-size: 0.95rem; }
.add-row { display: flex; gap: 0.5rem; margin: 1rem 0; }
.add-row input { flex: 1; min-width: 0; }
.task-edit > summary { cursor: pointer; font-weight: 600; list-style: none; }
.task-edit > summary::-webkit-details-marker { display: none; }
.task-edit[open] { padding-bottom: 0.5rem; }
.task-edit form { margin-top: 0.6rem; }

/* list header: small actions next to the title instead of panels under the tasks */
.page-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.4rem; }
.head-actions { display: flex; gap: 0.4rem; }
.page-head h1 { flex: 1; min-width: 0; overflow-wrap: break-word; hyphens: auto; }
.head-actions .icon-button { width: 2.6rem; height: 2.6rem; background: var(--surface); box-shadow: var(--shadow); color: var(--muted); }
.head-actions .icon-button.active { color: var(--accent); background: var(--accent-soft); }
.shared-line { margin: -0.25rem 0 0.9rem; color: var(--muted); font-size: 0.95rem; }
dialog.sheet { max-height: 88vh; overflow-y: auto; }

/* while a page is fetched in the background: a calm hint, only when it takes a moment */
@media (prefers-reduced-motion: no-preference) {
  html.loading main { opacity: 0.6; transition: opacity 0.2s ease 0.15s; }
}

/* compact capture sheet: input and button on one line, choices as scrolling chip rows */
.capture-row { display: flex; gap: 0.5rem; }
.capture-row input { flex: 1; min-width: 0; }
.capture-note { min-height: 1.3rem; margin: 0.35rem 0 0.25rem; font-size: 0.9rem; color: var(--focus); font-weight: 600; }
.chip-scroll { position: relative; display: flex; gap: 0.4rem; overflow-x: auto; padding: 0.2rem 0.1rem 0.5rem; margin: 0 -0.1rem; scrollbar-width: thin; scrollbar-color: var(--line) transparent; cursor: grab; overscroll-behavior-x: contain; }
.chip-scroll.dragging { cursor: grabbing; user-select: none; }
.chip-scroll::-webkit-scrollbar { height: 5px; }
.chip-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
.chip-scroll label { flex: none; margin: 0; }
.chip-scroll input { position: absolute; opacity: 0; }
.chip-scroll span {
  display: inline-flex; align-items: center; gap: 0.3rem; min-height: 2.3rem; padding: 0.25rem 0.8rem; white-space: nowrap;
  border-radius: 999px; background: var(--bg); border: 1px solid var(--line); cursor: pointer; font-size: 0.92rem; font-weight: 600;
}
.chip-scroll input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--focus); }
.chip-scroll.list-pick span { background: var(--tile); color: var(--ink); border-color: transparent; }
.chip-scroll.list-pick input:checked + span { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.chip-scroll input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

/* --- compact task page ------------------------------------------------------------------------------------------ */
.page-head.compact { margin-bottom: 0.35rem; }
.page-head.compact .tile { width: 2.7rem; height: 2.7rem; font-size: 1.35rem; border-radius: 14px; }
.page-head.compact h1 { font-size: 1.4rem; line-height: 1.25; }
.head-meta { margin: 0 0 0.75rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 0.9rem; }
.toolbar form.inline { display: contents; }
button.tool, a.button.tool {
  min-height: 2.4rem; padding: 0.3rem 0.85rem; font-size: 0.92rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
}
button.tool.primary, a.button.tool.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.first-step-card.compact { display: flex; align-items: center; gap: 0.75rem; justify-content: space-between; padding: 0.7rem 0.9rem; margin: 0 0 0.9rem; }
.first-step-card.compact p { margin: 0.1rem 0 0; font-size: 1rem; }

/* rows: one line per item, like a settings list */
ul.rows { list-style: none; margin: 0 0 0.9rem; padding: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
ul.rows > li + li { border-top: 1px solid var(--line); }
.row-link, details.row-details > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  min-height: 3rem; padding: 0.55rem 0.95rem; color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.95rem;
  cursor: pointer; list-style: none; margin: 0;
}
details.row-details > summary::-webkit-details-marker { display: none; }
details.row-details[open] { padding-bottom: 0.6rem; }
details.row-details > :not(summary) { margin-left: 0.95rem; margin-right: 0.95rem; }
.row-value { color: var(--muted); font-weight: 500; white-space: nowrap; }
.row-link select, .row-link input[type="time"] { width: auto; min-height: 2.3rem; padding: 0.2rem 0.5rem; }

/* the details form: title, list, dates; the rest folded under "Meer" */
.compact-form { padding: 0.9rem; margin-top: 0; }
.title-input { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; }
.three { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0 0.6rem; }
.three label { font-size: 0.82rem; margin-bottom: 0.5rem; }
.three input { padding: 0.4rem 0.5rem; min-height: 2.6rem; font-size: 0.92rem; min-width: 0; }
.compact-form .saved-note { min-height: 0; margin: 0; }
details.more > summary { cursor: pointer; padding: 0.4rem 0; color: var(--accent); font-weight: 600; font-size: 0.92rem; }
details.more[open] > summary { margin-bottom: 0.4rem; }

/* --- compact settings: grouped rows with switches ----------------------------------------------------------- */
h2.group { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 1.4rem 0 0.4rem 0.2rem; }
.row-link select { flex: none; max-width: 48%; }
.row-button { width: 100%; border: 0; border-radius: 0; background: none; box-shadow: none; text-align: left; }
.row-button:hover { background: var(--bg); }
.small-note { font-size: 0.85rem; margin: -0.4rem 0.2rem 0.6rem; }
input.switch {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 2.9rem; height: 1.7rem; margin: 0;
  border-radius: 999px; background: var(--line); cursor: pointer; transition: background 0.15s;
}
input.switch::after {
  content: ""; position: absolute; top: 0.2rem; left: 0.2rem; width: 1.3rem; height: 1.3rem; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.15s;
}
input.switch:checked { background: var(--accent); }
input.switch:checked::after { transform: translateX(1.2rem); }
input.switch:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.active-summary ul { padding-left: 1.1rem; font-size: 0.92rem; }
form[data-autosave] .saved-note:empty { display: none; }
form[data-autosave] { margin-bottom: 0.6rem; }
li.row-item .entry-text small { display: block; margin-top: 0.1rem; }
li.row-item .entry-text { padding: 0; }

/* lists page: title with small create buttons, area headings with a small edit button */
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.title-row h1 { margin: 0.25rem 0; }
h2.area-head { display: flex; align-items: center; gap: 0.45rem; }
h2.area-head .icon-button.small { width: 2.1rem; height: 2.1rem; margin-left: auto; background: var(--surface); box-shadow: var(--shadow); color: var(--muted); }
h2.area-head .icon-button.small svg { width: 1.05rem; height: 1.05rem; }

/* --- agenda views (day, week, month, list) ------------------------------------------------------------------ */
.cal-bar { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; margin: 0.25rem 0 0.4rem; }
.segmented { display: inline-flex; padding: 0.2rem; background: var(--surface); border-radius: 999px; box-shadow: var(--shadow); }
.segmented a { padding: 0.35rem 0.5rem; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.88rem; }
.segmented a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
/* prev / today / next as one pill next to the view switch */
.cal-nav { display: inline-flex; align-items: center; flex: none; padding: 0.2rem; background: var(--surface); border-radius: 999px; box-shadow: var(--shadow); }
.cal-nav .icon-button { width: 1.75rem; height: 1.9rem; background: none; font-size: 1.25rem; text-decoration: none; }
.cal-nav .button.tool { min-height: 1.9rem; padding: 0 0.35rem; border: 0; background: none; box-shadow: none; font-size: 0.88rem; }
@media (max-width: 370px) { .segmented a { padding: 0.35rem 0.35rem; font-size: 0.8rem; } .cal-nav .button.tool { padding: 0 0.2rem; font-size: 0.8rem; } .cal-nav .icon-button { width: 1.5rem; } }


.cal-grid { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; --gutter: 2.6rem; --hour: 3rem; }
.cal-row { display: grid; grid-template-columns: var(--gutter) repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.cal-grid.single .cal-row, .cal-grid.single .cal-body { grid-template-columns: var(--gutter) minmax(0, 1fr); }
.cal-gutter { font-size: 0.68rem; color: var(--muted); padding: 0.35rem 0.2rem; text-align: center; align-self: center; }
.cal-dayname { display: flex; flex-direction: column; align-items: center; padding: 0.3rem 0; color: var(--text); text-decoration: none; }
.cal-dayname small { font-size: 0.7rem; color: var(--muted); }
.cal-dayname b { width: 1.9rem; height: 1.9rem; display: grid; place-items: center; border-radius: 50%; font-size: 0.95rem; }
.cal-dayname.is-today b { background: var(--accent); color: var(--accent-ink); }
.cal-allday .cal-cell { padding: 0.15rem; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; border-left: 1px solid var(--line); }
.cal-chip {
  display: block; padding: 0.1rem 0.3rem; border-radius: 6px; font-size: 0.7rem; line-height: 1.3; color: var(--text);
  background: var(--accent-soft); border-left: 3px solid var(--accent); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-chip.task { background: var(--tile); border-left: 3px dashed var(--ink); color: var(--ink); }
.cal-body { display: grid; grid-template-columns: var(--gutter) repeat(7, minmax(0, 1fr)); height: min(62vh, 34rem); overflow-y: auto; position: relative; }
.cal-hours span { display: block; height: var(--hour); font-size: 0.66rem; color: var(--muted); text-align: right; padding-right: 0.3rem; transform: translateY(-0.45em); }
.cal-hours span:first-child { visibility: hidden; }
.cal-col {
  position: relative; height: calc(var(--hour) * 24); border-left: 1px solid var(--line);
  background-image: repeating-linear-gradient(to bottom, var(--line) 0, var(--line) 1px, transparent 1px, transparent var(--hour));
}
.cal-col.is-today { background-color: rgba(108, 99, 217, 0.04); }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: #e5484d; z-index: 3; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #e5484d; }
.cal-event {
  position: absolute; left: 0; width: 100%; padding: 0.1rem 0.25rem; overflow: hidden; border-radius: 6px;
  background: var(--accent-soft); border-left: 3px solid var(--accent); color: var(--text); text-decoration: none;
  font-size: 0.7rem; line-height: 1.25; box-shadow: 0 0 0 1px var(--surface);
}
.cal-event b { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-event small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event.task { background: var(--tile); border-left: 3px dashed var(--ink); color: var(--ink); }
.cal-grid.single .cal-event { font-size: 0.85rem; padding: 0.2rem 0.5rem; }

.cal-month { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.cal-mrow { display: grid; grid-template-columns: 1.8rem repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.cal-mrow:last-child { border-bottom: 0; }
.cal-mhead span { font-size: 0.72rem; color: var(--muted); text-align: center; padding: 0.35rem 0; font-weight: 600; }
.cal-mrow .wk { font-size: 0.66rem; color: var(--muted); text-align: center; padding-top: 0.4rem; }
.cal-mday {
  min-height: 4.6rem; padding: 0.2rem; border-left: 1px solid var(--line); color: var(--text); text-decoration: none;
  display: flex; flex-direction: column; gap: 0.12rem; min-width: 0;
}
.cal-mday b { font-size: 0.8rem; width: 1.5rem; height: 1.5rem; display: grid; place-items: center; border-radius: 50%; }
.cal-mday.is-today b { background: var(--accent); color: var(--accent-ink); }
.cal-mday.other { background: var(--bg); color: var(--muted); }
.cal-dot {
  display: block; font-size: 0.62rem; line-height: 1.3; padding: 0 0.2rem; border-radius: 4px; border-left: 2px solid var(--accent);
  background: var(--accent-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-mday small { font-size: 0.62rem; color: var(--muted); }
.cal-swatch { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 50%; background: var(--accent); margin-right: 0.5rem; vertical-align: -0.05rem; }

/* --- agenda fills the screen: the top (title, views, navigation) stays, only the calendar scrolls ------------ */
body.page-fill { padding-bottom: 0; overflow: hidden; }
body.page-fill main {
  display: flex; flex-direction: column; overflow: hidden; padding-bottom: 0.5rem;
  height: calc(100dvh - var(--tab-height) - env(safe-area-inset-bottom));
}
.cal-top { flex: none; }
.cal-scroll { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 5.5rem; overscroll-behavior: contain; }
.cal-scroll:has(> .cal-grid) { overflow: hidden; padding-bottom: 0; display: flex; flex-direction: column; }
.cal-scroll > .cal-grid { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cal-scroll > .cal-grid .cal-body { flex: 1; min-height: 0; height: auto; padding-bottom: 4.5rem; }
/* the month fits the screen: the weeks share the height, a day shows what fits */
.cal-scroll:has(> .cal-month) { overflow: hidden; padding-bottom: 4.6rem; display: flex; flex-direction: column; }
.cal-scroll > .cal-month { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cal-scroll > .cal-month .cal-mrow:not(.cal-mhead) { flex: 1; min-height: 0; }
.cal-scroll > .cal-month .cal-mday { min-height: 0; overflow: hidden; }
@media (min-width: 48rem) {
  body.page-fill main { height: calc(100dvh - var(--tab-height) - 2rem); }
}
.cal-jump { position: relative; margin: 0.25rem 0; }
button.cal-title {
  min-height: 2.6rem; padding: 0.2rem 0.4rem 0.2rem 0; border: 0; background: none; box-shadow: none;
  font-size: 1.15rem; font-weight: 800; color: var(--text); text-align: left; justify-content: flex-start;
}
button.cal-title span { color: var(--muted); font-size: 0.8rem; }
.picker-input { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* feedback (settings sheet and the admins' list) */
textarea#feedback-text { width: 100%; resize: vertical; }
.feedback-item { background: var(--surface); border-radius: 16px; padding: 0.8rem 1rem; margin-bottom: 0.6rem; }
.feedback-item.handled { opacity: 0.55; }
.feedback-meta { margin: 0 0 0.3rem; }
.feedback-meta small { color: var(--muted); }
.feedback-text { margin: 0 0 0.4rem; white-space: pre-wrap; overflow-wrap: anywhere; }

/* quick-add suggestions on the new list / new area sheets: one tap adds it */
.suggest-chips form { flex: none; margin: 0; }
.suggest-chips button { padding: 0; border: 0; background: none; min-height: 0; box-shadow: none; }

/* no page zoom by pinching (the agenda zooms its hours instead, see app.js) */
html { touch-action: pan-x pan-y; }
.cal-body { touch-action: pan-y; }

/* "install the app" suggestion on phones */
.install-hint {
  position: fixed; z-index: 25; left: 1rem; right: 1rem; bottom: calc(var(--tab-height) + env(safe-area-inset-bottom) + 5.2rem);
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.8rem; padding: 0.8rem 1rem;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
}
.install-hint[hidden] { display: none; }
.install-hint p { margin: 0; flex: 1 1 14rem; font-size: 0.92rem; }
.install-hint div { display: flex; gap: 0.4rem; }
