/* Everywhile app styles. Every color, size and radius comes from tokens.css (--ew-*); see build-spec/README.md.
   Instrument Sans ships here at 400 and 700 only (the container that built Beta 1 couldn't download 500/600);
   600 renders as 700 until those files are added. */

@font-face { font-family: "Instrument Sans"; src: url("/fonts/InstrumentSans-Regular.ttf") format("truetype"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/fonts/InstrumentSans-Bold.ttf") format("truetype"); font-weight: 600 700; font-display: swap; }

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 400 var(--ew-t-body)/1.3 var(--ew-font);
  color: var(--ew-ink);
  background: var(--ew-ground) var(--ew-texture);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: manipulation; /* no double-tap zoom */
}
button { font: inherit; color: inherit; }
.tnum { font-variant-numeric: tabular-nums; }
.caps { font-size: var(--ew-t-caps); font-weight: 600; text-transform: uppercase; letter-spacing: var(--ew-caps-tracking); color: var(--ew-ink-2); }
:focus-visible { outline: 2px solid var(--ew-accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- app frame ---------- */
#app { position: fixed; inset: 0; display: flex; flex-direction: column; padding-top: calc(env(safe-area-inset-top) + var(--ew-top-clear)); background: var(--ew-ground) var(--ew-texture); }
/* iOS draws a soft fade under the status bar; the top bar starts below it. */
:root { --ew-top-clear: 6px; }
.boot { margin: auto; color: var(--ew-ink-2); }

/* ---------- top bar ---------- */
.topbar { flex: none; display: flex; align-items: center; gap: 10px; padding: 6px var(--ew-gutter) 10px; min-height: 52px; }
.avatar {
  position: relative; flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: var(--c); color: var(--ew-on-accent); font-weight: 700; font-size: 15px; display: grid; place-items: center;
}
.avatar.sm { width: 26px; height: 26px; font-size: 12px; cursor: default; }
.avatar.preview::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px dashed var(--ew-ink-2); }
.titleblock { flex: 1; min-width: 0; }
.title { font-size: var(--ew-t-title); line-height: 1.05; font-weight: 600; letter-spacing: var(--ew-title-tracking); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subtitle { margin-top: 3px; }
.views-btn {
  flex: none; height: 34px; min-width: 44px; padding: 0 12px; border-radius: 17px; background: var(--ew-raised); border: 1px solid var(--ew-edge);
  display: grid; place-items: center; cursor: pointer;
}
.views-btn svg { width: 18px; height: 18px; }
/* something is hidden by the Show filters: a dot, so a hidden layer is never forgotten */
.views-btn { position: relative; }
.views-btn.filtered::after { content: ""; position: absolute; top: 3px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--ew-state-ask); box-shadow: 0 0 0 1.5px var(--ew-raised); }
.no-custody .custody, .no-custody .custody-hit, .no-custody .mcustody { display: none; }
.refade { animation: refade var(--ew-dur-glide) var(--ew-ease); }
@keyframes refade { from { opacity: .4; } }
/* test site only: says TEST beside the views button */
.test-chip {
  flex: none; padding: 3px 7px; border-radius: var(--ew-r-chip); background: var(--ew-state-ask-fill); color: var(--ew-on-accent);
  font-size: var(--ew-t-caps); font-weight: 700; letter-spacing: var(--ew-caps-tracking); line-height: 1.2;
}
.preview-banner {
  flex: none; margin: 0 var(--ew-gutter) 8px; padding: 7px 10px; border-radius: var(--ew-r-card); background: var(--ew-surface);
  display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600;
}
.preview-banner svg { width: 16px; height: 16px; flex: none; }
.preview-banner button { margin-left: auto; border: 0; background: none; color: var(--ew-accent); font-weight: 700; cursor: pointer; padding: 4px; }

/* ---------- main split ---------- */
.main { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }

/* ---------- timeline ---------- */
.timeline { flex: none; position: relative; background: var(--ew-timeline); display: flex; flex-direction: column; overflow: hidden; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.tl-head { flex: none; display: flex; height: 38px; }
.tl-corner { flex: none; width: var(--ew-lane-label-w); }
.tl-days { position: relative; flex: 1; overflow: hidden; }
.tl-day { position: absolute; top: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 3px; }
.tl-day .wd { font-size: var(--ew-t-day); font-weight: 600; letter-spacing: var(--ew-caps-tracking); color: var(--ew-ink-2); text-transform: uppercase; }
.tl-day .dn { font-size: 14px; font-weight: 600; line-height: 22px; width: 22px; height: 22px; text-align: center; border-radius: 50%; font-variant-numeric: tabular-nums; }
.tl-day.today { background: color-mix(in srgb, var(--ew-today) 10%, transparent); } /* tint and orange type, no strokes (note 113) */
.tl-day.today .wd { color: var(--ew-today); }
.tl-day.today .dn { background: var(--ew-today); color: var(--ew-on-accent); font-size: 13px; }
.tl-day.compact { flex-direction: row; align-items: flex-end; justify-content: flex-start; padding: 0 0 6px 3px; }
.tl-day.compact .dn { font-size: 11px; width: auto; height: auto; line-height: 1; border-radius: 0; color: var(--ew-ink-2); }
.tl-day.compact.today { background: none; box-shadow: none; }
.tl-day.compact.today .dn { background: none; color: var(--ew-today); font-weight: 800; }
.tl-slide { position: absolute; inset: 0; will-change: transform; }
.tl-month.pin { z-index: 1; background: linear-gradient(90deg, var(--ew-timeline) 80%, transparent); padding-right: 10px; }
.tl-month { position: absolute; top: 4px; font-size: var(--ew-t-caps); font-weight: 700; letter-spacing: var(--ew-caps-tracking); text-transform: uppercase; color: var(--ew-ink); white-space: nowrap; padding-left: 3px; }
.tl-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; position: relative; scrollbar-width: none; }
.tl-body::-webkit-scrollbar { display: none; }
.tl-grid { position: absolute; top: 0; bottom: 0; left: var(--ew-lane-label-w); right: 0; pointer-events: none; overflow: hidden; z-index: 1; } /* over lane backgrounds (yours too), under events */
.tl-grid .gl { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--ew-line); opacity: .7; }
.tl-grid .gl.wk { opacity: 1; }
.tl-grid .wkend { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--ew-ink) 2.5%, transparent); }
.tl-day.wkend:not(.today) { background: color-mix(in srgb, var(--ew-ink) 7%, transparent); }
.tl-grid .todaycol { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--ew-today) 5%, transparent); }
/* the event being made or changed (VizD "New", note 59): its own blue fill and a 2px blue outer ring that pulses to
   4px and back; above other events; oblong handles at its ends, a little taller than the bar, with big touch targets */
