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

:root {
  --bg: #1a1a2e;
  --bg-card: #16213e;
  --bg-input: #0f3460;
  --bg-hover: #1a3a6e;
  --text: #e8e8e8;
  --text-muted: #8a8a9a;
  --accent: #4a9eff;
  --border: #2a2a4a;

  --feeding: #4a9eff;
  --breast: #e891b0;
  --sleep: #9b6dff;
  --diaper: #f0943a;
  --care: #4ecdc4;
  --medical: #e74c3c;
  --pump: #d4a574;
  --note: #6c6c8a;

  --rocky: #8B4513;
  --seizure: #ff6b6b;
  --walk: #69db7c;

  --radius: 10px;
  --gap: 12px;
}

html, body {
  font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

body { padding-bottom: 80px; }

#app { max-width: 480px; margin: 0 auto; padding: 0 var(--gap); }

/* ---- Nav ---- */
.nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 16px env(safe-area-inset-bottom, 8px);
  z-index: 100;
}
.nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
  padding: 6px 8px;
  min-width: 54px;
  min-height: 44px;
  justify-content: center;
  border-radius: var(--radius);
  transition: color 0.15s;
}
.nav a.active { color: var(--accent); }
.nav a .icon { font-size: 22px; line-height: 1; height: 24px; display: flex; align-items: center; justify-content: center; }
.nav a .nav-img { width: 32px; height: 32px; object-fit: contain; display: block; }
.nav-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  padding: 0 4px;
  color: #fff;
}
.nav-badge-warn { background: rgba(240,180,40,0.65); }
.nav-badge-urgent { background: rgba(231,76,60,0.65); }

@keyframes mic-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---- Voice Transcript Banner ---- */
.voice-transcript-banner {
  background: rgba(74, 158, 255, 0.12);
  border: 1px solid rgba(74, 158, 255, 0.25);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: var(--gap);
  font-size: 13px;
  color: var(--accent);
  line-height: 1.4;
}
.voice-transcript-text {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 4px;
  font-style: italic;
}

/* ---- Header ---- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 12px;
}
.header-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.header-logo { width: auto; height: 36px; }
.header h1 { font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.header-right { display: flex; align-items: center; gap: 10px; }
.header-right-meta { text-align: right; line-height: 1.3; }

/* ---- Comment Inbox ---- */
.inbox { position: relative; }
.inbox-btn {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  color: var(--text);
}
.inbox-btn.has-unread {
  border-color: rgba(74, 158, 255, 0.5);
  box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.15);
}
.inbox-btn:active { opacity: 0.8; }
.inbox-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ff4757;
  color: white;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.inbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.35);
  -webkit-tap-highlight-color: transparent;
}
.inbox-panel {
  position: fixed;
  top: 64px;
  right: 8px;
  left: 8px;
  max-width: 420px;
  margin-left: auto;
  z-index: 201;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0,0,0,0.5);
  max-height: 75vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: inbox-in 0.15s ease-out;
}
@keyframes inbox-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.inbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.inbox-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}
.inbox-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  -webkit-tap-highlight-color: transparent;
}
.inbox-empty {
  padding: 24px 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}
.inbox-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.inbox-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.inbox-item:last-child { border-bottom: none; }
.inbox-item:active { background: var(--bg-hover); }
.inbox-item.unread { background: rgba(74, 158, 255, 0.08); }
.inbox-item.unread::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #4a9eff;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.inbox-item-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.inbox-item-icon { font-size: 14px; }
.inbox-item-type {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.inbox-item-time {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
}
.inbox-item-text {
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.4;
}
.logout-link { color: var(--text-muted); font-size: 12px; cursor: pointer; text-decoration: none; }
.logout-link:active { color: var(--text); }
.section-title { font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }

/* ---- Quick Stats ---- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: var(--gap);
}
.stat-card {
  position: relative;
  overflow: hidden;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 10px 8px;
  text-align: center;
}
.stats-row-since .stat-card {
  background: #1e2d4d;
  border-left: 2px solid rgba(74,158,255,0.25);
}
.trend {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  font-weight: 800;
  opacity: 0.18;
  pointer-events: none;
  line-height: 1;
}
.trend-up { color: #4ecdc4; text-shadow: 0 0 12px rgba(78,205,196,0.4); }
.trend-down { color: #e74c3c; text-shadow: 0 0 12px rgba(231,76,60,0.4); }
.trend-sig { opacity: 0.35; text-shadow: 0 0 18px currentColor; }
.trend-diff {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  font-weight: 700;
  color: #fff;
  opacity: 0.7;
  line-height: 1;
  white-space: nowrap;
  margin-top: 1px;
}
.trend-flat { color: var(--text-muted); }
.stat-card .label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; position: relative; z-index: 1; }
.stat-card .value { font-size: 15px; font-weight: 700; margin-top: 2px; white-space: nowrap; position: relative; z-index: 1; font-family: 'JetBrains Mono', monospace; }
.stat-card .sub { font-size: 10px; color: var(--text-muted); margin-top: 2px; position: relative; z-index: 1; }
.sparkline-canvas { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 50%; pointer-events: none; z-index: 0; }
.stat-card.warn::after,
.stat-card.urgent::after {
  content: '';
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  z-index: 2;
}
.stat-card.warn::after { background: rgba(240,180,40,0.9); }
.stat-card.urgent::after { background: rgba(231,76,60,0.9); }

/* ---- Celebration particles ---- */
.celebrate-particle {
  position: fixed;
  font-size: 18px;
  pointer-events: none;
  z-index: 9999;
  animation: celebrate-pop 1s ease-out forwards;
  opacity: 0;
}
.celebrate-particle.celebrate-logo {
  z-index: 10000;
  animation: celebrate-pop-slow 1.6s ease-out forwards;
}
@keyframes celebrate-pop {
  0% { opacity: 1; transform: translate(0, 0) scale(0.5); }
  40% { opacity: 1; transform: translate(calc(var(--dx) * 0.6), calc(var(--dy) * 0.8)) scale(1.1); }
  100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) - 20px)) scale(0.7); }
}
@keyframes celebrate-pop-slow {
  0% { opacity: 1; transform: translate(0, 0) scale(0.5); }
  30% { opacity: 1; transform: translate(calc(var(--dx) * 0.4), calc(var(--dy) * 0.5)) scale(1.2); }
  70% { opacity: 1; transform: translate(calc(var(--dx) * 0.8), calc(var(--dy) * 0.85)) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) - 20px)) scale(0.8); }
}

