/* Calindar styles. Design tokens (--cal-*) first, then the component styles from the
   design export, then the pieces only this app has (home page, connecting, decisions).
   Light is the default; dark follows prefers-color-scheme unless <html data-theme> pins it. */

:root,
:root[data-theme="light"] {
  color-scheme: light;

  /* Oppervlakken */
  --cal-paper: #FFFFFF;          /* pagina */
  --cal-card: #FFFFFF;           /* kaarten, sheets, dialogen */
  --cal-panel: #F7F8F7;          /* kalenderplaat, uitlegblokken */
  --cal-track: #F1F3F2;          /* segmentkeuze-spoor */
  --cal-skeleton: #EEF1EF;       /* laadbalken, uitgeschakelde knop */
  --cal-hover: #F4F6F5;          /* hover op lichte knoppen en rijen */
  --cal-seg-on: #FFFFFF;         /* gekozen segment */
  --cal-scrim: rgba(31, 42, 36, 0.45);
  --cal-scrim-light: rgba(31, 42, 36, 0.35); /* achter het dagpaneel */

  /* Tekst en lijnen */
  --cal-ink: #1F2A24;            /* 14,8:1 op wit */
  --cal-muted: #5F6A64;          /* 5,6:1 op wit, 5,1:1 op spoor */
  --cal-line: #E1E5E2;           /* decoratieve randen */
  --cal-control: #8A948F;        /* randen van invoer (3,1:1) */

  /* Acties */
  --cal-primary: #24302A;
  --cal-on-primary: #FFFFFF;     /* 13,7:1 */
  --cal-primary-hover: #35443C;
  --cal-primary-pressed: #1A231E;
  --cal-success: #2F7D55;        /* ‘Ik kan’ gekozen, 5,0:1 met wit */
  --cal-on-success: #FFFFFF;
  --cal-success-hover: #276A48;
  --cal-danger: #B3261E;         /* 6,5:1 op wit */
  --cal-danger-bg: #FBECEB;
  --cal-focus: #24302A;

  /* Beschikbaarheid: tegel / icoon / tekst in pill */
  --cal-green: #A6D8B6;          /* strongest tile: the days that work */
  --cal-green-icon: #1A5E3A;     /* 4.8:1 on tile */
  --cal-green-text: #1A5E3A;
  --cal-yellow: #F6E5B0;
  --cal-yellow-edge: #E3C866;
  --cal-yellow-icon: #7A5B00;    /* 5,0:1 op tegel */
  --cal-yellow-text: #6B4E00;
  --cal-red: #EBC0BE;
  --cal-red-icon: #9E1F18;       /* 4,8:1 op tegel */
  --cal-red-text: #7A1A13;
  --cal-tile-ink: #1F2A24;       /* ≥9:1 op alle tegels */
  --cal-bar-empty: rgba(31, 42, 36, 0.16);
  --cal-past: #EEF2EF;
  --cal-past-ink: #8A948F;

  /* Avatars (witte initiaal, ≥4,5:1) */
  --cal-avatar-1: #C4521F;
  --cal-avatar-2: #2F6B8A;
  --cal-avatar-3: #2F7D55;
  --cal-avatar-4: #6B4FA0;
  --cal-avatar-5: #8A5A12;

  /* Schaduw */
  --cal-shadow-seg: 0 1px 2px rgba(31, 42, 36, 0.10), 0 2px 6px rgba(31, 42, 36, 0.06);
  --cal-shadow-sheet: 0 -8px 32px rgba(0, 0, 0, 0.18);
  --cal-shadow-dialog: 0 24px 64px rgba(0, 0, 0, 0.22);

  /* Typografie */
  --cal-font: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;

  /* Vorm */
  --cal-r-pill: 999px;
  --cal-r-seg: 14px;
  --cal-r-seg-item: 10px;
  --cal-r-card: 16px;
  --cal-r-row: 14px;
  --cal-r-plate: 18px;
  --cal-r-tile: 10px;
  --cal-r-input: 12px;
  --cal-r-sheet: 20px;

  /* Maten */
  --cal-tap: 44px;
  --cal-btn-h: 48px;
  --cal-btn-h-lg: 52px;
  --cal-gutter: 16px;
  --cal-sidebar: 400px;

  /* Beweging */
  --cal-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --cal-fast: 150ms;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --cal-paper: #121614;
  --cal-card: #1A201D;
  --cal-panel: #171C19;
  --cal-track: #1F2622;
  --cal-skeleton: #2A322E;
  --cal-hover: #222925;
  --cal-seg-on: #2C3530;
  --cal-scrim: rgba(0, 0, 0, 0.6);
  --cal-scrim-light: rgba(0, 0, 0, 0.55);
  --cal-ink: #E8EDEA;
  --cal-muted: #A3ADA7;
  --cal-line: #2C3530;
  --cal-control: #78837D;
  --cal-primary: #E8EDEA;
  --cal-on-primary: #121614;
  --cal-primary-hover: #FFFFFF;
  --cal-primary-pressed: #D5DDD8;
  --cal-success: #6FD39A;
  --cal-on-success: #121614;
  --cal-success-hover: #8EE0B2;
  --cal-danger: #FF8A80;
  --cal-danger-bg: rgba(255, 138, 128, 0.10);
  --cal-focus: #F2C94C;
  --cal-green: #245A3B;
  --cal-green-icon: #6FD39A;
  --cal-green-text: #8EE0B2;
  --cal-yellow: #3D3416;
  --cal-yellow-edge: #6B5A22;
  --cal-yellow-icon: #F2C94C;
  --cal-yellow-text: #F2C94C;
  --cal-red: #45201F;
  --cal-red-icon: #FF8A80;
  --cal-red-text: #FF8A80;
  --cal-tile-ink: #E8EDEA;
  --cal-bar-empty: rgba(232, 237, 234, 0.22);
  --cal-past: #1A201D;
  --cal-past-ink: #78837D;
  --cal-shadow-seg: 0 1px 2px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --cal-paper: #121614;
    --cal-card: #1A201D;
    --cal-panel: #171C19;
    --cal-track: #1F2622;
    --cal-skeleton: #2A322E;
    --cal-hover: #222925;
    --cal-seg-on: #2C3530;
    --cal-scrim: rgba(0, 0, 0, 0.6);
    --cal-scrim-light: rgba(0, 0, 0, 0.55);
    --cal-ink: #E8EDEA;
    --cal-muted: #A3ADA7;
    --cal-line: #2C3530;
    --cal-control: #78837D;
    --cal-primary: #E8EDEA;
    --cal-on-primary: #121614;
    --cal-primary-hover: #FFFFFF;
    --cal-primary-pressed: #D5DDD8;
    --cal-success: #6FD39A;
    --cal-on-success: #121614;
    --cal-success-hover: #8EE0B2;
    --cal-danger: #FF8A80;
    --cal-danger-bg: rgba(255, 138, 128, 0.10);
    --cal-focus: #F2C94C;
    --cal-green: #245A3B;
    --cal-green-icon: #6FD39A;
    --cal-green-text: #8EE0B2;
    --cal-yellow: #3D3416;
    --cal-yellow-edge: #6B5A22;
    --cal-yellow-icon: #F2C94C;
    --cal-yellow-text: #F2C94C;
    --cal-red: #45201F;
    --cal-red-icon: #FF8A80;
    --cal-red-text: #FF8A80;
    --cal-tile-ink: #E8EDEA;
    --cal-bar-empty: rgba(232, 237, 234, 0.22);
    --cal-past: #1A201D;
    --cal-past-ink: #78837D;
    --cal-shadow-seg: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

/* Short names used by the privacy and terms pages. */
:root {
  --paper: var(--cal-paper);
  --card: var(--cal-card);
  --ink: var(--cal-ink);
  --muted: var(--cal-muted);
  --line: var(--cal-line);
}

/* ---------- Basis ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cal-paper);
  color: var(--cal-ink);
  font-family: var(--cal-font);
  font-size: 16px;
  line-height: 1.5;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--cal-focus); outline-offset: 2px; }
/* Het hidden-attribuut wint altijd, ook van componentklassen met een eigen display. */
[hidden] { display: none !important; }

/* :where() houdt de specificiteit op 0, zodat componentklassen altijd winnen. */
:where(.cal-root) *,
:where(.cal-root) *::before,
:where(.cal-root) *::after { box-sizing: border-box; }
:where(.cal-root) :where(button, input, select) { font: inherit; color: inherit; }
:where(.cal-root) :focus-visible { outline: 2px solid var(--cal-focus); outline-offset: 2px; }
.cal-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Knoppen ---------- */
.cal-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--cal-btn-h); padding: 0 22px; border-radius: var(--cal-r-pill);
  border: 1px solid transparent; background: transparent; cursor: pointer;
  font-size: 16px; font-weight: 650; line-height: 1; white-space: nowrap;
  transition: background-color var(--cal-fast) ease, border-color var(--cal-fast) ease, box-shadow var(--cal-fast) ease;
}
.cal-btn--sm { height: var(--cal-tap); padding: 0 18px; font-size: 15px; }
.cal-btn--lg { height: var(--cal-btn-h-lg); font-size: 17px; }
.cal-btn--block { display: flex; width: 100%; }
.cal-btn--primary { background: var(--cal-primary); color: var(--cal-on-primary); }
.cal-btn--secondary { border-color: var(--cal-line); color: var(--cal-ink); }
.cal-btn--dashed { border: 1.5px dashed var(--cal-control); color: var(--cal-ink); }
.cal-btn--ghost { color: var(--cal-muted); padding: 0 16px; font-weight: 600; }
.cal-btn--success { background: var(--cal-success); color: var(--cal-on-success); box-shadow: 0 0 0 2px var(--cal-card), 0 0 0 4px var(--cal-success); }
.cal-btn--danger-soft { background: var(--cal-red); color: var(--cal-tile-ink); box-shadow: 0 0 0 2px var(--cal-card), 0 0 0 4px var(--cal-red-icon); }
.cal-btn:disabled { background: var(--cal-skeleton); color: var(--cal-muted); border-color: transparent; cursor: not-allowed; box-shadow: none; }
.cal-btn--primary:active:not(:disabled) { background: var(--cal-primary-pressed); }

