/* ==========================================================================
   flob
   Dark, editorial, and built for one screen on an iPhone.

   Rules driving the layout:
     1. The page NEVER scrolls. The shell is a fixed 100dvh grid; only
        explicitly marked rails scroll, and only sideways.
     2. Everything is Times New Roman except the logo, which is an image.
     3. Corners are barely rounded - a few pixels, not pills. The only true
        circles are the calendar days and the colour swatches.

   Overview is one screen: a status banner, the calendar taking the middle,
   a painkiller banner under it, and the links rail at the bottom.
   ========================================================================== */

:root {
  /* Overwritten at runtime from her saved theme. */
  --accent: #e11d48;
  --accent-soft: #f43f5e;
  --bg: #0b0a0f;
  --surface: #16141c;

  --text: #f6f3f0;
  --text-dim: #a49fae;
  --text-faint: #6b6577;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);

  --ovulation: #38bdf8;
  --fertile: rgba(56, 189, 248, 0.20);
  --good: #4ade80;
  --warn: #fbbf24;

  /* Barely-there corners. */
  --r-lg: 6px;
  --r-md: 5px;
  --r-sm: 4px;

  --pad: clamp(12px, 3.6vw, 18px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);

  /* Subtle fills for buttons, inputs, idle calendar days. Themes override
     these along with the text/line tokens - a light theme needs dark fills. */
  --fill-1: rgba(255, 255, 255, 0.03);
  --fill-2: rgba(255, 255, 255, 0.05);
  --fill-3: rgba(255, 255, 255, 0.08);
  --fill-4: rgba(255, 255, 255, 0.13);
  --shadow: rgba(0, 0, 0, 0.9);
  --on-accent: #fff;

  /* Themes swap the font and the corner radii. The default is Times New Roman,
     per the original spec; other themes are free to differ. */
  --font: "Times New Roman", Times, "Liberation Serif", serif;
  --serif: var(--font);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;                 /* the page itself never scrolls */
  overscroll-behavior: none;
  background: var(--bg);
}