/* ---- Quick Add ---- */
.quick-add {
  display: grid;
  grid-template-columns: repeat(4, 1fr) minmax(0, 1fr);
  grid-template-rows: 1fr 1fr;
  gap: 6px;
  margin-bottom: var(--gap);
}
.quick-btn {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: border-color 0.15s, background 0.15s;
}
.quick-btn:active { background: var(--bg-hover); }
.quick-btn .icon { font-size: 18px; }
.quick-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.quick-mic {
  grid-column: 5;
  grid-row: 1 / 3;
  border-color: var(--accent);
}
.quick-mic.recording { border-color: #ff4444; animation: mic-pulse 1s ease-in-out infinite; }
.quick-mic.processing { border-color: var(--accent); opacity: 0.6; }
.quick-mic:disabled { pointer-events: none; }
.quick-btn[data-type="feeding_bottle"] { border-color: var(--feeding); }
.quick-btn[data-type="feeding_breast"] { border-color: var(--breast); }
.quick-btn[data-type="sleep"] { border-color: var(--sleep); }
.quick-btn[data-type="diaper"] { border-color: var(--diaper); }
.quick-btn[data-type="care"] { border-color: var(--care); }
.quick-btn[data-type="medical"] { border-color: var(--medical); }
.quick-btn[data-type="pump"] { border-color: var(--pump); }
.quick-btn[data-type="note"] { border-color: var(--note); }

/* ---- Active Sleep Banner ---- */
/* ---- Active Session Banners (shared) ---- */
.active-sleep, .active-pump, .active-breast, .active-bottle, .active-care {
  color: #fff;
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-bottom: var(--gap);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.active-sleep { background: var(--sleep); animation: pulse-glow 2s infinite; }
.active-pump { background: var(--pump); animation: pulse-glow-pump 2s infinite; }
.active-breast { background: var(--breast); animation: pulse-glow-breast 2s infinite; }
.active-bottle { background: var(--feeding); animation: pulse-glow-bottle 2s infinite; }
.active-care { background: var(--care); animation: pulse-glow-care 2s infinite; }

.sleep-duration-box, .pump-duration-box, .breast-duration-box, .bottle-duration-box, .care-duration-box {
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 16px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  min-width: 56px;
  text-align: center;
  flex-shrink: 0;
  letter-spacing: -0.5px;
}
.active-sleep .info, .active-pump .info, .active-breast .info, .active-bottle .info, .active-care .info {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.95;
}
.active-sleep .duration, .active-pump .duration, .active-breast .duration, .active-bottle .duration, .active-care .duration {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  opacity: 0.7;
  margin-top: 2px;
  letter-spacing: 0.3px;
}
.active-breast .side-breakdown {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  opacity: 0.7;
  margin-top: 2px;
  letter-spacing: 0.3px;
}
.active-breast .breast-btns { display: flex; gap: 8px; }
.active-sleep button, .active-pump button, .active-breast button, .active-bottle button, .active-care button {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  min-height: 36px;
  flex-shrink: 0;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(155,109,255,0.3); }
  50% { box-shadow: 0 0 16px rgba(155,109,255,0.6); }
}
@keyframes pulse-glow-pump {
  0%, 100% { box-shadow: 0 0 8px rgba(212,165,116,0.3); }
  50% { box-shadow: 0 0 16px rgba(212,165,116,0.6); }
}
@keyframes pulse-glow-breast {
  0%, 100% { box-shadow: 0 0 8px rgba(232,145,176,0.3); }
  50% { box-shadow: 0 0 16px rgba(232,145,176,0.6); }
}
@keyframes pulse-glow-bottle {
  0%, 100% { box-shadow: 0 0 8px rgba(74,158,255,0.3); }
  50% { box-shadow: 0 0 16px rgba(74,158,255,0.6); }
}
@keyframes pulse-glow-care {
  0%, 100% { box-shadow: 0 0 8px rgba(78,205,196,0.3); }
  50% { box-shadow: 0 0 16px rgba(78,205,196,0.6); }
}

/* ---- Breast Side Picker Dialog ---- */
.breast-side-picker .dialog { text-align: center; }
.breast-side-picker .side-btns { display: flex; gap: 8px; margin-top: 12px; }
.breast-side-picker .side-btns .btn { flex: 1; }
.breast-side-picker .recommended { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.btn-breast { background: var(--breast); color: #fff; }

/* ---- Filter Pills ---- */
.filter-pills {
  display: flex;
  gap: 6px;
  margin-bottom: var(--gap);
  justify-content: center;
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0 4px;
}
.filter-pills::-webkit-scrollbar { display: none; }
.filter-pill {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 10px;
  font-size: 18px;
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  opacity: 0.5;
  flex-shrink: 0;
}
.filter-pill:active { transform: scale(0.95); }
.filter-pill.active {
  opacity: 1;
  border-color: rgba(74,158,255,0.4);
  background: rgba(74,158,255,0.15);
}
.filter-pill.filter-reset {
  opacity: 0.7;
}

/* ---- Timeline ---- */
.timeline { display: flex; flex-direction: column; gap: 8px; }
.timeline-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 10px 12px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  flex-direction: column;
  gap: 4px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
.timeline-card:active { background: var(--bg-hover); }

.timeline-card[data-type="feeding_bottle"] { border-left: 2px solid color-mix(in srgb, var(--feeding) 40%, transparent); }
.timeline-card[data-type="feeding_breast"] { border-left: 2px solid color-mix(in srgb, var(--breast) 40%, transparent); }
.timeline-card[data-type="sleep"] { border-left: 2px solid color-mix(in srgb, var(--sleep) 40%, transparent); }
.timeline-card[data-type="diaper"] { border-left: 2px solid color-mix(in srgb, var(--diaper) 40%, transparent); }
.timeline-card[data-type="care"] { border-left: 2px solid color-mix(in srgb, var(--care) 40%, transparent); }
.timeline-card[data-type="medical"] { border-left: 2px solid color-mix(in srgb, var(--medical) 40%, transparent); }
.timeline-card[data-type="pump"] { border-left: 2px solid color-mix(in srgb, var(--pump) 40%, transparent); }
.timeline-card[data-type="note"] { border-left: 2px solid color-mix(in srgb, var(--note) 40%, transparent); }
.timeline-card[data-type="seizure"] { border-left: 2px solid color-mix(in srgb, var(--seizure) 40%, transparent); }
.timeline-card[data-type="teeth_brushing"] { border-left: 2px solid color-mix(in srgb, #4ecdc4 40%, transparent); }
.timeline-card[data-type="walk"] { border-left: 2px solid color-mix(in srgb, var(--walk) 40%, transparent); }
.timeline-card[data-type="grooming"] { border-left: 2px solid color-mix(in srgb, #d4a574 40%, transparent); }
.timeline-card[data-type="bath"] { border-left: 2px solid color-mix(in srgb, #5ba8d4 40%, transparent); }
.timeline-card[data-type="medication"] { border-left: 2px solid color-mix(in srgb, var(--medical) 40%, transparent); }
.timeline-card[data-type="vet_visit"] { border-left: 2px solid color-mix(in srgb, #4a9eff 40%, transparent); }
.timeline-card[data-type="feeding_bottle"] .card-type { color: color-mix(in srgb, var(--feeding) 70%, transparent); }
.timeline-card[data-type="feeding_breast"] .card-type { color: color-mix(in srgb, var(--breast) 70%, transparent); }
.timeline-card[data-type="sleep"] .card-type { color: color-mix(in srgb, var(--sleep) 70%, transparent); }
.timeline-card[data-type="diaper"] .card-type { color: color-mix(in srgb, var(--diaper) 70%, transparent); }
.timeline-card[data-type="care"] .card-type { color: color-mix(in srgb, var(--care) 70%, transparent); }
.timeline-card[data-type="medical"] .card-type { color: color-mix(in srgb, var(--medical) 70%, transparent); }
.timeline-card[data-type="pump"] .card-type { color: color-mix(in srgb, var(--pump) 70%, transparent); }
.timeline-card[data-type="note"] .card-type { color: color-mix(in srgb, var(--note) 70%, transparent); }

.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-body {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.card-time-range { font-size: 11px; color: var(--text); font-weight: 600; margin-left: auto; flex-shrink: 0; font-family: 'JetBrains Mono', monospace; }
.card-ago { font-size: 10px; color: var(--text-muted); margin-left: auto; font-family: 'JetBrains Mono', monospace; letter-spacing: 0.3px; }
.timeline-card .card-type {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-family: 'JetBrains Mono', monospace;
}
.card-duration-dot { color: rgba(255,255,255,0.4); }
.card-duration { color: #fff; text-transform: none; font-family: 'JetBrains Mono', monospace; }
.user-badge { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; padding: 1px 5px; border-radius: 4px; font-family: 'JetBrains Mono', monospace; }
.user-anth { background: #4a9eff33; color: #4a9eff; }
.user-amy { background: #e891b033; color: #e891b0; }
.timeline-card .card-detail { font-size: 15px; flex: 1; min-width: 0; }
.timeline-card .card-notes { font-size: 13px; color: var(--text-muted); }

/* ---- Reactions ---- */
.card-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.reaction-pill {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1px 7px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  line-height: 1.5;
}
.reaction-pill.mine {
  background: rgba(74, 158, 255, 0.12);
  border-color: rgba(74, 158, 255, 0.35);
  color: var(--accent);
}
.reaction-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.15);
  -webkit-tap-highlight-color: transparent;
}
.reaction-picker {
  position: relative;
  z-index: 201;
  display: flex;
  justify-content: center;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 6px 10px;
  margin: -6px auto 8px;
  width: fit-content;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  animation: picker-in 0.15s ease-out;
}
.reaction-picker-btn {
  background: none;
  border: none;
  font-size: 26px;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 8px;
  transition: transform 0.1s, background 0.1s;
  -webkit-tap-highlight-color: transparent;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.reaction-picker-btn:active {
  transform: scale(1.3);
  background: rgba(255,255,255,0.08);
}
@keyframes picker-in {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

/* ---- Comments ---- */
.comment-pill {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1px 7px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  line-height: 1.5;
}
.comment-pill.open {
  background: rgba(74, 158, 255, 0.12);
  border-color: rgba(74, 158, 255, 0.35);
  color: var(--accent);
}
.card-comments {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card-comments-empty {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}
.comment-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.comment-body {
  flex: 1;
  min-width: 0;
}
.comment-text {
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.comment-meta {
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.comment-edited {
  opacity: 0.7;
}
.comment-link {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.comment-link:hover { color: var(--text); }
.comment-link-danger:hover { color: #ff6b6b; }
.comment-edit {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.comment-compose {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.comment-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 14px;
  min-height: 44px;
  max-height: 120px;
  resize: vertical;
  box-sizing: border-box;
}
.comment-input:focus {
  outline: none;
  border-color: rgba(74, 158, 255, 0.5);
}
.comment-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.comment-counter {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  margin-right: auto;
}
.comment-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 6px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  min-height: 32px;
}
.comment-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.comment-btn-send,
.comment-btn-save {
  background: rgba(74, 158, 255, 0.18);
  border-color: rgba(74, 158, 255, 0.45);
  color: #4a9eff;
}
.comment-btn:active:not(:disabled) {
  opacity: 0.8;
}

/* ---- Day Separator ---- */
.day-separator {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  padding: 8px 0 4px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

/* ---- Forms ---- */
.form-page { padding-top: 8px; }
.form-page .header .user-picker { gap: 6px; }
.form-page .header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-photo-btn {
  background: none;
  border: none;
  font-size: 20px;
  padding: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.header-photo-btn:active { opacity: 0.6; transform: scale(0.9); }

.type-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: var(--gap);
  overflow: hidden;
}
.type-tab {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 4px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.type-tab:active { transform: scale(0.95); }
.type-tab.active {
  background: rgba(74,158,255,0.15);
  border-color: rgba(74,158,255,0.4);
  color: #fff;
}

/* ---- User Picker (event attribution) ---- */
.user-picker {
  display: flex;
  gap: 8px;
}
.user-pick {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 6px 16px;
  border-radius: var(--radius);
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.user-pick:active { transform: scale(0.95); }
.user-pick-anth.active {
  background: #4a9eff22;
  border-color: #4a9eff66;
  color: #4a9eff;
}
.user-pick-amy.active {
  background: #e891b022;
  border-color: #e891b066;
  color: #e891b0;
}

.form-group { margin-bottom: var(--gap); }
.unit-toggle {
  display: flex;
  background: var(--bg-input);
  border-radius: 6px;
  padding: 2px;
}
.unit-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.unit-btn.active {
  background: rgba(74, 158, 255, 0.7);
  color: #fff;
}
.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

input[type="text"], input[type="number"], input[type="datetime-local"], textarea, select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 12px;
  font-size: 16px;
  min-height: 44px;
  -webkit-appearance: none;
  appearance: none;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
textarea { resize: vertical; min-height: 80px; font-family: inherit; }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238a8a9a'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

/* ---- Timestamp Picker ---- */
.ts-picker { margin-bottom: var(--gap); }
.ts-start .ts-display {
  border-left: 3px solid #34c77b;
}
.ts-start .ts-quick button.now {
  background: #34c77b;
  border-color: #34c77b;
}
.ts-end .ts-display {
  border-left: 3px solid #e74c3c;
}
.ts-end .ts-quick button.now {
  background: #e74c3c;
  border-color: #e74c3c;
}
.ts-display {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  min-height: 44px;
  position: relative;
}
.ts-edit-input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  outline: none;
  padding: 0;
  font-family: inherit;
  color-scheme: dark;
}
.ts-editing {
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(74, 158, 255, 0.2);
}
.ts-quick {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.ts-quick button {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  min-height: 36px;
  transition: background 0.12s, border-color 0.12s;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: none) {
  .ts-quick button { touch-action: manipulation; }
}
.ts-quick button:active { background: var(--bg-hover); border-color: var(--accent); }
.ts-quick button.now { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* ---- Mix Amount Breakdown ---- */
.mix-amounts { display: flex; gap: 8px; }
.mix-amount-field { flex: 1; }
.mix-amount-field label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; display: block; }
.mix-total { text-align: center; font-size: 13px; color: var(--text-muted); margin-top: 6px; }

/* ---- Pill Selector ---- */
.pill-group { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  padding: 8px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  transition: all 0.15s;
}
.pill:active { transform: scale(0.95); }
.pill.active {
  background: rgba(74,158,255,0.15);
  border-color: rgba(74,158,255,0.4);
  color: #fff;
}
.quick-dates .pill.active {
  background: rgba(155,109,255,0.15);
  border-color: rgba(155,109,255,0.4);
}

/* ---- Toggle ---- */
.toggle-pair {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.toggle-pair .toggle-row {
  flex: 1 1 calc(50% - 5px);
  min-width: 0;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}
.toggle {
  width: 52px;
  min-width: 52px;
  height: 30px;
  background: var(--border);
  border-radius: 15px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  border: none;
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 3px;
}
.toggle.on { background: var(--accent); }
.toggle .knob {
  width: 24px;
  height: 24px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle.on .knob { transform: translateX(22px); }

/* ---- Buttons ---- */
.btn {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  min-height: 52px;
  transition: opacity 0.15s;
}
.btn:active { opacity: 0.8; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-secondary { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.btn + .btn { margin-top: 8px; }

/* ---- Form action buttons row ---- */
.form-actions {
  display: flex;
  gap: 8px;
  margin-top: var(--gap);
}
.form-actions .btn {
  width: auto;
  flex: 1;
  margin-top: 0;
  min-height: 48px;
  padding: 12px 8px;
  font-size: 14px;
}
.form-actions .btn + .btn { margin-top: 0; }
.form-actions .btn-primary { flex: 2; }

/* ---- Delete confirmation ---- */
.delete-confirm {
  background: rgba(0,0,0,0.7);
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: var(--gap);
}
.delete-confirm .dialog {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 320px;
  width: 100%;
  text-align: center;
}
.delete-confirm .dialog p { margin-bottom: 16px; }
.delete-confirm .dialog .btns { display: flex; gap: 8px; }
.delete-confirm .dialog .btns .btn { flex: 1; width: auto; margin-top: 0; }

/* ---- Stats / Data ---- */
.data-page .filter-pill.active,
.stats-page .filter-pill.active,
.history-page .filter-pill.active {
  border-color: rgba(155,109,255,0.4);
  background: rgba(155,109,255,0.15);
}
.data-page .pill.active,
.stats-page .pill.active,
.history-page .pill.active {
  background: rgba(155,109,255,0.15);
  border-color: rgba(155,109,255,0.4);
  color: #fff;
}
.data-page { padding-top: 8px; }
.data-header-icon { font-size: 28px; line-height: 1; }
.data-seg {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 3px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}
.data-seg-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  padding: 8px 0;
  transition: all 0.2s;
}
.data-seg-btn:active { transform: scale(0.95); }
.data-seg-btn.active {
  background: rgba(155,109,255,0.8);
  color: #fff;
  box-shadow: 0 1px 4px rgba(155,109,255,0.3);
}

.stats-page { padding-top: 0; }
.period-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.period-tab {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  padding: 8px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  text-align: center;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.period-tab:active { transform: scale(0.95); }
.period-tab.active {
  background: rgba(155,109,255,0.15);
  border-color: rgba(155,109,255,0.4);
  color: #fff;
}

.chart-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: var(--gap);
}
.chart-section h3 { color: rgba(232,232,232,0.7); margin-bottom: 12px; font-family: 'JetBrains Mono', monospace; text-transform: uppercase; letter-spacing: 0.5px; font-size: 11px; font-weight: 700; }
.chart-section canvas { width: 100% !important; max-height: 250px; }
.sleep-timeline-section canvas { max-height: none; }

/* ---- History Page ---- */
.history-page { padding-top: 0; }

.quick-dates {
  display: flex;
  gap: 8px;
  margin-bottom: var(--gap);
}
.quick-dates .pill { flex: 1; display: flex; justify-content: center; min-height: 44px; align-items: center; }

.history-controls {
  display: flex;
  gap: 8px;
  margin-bottom: var(--gap);
  align-items: flex-end;
}
.date-field { flex: 1; }
.date-field label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.date-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px;
  font-size: 15px;
  min-height: 44px;
  -webkit-appearance: none;
  appearance: none;
  color-scheme: dark;
}
.date-input:focus { outline: none; border-color: var(--accent); }

.history-load-btn {
  width: auto;
  min-width: 64px;
  padding: 10px 16px;
  min-height: 44px;
  align-self: flex-end;
}

/* ---- Duration Filter ---- */
.duration-filter-row {
  display: flex;
  gap: 8px;
  margin-bottom: var(--gap);
  flex-wrap: wrap;
  align-items: center;
}
.duration-select, .duration-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 10px;
  font-size: 14px;
  min-height: 44px;
  -webkit-appearance: none;
  appearance: none;
}
.duration-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238a8a9a'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.duration-select:focus, .duration-input:focus {
  outline: none;
  border-color: var(--accent);
}
.duration-input {
  width: 70px;
  text-align: center;
}
.duration-unit {
  width: 65px;
}

/* ---- Auth ---- */
.auth-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  text-align: center;
}
.auth-logo { width: 220px; height: auto; margin-bottom: 4px; filter: drop-shadow(0 0 24px rgba(138,100,220,0.4)); }
.auth-page h1 { font-size: 32px; margin-bottom: 8px; }
.auth-page .subtitle { color: rgba(255,255,255,0.5); font-size: 14px; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 32px; }
.auth-page form { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.auth-page input {
  max-width: 260px; width: 100%; text-align: center; margin-bottom: 0;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px; padding: 14px 16px; font-size: 16px; color: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-page input::placeholder { color: rgba(255,255,255,0.3); }
.auth-page input:focus { border-color: rgba(138,100,220,0.6); box-shadow: 0 0 16px rgba(138,100,220,0.2); outline: none; }
.auth-page .btn {
  max-width: 260px; width: 100%; border-radius: 12px; padding: 14px 16px;
  font-size: 15px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  background: linear-gradient(135deg, #7c5cbf, #5b8cd4); border: none;
  box-shadow: 0 4px 16px rgba(92,60,180,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}
.auth-page .btn:active { transform: scale(0.97); box-shadow: 0 2px 8px rgba(92,60,180,0.3); }
.auth-error { color: #e74c3c; font-size: 13px; margin-top: 8px; }

/* ---- Settings Page ---- */
.settings-page { padding-top: 8px; }
.settings-header-icon { font-size: 28px; line-height: 1; }
.settings-section { margin-bottom: 20px; }
.settings-section h3 { font-size: 14px; color: #f0943a; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.settings-page .btn-primary { background: #f0943a; }
.settings-page input:focus { border-color: #f0943a; }
.settings-dash-link:active { border-color: rgba(240,148,58,0.5); }
.threshold-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}
.threshold-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.threshold-row .threshold-label { flex: 1; font-size: 13px; font-weight: 600; min-width: 40px; }
.threshold-row .threshold-inputs { display: flex; gap: 4px; align-items: center; }
.threshold-row .threshold-inputs label { font-size: 11px; color: var(--text-muted); }
.threshold-row .threshold-inputs input {
  width: 44px;
  padding: 4px 6px;
  font-size: 13px;
  text-align: center;
  min-height: 32px;
}
.threshold-warn-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(240,180,40,0.8); flex-shrink: 0; }
.threshold-urgent-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(231,76,60,0.8); flex-shrink: 0; }
.settings-dashboards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.settings-dash-link {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius);
  padding: 12px 8px; text-decoration: none; color: var(--text-muted);
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
  font-family: 'JetBrains Mono', monospace; min-height: 44px; transition: border-color 0.15s;
}
.settings-dash-link:active { background: var(--bg-hover); }
.settings-dash-link .dash-icon { font-size: 20px; }

/* ---- Loading ---- */
.loading { text-align: center; padding: 40px; color: var(--text-muted); }

/* ---- Empty state ---- */
.empty { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty .icon { font-size: 40px; margin-bottom: 8px; }

/* ---- Utilities ---- */
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.week-glow { color: #4a9eff; text-shadow: 0 0 10px rgba(255,255,255,0.3); }

/* ---- TV Dashboard ---- */
.tv-dashboard {
  position: fixed;
  inset: 0;
  overflow: hidden;
  cursor: none;
  background: #0a0a0f;
  z-index: 300;
  display: flex;
  flex-direction: column;
  max-width: none;
  padding: 0;
  color: #f0f0f0;
}
.tv-dashboard::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(20,25,45,0.4) 0%, transparent 50%),
    radial-gradient(ellipse 100% 100% at 50% 100%, rgba(5,8,18,0.6) 0%, transparent 45%);
  pointer-events: none;
  z-index: 0;
}
/* Shared grain texture overlay — apply via ::after or ::before on positioned parent */
.tv-grain::after,
.tv-grain-before::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  opacity: 0.06;
  pointer-events: none;
  border-radius: inherit;
}
.tv-dashboard::after {
  opacity: 0.035;
  z-index: 9998;
}
.tv-dashboard > * { position: relative; z-index: 2; }

.tv-night-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 140, 0, 0);
  pointer-events: none;
  z-index: 9999;
  transition: background 2s ease;
}
.tv-night-overlay.active {
  background: rgba(255, 140, 0, 0.15);
}

.tv-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 40px;
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
  flex-shrink: 0;
}
/* grain applied via .tv-grain class in HTML */

.tv-header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.tv-logo {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  object-fit: cover;
  position: relative;
  top: 10px;
}

.tv-clock {
  font-family: 'Departure Mono', 'JetBrains Mono', monospace;
  font-size: 90px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
  line-height: 1;
  color: #f0f0f0;
  -webkit-text-stroke: 1.5px #f0f0f0;
}

.tv-milestone {
  font-family: 'Nunito Sans', sans-serif;
  font-size: 48px;
  color: rgba(255,255,255,0.6);
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-align: center;
  line-height: 1.15;
}

.tv-header-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.tv-header-right {
  text-align: right;
}

.tv-date {
  font-family: 'Departure Mono', 'JetBrains Mono', monospace;
  font-size: 90px;
  color: #f0f0f0;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  -webkit-text-stroke: 1.5px #f0f0f0;
}

.tv-bar-detail {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.8);
  text-shadow: 0 1px 6px rgba(0,0,0,0.4);
}

/* Main grid */
.tv-grid {
  display: grid;
  grid-template-columns: 60fr 40fr;
  gap: 24px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 20px 28px 20px;
}

/* Left: 3 bar gauges */
.tv-left {
  display: flex;
  gap: 28px;
  align-items: stretch;
  overflow: hidden;
}

.tv-bar-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 20px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), inset 0 -1px 0 rgba(0,0,0,0.2);
  position: relative;
  transition: box-shadow 0.5s ease;
  overflow: hidden;
}
/* grain applied via .tv-grain-before class in HTML */

@keyframes tv-bar-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.25); }
}

.tv-bar-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  border-radius: 19px;
  transition: height 1s ease, background 0.5s ease, box-shadow 0.5s ease;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 16px;
  overflow: hidden;
  box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.4), 0 -2px 4px rgba(0, 0, 0, 0.3);
}
.tv-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image: url('/textures/paper-texture.jpg');
  background-size: 512px 512px;
  background-repeat: repeat;
  opacity: 0.45;
  mix-blend-mode: multiply;
  pointer-events: none;
  border-radius: inherit;
}
/* Offset texture per bar so they don't look identical */
.tv-bar-container:nth-child(1) .tv-bar-fill::after { background-position: 0 0; }
.tv-bar-container:nth-child(2) .tv-bar-fill::after { background-position: -137px -89px; }
.tv-bar-container:nth-child(3) .tv-bar-fill::after { background-position: -271px -203px; }
.tv-bar-container:nth-child(4) .tv-bar-fill::after { background-position: -53px -317px; }

.tv-bar-fill.tv-bar-active {
  animation: tv-bar-pulse 2.5s ease-in-out infinite;
}

.tv-bar-time {
  font-family: 'Nunito Sans', sans-serif;
  font-size: 58px;
  font-weight: 700;
  color: #000;
  text-shadow: none;
  z-index: 2;
  letter-spacing: -1px;
  white-space: nowrap;
}

.tv-bar-label {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 64px;
  font-weight: 900;
  color: #000000;
  letter-spacing: 1px;
  line-height: 1;
  z-index: 4;
}

.tv-right {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  overflow: hidden;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 20px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), inset 0 -1px 0 rgba(0,0,0,0.2);
  padding: 12px 16px;
}
/* grain applied via .tv-grain-before class in HTML */

.tv-sleep-chart-wrap {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.tv-sleep-chart-wrap {
  position: relative;
}
.tv-sleep-chart-wrap canvas {
  display: block;
}

/* ---- TV Environmental Cards ---- */
.tv-room-sensors {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  padding: 16px 28px 0;
}

.tv-env-card {
  position: relative;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 16px 20px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), inset 0 -1px 0 rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.tv-env-card.tv-room-stale {
  opacity: 0.4;
}

.tv-env-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.tv-env-icon {
  font-size: 22px;
  line-height: 1;
}

.tv-env-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.35);
}

.tv-env-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tv-env-row {
  display: flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
}

.tv-env-row-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

.tv-env-row-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.tv-env-header-split {
  justify-content: space-between;
}

.tv-env-header-left,
.tv-env-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tv-env-reading {
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.tv-env-value {
  font-family: 'Departure Mono', 'JetBrains Mono', monospace;
  font-size: 32px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.95);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.tv-env-unit {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.5px;
}

.tv-env-status {
  font-size: 14px;
  line-height: 1;
  margin-left: auto;
}

.tv-env-moon-phase {
  font-family: 'Departure Mono', 'JetBrains Mono', monospace;
  font-size: 32px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1;
}

.tv-env-moon-next {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.4);
}

.tv-env-iss {
  font-family: 'Departure Mono', 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1;
}

.tv-env-iss-dir {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
}

.tv-env-meteor {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.45);
}

.tv-aq-stale .tv-env-value {
  color: rgba(255, 255, 255, 0.45);
}
.tv-aq-stale .tv-env-unit {
  color: rgba(255, 255, 255, 0.3);
}

/* ---- Chat Page ---- */
.chat-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 70px);
  height: calc(100dvh - 70px);
  max-width: 480px;
  margin: 0 auto;
  padding: 0 var(--gap);
}
.chat-page .header {
  flex-shrink: 0;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  -webkit-overflow-scrolling: touch;
}
.chat-welcome {
  text-align: center;
  padding: 24px 0;
}
.chat-suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}
.chat-suggestion {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  font-family: 'Nunito Sans', sans-serif;
  transition: border-color 0.15s;
}
.chat-suggestion:active {
  border-color: rgba(74,158,255,0.4);
}
.chat-msg {
  margin-bottom: 6px;
  display: flex;
}
.chat-msg-user {
  justify-content: flex-end;
}
.chat-msg-assistant {
  justify-content: flex-start;
}
.chat-bubble {
  max-width: 80%;
  padding: 9px 14px;
  font-size: 15px;
  line-height: 1.4;
  word-break: break-word;
}
.chat-bubble-user {
  background: rgba(25, 130, 252, 0.15);
  color: var(--text);
  border: 1px solid rgba(25, 130, 252, 0.5);
  border-radius: 18px 18px 4px 18px;
}
.chat-bubble-assistant {
  background: rgba(52, 199, 89, 0.15);
  color: var(--text);
  border: 1px solid rgba(52, 199, 89, 0.5);
  border-radius: 18px 18px 18px 4px;
}
.chat-loading {
  color: var(--text-muted);
  font-style: italic;
}
.chat-answer {
  margin-bottom: 4px;
}
.chat-detail-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  padding: 4px 0;
}
.chat-detail-toggle:active {
  opacity: 0.7;
}
.chat-details {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.chat-explanation {
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 6px;
}
.chat-sql {
  background: var(--bg-input);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: rgba(155,109,255,0.85);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin-bottom: 6px;
}
.chat-results-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.chat-results-table-wrap {
  overflow-x: auto;
  margin-bottom: 4px;
}
.chat-results-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}
.chat-results-table th {
  background: var(--bg-input);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 9px;
  font-weight: 600;
  padding: 4px 8px;
  text-align: left;
  white-space: nowrap;
}
.chat-results-table td {
  padding: 3px 8px;
  border-top: 1px solid rgba(255,255,255,0.04);
  color: var(--text);
  white-space: nowrap;
}
.chat-results-table tr:nth-child(even) {
  background: rgba(155,109,255,0.04);
}
.chat-input-bar {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  padding: 10px 0;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
.chat-input-bar input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  color: var(--text);
  font-size: 16px;
  font-family: 'Nunito Sans', sans-serif;
  min-height: 44px;
}
.chat-input-bar input:focus {
  border-color: rgba(74,158,255,0.4);
  outline: none;
}
.chat-send-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: rgba(74,158,255,0.2);
  border: 1px solid rgba(74,158,255,0.3);
  color: #4a9eff;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-send-btn:disabled {
  opacity: 0.3;
}
.chat-send-btn:active:not(:disabled) {
  transform: scale(0.95);
}

/* ---- Pull-to-Refresh Indicator ---- */
.ptr-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  z-index: 9998;
  pointer-events: none;
}
.ptr-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.ptr-ready .ptr-logo {
  opacity: 1;
}
.ptr-spinning .ptr-logo {
  opacity: 1;
  animation: ptr-wobble 0.4s ease-in-out infinite;
}
.ptr-releasing .ptr-logo {
  animation: none;
}
@keyframes ptr-wobble {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-12deg); }
  75% { transform: rotate(12deg); }
}
.ptr-releasing {
  transition: transform 0.25s ease;
}
@keyframes ptr-spin {
  to { transform: rotate(360deg); }
}

/* ---- AI Insights ---- */
.insights-page { padding-top: 8px; }
.insights-header-icon { font-size: 28px; line-height: 1; }
.insights-meta { font-size: 12px; color: var(--text-muted); margin-bottom: var(--gap); display: flex; align-items: center; justify-content: space-between; }
.insights-age { font-weight: 600; color: var(--text); }
.insight-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  border-left: 4px solid var(--accent);
}
.insight-card h3 { font-size: 14px; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.insight-card p { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.insight-card.feeding { border-left-color: var(--feeding); }
.insight-card.sleep { border-left-color: var(--sleep); }
.insight-card.diaper { border-left-color: var(--diaper); }
.insight-card.development { border-left-color: var(--care); }
.insight-card.tip { border-left-color: #f0b428; }
.insights-generating {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.insights-generating .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ptr-spin 0.6s linear infinite;
  margin: 0 auto 12px;
}
.insights-error {
  background: rgba(231, 76, 60, 0.15);
  border: 1px solid rgba(231, 76, 60, 0.3);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: #e74c3c;
  font-size: 13px;
  margin-bottom: var(--gap);
}
.btn-generate {
  background: linear-gradient(135deg, var(--accent), #9b6dff);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
  width: 100%;
  transition: opacity 0.15s;
}
.btn-generate:active { opacity: 0.8; }
.btn-generate:disabled { opacity: 0.5; cursor: default; }

/* ---- Rocky ---- */
.rocky-card {
  border-left: none;
}
.rocky-card .card-type { color: var(--rocky); }
.rocky-card .paw-badge {
  display: inline-block;
  background: var(--rocky);
  padding: 2px;
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
  line-height: 0;
}

.active-walk {
  background: rgba(105, 219, 124, 0.12);
  border: 1px solid rgba(105, 219, 124, 0.3);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: var(--gap);
  display: flex;
  align-items: center;
  gap: 12px;
}
.active-walk .walk-duration-box {
  background: rgba(105, 219, 124, 0.2);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 20px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--walk);
  min-width: 80px;
  text-align: center;
}
.active-walk .info { font-weight: 600; }
.active-walk .duration { font-size: 13px; color: var(--text-muted); }
.active-walk button {
  margin-left: auto;
  background: var(--walk);
  color: #000;
  border: none;
  border-radius: var(--radius);
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}

.rocky-dashboard .quick-add {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: var(--gap);
}
.rocky-quick-add {
  grid-template-columns: repeat(4, 1fr) !important;
}
.rocky-note-btn {
  grid-column: 4;
  grid-row: 1 / 3;
}
.rocky-dashboard .quick-btn[data-type="seizure"] { border-color: var(--seizure); }
.rocky-dashboard .quick-btn[data-type="teeth_brushing"] { border-color: #4ecdc4; }
.rocky-dashboard .quick-btn[data-type="grooming"] { border-color: #d4a574; }
.rocky-dashboard .quick-btn[data-type="bath"] { border-color: #5ba8d4; }
.rocky-dashboard .quick-btn[data-type="medication"] { border-color: var(--medical); }
.rocky-dashboard .quick-btn[data-type="vet_visit"] { border-color: #4a9eff; }
.rocky-dashboard .quick-btn[data-type="note"] { border-color: var(--note); }

.rocky-form .type-tab.active {
  background: rgba(245,230,200,0.15);
  border-color: rgba(245,230,200,0.4);
  color: #f5e6c8;
}

.rocky-dashboard .chart-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: var(--gap);
}
.rocky-dashboard .chart-section h3 {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.rocky-card .card-detail { font-family: 'Nunito Sans', -apple-system, system-ui, sans-serif; }
.rocky-card .card-notes { font-family: 'Nunito Sans', -apple-system, system-ui, sans-serif; }

/* ---- Doctor Flag ---- */
.card-todo-flag {
  display: inline-block;
  background: rgba(78,205,196,0.2);
  color: #4ecdc4;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---- Milestone Flag ---- */
.card-milestone-flag {
  display: inline-block;
  background: rgba(255,200,50,0.2);
  color: #f0c030;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.todo-page { padding-top: 8px; }
.todo-header-icon { font-size: 28px; line-height: 1; }
.todo-empty { text-align: center; color: var(--text-muted); padding: 40px 20px; font-size: 14px; }

.todo-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid rgba(78,205,196,0.35);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.todo-card-content { flex: 1; min-width: 0; }
.todo-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.todo-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}
.todo-text {
  font-size: 14px;
  line-height: 1.5;
}
.btn-todo-done {
  background: rgba(78,205,196,0.1);
  color: #4ecdc4;
  border: 1px solid rgba(78,205,196,0.25);
  border-radius: var(--radius);
  padding: 0;
  width: 44px;
  height: 44px;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.btn-todo-done:active {
  background: rgba(78,205,196,0.25);
  transform: scale(0.95);
}
.btn-discussed:active { opacity: 0.7; }

/* ---- Milestones Page ---- */
.milestones-page { padding-top: 8px; }
.milestones-header-icon { font-size: 28px; line-height: 1; }
.milestones-empty { text-align: center; color: var(--text-muted); padding: 40px 20px; font-size: 14px; }
.milestone-card {
  background: var(--bg-card);
  border-left: 3px solid rgba(255,200,50,0.35);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
}
.milestone-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.milestone-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}
.milestone-text {
  font-size: 14px;
  line-height: 1.5;
}
.milestone-type-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,200,50,0.8);
  background: rgba(255,200,50,0.1);
  padding: 2px 8px;
  border-radius: 4px;
}

/* ---- Image Uploads ---- */
.image-section { margin-top: 8px; margin-bottom: 16px; }
.image-section label { display: block; margin-bottom: 6px; }

.image-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.image-thumb-wrap {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-input);
}
.image-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.image-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: none;
  font-size: 14px;
  line-height: 24px;
  text-align: center;
  cursor: pointer;
  padding: 10px;
  margin: 0;
  box-sizing: content-box;
}

.btn-add-photo {
  background: var(--bg-input);
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  min-height: 44px;
}
.btn-add-photo:active { opacity: 0.7; }

.image-hint {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* Timeline card images — full-width, IG-style, inside card padding */
.card-images {
  display: flex;
  margin-top: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
  gap: 8px;
  align-items: flex-start;
  border-radius: 8px;
}
.card-images::-webkit-scrollbar { display: none; }
.card-image-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.card-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  cursor: pointer;
  /* Polished frame: subtle highlight edge + depth shadow + inner dark ring */
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.4),
    0 1px 2px rgba(0, 0, 0, 0.25),
    inset 0 0 0 1px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card-image:active {
  transform: scale(0.99);
}
.card-images.is-carousel {
  position: relative;
}

/* Carousel pagination dots */
.card-images-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.card-image-dots {
  display: flex;
  gap: 6px;
  padding: 2px 0;
  justify-content: center;
}
.card-image-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  transition: background 0.2s ease, transform 0.2s ease;
}
.card-image-dot.active {
  background: rgba(255, 255, 255, 0.85);
  transform: scale(1.15);
}

/* Fullscreen image viewer */
.image-viewer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  cursor: pointer;
}
.image-viewer-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
}

/* ---- iPhone 6s Dedicated Dashboard ---- */
.i6s-dashboard {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--bg);
  z-index: 300;
  display: flex;
  flex-direction: column;
  max-width: none;
  padding: 0;
}
.i6s-chart {
  flex-shrink: 0;
  padding: 8px 0 0;
}
.i6s-chart-title {
  font-size: 14px;
  font-weight: 700;
  color: rgba(155,109,255,0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0 4px 4px;
}
.i6s-grid {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  min-height: 0;
}
.i6s-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  flex: 1;
  min-height: 0;
}
.i6s-row .stat-card {
  position: relative;
  overflow: hidden;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 8px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}