.cal-iconbtn {
  display: inline-grid; place-items: center; flex: none;
  width: 46px; height: 46px; padding: 0; border-radius: var(--cal-r-pill);
  border: 1px solid var(--cal-line); background: transparent; color: var(--cal-ink); cursor: pointer;
  transition: background-color var(--cal-fast) ease, border-color var(--cal-fast) ease;
}
.cal-iconbtn--44 { width: 44px; height: 44px; }
.cal-iconbtn--48 { width: 48px; height: 48px; }

.cal-link {
  display: inline-flex; align-items: center; min-height: var(--cal-tap); padding: 0 4px;
  background: none; border: 0; cursor: pointer; white-space: nowrap;
  color: var(--cal-ink); font-weight: 650; text-decoration: underline; text-underline-offset: 3px;
}

@media (hover: hover) {
  .cal-btn--primary:hover:not(:disabled) { background: var(--cal-primary-hover); }
  .cal-btn--secondary:hover:not(:disabled),
  .cal-btn--dashed:hover:not(:disabled),
  .cal-iconbtn:hover { background: var(--cal-hover); border-color: var(--cal-ink); }
  .cal-btn--ghost:hover:not(:disabled) { background: var(--cal-hover); color: var(--cal-ink); }
  .cal-btn--success:hover { background: var(--cal-success-hover); }
}

/* ---------- Bovenbalk ---------- */
.cal-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  height: 68px; padding: 0 var(--cal-gutter);
}
.cal-logo { display: flex; align-items: center; gap: 8px; min-height: var(--cal-tap); color: var(--cal-ink); text-decoration: none; }
.cal-logo__text { font-size: 20px; font-weight: 750; letter-spacing: -0.02em; }
.cal-topbar__actions { display: flex; align-items: center; gap: 6px; }
.cal-topbar__share-text { display: none; }
.cal-account-email { margin: 0; font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.cal-device { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--cal-line); border-radius: var(--cal-r-row); }
.cal-device__icon { flex: none; width: 36px; height: 36px; border-radius: var(--cal-r-tile); display: grid; place-items: center; background: var(--cal-panel); }
.cal-device__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cal-device__title { font-size: 15px; font-weight: 650; overflow-wrap: anywhere; }
.cal-device__sub { font-size: 13px; color: var(--cal-muted); }
.cal-btn--danger-text { color: var(--cal-danger); }

.cal-lang { display: flex; gap: 2px; padding: 2px; border: 1px solid var(--cal-line); border-radius: var(--cal-r-pill); }
.cal-lang__opt {
  width: 44px; height: 44px; border-radius: var(--cal-r-pill); border: 0; background: transparent;
  color: var(--cal-muted); font-size: 14px; font-weight: 650; cursor: pointer; padding: 0;
}
.cal-lang__opt[aria-pressed="true"] { background: var(--cal-primary); color: var(--cal-on-primary); font-weight: 700; }
@media (hover: hover) { .cal-lang__opt[aria-pressed="false"]:hover { background: var(--cal-hover); color: var(--cal-ink); } }
.cal-lang--compact { display: none; }

@media (max-width: 559.98px) {
  .cal-logo__text { font-size: 18px; }
  .cal-lang--full { display: none; }
  .cal-lang--compact { display: inline-flex; }
}

@media (min-width: 960px) {
  .cal-topbar { height: 96px; padding: 0 64px; }
  .cal-logo__text { font-size: 21px; }
  .cal-topbar__actions { gap: 10px; }
  .cal-topbar .cal-iconbtn { width: 48px; height: 48px; }
  .cal-topbar__share { width: auto !important; padding: 0 22px 0 18px !important; gap: 10px; display: inline-flex !important; font-size: 17px; font-weight: 650; }
  .cal-topbar__share-text { display: inline; }
}

/* ---------- Pagina-opbouw ---------- */
.cal-page { display: flex; flex-direction: column; gap: 28px; padding: 12px var(--cal-gutter) 40px; }
.cal-page__side { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.cal-page__main { display: contents; }
@media (min-width: 960px) {
  .cal-page {
    display: grid; grid-template-columns: var(--cal-sidebar) minmax(0, 1fr);
    gap: 56px; padding: 16px 64px 64px; align-items: start;
  }
  .cal-page__main { display: block; position: sticky; top: 24px; min-width: 0; }
}

.cal-h1 { margin: 0; font-size: 34px; line-height: 1.05; font-weight: 800; letter-spacing: -0.035em; }
.cal-h2 { margin: 0; font-size: 22px; line-height: 1.2; font-weight: 800; letter-spacing: -0.02em; }
.cal-h3 { margin: 0; font-size: 17px; font-weight: 750; }
.cal-muted { color: var(--cal-muted); }
@media (min-width: 960px) { .cal-h1 { font-size: 44px; letter-spacing: -0.04em; } }

/* ---------- Deelnemers ---------- */
.cal-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.cal-chip {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 5px;
  border-radius: var(--cal-r-pill); border: 1px solid var(--cal-line);
}
.cal-chip--me { border: 1.5px solid var(--cal-ink); }
.cal-chip__name { font-size: 15px; font-weight: 600; }
.cal-chip__src { font-size: 13px; font-weight: 500; color: var(--cal-muted); }
.cal-avatar {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--cal-r-pill);
  color: #FFFFFF; font-size: 13px; font-weight: 700;
}
.cal-avatar--36 { width: 36px; height: 36px; font-size: 15px; }
.cal-avatar--40 { width: 40px; height: 40px; font-size: 16px; }