body {
  font-family: var(--font);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
  position: fixed;                  /* kills Safari rubber-banding */
  inset: 0;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(120% 60% at 50% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 62%),
    radial-gradient(90% 45% at 50% 108%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
}
button { cursor: pointer; }
input, textarea, select { -webkit-appearance: none; appearance: none; }
[hidden] { display: none !important; }

/* --------------------------------------------------------------- app shell */

#app {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: calc(var(--safe-t) + 8px) 0 var(--safe-b);
}
@supports (-webkit-touch-callout: none) {
  #app { height: -webkit-fill-available; }
  @supports (height: 100dvh) { #app { height: 100dvh; } }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px var(--pad) 7px;
}

.logo { display: flex; align-items: center; gap: 9px; min-width: 0; }
.logo img { height: clamp(26px, 7.4vw, 33px); width: auto; display: block; }
.logo-fallback { font-size: clamp(23px, 7vw, 30px); letter-spacing: -0.02em; font-weight: 700; }

.topbar-right { display: flex; align-items: center; gap: 7px; }

.chip {
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 5px 9px;
  white-space: nowrap;
}
.chip-accent { color: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

/* ------------------------------------------------------------------ views */

.views { position: relative; min-height: 0; }

.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 0 var(--pad);
  min-height: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(5px);
  transition: opacity .2s ease, transform .2s ease;
}
.view.active { opacity: 1; pointer-events: auto; transform: none; }

.card {
  background: linear-gradient(168deg,
    color-mix(in srgb, var(--surface) 92%, white 4%),
    var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(11px, 3.4vw, 16px);
  min-height: 0;
}
.card-tight { padding: clamp(9px, 2.8vw, 13px); }

.card-label {
  font-size: 10px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}

/* ================================================================= banners */

/* Compact horizontal strips. Her cycle status and her painkiller timer each
   live in one of these rather than owning a whole screen. */
.banner {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(168deg,
    color-mix(in srgb, var(--surface) 92%, white 4%),
    var(--surface));
  padding: 10px 12px;
  flex-shrink: 0;
  transition: background .18s ease;
}
.banner:active { background: color-mix(in srgb, var(--surface) 80%, white 8%); }

/* A flex column so the tag/value/label stack, and so those spans are blockified
   (an inline span would ignore the ellipsis truncation on .banner-label). */
.banner-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.banner-value {
  font-size: clamp(20px, 6vw, 25px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums lining-nums;
}
.banner-label {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 2px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.banner-tag {
  font-size: 9.5px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--accent-soft);
  margin-bottom: 3px;
}

/* A thin accent stripe down the leading edge, rather than a big coloured card. */
.banner-rule {
  width: 3px;
  align-self: stretch;
  border-radius: 2px;
  background: var(--accent);
  flex-shrink: 0;
}
.banner-late .banner-rule { background: var(--warn); }
.banner-late .banner-tag { color: var(--warn); }

.banner-action {
  flex-shrink: 0;
  padding: 9px 14px;
  border-radius: var(--r-md);
  font-size: 14px;
  background: linear-gradient(160deg, var(--accent-soft), var(--accent));
  color: var(--on-accent);
  border: none;
  white-space: nowrap;
}
.banner-action:active { transform: scale(0.97); }
.banner-action-ready { background: linear-gradient(160deg, #4ade80, #16a34a); }

.pill-banner .stickman-sm { width: 42px; height: 42px; flex-shrink: 0; color: var(--text-dim); }
.pill-banner-ready .banner-value { color: var(--good); }

/* The painkiller banner holds two targets: the whole left side opens today's
   doses, the button on the right logs one. Nested buttons are invalid HTML, so
   they are siblings inside a plain div. */
.pill-open {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
  background: none;
  padding: 0;
}

/* -------------------------------------------------------------- calendar */

/* The calendar takes every pixel between the status banner and the painkiller
   banner - the grid itself stretches rather than sitting in the middle of a
   void. */
.cal-region {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
  flex-shrink: 0;
}
.cal-title { display: flex; align-items: baseline; gap: 7px; min-width: 0; }

/* Month and year are separate jump targets. */
.cal-jump {
  font-size: 18px;
  letter-spacing: 0.01em;
  color: var(--text);
  padding: 3px 6px;
  margin-left: -6px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
}
.cal-jump:active { background: var(--fill-3); }
.cal-jump-year { color: var(--text-dim); font-size: 16px; margin-left: 0; }

.cal-nav { display: flex; gap: 5px; }
.cal-nav button {
  width: 30px; height: 30px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-size: 14px;
  color: var(--text-dim);
}

.cal-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  font-size: 9.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
  text-align: center;
  flex-shrink: 0;
}

/* The grid fills the region, and its rows split that height evenly. */
/* minmax(0, 1fr) rather than 1fr: a plain 1fr track refuses to shrink below its
   content, so on a short screen a six-row month kept 46px circles, overflowed
   its box and ran under the painkiller banner. The circle size itself is set by
   sizeCalendar() in app.js from the space actually available. */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(0, 1fr);
  align-content: space-evenly;
  justify-items: center;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* Every day is a circle, sized to whichever of column width or row height is
   smaller (--day-size, computed in sizeCalendar). */
.day {
  position: relative;
  width: var(--day-size, 46px);
  height: var(--day-size, 46px);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: clamp(12px, 3.6vw, 15px);
  color: var(--text);
  border: 1px solid transparent;
  background: var(--fill-1);
  line-height: 1;
}
.day-out { opacity: 0.2; }
.day-today { border-color: var(--text); font-weight: 700; }
.day-period { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.day-predicted {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px dashed color-mix(in srgb, var(--accent) 58%, transparent);
}
.day-fertile { background: var(--fertile); }
.day-ovulation { box-shadow: inset 0 0 0 2px var(--ovulation); }
.day-note::after {
  content: '';
  position: absolute;
  bottom: 5px;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.9;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 11px;
  font-size: 10px;
  color: var(--text-faint);
  flex-shrink: 0;
  justify-content: center;
}
.legend span { display: flex; align-items: center; gap: 5px; }
.swatch { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* --------------------------------- side-scrolling rails (the only scrolling) */

.rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
  flex-shrink: 0;
}
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; flex: 0 0 auto; }
.rail-fill { flex: 1 1 auto; align-items: center; }

/* The links row spans the full width: equal columns that share whatever space
   there is. `grid-auto-columns: minmax(84px, 1fr)` means three links fill the
   row exactly, and if more are ever added they hold a sensible minimum and the
   row scrolls sideways instead of crushing them. */
.links-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(84px, 1fr);
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  flex-shrink: 0;
}
.links-row::-webkit-scrollbar { display: none; }

.link-square {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  padding: 11px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: linear-gradient(168deg,
    color-mix(in srgb, var(--surface) 92%, white 4%),
    var(--surface));
  color: var(--text);
  text-decoration: none;
}
.link-square:active { background: color-mix(in srgb, var(--surface) 78%, white 9%); }
.link-emoji { font-size: 24px; line-height: 1; }
.link-label {
  font-size: 12.5px;
  line-height: 1.25;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Insight cards live on a rail too, so a long list never scrolls the page. */
.insight {
  width: min(78vw, 320px);
  white-space: normal;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-self: center;
  max-height: 100%;
  overflow-y: auto;
  scrollbar-width: none;
}
.insight::-webkit-scrollbar { display: none; }
.insight-title { font-size: 17px; line-height: 1.25; }
.insight-body { font-size: 13.5px; color: var(--text-dim); line-height: 1.5; }
.insight-src {
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  align-self: flex-start;
  padding: 3px 7px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  color: var(--text-faint);
}
.insight-flag { border-color: color-mix(in srgb, var(--warn) 42%, transparent); }
.insight-flag .insight-src { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 42%, transparent); }
.insight-good .insight-src { color: var(--good); border-color: color-mix(in srgb, var(--good) 38%, transparent); }
.insight a { color: var(--accent-soft); }

/* The note from Chris that lives under the insights deck. */
.love-note {
  flex-shrink: 0;
  padding: 12px 15px;
  border-radius: var(--r-lg);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
}
.love-note p + p { margin-top: 4px; }
.love-note-sign { color: var(--accent-soft); font-style: italic; }
.insight-link { font-size: 13px; }

/* ------------------------------------------------------------------ buttons */

.btn {
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 15px;
  border: 1px solid var(--line-strong);
  background: var(--fill-2);
  transition: transform .12s ease, background .18s ease;
  text-align: center;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(160deg, var(--accent-soft), var(--accent));
  border-color: transparent;
  color: #fff;
}
.btn-ghost { background: transparent; }

/* Destructive actions confirm in place rather than via a native dialog. */
.btn-danger {
  background: transparent;
  border-color: color-mix(in srgb, #ef4444 40%, transparent);
  color: #fca5a5;
}
.btn-danger-armed {
  background: #dc2626;
  border-color: transparent;
  color: #fff;
}
.btn-full { width: 100%; }
.btn-sm { padding: 9px 13px; font-size: 13.5px; }
.btn:disabled { opacity: 0.42; }

/* ------------------------------------------------------------ settings view */

.settings-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding-bottom: 8px;
}
.settings-scroll::-webkit-scrollbar { display: none; }
/* Flex children shrink by default. In a scrolling column that means the cards
   get squashed below their content height and their contents spill out over the
   card below, instead of the container simply scrolling. Pin them. */
.settings-scroll > * { flex: 0 0 auto; }
.sheet-body > * { flex: 0 0 auto; }

.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; }
.field + .field { border-top: 1px solid var(--line); }
.field-label { font-size: 14.5px; }
.field-hint { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; line-height: 1.4; }
.field-col { flex-direction: column; align-items: stretch; gap: 7px; }

.input {
  background: var(--fill-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 16px;              /* 16px stops iOS zooming on focus */
  width: 100%;
  color: var(--text);
}
.input:focus { outline: none; border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.input-sm { width: 84px; text-align: center; padding: 8px 6px; }

/* The native colour input needs help once appearance is reset, or it renders as
   a thin bar rather than a swatch. */
input[type="color"] {
  width: 46px;
  height: 34px;
  padding: 3px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--fill-2);
  cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 2px; }
input[type="color"]::-moz-color-swatch { border: none; border-radius: 2px; }

input[type="date"], input[type="file"] { min-height: 42px; }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); opacity: .55; }

/* Colour swatches stay round - they read as paint, not as controls. */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }

