/* ── FONTS ─────────────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Lora';
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url('/fonts/lora-variable.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/fonts/source-sans-3-variable.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/ibm-plex-mono-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── DESIGN TOKENS ─────────────────────────────────────────────────────────── */
:root {
  --surface-page:     #f9f7f4;
  --surface-card:     #ffffff;
  --surface-card-alt: #fdfaf6;
  --surface-subtle:   #f3f0eb;
  --text-primary:     #1f2937;
  --text-secondary:   #4b5563;
  --text-muted:       #9ca3af;
  --color-primary:    #4b7a8a;
  --color-primary-dk: #3a6070;
  --color-accent:     #6b7db3;
  --status-normal:    #4a8c6f;
  --status-review:    #b8860b;
  --status-neutral:   #6b7280;
  --border-default:   #e5e0d8;
  --border-strong:    #c9c3bb;
  --sidebar-width:    220px;
  --radius-card:      10px;
  --radius-btn:       8px;
}

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

/* ── BASE ──────────────────────────────────────────────────────────────────── */
body {
  font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--surface-page);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 {
  font-family: 'Lora', Georgia, serif;
  color: var(--text-primary);
  line-height: 1.2;
}
h1 { font-size: 2rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; }

p { color: var(--text-secondary); line-height: 1.65; }

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-dk); text-decoration: underline; }

code {
  background: var(--surface-subtle);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.875em;
}

/* ── PUBLIC LAYOUT ─────────────────────────────────────────────────────────── */
.public-page { display: flex; flex-direction: column; min-height: 100vh; }

.public-header {
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-default);
  padding: 0 40px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-logo {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.site-logo span { color: var(--color-primary); }
.site-logo:hover { text-decoration: none; color: var(--text-primary); }

.public-nav { display: flex; align-items: center; gap: 24px; }
.public-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}
.public-nav a:hover { color: var(--text-primary); text-decoration: none; }
.public-nav a.signin {
  background: var(--color-primary);
  color: #fff;
  padding: 8px 20px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  transition: background 0.15s;
}
.public-nav a.signin:hover { background: var(--color-primary-dk); color: #fff; text-decoration: none; }

.public-main { flex: 1; }

.public-container { max-width: 1100px; margin: 0 auto; padding: 0 40px; }

.public-footer {
  background: var(--surface-card);
  border-top: 1px solid var(--border-default);
  padding: 28px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.public-footer .copy { font-size: 0.8125rem; color: var(--text-muted); }
.public-footer nav { display: flex; gap: 20px; flex-wrap: wrap; }
.public-footer nav a { font-size: 0.8125rem; color: var(--text-secondary); text-decoration: none; }
.public-footer nav a:hover { color: var(--text-primary); }

/* ── LANDING HERO ──────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #3a6070 0%, #4b7a8a 40%, #6b7db3 100%);
  padding: 100px 40px 120px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.06) 1px, transparent 0);
  background-size: 32px 32px;
  pointer-events: none;
}
.hero-inner { max-width: 680px; margin: 0 auto; position: relative; }
.hero h1 {
  font-size: 3rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.15;
  margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
}
.hero h1 em { font-style: normal; opacity: 0.8; }
.hero > .hero-inner > p {
  font-size: 1.125rem;
  color: rgba(255,255,255,0.82);
  line-height: 1.7;
  margin-bottom: 2.5rem;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}
.hero-cta {
  display: inline-block;
  background: #fff;
  color: var(--color-primary-dk);
  padding: 16px 40px;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 700;
  font-family: 'Source Sans 3', sans-serif;
  text-decoration: none;
  transition: background 0.15s, transform 0.15s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.hero-cta:hover { background: #f3f0eb; transform: translateY(-1px); text-decoration: none; color: var(--color-primary-dk); }

/* ── LANDING: FEATURES ─────────────────────────────────────────────────────── */
.features-section { padding: 80px 0; }
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.feature-card {
  background: var(--surface-card-alt);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-card);
  padding: 28px;
}
.feature-icon { margin-bottom: 14px; color: var(--color-primary); }
.feature-icon svg { width: 28px; height: 28px; }
.feature-card h3 { font-size: 1rem; margin-bottom: 8px; }
.feature-card p { font-size: 0.9rem; margin: 0; }

/* ── LANDING: TRUST BAR ────────────────────────────────────────────────────── */
.trust-bar {
  text-align: center;
  padding: 36px 0;
  border-top: 1px solid var(--border-default);
  border-bottom: 1px solid var(--border-default);
  font-size: 1rem;
  color: var(--text-secondary);
  font-style: italic;
  font-family: 'Lora', Georgia, serif;
}
.trust-bar strong { color: var(--text-primary); font-style: normal; }

/* ── LANDING: PRICING ──────────────────────────────────────────────────────── */
.pricing-section { padding: 80px 0; }
.pricing-section > .public-container > h2 {
  font-size: 2rem;
  text-align: center;
  margin-bottom: 0.5rem;
}
.pricing-sub {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 3rem;
  font-size: 1rem;
}
.plans-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
  max-width: 1040px;
  margin: 0 auto;
}
.plan-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 32px;
}
.plan-card.highlighted {
  border-color: var(--color-primary);
  border-width: 2px;
}
.plan-badge {
  display: inline-block;
  background: rgba(75,122,138,0.12);
  color: var(--color-primary);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 14px;
}
.plan-name { font-family: 'Lora', Georgia, serif; font-size: 1.2rem; font-weight: 700; margin-bottom: 4px; }
.badge-soon {
  display: inline-block;
  background: rgba(120,120,120,0.10);
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 10px;
  vertical-align: middle;
  margin-left: 6px;
}
.plan-price {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}
.plan-price span { font-size: 1rem; font-weight: 400; color: var(--text-muted); }
.plan-desc { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 24px; line-height: 1.5; }
.plan-features { list-style: none; padding: 0; margin: 0 0 28px; }
.plan-features li {
  font-size: 0.9rem;
  color: var(--text-secondary);
  padding: 6px 0;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.plan-features li::before { content: "✓"; color: var(--status-normal); font-weight: 700; flex-shrink: 0; }
.plan-features li.muted::before { content: "–"; color: var(--border-strong); }
.plan-features li.muted { color: var(--text-muted); }
.plan-cta {
  display: block;
  text-align: center;
  padding: 12px;
  border-radius: var(--radius-btn);
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: 'Source Sans 3', sans-serif;
  text-decoration: none;
  border: 1.5px solid var(--color-primary);
  color: var(--color-primary);
  transition: background 0.15s;
}
.plan-cta:hover { background: var(--surface-subtle); text-decoration: none; }
.plan-card.highlighted .plan-cta { background: var(--color-primary); color: #fff; }
.plan-card.highlighted .plan-cta:hover { background: var(--color-primary-dk); }
.pricing-disclaimer { text-align: center; font-size: 0.75rem; color: var(--text-muted); margin-top: 2rem; line-height: 1.5; }

/* ── AUTH LAYOUT ───────────────────────────────────────────────────────────── */
.auth-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--surface-page);
  padding: 40px 20px;
}
.auth-logo {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  margin-bottom: 28px;
  display: block;
  text-align: center;
  letter-spacing: -0.01em;
}
.auth-logo span { color: var(--color-primary); }
.auth-logo:hover { text-decoration: none; color: var(--text-primary); }
.auth-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 460px;
}
.auth-card h1 { font-size: 1.375rem; margin-bottom: 0.5rem; }
.auth-card p { font-size: 0.9375rem; margin-bottom: 1.5rem; }
.auth-card a { color: var(--color-primary); }