/* ---------- Segmentkeuze ---------- */
.cal-seg { display: grid; grid-template-columns: repeat(var(--cal-seg-n, 3), minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: var(--cal-r-seg); background: var(--cal-track); }
.cal-seg__opt {
  height: 46px; padding: 0 4px; border-radius: var(--cal-r-seg-item); border: 0; background: transparent;
  color: var(--cal-muted); font-size: 16px; font-weight: 600; cursor: pointer;
}
.cal-seg__opt[aria-checked="true"] { background: var(--cal-seg-on); color: var(--cal-ink); font-weight: 700; box-shadow: var(--cal-shadow-seg); }
@media (hover: hover) { .cal-seg__opt[aria-checked="false"]:hover { color: var(--cal-ink); } }
@media (min-width: 960px) { .cal-seg__opt { font-size: 17px; } }

.cal-slotrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.cal-slotrow__text { margin: 0; font-size: 15px; color: var(--cal-muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.cal-select { position: relative; display: inline-flex; }
.cal-select select {
  appearance: none; -webkit-appearance: none; height: 44px; padding: 0 36px 0 16px;
  border-radius: var(--cal-r-pill); border: 1px solid var(--cal-line); background: var(--cal-card);
  font-size: 15px; font-weight: 600; cursor: pointer;
}
.cal-select svg { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); pointer-events: none; }
@media (min-width: 960px) { .cal-select select { height: 46px; font-size: 16px; padding: 0 38px 0 18px; } }

/* ---------- Rijen en kaarten ---------- */
.cal-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cal-rowbtn {
  width: 100%; min-height: 68px; display: flex; align-items: center; gap: 14px;
  padding: 10px 14px 10px 10px; border-radius: var(--cal-r-row); border: 1px solid var(--cal-line);
  background: var(--cal-card); text-align: left; cursor: pointer;
  transition: background-color var(--cal-fast) ease, border-color var(--cal-fast) ease;
}
.cal-rowbtn--lg { min-height: 72px; padding: 14px 18px; border-radius: var(--cal-r-card); }
.cal-rowbtn__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cal-rowbtn__title { font-size: 17px; font-weight: 650; }
.cal-rowbtn--lg .cal-rowbtn__title { font-size: 18px; font-weight: 750; }
.cal-rowbtn__sub { font-size: 14px; color: var(--cal-muted); }
.cal-rowbtn--lg .cal-rowbtn__sub { font-size: 15px; }
.cal-rowbtn__chev { flex: none; color: var(--cal-muted); }
.cal-best-mark {
  flex: none; width: 46px; height: 46px; border-radius: var(--cal-r-tile);
  display: grid; place-items: center; background: var(--cal-green); color: var(--cal-green-icon);
}
@media (hover: hover) { .cal-rowbtn:hover { background: var(--cal-hover); border-color: var(--cal-ink); } }

.cal-card { border: 1px solid var(--cal-line); border-radius: var(--cal-r-card); padding: 20px; display: flex; flex-direction: column; gap: 12px; background: var(--cal-card); }
.cal-card__body { margin: 0; font-size: 16px; line-height: 1.5; color: var(--cal-muted); }
@media (min-width: 960px) { .cal-card { padding: 24px; } }

.cal-note {
  margin: 0; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px;
  border-radius: 12px; background: var(--cal-panel); font-size: 15px; line-height: 1.45; color: var(--cal-muted);
}
.cal-note svg { flex: none; margin-top: 1px; }
.cal-note strong { color: var(--cal-ink); font-weight: 650; }

/* ---------- Kalender ---------- */
.cal-cal { display: flex; flex-direction: column; gap: 12px; }
.cal-cal__head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-bottom: 12px; border-bottom: 1px solid var(--cal-line);
}
.cal-cal__title { margin: 0; font-size: 16px; font-weight: 700; }
.cal-cal__tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cal-week-filter {
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 0 14px; border: 1px solid var(--cal-line); border-radius: var(--cal-r-pill);
  background: var(--cal-card); color: var(--cal-muted); cursor: pointer;
  font-size: 14px; font-weight: 650; line-height: 1.2;
}
.cal-week-filter[aria-pressed="true"] { background: var(--cal-primary); border-color: var(--cal-primary); color: var(--cal-on-primary); }
.cal-week-filter:disabled { background: var(--cal-panel); color: var(--cal-muted); cursor: default; opacity: .75; }
@media (hover: hover) { .cal-week-filter:hover { border-color: var(--cal-ink); color: var(--cal-ink); } }
@media (hover: hover) { .cal-week-filter[aria-pressed="true"]:hover { background: var(--cal-primary-hover); border-color: var(--cal-primary-hover); color: var(--cal-on-primary); } }
.cal-plate {
  background: var(--cal-panel); border: 1px solid var(--cal-line); border-radius: 16px;
  padding: 12px 10px; display: flex; flex-direction: column; gap: 8px;
}
.cal-plate__month { margin: 6px 0 0; font-size: 13px; font-weight: 500; color: var(--cal-muted); }
.cal-plate__month:first-child { margin-top: 0; }
.cal-plate__heads { display: grid; grid-template-columns: repeat(var(--cal-cols), minmax(0, 1fr)); gap: 6px; font-size: 13px; color: var(--cal-muted); text-align: center; padding-bottom: 2px; }
.cal-plate__grid { display: grid; grid-template-columns: repeat(var(--cal-cols), minmax(0, 1fr)); gap: 6px; }
.cal-week-fold { display: flex; flex-direction: column; gap: 8px; }
.cal-week-fold__bar {
  width: 100%; min-height: 34px; padding: 5px 10px; border: 1px solid var(--cal-line); border-radius: 9px;
  display: flex; align-items: center; gap: 8px; background: var(--cal-card); color: var(--cal-muted);
  font: inherit; font-size: 12px; line-height: 1.2; text-align: left; cursor: pointer;
}
.cal-week-fold__range { color: var(--cal-ink); font-weight: 700; }
.cal-week-fold__label { margin-right: auto; }
.cal-week-fold__bar svg { flex: none; transition: transform var(--cal-fast) ease; }
.cal-week-fold__bar[aria-expanded="true"] svg { transform: rotate(180deg); }
@media (hover: hover) { .cal-week-fold__bar:hover { border-color: var(--cal-ink); color: var(--cal-ink); } }
@media (max-width: 359.98px) {
  .cal-plate { padding: 10px 8px; }
  .cal-tile { padding: 8px 7px 9px; }
  .cal-tile__bar { width: 5px; }
  .cal-tile__icon { width: 12px; height: 12px; flex: none; }
  .cal-seg__opt { font-size: 15px; padding: 0 2px; white-space: nowrap; }
}
@media (min-width: 960px) {
  .cal-cal { gap: 16px; }
  .cal-cal__head { padding-bottom: 14px; }
  .cal-cal__title { font-size: 17px; }
  .cal-plate { border-radius: var(--cal-r-plate); padding: 20px 22px 24px; }
  .cal-plate__month { font-size: 14px; }
  .cal-plate__heads { font-size: 15px; gap: 10px; padding-bottom: 4px; }
  .cal-plate__grid { gap: 10px; }
  .cal-week-fold { gap: 10px; }
  .cal-week-fold__bar { min-height: 38px; padding: 7px 12px; font-size: 13px; }
}

.cal-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--cal-muted); }
.cal-legend li { display: flex; align-items: center; gap: 6px; }
.cal-legend__sw { width: 10px; height: 10px; border-radius: 50%; }