.ev-new { position: absolute; z-index: 3; display: flex; align-items: center; gap: 5px; padding: 0 12px; box-sizing: border-box; border-radius: 6px;
  background: color-mix(in srgb, var(--ew-state-new) 18%, var(--ew-surface)); box-shadow: 0 0 0 2px var(--ew-state-new); animation: new-pulse 1.5s ease-in-out infinite;
  font: 700 11px/1.1 var(--ew-font); color: var(--ew-state-new); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.ev-new.stepping { transition: left 140ms var(--ew-ease), width 140ms var(--ew-ease); } /* all-day handle steps glide (note 69) */
.ev-new.held { cursor: grabbing; }
.ev-new .lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-new .bd-new { flex: none; padding: 2px 5px; border-radius: var(--ew-r-chip); background: var(--ew-state-new); color: var(--ew-on-accent); font-size: 9px; letter-spacing: .04em; text-transform: uppercase; }
.ev-new.narrow .bd-new { display: none; }
.ev-new.edit .bd-new { display: none; } /* an event being changed isn't new */
.ev.editing, .bars .bar.editing { visibility: hidden; } /* its blue bar stands in for it (note 99) */
/* too short for its name (a short timed event): the name sits beside it, past the handle (note 66) */
.ev-new.narrow .lbl { position: absolute; left: calc(100% + 14px); top: 50%; transform: translateY(-50%); flex: none; max-width: 160px; padding: 3px 7px;
  border-radius: var(--ew-r-chip); background: color-mix(in srgb, var(--ew-state-new) 18%, var(--ew-surface)); box-shadow: 0 0 0 1.5px var(--ew-state-new); }
.ev-new .ev-hd { position: absolute; top: 50%; width: 8px; height: calc(100% + 10px); min-height: 26px; transform: translate(-50%, -50%); border-radius: 4px;
  background: var(--ew-raised); box-shadow: 0 0 0 2px var(--ew-state-new), var(--ew-shadow-card); cursor: ew-resize; }
.ev-new .ev-hd.start { left: 0; }
.ev-new .ev-hd.end { left: 100%; }
.ev-new .ev-hd::after { content: ""; position: absolute; inset: -12px -16px; } /* the touch target */
@keyframes new-pulse { 0%, 100% { box-shadow: 0 0 0 2px var(--ew-state-new); } 50% { box-shadow: 0 0 0 4px var(--ew-state-new); } }
.bars .bar.newing { --c: var(--ew-state-new); z-index: 3; border-left: 0; color: var(--ew-state-new); pointer-events: none;
  background: color-mix(in srgb, var(--ew-state-new) 18%, var(--ew-surface)); box-shadow: 0 0 0 2px var(--ew-state-new); animation: new-pulse 1.5s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .ev-new, .bars .bar.newing { animation: none; } }
/* hour lines from the Day zoom in: faint graph paper, labeled where there's room (Oct 28) */
.tl-grid .hr { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--ew-hour-line); }
.tl-grid .hr.named { background: var(--ew-hour-line-strong); }
.tl-hours { position: absolute; top: 0; bottom: 0; left: var(--ew-lane-label-w); right: 0; pointer-events: none; overflow: hidden; z-index: 3; } /* hour names over the events (note 104) */
.tl-hours .hr-t, .tl-hours .hr-b { position: absolute; transform: translateX(-50%); padding: 1px 3px; border-radius: var(--ew-r-chip); background: color-mix(in srgb, var(--ew-ground) 85%, transparent); font: 600 var(--ew-t-hour)/1 var(--ew-font); font-variant-numeric: tabular-nums; color: var(--ew-ink-2); white-space: nowrap; }
.tl-hours .hr-t { top: 2px; }
.tl-hours .hr-b { bottom: 2px; }
.tl-dl { display: flex; flex-direction: column; align-items: center; }
.tl-grid .nowline { position: absolute; top: 0; bottom: 0; width: 1.5px; background: var(--ew-today); opacity: .45; } /* toned down (note 113) */
.lane { position: relative; display: flex; height: var(--ew-lane-h); margin-bottom: var(--ew-lane-gap); transition: height var(--ew-dur-glide) var(--ew-ease); }
.lane.mine { background: var(--ew-mine-lane); }
.lane-label { flex: none; width: var(--ew-lane-label-w); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; position: relative; z-index: 2; }
.lane-name { font-size: var(--ew-t-day); font-weight: 600; color: var(--ew-ink-2); max-width: calc(var(--ew-lane-label-w) - 4px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lane.short .lane-name { display: none; }
.lane-more { position: absolute; right: 4px; bottom: 6px; z-index: 1; font-size: var(--ew-t-day); font-weight: 700; color: var(--ew-ink-2); background: var(--ew-timeline); border-radius: var(--ew-r-event); padding: 0 4px; pointer-events: none; }
.lane-track { position: relative; flex: 1; overflow: hidden; z-index: 2; }
.ev {
  position: absolute; height: var(--ew-event-h); border-radius: var(--ew-r-event); padding: 0 5px; display: flex; align-items: center; gap: 4px;
  background: color-mix(in srgb, var(--c) var(--ew-event-fill-mix), var(--ew-surface));
  color: color-mix(in srgb, var(--c) var(--ew-event-ink-mix), var(--ew-ink));
  font-size: var(--ew-t-event); font-weight: 600; line-height: 1.05; overflow: hidden; cursor: pointer; border: 0; text-align: left;
}
.ev .lbl { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: normal; /* words are never split mid-word */ }
.ev { transition: top var(--ew-dur-glide) var(--ew-ease), height var(--ew-dur-glide) var(--ew-ease), opacity var(--ew-dur-glide) var(--ew-ease); animation: ev-in var(--ew-dur-glide) var(--ew-ease); }
@keyframes ev-in { from { opacity: 0; } }
.ev.off { opacity: 0; pointer-events: none; }
.ev.slim { padding: 0; }
.ev.slim.point::before { width: 6px; height: 6px; }
.ev.tall .lbl { white-space: normal; }
.ev:not(.tall) .lbl { -webkit-line-clamp: 1; white-space: nowrap; text-overflow: ellipsis; display: block; }
.ev.point { background: none; padding-left: 0; }
.ev.stub { background: none; box-shadow: none; padding-left: calc(var(--bw) + 5px); }
.ev.stub::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--bw); border-radius: var(--ew-r-event); background: color-mix(in srgb, var(--c) var(--ew-event-fill-mix), var(--ew-surface)); }
.ev.stub.busy::before { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 22%, var(--ew-surface)) 0 5px, color-mix(in srgb, var(--c) 10%, var(--ew-surface)) 5px 10px); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 35%, transparent); }
.ev.point::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.ev.busy {
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 22%, var(--ew-surface)) 0 5px, color-mix(in srgb, var(--c) 10%, var(--ew-surface)) 5px 10px);
  color: color-mix(in srgb, var(--c) 60%, var(--ew-ink)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 35%, transparent);
}
.ev.school { --c: var(--ew-ink-2); background: color-mix(in srgb, var(--ew-ink) 9%, var(--ew-surface)); color: var(--ew-ink-2); }
.ev.est { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 45%, transparent); background-image: none; }
.ev.stub.busy, .ev.point.busy { background: none; box-shadow: none; }
.ev.est.busy { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 22%, var(--ew-surface)) 0 5px, color-mix(in srgb, var(--c) 10%, var(--ew-surface)) 5px 10px); }
.past { opacity: .5; filter: saturate(.4); }
/* a past bar stays opaque, faded by a wash of the timeline's own color, so lines behind it (today's outline) don't
   show through it (note 74) */
.ev.past:not(.point):not(.stub) { opacity: 1; }
.ev.past:not(.point):not(.stub)::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--ew-timeline); opacity: .5; pointer-events: none; }
.custody { position: absolute; left: 0; right: 0; top: 6px; height: var(--ew-custody-line); pointer-events: none; }
.custody .seg { position: absolute; top: 0; height: 100%; border-radius: 3px; background: var(--c); }
.custody .seg.other { opacity: .3; }
.custody .diamond {
  position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; transform: rotate(45deg);
  background: var(--ew-timeline); border: 2px solid var(--ew-ink); border-radius: 1.5px;
}
.custody .badge-draft { position: absolute; top: 50%; transform: translateY(-50%); }
/* nights in a stretch, on the custody line in the stretch's color (timeline and month alike) */
.nights {
  position: absolute; top: 50%; height: 16px; margin-top: -8px; min-width: 16px; padding: 0 4px; box-sizing: border-box; border-radius: 8px;
  background: var(--c); color: var(--ew-on-accent); font-size: var(--ew-t-day); font-weight: 700; line-height: 16px; text-align: center;
  font-variant-numeric: tabular-nums; box-shadow: 0 0 0 1.5px var(--ew-timeline); white-space: nowrap;
}
.mline .nights { height: 13px; margin-top: -6.5px; min-width: 13px; padding: 0 3px; border-radius: 6.5px; font-size: var(--ew-t-badge); line-height: 13px; box-shadow: 0 0 0 1.5px var(--ew-ground); }
.mline .nights.before { transform: translateX(-100%); }
.mline .nights { transition: opacity .3s ease-out; }
.scrolling .mline .nights { opacity: 0; transition-duration: .22s; }
.custody-hit { position: absolute; left: 0; right: 0; top: 0; height: 22px; cursor: pointer; }
/* the subject of an open sheet stays in sight, highlighted (note 68) */
.custody-focus { position: absolute; top: 1px; height: 16px; border-radius: 9px; pointer-events: none; z-index: 2;
  box-shadow: 0 0 0 2px var(--ew-ink), 0 0 0 5px color-mix(in srgb, var(--ew-ink) 14%, transparent); }