/* ── APP LAYOUT (sidebar) ──────────────────────────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--surface-card);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform 0.25s ease;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}
.sidebar-logo a {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.sidebar-logo a span { color: var(--color-primary); }
.sidebar-logo a:hover { text-decoration: none; color: var(--text-primary); }

.sidebar-nav { flex: 1; padding: 10px 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.12s, color 0.12s;
  cursor: pointer;
}
.nav-item:hover { background: var(--surface-subtle); color: var(--text-primary); text-decoration: none; }
.nav-item.active { border-left-color: var(--color-primary); background: var(--surface-subtle); color: var(--color-primary); }
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; stroke-width: 1.75; }

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-default);
  flex-shrink: 0;
}
.sidebar-footer form { margin: 0; }
.sidebar-signout {
  background: none;
  border: none;
  padding: 8px 0;
  font-size: 0.875rem;
  font-family: 'Source Sans 3', sans-serif;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  transition: color 0.12s;
}
.sidebar-signout:hover { color: var(--text-primary); }
.sidebar-signout svg { width: 16px; height: 16px; flex-shrink: 0; }

.app-main { flex: 1; margin-left: var(--sidebar-width); min-width: 0; }

.app-content { max-width: 960px; padding: 36px 40px 80px; }

.page-title { font-size: 1.75rem; font-weight: 700; margin-bottom: 28px; }

/* mobile */
.hamburger {
  display: none;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--text-primary);
}
.hamburger svg { display: block; }
.mobile-nav-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 56px;
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-default);
  position: sticky;
  top: 0;
  z-index: 150;
}
.mobile-logo {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}
.mobile-logo span { color: var(--color-primary); }
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 190;
}