/* Dagtegel */
.cal-tile {
  min-width: 0; height: 72px; padding: 9px 8px 10px; border: 1px solid var(--cal-line); border-radius: 12px;
  display: flex; flex-direction: column; justify-content: space-between; align-items: center;
  color: var(--cal-tile-ink); text-align: center; cursor: pointer;
  transition: border-color var(--cal-fast) ease, box-shadow var(--cal-fast) ease, transform var(--cal-fast) var(--cal-ease);
}
.cal-tile__label { font-size: 13px; font-weight: 700; white-space: nowrap; }
.cal-tile__foot { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 10px; }
.cal-tile__bars { width: 100%; display: grid; grid-template-columns: repeat(var(--cal-dots, 5), minmax(0, 1fr)); gap: 3px; }
.cal-tile__bar { width: clamp(5px, 1vw, 9px); aspect-ratio: 1; justify-self: center; border-radius: 50%; background: var(--cal-bar-empty); }
.cal-tile--green { background: linear-gradient(to bottom, var(--cal-card) 42%, color-mix(in srgb, var(--cal-green) 84%, var(--cal-card))); }
.cal-tile--yellow { background: linear-gradient(to bottom, var(--cal-card) 42%, color-mix(in srgb, var(--cal-yellow) 84%, var(--cal-card))); }
.cal-tile--red { background: linear-gradient(to bottom, var(--cal-card) 42%, color-mix(in srgb, var(--cal-red) 84%, var(--cal-card))); }
.cal-tile--green .cal-tile__icon { color: var(--cal-green-icon); }
.cal-tile--yellow .cal-tile__icon { color: var(--cal-yellow-icon); }
.cal-tile--red .cal-tile__icon { color: var(--cal-red-icon); }
.cal-tile--green .cal-tile__bar--on { background: var(--cal-green-icon); }
.cal-tile--yellow .cal-tile__bar--on { background: var(--cal-yellow-icon); }
.cal-tile--red .cal-tile__bar--on { background: var(--cal-red-icon); }
.cal-tile:not(.cal-tile--compact) .cal-tile__icon { display: none; }
.cal-tile--today { border-color: var(--cal-control); box-shadow: inset 0 0 0 1px var(--cal-control); }
.cal-tile[aria-pressed="true"] { border-color: var(--cal-green-icon); box-shadow: 0 0 0 2px var(--cal-card), 0 0 0 4px var(--cal-green-icon); }
.cal-tile:disabled { border-color: transparent; background: var(--cal-past); color: var(--cal-past-ink); cursor: default; }
.cal-tile--tall { height: 72px; }
@media (hover: hover) { .cal-tile:not(:disabled):not([aria-pressed="true"]):hover { border-color: var(--cal-control); box-shadow: 0 8px 20px rgba(31, 42, 36, .10); transform: translateY(-2px); } }
@media (min-width: 960px) {
  .cal-tile, .cal-tile--tall { height: 104px; padding: 13px 10px 15px; }
  .cal-tile__label { font-size: 15px; }
  .cal-tile__foot { min-height: 12px; }
  .cal-tile__bars { gap: 4px; }
  .cal-tile__icon { width: 16px; height: 16px; }
}

/* ---------- Overlay: bottom sheet / dialoog ---------- */
.cal-overlay { position: fixed; inset: 0; z-index: 50; }
.cal-overlay__scrim { position: absolute; inset: 0; background: var(--cal-scrim); animation: cal-fade 200ms ease both; }
.cal-overlay--light .cal-overlay__scrim { background: var(--cal-scrim-light); }
.cal-overlay__panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: calc(100% - 24px);
  background: var(--cal-card); border-radius: var(--cal-r-sheet) var(--cal-r-sheet) 0 0;
  box-shadow: var(--cal-shadow-sheet); display: flex; flex-direction: column; overflow: hidden;
  animation: cal-sheet-in 240ms var(--cal-ease) both;
}
.cal-overlay__grab { width: 40px; height: 5px; border-radius: var(--cal-r-pill); background: var(--cal-line); margin: 10px auto 4px; flex: none; }
.cal-overlay__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px 12px 20px; flex: none; }
.cal-overlay__bar--nav { padding: 4px 16px 8px 8px; }
.cal-overlay__title { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.cal-overlay__scroll { overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px calc(20px + env(safe-area-inset-bottom)); }
.cal-back { display: inline-flex; align-items: center; gap: 4px; height: 44px; padding: 0 14px 0 6px; border: 0; border-radius: var(--cal-r-pill); background: transparent; font-size: 16px; font-weight: 650; cursor: pointer; }
@media (hover: hover) { .cal-back:hover { background: var(--cal-hover); } }

@media (min-width: 960px) {
  .cal-overlay__panel {
    left: 50%; right: auto; bottom: auto; top: 48px; transform: translateX(-50%);
    width: min(600px, calc(100% - 48px)); max-height: calc(100% - 96px);
    border-radius: var(--cal-r-card); box-shadow: var(--cal-shadow-dialog);
    animation: cal-dialog-in 200ms var(--cal-ease) both;
  }
  .cal-overlay--narrow .cal-overlay__panel { width: min(560px, calc(100% - 48px)); top: 72px; }
  .cal-overlay__grab { display: none; }
  .cal-overlay__bar { padding: 24px 24px 20px 28px; }
  .cal-overlay__bar--nav { padding: 16px 20px 8px 16px; }
  .cal-overlay__title { font-size: 28px; }
  .cal-overlay__scroll { padding: 4px 28px 28px; }
}

@keyframes cal-fade { from { opacity: 0; } }
@keyframes cal-sheet-in { from { transform: translateY(24px); opacity: 0; } }
@keyframes cal-dialog-in { from { transform: translate(-50%, 8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .cal-overlay__panel { animation: cal-fade 200ms ease both; }
  .cal-root * { transition: none !important; }
}

/* ---------- Instellingen ---------- */
.cal-settings { display: flex; flex-direction: column; gap: 24px; }
.cal-section { display: flex; flex-direction: column; gap: 12px; padding-bottom: 24px; border-bottom: 1px solid var(--cal-line); }
.cal-section:last-child { border-bottom: 0; padding-bottom: 0; }
.cal-section__hint { margin: 0; font-size: 14px; line-height: 1.45; color: var(--cal-muted); }
.cal-person { display: flex; align-items: center; gap: 12px; }
.cal-person__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cal-person__name { font-size: 17px; font-weight: 650; }
.cal-input {
  height: 48px; padding: 0 12px; border-radius: var(--cal-r-input); border: 1px solid var(--cal-control);
  background: var(--cal-card); font-size: 16px; font-weight: 600;
}
.cal-account { border: 1px solid var(--cal-line); border-radius: var(--cal-r-row); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.cal-account__head { display: flex; align-items: center; gap: 12px; }
.cal-account__icon { flex: none; width: 40px; height: 40px; border-radius: var(--cal-r-tile); display: grid; place-items: center; background: var(--cal-panel); }
.cal-account__email { font-size: 14px; color: var(--cal-muted); overflow-wrap: anywhere; }
.cal-account__status { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--cal-green-icon); }
.cal-account__status--error { color: var(--cal-danger); }
.cal-account__dot { width: 8px; height: 8px; border-radius: var(--cal-r-pill); background: currentColor; }
.cal-account__actions { display: flex; flex-wrap: wrap; gap: 8px; }

.cal-days { display: grid; grid-template-columns: repeat(auto-fit, minmax(44px, 1fr)); gap: 6px; }
.cal-day {
  height: 56px; min-width: 44px; padding: 6px 0; border-radius: var(--cal-r-tile);
  border: 1px solid var(--cal-line); background: var(--cal-card); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 15px; font-weight: 650;
}
.cal-day[aria-pressed="true"] { border-color: transparent; background: var(--cal-red); color: var(--cal-tile-ink); }
.cal-day[aria-pressed="true"] .cal-day__label { text-decoration: line-through; text-decoration-thickness: 2px; }
.cal-day[aria-pressed="true"] svg { color: var(--cal-red-icon); }
@media (hover: hover) {
  .cal-day[aria-pressed="false"]:hover { background: var(--cal-hover); border-color: var(--cal-ink); }
  .cal-day[aria-pressed="true"]:hover { box-shadow: inset 0 0 0 2px var(--cal-ink); }
}

.cal-times { margin: 0; padding: 0; border: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.cal-times legend { float: left; width: 100%; padding: 0 0 6px; font-size: 15px; font-weight: 650; }
.cal-times label { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--cal-muted); }
.cal-times .cal-input { width: 108px; color: var(--cal-ink); }
.cal-save-end { align-self: stretch; }
@media (min-width: 480px) { .cal-save-end { align-self: flex-end; } }

.cal-menu-item {
  min-height: 60px; display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  margin: 0 -12px; width: calc(100% + 24px); border-radius: 12px; border: 0;
  background: transparent; text-align: left; cursor: pointer;
}
.cal-menu-item__body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.cal-menu-item__title { font-size: 16px; font-weight: 650; }
.cal-menu-item__hint { font-size: 14px; color: var(--cal-muted); }
.cal-menu-item--danger { color: var(--cal-danger); }
@media (hover: hover) {
  .cal-menu-item:hover { background: var(--cal-hover); }
  .cal-menu-item--danger:hover { background: var(--cal-danger-bg); }
}

/* ---------- Agenda's kiezen ---------- */
.cal-picker { display: flex; flex-direction: column; gap: 20px; }
.cal-picker__title { margin: 0; font-size: 26px; line-height: 1.15; font-weight: 800; letter-spacing: -0.03em; }
.cal-picker fieldset { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; }
.cal-picker legend { padding: 0 0 6px; font-size: 15px; font-weight: 650; }
.cal-check {
  display: flex; align-items: center; gap: 14px; min-height: 58px; padding: 6px 8px; margin: 0 -8px;
  border-bottom: 1px solid var(--cal-line); border-radius: 10px; cursor: pointer;
}
.cal-check input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--cal-primary); cursor: pointer; }
.cal-check input:focus-visible { outline: none; }
.cal-check:focus-within { outline: 2px solid var(--cal-focus); outline-offset: -2px; }
.cal-check__dot { flex: none; width: 12px; height: 12px; border-radius: var(--cal-r-pill); }
.cal-check__name { flex: 1; min-width: 0; font-size: 16px; font-weight: 600; }
.cal-tag { flex: none; height: 26px; padding: 0 10px; display: inline-flex; align-items: center; border-radius: var(--cal-r-pill); border: 1px solid var(--cal-line); font-size: 13px; font-weight: 600; color: var(--cal-muted); }
@media (hover: hover) { .cal-check:hover { background: var(--cal-hover); } }
.cal-picker__foot { display: flex; flex-direction: column; align-items: stretch; gap: 12px; text-align: center; font-size: 14px; color: var(--cal-muted); }
@media (min-width: 480px) { .cal-picker__foot { flex-direction: row; align-items: center; justify-content: space-between; text-align: left; } }
.cal-skel { display: flex; align-items: center; gap: 14px; min-height: 58px; border-bottom: 1px solid var(--cal-line); }
.cal-skel span { background: var(--cal-skeleton); border-radius: 6px; }
.cal-spinner { animation: cal-spin 900ms linear infinite; }
@keyframes cal-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .cal-spinner { animation: none; } }
.cal-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 16px 8px 4px; }
.cal-empty__art { display: grid; grid-template-columns: repeat(3, 22px); gap: 4px; padding: 10px; border-radius: 14px; background: var(--cal-panel); border: 1px solid var(--cal-line); }
.cal-empty__art span { height: 22px; border-radius: 5px; border: 1.5px dashed var(--cal-control); }
.cal-alert { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 14px; background: var(--cal-yellow); border: 1px solid var(--cal-yellow-edge); color: var(--cal-tile-ink); }
.cal-alert__title { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; }
.cal-alert__title svg { color: var(--cal-yellow-icon); }
.cal-alert p { margin: 0; font-size: 15px; line-height: 1.5; }
.cal-stack { display: flex; flex-direction: column; gap: 8px; }