.ev.echo, .custody-focus.echo { animation: ew-echo var(--ew-dur-glide) var(--ew-ease); }
.ev.echo { box-shadow: 0 0 0 2px var(--ew-ink), 0 0 0 5px color-mix(in srgb, var(--ew-ink) 14%, transparent); z-index: 3; }
@keyframes ew-echo { 35% { scale: 1.14; } }
.ev.focused { box-shadow: 0 0 0 2px var(--ew-ink), 0 0 0 5px color-mix(in srgb, var(--ew-ink) 14%, transparent); z-index: 2; }
/* A dot or a sliver with its name beside it: the outline stays on the event's own time and the name turns black, so
   the outline never claims more time than the event has (note 115) */
.ev.stub.focused, .ev.point.focused { box-shadow: none; color: var(--ew-ink); }
.ev.stub.focused::before { box-shadow: inset 0 0 0 2px var(--ew-ink); } /* inside: the event box clips anything outside */
.ev.point.focused::before { width: 10px; height: 10px; box-shadow: inset 0 0 0 2px var(--ew-ink); } /* ringed inside: the event box clips outside */
.bars .bar.focused { box-shadow: 0 0 0 2px var(--ew-ink); z-index: 3; }
.calendar .cell.focused { background: color-mix(in srgb, var(--ew-ink) 9%, transparent); }
.lane-empty { position: absolute; inset: 0; display: flex; align-items: center; padding-left: 8px; font-size: 12px; color: var(--ew-ink-2); pointer-events: none; }

/* ---------- status badge ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 3px; height: 15px; padding: 0 6px 0 4px; border-radius: 8px;
  font-size: var(--ew-t-badge); line-height: 1; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #fff; white-space: nowrap;
}
.badge svg { width: 10px; height: 10px; }
.badge.draft { background: var(--ew-state-draft); }

/* ---------- zoom strip ---------- */
.zoom { flex: none; height: 30px; display: flex; align-items: center; padding: 0 22px 0 calc(var(--ew-lane-label-w) + 10px); position: relative; }
.zoom-track { position: relative; flex: 1; height: 26px; touch-action: none; cursor: pointer; }
.zoom-track .rail { position: absolute; left: 0; right: 0; top: 50%; height: 3px; margin-top: -1.5px; border-radius: 2px; background: color-mix(in srgb, var(--ew-ink) 18%, transparent); }
.zoom-track .tick { position: absolute; top: 50%; width: 1.5px; height: 7px; margin: -3.5px 0 0 -.75px; background: color-mix(in srgb, var(--ew-ink) 40%, transparent); }
.zoom-track .tlabel {
  position: absolute; bottom: 100%; transform: translateX(-50%); font-size: 10px; font-weight: 700; color: var(--ew-ink-2);
  padding: 1px 5px; border-radius: 6px; opacity: 0; transition: opacity .15s; pointer-events: none;
}
.zoom-track.dragging .tlabel { opacity: 1; background: var(--ew-timeline); }
/* The zoom names and the span chip show only while you're using the slider, and the bottom hour names step aside for
   them; when you let go, the hours come back (note 116) */
.zoom-chip { opacity: 0; transition: opacity .15s; }
.zoom-track.dragging .zoom-chip { opacity: 1; background: var(--ew-timeline); }
.tl-hours .hr-b { transition: opacity .15s; }
.timeline:has(.zoom-track.dragging) .tl-hours .hr-b { opacity: 0; }
.zoom-track .tlabel.on { color: var(--ew-ink); background: var(--ew-ground); }
.zoom-handle {
  position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 5px; background: var(--ew-surface);
  border: 1.5px solid color-mix(in srgb, var(--ew-ink) 55%, transparent); box-shadow: 0 1px 3px rgba(0,0,0,.18);
  transition: width .12s, height .12s, margin .12s, border-radius .12s;
}
.zoom-track.dragging .zoom-handle { width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 7px; }
.zoom-chip { position: absolute; top: -16px; transform: translateX(-50%); font-size: var(--ew-t-day); font-weight: 700; color: var(--ew-ink); background: var(--ew-ground); border-radius: var(--ew-r-chip); padding: 1px 5px; white-space: nowrap; pointer-events: none; }
.zoom-handle.pulse { animation: pulse .22s ease-out; }
@keyframes pulse { 50% { transform: scale(1.25); } }

/* ---------- window bar ---------- */
.windowbar, .timeline, .topbar { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.windowbar {
  flex: none; position: relative; height: 32px; display: flex; align-items: center; justify-content: space-between; padding: 0 var(--ew-gutter);
  background: var(--ew-window-bar); border-top: 1px solid color-mix(in srgb, var(--ew-ink) 16%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--ew-ink) 16%, transparent); cursor: row-resize; touch-action: none; z-index: 5;
}
.windowbar { transition: height .26s var(--ew-ease); }
.windowbar.searching { height: 44px; cursor: default; gap: 8px; }
/* When the keyboard would cover the search field, the timeline eases shorter just enough to lift it. */
.timeline.lifting { transition: height var(--ew-dur-slide) var(--ew-ease); }
.wb-btn {
  width: 36px; height: 24px; border-radius: 7px; display: grid; place-items: center; cursor: pointer; border: 1px solid var(--ew-edge); background: var(--ew-raised); padding: 0;
}
.wb-btn svg { width: 18px; height: 18px; }
.wb-btn.plus { background: var(--ew-accent); color: var(--ew-on-accent); border-color: transparent; }
.cal-float { position: sticky; top: var(--ew-cal-wd-h); height: 0; z-index: 6; }
.cal-float .cal-select { position: absolute; right: 14px; top: 8px; } /* under the window bar’s + (same size, same right edge) */
.cal-select { width: 36px; height: 24px; border-radius: 7px; display: grid; place-items: center; cursor: pointer; border: 1px solid var(--ew-edge); background: var(--ew-raised); padding: 0; color: var(--ew-ink-2);
  transition: background var(--ew-dur-glide) var(--ew-ease), color var(--ew-dur-glide) var(--ew-ease), border-color var(--ew-dur-glide) var(--ew-ease); }
.cal-select svg { width: 18px; height: 18px; }
.calendar.selecting .cal-select { background: color-mix(in srgb, var(--ew-accent) 18%, var(--ew-raised)); border-color: var(--ew-accent); color: var(--ew-accent); }
.calendar.selecting { touch-action: none; cursor: crosshair; }
.grip { width: 30px; display: grid; gap: 2px; pointer-events: none; }
.grip i { display: block; height: 1px; background: color-mix(in srgb, var(--ew-ink) 35%, transparent); box-shadow: 0 1px 0 rgba(255,255,255,.35); }
.search-field {
  flex: 1; height: 32px; border-radius: 9px; background: var(--ew-raised); border: 1.5px solid var(--ew-accent); display: flex; align-items: center; gap: 6px; padding: 0 8px;
}
.search-field svg { width: 16px; height: 16px; flex: none; color: var(--ew-ink-2); }
.search-field .glass { flex: none; display: grid; place-items: center; margin: -8px -4px -8px -8px; padding: 8px 4px 8px 8px; border: 0; background: none; cursor: pointer; }
.search-field input { flex: 1; min-width: 0; border: 0; background: none; font: 600 var(--ew-t-control) var(--ew-font); color: var(--ew-ink); outline: none; } /* the viewport is pinned (maximum-scale=1), so iOS doesn't zoom in on focus at this size */
.search-field input::placeholder { color: var(--ew-ink-2); font-weight: 400; }
.search-field .clear { width: 17px; height: 17px; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--ew-ink) 35%, transparent); color: var(--ew-raised); display: grid; place-items: center; padding: 0; cursor: pointer; font-size: 11px; font-weight: 700; }
.text-btn { border: 0; background: none; color: var(--ew-accent); font-weight: 600; font-size: var(--ew-t-control); padding: 6px 2px; cursor: pointer; }

