/* Claude's design language (warm cream and charcoal surfaces, a grotesque UI face with a
   serif for headings, soft hairline borders) with FawziFam's misty teal as the primary
   colour. Colors are HSL triplets (as Claude defines them) so any of them can take an
   alpha: hsl(var(--primary) / 20%). */
:root {
  color-scheme: light;
  --bg-000: 0 0% 100%;
  --bg-100: 48 33.3% 97.1%;
  --bg-200: 53 28.6% 94.5%;
  --bg-300: 48 25% 92.2%;
  --text-000: 60 2.6% 7.6%;
  --text-200: 60 2.5% 23.3%;
  --text-400: 51 3.1% 43.7%;
  --border: 30 3.3% 11.8%;
  /* #bacfcf. It's light, so anything drawn on it uses the deep --on-primary ink, and
     teal text or icons on the page use --primary-strong, a darker shade of the hue. */
  --primary: 180 17.9% 77.1%;
  --primary-hover: 180 17.9% 71%;
  --primary-strong: 180 22% 34%;
  --on-primary: 180 30% 14%;
  --danger: 0 56.2% 45.4%;
  --success: 103 72.3% 26.9%;
  --warn: 38 80% 45%;
  --on-color: 0 0% 100%;
  --shadow: 0 0.25rem 1.25rem hsl(0 0% 0% / 4%);
  /* People and calendar categories have a hue (public/shared/palette.js). The theme sets
     the saturation and lightness, so any hue reads well. setTint() in ui.js gives an
     element --tint: "<hue> var(--tint-sl)"; without a hue it's the neutral grey. */
  --tint-sl: 62% 45%;
  --c-none: 51 3.1% 55%;
  --tint: var(--c-none);
  /* Bills on the calendar: #8e8e93, a neutral grey, so the family's events stand out. */
  --bill: 240 2.3% 56.7%;
  --hue-gradient: linear-gradient(to right, hsl(0 var(--tint-sl)), hsl(30 var(--tint-sl)), hsl(60 var(--tint-sl)), hsl(90 var(--tint-sl)), hsl(120 var(--tint-sl)), hsl(150 var(--tint-sl)), hsl(180 var(--tint-sl)), hsl(210 var(--tint-sl)), hsl(240 var(--tint-sl)), hsl(270 var(--tint-sl)), hsl(300 var(--tint-sl)), hsl(330 var(--tint-sl)), hsl(360 var(--tint-sl)));

  --font-sans: "Hanken Grotesk Variable", system-ui, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Newsreader Variable", Georgia, "Times New Roman", serif;
  --radius: 1.25rem;
  --gutter: 16px;
}

/* Dark, from the system setting unless the person picked light. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg-000: 60 2.1% 18.4%;
    --bg-100: 60 2.7% 14.5%;
    --bg-200: 30 3.3% 11.8%;
    --bg-300: 60 2.6% 7.6%;
    --text-000: 48 33.3% 97.1%;
    --text-200: 50 9% 73.7%;
    --text-400: 48 4.8% 59.2%;
    --border: 51 16.5% 84.5%;
    --primary-hover: 180 22% 84%;
    --primary-strong: 180 17.9% 77.1%;
    --danger: 0 67% 59.6%;
    --success: 100 45% 52%;
    --warn: 38 85% 58%;
    --shadow: 0 0.25rem 1.25rem hsl(0 0% 0% / 25%);
    --tint-sl: 68% 66%;
    --c-none: 48 4.8% 59.2%;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-000: 60 2.1% 18.4%;
  --bg-100: 60 2.7% 14.5%;
  --bg-200: 30 3.3% 11.8%;
  --bg-300: 60 2.6% 7.6%;
  --text-000: 48 33.3% 97.1%;
  --text-200: 50 9% 73.7%;
  --text-400: 48 4.8% 59.2%;
  --border: 51 16.5% 84.5%;
  --primary-hover: 180 22% 84%;
  --primary-strong: 180 17.9% 77.1%;
  --danger: 0 67% 59.6%;
  --success: 100 45% 52%;
  --warn: 38 85% 58%;
  --shadow: 0 0.25rem 1.25rem hsl(0 0% 0% / 25%);
  --tint-sl: 68% 66%;
  --c-none: 48 4.8% 59.2%;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: hsl(var(--bg-100));
  color: hsl(var(--text-000));
  font: 400 1rem/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }

button, input { font: inherit; color: inherit; }
button { touch-action: manipulation; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid hsl(var(--primary-strong) / 70%); outline-offset: 2px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.fine { margin: 0; font-size: 0.8125rem; color: hsl(var(--text-400)); }

.display {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 330;
  font-size: 2.25rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-align: center;
  overflow-wrap: anywhere;
}
.display.sm { font-size: 1.625rem; text-align: left; }

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: hsl(var(--bg-100));
  border-bottom: 0.5px solid transparent;
  transition: border-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) 4px max(var(--gutter), env(safe-area-inset-left));
}
.brand { display: flex; align-items: center; gap: 8px; }
.mark { width: 30px; height: 30px; color: hsl(var(--primary-strong)); stroke-width: 1.9; }
.wordmark { font-family: var(--font-serif); font-size: 1.5rem; font-weight: 420; letter-spacing: -0.01em; line-height: 1; }
.topbar-actions { display: flex; gap: 4px; }
/* Once the page scrolls under it, a hairline separates them. */
.topbar[data-scrolled] { border-bottom-color: hsl(var(--border) / 15%); }
body:not([data-view="calendar"]) #cal-bell { display: none; }
body[data-view="camera"] .topbar-actions { display: none; }