/* Theme tiles preview themselves - each is styled inline with its own font,
   corners and surface, so she sees what she is picking. */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.theme-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 11px 12px;
  text-align: left;
  border: 2px solid transparent;
  outline: 1px solid var(--line);
  outline-offset: -1px;
  transition: transform .12s ease;
}
.theme-tile:active { transform: scale(0.98); }
.theme-tile[aria-pressed="true"] { border-color: var(--accent); outline: none; }
.theme-tile-name { font-size: 16px; }
.theme-tile-blurb { font-size: 11px; line-height: 1.35; color: var(--tile-dim, inherit); opacity: .9; }
.swatch-btn { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; position: relative; }
.swatch-btn[aria-pressed="true"] { border-color: var(--text); }

/* A switch is a switch; it keeps its pill. */
.toggle {
  width: 46px; height: 27px;
  border-radius: 999px;
  background: var(--fill-4);
  position: relative;
  transition: background .2s ease;
  flex-shrink: 0;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 21px; height: 21px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s ease;
}
.toggle[aria-pressed="true"] { background: var(--accent); }
.toggle[aria-pressed="true"]::after { transform: translateX(19px); }

/* ------------------------------------------------------------------ tab bar */

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 6px var(--pad) 2px;
  border-top: 1px solid var(--line);
  margin-top: 5px;
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px;
  color: var(--text-faint);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  border-radius: var(--r-sm);
}
.tab svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.tab[aria-selected="true"] { color: var(--accent-soft); }