.i6s-row-since .stat-card {
  background: #1e2d4d;
}
.i6s-row .stat-card .label {
  font-size: 12px;
}
.i6s-row .stat-card .value {
  font-size: 17px;
  margin-top: 2px;
}

/* ---- Grocery Page ---- */
.grocery-page {
  padding-top: 8px;
}
/* Override base .btn inside grocery page — compact inline buttons, not full-width */
.grocery-page .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 0;
  padding: 8px 18px;
  font-size: 13px;
}
.grocery-page .btn + .btn { margin-top: 0; }
.grocery-page .btn-primary { background: #34c77b; color: #fff; }
.grocery-page .btn-primary:disabled { background: #2a5e42; opacity: 0.5; }

.grocery-header-icon {
  font-size: 28px;
  line-height: 1;
}
.grocery-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--gap);
  padding-bottom: 2px;
}
.grocery-tabs::-webkit-scrollbar { display: none; }
.grocery-tab {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 14px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.grocery-tab:active { transform: scale(0.95); }
.grocery-tab.active {
  background: rgba(52,199,123,0.15);
  border-color: rgba(52,199,123,0.4);
  color: #fff;
}
.grocery-tab-count {
  background: rgba(52,199,123,0.35);
  color: #fff;
  border-radius: 8px;
  padding: 1px 5px;
  font-size: 10px;
  margin-left: 4px;
}
.grocery-section {
  margin-bottom: var(--gap);
}
.grocery-section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.grocery-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.grocery-chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 14px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
.grocery-chip:active {
  transform: scale(0.95);
}
.grocery-chip.needed {
  background: rgba(52,199,123,0.15);
  border-color: rgba(52,199,123,0.4);
  color: #fff;
}
.grocery-chip.overdue {
  animation: grocery-glow 2s ease-in-out infinite;
}
@keyframes grocery-glow {
  0%, 100% { box-shadow: 0 0 4px rgba(52,199,123,0.2); }
  50% { box-shadow: 0 0 12px rgba(52,199,123,0.5); }
}
.grocery-empty {
  color: var(--text-muted);
  font-size: 13px;
  padding: 12px 0;
}
.grocery-add {
  display: flex;
  gap: 8px;
  margin-top: var(--gap);
  align-items: center;
}
.grocery-add input[type="text"] {
  flex: 1;
  min-height: 38px;
  font-size: 14px;
  padding: 8px 12px;
}
.grocery-add input[type="text"]:focus {
  border-color: #34c77b;
}
.grocery-add .btn {
  padding: 0;
  width: 38px;
  height: 38px;
  min-height: 0;
  font-size: 20px;
  flex-shrink: 0;
  border-radius: 50%;
}

/* Grocery header actions */
.grocery-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.grocery-list-btn {
  padding: 0 !important;
  width: 36px !important;
  height: 36px !important;
  font-size: 18px !important;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Grocery full list view */
.grocery-list-store {
  margin-bottom: 16px;
}
.grocery-list-store-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #34c77b;
  padding-bottom: 6px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.grocery-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  font-size: 15px;
  color: var(--text);
  border-bottom: 1px solid rgba(42,42,74,0.5);
}
.grocery-list-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34c77b;
  flex-shrink: 0;
}
.grocery-list-total {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 16px;
  font-family: 'JetBrains Mono', monospace;
}