:root .show-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .show-light { display: none; }
  :root:not([data-theme="light"]) .show-dark { display: block; }
}
:root[data-theme="dark"] .show-light { display: none; }
:root[data-theme="dark"] .show-dark { display: block; }

/* Buttons */
.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 0.75rem;
  background: transparent;
  color: hsl(var(--text-200));
  transition: background-color 0.15s, color 0.15s, transform 0.1s;
}
.icon-btn:hover { background: hsl(var(--text-000) / 6%); color: hsl(var(--text-000)); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn.round {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: hsl(var(--bg-000));
  border: 0.5px solid hsl(var(--border) / 15%);
  box-shadow: var(--shadow);
}
.icon-btn.lg { width: 64px; height: 64px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 0.75rem;
  border: 0.5px solid transparent;
  font-weight: 550;
  transition: background-color 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: hsl(var(--primary)); color: hsl(var(--on-primary)); }
.btn.primary:hover { background: hsl(var(--primary-hover)); }
.btn.ghost { background: transparent; color: hsl(var(--text-200)); border-color: hsl(var(--border) / 15%); }
.btn.ghost:hover { background: hsl(var(--text-000) / 5%); }
.btn.block { width: 100%; }
.btn svg { width: 26px; height: 26px; }

/* Layout */
main {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 8px max(var(--gutter), env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
}
.view {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* Home: the big button */
.home { justify-content: center; padding-bottom: 8vh; }
.hero {
  position: relative;
  display: grid;
  place-items: center;
  width: 176px;
  height: 176px;
  border: 0;
  border-radius: 50%;
  background: hsl(var(--primary));
  color: hsl(var(--on-primary));
  box-shadow: 0 0.75rem 2rem hsl(var(--primary-strong) / 25%);
  transition: transform 0.15s, background-color 0.15s, opacity 0.2s;
}
.hero svg { width: 88px; height: 88px; stroke-width: 1.5; }
.hero:hover { background: hsl(var(--primary-hover)); }
.hero:active { transform: scale(0.96); }
.hero::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid hsl(var(--primary-strong) / 30%);
  animation: breathe 2.4s ease-in-out infinite;
}
/* While the face models load: dimmed, with a spinning arc instead of the halo. */
.hero[aria-busy="true"] { opacity: 0.55; }
.hero[aria-busy="true"]::after {
  border-color: hsl(var(--primary-strong)) transparent transparent;
  animation: spin 1s linear infinite;
}

.outcome { display: grid; justify-items: center; gap: 8px; text-align: center; animation: pop 0.35s ease-out; }
.outcome-badge {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: hsl(var(--danger) / 12%);
  color: hsl(var(--danger));
}
.outcome-badge svg { width: 40px; height: 40px; }

/* Camera */
.camera { gap: 16px; }
.viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: calc(100dvh - 220px);
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow);
}
/* Mirrored, so it moves like a mirror; the landmark canvas mirrors with it. */
.viewport video, .viewport canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.viewport canvas { color: hsl(var(--primary)); }
.oval {
  position: absolute;
  left: 50%;
  top: 52%;
  width: 66%;
  height: 64%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 3px dashed rgb(255 255 255 / 60%);
  box-shadow: 0 0 0 999px rgb(0 0 0 / 30%);
  transition: border-color 0.2s;
}
.viewport[data-state="ok"] .oval { border-style: solid; border-color: hsl(var(--primary)); }
.viewport[data-state="warn"] .oval { border-color: hsl(var(--warn)); }

/* The instruction: one big animated icon at the top, near the camera, so eyes stay up. */
.cue {
  position: absolute;
  top: 12px;
  left: 50%;
  translate: -50% 0;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: rgb(20 20 19 / 55%);
  backdrop-filter: blur(8px);
  color: #fff;
}
.cue svg { width: 48px; height: 48px; stroke-width: 2; }
.viewport[data-state="warn"] .cue { color: hsl(var(--warn)); }
.cue[data-cue="center"] svg { animation: breathe-icon 1.6s ease-in-out infinite; }
.cue[data-cue="blink"] svg { animation: blink 1.6s ease-in-out infinite; }
.cue[data-cue="left"] svg { animation: nudge-left 1.1s ease-in-out infinite; }
.cue[data-cue="right"] svg { animation: nudge-right 1.1s ease-in-out infinite; }
.cue[data-cue="none"] svg, .cue[data-cue="far"] svg, .cue[data-cue="many"] svg { animation: breathe-icon 1s ease-in-out infinite; }

.timebar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgb(255 255 255 / 15%); }
.timebar span { display: block; height: 100%; width: 100%; background: hsl(var(--primary)); transition: width 0.25s linear; }

.dots { display: flex; gap: 10px; margin: 0; padding: 0; list-style: none; }
.dots li {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid hsl(var(--border) / 20%);
  transition: background-color 0.2s, border-color 0.2s;
}
.dots li svg { width: 16px; height: 16px; stroke-width: 3; color: hsl(var(--on-primary)); }
.dots li.done { background: hsl(var(--primary)); border-color: hsl(var(--primary)); animation: pop 0.3s ease-out; }
.dots li.current { border-color: hsl(var(--primary-strong)); animation: ring 1.4s ease-in-out infinite; }

/* Signed in */
.user { justify-content: center; padding-bottom: 8vh; }
.avatar {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: hsl(var(--bg-300));
  font-size: 24px;
  line-height: 1;
}
.avatar.xl { width: 120px; height: 120px; font-size: 68px; border: 0.5px solid hsl(var(--border) / 15%); }
.avatar .badge {
  position: absolute;
  right: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: hsl(var(--success));
  color: hsl(var(--on-color));
  border: 3px solid hsl(var(--bg-100));
  animation: pop 0.4s 0.15s ease-out backwards;
}
.avatar .badge svg { width: 20px; height: 20px; stroke-width: 3; }
.user .avatar.xl { animation: pop 0.4s ease-out; }

