:root {
  color-scheme: dark;
  --bg: #0a0b0c;
  --bg-elevated: #111315;
  --panel: #16181b;
  --panel-2: #1c1f24;
  --accent: #5e6a27;
  --accent-dim: #4a5520;
  --accent-soft: rgba(94, 106, 39, 0.2);
  --brand-ink: #ece8e1;
  --text: #ece8e1;
  --muted: #8f9399;
  --border: #2a2e34;
  --success: #5a9e4d;
  --danger: #8b4545;
  --danger-text: #f0c8c8;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: linear-gradient(180deg, #060708 0%, var(--bg) 40%, #0d0e10 100%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* —— Site header & nav —— */
.site-shell {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 1.15rem 1.5rem 1.05rem;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(94, 106, 39, 0.18), transparent 55%),
    linear-gradient(180deg, #121410 0%, rgba(10, 11, 12, 0.98) 70%);
}

.site-shell-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.site-header {
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  position: static;
}

/* Legacy alias — older pages may still use site-header-inner */
.site-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
  line-height: 0;
}

.wordmark-logo {
  display: block;
  height: 132px;
  width: auto;
  max-width: min(500px, 88vw);
  object-fit: contain;
  background: transparent;
  border-radius: 0;
  padding: 0;
  filter: none;
}

@media (max-width: 640px) {
  .site-header {
    padding: 0.95rem 1rem 0.85rem;
  }

  .wordmark-logo {
    height: 102px;
    max-width: min(360px, 92vw);
  }
}

.auth-logo {
  display: block;
  width: min(100%, 400px);
  height: auto;
  margin: 0 auto 1.1rem;
  background: transparent;
  border-radius: 0;
  padding: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.brand-name {
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  text-transform: none;
  font-variant: normal;
  color: var(--brand-ink);
  font-weight: 700;
}

.brand-name .brand-ops {
  color: var(--accent);
}

.site-nav {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.site-nav a:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--panel);
}

.site-nav a.active {
  color: var(--text);
  border-color: var(--accent-dim);
  background: var(--accent-soft);
}

/* —— Page shell —— */
.page-main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.25rem 0;
}

.page-intro {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

/* —— Stat cards (property snapshot) —— */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
}

.stat-card .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.stat-card .value {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}

.stat-card .sub {
  margin-top: 0.3rem;
  font-size: 0.78rem;
  color: var(--muted);
}

/* —— Chat —— */
#messages {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-bottom: 1rem;
  min-height: 200px;
}

.msg {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 100%;
}

.msg.user { align-items: flex-end; }
.msg.assistant { align-items: flex-start; }

.bubble {
  padding: 0.85rem 1rem;
  border-radius: 14px;
  line-height: 1.5;
  max-width: min(720px, 100%);
  white-space: pre-wrap;
}

.msg.user .bubble {
  background: #2a2218;
  border: 1px solid #4a3a28;
}

.msg.assistant .bubble {
  background: var(--panel);
  border: 1px solid var(--border);
}

.visual {
  width: 100%;
  max-width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem 1.1rem;
  overflow: hidden;
}

.visual h3 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.visual .meta {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 0.9rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.chip {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  cursor: pointer;
}

.chip:hover {
  color: var(--text);
  border-color: var(--accent-dim);
}

.hour-chart {
  width: 100%;
  max-width: 100%;
  margin-top: 0.55rem;
  overflow: hidden;
}

.hour-bars {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 3px;
  align-items: end;
  height: 110px;
  width: 100%;
}

.hour-bar {
  width: 85%;
  max-width: none;
  min-width: 0;
  min-height: 2px;
  margin: 0 auto;
  background: linear-gradient(180deg, var(--accent), var(--accent-dim));
  border-radius: 2px 2px 0 0;
  justify-self: center;
}

.hour-bar.peak {
  box-shadow: 0 0 6px rgba(212, 135, 61, 0.4);
}

.hour-axis {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 3px;
  width: 100%;
  margin-top: 0.4rem;
}

.hour-label {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

/* legacy wrappers — keep harmless if old markup appears */
.hour-bar-wrap,
.hour-bar-area {
  min-width: 0;
  width: 100%;
  height: 100%;
}

.timeline {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 0.35rem;
  margin-top: 0.5rem;
}

.day-col {
  min-width: 54px;
  flex: 0 0 auto;
  text-align: center;
}

.day-bar-wrap {
  height: 72px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.day-bar {
  width: 28px;
  background: linear-gradient(180deg, var(--accent), var(--accent-dim));
  border-radius: 6px 6px 2px 2px;
  min-height: 4px;
}

.day-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.35rem;
  white-space: nowrap;
}

.day-count {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 600;
}

.species-bars { display: flex; flex-direction: column; gap: 0.55rem; }

.species-row {
  display: grid;
  grid-template-columns: 110px 1fr 36px;
  gap: 0.6rem;
  align-items: center;
  font-size: 0.88rem;
}

.species-track {
  height: 10px;
  background: #0a0b0c;
  border-radius: 999px;
  overflow: hidden;
}

.species-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  border-radius: 999px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.65rem;
}

.thumb-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  padding: 0;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: zoom-in;
  width: 100%;
}