/* ---------- Dagpaneel ---------- */
.cal-dayp { display: flex; flex-direction: column; gap: 18px; }
.cal-dayp__head { display: flex; align-items: center; gap: 14px; padding-right: 52px; }
.cal-dayp__date {
  flex: none; width: 52px; height: 56px; border-radius: var(--cal-r-tile);
  display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--cal-tile-ink);
}
.cal-dayp__date small { font-size: 12px; font-weight: 600; }
.cal-dayp__date strong { font-size: 22px; font-weight: 800; line-height: 1; }
.cal-dayp__title { margin: 0; font-size: 24px; line-height: 1.15; font-weight: 800; letter-spacing: -0.03em; }
.cal-dayp__slot { margin: 2px 0 0; display: flex; align-items: center; gap: 6px; font-size: 15px; color: var(--cal-muted); }
.cal-dayp__sum { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 12px; font-size: 15px; font-weight: 600; color: var(--cal-tile-ink); }
.cal-dayp__sum > span:first-child { min-width: 0; display: flex; align-items: center; gap: 8px; }
.cal-dayp__bars { flex: none; display: flex; gap: 4px; }
.cal-dayp__bars span { width: 9px; height: 9px; border-radius: 50%; background: var(--cal-bar-empty); }
.cal-people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.cal-people li { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 6px 0; border-bottom: 1px solid var(--cal-line); }
.cal-people__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cal-people__name { font-size: 16px; font-weight: 650; }
.cal-people__detail { font-size: 14px; color: var(--cal-muted); }
.cal-pill { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px 0 10px; border-radius: var(--cal-r-pill); font-size: 14px; font-weight: 650; }
.cal-pill--free { background: var(--cal-green); color: var(--cal-green-text); }
.cal-pill--partial, .cal-pill--unknown { background: var(--cal-yellow); color: var(--cal-yellow-text); }
.cal-pill--busy { background: var(--cal-red); color: var(--cal-red-text); }
.cal-vote { display: flex; flex-direction: column; gap: 10px; }
.cal-vote__label { font-size: 15px; font-weight: 650; }
.cal-vote__btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cal-vote__msg { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--cal-muted); }

.cal-sum--green, .cal-date--green { background: var(--cal-green); }
.cal-sum--yellow, .cal-date--yellow { background: var(--cal-yellow); }
.cal-sum--red, .cal-date--red { background: var(--cal-red); }
.cal-sum--green .cal-dayp__bars .on { background: var(--cal-green-icon); }
.cal-sum--yellow .cal-dayp__bars .on { background: var(--cal-yellow-icon); }
.cal-sum--red .cal-dayp__bars .on { background: var(--cal-red-icon); }
.cal-sum--green svg { color: var(--cal-green-icon); }
.cal-sum--yellow svg { color: var(--cal-yellow-icon); }
.cal-sum--red svg { color: var(--cal-red-icon); }

/* Desktop: dagpaneel in de zijkolom */
.cal-daycard { background: var(--cal-card); border: 1px solid var(--cal-line); border-radius: var(--cal-r-card); padding: 24px; }

/* =================================================================
   App-specific pieces, built from the same tokens.
   ================================================================= */

#app {
  max-width: 1440px; margin: 0 auto;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.cal-logo svg { flex: none; }
.cal-btn--danger { background: var(--cal-danger); color: var(--cal-on-primary); }
@media (hover: hover) { .cal-btn--danger:hover:not(:disabled) { filter: brightness(1.08); } }
.cal-btn svg, .cal-iconbtn svg, .cal-link svg { flex: none; }
a.cal-btn { text-decoration: none; }
.cal-input { width: 100%; min-width: 0; color: var(--cal-ink); }
.cal-input::placeholder { color: var(--cal-muted); font-weight: 500; }
.cal-error { margin: 0; color: var(--cal-danger); font-size: 14px; font-weight: 600; }
.cal-small { font-size: 14px; line-height: 1.45; }
.cal-chip__src--warn { color: var(--cal-danger); }
.cal-rowbtn__icon { flex: none; width: 46px; height: 46px; border-radius: var(--cal-r-tile); display: grid; place-items: center; background: var(--cal-panel); }
.cal-rowbtn:disabled { cursor: not-allowed; opacity: .55; }
@media (hover: hover) { .cal-rowbtn:disabled:hover { background: var(--cal-card); border-color: var(--cal-line); } }
.cal-best-mark--yellow { background: var(--cal-yellow); color: var(--cal-yellow-icon); }
.cal-best-mark--red { background: var(--cal-red); color: var(--cal-red-icon); }
.cal-best-note { color: var(--cal-yellow-text); }
.cal-picks__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cal-demo-note { margin: 12px var(--cal-gutter) 0; padding: 10px 14px; border-radius: 12px; border: 1px dashed var(--cal-control); font-size: 14px; color: var(--cal-muted); }
.cal-loading { padding: 40px 16px; text-align: center; color: var(--cal-muted); }