/* Cards and forms */
.card {
  width: 100%;
  display: grid;
  gap: 14px;
  padding: 20px;
  border-radius: var(--radius);
  background: hsl(var(--bg-000));
  border: 0.5px solid hsl(var(--border) / 15%);
  box-shadow: var(--shadow);
}
.sheet { margin-top: 4vh; justify-items: center; grid-template-columns: minmax(0, 1fr); }
.sheet > * { width: 100%; }
.card-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: hsl(var(--primary));
  color: hsl(var(--on-primary));
}
.card-icon svg { width: 28px; height: 28px; }

input:not([type="checkbox"], [type="range"]) {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 0.75rem;
  border: 0.5px solid hsl(var(--border) / 25%);
  background: hsl(var(--bg-100));
  font-size: 1.0625rem; /* 16px+ stops phones zooming in on focus */
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:not([type="checkbox"], [type="range"]):focus { outline: none; border-color: hsl(var(--primary-strong)); box-shadow: 0 0 0 3px hsl(var(--primary) / 50%); }
input::placeholder { color: hsl(var(--text-400)); }

.password { position: relative; }
.password input { padding-right: 52px; }
.password .reveal { position: absolute; right: 4px; top: 50%; translate: 0 -50%; }

.actions { display: grid; grid-template-columns: auto 1fr; gap: 10px; }

/* The picture circle opens the picture keyboard: any emoji, or a hashflag. */
.picker { padding: 0; }
.picker:active { scale: 0.96; }
.avatar .badge.edit { background: hsl(var(--primary)); color: hsl(var(--on-primary)); animation: none; pointer-events: none; }

.consent {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 0.75rem;
  background: hsl(var(--bg-200));
  color: hsl(var(--text-200));
  font-size: 0.9375rem;
  cursor: pointer;
}
.consent input { width: 22px; height: 22px; margin: 0; accent-color: hsl(var(--primary-strong)); }
.consent:has(input:checked) { color: hsl(var(--success)); }

.shake { animation: shake 0.4s; }

/* Admin */
.admin { align-items: stretch; gap: 14px; }
.admin-head { display: flex; align-items: center; gap: 4px; }
.admin-head h1 { flex: 1; }
.dot-badge { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: hsl(var(--primary-strong)); border: 2px solid hsl(var(--bg-100)); }

.user-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.user-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px 8px 10px;
  border-radius: 1rem;
  background: hsl(var(--bg-000));
  border: 0.5px solid hsl(var(--border) / 15%);
}
.user-row.fresh { animation: pop 0.4s ease-out; border-color: hsl(var(--primary-strong) / 60%); }
/* The card's main button stretches over the whole card (through ::after), so tapping
   anywhere opens it; the action buttons are raised above it. */
.row-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 0; border: 0; background: transparent; text-align: start; }
.row-open::after { content: ""; position: absolute; inset: 0; border-radius: 1rem; transition: background-color 0.15s; }
.row-open:hover::after { background: hsl(var(--text-000) / 3%); }
.row-open:active::after { background: hsl(var(--text-000) / 6%); }
.row-open:focus-visible { outline: none; }
.row-open:focus-visible::after { outline: 2px solid hsl(var(--primary-strong) / 70%); outline-offset: 2px; }
.user-row .icon-btn { z-index: 1; }
.who { flex: 1; min-width: 0; display: grid; }
.who .name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.no-face { display: grid; place-items: center; flex: none; width: 44px; height: 44px; color: hsl(var(--text-400)); }
.act-delete[data-armed] { background: hsl(var(--danger)); color: hsl(var(--on-color)); }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 2 * var(--gutter));
  padding: 10px 16px 10px 12px;
  border-radius: 999px;
  background: hsl(var(--text-000));
  color: hsl(var(--bg-100));
  box-shadow: var(--shadow);
  font-size: 0.9375rem;
  animation: rise 0.25s ease-out;
  z-index: 20;
}
.toast[data-tone="error"] svg { color: hsl(var(--danger)); }
.toast[data-tone="ok"] svg { color: hsl(var(--success)); }

/* Colours on pictures. A picture can be a button (tap it to change the colour). */
.avatar[data-tinted] { background: hsl(var(--tint) / 28%); }
button.avatar { padding: 0; border: 0; cursor: pointer; }
.avatar.xs { width: 22px; height: 22px; font-size: 13px; }
.user-actions { display: flex; gap: 16px; }
.icon-btn.round.primary { background: hsl(var(--primary)); color: hsl(var(--on-primary)); border-color: transparent; }
.icon-btn.round.primary:hover { background: hsl(var(--primary-hover)); }
.person-name { text-align: center; }
:dir(rtl) .flip { scale: -1 1; }

/* The colour picker: a rainbow bar with a round handle in the chosen colour, and the
   same position as a percentage. Both show the theme's own shade of each hue. */