/* ------------------------------------------------------------------- sheets */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(3px);
  z-index: 40;
  display: grid;
  align-items: end;
}
.sheet {
  background: var(--surface);
  border-top-left-radius: var(--r-lg);
  border-top-right-radius: var(--r-lg);
  border-top: 1px solid var(--line-strong);
  padding: 8px var(--pad) calc(var(--safe-b) + 16px);
  max-height: 86dvh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: sheet-up .24s cubic-bezier(.22,.9,.3,1);
}
@keyframes sheet-up { from { transform: translateY(100%); } }
.sheet-grip {
  width: 34px; height: 3px;
  border-radius: 2px;
  background: var(--line-strong);
  margin: 0 auto 4px;
  flex-shrink: 0;
}
.sheet-title { font-size: 19px; flex-shrink: 0; }
.sheet-body { overflow-y: auto; min-height: 0; scrollbar-width: none; display: flex; flex-direction: column; gap: 10px; }
.sheet-body::-webkit-scrollbar { display: none; }

.seg { display: flex; gap: 5px; flex-wrap: wrap; }
.seg button {
  padding: 8px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--text-dim);
}
.seg button[aria-pressed="true"] { background: var(--accent); border-color: transparent; color: #fff; }

/* Month / year quick pickers. */
.picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  max-height: 52dvh;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 1px;
}
.picker-grid::-webkit-scrollbar { display: none; }
.picker-btn {
  padding: 13px 6px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  font-size: 14.5px;
  color: var(--text-dim);
  text-align: center;
}
.picker-btn[aria-pressed="true"] { background: var(--accent); border-color: transparent; color: #fff; }
.picker-btn-now { border-color: color-mix(in srgb, var(--accent) 55%, transparent); color: var(--text); }

textarea.input { min-height: 84px; resize: none; line-height: 1.5; }
.bulk-input { min-height: 150px; }

.dose-list { display: flex; flex-direction: column; gap: 4px; }
.dose-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
  padding: 7px 2px;
  border-bottom: 1px solid var(--line);
}
.dose-row:last-child { border-bottom: none; }
.dose-del { color: var(--text-faint); font-size: 16px; padding: 0 6px; }

.stickman { width: clamp(120px, 32vw, 150px); height: auto; align-self: center; }