/* ── STATUS BANNER ─────────────────────────────────────────────────────────── */
.status-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: var(--radius-card);
  margin-bottom: 20px;
  font-size: 0.9375rem;
  font-weight: 500;
}
.status-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.status-banner.normal { background: #f0fdf7; color: #1a5c3e; border: 1px solid #bbf0d6; }
.status-banner.normal .status-dot { background: var(--status-normal); }
.status-banner.review { background: #fffbeb; color: #78450a; border: 1px solid #fde68a; }
.status-banner.review .status-dot { background: var(--status-review); }
.status-banner.neutral { background: var(--surface-subtle); color: var(--text-secondary); border: 1px solid var(--border-default); }
.status-banner.neutral .status-dot { background: var(--status-neutral); }

/* ── SUMMARY CARD ──────────────────────────────────────────────────────────── */
.summary-card {
  background: var(--surface-card-alt);
  border: 1px solid var(--border-default);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-card);
  padding: 26px 30px;
  margin-bottom: 20px;
}
.summary-ai-badge {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
  display: block;
}
.summary-text {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text-primary);
}

/* ── STAT CARDS ────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-card);
  padding: 20px 18px;
  min-height: 96px;
}
.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.stat-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── TIMELINE ──────────────────────────────────────────────────────────────── */
.timeline-section-heading {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-default);
  font-family: 'Source Sans 3', sans-serif;
}
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-default);
  align-items: flex-start;
}
.timeline li:last-child { border-bottom: none; }
.tl-time {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 72px;
  padding-top: 2px;
  line-height: 1.4;
  flex-shrink: 0;
}
.tl-time .tl-abs { display: block; font-size: 0.625rem; margin-top: 2px; opacity: 0.7; }
.tl-body { flex: 1; min-width: 0; }
.tl-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.tl-device { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.tl-thumb {
  width: 64px; height: 48px;
  border-radius: 6px;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid var(--border-default);
  display: block;
  background: var(--surface-subtle);
  transition: opacity 0.15s;
}
.tl-thumb:hover { opacity: 0.85; }
.tl-thumb-placeholder {
  width: 64px; height: 48px;
  border-radius: 6px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5625rem;
  color: var(--text-muted);
  font-family: 'Source Sans 3', sans-serif;
}
.tl-thumb-locked {
  width: 64px; height: 48px;
  border-radius: 6px;
  border: 1px solid var(--border-default);
  background: linear-gradient(135deg, #d4d4d8 0%, #a1a1aa 100%);
  filter: blur(2px);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  font-family: 'Source Sans 3', sans-serif;
  transition: filter 0.15s;
}
.tl-thumb-locked:hover { filter: blur(0); }
.tl-thumb-locked .tl-lock-icon { font-size: 1rem; line-height: 1; }
.tl-thumb-locked .tl-lock-text { font-size: 0.5rem; font-weight: 600; text-align: center; margin-top: 2px; text-shadow: 0 1px 2px rgba(0,0,0,0.4); }
/* Hour-grouped history rows */
.timeline li.tl-hour { display: block; padding: 0; border-bottom: 1px solid var(--border-default); }
.tl-hour-toggle {
  display: grid;
  grid-template-columns: 60px 90px 1fr auto auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  background: transparent;
  border: 0;
  padding: 10px 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.tl-hour-toggle:hover { background: var(--surface-subtle); }
.tl-hour-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
}
.tl-hour-count { font-size: 0.75rem; color: var(--text-muted); }
.tl-hour-strip { display: flex; gap: 4px; align-items: center; min-width: 0; overflow: hidden; }
.tl-strip-thumb {
  width: 36px; height: 28px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid var(--border-default);
  background: var(--surface-subtle);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  color: var(--text-muted);
}
.tl-strip-locked { filter: blur(1px); }
.tl-strip-more {
  font-size: 0.6875rem;
  color: var(--text-muted);
  padding: 2px 6px;
  background: var(--surface-subtle);
  border-radius: 4px;
  flex-shrink: 0;
}
.tl-hour-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.tl-hour-badge { font-size: 0.6875rem; padding: 1px 6px; }
.tl-hour-chevron { font-size: 0.75rem; color: var(--text-muted); transition: transform 0.15s; }
.tl-hour.is-open .tl-hour-chevron { transform: rotate(180deg); }
.tl-hour-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  padding: 0 0 12px;
}
.tl-grid-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border-default);
  background: var(--surface-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-decoration: none;
}
.tl-grid-thumb:hover { opacity: 0.85; }
.tl-grid-locked { filter: blur(2px); color: #fff; background: linear-gradient(135deg, #d4d4d8 0%, #a1a1aa 100%); }
.tl-grid-locked:hover { filter: blur(0); }
.tl-grid-placeholder { cursor: default; }
@media (max-width: 640px) {
  .tl-hour-toggle { grid-template-columns: 48px 1fr auto; }
  .tl-hour-count, .tl-hour-strip { display: none; }
  .tl-hour-grid { grid-template-columns: repeat(4, 1fr); }
}
#modal-caption { color: #fff; font-size: 0.875rem; margin-top: 10px; text-align: center; }
#modal-caption .badge { margin-left: 4px; }

/* History page: sticky day headers + transition / terminal rows */
.timeline li.tl-day-header {
  display: block;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-page);
  border-bottom: 1px solid var(--border-default);
  padding: 10px 0 8px;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}