/* ---------- month calendar ---------- */
.calendar { flex: 1; min-height: 0; overflow-y: auto; position: relative; -webkit-overflow-scrolling: touch; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.calendar.ranging { overflow-y: hidden; }
.calendar .cell.pulse { animation: cellpulse .25s ease-out; }
/* the event you just saved, wherever it shows (note 50) */
.just-saved { animation: just-saved 1.6s var(--ew-ease); }
@keyframes just-saved { 20%, 60% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ew-accent) 70%, transparent); } }
@keyframes cellpulse { 40% { background: color-mix(in srgb, var(--ew-accent) 22%, transparent); } }
.calendar.ranging .lens { box-shadow: 0 0 0 2px var(--ew-accent); }
.calendar .cell.swept { background: color-mix(in srgb, var(--ew-accent) 22%, transparent); }
/* Select days on: what you pick is green like the button, not the white of the timeline's window (note 62) */
.calendar.selecting .lens { background: color-mix(in srgb, var(--ew-accent) 14%, var(--ew-timeline)); box-shadow: inset 0 0 0 2px var(--ew-accent); }
/* Stuck 1px above the top (and 1px taller) so Safari's rounding never leaves a row of scrolling pixels showing
   between it and the window bar (note 56). */
.cal-wd { position: sticky; top: -1px; z-index: 6; /* above the month names, which slide under it on their way out */ height: calc(var(--ew-cal-wd-h) + 1px); box-sizing: border-box; display: grid; grid-template-columns: repeat(7, 1fr); padding: 5px 6px 3px; background: var(--ew-ground) var(--ew-texture); border-bottom: 1px solid var(--ew-hairline); }
.cal-wd span { text-align: center; font-size: var(--ew-t-day); font-weight: 600; letter-spacing: var(--ew-caps-tracking); color: var(--ew-ink-2); }
.calendar { --ew-cal-wd-h: 22px; }
.month { padding: 0 6px; }
.calendar .cal-end { border-top: 1px solid var(--ew-cal-grid); }
/* The month name floats under the weekday row until the next month pushes it up. */
.month h2 {
  position: sticky; top: var(--ew-cal-wd-h); z-index: 4; margin: 0 -6px; padding: 8px 10px 6px; height: 36px; box-sizing: border-box;
  font-size: 17px; line-height: 22px; font-weight: 600; letter-spacing: var(--ew-title-tracking); background: var(--ew-ground) var(--ew-texture);
}
/* a soft edge under the month name, so dates and numbers fade as they scroll under it instead of being cut off */
.month h2::after { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 12px; background: linear-gradient(var(--ew-ground), color-mix(in srgb, var(--ew-ground) 0%, transparent)); pointer-events: none; opacity: 0; transition: opacity .3s; }
/* only while the calendar is moving (notes 47, 57); at rest nothing is faded */
.scrolling .month.pinned h2::after { opacity: 1; }
/* weekends, as on the timeline */
.cell.wkend { background: color-mix(in srgb, var(--ew-ink) 4.5%, transparent); }
.cal-wd span:nth-child(n+6) { color: color-mix(in srgb, var(--ew-ink-2) 80%, transparent); }
.week { position: relative; display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--ew-cal-grid); min-height: 58px; transition: min-height var(--ew-dur-glide) var(--ew-ease); }
.cell + .cell { box-shadow: inset 1px 0 0 var(--ew-cal-grid); }
.cell { position: relative; min-width: 0; padding: 3px 2px 2px; cursor: pointer; }
.cell.out { visibility: hidden; }
/* the date row; in a tall week partly scrolled off (.week.stuck) it floats under the month name */
.cell .top { display: flex; align-items: center; gap: 3px; height: 20px; padding-left: 2px; }
/* once a tall week's dates are floating, they get the ground behind them so events slide under, not through */
.week.stuck .cell .top { position: sticky; top: calc(var(--ew-cal-wd-h) + 36px); z-index: 3; margin: 0 -2px; padding-left: 4px; background: var(--ew-ground) var(--ew-texture); box-shadow: 0 1px 0 var(--ew-cal-grid); }
.week.stuck .cell .top::after { content: ''; position: absolute; left: 0; right: 0; top: calc(100% + 1px); height: 10px; background: linear-gradient(var(--ew-ground), color-mix(in srgb, var(--ew-ground) 0%, transparent)); pointer-events: none; opacity: 0; transition: opacity .3s; }
.scrolling .week.stuck .cell .top::after { opacity: 1; transition-duration: .15s; }
.week.stuck .cell + .cell .top { box-shadow: inset 1px 0 0 var(--ew-cal-grid), 0 1px 0 var(--ew-cal-grid); }
.cell .n { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 20px; height: 20px; line-height: 20px; text-align: center; border-radius: 50%; }
/* continuous weeks (note 48): the 1st reads "Feb 1" and a darker edge marks where its month starts */
.cell.first .n { padding: 0 5px; border-radius: var(--ew-r-control); }
.cell.first { box-shadow: inset 2px 0 0 var(--ew-ink-2); }
.cell.today .n { background: var(--ew-today); color: var(--ew-on-accent); }
.cell.today { background: color-mix(in srgb, var(--ew-today) 10%, transparent); } /* tinted, no stroke (note 113) */
.cell.past .n { color: var(--ew-ink-2); }
.kd { width: 6px; height: 6px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1.5px var(--ew-ground), 0 0 0 2.5px color-mix(in srgb, var(--c) 50%, transparent); flex: none; }
.kd.other { background: color-mix(in srgb, var(--c) 35%, var(--ew-ground)); }
.hd { width: 7px; height: 7px; transform: rotate(45deg); border: 1.5px solid var(--ew-ink); border-radius: 1px; flex: none; margin-left: 1px; }
.bars { position: absolute; left: 0; right: 0; top: 24px; pointer-events: none; z-index: 2; }
.bars .bar:not(.more) { pointer-events: auto; cursor: pointer; }
.bars .bar.more { pointer-events: auto; cursor: pointer; }
.bar {
  position: absolute; height: 16px; border-radius: 3px; padding: 0 4px 0 5px; font-size: var(--ew-t-month-bar); line-height: 16px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ew-ink);
  background: color-mix(in srgb, var(--c) var(--ew-event-fill-mix), var(--ew-surface)); box-shadow: inset 2.5px 0 0 var(--c), inset 0 0 0 1px color-mix(in srgb, var(--c) 28%, transparent);
}
.bar.busy { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 22%, var(--ew-surface)) 0 4px, color-mix(in srgb, var(--c) 10%, var(--ew-surface)) 4px 8px); }
.bar.school { --c: var(--ew-ink-2); background: color-mix(in srgb, var(--ew-ink) 13%, var(--ew-surface)); color: var(--ew-ink-2); }
.bar.point { background: none; box-shadow: none; color: color-mix(in srgb, var(--c) 60%, var(--ew-ink)); font-weight: 600; padding-left: 2px; }
.bar.point::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--c); margin-right: 4px; vertical-align: 1px; }
.bar.point.busy { color: var(--ew-ink-2); }
.bar.more { background: none; box-shadow: none; color: var(--ew-ink-2); padding-left: 3px; }
.bar.past { opacity: .5; }
/* event sizes (pinch the calendar): bars glide to their new rows; custody lines never change */
.bar { height: calc(var(--bar, 18px) - 2px); transition: top var(--ew-dur-glide) var(--ew-ease), height var(--ew-dur-glide) var(--ew-ease), color var(--ew-dur-glide) var(--ew-ease); }
.bar .tm { display: none; }
.bar.more { height: 16px; }
.calendar[data-density="compact"] .bar:not(.more) { color: transparent; border-radius: 2px; }
.calendar[data-density="compact"] .bar.point { background: color-mix(in srgb, var(--c) 55%, var(--ew-surface)); }
.calendar[data-density="compact"] .bar.point::before { display: none; }
.calendar[data-density="roomy"] .bar:not(.more) { white-space: normal; line-height: 14px; padding-top: 1px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; text-overflow: clip; }
.calendar[data-density="roomy"] .bar .tm { display: inline; font-weight: 600; }
.calendar[data-density="roomy"] .bar.point::before { display: none; }
/* custody in the month: one thin line per kid under the dates, colored by who has them; the night of day d runs
   from midday d to midday d+1, as on the timeline */
