/* Family dashboard. Target: Android WebView 106 at 1280 x 800.
   No CSS nesting, no color-mix(), no oklch(), no :has(), no dvh. */

/* ---------------------------------------------------------------- fonts (self-hosted) */
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url(../fonts/archivo-var-latin.woff2) format('woff2');
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/instrument-serif-latin.woff2) format('woff2');
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/instrument-serif-italic-latin.woff2) format('woff2');
}

/* ---------------------------------------------------------------- tokens */
:root {
  --paper: #F2EEE6;
  --paper-2: #E8E2D5;
  --card: #FBF9F4;
  --ink: #111111;
  --ink-rgb: 17 17 17;
  --ink-2: #3B3934;
  --mute: #7A756B;
  --line: #D6CFC0;
  --alert: #E5261E;
  --wet: #1F6FEB;
  --tint: .13;
  --shadow: rgba(0, 0, 0, .25);

  /* person colour defaults (overridden inline per element) */
  --c: var(--ink);
  --c-rgb: var(--ink-rgb);
  --c-ink: var(--paper);

  --sans: 'Archivo', 'Roboto Condensed', 'Roboto', system-ui, sans-serif;
  --serif: 'Instrument Serif', 'Noto Serif', Georgia, serif;
  --fs-label: 15px;
  --fs-min: 14px;
  --r: 18px;
  --tap: 64px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}
:root[data-theme="dark"] {
  --paper: #121110;
  --paper-2: #26231F;
  --card: #1C1A18;
  --ink: #F2EEE6;
  --ink-rgb: 242 238 230;
  --ink-2: #CEC8BB;
  --mute: #958F83;
  --line: #38342E;
  --alert: #FF5A4F;
  --wet: #6CA8FF;
  --tint: .24;
  --shadow: rgba(0, 0, 0, .6);
}

/* ---------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0B0B0B; }
body {
  font-family: var(--sans);
  font-size: 20px;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: inherit; }
h1, h2, h3, p { margin: 0; font-weight: inherit; }
.i { flex: none; display: block; }
::-webkit-scrollbar { width: 0; height: 0; }

.num { font-stretch: 62%; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -.01em; }
.label {
  font-size: var(--fs-label);
  font-weight: 700;
  font-stretch: 80%;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--mute);
  line-height: 1.2;
  display: flex; align-items: center; gap: 6px;
}

/* ---------------------------------------------------------------- stage (1280 x 800, scaled to fit by app.js) */
.stage {
  position: absolute;
  left: 50%; top: 50%;
  width: 1280px; height: 800px;
  margin: -400px 0 0 -640px;
  transform-origin: 50% 50%;
  background: var(--paper);
  overflow: hidden;
  padding: 22px 24px 24px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: 174px minmax(0, 1fr);
  gap: 16px;
  transition: background-color .5s;
}

/* ---------------------------------------------------------------- header */
.top {
  grid-column: 1 / 13;
  display: grid;
  grid-template-columns: 368px 336px 1fr 72px;
  gap: 18px;
  border-bottom: 3px solid var(--ink);
  padding-bottom: 12px;
  min-height: 0;
}

.clock { display: flex; flex-direction: column; justify-content: flex-end; }
.clock-time { font-size: 150px; line-height: .78; letter-spacing: -.035em; display: flex; align-items: flex-start; }
.clock-ampm { font-size: 28px; font-weight: 800; letter-spacing: .06em; margin: 6px 0 0 10px; }
.clock-date { font-size: 26px; margin-top: 16px; font-family: var(--serif); line-height: 1; white-space: nowrap; }
.clock-date b { font-family: var(--sans); font-weight: 800; font-stretch: 75%; text-transform: uppercase; letter-spacing: .06em; font-size: 21px; margin-right: 6px; }