.timeline li.tl-day-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.timeline li.tl-day-header.is-empty { font-weight: 600; color: var(--text-muted); }
.summary-toggle {
  background: transparent;
  border: 0;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.summary-toggle:hover { background: var(--surface-subtle); }
.timeline li.tl-summary-panel {
  display: block;
  background: var(--surface-card-alt);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-card);
  padding: 12px 14px;
  margin: 8px 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-secondary);
}
.timeline li.tl-summary-panel.is-empty { color: var(--text-muted); font-style: italic; }
.tl-day-empty { color: var(--text-muted); font-weight: 500; }
.timeline li.tl-expired-band {
  display: block;
  background: var(--surface-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-card);
  padding: 10px 14px;
  margin: 10px 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}
.timeline li.tl-expired-band a { font-weight: 600; }
.timeline li.tl-terminal {
  display: block;
  text-align: center;
  padding: 24px 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
  border-bottom: none;
}
#scroll-sentinel { height: 1px; }

/* Density strip: 7 bars of per-day activity counts, log-scaled. Clicking jumps the timeline. */
.density-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin: 4px 0 20px;
  align-items: end;
}
.density-strip .ds-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  height: 64px;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  gap: 4px;
}
.density-strip .ds-fill {
  display: block;
  background: var(--color-accent);
  border-radius: 3px 3px 0 0;
  transition: filter 0.15s;
  min-height: 2px;
}
.density-strip .ds-bar:hover .ds-fill { filter: brightness(1.1); }
.density-strip .ds-bar.is-today .ds-fill { background: var(--color-primary); }
.density-strip .ds-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-family: 'Source Sans 3', sans-serif;
  text-align: center;
  letter-spacing: 0.02em;
}
.density-strip .ds-bar.is-today .ds-label { color: var(--text-primary); font-weight: 600; }
.density-strip .ds-bar:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: 4px; }

/* History page sticky nav: appears once strip + filter bar have scrolled out of view */
.history-sticky-nav {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 24px;
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-default);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.8125rem;
}
.history-sticky-nav[hidden] { display: none; }
.history-sticky-nav .sn-date { font-weight: 700; color: var(--text-primary); }
.history-sticky-nav .sn-sep { color: var(--text-muted); }
.history-sticky-nav .sn-filters { color: var(--text-secondary); flex: 1; }
.history-sticky-nav .sn-show {
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-btn);
  padding: 4px 10px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
}
.history-sticky-nav .sn-show:hover { background: var(--surface-subtle); }
@media (max-width: 768px) { .history-sticky-nav { left: 0; padding: 8px 16px; } }
#sticky-nav-trigger { height: 1px; margin-top: -1px; }

/* Density-view segmented toggle: Last 7 days / Calendar (Care+Premium only) */
.density-toggle {
  display: inline-flex;
  margin: 0 0 8px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-btn);
  overflow: hidden;
  background: var(--surface-card);
}
.density-toggle .dt-btn {
  padding: 5px 12px;
  font-family: inherit;
  font-size: 0.8125rem;
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  cursor: pointer;
}
.density-toggle .dt-btn:not(:last-child) { border-right: 1px solid var(--border-default); }
.density-toggle .dt-btn.is-active { background: var(--color-primary); color: #fff; font-weight: 600; }

/* Calendar heatmap: 7 rows (weekdays), columns flow left-to-right by week */
.density-heatmap {
  display: grid;
  grid-template-rows: repeat(7, 14px);
  grid-auto-flow: column;
  grid-auto-columns: 14px;
  gap: 3px;
  margin: 4px 0 20px;
  padding: 6px 0;
}
.density-heatmap[hidden] { display: none; }
.density-heatmap .dh-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: var(--surface-subtle);
}
.density-heatmap .dh-empty { background: transparent; cursor: default; }
.density-heatmap .dh-cell-0 { background: var(--surface-subtle); }
.density-heatmap .dh-cell-1 { background: #cfd8e8; }
.density-heatmap .dh-cell-2 { background: #8da5c0; }
.density-heatmap .dh-cell-3 { background: #5a7a98; }
.density-heatmap .dh-cell-4 { background: var(--color-primary-dk); }
.density-heatmap .dh-cell:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.density-heatmap .dh-loading { color: var(--text-muted); font-size: 0.8125rem; grid-column: 1 / -1; grid-row: 1 / -1; }

/* History page filter bar: camera dropdown + event-type chips */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding: 10px 12px;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-card);
}
.filter-bar .filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-family: 'Source Sans 3', sans-serif;
}
.filter-bar .filter-select {
  padding: 6px 10px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-btn);
  background: var(--surface-card);
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text-primary);
  min-width: 160px;
}
.type-chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.type-chip {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-default);
  background: var(--surface-card);
  font-family: inherit;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.type-chip:hover { background: var(--surface-subtle); }