.hue-picker { display: grid; grid-template-columns: minmax(0, 1fr) 5.5rem; gap: 10px; align-items: center; }
.hue-bar { width: 100%; height: 44px; margin: 0; background: transparent; cursor: pointer; appearance: none; -webkit-appearance: none; }
.hue-bar::-webkit-slider-runnable-track { height: 14px; border-radius: 999px; background: var(--hue-gradient); }
.hue-bar::-moz-range-track { height: 14px; border-radius: 999px; background: var(--hue-gradient); }
.hue-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  margin-top: -8px;
  border: 3px solid hsl(var(--bg-000));
  border-radius: 50%;
  background: hsl(var(--tint));
  box-shadow: 0 0 0 1px hsl(var(--border) / 25%), 0 2px 6px hsl(0 0% 0% / 25%);
}
.hue-bar::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border: 3px solid hsl(var(--bg-000));
  border-radius: 50%;
  background: hsl(var(--tint));
  box-shadow: 0 0 0 1px hsl(var(--border) / 25%), 0 2px 6px hsl(0 0% 0% / 25%);
}
.hue-bar:focus-visible { outline: none; }
.hue-bar:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px hsl(var(--primary) / 70%); }
.hue-bar:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px hsl(var(--primary) / 70%); }
.hue-field { position: relative; }
.hue-field input { padding-inline: 12px 30px; text-align: end; font-variant-numeric: tabular-nums; appearance: textfield; -moz-appearance: textfield; }
.hue-field input::-webkit-inner-spin-button, .hue-field input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.hue-field span { position: absolute; inset-inline-end: 12px; top: 50%; translate: 0 -50%; color: hsl(var(--text-400)); pointer-events: none; }

/* Calendar: shared bits */
.calendar, .day { max-width: 560px; align-items: stretch; gap: 8px; }
.cal-bar { display: flex; align-items: center; gap: 4px; }
.spacer { flex: 1; }
.icon-btn.add { color: hsl(var(--primary-strong)); }
.icon-btn.add svg { stroke-width: 2.25; }
/* Today's date sits inside the calendar icon. */
.icon-btn.today span {
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

.weekdays, .month-grid, .week-strip { display: grid; grid-template-columns: repeat(7, 1fr); }
.weekdays { padding: 4px 0; font-size: 0.75rem; font-weight: 600; color: hsl(var(--text-400)); text-align: center; }
.cell {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 3px;
  min-width: 0;
  min-height: 50px;
  padding: 4px 0 6px;
  border: 0;
  border-top: 0.5px solid hsl(var(--border) / 12%);
  background: transparent;
  font-variant-numeric: tabular-nums;
}
.cell .num {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.0625rem;
  transition: background-color 0.15s;
}
.cell:hover .num { background: hsl(var(--text-000) / 6%); }
.cell.out .num { opacity: 0.4; }
/* Today in teal; the chosen day filled, as Apple does in red. */
.cell[aria-current="date"] .num { color: hsl(var(--primary-strong)); font-weight: 700; }
.cell[aria-selected="true"] .num { background: hsl(var(--text-000)); color: hsl(var(--bg-100)); font-weight: 650; opacity: 1; }
.cell[aria-current="date"][aria-selected="true"] .num { background: hsl(var(--primary)); color: hsl(var(--on-primary)); }
.month-grid, .week-strip, .timeline { touch-action: pan-y; }

/* Up to three dots a day, for one-time events only. */
.marks { display: flex; align-items: center; gap: 3px; height: 7px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: hsl(var(--tint)); }
.dot.more { width: 4px; height: 4px; background: hsl(var(--text-400)); }

/* An event: tinted with its category's colour, with a bar down the side. Repeating
   events are lighter, with a dashed outline. */
.event-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.event-row, .day-event {
  position: relative;
  border: 1.5px solid transparent;
  background: hsl(var(--tint) / 20%);
  text-align: start;
  transition: transform 0.1s;
}
.event-row::before, .day-event::before {
  content: "";
  position: absolute;
  inset-inline-start: 4px;
  top: 6px;
  bottom: 6px;
  width: 4px;
  border-radius: 2px;
  background: hsl(var(--tint));
}
.event-row[data-repeat], .day-event[data-repeat] { background: hsl(var(--tint) / 9%); border-style: dashed; border-color: hsl(var(--tint)); }
.event-row:active, .day-event:active { transform: scale(0.98); }
.event-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 6px 10px 6px 16px;
  border-radius: 0.875rem;
}
.when {
  display: grid;
  justify-items: end;
  flex: none;
  width: 3.75rem;
  font-size: 0.8125rem;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
.when .to { color: hsl(var(--text-400)); }
.when .allday { width: 22px; height: 22px; color: hsl(var(--text-200)); }
.event-emoji { flex: none; font-size: 24px; line-height: 1; }
.what { flex: 1; min-width: 0; display: grid; gap: 3px; }
.what .title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.faces { display: flex; align-items: center; gap: 3px; }
.faces:empty { display: none; }
.what .where { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.what .ticks { font-variant-numeric: tabular-nums; }
.what .ticks.all-done { color: hsl(var(--success)); font-weight: 600; }
.faces-more { margin-inline-start: 2px; }
.repeats { width: 18px; height: 18px; flex: none; color: hsl(var(--tint)); }

/* Month */
.month-head { display: flex; align-items: center; gap: 4px; }
.month-head h1 { flex: 1; }
.agenda { display: grid; gap: 8px; margin-top: 4px; }
.agenda-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 4px 0 6px;
  border: 0;
  border-radius: 0.75rem;
  background: transparent;
  font-weight: 600;
  text-align: start;
}
.agenda-head:hover { background: hsl(var(--text-000) / 5%); }
.agenda-head svg { color: hsl(var(--text-400)); }
.btn.empty { min-height: 56px; border-style: dashed; color: hsl(var(--text-400)); }

/* Day: the header and week stay put while the hours scroll. */
.day { gap: 0; }
.day-top { position: sticky; top: var(--topbar-h, 0px); z-index: 2; display: grid; gap: 4px; padding-bottom: 8px; background: hsl(var(--bg-100)); }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: 0 10px 0 2px;
  border: 0;
  border-radius: 0.75rem;
  background: transparent;
  color: hsl(var(--primary-strong));
  font-size: 1.0625rem;
  font-weight: 600;
}
.back-link:hover { background: hsl(var(--text-000) / 5%); }
.week-strip .cell { min-height: 58px; border-top: 0; }
.week-strip .wd { font-size: 0.6875rem; font-weight: 600; color: hsl(var(--text-400)); }
.day-title { margin: 0; font-family: var(--font-serif); font-size: 1.125rem; text-align: center; }
.allday-lane { max-height: 136px; overflow-y: auto; }
.allday-lane .event-row { min-height: 44px; }

