/* Doctor Mom
 *
 * Cute and professional, from the logo: coral "DOCTOR", deep teal "MOM", and
 * the bandage's warm tan. Soft rounded cards on a warm cream page, rounded
 * Fredoka headings like the logo's letters, and each person's own color
 * behind their records.
 *
 * Built for a phone first. Wider screens get the tabs in the header and more
 * room, but every screen works one-handed at 360px.
 */

@font-face {
  font-family: 'Fredoka';
  src: url('/fonts/fredoka.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('/fonts/nunito.woff2') format('woff2');
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  --coral: #F16563;
  --coral-deep: #C23E3C;
  --coral-tint: #FDECEB;
  --teal: #165A66;
  --teal-2: #1E6F7C;
  --teal-tint: #E3F0F1;
  --tan: #F4BA86;
  --pad: #FDD3A6;
  --tan-tint: #FEF3E7;
  --dot: #DCA179;

  --page: #FFF8F1;
  --card: #FFFFFF;
  --ink: #22393E;
  --muted: #5E6E71;
  --line: #EADFD3;
  --line-strong: #D6C7B7;

  --ok: #2E8B57;
  --warn: #B86E00;
  --warn-tint: #FFF1D6;
  --high-tint: #FFE0CC;
  --low-tint: #DCEBFF;

  /* The person being viewed, set from their color. */
  --person: var(--teal);
  --person-tint: var(--page);

  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(34, 57, 62, .06), 0 6px 18px rgba(34, 57, 62, .08);
  --shadow-lift: 0 2px 4px rgba(34, 57, 62, .08), 0 12px 28px rgba(34, 57, 62, .12);

  --font-display: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease;
}
body.has-person { background: var(--person-tint); }
img { max-width: 100%; height: auto; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0 0 .4em; color: var(--teal); }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 1em; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }

:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; border-radius: 8px; }

