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

:root {
  --bg: #EEF4FB;
  --ink: #1A3F5C;
  --ink-soft: #4a6b85;
  --accent: #5BA4D9;
  --accent-strong: #2E7BB8;
  --surface: #ffffff;
  --surface-alt: #f0f5fa;
  --border: #d8e3ee;
  --danger: #c0392b;
  --success: #2e8b57;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
}

/* ── Sidebar layout ─────────────────────────────────────── */

:root {
  --sidebar-width: 232px;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--ink);
  color: var(--bg);
  padding: 1.5rem 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  z-index: 30;
  transition: transform 0.22s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0 0.5rem;
}

.sidebar-emoji {
  font-size: 1.7rem;
  line-height: 1;
}

.sidebar-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  color: var(--bg);
  line-height: 1.1;
}

.sidebar-tagline {
  font-size: 0.72rem;
  opacity: 0.55;
  font-style: italic;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  overflow-y: auto;
}

.sidebar-divider {
  height: 1px;
  background: rgba(238, 244, 251, 0.12);
  margin: 0.6rem 0.5rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.85rem;
  padding: 0.65rem 0.5rem 0;
  border-top: 1px solid rgba(238, 244, 251, 0.12);
  flex-wrap: wrap;
}

.user-chip img,
.user-chip .avatar-fallback {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  object-fit: cover;
  font-size: 0.85rem;
}

.user-chip .chip-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip #logout-btn,
.user-chip #upgrade-btn,
.user-chip #billing-btn,
.user-chip .install-btn {
  color: rgba(238, 244, 251, 0.7);
  background: transparent;
  border: 1px solid rgba(238, 244, 251, 0.22);
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  flex: 1 1 auto;
}

.user-chip #logout-btn:hover,
.user-chip #upgrade-btn:hover,
.user-chip #billing-btn:hover,
.user-chip .install-btn:hover {
  color: var(--bg);
  border-color: rgba(238, 244, 251, 0.5);
}

/* Post-join "add to home screen" nudge (shown only after sign-in) */
.install-nudge {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translate(-50%, 140%);
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 12px;
  width: calc(100% - 32px);
  max-width: 460px;
  padding: 12px 14px;
  background: var(--ink, #1A3F5C);
  color: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(26, 63, 92, 0.35);
  transition: transform 0.25s ease;
}
.install-nudge.show { transform: translate(-50%, 0); }
.install-nudge img { border-radius: 50%; display: block; flex-shrink: 0; }
.install-nudge-text { flex: 1; min-width: 0; line-height: 1.3; }
.install-nudge-text strong { display: block; font-size: 0.9rem; }
.install-nudge-text span { font-size: 0.78rem; color: rgba(255, 255, 255, 0.75); }
.install-nudge-go {
  flex-shrink: 0;
  background: #fff;
  color: var(--ink, #1A3F5C);
  border: none;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.install-nudge-go:hover { background: rgba(255, 255, 255, 0.9); }
.install-nudge-x {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
}
.install-nudge-x:hover { color: #fff; }

/* ── Login / auth welcome screen ───────────────────────────── */

body.auth-screen {
  background: linear-gradient(160deg, #EEF4FB 0%, #D6E8F7 100%);
}

body.auth-screen main {
  margin: 0;
  max-width: none;
  padding: 0;
}

.auth-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  position: relative;
  overflow: hidden;
}

.auth-decor { position: absolute; inset: 0; pointer-events: none; }

.auth-decor::before {
  content: '';
  position: absolute;
  top: -150px; right: -130px;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(91, 164, 217, 0.20), transparent 70%);
}

.auth-decor::after {
  content: '';
  position: absolute;
  bottom: -130px; left: -130px;
  width: 360px; height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232, 168, 56, 0.13), transparent 70%);
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid rgba(168, 203, 232, 0.45);
  border-radius: 18px;
  padding: 2.5rem 2.25rem;
  box-shadow: 0 14px 44px rgba(26, 63, 92, 0.15);
  text-align: center;
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-bottom: 1.6rem;
}

.auth-emoji {
  width: 52px; height: 52px;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.auth-name {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--ink);
  line-height: 1.1;
  text-align: left;
}

.auth-tagline {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 0.8rem;
  color: var(--ink-soft);
  text-align: left;
}

.auth-title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: clamp(1.7rem, 6vw, 2.1rem);
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.auth-sub {
  color: var(--ink-soft);
  font-size: 0.97rem;
  line-height: 1.55;
  max-width: 34ch;
  margin: 0 auto 1.6rem;
}

.auth-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.8rem 1rem;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(26, 63, 92, 0.08);
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}