.timeline { --hour: 52px; position: relative; height: calc(24 * var(--hour)); margin-top: 10px; }
.hour { position: relative; display: block; width: 100%; height: var(--hour); padding: 0; border: 0; background: transparent; }
.hour:hover { background: hsl(var(--text-000) / 3%); }
.hour::after { content: ""; position: absolute; inset-inline: 52px 0; top: 0; border-top: 0.5px solid hsl(var(--border) / 14%); }
.hour span {
  position: absolute;
  top: -0.6em;
  inset-inline-start: 0;
  width: 44px;
  font-size: 0.6875rem;
  line-height: 1.2;
  color: hsl(var(--text-400));
  text-align: end;
  font-variant-numeric: tabular-nums;
}
.day-events { position: absolute; inset: 0; inset-inline-start: 56px; pointer-events: none; }
/* Placed by --top/--height (minutes) and --col/--cols, set from calendar.js. */
.day-event {
  position: absolute;
  top: calc(var(--top) * var(--hour) / 60 + 1px);
  inset-inline-start: calc(var(--col) * 100% / var(--cols));
  width: calc(100% / var(--cols) - 2px);
  height: calc(var(--height) * var(--hour) / 60 - 2px);
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: baseline;
  gap: 0 6px;
  overflow: hidden;
  padding: 2px 6px 2px 12px;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.35;
  pointer-events: auto;
}
.day-event .event-emoji { font-size: 15px; }
.day-event .title { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.day-event .fine { flex-basis: 100%; font-size: 0.75rem; }
/* Travel time: striped bands behind the events, before (getting there) and after
   (getting home), placed in minutes like the events. */
.travel-band {
  position: absolute;
  inset-inline: 0;
  top: calc(var(--top) * var(--hour) / 60);
  height: calc(var(--height) * var(--hour) / 60);
  overflow: hidden;
  padding: 1px 6px;
  border-radius: 0.5rem;
  background: repeating-linear-gradient(135deg, hsl(var(--text-000) / 8%) 0 5px, transparent 5px 10px);
  color: hsl(var(--text-400));
  font-size: 0.6875rem;
  line-height: 1.3;
  pointer-events: none;
}

/* Now, as a red line with a dot. */
.now-line {
  position: absolute;
  inset-inline: 48px 0;
  top: calc(var(--now) * var(--hour) / 60);
  height: 2px;
  background: hsl(var(--danger));
  pointer-events: none;
  z-index: 1;
}
.now-line::before { content: ""; position: absolute; inset-inline-start: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: hsl(var(--danger)); }

/* One event */
.event-card { text-align: center; }
.event-card .display.sm { text-align: center; }
.sheet > .chip { width: auto; justify-self: center; }
.event-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin: 0; color: hsl(var(--text-200)); }
.event-line svg { width: 18px; height: 18px; color: hsl(var(--text-400)); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: hsl(var(--tint) / 22%);
  font-weight: 550;
}
.people { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.person, .person-toggle { display: grid; justify-items: center; gap: 2px; }
.person .fine, .person-toggle .fine { max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notes {
  margin: 0;
  padding: 12px 14px;
  border-radius: 0.75rem;
  background: hsl(var(--bg-100));
  color: hsl(var(--text-200));
  text-align: start;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
/* Checklists: ticked on the event (saved straight away), edited one line per item. */
.check-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; text-align: start; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 0.75rem; background: hsl(var(--bg-100)); cursor: pointer; }
.check input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: hsl(var(--primary-strong)); }
.check span { overflow-wrap: anywhere; }
.check:has(input:checked) span { color: hsl(var(--text-400)); text-decoration: line-through; }
.checklist-edit { display: grid; gap: 6px; }
.checklist-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px; }
.checklist-row input { min-height: 44px; }
.checklist-row.blank .icon-btn { visibility: hidden; }

/* Where the event is, with a button that opens the phone's maps app. */
.event-where { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border-radius: 0.75rem; background: hsl(var(--bg-100)); text-align: start; }
.event-where .pin { width: 18px; height: 18px; color: hsl(var(--text-400)); }
.where-text { flex: 1; min-width: 0; display: grid; }
.where-text > :first-child { font-weight: 550; overflow-wrap: anywhere; }
.where-text .fine:empty { display: none; }
.home-note { text-align: center; }
.event-where .icon-btn { color: hsl(var(--primary-strong)); }
.actions.four { grid-template-columns: auto auto auto 1fr; gap: 6px; }
.actions.four .btn { padding: 0 12px; }
.actions.five { grid-template-columns: repeat(4, minmax(44px, 1fr)) minmax(44px, 1.6fr); gap: 6px; }
.actions.five .btn { padding: 0; }