/* Grocery shopping mode */
.grocery-shop-store-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.grocery-shop-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.grocery-shop-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px;
  border-radius: var(--radius);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.15s;
  -webkit-user-select: none;
  user-select: none;
}
.grocery-shop-item:active {
  background: var(--bg-hover);
}
.grocery-shop-item.checked {
  opacity: 0.4;
}
.grocery-shop-item.checked .grocery-shop-name {
  text-decoration: line-through;
}
.grocery-shop-check {
  font-size: 20px;
  line-height: 1;
  color: #34c77b;
}
.grocery-shop-name {
  font-size: 15px;
}
.grocery-shop-progress {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: var(--gap);
  font-family: 'JetBrains Mono', monospace;
}

/* Grocery edit popover */
.grocery-edit-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gap);
}
.grocery-edit-popover {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.grocery-edit-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}
.grocery-edit-label {
  font-size: 12px;
  color: var(--text-muted);
}
.grocery-edit-stats {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.grocery-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.grocery-edit-actions .btn {
  flex: 1;
  font-size: 12px;
  padding: 8px 12px;
}
.grocery-page .btn-danger {
  background: rgba(231,76,60,0.2);
  border: 1px solid rgba(231,76,60,0.4);
  color: #e74c3c;
}
.grocery-page .btn-danger:active {
  background: rgba(231,76,60,0.3);
}

/* Grocery quantity badge */
.grocery-qty {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  opacity: 0.6;
  margin-left: 2px;
}

/* Grocery quantity stepper (edit modal) */
.grocery-qty-stepper {
  display: flex;
  align-items: center;
  gap: 12px;
}
.grocery-qty-btn {
  width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  font-size: 18px !important;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.grocery-qty-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  min-width: 24px;
  text-align: center;
  color: var(--text);
}

/* ---- Shared header divider ---- */
.header {
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--gap);
}