.thumb-card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.thumb-card img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  background: #0a0b0c;
  pointer-events: none;
}

.thumb-card .cap {
  padding: 0.4rem 0.45rem;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.3;
}

.buck-list,
.deer-list { display: flex; flex-direction: column; gap: 1rem; }

.buck-card,
.deer-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
}

.buck-head,
.deer-head {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.65rem;
}

.buck-head img,
.deer-head img {
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  background: #0a0b0c;
  flex-shrink: 0;
}

.buck-head h4,
.deer-head h4 {
  margin: 0;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.buck-head p,
.deer-head p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.badge.confirmed {
  color: var(--success);
  border-color: rgba(90, 158, 77, 0.45);
  background: rgba(90, 158, 77, 0.12);
}

.badge.likely {
  color: var(--accent);
  border-color: rgba(212, 135, 61, 0.45);
  background: var(--accent-soft);
}

.mini-timeline {
  display: flex;
  gap: 3px;
  overflow-x: auto;
  padding: 0.25rem 0;
}

.mini-day {
  min-width: 8px;
  height: 22px;
  border-radius: 3px;
  background: #2a2e34;
}

.mini-day.active {
  background: var(--accent);
}

.sightings-row {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  margin-top: 0.5rem;
}

.sightings-row img {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  background: #0a0b0c;
}

#composer {
  position: sticky;
  bottom: 0;
  z-index: 25;
  background: linear-gradient(180deg, transparent, var(--bg) 18%);
  padding: 0.55rem 1rem 0.7rem;
  border-top: 1px solid var(--border);
}

#composer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

#composer input {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-size: 0.88rem;
  outline: none;
  min-height: 34px;
}

#composer input:focus {
  border-color: var(--accent-dim);
}

#composer button {
  border: none;
  background: var(--accent);
  color: #1a1208;
  font-weight: 700;
  border-radius: 999px;
  padding: 0 0.85rem;
  cursor: pointer;
  font-size: 0.8rem;
  min-height: 34px;
}

#composer button.composer-secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  font-weight: 600;
  white-space: nowrap;
  padding: 0 0.55rem;
  font-size: 0.75rem;
}

#composer button.composer-secondary:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--accent-dim);
}

#composer button:disabled {
  opacity: 0.55;
  cursor: wait;
}

#welcome {
  color: var(--muted);
  text-align: center;
  padding: 1.5rem 1rem 0.5rem;
}

.typing {
  color: var(--muted);
  font-style: italic;
  padding: 0.5rem 0;
}

/* —— Labeling —— */
.label-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
}

#pair-context {
  text-align: center;
  color: var(--muted);
  margin: 0 0 1rem;
  font-size: 0.92rem;
}

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

.scout-details {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.scout-details summary {
  cursor: pointer;
  padding: 0.85rem 1rem;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--muted);
  list-style: none;
  user-select: none;
}

.scout-details summary::-webkit-details-marker { display: none; }

.scout-details summary::before {
  content: "▸ ";
  color: var(--accent);
}

.scout-details[open] summary::before {
  content: "▾ ";
}

.scout-details-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border);
}

.scout-details-body p {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.verdict {
  color: var(--accent);
  font-weight: 700;
  text-transform: capitalize;
}

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

.scout-actions button {
  padding: 0.55rem 1rem;
  font-size: 0.88rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.cam-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.85rem;
  text-align: center;
}

.cam-card img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: 8px;
  background: #0a0b0c;
}

.cam-card p {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

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

.card-actions button {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  cursor: pointer;
}

.card-actions button:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--accent-dim);
}

.label-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  max-width: 520px;
  margin: 0 auto;
}

.label-actions .skip-row {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
}

.label-actions button {
  border: none;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.02em;
}

.btn-same {
  background: var(--accent);
  color: #1a1208;
}

.btn-different {
  background: var(--danger);
  color: var(--danger-text);
}

.btn-skip {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border) !important;
  padding: 0.65rem 1.5rem !important;
  font-size: 0.9rem !important;
  font-weight: 600 !important;
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

#status {
  text-align: center;
  color: var(--muted);
  min-height: 1.5rem;
  margin-top: 1rem;
  font-size: 0.88rem;
}

.camera-status {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 1rem;
}

.cameras-main {
  padding-bottom: 2rem;
}

.camera-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  max-width: 920px;
}

.camera-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.camera-card img,
.camera-hero-link img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: #0a0b0c;
}