/* Adding or changing an event */
.event-form { gap: 12px; padding: 20px 16px; }
.event-form .people { justify-content: flex-start; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .chip { min-height: 44px; border: 2px solid transparent; font-size: 0.9375rem; }
.chips .chip[aria-checked="true"] { border-color: hsl(var(--tint)); background: hsl(var(--tint) / 38%); }

/* Saved places: one line until opened, then a search box over an alphabetical list. */
.place-picker { display: grid; gap: 6px; }
.place-button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 0 12px 0 16px;
  border: 0.5px solid hsl(var(--border) / 25%);
  border-radius: 0.75rem;
  background: hsl(var(--bg-100));
  font-size: 1.0625rem;
  text-align: start;
}
.place-chosen { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place-chosen.placeholder { color: hsl(var(--text-400)); }
.place-arrow { color: hsl(var(--text-400)); transition: rotate 0.15s; }
.place-button[aria-expanded="true"] .place-arrow { rotate: 180deg; }
.place-panel {
  display: grid;
  gap: 6px;
  padding: 6px;
  border: 0.5px solid hsl(var(--border) / 15%);
  border-radius: 0.75rem;
  background: hsl(var(--bg-000));
  box-shadow: var(--shadow);
}
.place-panel input { min-height: 44px; }
.place-list { max-height: 220px; overflow-y: auto; overscroll-behavior: contain; margin: 0; padding: 0; list-style: none; }
.place-option { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 10px; border-radius: 0.6rem; cursor: pointer; overflow-wrap: anywhere; }
.place-option svg { width: 18px; height: 18px; color: hsl(var(--text-400)); }
.place-option:hover, .place-option.active { background: hsl(var(--text-000) / 6%); }
.place-option[aria-selected="true"] { font-weight: 600; color: hsl(var(--primary-strong)); }
.place-empty { padding: 10px; }
.person-toggle { padding: 2px; border: 0; border-radius: 0.75rem; background: transparent; }
.person-toggle .avatar { transition: filter 0.15s, opacity 0.15s, box-shadow 0.15s; }
.person-toggle[aria-pressed="false"] .avatar { filter: grayscale(1); opacity: 0.45; }
.person-toggle[aria-pressed="false"] .fine { opacity: 0.6; }
.person-toggle[aria-pressed="true"] .avatar { box-shadow: 0 0 0 2.5px hsl(var(--tint)); }

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 12px 0 14px;
  border-radius: 0.75rem;
  background: hsl(var(--bg-200));
  color: hsl(var(--text-200));
  cursor: pointer;
}
.switch span { flex: 1; }
.switch input {
  appearance: none;
  position: relative;
  flex: none;
  width: 46px;
  height: 28px;
  margin: 0;
  border-radius: 999px;
  background: hsl(var(--border) / 22%);
  cursor: pointer;
  transition: background-color 0.15s;
}
.switch input::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px hsl(0 0% 0% / 25%);
  transition: translate 0.15s;
}
.switch input:checked { background: hsl(var(--primary-strong)); }
.switch input:checked::before { translate: 18px 0; }

/* Native date and time inputs: 16px text (no zoom on iPhone), and allowed to shrink. */
.when-grid { display: grid; grid-template-columns: minmax(0, 1fr) 6.25rem; gap: 4px 6px; align-items: center; }
.when-grid .fine { grid-column: 1 / -1; padding-inline-start: 4px; }
.when-grid.all-day { grid-template-columns: minmax(0, 1fr); }
.when-grid.all-day .time { display: none; }
.when-grid input, .until input { min-width: 0; min-height: 48px; padding: 0 8px; font-size: 1rem; }

.field-label { display: flex; align-items: center; gap: 6px; margin-bottom: -6px; padding-inline-start: 4px; }
.field-label svg { width: 16px; height: 16px; }
.segmented { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; padding: 3px; border-radius: 0.75rem; background: hsl(var(--bg-200)); }
.segmented button {
  min-width: 0;
  min-height: 42px;
  padding: 0 2px;
  border: 0;
  border-radius: 0.6rem;
  background: transparent;
  color: hsl(var(--text-200));
  font-size: 0.8125rem;
  font-weight: 550;
}
.segmented button[aria-checked="true"] { background: hsl(var(--bg-000)); color: hsl(var(--text-000)); box-shadow: 0 1px 3px hsl(0 0% 0% / 14%); }
/* Weekly repeats: the weekdays as toggles, then a time for each chosen day. The start's
   own weekday is marked with a dot. */