/* ---- Growth Page ---- */
.growth-page { padding-top: 0; }
.growth-header-icon { font-size: 28px; line-height: 1; }

.growth-percentiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: var(--gap);
}
.growth-pct-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
  border: 1px solid var(--border);
}
.growth-pct-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.growth-pct-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.growth-pct-suffix {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}
.growth-footnote {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
  letter-spacing: 0.3px;
}

/* ---- Photos Page ---- */
.photos-page { padding-top: 8px; }
.photos-header-icon { font-size: 28px; line-height: 1; }

.photos-month-group { margin-bottom: 20px; }
.photos-month-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: rgba(91,168,245,0.7);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.photos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}

.photo-tile {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg-card);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.3s;
}
.photo-tile img[data-src] { opacity: 0; }

/* Photos page — soft blue theme */
.photo-tile:active { opacity: 0.75; box-shadow: inset 0 0 0 2px rgba(91,168,245,0.4); }

/* ---- Photo Event Modal ---- */
.photo-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.photo-modal {
  max-width: 420px;
  width: 100%;
  background: var(--bg-card);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.photo-modal-img {
  width: 100%;
  max-height: 50vh;
  object-fit: contain;
  background: #000;
  display: block;
}
.photo-modal-event {
  padding: 16px;
  cursor: pointer;
  transition: background 0.15s;
}
.photo-modal-event:active {
  background: var(--bg-hover);
}
.photo-modal-type {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.photo-modal-icon {
  font-size: 24px;
  line-height: 1;
}
.photo-modal-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text);
}
.photo-modal-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.photo-modal-notes {
  font-size: 14px;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 8px;
}
.photo-modal-hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(91,168,245,0.6);
}