.camera-hero-link {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

.camera-placeholder {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #0a0b0c;
  font-size: 0.9rem;
}

.camera-card-body {
  padding: 0.9rem 1rem 1rem;
}

.camera-number-badge {
  display: inline-grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  margin-bottom: 0.45rem;
  border-radius: 999px;
  background: var(--accent);
  color: #1a1208;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
}

.camera-card-body h2 {
  margin: 0;
  font-size: 1rem;
}

.camera-meta {
  margin: 0.35rem 0 0.65rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.camera-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.88rem;
  color: var(--text);
}

.camera-stats strong {
  color: var(--accent);
}

.camera-species {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.camera-gallery-label {
  margin: 0;
  padding: 0.75rem 1rem 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.camera-gallery {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0 1rem 1rem;
  scrollbar-width: thin;
}

.camera-gallery-item {
  flex: 0 0 auto;
  display: block;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  padding: 0;
  background: none;
  cursor: zoom-in;
}

.camera-gallery-item img {
  width: 132px;
  height: 99px;
  object-fit: cover;
  display: block;
  background: #0a0b0c;
}

.camera-gallery-item:hover {
  border-color: var(--accent);
}

body.lightbox-open {
  overflow: hidden;
}

.sighting-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
}

.sighting-lightbox.hidden {
  display: none;
}

.sighting-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
}

.sighting-lightbox-panel {
  position: relative;
  z-index: 1;
  width: min(96vw, 960px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sighting-lightbox-panel img {
  width: 100%;
  max-height: calc(92vh - 7rem);
  object-fit: contain;
  border-radius: var(--radius);
  background: #000;
}

.sighting-lightbox-close {
  position: absolute;
  top: -0.25rem;
  right: 0;
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.sighting-lightbox-close:hover {
  background: var(--panel-2);
}

.sighting-lightbox-nav {
  position: absolute;
  top: 42%;
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 999px;
  background: rgba(22, 24, 27, 0.9);
  color: var(--text);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.sighting-lightbox-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.sighting-lightbox-nav.prev { left: -0.25rem; }
.sighting-lightbox-nav.next { right: -0.25rem; }

.sighting-lightbox-meta {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}

.sighting-lightbox-title {
  margin: 0;
  font-weight: 600;
}

.sighting-lightbox-caption {
  margin: 0.25rem 0 0.65rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.sighting-lightbox-back {
  border: 0;
  padding: 0;
  background: none;
  color: var(--accent);
  font-size: 0.9rem;
  cursor: pointer;
}

.sighting-lightbox-back:hover {
  text-decoration: underline;
}

@media (max-width: 700px) {
  .site-shell-inner,
  .site-header-inner {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .page-main {
    padding: 1rem;
  }

  .camera-grid {
    max-width: none;
  }

  .sighting-lightbox-panel {
    width: 100vw;
    max-height: 100vh;
    padding: 0 0.5rem;
  }

  .sighting-lightbox-panel img {
    max-height: calc(100vh - 8rem);
    border-radius: 8px;
  }

  .sighting-lightbox-nav {
    width: 2.75rem;
    height: 2.75rem;
  }

  .sighting-lightbox-nav.prev { left: 0.15rem; }
  .sighting-lightbox-nav.next { right: 0.15rem; }

  .sighting-lightbox-close {
    top: 0.15rem;
    right: 0.15rem;
  }

  .camera-gallery-item img {
    width: 108px;
    height: 81px;
  }

  .stat-row {
    grid-template-columns: 1fr;
  }

  .species-row {
    grid-template-columns: 90px 1fr 30px;
  }

  .hour-label {
    font-size: 0.72rem;
  }

  .pair {
    grid-template-columns: 1fr;
  }

  .label-actions {
    grid-template-columns: 1fr;
  }
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.auth-card {
  width: min(100%, 420px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.auth-card h1.brand-name {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-weight: 700;
  text-transform: none;
  font-variant: normal;
}

.auth-card h1 {
  margin: 0 0 0.35rem;
}

.auth-sub {
  margin: 0 0 1.25rem;
  color: var(--muted);
  text-align: center;
}

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

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

.apple-signin-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 0.25rem;
}

.apple-signin-slot .auth-divider {
  width: 100%;
}

.apple-signin-slot[hidden] {
  display: none !important;
}

.settings-form label,
.auth-card label {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  font-size: 0.9rem;
}

.settings-form input,
.auth-card input,
.auth-card select,
.auth-card textarea {
  padding: 0.65rem 0.75rem;
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
}

.btn-primary,
.btn-secondary {
  border-radius: 8px;
  padding: 0.65rem 1rem;
  border: 0;
  cursor: pointer;
  font-size: 0.95rem;
}

.btn-primary {
  background: var(--accent);
  color: #1a1208;
  font-weight: 600;
}

.btn-secondary {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.auth-error {
  color: var(--danger-text);
  margin-top: 0.75rem;
}

.auth-switch {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.settings-main {
  max-width: 720px;
}

.settings-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem 1.2rem;
  margin-bottom: 1rem;
}

.settings-help,
.settings-status,
.settings-message {
  color: var(--muted);
  font-size: 0.88rem;
}

.settings-message {
  min-height: 1.25rem;
  margin-top: 0.75rem;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.settings-message.is-pending {
  color: var(--accent);
}

.settings-message.is-success {
  color: var(--success);
}

.settings-message.auth-error {
  color: var(--danger-text);
}

button.is-busy,
button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
}

.btn-text {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.35rem 0.5rem;
}

.btn-text:hover {
  color: var(--text);
}

.onboarding-page {
  min-height: 100vh;
  background: var(--bg);
}

.onboarding-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.onboarding-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.onboarding-intro h1 {
  margin: 0 0 0.5rem;
}

.onboarding-intro p {
  margin: 0 0 1.5rem;
  color: var(--muted);
}

.onboarding-steps {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.onboarding-step {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  opacity: 0.65;
}

.onboarding-step.active {
  opacity: 1;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

.onboarding-step.done {
  opacity: 0.85;
}

.onboarding-step.done .step-badge {
  background: color-mix(in srgb, var(--accent) 25%, var(--panel-2));
}

.onboarding-step div {
  display: grid;
  gap: 0.15rem;
}

.onboarding-step span:last-child {
  color: var(--muted);
  font-size: 0.88rem;
}

.step-badge {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.onboarding-step.active .step-badge {
  background: var(--accent);
  color: #1a1208;
}

.onboarding-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.15rem 1.25rem;
}

.onboarding-panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.onboarding-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.sync-status-card {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin: 0.75rem 0 1rem;
  display: grid;
  gap: 0.35rem;
}

.sync-spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.onboarding-actions .btn-primary,
.onboarding-actions .btn-secondary,
.onboarding-actions .btn-text {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.password-field {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}

.password-field input {
  flex: 1;
  min-width: 0;
}

.password-toggle {
  flex-shrink: 0;
  padding: 0 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.password-toggle:hover {
  color: var(--text);
  border-color: var(--accent-dim);
}

.camp-date-range {
  display: grid;
  gap: 0.75rem;
  margin: 0.75rem 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.camp-date-range .settings-help {
  margin: 0;
}

.onboarding-step.done,
.onboarding-step.active {
  cursor: pointer;
}

.sync-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.85rem;
}

.sync-progress {
  margin-top: 0.85rem;
  display: grid;
  gap: 0.4rem;
}

.sync-progress[hidden] {
  display: none;
}

.sync-progress-track {
  width: 100%;
  height: 0.65rem;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  overflow: hidden;
}

.sync-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  transition: width 0.35s ease;
}

.sync-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.btn-danger {
  border: 1px solid var(--danger);
  background: transparent;
  color: var(--danger-text);
  border-radius: var(--radius);
  padding: 0.55rem 0.95rem;
  font: inherit;
  cursor: pointer;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(139, 69, 69, 0.18);
}

.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* —— Intel dashboard —— */
.intel-dashboard {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.dash-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem 1.15rem;
  box-shadow: var(--shadow);
}

.dash-section h2 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 650;
  color: var(--text);
}

.dash-section .dash-sub {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.dash-empty {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.25rem 0 0;
}

.dash-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 800px) {
  .dash-grid-2 {
    grid-template-columns: 1fr;
  }
}

.dash-event-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.65rem;
}

.dash-event-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  padding: 0;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: zoom-in;
}

.dash-event-card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.dash-event-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #0d0e10;
  pointer-events: none;
}

.dash-event-card .cap {
  padding: 0.45rem 0.5rem 0.55rem;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
}

.dash-event-card .cap strong {
  display: block;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 0.15rem;
  text-transform: none;
}

.dash-log {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 280px;
  overflow: auto;
}

.dash-log-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.4rem 0.45rem;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid transparent;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: zoom-in;
}

.dash-log-row:hover {
  border-color: var(--border);
}

.dash-log-row img {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  background: #0d0e10;
}

.dash-log-row .who {
  font-size: 0.86rem;
  color: var(--text);
  font-weight: 600;
}

.dash-log-row .meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.dash-log-row .when {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  text-align: right;
}

.chat-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.25rem 0 1rem;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

/* —— Mobile layout (viewport-based — works without JS) —— */
@media (max-width: 640px) {
  :root {
    --mobile-nav-height: 4.25rem;
  }

  .site-shell-inner {
    flex-wrap: nowrap !important;
  }

  html {
    -webkit-text-size-adjust: 100%;
  }

  body:has(.site-nav) {
    padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom, 0px));
  }

  .site-shell {
    padding: 0.5rem 0.85rem 0.55rem;
    padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
    position: relative;
    top: auto;
  }

  .site-shell-inner {
    justify-content: center;
    flex-wrap: nowrap;
    gap: 0;
    width: 100%;
  }

  .site-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100% !important;
    gap: 0.2rem;
    margin: 0;
    padding: 0.35rem 0.4rem calc(0.4rem + env(safe-area-inset-bottom, 0px));
    background: rgba(10, 11, 12, 0.98);
    border-top: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  }

  .site-nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.45rem 0.3rem;
    font-size: 0.72rem;
    line-height: 1.15;
    text-align: center;
    border-radius: 10px;
    border: 1px solid transparent;
  }

  .wordmark-logo {
    height: 72px;
    max-width: min(260px, 78vw);
  }

  /* Intel / chat: fixed shell — logo+nav top, scroll body, composer bottom */
  body.page-chat {
    display: flex;
    flex-direction: column;
    height: 100svh;
    max-height: 100svh;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
    padding-bottom: 0;
  }

  body.page-chat .site-shell {
    flex: 0 0 auto;
  }

  body.page-chat .page-main {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 0.75rem 0.85rem 1rem;
  }

  body.page-chat #composer {
    position: relative !important;
    bottom: auto !important;
    flex: 0 0 auto;
    z-index: 30;
    margin: 0;
    padding: 0.4rem 0.65rem 0.45rem;
    border-top: 1px solid var(--border);
    background: var(--bg-elevated);
  }

  body.page-chat #composer-inner {
    gap: 0.35rem;
  }

  #composer input {
    font-size: 16px; /* avoid iOS focus zoom */
    min-height: 36px;
    padding: 0.4rem 0.75rem;
  }

  #composer button {
    min-height: 36px;
    padding: 0 0.75rem;
    font-size: 0.78rem;
  }

  #composer button.composer-secondary {
    flex: 0 0 auto;
    padding: 0 0.5rem;
    font-size: 0.72rem;
  }

  .page-main {
    padding: 0.85rem 0.85rem 0.5rem;
  }

  .page-intro {
    font-size: 0.88rem;
    margin-bottom: 0.85rem;
  }

  .stat-row {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

  .stat-card .value {
    font-size: 1.35rem;
  }

  .dash-section {
    padding: 0.85rem 0.9rem 0.95rem;
  }

  .dash-section h2 {
    font-size: 0.95rem;
  }

  /* Compact activity overview — keep charts in the top ~25% of the screen */
  .activity-overview {
    padding: 0.65rem 0.75rem 0.7rem;
    margin-bottom: 0;
  }

  .activity-overview h2 {
    font-size: 0.88rem;
    margin-bottom: 0.1rem;
  }

  .activity-overview .dash-sub {
    margin: 0 0 0.25rem;
    font-size: 0.72rem;
  }

  .activity-overview .meta {
    font-size: 0.72rem;
    margin-bottom: 0.25rem !important;
  }

  .activity-overview .hour-chart {
    margin-top: 0.2rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .activity-overview .hour-bars {
    height: 44px;
    gap: 2px;
    min-width: 420px;
  }

  .activity-overview .hour-axis {
    gap: 2px;
    margin-top: 0.15rem;
    min-width: 420px;
  }

  .activity-overview .hour-label {
    font-size: 0.58rem;
  }

  .activity-overview .timeline {
    margin-top: 0.35rem;
    gap: 3px;
    padding-bottom: 0;
  }

  .activity-overview .day-col {
    min-width: 28px;
  }

  .activity-overview .day-bar-wrap {
    height: 28px;
  }

  .activity-overview .day-count {
    display: none;
  }

  .activity-overview .day-label {
    font-size: 0.55rem;
    margin-top: 0.15rem;
  }

  .event-timeline {
    margin-top: 1.35rem;
  }

  .timeline-day-heading:first-child {
    margin-top: 0;
    margin-bottom: 0.55rem;
  }

  .timeline-event {
    grid-template-columns: 3.4rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.65rem;
  }

  .timeline-event-time {
    padding-top: 0;
    font-size: 0.72rem;
  }

  .timeline-event-body h3 {
    font-size: 0.88rem;
    line-height: 1.25;
  }

  .timeline-event-meta {
    margin-top: 0.1rem;
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .timeline-event-thumbs {
    margin-top: 0;
    gap: 0.25rem;
  }

  .timeline-thumb img {
    width: 48px;
    height: 48px;
  }

  .dash-event-gallery,
  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .hour-chart {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .hour-bars,
  .hour-axis {
    min-width: 520px;
  }

  .hour-label {
    font-size: 0.65rem;
  }

  .species-row {
    grid-template-columns: minmax(72px, 88px) 1fr 28px;
    font-size: 0.82rem;
  }

  .bubble {
    font-size: 0.95rem;
    padding: 0.75rem 0.9rem;
  }

  .visual {
    padding: 0.85rem 0.9rem;
  }

  .visual h3 {
    font-size: 1rem;
  }

  .cameras-main {
    padding-bottom: 0.5rem;
  }

  .camera-gallery {
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 0.85rem 0.85rem;
  }

  .camera-gallery-item img {
    width: 96px;
    height: 72px;
  }

  .sighting-lightbox-panel {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    padding: env(safe-area-inset-top, 0px) 0.35rem env(safe-area-inset-bottom, 0px);
  }

  .sighting-lightbox-panel img {
    max-height: calc(100dvh - 10rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }

  .sighting-lightbox-nav {
    width: 3rem;
    height: 3rem;
    font-size: 1.75rem;
  }

  .sighting-lightbox-close {
    width: 2.75rem;
    height: 2.75rem;
    top: calc(0.35rem + env(safe-area-inset-top, 0px));
    right: 0.35rem;
  }

  .auth-page {
    padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
  }

  .auth-card {
    padding: 1.15rem 1rem 1.25rem;
  }

  .auth-logo {
    width: min(100%, 280px);
  }

  .auth-card input,
  .settings-form input,
  .settings-form select,
  .settings-form textarea {
    font-size: 16px;
    min-height: 44px;
  }

  .btn-primary,
  .btn-secondary {
    min-height: 44px;
  }

  .onboarding-header {
    padding: 0.65rem 0.85rem;
    padding-top: max(0.65rem, env(safe-area-inset-top));
  }

  .onboarding-header .wordmark-logo {
    height: 64px;
  }

  .onboarding-main {
    padding: 1rem 0.85rem calc(2rem + env(safe-area-inset-bottom, 0px));
  }
}

/* —— Device-aware tweaks (optional enhancement via device.js) —— */
html.device-touch {
  -webkit-tap-highlight-color: transparent;
}

/* Tablet: keep top nav, tighten spacing */
html.device-tablet .site-header-inner {
  gap: 0.75rem;
}

html.device-tablet .wordmark-logo {
  height: 108px;
}

html.device-tablet .site-nav a {
  min-height: 40px;
  padding: 0.45rem 0.7rem;
}

html.device-tablet .page-main {
  padding: 1rem 1.1rem 0;
}

html.device-tablet .dash-grid-2 {
  grid-template-columns: 1fr;
}

html.device-tablet #composer input {
  font-size: 16px;
}

html.device-tablet .auth-card input {
  font-size: 16px;
}

/* Desktop polish */
html.device-desktop .site-nav a {
  min-height: 36px;
}

/* —— Compact app header + LandOps Today landing —— */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 56px;
  padding: 0.65rem 1rem 0.4rem;
  padding-top: max(0.85rem, calc(env(safe-area-inset-top, 0px) + 0.45rem));
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  background: rgba(10, 11, 12, 0.96);
}

.app-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 44px;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
}

.app-brand-mark {
  display: block;
  height: 42px;
  width: auto;
  max-width: min(168px, 46vw);
  object-fit: contain;
  object-position: center;
  border-radius: 0;
  flex-shrink: 0;
}

.app-brand-text {
  display: none;
}

.app-property {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: min(52vw, 220px);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  cursor: pointer;
}

.app-property span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-property-caret {
  color: var(--muted);
  font-size: 0.75rem;
}

.property-menu {
  position: relative;
  flex: 0 0 auto;
}

.property-menu-panel {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 80;
  min-width: max(100%, 12.5rem);
  max-width: min(80vw, 18rem);
  padding: 0.35rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  display: grid;
  gap: 0.2rem;
}

.property-menu-panel.hidden,
.property-menu-panel[hidden] {
  display: none !important;
}

.property-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  text-align: left;
  border-radius: 8px;
  padding: 0.7rem 0.75rem;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.property-menu-item.is-active,
.property-menu-item:hover,
.property-menu-item:focus-visible {
  background: var(--accent-soft);
  border-color: var(--accent-dim);
}

.property-menu-check {
  color: var(--accent);
  font-size: 0.85rem;
}

.property-menu-empty {
  margin: 0;
  padding: 0.65rem 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.property-menu-manage {
  display: block;
  margin-top: 0.15rem;
  padding: 0.7rem 0.75rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
  border-radius: 0 0 8px 8px;
}

.property-menu-manage:hover,
.property-menu-manage:focus-visible {
  color: var(--text);
}

.app-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.15rem;
  width: 100%;
  max-width: 1100px;
  margin: 0.2rem auto 0;
  padding: 0 0 0.25rem;
  position: static;
  background: transparent;
  border: none;
  pointer-events: auto;
}

body.page-chat #composer {
  position: relative !important;
  bottom: auto !important;
  z-index: 30;
}