.link { color: var(--teal-2); font-weight: 800; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.link:hover { color: var(--coral-deep); }
.lede { font-size: 1.04rem; color: var(--muted); }
.hint { display: block; font-size: .87rem; color: var(--muted); margin-top: 4px; }
.optional { font-weight: 500; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.icon { width: 1.35em; height: 1.35em; vertical-align: -.3em; flex: none; }
.icon-lg { width: 40px; height: 40px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------- buttons -------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px;
  font: 600 1.02rem/1 var(--font-display);
  padding: 12px 20px;
  border: 2px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  background: var(--card);
  border-color: var(--line-strong);
  transition: transform .08s ease, box-shadow .15s, background .15s, border-color .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { border-color: var(--teal-2); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; box-shadow: 0 4px 0 #0E3E47; }
.btn-primary:hover { background: var(--teal-2); border-color: var(--teal-2); }
.btn-primary:active { transform: translateY(3px); box-shadow: 0 1px 0 #0E3E47; }
.btn-coral { background: var(--coral); border-color: var(--coral); color: #fff; box-shadow: 0 4px 0 #B8403E; }
.btn-coral:hover { background: #F37876; border-color: #F37876; }
.btn-coral:active { transform: translateY(3px); box-shadow: 0 1px 0 #B8403E; }
.btn-danger { background: var(--coral-deep); border-color: var(--coral-deep); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--teal-2); }
.btn-ghost:hover { background: var(--teal-tint); border-color: transparent; }
.btn-small { min-height: 36px; padding: 7px 14px; font-size: .92rem; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--teal-tint); }

/* The round + button that adds something, bottom right on phones. */
.fab {
  position: fixed; z-index: 30;
  right: 18px; bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  display: inline-flex; align-items: center; gap: 8px;
  height: 56px; padding: 0 22px 0 18px;
  font: 600 1.05rem/1 var(--font-display);
  color: #fff; background: var(--coral);
  border: 0; border-radius: 999px; cursor: pointer;
  box-shadow: 0 4px 0 #B8403E, var(--shadow-lift);
}
.fab:active { transform: translateY(3px); box-shadow: 0 1px 0 #B8403E, var(--shadow); }
.fab svg { width: 22px; height: 22px; }

/* -------------------------------- forms --------------------------------- */

.field { display: block; margin-bottom: 16px; }
.label { display: block; font-weight: 800; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=datetime-local], input[type=search], select, textarea {
  width: 100%;
  min-height: 46px;
  font: inherit;
  padding: 10px 14px;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23165A66' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; padding-right: 40px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal-2); box-shadow: 0 0 0 4px var(--teal-tint); }
input::placeholder, textarea::placeholder { color: #A99B8D; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
.row-tight { display: flex; gap: 8px; align-items: center; }

.password-wrap { position: relative; display: block; }
.password-wrap input { padding-right: 70px; }
.reveal {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  font: 800 .85rem var(--font-body); color: var(--teal-2);
  background: none; border: 0; padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.reveal:hover { background: var(--teal-tint); }

.check { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--teal); }

.form-error {
  background: var(--coral-tint);
  border: 2px solid var(--coral);
  color: #8E2A2C;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-weight: 700;
}
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }

/* A row of choices that look like big friendly buttons (event types, period kinds). */
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; }
.choice-row.field { margin-bottom: 18px; }
.choice-row legend { font-weight: 800; margin-bottom: 6px; padding: 0; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; pointer-events: none; }
.choice > span {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; min-height: 42px;
  border: 2px solid var(--line-strong); border-radius: 999px; background: #fff;
  font-weight: 800; cursor: pointer; user-select: none;
}
.choice input:checked + span { border-color: var(--teal); background: var(--teal-tint); color: var(--teal); }
.choice input:focus-visible + span { outline: 3px solid var(--coral); outline-offset: 2px; }

/* --------------------------------- cards -------------------------------- */

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h2, .card-head h3 { margin: 0; }
.section-title { display: flex; align-items: center; gap: 8px; margin: 26px 4px 10px; font: 600 1.15rem var(--font-display); color: var(--teal); }
.section-title .icon { width: 26px; height: 26px; }

.empty {
  text-align: center; padding: 30px 18px; color: var(--muted);
  border: 2px dashed var(--line-strong); border-radius: var(--radius); background: rgba(255,255,255,.6);
}
.empty img { width: 56px; height: 56px; display: block; margin: 0 auto 10px; }
.empty strong { display: block; color: var(--ink); font: 600 1.1rem var(--font-display); margin-bottom: 4px; }

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 999px;
  font-size: .8rem; font-weight: 800;
  background: var(--teal-tint); color: var(--teal);
}
.pill-warn { background: var(--warn-tint); color: var(--warn); }
.pill-coral { background: var(--coral-tint); color: var(--coral-deep); }

.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--tan-tint); border: 2px solid var(--pad);
  font-weight: 600;
}
.notice-warn { background: var(--warn-tint); border-color: #F2C66B; }
.notice-coral { background: var(--coral-tint); border-color: #F7A8A6; }
.notice .icon { width: 24px; height: 24px; }

/* ------------------------------ app layout ------------------------------ */

.page { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 8px 14px; padding-top: calc(8px + env(safe-area-inset-top, 0px));
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand img { width: 62px; height: auto; display: block; }
.brand-tag { font: 500 .92rem var(--font-display); color: var(--muted); display: none; }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.tabs { display: none; }
.main { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 16px 14px calc(var(--nav-h) + var(--safe-b) + 92px); }
.main.wide { max-width: 1400px; }

.bottom-nav {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--muted);
  font: 600 .8rem var(--font-display);
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav a img { width: 28px; height: 28px; filter: grayscale(.85) opacity(.7); transition: transform .15s, filter .15s; }
.bottom-nav a.is-active { color: var(--teal); }
.bottom-nav a.is-active img { filter: none; transform: translateY(-2px) scale(1.08); }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 2px 12px; }
.page-head h1 { margin: 0; display: flex; align-items: center; gap: 10px; }
.page-head h1 img { width: 34px; height: 34px; }

@media (min-width: 820px) {
  .brand img { width: 70px; }
  .brand-tag { display: inline; }
  .topbar { padding: 10px 24px; }
  .tabs { display: flex; gap: 4px; margin-left: 18px; }
  .tab {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 16px; border-radius: 999px;
    text-decoration: none; color: var(--muted);
    font: 600 1.02rem var(--font-display);
  }
  .tab img { width: 24px; height: 24px; filter: grayscale(.8) opacity(.75); }
  .tab:hover { background: var(--teal-tint); color: var(--teal); }
  .tab.is-active { background: var(--teal); color: #fff; }
  .tab.is-active img { filter: none; }
  .bottom-nav { display: none; }
  .main { padding: 24px 24px 60px; }
  .fab { bottom: 28px; right: 28px; }
}

.site-footer {
  text-align: center; font-size: .82rem; color: var(--muted);
  padding: 10px 16px calc(var(--nav-h) + var(--safe-b) + 14px);
}
.site-footer a { color: var(--muted); }
@media (min-width: 820px) { .site-footer { padding-bottom: 20px; } }

/* ---------------------------- settings menu ----------------------------- */

.menu { position: relative; }
.menu-button {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px 4px 4px; border: 0; border-radius: 999px;
  background: transparent; cursor: pointer;
}
.menu-button:hover { background: var(--teal-tint); }
.menu-name { font-weight: 800; display: none; }
@media (min-width: 820px) { .menu-name { display: inline; } }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50;
  width: min(300px, calc(100vw - 24px));
  background: #fff; border-radius: 18px; box-shadow: var(--shadow-lift);
  padding: 8px; border: 1px solid var(--line);
}
.menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head strong { display: block; font: 600 1.05rem var(--font-display); color: var(--teal); }
.menu-head span { font-size: .88rem; color: var(--muted); word-break: break-all; }
.menu-list [role=menuitem] {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 12px; border: 0; border-radius: 12px;
  background: transparent; text-align: left; text-decoration: none; color: var(--ink);
  font: 700 .98rem var(--font-body); cursor: pointer;
}
.menu-list [role=menuitem] img { width: 22px; height: 22px; }
.menu-list [role=menuitem]:hover, .menu-list [role=menuitem]:focus-visible { background: var(--teal-tint); outline: none; }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.menu-danger { color: var(--coral-deep) !important; }

/* ------------------------------- avatars -------------------------------- */

.avatar {
  --c: var(--teal);
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--c); color: #fff;
  font: 600 1rem/1 var(--font-display);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.12);
}
.avatar-lg { width: 52px; height: 52px; font-size: 1.4rem; }
.avatar-sm { width: 26px; height: 26px; font-size: .8rem; }
.avatar-xs { width: 20px; height: 20px; font-size: .68rem; box-shadow: none; }

/* --------------------------- the person picker -------------------------- */

/* Wraps onto as many lines as it needs, so every person is always in view. */
.people { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 2px 10px; margin: 0 -2px 6px; }
.person-chip {
  --c: var(--teal);
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  padding: 5px 14px 5px 5px; min-height: 46px;
  border: 2px solid var(--line-strong); border-radius: 999px;
  background: #fff; cursor: pointer; font-weight: 800;
  transition: border-color .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
}
.person-chip[aria-pressed=true], .person-chip[aria-checked=true] {
  border-color: var(--c);
  background: color-mix(in srgb, var(--c) 16%, white);
}
.person-chip .tick { width: 18px; height: 18px; margin-left: -2px; color: var(--c); display: none; }
.person-chip[aria-pressed=true] .tick { display: block; }
.person-chip.all { padding-left: 14px; }

/* A record tinted with its person's color. */
.tinted {
  --c: var(--teal);
  border-left: 6px solid var(--c);
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 9%, white), #fff 70%);
}

/* -------------------------------- dialogs ------------------------------- */

.dialog {
  border: 0; padding: 0; border-radius: 24px;
  width: min(560px, calc(100vw - 20px)); max-height: calc(100vh - 30px);
  box-shadow: var(--shadow-lift);
  color: var(--ink);
}
.dialog::backdrop { background: rgba(22, 50, 56, .45); backdrop-filter: blur(2px); }
@media (max-width: 600px) {
  .dialog {
    margin: auto auto 0; width: 100vw; max-width: 100vw; border-radius: 24px 24px 0 0;
    max-height: calc(100dvh - 24px);
  }
}
.dialog-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 16px 10px 22px; background: #fff;
}
.dialog-head h2 { margin: 0; }
.dialog-body { padding: 4px 22px 22px; }
.dialog-actions {
  display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
  margin-top: 18px;
}
.dialog-actions .spacer { flex: 1; }
@media (max-width: 600px) {
  .dialog-actions { position: sticky; bottom: 0; background: #fff; padding: 12px 0 calc(6px + var(--safe-b)); margin-bottom: -10px; }
  .dialog-actions .btn { flex: 1; }
  .dialog-actions .btn-ghost { flex: none; }
}

#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 18px); z-index: 100;
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  background: var(--teal); color: #fff;
  padding: 12px 20px; border-radius: 999px; font-weight: 800;
  box-shadow: var(--shadow-lift); transition: transform .25s, opacity .25s;
  max-width: calc(100vw - 30px); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--coral-deep); }

/* ------------------------------ sign-in pages ---------------------------- */

.auth { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.auth-art {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 26px 20px 20px;
  background:
    radial-gradient(circle at 12% 18%, var(--coral-tint) 0 14%, transparent 15%),
    radial-gradient(circle at 92% 80%, var(--teal-tint) 0 20%, transparent 21%),
    var(--tan-tint);
}
.auth-logo { width: min(210px, 56vw); position: relative; z-index: 1; }
.auth-pitch { position: relative; z-index: 1; margin: 12px 0 0; text-align: center; font: 500 1.1rem/1.35 var(--font-display); color: var(--teal); }
.auth-pitch-more { display: none; }
.auth-panel { display: flex; flex-direction: column; align-items: center; padding: 22px 16px 30px; }
.auth-card { width: 100%; max-width: 430px; }
.auth-card h1 { font-size: 1.6rem; }
.auth-switch { text-align: center; margin: 18px 0 0; }
.or-line { display: flex; align-items: center; gap: 12px; margin: 18px 0 14px; color: var(--muted); font-size: .9rem; font-weight: 800; }
.or-line::before, .or-line::after { content: ''; flex: 1; border-top: 2px dashed var(--line-strong); }
.done { text-align: center; }
.done .btn { margin-top: 8px; }
.done-badge { width: 72px; height: 72px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--tan-tint); border-radius: 50%; }
.done-badge img { width: 44px; height: 44px; }
.dev-note { background: var(--warn-tint); border: 2px dashed #E3B45B; border-radius: var(--radius-sm); padding: 8px 12px; font-size: .9rem; }
.code-input { text-transform: uppercase; letter-spacing: .18em; font: 700 1.25rem var(--font-display) !important; text-align: center; }
.joining { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--teal-tint); margin-bottom: 16px; }
.doodle { position: absolute; width: 38px; height: 38px; opacity: .9; z-index: 0; }
/* On a phone the panel is short, so the two lowest pictures would sit on the tagline. */
.doodle.low { display: none; }
.auth-choices { display: grid; gap: 10px; }

@media (min-width: 820px) {
  .auth { grid-template-columns: 1.05fr 1fr; grid-template-rows: none; }
  .auth-art { padding: 48px 32px; }
  .auth-logo { width: min(340px, 70%); }
  .auth-pitch { font-size: 1.3rem; max-width: 360px; margin-top: 22px; }
  .auth-pitch-more { display: block; margin-top: 10px; color: var(--muted); font: 500 1rem var(--font-body); max-width: 360px; text-align: center; position: relative; z-index: 1; }
  .auth-panel { justify-content: center; padding: 40px 24px; }
  .doodle { width: 52px; height: 52px; }
  .doodle.low { display: block; }
  .auth-choices { grid-template-columns: 1fr 1fr; }
}

/* -------------------------------- household ----------------------------- */

.member-list { display: grid; gap: 12px; }
.member { padding: 0; overflow: hidden; }
.member-summary {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 14px 16px; border: 0; background: transparent; text-align: left; cursor: pointer;
}
.member-summary .who { flex: 1; min-width: 0; }
.member-summary .who strong { display: block; font: 600 1.15rem var(--font-display); color: var(--ink); }
.member-summary .who span { font-size: .88rem; color: var(--muted); }
.member-summary .chev { transition: transform .2s; color: var(--muted); }
.member[open] .member-summary .chev { transform: rotate(180deg); }
.member-body { padding: 0 16px 16px; border-top: 1px solid var(--line); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 14px 0; }
.fact { background: var(--page); border-radius: 14px; padding: 10px 12px; }
.fact .k { font-size: .78rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.fact .v { font: 600 1.12rem var(--font-display); }
.fact .d { font-size: .8rem; color: var(--muted); }
.member-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.invite-box { margin-top: 14px; padding: 14px; border-radius: 14px; background: var(--teal-tint); }
.invite-code { font: 700 1.6rem var(--font-display); letter-spacing: .14em; color: var(--teal); user-select: all; }
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.swatch {
  aspect-ratio: 1; border-radius: 50%; border: 3px solid #fff; background: var(--c);
  box-shadow: 0 0 0 2px var(--line-strong); cursor: pointer; padding: 0;
}
.swatch[aria-checked=true] { box-shadow: 0 0 0 3px var(--ink); }
.vitals-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.vitals-table th, .vitals-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.vitals-table th { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* --------------------------------- history ------------------------------ */

.timeline { position: relative; display: grid; gap: 12px; padding-left: 4px; }
.month-label { font: 600 1rem var(--font-display); color: var(--muted); margin: 14px 4px 0; }
.event { display: flex; gap: 14px; align-items: flex-start; cursor: pointer; border: 0; text-align: left; width: 100%; font: inherit; }
.event:hover { box-shadow: var(--shadow-lift); }
.event-icon { flex: none; width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; background: var(--tan-tint); }
.event-icon img { width: 34px; height: 34px; }
.event-main { flex: 1; min-width: 0; }
.event-title { font: 600 1.08rem var(--font-display); color: var(--ink); margin: 0; }
.event-meta { font-size: .86rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 2px; }
.event-details { margin: 8px 0 0; white-space: pre-wrap; color: var(--ink); font-size: .96rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.who-dots { display: inline-flex; gap: 3px; }
.kind-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.kind-grid .choice > span { flex-direction: column; width: 100%; border-radius: 16px; padding: 10px 6px; gap: 4px; font-size: .86rem; }
.kind-grid .choice img { width: 34px; height: 34px; }

/* ---------------------------------- meds -------------------------------- */

.timers { display: grid; gap: 10px; }
.timer {
  display: flex; align-items: center; gap: 14px;
}
.timer-clock {
  flex: none; width: 78px; height: 78px; border-radius: 50%;
  display: grid; place-items: center; text-align: center;
  background: conic-gradient(var(--c, var(--teal)) calc(var(--p, 0) * 1%), color-mix(in srgb, var(--c, var(--teal)) 15%, white) 0);
  position: relative;
}
.timer-clock::before { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: #fff; }
.timer-clock span { position: relative; font: 700 1rem/1.05 var(--font-display); color: var(--ink); }
.timer-clock small { display: block; font: 700 .64rem var(--font-body); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.timer-main { flex: 1; min-width: 0; }
.timer-main strong { font: 600 1.1rem var(--font-display); }
.timer-ready { color: var(--ok); font-weight: 800; }
.timer-wait { color: var(--warn); font-weight: 800; }
.med-list { display: grid; gap: 10px; }
.med { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.med:hover { box-shadow: var(--shadow-lift); }
.med-name { font: 600 1.08rem var(--font-display); }
.med-sub { font-size: .9rem; color: var(--muted); }
.med.inactive { opacity: .6; }
.dose-row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.dose-row:last-child { border-bottom: 0; }
.suggest {
  border-radius: 16px; padding: 12px 14px; margin-bottom: 10px;
  background: color-mix(in srgb, var(--c, var(--teal)) 10%, white);
  border: 2px solid color-mix(in srgb, var(--c, var(--teal)) 35%, white);
}
.suggest-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.suggest-amount { font: 600 1.35rem var(--font-display); color: var(--ink); }
.next-box {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px; border-radius: 16px; background: var(--teal-tint); margin-top: 6px;
}
.next-box strong { font: 600 1.1rem var(--font-display); color: var(--teal); }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper input { width: 84px; text-align: center; }
.product-list { display: grid; gap: 8px; }
.product { display: flex; align-items: center; gap: 12px; }

/* --------------------------------- periods ------------------------------ */

.cycle-card { display: flex; gap: 16px; align-items: center; }
.cycle-ring {
  flex: none; width: 112px; height: 112px; border-radius: 50%;
  display: grid; place-items: center; text-align: center; position: relative;
  background: conic-gradient(var(--c, var(--coral)) calc(var(--p, 0) * 1%), color-mix(in srgb, var(--c, var(--coral)) 15%, white) 0);
}
.cycle-ring::before { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: #fff; }
.cycle-ring span { position: relative; font: 700 2rem/1 var(--font-display); color: var(--ink); }
.cycle-ring small { display: block; font: 800 .7rem var(--font-body); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }
.cycle-facts { display: grid; gap: 4px; font-size: .95rem; }
.cycle-facts b { font-family: var(--font-display); font-weight: 600; }
.entry { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.entry:hover { box-shadow: var(--shadow-lift); }
.entry .event-icon { width: 42px; height: 42px; border-radius: 14px; }
.entry .event-icon img { width: 28px; height: 28px; }

/* ----------------------------------- labs ------------------------------- */

.labs-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.labs-toolbar input[type=search] { flex: 1; min-width: 160px; }
.sheet-wrap {
  overflow: auto; max-height: calc(100vh - 230px); max-height: calc(100dvh - 230px);
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 820px) { .sheet-wrap { max-height: calc(100vh - 220px); } }
.sheet { border-collapse: separate; border-spacing: 0; font-size: .9rem; }
.sheet th, .sheet td { padding: 6px 10px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); white-space: nowrap; }
.sheet thead th {
  position: sticky; top: 0; z-index: 3; background: var(--teal); color: #fff;
  font: 600 .9rem var(--font-display); text-align: center; cursor: pointer;
}
.sheet thead th.corner { left: 0; z-index: 5; text-align: left; cursor: default; }
.sheet thead th .draw-note { display: block; font: 600 .7rem var(--font-body); opacity: .9; max-width: 120px; overflow: hidden; text-overflow: ellipsis; margin: 2px auto 0; }
.sheet thead th.highlight { background: var(--coral); }
.sheet tbody th {
  position: sticky; left: 0; z-index: 2; background: #fff; text-align: left;
  font-weight: 800; cursor: pointer; min-width: 150px; max-width: 220px;
  white-space: normal; line-height: 1.25;
  box-shadow: 2px 0 0 var(--line);
}
.sheet tbody th:hover { color: var(--teal-2); }
.sheet tbody th .unit { display: block; font: 600 .74rem var(--font-body); color: var(--muted); }
.sheet td { text-align: right; min-width: 74px; cursor: cell; font-variant-numeric: tabular-nums; }
.sheet td.text { text-align: left; white-space: normal; min-width: 110px; font-size: .84rem; }
/* On a phone every pixel of the frozen name column is a pixel of results lost. */
@media (max-width: 600px) {
  .sheet { font-size: .84rem; }
  .sheet tbody th { min-width: 112px; max-width: 132px; font-size: .8rem; padding: 6px 8px; }
  .sheet td { min-width: 60px; padding: 6px 7px; }
  .sheet td.text { min-width: 90px; }
}
.sheet td.high { background: var(--high-tint); font-weight: 800; }
.sheet td.low { background: var(--low-tint); font-weight: 800; }
.sheet td.flag::after { content: attr(data-flag); font-size: .7rem; margin-left: 3px; }
.sheet td.col-highlight { background: color-mix(in srgb, var(--coral) 9%, white); }
.sheet tr.section th, .sheet tr.section td {
  background: var(--tan-tint); color: var(--coral-deep);
  font: 700 .82rem var(--font-display); text-transform: uppercase; letter-spacing: .05em;
  cursor: default; position: sticky; left: 0;
}
.sheet tr.tracker th { background: var(--teal-tint); }
.sheet tr.tracker td { background: color-mix(in srgb, var(--teal-tint) 55%, white); }
.sheet td:hover { outline: 2px solid var(--teal-2); outline-offset: -2px; }
.sheet .cell-input { width: 100%; min-width: 70px; min-height: 0; padding: 2px 4px; border: 0; border-radius: 4px; font: inherit; text-align: inherit; box-shadow: 0 0 0 2px var(--teal-2); }

.chart-box svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-box .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart-box .grid { stroke: var(--line); stroke-width: 1; }
.chart-box .tick { font: 600 12px var(--font-body); fill: var(--muted); }
.chart-box .line { fill: none; stroke: var(--teal); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-box .band { fill: color-mix(in srgb, var(--ok) 12%, white); }
.chart-box .limit { stroke: var(--ok); stroke-width: 1.5; stroke-dasharray: 5 4; fill: none; }
.chart-box .pt { fill: #fff; stroke: var(--teal); stroke-width: 2.5; }
.chart-box .pt.out { fill: var(--coral); stroke: var(--coral-deep); }
.chart-box .pt-label { font: 800 12px var(--font-body); fill: var(--ink); paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .85rem; color: var(--muted); margin-top: 8px; }
.chart-legend i { display: inline-block; width: 18px; height: 0; border-top: 2px dashed var(--ok); vertical-align: middle; margin-right: 5px; }
.value-list { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: .92rem; }
.value-list td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
.value-list td:last-child { text-align: right; font-weight: 800; }
.range-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 8px; }
.range-row .field { margin: 0; }

/* -------------------------------- privacy ------------------------------- */

.prose { max-width: 720px; margin: 0 auto; padding: 24px 18px 60px; }
.prose h1 { margin-top: 18px; }
.prose h2 { margin-top: 28px; }

/* The History type filter: the person chips' look, a little smaller. On a
   phone it folds away behind one "Types: All" button. */
.kind-filter { margin: -4px 0 8px; }
.kind-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 6px 12px; border: 2px solid var(--line-strong); border-radius: 999px;
  background: #fff; font-weight: 700; cursor: pointer; color: var(--ink);
}
.kind-toggle strong { color: var(--teal); }
.kind-toggle svg { transition: transform .2s; }
.kind-filter.open .kind-toggle svg { transform: rotate(180deg); }
.kind-filter .kinds { display: none; margin-top: 8px; }
.kind-filter.open .kinds { display: flex; }
@media (min-width: 820px) {
  .kind-toggle { display: none; }
  .kind-filter .kinds { display: flex; margin-top: 0; }
}
.kind-chip { min-height: 38px; padding: 4px 12px 4px 8px; font-size: .9rem; }
.kind-chip.all { padding-left: 12px; }
.kind-chip .kind-icon { width: 22px; height: 22px; }
.kind-chip[aria-pressed=true] { border-color: var(--teal); background: var(--teal-tint); }
.kind-chip[aria-pressed=true] .tick { display: block; color: var(--teal); }