/* ---- More Nav Menu ---- */
.nav-more {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.nav-more-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
  background: none;
  border: none;
  font-size: 11px;
  padding: 6px 8px;
  min-width: 54px;
  min-height: 44px;
  justify-content: center;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 0.15s;
  font-family: inherit;
}
.nav-more-btn .icon {
  font-size: 22px;
  line-height: 1;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-more-btn.active { color: var(--accent); }

.nav-more-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 140px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  overflow: hidden;
  z-index: 200;
}

.nav-more-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.1s;
}
.nav-more-item:active { background: var(--bg-hover); }
.nav-more-item + .nav-more-item { border-top: 1px solid var(--border); }
.nav-more-item span:first-child { font-size: 18px; }

/* ---- Visit Page (public) ---- */
.visit-page {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px 40px;
}
.visit-page .header { margin-bottom: 20px; }
.visit-intro {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
  border-left: 3px solid #f28a7b;
  line-height: 1.6;
  font-size: 15px;
}
.visit-section { margin-bottom: 20px; }
.visit-section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #f28a7b;
  margin-bottom: 10px;
  padding-left: 2px;
}
.visit-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  line-height: 1.6;
  font-size: 15px;
}
.visit-card p { margin-bottom: 12px; }
.visit-card p:last-child { margin-bottom: 0; }
.visit-checklist {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.visit-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: rgba(242, 138, 123, 0.06);
  border: 1px solid rgba(242, 138, 123, 0.15);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.visit-check:active { transform: scale(0.98); }
.visit-checkbox {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid rgba(242, 138, 123, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  margin-top: 1px;
  transition: background 0.15s, border-color 0.15s;
  color: #fff;
}
.visit-check-done .visit-checkbox {
  background: #f28a7b;
  border-color: #f28a7b;
}
.visit-check-done .visit-check-text {
  opacity: 0.5;
  text-decoration: line-through;
  text-decoration-color: rgba(242, 138, 123, 0.4);
}
.visit-check-important {
  border: 2px solid rgba(242, 138, 123, 0.5);
  background: rgba(242, 138, 123, 0.1);
}
.visit-check-done {
  background: rgba(242, 138, 123, 0.03);
  border-color: rgba(242, 138, 123, 0.08);
}
.visit-card strong { color: #f28a7b; }
.visit-seg {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 3px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}
.visit-seg-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.visit-seg-btn:active { transform: scale(0.95); }
.visit-seg-btn.active {
  background: rgba(242, 138, 123, 0.15);
  border-color: rgba(242, 138, 123, 0.4);
  color: #fff;
}
.visit-tips {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.visit-tips li {
  padding: 10px 12px;
  background: rgba(242, 138, 123, 0.06);
  border: 1px solid rgba(242, 138, 123, 0.12);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
}
.visit-tips strong { color: #f28a7b; }
.visit-tips a { color: #f28a7b; text-decoration: none; font-size: 14px; }
.visit-tips a:active { opacity: 0.7; }
.visit-weather {
  background: rgba(242, 138, 123, 0.08);
  border: 1px solid rgba(242, 138, 123, 0.18);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
  text-align: center;
}
.visit-weather-temps {
  font-family: 'JetBrains Mono', monospace;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 1px;
}
.visit-weather-high { color: #f28a7b; }
.visit-weather-sep { color: var(--text-muted); margin: 0 4px; }
.visit-weather-low { color: var(--text-muted); }
.visit-weather-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-top: 2px;
}
.visit-weather-desc {
  font-size: 14px;
  color: var(--text);
  margin-top: 8px;
  line-height: 1.5;
}
.visit-date-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 16px;
  color: var(--text);
  min-height: 44px;
  color-scheme: dark;
}
.visit-date-input:focus {
  border-color: rgba(242, 138, 123, 0.6);
  box-shadow: 0 0 12px rgba(242, 138, 123, 0.15);
  outline: none;
}
.visit-date-banner {
  background: rgba(242, 138, 123, 0.1);
  border: 1px solid rgba(242, 138, 123, 0.25);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 14px;
  font-family: 'JetBrains Mono', monospace;
  text-align: center;
}
.visit-date-banner strong { color: #f28a7b; }
.visit-thanks {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  font-size: 15px;
  line-height: 1.6;
  border: 1px solid rgba(242, 138, 123, 0.2);
}

/* ---- Emergency Page ---- */
.emergency-page {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px 40px;
}
.emergency-page .header { margin-bottom: 20px; }
.emergency-banner {
  background: rgba(231, 76, 60, 0.15);
  border: 2px solid rgba(231, 76, 60, 0.5);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
}
.emergency-banner a {
  color: #e74c3c;
  text-decoration: none;
  font-size: 22px;
}
.emergency-section { margin-bottom: 16px; }
.emergency-section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #e74c3c;
  margin-bottom: 8px;
  padding-left: 2px;
}
.emergency-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 4px 0;
  overflow: hidden;
}
.emergency-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 16px;
  font-size: 14px;
  gap: 12px;
}
.emergency-row + .emergency-row { border-top: 1px solid var(--border); }
.emergency-row-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.emergency-contact-card {
  display: block;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.emergency-contact-card:active { background: var(--bg-hover); }
.emergency-contact-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.emergency-contact-phone {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 700;
  color: #e74c3c;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}
.emergency-contact-detail {
  font-size: 13px;
  color: var(--text-muted);
}
.emergency-contact-note {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 4px;
}
.emergency-directions-link {
  display: block;
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #e74c3c;
  text-decoration: none;
  padding: 6px 4px 0;
  letter-spacing: 0.5px;
}
.emergency-directions-link:active { opacity: 0.7; }

/* ---- Sleep Score ---- */
.sleep-score-pills {
  margin-top: 8px;
}
.sleep-score-pill-date {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.sleep-score-pill-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.sleep-score-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid;
  min-width: 52px;
}
.sleep-score-pill .pill-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.sleep-score-pill .pill-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 700;
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .quick-mic.recording,
  .tv-bar-fill.tv-bar-active { animation: none; }

  .quick-btn,
  .nav a { transition: none; }
}

/* ---- Dashboard Home ---- */