/* Form: input with the button next to it, dropping below when there's no room. */
.cal-form-row { display: flex; flex-wrap: wrap; gap: 8px; }
.cal-form-row > .cal-input { flex: 1 1 12rem; }
.cal-form-row > .cal-btn { flex: 0 0 auto; min-width: 140px; }
@media (max-width: 420px) { .cal-form-row > .cal-btn { flex: 1 1 100%; } }
.cal-field { display: flex; flex-direction: column; gap: 6px; }
.cal-field > label { font-size: 15px; font-weight: 650; }

/* Custom time window and weekday choice */
.cal-days--choose .cal-day[aria-pressed="true"] { background: var(--cal-primary); color: var(--cal-on-primary); border-color: transparent; }
.cal-days--choose .cal-day[aria-pressed="true"] .cal-day__label { text-decoration: none; }
@media (hover: hover) { .cal-days--choose .cal-day[aria-pressed="true"]:hover { box-shadow: none; background: var(--cal-primary-hover); } }

/* Calendar: loading, empty cells, the "answer these evenings" prompt */
.cal-plate--loading { min-height: 220px; display: grid; place-items: center; color: var(--cal-muted); font-size: 15px; }
.cal-tile--blank { visibility: hidden; }
.cal-review {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; text-align: left;
  border-radius: var(--cal-r-row); border: 1px solid var(--cal-yellow-edge); background: var(--cal-yellow); color: var(--cal-tile-ink);
  font-size: 16px; font-weight: 650; transition: box-shadow var(--cal-fast) ease;
}
.cal-review svg { flex: none; color: var(--cal-yellow-icon); }
.cal-review span { flex: 1; }
@media (hover: hover) { .cal-review:hover { box-shadow: inset 0 0 0 1px var(--cal-ink); } }

/* Connecting a calendar */
.cal-connect { display: flex; flex-direction: column; gap: 8px; }
.cal-steps-sheet { display: flex; flex-direction: column; gap: 16px; }
.cal-numbered { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; counter-reset: s; }
.cal-numbered > li { display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: start; counter-increment: s; }
.cal-numbered > li::before {
  content: counter(s); width: 32px; height: 32px; border-radius: var(--cal-r-pill); display: grid; place-items: center;
  background: var(--cal-panel); border: 1px solid var(--cal-line); font-weight: 750; font-size: 15px;
}
.cal-numbered > li > div { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }

/* Day panel extras: your calendar in this time window, the "could you still make it" prompt */
.cal-dayp__mine { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 12px; background: var(--cal-panel); }
.cal-dayp__mine-label { font-size: 13px; font-weight: 650; color: var(--cal-muted); }
.cal-events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.cal-events li { display: flex; flex-direction: column; gap: 1px; padding: 8px 0; border-top: 1px solid var(--cal-line); }
.cal-events li:first-child { border-top: 0; padding-top: 0; }
.cal-events strong { font-size: 15px; font-weight: 650; overflow-wrap: anywhere; }
.cal-events span { font-size: 14px; color: var(--cal-muted); font-variant-numeric: tabular-nums; }
.cal-dayp__question { margin: 0; font-size: 17px; line-height: 1.35; font-weight: 700; }
.cal-dayp__hint { margin: 0; font-size: 13px; line-height: 1.45; color: var(--cal-muted); }
.cal-progress { margin: 0; font-size: 14px; font-weight: 650; color: var(--cal-muted); }

/* Settings extras */
.cal-section__head { display: flex; flex-direction: column; gap: 4px; }
.cal-account__title { font-size: 16px; font-weight: 650; }
.cal-confirm { display: flex; flex-direction: column; gap: 20px; }
.cal-confirm__btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