.type-chip.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  font-weight: 600;
}
.type-chip:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* ── BADGES ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge.human    { background: #dbeafe; color: #1d4ed8; } .badge.human::before    { background: #3b82f6; }
.badge.animal   { background: #fef3c7; color: #92400e; } .badge.animal::before   { background: #f59e0b; }
.badge.vehicle  { background: #ede9fe; color: #6d28d9; } .badge.vehicle::before  { background: #8b5cf6; }
.badge.doorbell { background: #fce7f3; color: #9d174d; } .badge.doorbell::before { background: #ec4899; }
.badge.active   { background: #dcfce7; color: #166534; } .badge.active::before   { background: #22c55e; }
.badge.inactive { background: #fee2e2; color: #991b1b; } .badge.inactive::before { background: #ef4444; }
.badge.motion   { background: var(--surface-subtle); color: var(--text-secondary); } .badge.motion::before { background: var(--text-muted); }

.btn-state { min-width: 96px; color: #fff; border: none; font-weight: 500; transition: background .15s; }
.btn-state.on  { background: #22c55e; } .btn-state.on:hover  { background: #16a34a; }
.btn-state.off { background: #ef4444; } .btn-state.off:hover { background: #dc2626; }

/* ── BUTTONS ───────────────────────────────────────────────────────────────── */
button, .btn {
  font-family: 'Source Sans 3', sans-serif;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  text-decoration: none;
  line-height: 1;
}
.btn-primary { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-dk); border-color: var(--color-primary-dk); color: #fff; text-decoration: none; }
.btn-outline { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn-outline:hover { background: var(--surface-subtle); text-decoration: none; color: var(--color-primary); }
.btn-sm { padding: 6px 13px; font-size: 0.875rem; }
.btn-danger { background: transparent; color: #dc2626; border-color: #fca5a5; }
.btn-danger:hover { background: #fef2f2; text-decoration: none; }
.btn-danger-filled { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger-filled:hover { background: #b91c1c; border-color: #b91c1c; text-decoration: none; }

/* plain button resets for inline uses */
button.plain {
  background: none; border: none; padding: 0;
  font-size: inherit; color: inherit;
}

/* ── FORMS ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
input[type=email], input[type=text], input[type=password] {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-size: 0.9375rem;
  font-family: 'Source Sans 3', sans-serif;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  background: var(--surface-card);
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type=email]:focus, input[type=text]:focus, input[type=password]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(75,122,138,0.1);
}
input::placeholder { color: var(--text-muted); }
.auth-submit {
  display: block;
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  font-weight: 600;
  font-family: 'Source Sans 3', sans-serif;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.15s;
}
.auth-submit:hover { background: var(--color-primary-dk); }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input[type=text], .inline-form input[type=email] { width: auto; min-width: 200px; }

/* ── TABLES ────────────────────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-card);
  overflow: hidden;
}
thead tr { background: var(--surface-subtle); }
th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-default);
  font-family: 'Source Sans 3', sans-serif;
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-default);
  color: var(--text-secondary);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }

/* ── SETTINGS ──────────────────────────────────────────────────────────────── */
.section-heading {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 32px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-default);
  font-family: 'Source Sans 3', sans-serif;
}
.section-heading:first-child { margin-top: 0; }

.privacy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-card);
  flex-wrap: wrap;
}
.privacy-row-text strong { display: block; color: var(--text-primary); font-size: 0.9375rem; font-weight: 600; }
.privacy-row-text p { font-size: 0.825rem; color: var(--text-muted); margin: 4px 0 0; line-height: 1.5; }

.danger-zone {
  margin-top: 16px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-card);
  background: var(--surface-card);
}
.danger-zone > summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  list-style: none;
  user-select: none;
}
.danger-zone > summary::-webkit-details-marker { display: none; }
.danger-zone > summary::before {
  content: '▸';
  display: inline-block;
  width: 14px;
  margin-right: 6px;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.danger-zone[open] > summary::before { content: '▾'; }
.danger-zone[open] > summary { border-bottom: 1px solid var(--border-default); }
.danger-zone-body { padding: 16px; }

#delete-confirm {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: var(--radius-card);
  padding: 20px;
  margin-top: 1rem;
}
#delete-confirm p { color: #991b1b; font-weight: 500; margin-bottom: 12px; }

/* ── UPGRADE PROMPT ────────────────────────────────────────────────────────── */
.upgrade-prompt {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-card);
  padding: 20px 22px;
  margin-bottom: 20px;
  font-size: 0.9375rem;
  color: #78450a;
}
.upgrade-prompt strong { display: block; margin-bottom: 4px; }
.upgrade-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ── DATE NAV ──────────────────────────────────────────────────────────────── */
.date-nav { display: flex; gap: 10px; align-items: center; margin-bottom: 24px; }
.date-nav .cur-date {
  font-family: 'Lora', Georgia, serif;
  font-weight: 600;
  min-width: 130px;
  text-align: center;
  color: var(--text-primary);
}
.date-nav button {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 0.875rem;
  font-family: 'Source Sans 3', sans-serif;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s;
}
.date-nav button:hover { background: var(--surface-subtle); }
.date-nav button:disabled { opacity: 0.4; cursor: default; }

/* ── MODAL ─────────────────────────────────────────────────────────────────── */
#modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.78);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
#modal-overlay.open { display: flex; }
#modal-img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 10px;
  display: block;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
#modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── EMPTY STATE ───────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 0; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state .empty-title { font-weight: 600; color: var(--text-secondary); font-size: 1rem; }
.empty-state .empty-sub { font-size: 0.875rem; margin-top: 6px; }

/* ── PAGINATION ────────────────────────────────────────────────────────────── */
#pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 20px;
  align-items: center;
}
#pagination button {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.875rem;
  font-family: 'Source Sans 3', sans-serif;
  color: var(--text-secondary);
  cursor: pointer;
}
#pagination button:hover { background: var(--surface-subtle); }
#pagination .page-info { font-size: 0.8125rem; color: var(--text-muted); padding: 0 4px; }

/* ── TIMELINE STATUS ───────────────────────────────────────────────────────── */
#timeline-status { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 8px; }

/* ── MISC ──────────────────────────────────────────────────────────────────── */
.msg { font-size: 0.875rem; color: var(--text-secondary); }

.invite-banner {
  padding: 10px 14px;
  border-radius: var(--radius-btn);
  margin-bottom: 12px;
  font-size: 0.9375rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.invite-banner.success { background: #f0fdf7; color: #1a5c3e; border: 1px solid #bbf0d6; }
.invite-banner.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ── LEGAL ─────────────────────────────────────────────────────────────────── */
.legal-content { max-width: 860px; }
.legal-content h1 { margin-bottom: 0.25rem; }
.legal-content .updated { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 2rem; display: block; }
.legal-content h2 { margin-top: 2.5rem; margin-bottom: 0.75rem; }
.legal-content h3 { margin-top: 1.75rem; margin-bottom: 0.5rem; }
.legal-content p, .legal-content ul, .legal-content ol { color: var(--text-secondary); margin-bottom: 1rem; }
.legal-content ul, .legal-content ol { padding-left: 1.5rem; }
.legal-content li { margin-bottom: 0.25rem; }
.legal-content table { margin: 1rem 0; }

/* ── DIAGRAM ───────────────────────────────────────────────────────────────── */
.diagram {
  background: var(--surface-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-card);
  padding: 24px;
  margin: 24px 0;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.875rem;
}
.diagram .box {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  padding: 12px 16px;
  margin: 0 auto;
  max-width: 420px;
  text-align: center;
  font-family: 'Source Sans 3', sans-serif;
}
.diagram .box.accent { background: rgba(75,122,138,0.07); border-color: rgba(75,122,138,0.3); }
.diagram .box.highlight { background: #f0fdf7; border-color: #bbf0d6; }
.diagram .arrow { text-align: center; padding: 8px 0; color: var(--text-muted); }
.diagram .arrow-row { display: flex; gap: 24px; margin: 8px 0; }
.diagram .branch { flex: 1; display: flex; flex-direction: column; align-items: center; }
.diagram .note {
  margin-top: 16px; padding: 12px;
  background: #fffbeb;
  border-radius: 6px;
  text-align: center;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.875rem;
  color: #78450a;
}

/* ── RESPONSIVE ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .hamburger { display: flex; align-items: center; justify-content: center; }
  .mobile-nav-header { display: flex; }
  .app-main { margin-left: 0; }
  .app-content { padding: 20px 20px 60px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .features-grid { grid-template-columns: 1fr; }
  .plans-grid { grid-template-columns: 1fr; }

  .hero { padding: 60px 24px 80px; }
  .hero h1 { font-size: 2rem; }

  .public-header { padding: 0 20px; }
  .public-container { padding: 0 20px; }
  .public-footer { padding: 24px 20px; flex-direction: column; align-items: flex-start; }
  .auth-card { padding: 28px 24px; }
  .inline-form input[type=email], .inline-form input[type=text] { min-width: 160px; }

  .page-title { font-size: 1.375rem; margin-bottom: 20px; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.75rem; }
  .hero-cta { padding: 14px 28px; }
}

/* ── SUBSCRIPTION SECTION (settings) ───────────────────────────────────────── */
.subscription-section { margin-bottom: 24px; }
.subscription-section[data-period="monthly"] .ann-only { display: none; }
.subscription-section[data-period="annual"] .mon-only { display: none; }

.subscription-section .sub-plans-grid {
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  max-width: 100%;
  margin: 0;
}
.subscription-section .plan-card { padding: 20px; }
.subscription-section .plan-price { font-size: 2rem; }

.period-toggle {
  display: inline-flex;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-btn);
  background: var(--surface-card);
  padding: 3px;
  margin-bottom: 16px;
}
.period-toggle button {
  border: 0; background: transparent; color: var(--text-secondary);
  padding: 6px 16px; border-radius: calc(var(--radius-btn) - 3px);
  font-size: 0.875rem; font-weight: 600; cursor: pointer;
  font-family: 'Source Sans 3', sans-serif;
}
.period-toggle button.active {
  background: var(--color-primary); color: #fff;
}

.plan-cta.is-current {
  background: var(--surface-subtle);
  color: var(--text-muted);
  border-color: var(--border-default);
  cursor: default;
}
.plan-card.is-current .plan-cta.is-current { background: var(--surface-subtle); color: var(--text-muted); }
.plan-card.is-current { border-color: var(--color-primary); border-width: 2px; }

.plan-cta.is-cancel {
  border-color: var(--border-default);
  color: var(--text-secondary);
  background: transparent;
  font-weight: 500;
}
.plan-cta.is-cancel:hover { background: var(--surface-subtle); color: var(--text-primary); }

.save-badge {
  display: inline-block;
  background: rgba(34,148,90,0.12);
  color: var(--status-normal);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 10px;
  vertical-align: middle;
  margin-left: 6px;
}

.sub-status-line {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 12px;
}
.sub-status-line .link-portal {
  border: 0; background: 0; padding: 0;
  color: var(--color-primary);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
}

.trial-banner { margin-bottom: 16px; }
.trial-banner a { color: inherit; text-decoration: underline; font-weight: 600; }
.grace-banner { margin-bottom: 16px; }
.grace-banner a { color: inherit; text-decoration: underline; font-weight: 600; }

.subscription-banner.success {
  background: #f0fdf7;
  color: #1a5c3e;
  border: 1px solid #bbf0d6;
  padding: 10px 14px;
  border-radius: var(--radius-btn);
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 0.9375rem;
}

.subscription-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-btn);
  margin-bottom: 16px;
}
.subscription-summary-info { font-size: 0.9375rem; color: var(--text-primary); }
.subscription-summary-info strong { color: var(--text-primary); font-weight: 700; }
.subscription-summary-info .trial-days-left { color: var(--status-review, var(--color-primary)); font-weight: 600; }
.subscription-summary-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.subscription-section[data-grid-collapsed="true"] .subscription-grid-wrap { display: none; }

@media (max-width: 900px) {
  .subscription-section .sub-plans-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .subscription-summary { align-items: flex-start; flex-direction: column; }
}

/* ── ANALYTICS DASHBOARD ──────────────────────────────────────────────────── */
.ai-header { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.page-title-hero {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
  color: var(--text-primary);
}
.ai-meta-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.ai-meta-sep { color: var(--text-muted); opacity: 0.5; }
.ai-meta { font-size: 0.8rem; color: var(--text-muted); }
.ai-actions { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.ai-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid var(--border-default);
  background: var(--surface-card);
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.ai-action:hover { background: var(--surface-subtle); text-decoration: none; }
.ai-action.is-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.ai-action.is-primary:hover { background: var(--color-primary-dk); color: #fff; }
.ai-filter-row { display: flex; justify-content: flex-end; margin: 0 0 14px; }

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.ac-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  min-height: 220px;
}
.ac-dim {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.ac-title { font-size: 1rem; font-weight: 600; margin: 0 0 12px; color: var(--text-primary); }
.ac-headline {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.ac-unit {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 6px;
  vertical-align: baseline;
}
.ac-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 8px 0 12px; font-size: 0.8rem; color: var(--text-muted); }
.ac-comparison { color: var(--text-secondary); font-weight: 600; }
.ac-delta { color: var(--text-muted); }
.ac-chart { margin-top: auto; }

@media (max-width: 720px) {
  .analytics-grid { grid-template-columns: 1fr; }
  .ac-card { min-height: 180px; padding: 18px; }
  .page-title-hero { font-size: 1.875rem; }
  .ac-headline { font-size: 2rem; }
  .ai-filter-row { justify-content: flex-start; }
}

/* ── PHOTO ALBUM HISTORY ──────────────────────────────────────────────────── */
.ph-album { list-style: none; padding: 0; margin: 0; }
.ph-day-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 24px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-default);
}
.ph-day-header.is-empty { opacity: 0.55; }
.ph-day-label { font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.ph-day-empty { font-size: 0.85rem; color: var(--text-muted); }
.ph-day-header .summary-toggle {
  margin-left: auto;
  font-size: 0.8rem;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  color: var(--text-secondary);
}
.ph-day-grid { list-style: none; padding: 0; margin: 0 0 8px; }
.ph-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.ph-thumb {
  position: relative;
  aspect-ratio: 1;
  background: var(--surface-muted, #f3f4f6);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
}
.ph-thumb .ph-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ph-corner {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.ph-locked, .ph-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.ph-locked a { color: inherit; text-decoration: none; font-size: 1.4rem; }

.history-filter-sticky {
  position: sticky;
  top: 0;
  background: var(--surface-page, #ffffff);
  z-index: 5;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-default);
  margin-bottom: 8px;
}

/* ── ANALYTICS PILLS ──────────────────────────────────────────────────────── */
.ai-header-right { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.ai-pills {
  display: inline-flex;
  background: var(--surface-muted, #f3f4f6);
  border-radius: 8px;
  padding: 2px;
  border: 1px solid var(--border-default);
}
.ai-pill {
  background: transparent;
  border: 0;
  padding: 6px 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
}
.ai-pill.is-active {
  background: var(--surface-card, #ffffff);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.ai-pill[disabled] { cursor: not-allowed; opacity: 0.5; }
.ac-chart-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 16px 4px;
  font-style: italic;
}

/* ── SNAPSHOT STRIP ───────────────────────────────────────────────────────── */
.snapshot-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 0 0 20px;
}
.ss-tile {
  position: relative;
  aspect-ratio: 16/10;
  background: var(--surface-muted, #f3f4f6);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  display: block;
}
.ss-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ss-tile-overlay {
  position: absolute;
  inset: auto 0 0 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  color: #fff;
  padding: 24px 10px 8px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  pointer-events: none;
}
.ss-tile-label { font-size: 0.75rem; font-weight: 600; }
.ss-tile-time { font-size: 0.7rem; opacity: 0.9; font-variant-numeric: tabular-nums; }
.ss-empty { cursor: default; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 0 8px; text-align: center; }
.ss-empty .ss-tile-label { color: var(--text-muted); font-size: 0.75rem; font-weight: 600; margin-bottom: 6px; }
.ss-empty .ss-tile-time { color: var(--text-default, #1f2937); font-size: 0.85rem; font-weight: 600; opacity: 1; font-variant-numeric: tabular-nums; }
.ss-empty .ss-tile-device { color: var(--text-muted); font-size: 0.7rem; margin-top: 2px; }
.ss-empty-text { color: var(--text-muted); font-size: 1.25rem; }

@media (max-width: 720px) {
  .snapshot-strip { grid-template-columns: repeat(2, 1fr); }
}

/* ── COLD-START STATES ────────────────────────────────────────────────────── */
.ac-chart-learning { opacity: 0.45; }

/* ── 1-CAMERA LAYOUT ──────────────────────────────────────────────────────── */
/* With only 1 camera, the per-camera card is hidden and we re-flow to a 5-card grid:
   row 1 has 3 columns, row 2 has 2. Only on >720px viewports — narrow layouts already
   stack to a single column. */
@media (min-width: 721px) {
  .analytics-grid.is-five-cards { grid-template-columns: repeat(6, 1fr); }
  .analytics-grid.is-five-cards > .ac-card:nth-child(1) { grid-column: span 2; }
  .analytics-grid.is-five-cards > .ac-card:nth-child(2) { grid-column: span 2; }
  .analytics-grid.is-five-cards > .ac-card:nth-child(3) { grid-column: span 2; }
  .analytics-grid.is-five-cards > .ac-card:nth-child(4) { grid-column: span 3; }
  .analytics-grid.is-five-cards > .ac-card:nth-child(5) { grid-column: span 3; }
}

/* ── LOCKED ANALYTICS CARDS ───────────────────────────────────────────────── */
.ac-card.ac-locked {
  background: repeating-linear-gradient(45deg, var(--surface-card), var(--surface-card) 10px, var(--surface-muted, #f8fafc) 10px, var(--surface-muted, #f8fafc) 20px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.ac-locked-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
}
.ac-locked-text { font-size: 0.85rem; font-weight: 500; }
.ac-locked-cta {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--brand, #2563eb);
  text-decoration: none;
  font-weight: 600;
  text-align: center;
}
.ai-pill.is-locked { opacity: 0.4; cursor: not-allowed; }