.auth-google:hover {
  border-color: var(--accent);
  box-shadow: 0 5px 16px rgba(46, 123, 184, 0.18);
  transform: translateY(-1px);
}

.auth-google:disabled { opacity: 0.6; cursor: default; transform: none; }

.auth-google svg { width: 18px; height: 18px; flex-shrink: 0; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.6rem 0 1rem;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-why {
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.55;
  margin-bottom: 0.9rem;
}

.auth-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 1.4rem;
}

.auth-chips span {
  font-size: 0.78rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--accent-strong);
  border: 1px solid rgba(168, 203, 232, 0.5);
}

.auth-note {
  font-size: 0.78rem;
  color: var(--ink-soft);
  opacity: 0.9;
}

.auth-fineprint {
  margin-top: 0.6rem;
  font-size: 0.75rem;
  color: var(--ink-soft);
}
.auth-fineprint a { color: var(--accent-strong); text-decoration: none; }
.auth-fineprint a:hover { text-decoration: underline; }

/* ── Plan badge + usage banner ─────────────────────────────── */

.plan-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  margin-left: 0.1rem;
}

.plan-badge.plan-free { color: rgba(238, 244, 251, 0.6); }
.plan-badge.plan-pro  { color: #f5c451; }

.usage-banner {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 1rem;
  row-gap: 0.4rem;
  align-items: center;
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin: 0.75rem 0 1rem;
}

.usage-banner.usage-full {
  background: #fff4ec;
  border: 1px solid #f5c188;
}

.usage-meter {
  grid-column: 1 / -1;
  background: rgba(26, 63, 92, 0.1);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
}

.usage-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-strong) 100%);
  transition: width 0.3s;
}

.usage-banner.usage-full .usage-fill {
  background: linear-gradient(90deg, #e88c4d 0%, #c0392b 100%);
}

.usage-text {
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.usage-text strong {
  color: var(--ink);
}

#usage-upgrade {
  color: var(--accent-strong);
  border: 1px solid var(--accent);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  background: white;
}

#usage-upgrade:hover:not([disabled]) {
  background: var(--accent);
  color: white;
}

#usage-upgrade[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Paywall modal ─────────────────────────────────────────── */

.paywall-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 63, 92, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 50;
  animation: fadein 0.15s ease;
}

@keyframes fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.paywall {
  max-width: 460px;
  width: 100%;
  text-align: center;
}

.paywall-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.plan-picker {
  display: flex;
  gap: 0.75rem;
  margin: 1.25rem 0 0.25rem;
  justify-content: center;
  flex-wrap: wrap;
}

.plan-option {
  flex: 1 1 140px;
  max-width: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border: 2px solid rgba(26, 63, 92, 0.12);
  border-radius: 12px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  color: var(--ink);
  transition: border-color 0.15s, background 0.15s, transform 0.05s;
}

.plan-option:hover {
  border-color: rgba(26, 63, 92, 0.3);
}

.plan-option.selected {
  border-color: var(--accent);
  background: rgba(91, 164, 217, 0.1);
}

.plan-option:active {
  transform: translateY(1px);
}

.plan-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.plan-price {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
}

.plan-cadence {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-soft);
  margin-left: 0.15rem;
}