/* ---------- Home ---------- */
body[data-page="home"] {
  color-scheme: light;
  --cal-paper: #fbfcfe;
  --cal-card: #ffffff;
  --cal-panel: #f6f8fb;
  --cal-track: #f4f7fb;
  --cal-hover: #edf8f3;
  --cal-seg-on: #dcf7e9;
  --cal-ink: #071333;
  --cal-muted: #65718c;
  --cal-line: #dfe5ee;
  --cal-control: #c9d2e0;
  --cal-primary: #07966d;
  --cal-on-primary: #ffffff;
  --cal-primary-hover: #087e5e;
  --cal-primary-pressed: #066d52;
  --cal-success: #12a66f;
  --cal-on-success: #ffffff;
  --cal-green: #e1f8e8;
  --cal-green-icon: #14a94f;
  --cal-green-text: #08764a;
  --cal-yellow: #fff4d4;
  --cal-yellow-icon: #eba916;
  --cal-red: #ffe4e5;
  --cal-red-icon: #ef454c;
  --cal-tile-ink: #071333;
  --cal-bar-empty: #d6dbe4;
  background: var(--cal-paper);
}
body[data-page="home"] .cal-topbar { width: 100%; max-width: 1510px; height: 80px; margin: 0 auto; padding: 0 32px; }
body[data-page="home"] .cal-logo { gap: 12px; }
body[data-page="home"] .cal-logo svg { width: 36px; height: 36px; }
body[data-page="home"] .cal-logo__text { font-size: 27px; font-weight: 800; }
.cal-account-button {
  min-height: 48px; padding: 0 22px; display: inline-flex; align-items: center; gap: 10px;
  border: 0; border-radius: 12px; background: var(--cal-primary); color: var(--cal-on-primary);
  box-shadow: 0 10px 24px rgba(7, 150, 109, .18); cursor: pointer; font-size: 15px; font-weight: 750;
}
.cal-account-button:hover { background: var(--cal-primary-hover); }
.cal-home { width: 100%; max-width: 1510px; margin: 0 auto; display: flex; flex-direction: column; gap: 34px; padding: 0 32px 56px; }
.cal-hero {
  position: relative; isolation: isolate; display: grid; gap: 28px; overflow: hidden; padding: 28px;
  border: 1px solid var(--cal-line); border-radius: 30px;
  background: #ffffff url("/static/calindar-home-background.webp") center / cover no-repeat;
  box-shadow: 0 24px 72px rgba(28, 48, 82, .08);
}
.cal-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: rgba(255, 255, 255, .08); pointer-events: none; }
.cal-hero__copy { display: flex; flex-direction: column; align-items: flex-start; gap: 24px; align-self: center; min-width: 0; }
.cal-hero__eyebrow {
  margin: 0; display: inline-flex; align-items: center; min-height: 36px; padding: 7px 18px;
  border-radius: var(--cal-r-pill); background: #eef2ff; color: #2455c3; font-size: 15px; line-height: 1.2; font-weight: 600;
}
.cal-hero__title { margin: 0; max-width: 9ch; font-size: clamp(52px, 5.8vw, 88px); line-height: .94; font-weight: 800; letter-spacing: -0.055em; }
.cal-hero__flow { width: 100%; max-width: 540px; display: flex; flex-direction: column; align-items: flex-start; }
.cal-hero__sources { display: flex; align-items: center; gap: 38px; padding-left: 18px; }
.cal-source-badge {
  position: relative; width: 74px; height: 74px; display: grid; place-items: center; flex: none;
  border: 1px solid var(--cal-line); border-radius: 18px; background: #fff; color: var(--cal-ink);
  box-shadow: 0 12px 28px rgba(41, 61, 96, .12); font-size: 24px; line-height: 1; font-weight: 800;
}
.cal-source-badge::after { content: ""; position: absolute; inset: 10px; z-index: -1; border-radius: 10px; opacity: .16; }
.cal-source-badge--google { transform: rotate(-10deg); color: #2475ea; border-bottom: 7px solid #31a853; }
.cal-source-badge--google::after { background: #fbbc04; }
.cal-source-badge--apple { transform: rotate(2deg); color: #111827; border-top: 13px solid #ef3340; }
.cal-source-badge--apple::before { content: "JUL"; position: absolute; top: -10px; color: #fff; font-size: 9px; letter-spacing: .04em; }
.cal-source-badge--outlook { transform: rotate(10deg); color: #0879ce; background: #e8f4ff; }
.cal-hero__flow-arrows { width: 300px; height: 48px; display: flex; align-items: center; justify-content: space-around; padding: 0 24px; color: #7189f5; font-size: 34px; font-weight: 400; transform: translateY(2px); }
.cal-hero__flow-arrows span:nth-child(2) { color: #9f72ef; }
.cal-hero__flow-arrows span:nth-child(3) { color: var(--cal-primary); }
.cal-hero__flow-result { display: flex; align-items: center; gap: 14px; width: 100%; }
.cal-hero__flow-card { min-height: 92px; max-width: 248px; padding: 16px 20px; display: flex; align-items: center; gap: 14px; border: 1px solid var(--cal-line); border-radius: 18px; background: #fff; box-shadow: 0 12px 32px rgba(41, 61, 96, .10); font-size: 17px; font-weight: 650; line-height: 1.3; }
.cal-hero__flow-card svg { flex: none; color: var(--cal-primary); }
.cal-hero__flow-next { color: var(--cal-primary); font-size: 38px; line-height: 1; }
.cal-hero__flow-answer { max-width: 190px; font-size: 17px; font-weight: 650; line-height: 1.35; }
.cal-hero__action { min-width: 0; display: flex; flex-direction: column; gap: 16px; align-self: stretch; padding: 28px; border: 1px solid var(--cal-line); border-radius: 24px; background: rgba(255, 255, 255, .94); box-shadow: 0 20px 50px rgba(40, 61, 94, .10); }
.cal-hero__form-card {
  position: relative; z-index: 1; padding: 18px; border: 1px solid var(--cal-line); border-radius: 18px; background: #fff;
}
.cal-hero__form-top { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.cal-hero__form-head { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.cal-hero__form-head .cal-h2 { font-size: 25px; white-space: nowrap; }
.cal-hero__form-head .cal-muted { font-size: 14px; line-height: 1.45; }
.cal-hero__form { display: flex; flex-direction: column; gap: 14px; }
.cal-hero__form .cal-field { gap: 7px; }
.cal-hero__form .cal-field > label,
.cal-hero__form .cal-field > span { font-size: 14px; font-weight: 700; }
.cal-hero__form .cal-input { height: 60px; padding: 0 18px; background: #fff; }
.cal-hero__form .cal-btn { height: 60px; border-radius: 12px; padding: 0 28px; }
.cal-hero__kind { flex: 0 1 430px; }
.cal-hero__kind .cal-seg { border: 1px solid var(--cal-line); background: #fff; }
.cal-hero__kind .cal-seg__opt { min-width: 150px; }
.cal-hero__name > label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.cal-hero__art { position: relative; min-width: 0; }
.cal-hero__art-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.cal-hero__people { display: flex; padding-left: 10px; }
.cal-hero__people span {
  width: 50px; height: 50px; margin-left: -10px; display: grid; place-items: center; border: 3px solid #fff;
  border-radius: 50%; background: #bdf0ce; color: #125b3a; font-size: 14px; font-weight: 800;
}
.cal-hero__people span:nth-child(2) { background: #d7c6ff; color: #4b23a1; }
.cal-hero__people span:nth-child(3) { background: #ffd9bc; color: #8a4316; }
.cal-hero__people span:nth-child(4) { background: #c7e0ff; color: #24599a; }
.cal-hero__art .cal-plate { padding: 0; border: 0; background: transparent; }
.cal-hero__art .cal-plate__grid { --cal-cols: 7; }
.cal-hero__art .cal-tile {
  height: 118px; padding: 12px 8px 14px; align-items: center; justify-content: flex-start; cursor: default;
  border: 1px solid var(--cal-line); border-radius: 12px; background: #fff; animation: cal-tile-in 360ms var(--cal-ease) both;
}
.cal-hero__art .cal-tile--green { background: linear-gradient(#fff 48%, #e4f9e9); }
.cal-hero__art .cal-tile--yellow { background: linear-gradient(#fff 48%, #fff5da); }
.cal-hero__art .cal-tile--red { background: linear-gradient(#fff 48%, #ffe7e8); }
.cal-hero__art .cal-tile--featured { border: 2px solid #3aca75; box-shadow: 0 8px 18px rgba(20, 169, 79, .13); }
.cal-hero__art .cal-tile__day { font-size: 14px; font-weight: 800; line-height: 1.2; }
.cal-hero__art .cal-tile__label { margin-top: 3px; color: var(--cal-muted); font-size: 12px; font-weight: 600; }
.cal-hero__art .cal-tile__foot { width: 100%; min-height: 10px; margin-top: auto; }
.cal-hero__art .cal-tile__bars { width: 100%; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.cal-hero__art .cal-tile__bar { width: 9px; height: 9px; justify-self: center; border-radius: 50%; }
.cal-hero__art .cal-tile__icon { display: none; }
.cal-hero__match {
  display: inline-flex; align-items: center; gap: 10px; min-height: 50px; padding: 10px 22px;
  border: 1px solid #c8f0d7; border-radius: 14px; background: #e3f9eb; color: #075f3d; font-size: 14px; font-weight: 800;
}
.cal-hero__match-star { color: var(--cal-success); font-size: 23px; line-height: 1; }
@keyframes cal-tile-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .cal-hero__art .cal-tile { animation: cal-fade 200ms ease both; } }
.cal-how { display: flex; flex-direction: column; gap: 18px; padding: 0; }
.cal-how__head { display: flex; justify-content: center; text-align: center; }
.cal-how .cal-h2 { font-size: 36px; }
.cal-home .cal-numbered { gap: 14px; font-size: 15px; }
.cal-home .cal-numbered > li {
  position: relative; min-height: 190px; grid-template-columns: minmax(0, .78fr) minmax(150px, 1.22fr); gap: 18px; align-items: center;
  padding: 28px 28px 24px; border: 1px solid var(--cal-line); border-radius: 18px; background: #fff; overflow: hidden;
}
.cal-home .cal-numbered > li::before { position: absolute; left: 28px; top: 20px; width: 42px; height: 42px; border: 0; background: #dbe8ff; color: #225cc7; font-size: 18px; z-index: 2; }
.cal-home .cal-numbered > li:nth-child(2)::before { background: #e9ddff; color: #6837c5; }
.cal-home .cal-numbered > li:nth-child(3)::before { background: #d8f6e3; color: #078453; }
.cal-step-copy { display: flex; flex-direction: column; gap: 8px; padding-top: 44px; }
.cal-step-copy strong { font-size: 20px; line-height: 1.25; }
.cal-step-copy small { color: var(--cal-muted); font-size: 13px; line-height: 1.4; }
.cal-step-visual { min-width: 0; display: flex; align-items: center; justify-content: center; }
.cal-step-visual .cal-source-badge { width: 58px; height: 58px; border-radius: 14px; font-size: 19px; }
.cal-step-visual--sources { gap: 8px; }
.cal-step-visual--people { flex-direction: column; gap: 14px; }
.cal-step-visual--people .cal-hero__people span { width: 36px; height: 36px; font-size: 10px; }
.cal-step-dots { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.cal-step-dots > span { display: flex; justify-content: center; gap: 7px; }
.cal-step-dots i { width: 18px; height: 8px; border-radius: var(--cal-r-pill); background: #e8ebf0; }
.cal-step-dots i.is-on { background: #8bdcaf; }
.cal-step-visual--result { min-height: 120px; background: repeating-linear-gradient(0deg, transparent 0 18px, #f5f7fa 18px 28px); border-radius: 22px; }
.cal-step-result-card { width: 76px; height: 76px; display: grid; place-items: center; border-radius: 16px; background: var(--cal-primary); color: #fff; box-shadow: 0 16px 30px rgba(7, 150, 109, .22); transform: rotate(-6deg); }
.cal-recent { display: flex; flex-direction: column; gap: 12px; }

@media (min-width: 1100px) {
  .cal-hero { grid-template-columns: minmax(0, .8fr) minmax(640px, 1.2fr); min-height: 660px; gap: 32px; padding: 26px 24px 26px 38px; }
  .cal-hero__copy { padding: 20px 10px; }
  .cal-hero__form-card { margin-top: auto; }
  .cal-hero__form .cal-form-row { flex-wrap: nowrap; }
  .cal-home .cal-numbered { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cal-recent { max-width: 640px; }
}

@media (max-width: 1099.98px) {
  .cal-hero { grid-template-columns: 1fr; }
  .cal-hero__copy { max-width: 690px; }
  .cal-hero__title { max-width: 10ch; }
  .cal-hero__action { padding: 22px; }
  .cal-home .cal-numbered { display: grid; grid-template-columns: 1fr; }
}

@media (max-width: 719.98px) {
  body[data-page="home"] .cal-topbar { height: 68px; padding: 0 16px; }
  body[data-page="home"] .cal-logo svg { width: 30px; height: 30px; }
  body[data-page="home"] .cal-logo__text { font-size: 20px; }
  .cal-account-button { width: 46px; height: 46px; padding: 0; justify-content: center; border-radius: 50%; }
  .cal-account-button span { display: none; }
  .cal-home { padding: 8px 16px 40px; }
  .cal-hero { padding: 24px 16px; border-radius: 22px; }
  .cal-hero__copy { gap: 18px; }
  .cal-hero__title { font-size: clamp(48px, 15vw, 64px); }
  .cal-hero__sources { gap: 20px; padding-left: 10px; }
  .cal-source-badge { width: 62px; height: 62px; }
  .cal-hero__flow-arrows { width: 240px; }
  .cal-hero__flow-result { align-items: stretch; gap: 8px; }
  .cal-hero__flow-card { min-height: 82px; padding: 13px 14px; font-size: 14px; }
  .cal-hero__flow-answer { font-size: 14px; }
  .cal-hero__action { padding: 16px; }
  .cal-hero__people span { width: 38px; height: 38px; font-size: 11px; }
  .cal-hero__match { min-height: 42px; padding: 8px 12px; font-size: 12px; }
  .cal-hero__art .cal-plate__grid { gap: 4px; }
  .cal-hero__art .cal-tile { height: 76px; padding: 8px 3px; }
  .cal-hero__art .cal-tile__day { font-size: 12px; }
  .cal-hero__art .cal-tile__label { font-size: 9px; }
  .cal-hero__art .cal-tile__bars { gap: 2px; }
  .cal-hero__art .cal-tile__bar { width: 5px; height: 5px; }
  .cal-hero__form-top { align-items: stretch; flex-direction: column; gap: 12px; }
  .cal-hero__form-head .cal-h2 { white-space: normal; }
  .cal-hero__kind { flex-basis: auto; }
  .cal-hero__kind .cal-seg__opt { min-width: 0; font-size: 14px; }
  .cal-hero__name > label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .cal-hero__form .cal-form-row { flex-direction: column; }
  .cal-hero__form .cal-form-row > .cal-input,
  .cal-hero__form .cal-form-row > .cal-btn { flex: 0 0 60px; height: 60px; }
  .cal-hero__form .cal-btn { width: 100%; }
  .cal-how .cal-h2 { font-size: 30px; }
  .cal-home .cal-numbered > li { min-height: 180px; padding: 24px 20px; grid-template-columns: minmax(0, 1fr) minmax(130px, 1fr); }
  .cal-home .cal-numbered > li::before { left: 20px; top: 18px; }
  .cal-step-copy strong { font-size: 18px; }
  .cal-step-copy small { display: none; }
}

@media (max-width: 359.98px) {
  .cal-hero__flow-result { display: grid; grid-template-columns: 1fr; gap: 4px; }
  .cal-hero__flow-card { width: 100%; max-width: none; }
  .cal-hero__flow-next { margin-left: 44px; transform: rotate(90deg); font-size: 30px; }
  .cal-hero__flow-answer { max-width: 100%; padding-left: 62px; }
  .cal-hero__kind .cal-seg__opt { height: 52px; padding: 0 4px; white-space: normal; font-size: 13px; line-height: 1.15; }
  .cal-hero__art .cal-tile__bars { gap: 1px; }
  .cal-hero__art .cal-tile__bar { width: 3px; height: 3px; }
}

/* ---------- Footer, toast ---------- */
.cal-footer {
  display: flex; align-items: center; justify-content: center; gap: 12px; margin: 8px var(--cal-gutter) 0;
  padding: 18px 0 28px; border-top: 1px solid var(--cal-line); font-size: 14px; color: var(--cal-muted);
}
.cal-footer a { text-decoration: none; min-height: var(--cal-tap); display: inline-flex; align-items: center; }
.cal-footer a:hover { color: var(--cal-ink); text-decoration: underline; text-underline-offset: 3px; }
@media (min-width: 960px) { .cal-footer { margin: 0 64px; } }

#toast {
  position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translate(-50%, -16px);
  max-width: calc(100% - 32px); padding: 12px 20px; border-radius: var(--cal-r-pill);
  background: var(--cal-primary); color: var(--cal-on-primary); font-family: var(--cal-font); font-size: 15px; font-weight: 600;
  box-shadow: var(--cal-shadow-dialog); opacity: 0; pointer-events: none; z-index: 60;
  transition: opacity 200ms ease, transform 200ms var(--cal-ease);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { #toast { transition: opacity 200ms ease; transform: translate(-50%, 0); } }

/* Small layout helpers */
.cal-stack-12 { display: flex; flex-direction: column; gap: 12px; }
.cal-stack-14 { display: flex; flex-direction: column; gap: 14px; }
.cal-stack-16 { display: flex; flex-direction: column; gap: 16px; }
.cal-rowbtn__sub--warn { color: var(--cal-danger); }
/* A panel replacing another one appears without sliding in again. */
.cal-overlay--instant .cal-overlay__scrim,
.cal-overlay--instant .cal-overlay__panel { animation: none; }
.cal-overlay__panel:focus { outline: none; }
.cal-daycard:focus { outline: none; }
.cal-daycard:focus-visible { outline: 2px solid var(--cal-focus); outline-offset: 2px; }
@media (min-width: 960px) { .cal-demo-note { margin: 16px 64px 0; } }

/* Phone week grid: seven compact tiles per row (date, status icon, one fill bar). */
.cal-plate--compact { padding: 12px 8px; }
.cal-plate--compact .cal-plate__heads,
.cal-plate--compact .cal-plate__grid { gap: 4px; }
.cal-tile--compact { height: 64px; padding: 6px 6px 7px; }
.cal-tile--compact .cal-tile__label { font-size: 15px; line-height: 1.1; }
.cal-tile--compact .cal-tile__foot { min-height: 5px; }
.cal-tile--compact .cal-tile__bars { gap: 1px; }
.cal-tile--compact .cal-tile__bar { width: 3px; }
.cal-tile__meter { display: block; width: 100%; height: 4px; border-radius: 2px; background: var(--cal-bar-empty); overflow: hidden; }
.cal-tile__meter span { display: block; height: 100%; border-radius: 2px; }
.cal-tile--green .cal-tile__meter span { background: var(--cal-green-icon); }
.cal-tile--yellow .cal-tile__meter span { background: var(--cal-yellow-icon); }
.cal-tile--red .cal-tile__meter span { background: var(--cal-red-icon); }
.cal-plate--compact .cal-tile[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--cal-ink); }
@media (max-width: 359.98px) {
  .cal-plate--compact { padding: 10px 6px; }
  .cal-plate--compact .cal-plate__heads, .cal-plate--compact .cal-plate__grid { gap: 3px; }
  .cal-tile--compact { padding: 5px 4px 6px; }
  .cal-tile--compact .cal-tile__label { font-size: 14px; }
}