.mcustody { position: absolute; left: 0; right: 0; top: 24px; z-index: 2; cursor: pointer; }
.mline { position: absolute; left: 0; right: 0; height: 4px; pointer-events: none; }
.mline .seg { position: absolute; top: 0; height: 100%; border-radius: 2px; background: var(--c); }
.mline .seg.other { opacity: .35; }
.mline .diamond {
  position: absolute; top: 50%; width: 7px; height: 7px; margin: -4.5px 0 0 -4.5px; transform: rotate(45deg);
  background: var(--ew-ground); border: 1.5px solid var(--ew-ink); border-radius: 1px;
}
.lens { position: absolute; top: 0; bottom: 0; background: var(--ew-timeline); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ew-ink) 22%, transparent); border-radius: 6px; z-index: 0; pointer-events: none; }
.cal-end { padding: 18px; text-align: center; color: var(--ew-ink-2); font-size: 12.5px; }

/* ---------- dropdown (one treatment for every menu) ---------- */
.menu {
  position: fixed; z-index: 50; min-width: 220px; max-width: calc(100vw - 24px); padding: 4px; border-radius: var(--ew-r-menu);
  background: var(--ew-menu-fill); -webkit-backdrop-filter: var(--ew-blur-menu); backdrop-filter: var(--ew-blur-menu);
  border: 1px solid color-mix(in srgb, var(--ew-ink) 10%, transparent); box-shadow: var(--ew-shadow-menu);
  max-height: 70vh; overflow-y: auto;
}
.menu .sec { font-size: var(--ew-t-micro-caps); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ew-ink-2); padding: 8px 10px 4px; }
.menu .row {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border-radius: var(--ew-r-row); border: 0; background: none;
  font-size: var(--ew-t-control); font-weight: 600; text-align: left; cursor: pointer; color: var(--ew-ink);
}
.menu .row svg { width: 16px; height: 16px; color: var(--ew-ink-2); flex: none; }
.menu .row .detail { margin-left: auto; font-size: 11.5px; font-weight: 500; color: var(--ew-ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.menu .row:hover, .menu .row.on, .menu .row:focus-visible { background: var(--ew-accent-wash); outline: none; }
.menu .row.picked { background: var(--ew-accent); color: var(--ew-on-accent); }
.menu .row.picked svg, .menu .row.picked .detail { color: var(--ew-on-accent); }
.menu .row[disabled] { color: color-mix(in srgb, var(--ew-ink) 45%, transparent); cursor: default; background: none; }
.menu .row .soon { margin-left: auto; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ew-ink-2); }
.menu .sep { height: 1px; margin: 4px 6px; background: color-mix(in srgb, var(--ew-ink) 9%, transparent); }
.menu .row .check { margin-left: auto; color: var(--ew-accent); }
.menu { transform-origin: top center; animation: menu-in 200ms var(--ew-ease); }
.menu.up { transform-origin: bottom center; animation-name: menu-in-up; }
.menu.out { opacity: 0; transform: translateY(-4px) scale(.98); transition: opacity 150ms ease-in, transform 150ms ease-in; }
.menu.up.out { transform: translateY(4px) scale(.98); }
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px) scale(.97); } }
@keyframes menu-in-up { from { opacity: 0; transform: translateY(6px) scale(.97); } }
.menu-catch { position: fixed; inset: 0; z-index: 49; cursor: pointer; }