.plan-note {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.muted {
  color: var(--ink-soft);
  font-size: 0.85rem;
  margin-top: 1rem;
}

/* The HTML hidden attribute sets display:none, but any explicit display
   rule (e.g. nav { display: flex }) overrides it. Force hidden to win. */
[hidden] { display: none !important; }

.sidebar-nav button {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.55rem 0.7rem;
  border: none;
  background: transparent;
  color: rgba(238, 244, 251, 0.72);
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav button:hover {
  color: var(--bg);
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-nav button.active {
  color: var(--bg);
  background: rgba(91, 164, 217, 0.22);
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-nav .nav-icon {
  font-size: 1.05rem;
  width: 1.4rem;
  text-align: center;
}

.sidebar-nav .nav-quick-add {
  color: var(--bg);
}

.sidebar-nav .nav-quick-add .nav-icon {
  color: #f5c451;
}

/* ── Mobile drawer ──────────────────────────────────────── */

.sidebar-toggle {
  position: fixed;
  top: 0.85rem;
  left: 0.85rem;
  z-index: 40;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
}

.sidebar-toggle span {
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}

.sidebar-scrim {
  position: fixed;
  inset: 0;
  background: rgba(26, 63, 92, 0.45);
  z-index: 25;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.sidebar-scrim.visible {
  opacity: 1;
}

main {
  margin: 0 0 0 var(--sidebar-width);
  padding: 2rem 2rem 4rem;
  max-width: calc(960px + var(--sidebar-width));
}

.card {
  background: var(--surface);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 2px 12px rgba(26, 63, 92, 0.08);
}

h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

.lede {
  color: var(--ink-soft);
  margin-bottom: 1.5rem;
}

/* ── Wizard ──────────────────────────────────────────────── */

.wizard-progress {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.wizard-progress .step {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  transition: background 0.2s;
}

.wizard-progress .step.active,
.wizard-progress .step.done {
  background: var(--accent);
}

.wizard-step {
  display: none;
}

.wizard-step.active {
  display: block;
}

.step-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-strong);
  margin-bottom: 0.5rem;
}

.wizard-step-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.wizard-step-head .step-label { margin-bottom: 0; }
.wizard-skip-all {
  font-size: 0.8rem;
  color: var(--ink-soft);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.wizard-skip-all:hover { color: var(--ink); text-decoration: underline; }

.choice-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

/* ── Buttons ─────────────────────────────────────────────── */

button.primary,
button.secondary,
button.ghost,
button.danger {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}

button.primary {
  background: var(--accent-strong);
  color: white;
}

button.primary:hover {
  background: #246199;
}

button.secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
}

button.secondary:hover {
  background: var(--surface-alt);
}

button.ghost {
  background: transparent;
  color: var(--ink-soft);
}

button.ghost:hover {
  color: var(--ink);
}

button.danger {
  background: transparent;
  color: var(--danger);
  border-color: transparent;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
}

button.danger:hover {
  text-decoration: underline;
}

/* ── Forms ───────────────────────────────────────────────── */

form .field {
  display: block;
  margin-bottom: 1rem;
}

form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 0.3rem;
}

form label .hint {
  font-weight: 400;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

form input[type="text"],
form input[type="number"],
form input[type="date"],
form select,
form textarea {
  width: 100%;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}

form input:focus,
form select:focus,
form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 164, 217, 0.15);
}

form .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.reminder-options {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.reminder-options label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  margin-bottom: 0;
  transition: all 0.15s;
}

.reminder-options input[type="radio"] {
  display: none;
}

.reminder-options input[type="radio"]:checked + span {
  color: var(--accent-strong);
}

.reminder-options label:has(input:checked) {
  border-color: var(--accent);
  background: rgba(91, 164, 217, 0.08);
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

/* ── Item list / cards ───────────────────────────────────── */

.item-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.9rem 1rem;
  background: var(--surface-alt);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}

.item-actions,
.vaccine-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  flex-shrink: 0;
}

.item-title {
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.item-meta {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.item-meta span + span::before {
  content: ' · ';
  opacity: 0.5;
}

/* Expandable item detail (e.g. a recipe's ingredients & instructions) */
.item-detail {
  margin-top: 0.5rem;
}

.item-detail > summary {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-strong);
  width: fit-content;
  list-style: revert;
}

.item-detail > summary:hover { text-decoration: underline; }

.item-detail-body {
  margin-top: 0.6rem;
  padding-left: 0.85rem;
  border-left: 2px solid var(--border);
}

.rec-section { margin-bottom: 0.65rem; }
.rec-section:last-child { margin-bottom: 0; }

.rec-h {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 0.2rem;
}

.rec-body {
  font-size: 0.9rem;
  color: var(--ink);
  white-space: pre-wrap;
  line-height: 1.5;
}

.receipt-link,
.cal-link {
  color: var(--deep-winter, #2c5f8a);
  text-decoration: none;
  cursor: pointer;
}

.receipt-link:hover,
.cal-link:hover { text-decoration: underline; }

.cal-link.cal-alt {
  margin-left: 0.4rem;
  font-size: 0.78rem;
  opacity: 0.75;
}

.coming-soon {
  margin: 0.75rem 0 1rem;
  padding: 0.65rem 0.85rem;
  background: rgba(91, 164, 217, 0.12);
  border: 1px dashed var(--accent);
  border-radius: 0.5rem;
  font-size: 0.9rem;
  color: var(--accent-strong);
}

.cat-note {
  margin: -0.25rem 0 1rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.empty {
  color: var(--ink-soft);
  font-style: italic;
  padding: 1rem 0;
}

/* ── Dashboard tiles ─────────────────────────────────────── */

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.tile {
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 1rem 1.25rem;
}

.tile .tile-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 0.4rem;
}

.tile .tile-value {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  color: var(--ink);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

/* ── Misc ────────────────────────────────────────────────── */

.banner {
  background: rgba(91, 164, 217, 0.12);
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: white;
  padding: 0.7rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 100;
}

.toast.show {
  opacity: 1;
}

.masked {
  font-family: monospace;
  letter-spacing: 0.1em;
}

.secret {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.secret .secret-value.masked {
  user-select: none;
}

.secret.revealed .secret-value {
  font-family: monospace;
  letter-spacing: normal;
  user-select: all;
}

.reveal-secret {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 0.78rem;
  color: var(--deep-winter, #2c5f8a);
  cursor: pointer;
  text-decoration: underline;
}

.reveal-secret:hover { color: var(--accent-strong, #2c5f8a); }

@media (max-width: 600px) {
  form .row {
    grid-template-columns: 1fr;
  }
  .reminder-options {
    flex-direction: column;
  }
  .card {
    padding: 1.25rem;
  }
}

/* ── Mobile sidebar drawer ──────────────────────────────── */

@media (max-width: 880px) {
  .sidebar-toggle {
    display: flex;
  }
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(26, 63, 92, 0.25);
  }
  body.sidebar-open .sidebar {
    transform: translateX(0);
  }
  main {
    margin-left: 0;
    padding: 4rem 1rem 4rem;
    max-width: 100%;
  }
}

/* ── Pets ──────────────────────────────────────────────── */

.pet-card {
  background: var(--surface-alt);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  border-left: 3px solid var(--accent);
  margin-bottom: 0.85rem;
}

.pet-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.pet-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.15rem;
}

.pet-meta {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.pet-meta span + span::before {
  content: ' · ';
  opacity: 0.5;
}

.vaccine-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin: 0.85rem 0 0.4rem;
}

.vaccine-list {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.vaccine-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--surface);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.88rem;
}

.vaccine-item .vaccine-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.vaccine-edit-form-container:empty { display: none; }

.vaccine-item .vaccine-name {
  font-weight: 600;
  color: var(--ink);
}

.vaccine-item .vaccine-meta {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.vaccine-item .vaccine-meta span + span::before {
  content: ' · ';
  opacity: 0.5;
}

.vaccine-due-soon {
  color: #b65b16;
  font-weight: 600;
}

.vaccine-overdue {
  color: var(--danger);
  font-weight: 600;
}

.vaccine-empty {
  color: var(--ink-soft);
  font-style: italic;
  font-size: 0.85rem;
  padding: 0.25rem 0;
}

/* Gift card ledger (mirrors the pet-card / vaccine-item structure) */
.gc-card {
  background: var(--surface-alt);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  border-left: 3px solid var(--accent);
  margin-bottom: 0.85rem;
}

.gc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.gc-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.15rem;
}

.gc-sub {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.gc-sub span + span::before { content: ' · '; opacity: 0.5; }

.gc-card-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.gc-card-actions button.danger {
  font-size: 0.8rem;
  padding: 0.3rem 0.65rem;
}

.gc-balance {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.6rem 0 0.2rem;
}

.gc-balance-amount {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}

.gc-balance-amount.zero { color: var(--ink-soft); }

.gc-balance-note {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.gc-ledger-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin: 0.85rem 0 0.4rem;
}

.gc-ledger {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.gc-txn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.88rem;
}

.gc-txn-desc {
  font-weight: 600;
  color: var(--ink);
}

.gc-txn-date {
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.gc-txn-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.gc-txn-amount {
  color: var(--danger);
  font-weight: 700;
}

.gc-txn-right button.danger {
  font-size: 0.78rem;
  padding: 0.25rem 0.55rem;
}

.gc-empty {
  color: var(--ink-soft);
  font-style: italic;
  font-size: 0.85rem;
  padding: 0.25rem 0;
}

.gc-actions { margin-top: 0.25rem; }
.gc-actions button.ghost { font-size: 0.82rem; }

/* Glovebox / vehicle cards (mirrors the pet-card structure) */
.gx-card {
  background: var(--surface-alt);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  border-left: 3px solid var(--accent);
  margin-bottom: 0.85rem;
}

.gx-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.gx-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.15rem;
}

.gx-sub {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.gx-sub span + span::before { content: ' · '; opacity: 0.5; }

.gx-card-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.gx-card-actions button.ghost,
.gx-card-actions button.danger {
  font-size: 0.8rem;
  padding: 0.3rem 0.65rem;
}

.gx-details {
  display: grid;
  gap: 0.3rem;
  margin: 0.7rem 0 0;
}

.gx-detail {
  display: flex;
  gap: 0.6rem;
  font-size: 0.88rem;
}

.gx-detail-label {
  flex: 0 0 110px;
  color: var(--ink-soft);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 1px;
}

.gx-detail-value { color: var(--ink); }

.gx-reminders {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.75rem;
}

.gx-reminder {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border-radius: 6px;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  color: var(--ink);
}

.gx-reminder button.ghost {
  font-size: 0.76rem;
  padding: 0.22rem 0.5rem;
  flex-shrink: 0;
}

/* Vehicle service history (mirrors the vaccine list under a pet) */
.gx-service-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin: 0.95rem 0 0.4rem;
}

.gx-service-list {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.gx-service-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.88rem;
}

.gx-service-name {
  font-weight: 600;
  color: var(--ink);
}

.gx-service-meta {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.gx-service-meta span + span::before { content: ' · '; opacity: 0.5; }

.gx-service-item button.danger {
  font-size: 0.78rem;
  padding: 0.25rem 0.55rem;
  flex-shrink: 0;
}

.gx-empty {
  color: var(--ink-soft);
  font-style: italic;
  font-size: 0.85rem;
  padding: 0.25rem 0;
}

/* VIN lookup + Google spec-search helpers inside the glovebox form */
.vin-lookup-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: -0.2rem 0 0.2rem;
}

.vin-lookup-row button.ghost {
  font-size: 0.82rem;
  padding: 0.35rem 0.7rem;
}

.vin-result {
  font-size: 0.82rem;
  color: #3A7D5C;
}

.vin-result.error { color: var(--danger); }

.spec-search-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 0.9rem;
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
}

.spec-search-row a {
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.spec-search-row a:hover { text-decoration: underline; }

.pet-card-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.pet-card-actions button.ghost,
.pet-card-actions button.danger {
  font-size: 0.8rem;
  padding: 0.3rem 0.65rem;
}

.pet-vet {
  background: rgba(91, 164, 217, 0.08);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  margin: 0 0 0.75rem;
}

.vet-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin-bottom: 0.35rem;
}

.vet-info {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.88rem;
  color: var(--ink);
}

.vet-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 0.5rem;
  align-items: baseline;
}

.vet-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-weight: 600;
}

.vet-info a {
  color: var(--accent-strong);
  text-decoration: none;
}

.vet-info a:hover { text-decoration: underline; }

.form-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin: 1rem 0 0.5rem;
}

.pet-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.pet-actions button.ghost {
  font-size: 0.85rem;
  padding: 0.3rem 0.6rem;
}

.inline-form {
  margin-top: 0.65rem;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* ── Household / sharing ─────────────────────────────────────── */
.hh-plan { color: var(--ink-soft); margin-bottom: 0.5rem; }
.hh-section-label {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-soft); margin: 1.1rem 0 0.5rem;
}
.hh-row {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  background: var(--surface-alt); border-radius: 8px; padding: 0.7rem 0.9rem; margin-bottom: 0.5rem;
}
.hh-row.hh-invite { background: #fff4ec; border: 1px solid #f5c188; }
.hh-name { font-weight: 600; color: var(--ink); }
.hh-email { font-size: 0.85rem; color: var(--ink-soft); }
.hh-tag {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--accent-strong); background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 0.05rem 0.45rem; margin-left: 0.3rem;
}
.hh-add { display: flex; gap: 0.5rem; margin-top: 0.6rem; }
.hh-add input { flex: 1; }
.hh-hint { font-size: 0.82rem; color: var(--ink-soft); margin-top: 0.5rem; }
.hh-toggle {
  display: flex; align-items: flex-start; gap: 0.6rem; cursor: pointer;
  background: var(--surface-alt); border-radius: 8px; padding: 0.7rem 0.9rem;
}
.hh-toggle input { margin-top: 0.15rem; flex: 0 0 auto; }
.hh-toggle span { font-size: 0.88rem; color: var(--ink); line-height: 1.35; }
.hh-upsell { background: var(--surface-alt); border-radius: 10px; padding: 1rem 1.1rem; }
.hh-upsell p { margin-bottom: 0.75rem; color: var(--ink); }

.private-toggle {
  display: flex; align-items: center; gap: 0.5rem; font-size: 0.88rem;
  color: var(--ink-soft); margin: 0.25rem 0 0.6rem; cursor: pointer;
}
.private-toggle input { width: auto; }

.appliance-toggle {
  display: flex; align-items: center; gap: 0.5rem; font-size: 0.88rem;
  color: var(--ink-soft); margin: 0.25rem 0 0.6rem; cursor: pointer;
}
.appliance-toggle input { width: auto; }

.privacy-toggle { font-size: 0.78rem; white-space: nowrap; }
.privacy-toggle.is-private { color: var(--accent); font-weight: 600; }

.shared-tag { font-size: 0.78rem; color: var(--ink-soft); white-space: nowrap; }

/* Collapsible child sections (ledger, service history, vaccines, tasks). */
.collapse-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  margin-top: 0.7rem; padding: 0.55rem 0 0.15rem;
  background: none; border: none; border-top: 1px solid var(--border);
  font: inherit; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-soft); cursor: pointer;
}
.collapse-toggle::after { content: '▸'; margin-left: auto; font-size: 0.85rem; transition: transform 0.15s; }
.collapse-toggle.open::after { transform: rotate(90deg); }
.collapse-toggle:hover { color: var(--accent); }
.collapse-body[hidden] { display: none; }