.app-nav a,
.app-nav-more {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 550;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.28rem 0.35rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.1;
}

.app-nav a.active,
.app-nav-more.active,
.app-nav-more[aria-expanded="true"] {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--accent-soft);
}

@media (hover: hover) and (pointer: fine) {
  .app-nav a:hover,
  .app-nav-more:hover {
    color: var(--text);
    border-color: var(--accent-dim);
    background: var(--accent-soft);
  }
}

.more-sheet.hidden,
.more-sheet[hidden] {
  display: none !important;
}

.more-sheet {
  position: fixed;
  inset: 0;
  z-index: 120;
}

.more-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.more-sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  background: var(--panel);
  border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  display: grid;
  gap: 0.35rem;
}

.more-sheet-title {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.more-sheet-panel a[hidden] {
  display: none !important;
}

.more-sheet-panel a {
  display: block;
  padding: 0.85rem 0.75rem;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.today-status {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.today-status.is-attention {
  border-color: color-mix(in srgb, #b7791f 55%, var(--border));
  background: color-mix(in srgb, #b7791f 12%, var(--panel));
}

.today-status-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.today-status-row {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}

.today-status-dot {
  width: 0.65rem;
  height: 0.65rem;
  margin-top: 0.35rem;
  border-radius: 999px;
  background: var(--accent);
  flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.today-status.is-attention .today-status-dot {
  background: #d4a017;
  box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.2);
}

.today-status-headline {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
}

.today-status-detail {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.event-timeline {
  display: grid;
  gap: 0.65rem;
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
}

.timeline-day-heading {
  margin: 0.35rem 0 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.timeline-day-heading:first-child {
  margin-top: 0.15rem;
}

.timeline-event {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem;
}

.timeline-event.severity-medium {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.timeline-event.severity-high,
.timeline-event.severity-critical {
  border-color: color-mix(in srgb, #b7791f 50%, var(--border));
  background: color-mix(in srgb, #b7791f 8%, var(--panel));
}

.timeline-event-time {
  font-size: 0.78rem;
  color: var(--muted);
  padding-top: 0.15rem;
}

.timeline-event-title-row {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}

.timeline-event-marker {
  width: 0.5rem;
  height: 0.5rem;
  margin-top: 0.4rem;
  border-radius: 999px;
  background: var(--accent);
  flex-shrink: 0;
}

.timeline-event.severity-high .timeline-event-marker,
.timeline-event.severity-critical .timeline-event-marker {
  background: #d4a017;
}

.timeline-event-body h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
}

.timeline-event-meta {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.timeline-event-thumbs {
  display: flex;
  gap: 0.4rem;
  margin-top: 0;
  overflow-x: auto;
  flex-shrink: 0;
}

.timeline-event-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

.timeline-action-btn {
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  background: color-mix(in srgb, var(--accent) 18%, var(--panel));
  color: var(--text);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}

.timeline-action-btn:hover {
  background: color-mix(in srgb, var(--accent) 28%, var(--panel));
}

.timeline-thumb {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #0a0b0c;
  cursor: zoom-in;
  flex: 0 0 auto;
}

.timeline-thumb img {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: cover;
}

.action-modal.hidden,
.action-modal[hidden] {
  display: none !important;
}

.action-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: end center;
}

.action-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 12, 0.55);
}

.action-modal-panel {
  position: relative;
  z-index: 1;
  width: min(32rem, 100%);
  max-height: min(92vh, 40rem);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  padding: 1rem 1.1rem 1.25rem;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.28);
}

.action-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.action-modal-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.action-modal-header h2 {
  margin: 0.2rem 0 0;
  font-size: 1.15rem;
}

.action-modal-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
}

.action-modal-preview {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.9rem;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated, var(--panel-2));
}

.action-modal-preview img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  background: #0a0b0c;
}

.action-modal-classification {
  margin: 0;
  font-weight: 650;
}

.action-modal-meta {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.action-modal-form {
  display: grid;
  gap: 0.75rem;
}

.action-field {
  display: grid;
  gap: 0.3rem;
}

.action-field span {
  font-size: 0.78rem;
  color: var(--muted);
}

.action-field input,
.action-field select,
.action-field textarea {
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated, var(--panel-2));
  color: var(--text);
  font: inherit;
}

.action-field textarea {
  resize: vertical;
  min-height: 6rem;
}

.action-modal-status {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.action-modal-status.is-error {
  color: #c45c4a;
}

.action-modal-status.is-ok {
  color: #3d8b6e;
}

.action-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 0.25rem;
}

@media (min-width: 720px) {
  .action-modal {
    place-items: center;
  }

  .action-modal-panel {
    border-radius: 14px;
  }
}

.today-summary {
  margin-bottom: 1.25rem;
}

.today-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}

.today-summary-grid div {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 0.55rem;
  text-align: center;
  display: grid;
  gap: 0.2rem;
}

.today-summary-grid strong {
  font-size: 1.15rem;
  color: var(--accent);
}

.today-summary-grid span {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

@media (max-width: 640px) {
  .app-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.12rem;
    position: static;
    margin: 0.15rem auto 0;
    padding: 0 0 0.2rem;
    background: transparent;
    border: none;
  }

  body:has(.app-nav) {
    padding-bottom: 0;
  }

  .page-main {
    padding-top: 0.75rem;
  }

  .today-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .timeline-event {
    grid-template-columns: 3.4rem minmax(0, 1fr) auto;
    gap: 0.45rem;
    padding: 0.55rem 0.65rem;
  }

  body.page-chat #composer {
    border-top: 1px solid var(--border);
    background: var(--bg-elevated);
    padding: 0.35rem 0.65rem calc(0.4rem + env(safe-area-inset-bottom, 0px));
  }
}

@media (min-width: 641px) {
  .app-header-inner {
    gap: 1rem;
    flex-wrap: nowrap;
  }

  .app-property {
    order: 3;
  }

  .app-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.25rem;
    position: static;
    max-width: 1100px;
    width: 100%;
    margin: 0.25rem auto 0;
    padding: 0 0 0.2rem;
    background: transparent;
    border: none;
  }

  .app-nav a,
  .app-nav-more {
    font-size: 0.7rem;
    padding: 0.3rem 0.55rem;
    border-radius: 999px;
    min-height: 30px;
  }

  body:has(.app-nav) {
    padding-bottom: 0;
  }

  .app-header {
    position: sticky;
  }
}