.weekday-pick { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.weekday-pick button {
  position: relative;
  min-width: 0;
  min-height: 44px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 0.6rem;
  background: hsl(var(--bg-200));
  color: hsl(var(--text-200));
  font-size: 0.75rem;
  font-weight: 600;
  overflow: hidden;
}
.weekday-pick button[aria-pressed="true"] { border-color: hsl(var(--primary-strong)); background: hsl(var(--primary) / 45%); color: hsl(var(--text-000)); }
.weekday-pick button[data-start]::after { content: ""; position: absolute; left: 50%; bottom: 4px; width: 4px; height: 4px; translate: -50% 0; border-radius: 50%; background: currentColor; }
.day-times { display: grid; gap: 6px; }
.day-time { display: grid; grid-template-columns: minmax(0, 1fr) 6.25rem; align-items: center; gap: 6px; padding-inline-start: 4px; color: hsl(var(--text-200)); }
.day-time input { min-width: 0; min-height: 48px; padding: 0 8px; font-size: 1rem; }
.until { display: flex; align-items: center; gap: 6px; }
.until > svg { margin-inline-start: 4px; color: hsl(var(--text-400)); }
.until input { flex: 1; min-width: 0; }

textarea {
  width: 100%;
  min-height: 88px;
  padding: 12px 16px;
  border-radius: 0.75rem;
  border: 0.5px solid hsl(var(--border) / 25%);
  background: hsl(var(--bg-100));
  color: inherit;
  font: inherit;
  font-size: 1.0625rem;
  resize: vertical;
}
textarea:focus { outline: none; border-color: hsl(var(--primary-strong)); box-shadow: 0 0 0 3px hsl(var(--primary) / 50%); }
textarea::placeholder { color: hsl(var(--text-400)); }

/* Repeating events: this one, or all from here on (an action sheet, as on iPhone). */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px max(var(--gutter), env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  background: hsl(0 0% 0% / 35%);
  animation: fade 0.2s ease-out;
}
.action-sheet {
  display: grid;
  gap: 8px;
  width: 100%;
  max-width: 400px;
  padding: 12px;
  border-radius: var(--radius);
  background: hsl(var(--bg-000));
  box-shadow: var(--shadow);
  animation: rise-sheet 0.25s ease-out;
}
.action-sheet .btn:not(.ghost) { justify-content: flex-start; gap: 12px; background: hsl(var(--bg-200)); color: hsl(var(--text-000)); }
.scrim[data-tone="danger"] .btn:not(.ghost) { color: hsl(var(--danger)); }

/* Filters: with nobody chosen, everyone shows as normal (no filter); once someone is
   chosen, the others grey out. */
.filter-sheet { gap: 12px; padding: 16px; }
.filter-sheet .people { justify-content: flex-start; }
.filter-sheet .actions .btn:not(.ghost) { justify-content: center; }
#filter-people.none-chosen .person-toggle .avatar { filter: none; opacity: 1; box-shadow: none; }
#filter-people.none-chosen .person-toggle .fine { opacity: 1; }

/* A hashflag stands in for an emoji at the same size: 1em, set by the font size. */
.hashflag { display: inline-block; width: 1em; height: 1em; object-fit: contain; vertical-align: -0.15em; }

/* The picture keyboard: a sheet from the bottom, full width on phones. */
.scrim.kb-scrim { padding: 0; }
.keyboard {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  height: min(80dvh, 640px);
  padding: 10px max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  border-radius: var(--radius) var(--radius) 0 0;
  background: hsl(var(--bg-000));
  box-shadow: var(--shadow);
  animation: rise-sheet 0.25s ease-out;
}
.kb-top { display: flex; align-items: center; gap: 4px; }
.kb-search { position: relative; flex: 1; }
.kb-search svg { position: absolute; inset-inline-start: 12px; top: 50%; translate: 0 -50%; width: 20px; height: 20px; color: hsl(var(--text-400)); pointer-events: none; }
.kb-search input { min-height: 44px; padding-inline-start: 40px; }
.kb-tabs { display: flex; gap: 2px; margin: 8px 0 4px; overflow-x: auto; scrollbar-width: none; }
.kb-tabs::-webkit-scrollbar { display: none; }
.kb-tabs button {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 0.75rem;
  background: transparent;
  color: hsl(var(--text-200));
  font-size: 22px;
  line-height: 1;
  opacity: 0.55;
}
.kb-tabs button[aria-selected="true"] { background: hsl(var(--primary) / 40%); opacity: 1; }
.kb-body { position: relative; flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.kb-body h2 { margin: 10px 4px 4px; font-size: 0.75rem; font-weight: 600; color: hsl(var(--text-400)); }
.kb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
.kb-key {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 0.75rem;
  background: transparent;
  font-size: 30px;
  line-height: 1;
}
.kb-key:hover { background: hsl(var(--text-000) / 6%); }
.kb-key:active { scale: 0.9; }
.kb-end { height: 1px; }
.kb-empty { display: grid; place-items: center; margin: 32px 0; color: hsl(var(--text-400)); }
.kb-empty svg { width: 40px; height: 40px; }
.kb-tones { display: flex; justify-content: center; gap: 2px; padding-top: 6px; border-top: 0.5px solid hsl(var(--border) / 12%); }
.kb-tones button { width: 44px; height: 44px; padding: 0; border: 2px solid transparent; border-radius: 50%; background: transparent; font-size: 24px; line-height: 1; }
.kb-tones button[aria-checked="true"] { border-color: hsl(var(--primary-strong)); background: hsl(var(--primary) / 30%); }

/* A count on a button: the payment reminders that need doing. Red once one is late. */
.count-badge {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  border: 2px solid hsl(var(--bg-100));
  background: hsl(var(--primary-strong));
  color: hsl(var(--bg-000));
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.count-badge[data-tone="danger"] { background: hsl(var(--danger)); color: hsl(var(--on-color)); }
.icon-btn.round .count-badge { top: -2px; right: -2px; }

/* Payments: what's overdue, what's next and what's paid, one card per due date. */
.payments { max-width: 560px; align-items: stretch; gap: 10px; }
#pay-back svg + svg { width: 22px; height: 22px; }
#pay-bell[data-state="on"] { color: hsl(var(--primary-strong)); }
#pay-bell:is([data-state="blocked"], [data-state="install"], [data-state="insecure"], [data-state="unsupported"]) { color: hsl(var(--text-400)); }
.pay-group { display: grid; gap: 8px; }
.group-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  margin: 6px 0 0;
  padding-inline-start: 4px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: hsl(var(--text-400));
}
.group-head svg { width: 16px; height: 16px; }
.group-head.danger { color: hsl(var(--danger)); }
summary.group-head { min-height: 44px; border-radius: 0.75rem; cursor: pointer; list-style: none; }
summary.group-head::-webkit-details-marker { display: none; }
summary.group-head:hover { background: hsl(var(--text-000) / 4%); }
summary .count { font-variant-numeric: tabular-nums; }
summary .count::before { content: "· "; }
summary .chevron { margin-inline-start: auto; margin-inline-end: 8px; transition: rotate 0.15s; }
details[open] > summary .chevron { rotate: 90deg; }

.bill-row .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; font-variant-numeric: tabular-nums; }
.bill-row .meta .amount { font-weight: 650; color: hsl(var(--text-200)); }
.bill-row .meta .avatar.xs { margin-inline-start: 2px; }
.bill-row[data-status="overdue"] { border-color: hsl(var(--danger) / 55%); background: hsl(var(--danger) / 6%); }
.bill-row[data-status="overdue"] .meta { color: hsl(var(--danger)); font-weight: 600; }
.bill-row[data-status="today"] .meta { color: hsl(var(--primary-strong)); font-weight: 650; }
.bill-row:is([data-status="paid"], [data-status="taken"]) { background: hsl(var(--bg-200) / 60%); }
.bill-row:is([data-status="paid"], [data-status="taken"]) .name { color: hsl(var(--text-200)); }
.pay-link { color: hsl(var(--primary-strong)); }
.pay-link svg { width: 22px; height: 22px; }
/* The tick: an empty ring, filled green once paid. */
.tick svg {
  width: 32px;
  height: 32px;
  padding: 5px;
  border-radius: 50%;
  border: 2px solid hsl(var(--border) / 30%);
  color: transparent;
  stroke-width: 3;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.tick:hover svg { color: hsl(var(--text-400)); }
.bill-row[data-status="overdue"] .tick svg { border-color: hsl(var(--danger) / 70%); }
.tick[aria-pressed="true"] svg { background: hsl(var(--success)); border-color: hsl(var(--success)); color: hsl(var(--on-color)); }
.auto-mark { display: grid; place-items: center; flex: none; width: 44px; height: 44px; color: hsl(var(--primary-strong)); }
.auto-mark svg { width: 22px; height: 22px; }

/* Bills on the calendar: grey (--bill) like a category, a wallet where the time goes, a tick once
   paid, and red once late. */
.event-row[data-bill] .when .allday { color: hsl(var(--tint)); }
.event-row[data-bill="paid"] { background: hsl(var(--tint) / 9%); }
.event-row[data-bill="paid"] .repeats { color: hsl(var(--success)); stroke-width: 2.5; }
.event-row[data-bill="overdue"] { background: hsl(var(--danger) / 10%); }
.event-row[data-bill="overdue"]::before { background: hsl(var(--danger)); }
.event-row[data-bill="overdue"] .where, .event-row[data-bill="overdue"] .repeats { color: hsl(var(--danger)); font-weight: 600; }
.dot.late { background: hsl(var(--danger)); }
.bill-sheet-head { display: flex; align-items: center; gap: 10px; padding: 4px 4px 6px; }
.action-sheet a.btn { text-decoration: none; }
#bs-paid[data-paid="false"] svg { color: hsl(var(--success)); }

/* Adding or changing a bill */
.bill-form { gap: 12px; padding: 20px 16px; }
.money { display: grid; grid-template-columns: minmax(0, 1fr) 7.5rem; gap: 8px; }
.money input { font-variant-numeric: tabular-nums; appearance: textfield; -moz-appearance: textfield; }
.money input::-webkit-inner-spin-button, .money input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
select {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 0 12px;
  border-radius: 0.75rem;
  border: 0.5px solid hsl(var(--border) / 25%);
  background: hsl(var(--bg-100));
  color: inherit;
  font: inherit;
  font-size: 1.0625rem; /* 16px+ stops phones zooming in on focus */
}
select:focus { outline: none; border-color: hsl(var(--primary-strong)); box-shadow: 0 0 0 3px hsl(var(--primary) / 50%); }
#bill-due { min-width: 0; }
.segmented.four { grid-template-columns: repeat(4, 1fr); }
.segmented.two { grid-template-columns: repeat(2, 1fr); }
.segmented.two button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 0.9375rem; }
.segmented.two svg { width: 18px; height: 18px; }
.bill-actions { display: flex; }
.bill-actions .btn.primary { flex: 1; }
.bill-actions .btn.ghost { padding: 0 12px; }

/* Live signal graph (?debug) */
.debug { width: 100%; }
.debug canvas { display: block; width: 100%; height: auto; background: hsl(var(--bg-200)); border-radius: 8px; }
.debug p { margin: 4px 0 0; font: 12px/1.4 ui-monospace, Consolas, monospace; color: hsl(var(--text-400)); }

@keyframes spin { to { rotate: 360deg; } }
@keyframes breathe { 0%, 100% { scale: 1; opacity: 0.9; } 50% { scale: 1.06; opacity: 0.4; } }
@keyframes breathe-icon { 0%, 100% { scale: 1; } 50% { scale: 1.1; } }
@keyframes blink { 0%, 35%, 65%, 100% { scale: 1 1; } 45%, 55% { scale: 1 0.1; } }
@keyframes nudge-left { 0%, 100% { translate: 4px 0; } 50% { translate: -8px 0; } }
@keyframes nudge-right { 0%, 100% { translate: -4px 0; } 50% { translate: 8px 0; } }
@keyframes ring { 0%, 100% { box-shadow: 0 0 0 0 hsl(var(--primary-strong) / 40%); } 50% { box-shadow: 0 0 0 6px hsl(var(--primary-strong) / 0%); } }
@keyframes pop { from { scale: 0.6; opacity: 0; } to { scale: 1; opacity: 1; } }
@keyframes rise { from { translate: -50% 12px; opacity: 0; } to { translate: -50% 0; opacity: 1; } }
@keyframes shake { 0%, 100% { translate: 0; } 20%, 60% { translate: -8px 0; } 40%, 80% { translate: 8px 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise-sheet { from { translate: 0 24px; opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