.wx { display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; }
.wx-top { display: flex; align-items: center; gap: 10px; }
.wx-temp { font-size: 88px; line-height: .8; letter-spacing: -.03em; }
.wx-meta { display: flex; flex-direction: column; gap: 3px; font-size: 17px; margin-left: 2px; min-width: 0; }
.wx-meta b { font-weight: 800; font-stretch: 80%; text-transform: uppercase; letter-spacing: .06em; font-size: 16px; }
.wx-meta span { color: var(--mute); font-variant-numeric: tabular-nums; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.wx-meta span .i { margin-right: -1px; }
.wx-meta span i { font-style: normal; margin-right: 8px; }
.wx-say { font-family: var(--serif); font-size: 23px; line-height: 1.12; margin-top: 12px; }
.wx-say i { font-style: italic; }
.wx-off { font-family: var(--serif); font-style: italic; font-size: 24px; color: var(--mute); }

.days { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; align-items: end; min-width: 0; }
.day {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 12px 0 12px; border-radius: 16px;
}
.day-l { font-size: var(--fs-min); font-weight: 800; font-stretch: 78%; letter-spacing: .09em; text-transform: uppercase; color: var(--mute); }
.day-i { height: 32px; display: grid; place-items: center; }
.day.is-wet .day-i { color: var(--wet); }
.day-t { display: flex; align-items: center; gap: 9px; }
.day-bar { position: relative; width: 6px; height: 46px; border-radius: 3px; background: rgb(var(--ink-rgb) / .12); }
.day-bar i { position: absolute; left: 0; right: 0; border-radius: 3px; background: var(--ink); min-height: 6px; }
.day-hl { display: flex; flex-direction: column; gap: 3px; line-height: 1; }
.day-hl b { font-size: 26px; }
.day-hl span { font-size: 19px; color: var(--mute); }
.day.is-today { background: var(--ink); color: var(--paper); }
.day.is-today .day-l, .day.is-today .day-hl span { color: inherit; opacity: .7; }
.day.is-today .day-i { color: inherit; }
.day.is-today .day-bar { background: rgb(255 255 255 / .22); }
:root[data-theme="dark"] .day.is-today .day-bar { background: rgb(0 0 0 / .18); }
.day.is-today .day-bar i { background: var(--paper); }

.tools { display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; }
.tool {
  height: 72px; border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  font-size: 12px; font-weight: 700; font-stretch: 70%; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-2); white-space: nowrap;
}
.tool:active { background: var(--paper-2); transform: scale(.94); }
.tool.is-busy .i { animation: spin .9s linear infinite; }
.tool.is-stale { color: var(--alert); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- calendar */
.cal { grid-column: 1 / 8; display: flex; flex-direction: column; min-height: 0; position: relative; }
.pane-head { display: flex; align-items: baseline; justify-content: space-between; flex: none; padding: 0 2px 8px; }
.pane-head h2 { font-size: 34px; line-height: 1; }
.pane-head h2 i { font-style: italic; }

.scroller {
  flex: 1; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-mask-image: linear-gradient(180deg, #000 0, #000 calc(100% - var(--fade, 0px)), transparent 100%);
  mask-image: linear-gradient(180deg, #000 0, #000 calc(100% - var(--fade, 0px)), transparent 100%);
}
.scroller.can-down { --fade: 56px; }
.scroller.is-dragging { cursor: grabbing; }
.scroller.is-dragging * { pointer-events: none; }

.more {
  position: absolute; left: 50%; bottom: 6px; z-index: 3;
  height: 40px; padding: 0 16px 0 12px; margin-left: -70px; min-width: 140px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 999px; background: var(--ink); color: var(--paper);
  font-size: var(--fs-min); font-weight: 800; font-stretch: 78%; letter-spacing: .08em; text-transform: uppercase;
  box-shadow: 0 10px 24px var(--shadow);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .25s, transform .25s var(--ease);
}
.cal.has-more .more { opacity: 1; transform: none; pointer-events: auto; }
.more:active { transform: scale(.94); }

/* next-up hero */
.hero {
  display: flex; align-items: stretch; gap: 20px; width: 100%;
  background: var(--c); color: var(--c-ink);
  border-radius: var(--r); padding: 18px 24px 20px;
  margin-bottom: 6px;
  overflow: hidden; position: relative;
  transition: transform .15s var(--ease);
}
.hero:active { transform: scale(.985); }
.hero-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.hero .label { color: inherit; opacity: .8; }
.hero-title {
  font-size: 50px; line-height: 1; margin: 8px 0 8px; padding-bottom: 2px;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.hero-meta { font-size: 18px; opacity: .88; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.hero-meta span { overflow: hidden; text-overflow: ellipsis; }
.hero-count { font-size: 112px; line-height: .8; letter-spacing: -.04em; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; flex: none; }
.hero-count small { font-size: 21px; letter-spacing: .1em; text-transform: uppercase; font-stretch: 80%; margin-top: 10px; }
.hero-count--text { font-size: 44px; line-height: .9; text-transform: uppercase; letter-spacing: 0; text-align: right; }

/* day groups */
.dg { padding-bottom: 10px; }
.dg-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: baseline; gap: 10px;
  padding: 12px 2px 7px; margin-bottom: 8px;
  background: var(--paper);
  border-bottom: 3px solid var(--ink);
  transition: background-color .5s;
}
.dg-head h3 { font-size: 32px; line-height: 1; }
.dg-head b { font-size: 16px; font-weight: 800; font-stretch: 80%; text-transform: uppercase; letter-spacing: .07em; }
.dg-head small { margin-left: auto; font-size: var(--fs-min); color: var(--mute); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-stretch: 85%; }

.ev {
  width: 100%; min-height: 68px;
  display: flex; align-items: center; gap: 14px;
  padding: 9px 14px 9px 0; margin-bottom: 6px;
  border-radius: 14px;
  background: rgb(var(--c-rgb) / var(--tint));
  position: relative; overflow: hidden;
  transition: transform .15s var(--ease), opacity .3s;
}
.ev--plain { background: rgb(var(--ink-rgb) / .055); }
.ev::before { content: ''; align-self: stretch; width: 6px; margin: -9px 0; background: var(--c); flex: none; }
.ev--plain::before { background: rgb(var(--ink-rgb) / .3); }
.ev:active { transform: scale(.985); }
.ev-t { width: 86px; flex: none; font-size: 19px; font-weight: 800; font-stretch: 68%; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.ev-b { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ev-n { font-size: 20px; font-weight: 650; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-l { font-size: 15px; color: var(--mute); display: flex; align-items: center; gap: 4px; min-width: 0; }
.ev-l span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev--allday { background: var(--c); color: var(--c-ink); }
.ev--allday.ev--plain { background: var(--ink); color: var(--paper); }
.ev--allday::before { display: none; }
.ev--allday { padding-left: 20px; }
.ev--allday .ev-t { color: inherit; opacity: .8; text-transform: uppercase; letter-spacing: .06em; font-size: 16px; font-stretch: 78%; width: 80px; }
.ev--allday .ev-l { color: inherit; opacity: .8; }

.avatars { display: inline-flex; flex: none; }
.avatar {
  flex: none; width: 34px; height: 34px;
  display: inline-grid; place-items: center;
  border-radius: 50%;
  background: var(--c); color: var(--c-ink);
  font-size: 17px; font-weight: 900; font-stretch: 70%; line-height: 1;
  box-shadow: 0 0 0 2px var(--paper);
}
.avatar + .avatar { margin-left: -8px; }
.ev--allday .avatar, .hero .avatar { background: var(--c-ink); color: var(--c); box-shadow: none; }
.hero .avatars { margin-left: 4px; }

.empty { font-family: var(--serif); font-size: 30px; line-height: 1.1; color: var(--mute); padding: 18px 2px; }
.empty i { font-style: italic; color: var(--ink); }
.empty small { display: block; font-family: var(--sans); font-size: 16px; margin-top: 8px; }
.cal-end { text-align: center; font-family: var(--serif); font-style: italic; font-size: 20px; color: var(--mute); padding: 6px 0 28px; }

/* ---------------------------------------------------------------- side column */
.side { grid-column: 8 / 13; display: grid; grid-template-rows: minmax(190px, 1fr) auto; gap: 16px; min-height: 0; }

/* photos: placeholder until the shared-album slideshow lands (see Photos in app.js) */
.photo { position: relative; border-radius: var(--r); overflow: hidden; background: var(--paper-2); min-height: 0; }
.photo-stage { position: absolute; top: 0; right: 0; bottom: 0; left: 0; }
.photo-stage img {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 30%;
  opacity: 0; transition: opacity 1.2s;
}
.photo-stage img.is-on { opacity: 1; }
.photo-empty {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  text-align: center; color: var(--mute);
  background:
    radial-gradient(circle at 78% 18%, rgb(255 196 92 / .5), rgb(255 196 92 / 0) 46%),
    radial-gradient(circle at 12% 92%, rgb(228 0 124 / .16), rgb(228 0 124 / 0) 52%),
    var(--paper-2);
}
:root[data-theme="dark"] .photo-empty {
  background:
    radial-gradient(circle at 78% 18%, rgb(255 196 92 / .2), rgb(255 196 92 / 0) 46%),
    radial-gradient(circle at 12% 92%, rgb(228 0 124 / .14), rgb(228 0 124 / 0) 52%),
    var(--paper-2);
}
.photo-frame {
  width: 84px; height: 84px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--card); color: var(--ink);
  box-shadow: 0 10px 26px rgb(0 0 0 / .1);
}
.photo-empty p { font-family: var(--serif); font-size: 34px; line-height: 1; color: var(--ink); margin-top: 6px; }
.photo-empty p i { font-style: italic; }
.photo.has-photos .photo-empty { display: none; }
.photo-cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 44px 18px 14px;
  background: linear-gradient(0deg, rgba(0, 0, 0, .6), rgba(0, 0, 0, 0));
  color: #fff; font-family: var(--serif); font-style: italic; font-size: 22px;
  display: none;
}
.photo.has-caption .photo-cap { display: block; }

/* to-dos */
.todos { background: var(--card); border-radius: var(--r); padding: 16px 12px 10px; display: flex; flex-direction: column; min-height: 0; max-height: 322px; transition: background-color .5s; position: relative; }
.todos .pane-head { padding: 0 8px 6px; }
.todos .pane-head h2 { font-size: 30px; }
.todos .scroller { flex: 0 1 auto; }
.td {
  width: 100%; min-height: 66px;
  display: flex; align-items: center; gap: 14px;
  padding: 8px 10px 8px 8px; border-radius: 14px;
  position: relative;
  transition: background-color .2s, opacity .4s, max-height .4s var(--ease), min-height .4s var(--ease), padding .4s var(--ease);
  max-height: 140px; overflow: hidden;
}
.td:active { background: var(--paper-2); }
.td + .td::after { content: ''; position: absolute; left: 66px; right: 10px; top: 0; border-top: 1px solid var(--line); }
.td-box {
  width: 44px; height: 44px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 3px var(--ink);
  transition: background-color .2s, transform .35s var(--spring);
}
.td-box svg { fill: none; stroke: var(--paper); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset .3s .08s; }
.td-b { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.td-n { font-size: 20px; font-weight: 650; line-height: 1.2; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.td-d { font-size: 15px; font-weight: 600; color: var(--mute); display: flex; align-items: center; gap: 5px; }
.td-pri { flex: none; height: 28px; padding: 0 10px; border-radius: 999px; background: var(--alert); color: #fff; font-size: 13px; font-weight: 800; font-stretch: 78%; letter-spacing: .08em; text-transform: uppercase; display: inline-flex; align-items: center; }
.td.is-done .td-box { background: var(--ink); transform: scale(1.08); }
.td.is-done .td-box svg { stroke-dashoffset: 0; }
.td.is-done .td-n { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--mute); }
.td.is-gone { opacity: 0; max-height: 0; min-height: 0; padding-top: 0; padding-bottom: 0; }
.todos .empty { padding: 6px 8px 12px; font-size: 28px; }

/* ---------------------------------------------------------------- buttons */
.btn {
  min-height: var(--tap); padding: 0 28px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border-radius: 999px; border: 2px solid var(--ink);
  font-size: 18px; font-weight: 800; font-stretch: 75%; letter-spacing: .06em; text-transform: uppercase;
  white-space: nowrap;
  transition: transform .15s var(--ease);
}
.btn:active { transform: scale(.96); }
.btn--solid { background: var(--ink); color: var(--paper); }
.btn--danger { border-color: var(--alert); color: var(--alert); }
.btn--danger.btn--solid { background: var(--alert); color: #fff; }

/* ---------------------------------------------------------------- sheet */
.sheet-layer { position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 50; pointer-events: none; }
.sheet-layer.is-open { pointer-events: auto; }
.sheet-scrim { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(10, 10, 10, .5); opacity: 0; transition: opacity .25s; }
.sheet-layer.is-open .sheet-scrim { opacity: 1; }
.sheet {
  position: absolute; left: 50%; top: 50%;
  width: 640px; max-height: 720px; overflow: hidden;
  background: var(--paper); border-radius: 28px;
  border-top: 12px solid var(--c);
  transform: translate(-50%, -44%) scale(.97); opacity: 0;
  box-shadow: 0 30px 80px var(--shadow);
  transition: transform .3s var(--ease), opacity .2s;
}
:root[data-theme="dark"] .sheet { background: var(--card); }
.sheet-layer.is-open .sheet { transform: translate(-50%, -50%); opacity: 1; }
.sheet-x {
  position: absolute; right: 14px; top: 14px; z-index: 2;
  width: var(--tap); height: var(--tap); border-radius: 50%;
  display: grid; place-items: center; background: rgb(var(--ink-rgb) / .08);
}
.sheet-x:active { background: rgb(var(--ink-rgb) / .18); }
.sheet-pad { padding: 30px 36px 32px; }
.sheet-pad > .label { padding-right: 70px; }
.sheet-h { font-size: 52px; line-height: 1; margin: 10px 0 18px; padding-right: 40px; overflow-wrap: anywhere; }
.sheet-row { display: flex; align-items: flex-start; gap: 12px; font-size: 20px; line-height: 1.3; color: var(--ink-2); margin-top: 12px; }
.sheet-row .i { margin-top: 1px; color: var(--mute); }
.sheet-who { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.chip {
  min-height: 48px; padding: 0 18px 0 7px;
  display: inline-flex; align-items: center; gap: 10px;
  border-radius: 999px; background: rgb(var(--c-rgb) / var(--tint));
  font-size: 18px; font-weight: 700;
}
.chip .avatar { box-shadow: none; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 30px; }
.sheet-confirm { display: none; }
.sheet.is-confirm .sheet-view { display: none; }
.sheet.is-confirm .sheet-confirm { display: block; }
.sheet-q { font-size: 44px; line-height: 1.02; margin: 10px 0 14px; padding-right: 60px; }
.sheet-q i { font-style: italic; }
.sheet-p { font-size: 20px; line-height: 1.3; color: var(--ink-2); }

/* ---------------------------------------------------------------- toasts */
.toasts { position: absolute; left: 0; right: 0; bottom: 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; z-index: 60; }
.toast {
  min-height: 68px; max-width: 760px; padding: 16px 28px 16px 22px;
  display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: var(--paper); border-radius: 20px;
  font-size: 20px; font-weight: 600;
  box-shadow: 0 18px 40px var(--shadow);
  transform: translateY(160%); opacity: 0;
  transition: transform .4s var(--ease), opacity .3s;
}
.toast.is-in { transform: none; opacity: 1; }
.toast--error { background: var(--alert); color: #fff; }