/* —— Property camera map —— */
.camera-map-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: end;
  margin: 0.75rem 0 0.5rem;
}

.camera-map-view-ui {
  align-items: center;
  justify-content: space-between;
}

.camera-map-select-label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--muted);
  flex: 1 1 180px;
}

.camera-map-select-label select {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  font-size: 0.95rem;
  min-height: 42px;
}

.camera-map-help {
  margin: 0 0 0.65rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.property-map {
  width: 100%;
  height: min(52vh, 360px);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  background: #0a0b0c;
  z-index: 1;
}

.property-map-tall {
  height: min(62vh, 480px);
}

.camera-map-heat-meta {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.camera-map-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.camera-map-list[hidden] {
  display: none;
}

.camera-map-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  cursor: pointer;
  font-size: 0.88rem;
}

.camera-map-list li span {
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
}

.camera-map-list li.is-unplaced {
  border-style: dashed;
}

.camera-map-list li.is-placed strong {
  color: var(--accent);
}

.leaflet-container {
  font: inherit;
  background: #0a0b0c;
}

.camera-pin {
  background: transparent;
  border: 0;
}

.camera-pin-dot {
  display: block;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--accent, #5e6a27);
  border: 2px solid #f4f1e4;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

.camera-pin-label {
  display: inline-block;
  margin-left: 10px;
  margin-top: -18px;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: rgba(12, 14, 12, 0.88);
  color: #f4f1e4;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid rgba(244, 241, 228, 0.18);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.camera-pin.is-editable .camera-pin-dot {
  width: 16px;
  height: 16px;
  margin-left: -8px;
  margin-top: -8px;
}

/* —— Marketing home —— */
.marketing {
  background:
    radial-gradient(80% 50% at 80% 0%, rgba(94, 106, 39, 0.22), transparent 55%),
    linear-gradient(180deg, #070808 0%, var(--bg) 42%, #0c0e0c 100%);
}

.marketing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.1rem 1.25rem;
}

.marketing-nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.marketing-nav a.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.marketing-nav a.nav-link:hover {
  color: var(--text);
}

.marketing-hero,
.marketing-section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
}

.marketing-hero h1 {
  font-size: clamp(1.6rem, 4.2vw, 3.15rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  max-width: 32ch;
  margin: 0.4rem 0 0.8rem;
}

.marketing-kicker {
  color: #c6d08a;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.75rem;
  margin: 0;
}

.marketing-lead {
  max-width: 38rem;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.5;
}

.marketing-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.4rem;
}

.marketing-cta .btn-primary,
.marketing-cta .btn-secondary,
.marketing-nav a.btn-primary {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.marketing-fine {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0.8rem 0 0;
}

.marketing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.marketing-card,
.marketing-price {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.15rem 1.2rem;
}

.marketing-card h2,
.marketing-price h2 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
}

.marketing-card p,
.marketing-price p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.marketing-plans {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.marketing-plans .marketing-price {
  max-width: none;
  display: flex;
  flex-direction: column;
}

.marketing-plans .marketing-price:first-child {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}

.marketing-plans .marketing-cta {
  margin-top: auto;
  padding-top: 1rem;
}

.marketing-price .price {
  font-size: 2.4rem;
  letter-spacing: -0.03em;
  margin: 0.3rem 0;
}

.marketing-price .price span {
  font-size: 1rem;
  color: var(--muted);
  letter-spacing: 0;
}

.marketing-footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.25rem 2.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.trial-nudge[hidden],
.today-status[hidden] {
  display: none !important;
}

.trial-nudge {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  background: rgba(94, 106, 39, 0.16);
}

.trial-nudge p {
  margin: 0;
}

.billing-card {
  width: min(32rem, calc(100% - 2rem));
}

.billing-card .btn-primary,
.billing-card .btn-secondary {
  margin-top: 0.6rem;
}

@media (max-width: 800px) {
  .marketing-grid,
  .marketing-plans {
    grid-template-columns: 1fr;
  }
}