.maint-due { color: var(--accent); font-weight: 600; }

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.6rem;
  margin: 0.6rem 0 0.8rem;
}
.preset-chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem;
  text-align: left; padding: 0.7rem 0.85rem;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface-alt); cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.preset-chip:hover:not(:disabled) {
  transform: translateY(-1px); border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(44,95,138,0.1);
}
.preset-chip:disabled { cursor: default; }
.preset-chip.added { border-color: var(--accent); }
.preset-emoji { font-size: 1.3rem; }
.preset-name { font-weight: 600; }
.preset-task { font-size: 0.78rem; color: var(--ink-soft); }
.preset-chip.added .preset-task { color: var(--accent); font-weight: 600; }
.preset-custom { margin: 0.2rem 0 0.6rem; }

/* ── Admin ───────────────────────────────────────────────────── */
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.admin-table th {
  text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ink-soft); padding: 0.5rem 0.6rem; border-bottom: 2px solid var(--border); white-space: nowrap;
}
.admin-table td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); color: var(--ink); vertical-align: middle; }
.admin-table select { padding: 0.3rem 0.4rem; font-size: 0.85rem; }
.admin-when { color: var(--ink-soft); white-space: nowrap; }
.admin-table button.ghost { font-size: 0.78rem; padding: 0.3rem 0.6rem; }