/* ---------- sheet ---------- */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; max-height: 64vh; display: flex; flex-direction: column;
  background: var(--ew-sheet) var(--ew-texture); border-radius: var(--ew-r-sheet) var(--ew-r-sheet) 0 0; box-shadow: var(--ew-shadow-sheet);
  padding-bottom: env(safe-area-inset-bottom); transform: translateY(100%); transition: transform var(--ew-dur) var(--ew-ease);
}
.sheet.open { transform: none; }
.sheet.morph > .sheet-head, .sheet.morph > .sheet-body { animation: sheet-morph var(--ew-dur-glide) var(--ew-ease); } /* Edit: the same sheet, new contents */
@keyframes sheet-morph { from { opacity: 0; } }
/* resized by dragging (note 51): it keeps whatever height you leave it at, up to 90% of the screen */
/* the event editor opens no taller than the calendar under the divider at its usual spot (note 61); drag it taller */
.sheet.editor { max-height: var(--ew-sheet-cap, 64vh); }
.sheet[style*="height"] { max-height: 90vh; }
.sheet.sizing { transition: transform var(--ew-dur) var(--ew-ease), height var(--ew-dur-glide) var(--ew-ease); }
.sheet.dragging { transition: none; }
.sheet .sheet-body { min-height: 0; }
/* a parked draft: just its handle and head, at the bottom; tap it or drag it up to go back */
.sheet.parked { overflow: hidden; cursor: pointer; }
.sheet.parked .sheet-body { opacity: 0; transition: opacity var(--ew-dur-glide) var(--ew-ease); }
.sheet.parked .sheet-title .t::after { content: ' · draft'; color: var(--ew-sheet-ink-2); font-weight: 500; }
.sheet .grab, .sheet-head { touch-action: none; user-select: none; -webkit-user-select: none; }
.sheet .grab { width: 36px; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--ew-ink) 22%, transparent); margin: 7px auto 6px; flex: none; }
.sheet-head { flex: none; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 2px var(--ew-sheet-gutter) 12px; }
.sheet-title { text-align: center; min-width: 0; }
.sheet-title .t { font-size: var(--ew-t-sheet-title); line-height: 1.2; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sheet-title .d { font-size: var(--ew-t-secondary); font-weight: 600; color: var(--ew-sheet-ink-2); margin-top: 2px; }
.btn-outline { height: 32px; padding: 0 12px; border-radius: var(--ew-r-button); border: 0; background: none; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ew-ink) 30%, transparent); font-size: var(--ew-t-control); font-weight: 600; cursor: pointer; }
.btn-primary { height: 32px; padding: 0 13px; border-radius: var(--ew-r-button); border: 0; background: var(--ew-accent-sheet); color: var(--ew-on-accent); font-size: var(--ew-t-control); font-weight: 600; cursor: pointer; }
.btn-primary[disabled] { opacity: .45; cursor: default; }
.btn-wide { width: 100%; height: 44px; font-size: var(--ew-t-field); }
.head-spacer { width: 60px; }
.head-left { width: 60px; display: flex; }
.sheet-x { width: 32px; height: 32px; padding: 0; border: 0; border-radius: var(--ew-r-round); display: grid; place-items: center; background: color-mix(in srgb, var(--ew-ink) 10%, transparent); color: var(--ew-sheet-ink-2); cursor: pointer; }
.sheet-x svg { width: 18px; height: 18px; }
.sheet-body { overflow-y: auto; padding: 0 var(--ew-sheet-gutter) 18px; display: grid; gap: 14px; }
.facts { display: grid; gap: 10px; }
.fact { display: grid; grid-template-columns: 74px 1fr; gap: 10px; align-items: baseline; }
.fact .k { font-size: var(--ew-t-caps); font-weight: 600; text-transform: uppercase; letter-spacing: var(--ew-caps-tracking); color: var(--ew-sheet-ink-2); }
.fact .v { font-size: var(--ew-t-body); line-height: 1.35; }
.fact .v small { display: block; color: var(--ew-sheet-ink-2); font-size: 12.5px; margin-top: 2px; }
.who { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); display: inline-block; flex: none; }
.note { font-size: 13px; line-height: 1.4; color: var(--ew-sheet-ink-2); margin: 0; }
.field { display: flex; align-items: center; gap: 8px; background: var(--ew-sheet-surface); box-shadow: inset 0 0 0 1px var(--ew-sheet-line); border-radius: var(--ew-r-card); padding: 0 12px; height: 44px; }
.field input { flex: 1; min-width: 0; border: 0; background: none; font: 600 var(--ew-t-field) var(--ew-font); color: var(--ew-ink); outline: none; }
.field input::placeholder { font-weight: 400; color: var(--ew-sheet-ink-2); }
.card { background: var(--ew-sheet-surface); border-radius: var(--ew-r-card); box-shadow: inset 0 0 0 1px var(--ew-hairline); padding: 12px 14px; display: grid; gap: 10px; }
.person-row { display: flex; align-items: center; gap: 10px; }
.person-row .nm { font-weight: 600; font-size: 15px; }
.person-row .rl { font-size: 12.5px; color: var(--ew-sheet-ink-2); }
.linkbox { font: 500 12px ui-monospace, Menlo, monospace; word-break: break-all; color: var(--ew-sheet-ink-2); background: var(--ew-sheet-surface); border-radius: var(--ew-r-card); padding: 10px 12px; box-shadow: inset 0 0 0 1px var(--ew-sheet-line); }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.row-btns { align-items: center; }
.btn-link { border: 0; background: none; padding: 0 2px; height: 32px; font-size: var(--ew-t-control); font-weight: 600; color: var(--ew-accent-sheet); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.sent-state { display: inline-flex; align-items: center; gap: 10px; }
.sent-state .done { font-size: var(--ew-t-control); font-weight: 600; color: var(--ew-sheet-ink-2); }
.sent-state .done::before { content: '✓ '; }
.msg { font-size: 12.5px; color: var(--ew-sheet-ink-2); min-height: 1em; }
.msg.err { color: var(--ew-state-needs); }

.muted { color: var(--ew-sheet-ink-2); }
.facts.with-stat { position: relative; }
.facts.with-stat > .fact:nth-child(-n+3) .v { padding-right: 60px; }
.nights-stat { position: absolute; top: 0; right: 0; display: grid; justify-items: center; line-height: 1; color: var(--c); }
.nights-stat b { font-size: var(--ew-t-stat); font-weight: 700; }
.nights-stat span { font-size: var(--ew-t-caps); font-weight: 600; text-transform: uppercase; letter-spacing: var(--ew-caps-tracking); margin-top: 3px; }
.fact .btn-link { display: block; height: auto; padding: 0; margin-top: 3px; }

/* ---------- the event editor ---------- */
.editor .sheet-body { gap: 16px; }
.ed-sec { display: grid; gap: 7px; }
.ed-label { font-size: var(--ew-t-caps); font-weight: 600; text-transform: uppercase; letter-spacing: var(--ew-caps-tracking); color: var(--ew-sheet-ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 30px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: var(--ew-r-chip); background: var(--ew-sheet-surface); box-shadow: inset 0 0 0 1px var(--ew-sheet-line); color: var(--ew-ink); font: 600 12px var(--ew-font); cursor: pointer; transition: background-color .15s, box-shadow .15s; }
.chip .dot { width: 8px; height: 8px; }
.chip.on { background: color-mix(in srgb, var(--c) 14%, var(--ew-sheet-surface)); box-shadow: inset 0 0 0 1.5px var(--c); }
.chip.fixed { cursor: default; color: var(--ew-ink); opacity: 1; }
.chip.add { background: none; box-shadow: inset 0 0 0 1px var(--ew-sheet-line); color: var(--ew-accent-sheet); border-style: dashed; }
.editor .sheet-body { overflow-x: hidden; }
.ed-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.ed-pair[hidden] { display: none; }
/* "Oct 28 to Oct 30" and All day on one line; the times the same way under it (notes 60, 98) */
.ed-range { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.ed-range .ed-range.times { display: contents; } /* the times share the dates' columns, under them */
.ed-range .ed-range.times[hidden] { display: none; }
.ed-to { font-size: var(--ew-t-body); color: var(--ew-sheet-ink-2); }
.ed-range .field.small { padding: 0 8px; }
.ed-range .field.small input, .ed-range .field.small input::-webkit-date-and-time-value { text-align: center; }
.field.bad { box-shadow: inset 0 0 0 1.5px var(--ew-state-needs); }
.ed-when-msg[hidden] { display: none; }
.editor .msg:empty { display: none; }
/* Delete sits closer to the rest, centred (note 100) */
.ed-del { justify-content: center; margin-top: 4px; }
/* All day as a plain checkbox on the sheet (notes 76, 106): no chip behind it, just the white box and its words; on,
   the box fills with the accent and takes a check */
.chip.box { background: none; box-shadow: none; padding: 0 4px; }
.chip.box .cb { width: 16px; height: 16px; border-radius: 4px; background: var(--ew-sheet-surface); box-shadow: inset 0 0 0 1.5px var(--ew-sheet-line); position: relative; flex: none; transition: background-color .15s, box-shadow .15s; }
.chip.box.on { background: none; color: var(--ew-ink); box-shadow: none; }
.chip.box.on .cb { background: var(--ew-accent-sheet); box-shadow: none; }
.chip.box.on .cb::after { content: ""; position: absolute; left: 5.5px; top: 2px; width: 4px; height: 8px; border: solid var(--ew-on-accent); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.field.small { height: 40px; padding: 0 10px; gap: 6px; }
.field.small .k { font-size: var(--ew-t-caps); font-weight: 600; text-transform: uppercase; letter-spacing: var(--ew-caps-tracking); color: var(--ew-sheet-ink-2); }
.field.small input { font-size: var(--ew-t-body); white-space: nowrap; text-align: right; width: 100%; min-width: 0; -webkit-appearance: none; appearance: none; }
/* Every date and time field on sheets is body size, on one line (note 67); the viewport's maximum-scale=1 keeps iOS
   from zooming in on focus, which is what 16px used to guard against. */
.field.small input::-webkit-date-and-time-value { text-align: right; white-space: nowrap; }
.field input[type="text"] { font-size: 16px; }
.share-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.share-row small { display: block; font-size: 12.5px; line-height: 1.35; color: var(--ew-sheet-ink-2); margin-top: 3px; }
.switch { width: 46px; height: 28px; border: 0; padding: 0; border-radius: 14px; background: color-mix(in srgb, var(--ew-ink) 22%, transparent); position: relative; cursor: pointer; transition: background-color .2s; }
.switch i { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--ew-sheet-surface); box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .2s; }
.switch[aria-checked="true"] { background: var(--ew-accent-sheet); }
.switch[aria-checked="true"] i { transform: translateX(18px); }
.btn-outline.danger { color: var(--ew-state-needs); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ew-state-needs) 45%, transparent); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; z-index: 60;
  background: var(--ew-surface); border-radius: var(--ew-r-card); padding: 11px 13px; font-size: 13.5px; box-shadow: var(--ew-shadow-toast);
  max-width: calc(100vw - 32px); transition: opacity .2s, transform .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- sign in ---------- */
.signin { margin: auto; width: 100%; max-width: 380px; padding: 24px var(--ew-gutter) 40px; display: grid; gap: 14px; }
.lockup { display: block; width: 168px; height: auto; } /* brand/everywhile, stacked lockup with the Mossmatica credit */
.signin p { margin: 0; color: var(--ew-ink-2); font-size: 14.5px; line-height: 1.4; }
.signin .field { background: var(--ew-raised); box-shadow: inset 0 0 0 1px var(--ew-edge); }
.signin .code input { letter-spacing: .3em; font-size: 22px; font-variant-numeric: tabular-nums; }
.signin .btn-primary { background: var(--ew-accent); }

/* iPad and other big screens: a sheet floats as a centered panel instead of spanning the whole width, and the
   family's cards sit two across */
@media (min-width: 600px) and (min-height: 500px) {
  .sheet { left: 0; right: 0; bottom: 16px; width: min(640px, calc(100% - 32px)); margin-inline: auto; border-radius: var(--ew-r-sheet); transform: translateY(calc(100% + 16px)); }
  .sheet.family .sheet-body { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); align-content: start; }
  .sheet.family .card { align-content: start; }
}

@media (prefers-reduced-motion: reduce) {
  .zoom-handle.pulse, .calendar .cell.pulse { animation: none; }
  .sheet, .toast { transition: none; }
}

/* ---------- loupe: hold the timeline or the calendar to look closer (VizD rev 3) ---------- */
.loupe { position: fixed; z-index: 60; border-radius: var(--ew-loupe-r); pointer-events: none; box-shadow: var(--ew-loupe-shadow);
  transform-origin: var(--ox, 50%) var(--oy, 120%); transition: left .09s ease-out, top .09s ease-out, width .2s ease, height .2s ease; }
.loupe.in { animation: lp-in .22s cubic-bezier(.2,1.35,.45,1); }
.loupe.out { animation: lp-out .16s ease-in forwards; }
/* crossing the window bar, the glass turns a quarter: flat over the timeline, upright over the calendar */
.loupe.turn { animation: lp-turn var(--ew-dur-glide) var(--ew-ease); }
@keyframes lp-turn { from { rotate: -90deg; scale: .92; } }
.loupe.cal.turn { animation-name: lp-turn-up; }
@keyframes lp-turn-up { from { rotate: 90deg; scale: .92; } }
@keyframes lp-in { from { transform: scale(.35); opacity: 0; filter: blur(3px); } }
@keyframes lp-out { to { transform: scale(.3); opacity: 0; } }
.loupe .lp-rim, .loupe .lp-in { position: absolute; overflow: hidden; background: var(--ew-timeline); }
.loupe .lp-rim { inset: 0; border-radius: var(--ew-loupe-r); }
.loupe .lp-rim .lp-cl { filter: blur(1px) saturate(1.2); }
.loupe .lp-in { inset: var(--ew-loupe-rim-t) var(--ew-loupe-rim) var(--ew-loupe-rim-b); border-radius: var(--ew-loupe-r-in); box-shadow: 0 0 0 .6px var(--ew-loupe-glint); }
.loupe .lp-cl { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.loupe.fresh .lp-cl { transition: none; }
.loupe .lp-cl > * { position: absolute; margin: 0; }
.loupe .lp-shell { position: absolute; inset: 0; border-radius: var(--ew-loupe-r); opacity: .9;
  background: radial-gradient(ellipse 10% 26% at 14% 20%, var(--ew-loupe-fleck), transparent 70%), radial-gradient(ellipse 8% 30% at 40% 96%, var(--ew-loupe-fleck), transparent 70%),
    radial-gradient(ellipse 14% 12% at 66% 6%, var(--ew-loupe-fleck), transparent 70%), radial-gradient(ellipse 7% 22% at 97% 58%, var(--ew-loupe-fleck), transparent 70%),
    radial-gradient(ellipse 12% 9% at 82% 97%, var(--ew-loupe-fleck), transparent 70%), var(--ew-loupe-shell); }
.loupe .lp-glass { position: absolute; inset: 0; border-radius: var(--ew-loupe-r);
  background: linear-gradient(158deg, color-mix(in srgb, var(--ew-loupe-white) 50%, transparent) 0, color-mix(in srgb, var(--ew-loupe-white) 14%, transparent) 16%, color-mix(in srgb, var(--ew-loupe-white) 0%, transparent) 30%);
  box-shadow: inset 0 1.5px 1px color-mix(in srgb, var(--ew-loupe-white) 95%, transparent), inset 0 -2px 3px color-mix(in srgb, var(--ew-loupe-umber) 28%, transparent), inset 0 0 12px 2px color-mix(in srgb, var(--ew-loupe-white) 20%, transparent); }
.loupe .lp-glass::before { content: ""; position: absolute; left: 14px; top: 5px; width: 46%; height: 16px; border-radius: 14px 60px 0 0; border-top: 2px solid var(--ew-loupe-glint); filter: blur(.4px); opacity: .85; }
.loupe .lp-glass::after { content: ""; position: absolute; inset: var(--ew-loupe-rim-t) var(--ew-loupe-rim) var(--ew-loupe-rim-b); border-radius: var(--ew-loupe-r-in); box-shadow: inset 0 0 10px color-mix(in srgb, var(--ew-loupe-umber) 18%, transparent); }
.loupe .lp-x { position: absolute; left: 50%; top: var(--ew-loupe-rim-t); bottom: var(--ew-loupe-rim-b); width: 1px; transform: translateX(-.5px);
  /* the centre line; on an event it breaks from --gap-t to --gap-b, where the event's outline takes over (note 69) */
  --line: color-mix(in srgb, var(--ew-ink) 70%, transparent);
  background: linear-gradient(to bottom, var(--line) var(--gap-t, 100%), transparent var(--gap-t, 100%), transparent var(--gap-b, 100%), var(--line) var(--gap-b, 100%)); }
.loupe .lp-x::before, .loupe .lp-x::after { content: ""; position: absolute; left: -3.5px; border: 4px solid transparent; }
.loupe .lp-x::before { top: 0; border-top: 5px solid var(--ew-ink); }
.loupe .lp-x::after { bottom: 0; border-bottom: 5px solid var(--ew-ink); }
.loupe .lp-x.tick { animation: lp-tick .14s ease-out; }
@keyframes lp-tick { 50% { --line: var(--ew-loupe-tick); filter: drop-shadow(0 0 3px var(--ew-loupe-tick)); } }
/* the centre line run around the caught event: two strokes from where the line meets it, meeting underneath */
.loupe .lp-ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; opacity: 0;
  clip-path: inset(var(--ew-loupe-rim-t) var(--ew-loupe-rim) var(--ew-loupe-rim-b) round var(--ew-loupe-r-in)); }
.loupe .lp-ring path { fill: none; stroke: color-mix(in srgb, var(--ew-ink) 70%, transparent); stroke-width: 1.5; stroke-linecap: round; stroke-dasharray: 1 1; stroke-dashoffset: 1; }
.loupe .lp-ring.on { opacity: 1; }
.loupe .lp-ring.on path { animation: lp-ring var(--ew-dur-glide) var(--ew-ease) forwards; }
@keyframes lp-ring { to { stroke-dashoffset: 0; } }
.loupe .lp-read { display: none; } /* the event shows in the glass itself now (note 81) */
.loupe .lp-read-off { position: absolute; left: 20px; right: 20px; bottom: 3px; height: 13px; display: flex; gap: 5px; align-items: center; justify-content: center;
  /* the readout, built into the bottom of the bezel (note 63): never under the finger */
  font: 600 8.5px/1 var(--ew-font); font-variant-numeric: tabular-nums; letter-spacing: .02em; color: var(--ew-loupe-pow); white-space: nowrap; overflow: hidden; }
.loupe .lp-read b { flex: 0 1 auto; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.loupe .lp-read-t { position: absolute; left: 20px; right: 26px; top: 3px; height: 13px; display: flex; align-items: center; justify-content: center;
  font: 700 8.5px/1 var(--ew-font); font-variant-numeric: tabular-nums; letter-spacing: .02em; color: var(--ew-loupe-pow); white-space: nowrap; overflow: hidden; }
/* the dot on the centre line: it catches events (note 65) */
.loupe .lp-dot { position: absolute; left: 50%; top: calc((100% + var(--ew-loupe-rim-t) - var(--ew-loupe-rim-b)) / 2); width: 9px; height: 9px; border-radius: 50%; transform: translate(-50%, -50%);
  background: var(--ew-loupe-white); box-shadow: 0 0 0 1.5px var(--ew-ink); transition: transform var(--ew-dur-glide) var(--ew-ease), background var(--ew-dur-glide) var(--ew-ease); }
.loupe.on-event .lp-dot { transform: translate(-50%, -50%) scale(0); } /* caught: the opened event takes its place */
/* the event the dot is on opens in place: its time and name spread out from it */
.lz .ev .lp-exp { display: none; }
.lz .ev.lp-hit { z-index: 6; }
.lz .ev.lp-hit:not(.lp-bar) .lbl { visibility: hidden; } /* the chip says it; the name behind would double it */
/* sized against the glass's power so it reads the same at any power */
.lz .ev.lp-hit .lp-exp, .lz .lp-exp.lp-cust { display: block; position: absolute; left: -3px; top: 50%; transform: translateY(-50%); padding: calc(3px / var(--lp-p, 1)) calc(8px / var(--lp-p, 1)); border-radius: var(--ew-r-chip); white-space: nowrap;
  background: var(--ew-surface); box-shadow: var(--ew-shadow-card); font: 600 calc(11px / var(--lp-p, 1))/1.2 var(--ew-font); color: var(--ew-ink); animation: lp-open .16s var(--ew-ease); }
@keyframes lp-open { from { opacity: 0; } }
/* a custody stay caught on its line (note 72): the chip sits on the line, where the dot is */
.lz .lp-exp.lp-cust { left: 0; transform: translate(-50%, -50%); z-index: 6; }
.lz .lp-exp.lp-cust b { color: var(--c); }
/* a labeled bar caught (note 71): it's outlined where it is, with its whole name showing */
.lz .ev.lp-bar { overflow: visible; z-index: 6; min-width: max-content; padding-right: 6px; } /* the bar grows to hold its name: one whole surface (note 81) */
.lz .ev.lp-bar:not(.busy):not(.school) { background: color-mix(in srgb, var(--c) var(--ew-event-fill-mix), var(--ew-surface)); }
.lz .ev.lp-bar.stub { padding-left: calc(var(--bw) + 5px); }
.lz .ev.lp-bar.past { opacity: 1; }
.lz .ev.lp-bar .lbl { display: block; overflow: visible; text-overflow: clip; white-space: nowrap; width: max-content; -webkit-line-clamp: unset; }
.loupe .lp-read i { font-style: normal; opacity: .8; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.loupe .lp-pow { position: absolute; right: 13px; top: 1px; font: 700 7.5px/1 var(--ew-font); letter-spacing: .06em; color: var(--ew-loupe-pow); }
/* lifted on something caught: the glass waits for a tap (note 80) */
.loupe.linger { pointer-events: auto; cursor: pointer; }
.loupe.linger .lp-read-t { color: var(--ew-loupe-white); animation: lp-cta 1s var(--ew-ease) infinite alternate; }
@keyframes lp-cta { to { opacity: .55; } }
.lp-foot { position: fixed; z-index: 59; pointer-events: none; border-radius: var(--ew-r-chip); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ew-ink) 35%, transparent), 0 0 0 3px color-mix(in srgb, var(--ew-loupe-white) 35%, transparent); }
/* only inside the glass: hour lines and labels, and times on events */
.lz .lp-hr { position: absolute; top: 0; bottom: 0; width: .4px; background: color-mix(in srgb, var(--ew-ink) 6%, transparent); }
.lz .lp-hr.six { background: color-mix(in srgb, var(--ew-ink) 12%, transparent); }
.lz .lp-hl { position: absolute; bottom: 1px; transform: translateX(-50%); font: 600 4.2px/1 var(--ew-font); color: var(--ew-ink-2); }
.lz .lp-t { font: 700 4.6px/1 var(--ew-font); color: var(--ew-ink-2); margin-left: 3px; white-space: nowrap; }
.lz .ev { overflow: visible; }
/* the calendar's day, unfolded in an upright glass */
.loupe.cal .lp-x, .loupe.cal .lp-read, .loupe.cal:not(.linger) .lp-read-t, .loupe.cal .lp-dot, .loupe.cal .lp-pow, .loupe.cal .lp-in .lp-cl, .loupe.cal .lp-rim .lp-cl, .loupe:not(.cal) .lp-day { display: none; }
.loupe .lp-day { position: absolute; inset: var(--ew-loupe-rim-t) var(--ew-loupe-rim) var(--ew-loupe-rim-b); border-radius: var(--ew-loupe-r-in); padding: 8px 10px 10px; background: color-mix(in srgb, var(--ew-surface) 72%, var(--ew-ground)); display: flex; flex-direction: column; gap: 6px; color: var(--ew-ink); overflow: hidden; }
.loupe .lp-day.swap { animation: lp-swap .16s ease-out; }
@keyframes lp-swap { from { opacity: .25; transform: translateY(4px); } }
.lpd-h { display: flex; align-items: baseline; gap: 6px; padding-bottom: 4px; border-bottom: 1px solid color-mix(in srgb, var(--ew-ink) 12%, transparent); }
.lpd-wd { font: 700 9.5px var(--ew-font); letter-spacing: .08em; color: var(--ew-ink-2); }
.lpd-n { font: 700 26px/1 var(--ew-font); }
.lpd-h.today .lpd-n { color: var(--ew-today); }
.lpd-m { font: 600 12px var(--ew-font); color: var(--ew-ink-2); }
.lpd-k { display: flex; gap: 6px; align-items: center; font: 600 10.5px var(--ew-font); color: var(--ew-ink-2); }
.lpd-k i { width: 14px; height: 3px; border-radius: 2px; background: var(--c); flex: none; }
.lpd-k .dia { width: 7px; height: 7px; transform: rotate(45deg); border: 1.5px solid var(--ew-ink); margin: 0 3px; flex: none; }
.lpd-l { position: relative; display: grid; gap: 6px; align-content: start; flex: 1 1 auto; min-height: 0; overflow: hidden; scroll-behavior: smooth;
  mask-image: linear-gradient(to bottom, #000 calc(100% - 14px), transparent); }
/* what the finger is on in the cell, outlined in the glass like a caught event on the timeline */
.lpd-r, .lpd-k { border-radius: var(--ew-r-chip); box-shadow: 0 0 0 1.5px transparent; transition: box-shadow var(--ew-dur-glide) var(--ew-ease), background var(--ew-dur-glide) var(--ew-ease); }
.lpd-r.hit, .lpd-k.hit { background: var(--ew-surface); box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--ew-ink) 70%, transparent), 0 0 0 4px var(--ew-surface); }
.lpd-more { flex: none; font: 700 10px var(--ew-font); color: var(--ew-ink-2); }
.loupe.cal.linger .lpd-r, .loupe.cal.linger .lpd-k[data-key], .loupe.cal.linger .lpd-h { cursor: pointer; }
.loupe.cal.linger .lp-glass { pointer-events: none; } /* the rows under the glass's sheen take the tap */
.lpd-r { display: grid; grid-template-columns: 3px 1fr; gap: 7px; align-items: stretch; }
.lpd-r > i { border-radius: 2px; background: var(--c); }
.lpd-r b { display: block; font: 700 12.5px/1.2 var(--ew-font); }
.lpd-r small { display: block; font: 600 10px/1.25 var(--ew-font); color: var(--ew-ink-2); margin-top: 1px; }
.lpd-r.past { opacity: .55; }
.lpd-r.busy > i { background: repeating-linear-gradient(135deg, var(--c) 0 2px, transparent 2px 4px); }
.lpd-none { font: 600 11px var(--ew-font); color: var(--ew-ink-2); }
.timeline, .calendar { -webkit-touch-callout: none; }
@media (prefers-reduced-motion: reduce) { .loupe, .loupe .lp-cl { transition: none; animation: none; } }

/* ---------- test site only: the app at another screen's size (testframe.js) ---------- */
.tf-stage { position: fixed; inset: 0; padding: var(--ew-gutter); background: var(--ew-surface-2); }
.tf-pick { position: fixed; left: var(--ew-gutter); top: var(--ew-gutter); z-index: 2; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.tf-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--ew-r-button); background: var(--ew-surface); color: var(--ew-ink); box-shadow: var(--ew-shadow-card); }
.tf-list { display: grid; gap: 2px; padding: 4px; border-radius: var(--ew-r-card); background: var(--ew-surface); box-shadow: var(--ew-shadow-card); }
.tf-list[hidden] { display: none; }
.tf-list button { padding: 7px 12px; border-radius: var(--ew-r-button); text-align: left; color: var(--ew-ink-2); font: 600 13px var(--ew-font); }
.tf-list button.on { background: var(--ew-ink); color: var(--ew-surface); }
.tf-box { position: absolute; inset: calc(var(--ew-gutter) + var(--ew-test-frame-rim)); } /* room for the frame's rim */
.tf-frame { position: absolute; left: 50%; top: 50%; translate: -50% -50%; overflow: visible; border: 0; border-radius: var(--ew-r-test-frame); background: var(--ew-ground); box-shadow: 0 0 0 var(--ew-test-frame-rim) var(--ew-ink), var(--ew-shadow-card); }