/* --------------------------------------------------------------- Chris popup */

.chris {
  position: fixed;
  left: 50%;
  bottom: -140px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 14px 9px 9px;
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--surface) 88%, black);
  border: 1px solid var(--line-strong);
  box-shadow: 0 16px 44px -16px var(--shadow);
  pointer-events: none;
  max-width: min(88vw, 400px);
  animation: chris-float 9s cubic-bezier(.3,.1,.4,1) forwards;
}
.chris img {
  width: 42px; height: 42px;
  border-radius: 50%;
  object-fit: cover;
  /* The photo is a landscape webcam shot with the face left of centre and
     upper-middle; this keeps the face in the circle rather than the door. */
  object-position: 40% 38%;
  border: 2px solid var(--accent);
  flex-shrink: 0;
}
.chris-text { font-size: 14px; line-height: 1.35; }

@keyframes chris-float {
  0%   { transform: translate(-50%, 0)      scale(0.9); opacity: 0; }
  9%   { transform: translate(-50%, -22dvh) scale(1);   opacity: 1; }
  78%  { transform: translate(-50%, -78dvh) scale(1);   opacity: 1; }
  100% { transform: translate(-50%, -104dvh) scale(0.95); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .chris { animation: chris-fade 7s ease forwards; bottom: 15dvh; }
  @keyframes chris-fade { 0%,100% { opacity: 0; transform: translateX(-50%); } 12%,80% { opacity: 1; transform: translateX(-50%); } }
  .sheet { animation: none; }
}

/* -------------------------------------------------------------- auth screen */

.auth {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 13px;
  padding: calc(var(--safe-t) + 26px) var(--pad) calc(var(--safe-b) + 26px);
  overflow-y: auto;
}
.auth-logo { display: flex; justify-content: center; margin-bottom: 4px; }
.auth-logo img { height: 54px; }
.auth h1 { font-size: 25px; font-weight: 400; text-align: center; }
.auth p.lede { font-size: 14px; color: var(--text-dim); text-align: center; line-height: 1.5; max-width: 34ch; margin: 0 auto; }
.auth form { display: flex; flex-direction: column; gap: 9px; }
.auth-alt { text-align: center; font-size: 13.5px; color: var(--text-dim); }
.auth-alt button { color: var(--accent-soft); text-decoration: underline; }

.recovery-code {
  font-family: "Courier New", monospace;
  font-size: clamp(17px, 5.6vw, 22px);
  letter-spacing: 0.08em;
  text-align: center;
  padding: 15px 10px;
  border-radius: var(--r-md);
  border: 1px dashed var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  word-break: break-all;
}

.notice {
  font-size: 13px;
  line-height: 1.5;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  color: var(--text-dim);
}
.notice-warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); color: var(--warn); }
.notice-error { border-color: color-mix(in srgb, #ef4444 55%, transparent); color: #fca5a5; }
.notice-good { border-color: color-mix(in srgb, var(--good) 45%, transparent); color: var(--good); }

/* ------------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--safe-b) + 78px);
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: 90vw;
}
.toast {
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 9px 15px;
  font-size: 13.5px;
  animation: toast-in .2s ease;
}
.toast-error { border-color: #ef4444; color: #fca5a5; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------------ import review */

.proposal {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.proposal:last-child { border-bottom: none; }
.proposal-dates { flex: 1; font-size: 14.5px; }
.proposal-meta { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.proposal-inputs { display: flex; gap: 6px; flex-wrap: wrap; }
.checkbox {
  width: 23px; height: 23px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--line-strong);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 13px;
}
.checkbox[aria-pressed="true"] { background: var(--accent); border-color: transparent; color: #fff; }

/* Short screens (iPhone SE, or landscape) - claw back vertical space. */
@media (max-height: 700px) {
  .link-square { width: clamp(76px, 23vw, 92px); }
  .link-emoji { font-size: 20px; }
  .banner-value { font-size: clamp(17px, 5.2vw, 21px); }
  .pill-banner .stickman-sm { width: 34px; height: 34px; }
  .cal-month { font-size: 16px; }
  .card { padding: 10px; }
}