/* ── Search (per-category + dashboard global) ────────────────── */
.search-box {
  width: 100%;
  padding: 0.6rem 0.85rem;
  margin: 0 0 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--ink);
}
.search-box:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91, 164, 217, 0.15); }

.dash-household {
  display: flex; align-items: center; gap: 0.8rem;
  background: var(--surface-alt); border-radius: 10px; padding: 0.85rem 1rem; margin-bottom: 1rem;
}
.dash-hh-icon { font-size: 1.6rem; line-height: 1; }
.dash-hh-text { font-size: 0.9rem; color: var(--ink); }
.dash-hh-text a { color: var(--accent-strong); text-decoration: none; font-size: 0.85rem; font-weight: 600; }
.dash-hh-text a:hover { text-decoration: underline; }

.dash-search { margin-bottom: 1.25rem; }
.dash-search .search-box { margin-bottom: 0; }
.global-results { display: grid; gap: 0.3rem; }
.global-results:not(:empty) { margin-top: 0.6rem; }
.gs-result {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.7rem; border-radius: 7px; text-decoration: none;
  background: var(--surface-alt); transition: background 0.12s;
}
.gs-result:hover { background: rgba(91, 164, 217, 0.14); }
.gs-cat {
  font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--accent-strong); background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 0.1rem 0.45rem; flex-shrink: 0; white-space: nowrap;
}
.gs-name { color: var(--ink); font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
