/*
 * BioStride — Clinical Instrument Theme
 * Matched to the BioStride logo: steel navy, ECG precision, veterinary authority
 */

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

:root {
  /* Brand — extracted from logo */
  --brand:        #2b4c7e;
  --brand-dark:   #1a3254;
  --brand-deeper: #0f1f36;
  --brand-mid:    #3d6a9e;
  --brand-light:  #ddeef8;
  --brand-pale:   #f0f7ff;

  /* Interactive */
  --accent:       #2563eb;
  --accent-dark:  #1d4ed8;
  --accent-light: #dbeafe;

  /* Traffic Light */
  --green:  #059669;
  --amber:  #d97706;
  --red:    #dc2626;
  --grey:   #94a3b8;

  /* Text */
  --text:        #0f1f33;
  --text-muted:  #4a6580;
  --text-light:  #7a98b4;

  /* Surface */
  --border:  #dde8f2;
  --bg:      #f2f6fb;
  --surface: #ffffff;

  /* Radii */
  --radius:    6px;
  --radius-lg: 10px;
  --radius-xl: 16px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(15,31,51,.06);
  --shadow:    0 1px 3px rgba(15,31,51,.08), 0 1px 2px rgba(15,31,51,.05);
  --shadow-md: 0 4px 8px rgba(15,31,51,.09), 0 2px 4px rgba(15,31,51,.05);
  --shadow-lg: 0 12px 24px rgba(15,31,51,.12), 0 4px 8px rgba(15,31,51,.06);

  /* Fonts */
  --font-serif: 'Lora', Georgia, 'Times New Roman', serif;
  --font:       'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:  'IBM Plex Mono', 'SF Mono', 'Cascadia Code', monospace;

  --sidebar-width: 248px;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
.icon { vertical-align: middle; flex-shrink: 0; }

/* ─── Sidebar ────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--brand-deeper);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,.05);
}

/* Logo sits in a white pill — the brand lives here */
.sidebar-brand {
  display: block;
  padding: 1.25rem 1rem 1rem;
  text-decoration: none;
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-logo-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  padding: .5rem .75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow .2s;
}
.sidebar-brand:hover .sidebar-logo-wrap {
  box-shadow: 0 0 0 2px rgba(255,255,255,.15);
}
.sidebar-logo {
  height: 36px;
  width: auto;
  display: block;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: .25rem .75rem 1rem;
}
.sidebar-label {
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.3);
  padding: 1rem .5rem .4rem;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .75rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  color: rgba(255,255,255,.6);
  text-decoration: none;
  transition: background .15s, color .15s;
  min-height: 40px;
}
.sidebar-link:hover {
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.9);
  text-decoration: none;
}
.sidebar-link.active {
  background: var(--brand);
  color: #fff;
}
.sidebar-link .icon { opacity: .65; }
.sidebar-link.active .icon,
.sidebar-link:hover .icon { opacity: 1; }

.sidebar-footer {
  padding: .75rem;
  border-top: 1px solid rgba(255,255,255,.07);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .5rem;
  font-size: .8rem;
  color: rgba(255,255,255,.5);
}
.sidebar-user-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-signout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: rgba(255,255,255,.4);
  cursor: pointer;
  padding: .3rem;
  border-radius: var(--radius);
  transition: color .15s, background .15s;
}
.sidebar-signout:hover {
  color: #fff;
  background: rgba(255,255,255,.1);
}

/* ─── Mobile Tab Bar ─────────────────────────────────── */
.mobile-tabbar {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.mobile-tabbar-inner { display: flex; align-items: stretch; }
.tabbar-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  padding: .5rem .25rem;
  min-height: 52px;
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-light);
  text-decoration: none;
  transition: color .15s;
}
.tabbar-link:hover, .tabbar-link.active {
  color: var(--brand);
  text-decoration: none;
}
.tabbar-link .icon { width: 22px; height: 22px; }

/* ─── App Body ───────────────────────────────────────── */
.app-body { margin-left: var(--sidebar-width); min-height: 100vh; }
.main-content { min-height: 100vh; }
.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.5rem; }
.container-narrow { max-width: 640px; margin: 0 auto; padding: 1.5rem 1.5rem; }

/* ─── Page Header ─────────────────────────────────────── */
.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 0;
}
.page-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-header-actions { display: flex; gap: .5rem; align-items: center; }
.page-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brand-deeper);
  line-height: 1.2;
  letter-spacing: -.01em;
}
.page-subtitle { font-size: .875rem; color: var(--text-muted); margin-top: .2rem; }

/* ─── Section Titles ──────────────────────────────────── */
.section-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand-deeper);
  letter-spacing: -.01em;
}

/* ─── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  min-height: 40px;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 600;
  font-family: var(--font);
  line-height: 1;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  letter-spacing: .01em;
  transition: background .15s, box-shadow .15s, transform .1s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:focus-visible { box-shadow: 0 0 0 3px rgba(43,76,126,.35); outline: none; }

.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); border-color: #c4d4e4; }

.btn-danger { background: #fef2f2; color: var(--red); border: 1px solid #fca5a5; }
.btn-danger:hover { background: #fee2e2; }

.btn-sm { padding: .35rem .7rem; font-size: .8rem; min-height: 32px; }
.btn-full { width: 100%; }

/* ─── Flash Messages ──────────────────────────────────── */
.flash {
  max-width: 1100px;
  margin: .75rem auto 0;
  padding: .75rem 1rem .75rem 1rem;
}
.auth-card .flash {
  max-width: none;
  margin: 0 0 1rem 0;
}
.flash {
  padding: .75rem 1rem .75rem 1rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .875rem;
  gap: 1rem;
  border-left: 4px solid transparent;
}
.flash-notice { background: var(--brand-pale); color: var(--brand-dark); border-left-color: var(--brand); }
.flash-alert  { background: #fef2f2; color: #991b1b; border-left-color: var(--red); }
.flash-dismiss { background: none; border: none; cursor: pointer; font-size: 1.1rem; line-height: 1; color: inherit; opacity: .5; }
.flash-dismiss:hover { opacity: 1; }

/* ─── Auth Pages ──────────────────────────────────────── */
.logged-out { background: var(--bg); }
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: var(--bg);

  /* Subtle ECG grid pattern in background */
  background-image:
    linear-gradient(rgba(43,76,126,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(43,76,126,.04) 1px, transparent 1px);
  background-size: 40px 40px;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.25rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.auth-header { text-align: center; margin-bottom: 2rem; }
.auth-logo {
  margin: 0 auto .75rem;
  display: flex;
  justify-content: center;
}
.auth-logo img {
  height: 56px;
  width: auto;
}
.auth-heading {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brand-deeper);
  letter-spacing: -.02em;
}
.auth-subheading { font-size: .875rem; color: var(--text-muted); margin-top: .3rem; }
.auth-footer { text-align: center; margin-top: 1.25rem; font-size: .875rem; color: var(--text-muted); }

/* ─── Forms ───────────────────────────────────────────── */
.auth-form, .form-card { display: flex; flex-direction: column; gap: 1rem; }
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group label { font-size: .8rem; font-weight: 600; color: var(--text); letter-spacing: .02em; text-transform: uppercase; }
.form-hint { font-size: .78rem; color: var(--text-light); margin-top: .2rem; }

.form-group input,
.form-group select,
.form-group textarea {
  padding: .65rem .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.form-group input, .form-group select { min-height: 44px; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--brand-mid);
  box-shadow: 0 0 0 3px rgba(43,76,126,.12);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

.form-actions { display: flex; gap: .75rem; margin-top: .5rem; flex-wrap: wrap; }
.form-errors {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  padding: .75rem 1rem;
  font-size: .875rem;
  color: var(--red);
}
.form-errors p + p { margin-top: .25rem; }
.link { color: var(--brand-mid); font-weight: 600; }

/* ─── Animal Grid ─────────────────────────────────────── */
.animal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: .75rem;
}
.animal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow .2s, border-color .2s, transform .2s;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.animal-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-mid);
  text-decoration: none;
  transform: translateY(-2px);
}
.animal-card-add {
  align-items: center;
  justify-content: center;
  border-style: dashed;
  color: var(--text-light);
  flex-direction: column;
  gap: .5rem;
  min-height: 160px;
}
.animal-card-add:hover { color: var(--brand-mid); border-color: var(--brand-mid); transform: translateY(-2px); }
.add-icon { font-size: 2rem; font-weight: 300; line-height: 1; }

.animal-card-header { display: flex; align-items: flex-start; justify-content: space-between; }
.animal-avatar { width: 52px; height: 52px; border-radius: 50%; overflow: hidden; }
.avatar-placeholder {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--brand-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--brand-mid);
}
.avatar-large { width: 64px; height: 64px; }
.avatar-upload { display: flex; align-items: center; gap: 1rem; margin-top: .4rem; }
.avatar-upload-preview { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }

.animal-card-body { flex: 1; }
.animal-name { font-size: .95rem; font-weight: 600; color: var(--text); }
.animal-breed { font-size: .8rem; color: var(--text-muted); margin-top: .15rem; }
.animal-meta { font-size: .78rem; color: var(--text-light); margin-top: .1rem; }
.animal-assessments { font-size: .78rem; color: var(--text-light); margin-top: .3rem; }

/* ─── Animal Show Header ─────────────────────────────── */
.animal-header-info { display: flex; align-items: center; gap: 1rem; }
.animal-header-avatar { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; flex-shrink: 0; }

/* ─── Traffic Lights ──────────────────────────────────── */
.traffic-light { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.traffic-light-green   { background: var(--green); box-shadow: 0 0 0 3px rgba(5,150,105,.2); }
.traffic-light-amber   { background: var(--amber); box-shadow: 0 0 0 3px rgba(217,119,6,.2); }
.traffic-light-red     { background: var(--red);   box-shadow: 0 0 0 3px rgba(220,38,38,.2); }
.traffic-light-grey    { background: var(--grey); }
.traffic-light-unknown { background: var(--grey); }
.traffic-light-lg { width: 18px; height: 18px; }

.traffic-light-large {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.traffic-light-large.traffic-light-green { background: rgba(5,150,105,.1); }
.traffic-light-large.traffic-light-amber { background: rgba(217,119,6,.1); }
.traffic-light-large.traffic-light-red   { background: rgba(220,38,38,.1); }
.traffic-light-large.traffic-light-grey  { background: rgba(148,163,184,.1); }
.traffic-light-large .traffic-light-dot  { width: 24px; height: 24px; border-radius: 50%; }
.traffic-light-large.traffic-light-green .traffic-light-dot { background: var(--green); }
.traffic-light-large.traffic-light-amber .traffic-light-dot { background: var(--amber); }
.traffic-light-large.traffic-light-red   .traffic-light-dot { background: var(--red); }
.traffic-light-large.traffic-light-grey  .traffic-light-dot { background: var(--grey); }

/* ─── Health Labels ──────────────────────────────────── */
.health-label { font-weight: 700; }
.health-label-green  { color: var(--green); }
.health-label-amber  { color: var(--amber); }
.health-label-red    { color: var(--red); }
.health-label-grey, .health-label-unknown { color: var(--text-muted); }

/* ─── Badges ─────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.badge-pending    { background: #fef9c3; color: #854d0e; }
.badge-processing { background: var(--brand-light); color: var(--brand-dark); }
.badge-completed  { background: #d1fae5; color: #065f46; }
.badge-rejected   { background: #fee2e2; color: #991b1b; }
.badge-confidence { background: var(--brand-light); color: var(--brand-dark); }

/* ─── Sections ───────────────────────────────────────── */
.section { margin-top: 2rem; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .875rem; }

/* ─── Stats Row (Clinical Instrument Cards) ──────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .875rem;
  margin-top: 1.5rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  border-top: 3px solid var(--brand-light);
  transition: box-shadow .2s, transform .2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-label {
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.stat-value { margin-top: .5rem; display: flex; align-items: center; gap: .5rem; }
.stat-number {
  font-size: 1.65rem;
  font-weight: 600;
  color: var(--brand-deeper);
  font-family: var(--font-mono);
  letter-spacing: -.02em;
}

/* ─── Assessment List ────────────────────────────────── */
.assessment-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.assessment-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.assessment-row:last-child { border-bottom: none; }
.assessment-row:hover { background: var(--bg); }
.assessment-row-info { flex: 1; display: flex; flex-direction: column; gap: .1rem; }
.assessment-animal { font-size: .9rem; font-weight: 600; }
.assessment-date { font-size: .78rem; color: var(--text-muted); }
.assessment-row-meta { display: flex; align-items: center; gap: .5rem; }

/* ─── Assessment Status Panel ───────────────────────── */
.assessment-status-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1rem;
}
.status-processing {
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  gap: 1rem; padding: 1rem 0;
}
.status-processing h3 { font-family: var(--font-serif); font-size: 1.1rem; font-weight: 700; color: var(--brand-deeper); }
.status-processing p  { color: var(--text-muted); font-size: .9rem; }

.status-rejected {
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  gap: 1rem; padding: 1rem 0;
}
.status-rejected .status-icon { color: var(--red); }
.status-rejected h3 { font-family: var(--font-serif); font-size: 1.1rem; font-weight: 700; color: var(--red); }
.status-rejected p  { color: var(--text-muted); font-size: .9rem; max-width: 360px; }

.results-header {
  display: flex; align-items: center; gap: 1.25rem;
  margin-bottom: 1.5rem; padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.results-header h3 { font-family: var(--font-serif); font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; }
.confidence-badge { display: flex; align-items: center; gap: .75rem; margin-top: .3rem; }
.analyzed-time { font-size: .78rem; color: var(--text-muted); }

/* ─── Metrics Grid ───────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: .75rem;
}
.metric-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  transition: box-shadow .2s;
}
.metric-card:hover { box-shadow: var(--shadow); }
.metric-label {
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.metric-value {
  font-size: 1.65rem;
  font-weight: 600;
  margin-top: .3rem;
  display: flex; align-items: baseline; gap: .15rem;
  font-family: var(--font-mono);
  letter-spacing: -.02em;
}
.metric-unit { font-size: .82rem; font-weight: 400; color: var(--text-muted); font-family: var(--font); }
.metric-value-green { color: var(--green); }
.metric-value-amber { color: var(--amber); }
.metric-value-red   { color: var(--red); }

.metric-bar { height: 4px; background: var(--border); border-radius: 999px; margin-top: .6rem; overflow: hidden; }
.metric-bar-fill { height: 100%; border-radius: 999px; transition: width .6s ease; }
.metric-bar-green { background: var(--green); }
.metric-bar-amber { background: var(--amber); }
.metric-bar-red   { background: var(--red); }
.metric-description { font-size: .78rem; color: var(--text-light); margin-top: .4rem; line-height: 1.4; }

/* ─── ECG Spinner ────────────────────────────────────── */
/* An animated ECG line instead of a generic spinner */
.spinner {
  width: 80px;
  height: 40px;
  position: relative;
  overflow: hidden;
}
.spinner::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
  transform: translateY(-50%);
}
.spinner::after {
  content: '';
  position: absolute;
  top: 0; left: -100%; right: 0; bottom: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 40'%3E%3Cpolyline points='0,20 30,20 40,15 50,25 60,20 75,20 85,2 95,38 105,10 115,28 125,20 160,20' fill='none' stroke='%232b4c7e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / 160px 40px;
  animation: ecg-scan 1.2s linear infinite;
}
@keyframes ecg-scan { from { transform: translateX(0); } to { transform: translateX(100%); } }

/* ─── Tutorial Card ──────────────────────────────────── */
.tutorial-card {
  background: var(--surface);
  border: 1px solid var(--brand-light);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.tutorial-header { margin-bottom: 1.25rem; }
.tutorial-header h2 { font-family: var(--font-serif); font-size: 1.1rem; font-weight: 700; color: var(--brand-deeper); }
.tutorial-header p { font-size: .875rem; color: var(--text-muted); margin-top: .25rem; }
.tutorial-steps { display: flex; flex-direction: column; gap: 1rem; }
.tutorial-step { display: flex; gap: 1rem; align-items: flex-start; }
.tutorial-step-icon {
  flex-shrink: 0; width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-pale); border-radius: var(--radius);
  color: var(--brand);
  border: 1px solid var(--brand-light);
}
.tutorial-step-content h3 { font-size: .9rem; font-weight: 600; color: var(--text); }
.tutorial-step-content p  { font-size: .85rem; color: var(--text-muted); margin-top: .2rem; }
.tutorial-footer { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.tutorial-warning { font-size: .82rem; color: var(--amber); display: flex; align-items: center; gap: .4rem; }

/* ─── Upload Area ────────────────────────────────────── */
.upload-area {
  background: var(--bg);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  position: relative;
  transition: border-color .15s, background .15s;
  cursor: pointer;
}
.upload-area:hover { border-color: var(--brand-mid); background: var(--brand-pale); }
.upload-icon { color: var(--brand-mid); margin-bottom: .875rem; display: flex; justify-content: center; opacity: .8; }
.upload-area h3 { font-size: .95rem; font-weight: 600; margin-bottom: .3rem; color: var(--text); }
.upload-hint { font-size: .8rem; color: var(--text-muted); margin-bottom: 1rem; }
.upload-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-preview { padding-top: .75rem; }
.video-preview { width: 100%; max-height: 240px; border-radius: var(--radius); object-fit: cover; }
.upload-file-name { font-size: .8rem; color: var(--text-muted); margin-top: .4rem; }

/* ─── Video + Notes Cards ────────────────────────────── */
.video-card, .notes-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.video-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.video-card h4, .notes-card h4 {
  font-size: .68rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em;
}
.notes-card h4 { margin-bottom: .75rem; }
.video-container { position: relative; width: 100%; }
.skeleton-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.video-player { width: 100%; border-radius: var(--radius); }
.notes-card p { font-size: .9rem; color: var(--text-muted); }

/* ─── Assessment Actions ─────────────────────────────── */
.assessment-actions { display: flex; gap: .75rem; margin-top: 1rem; flex-wrap: wrap; }

/* ─── Empty State ────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--text-muted);
}
.empty-icon {
  margin: 0 auto 1.25rem;
  display: flex; justify-content: center;
  color: var(--brand-light);
  filter: drop-shadow(0 2px 4px rgba(43,76,126,.1));
}
.empty-state h2 {
  font-family: var(--font-serif);
  font-size: 1.2rem; font-weight: 700;
  color: var(--brand-deeper); margin-bottom: .5rem;
}
.empty-state p  { font-size: .9rem; margin-bottom: 1.5rem; color: var(--text-muted); }

/* ─── Confirm Banner ─────────────────────────────────── */
.animal-confirm-banner {
  display: flex; align-items: center; gap: .75rem;
  background: var(--brand-pale);
  border: 1px solid var(--brand-light);
  border-radius: var(--radius);
  padding: .65rem 1rem;
  margin-bottom: .75rem;
}
.animal-confirm-avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex-shrink: 0; }
.animal-confirm-avatar .avatar-placeholder { width: 40px; height: 40px; }
.animal-confirm-text { font-size: .9rem; color: var(--text); flex: 1; }
.animal-confirm-change { font-size: .82rem; color: var(--brand-mid); font-weight: 600; white-space: nowrap; }

/* ─── Camera Capture ─────────────────────────────────── */
.camera-fullscreen {
  position: fixed; inset: 0; z-index: 200;
  background: #000; display: flex; flex-direction: column;
}
.camera-topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 210;
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem; padding-top: calc(.75rem + env(safe-area-inset-top));
  background: linear-gradient(to bottom, rgba(0,0,0,.65) 0%, transparent 100%);
}
.camera-topbar-link { color: #fff; font-size: .9rem; font-weight: 500; text-decoration: none; }
.camera-topbar-link:hover { text-decoration: underline; color: #fff; }
.camera-topbar-status { color: #fff; font-size: .85rem; font-weight: 500; opacity: .9; }

[data-camera-capture-target="liveView"] { position: relative; flex: 1; overflow: hidden; }
.camera-feed { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.camera-playback { width: 100%; height: 60vh; object-fit: contain; background: #000; }

.camera-overlay { position: absolute; inset: 0; z-index: 205; pointer-events: none; }
.framing-guide { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.framing-svg { width: 80%; max-width: 400px; height: auto; }
.framing-toggle-btn {
  pointer-events: auto;
  position: absolute; top: calc(3.5rem + env(safe-area-inset-top)); right: 1rem;
  background: rgba(255,255,255,.18); backdrop-filter: blur(4px);
  color: #fff; border: 1px solid rgba(255,255,255,.3);
  border-radius: var(--radius); padding: .35rem .75rem; font-size: .8rem; cursor: pointer;
}
.framing-toggle-btn:hover { background: rgba(255,255,255,.28); }

.level-indicator-container {
  position: absolute; top: calc(3.5rem + env(safe-area-inset-top)); left: 1rem;
  z-index: 206; display: flex; flex-direction: column; align-items: center; gap: .35rem;
}
.level-indicator {
  width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.5); position: relative;
  overflow: hidden; background: rgba(0,0,0,.3); backdrop-filter: blur(4px);
}
.level-bubble {
  width: 14px; height: 14px; border-radius: 50%; background: #fff;
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  transition: transform .1s ease-out, background .2s;
}
[data-level-state="good"]  .level-indicator { border-color: var(--green); }
[data-level-state="good"]  .level-bubble    { background: var(--green); }
[data-level-state="close"] .level-indicator { border-color: var(--amber); }
[data-level-state="close"] .level-bubble    { background: var(--amber); }
.level-permission-btn {
  background: rgba(255,255,255,.18); color: #fff;
  border: 1px solid rgba(255,255,255,.3); border-radius: var(--radius);
  padding: .25rem .5rem; font-size: .7rem; cursor: pointer;
}

.camera-controls {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 210;
  display: flex; flex-direction: column; align-items: center; gap: .75rem;
  padding: 1.5rem 1rem; padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0,0,0,.65) 0%, transparent 100%);
}
.camera-countdown { color: #fff; font-size: 1.2rem; font-weight: 600; min-height: 1.5rem; font-family: var(--font-mono); }
.record-btn {
  width: 72px; height: 72px; border-radius: 50%;
  border: 4px solid #fff; background: transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
}
.record-btn-inner {
  width: 56px; height: 56px; border-radius: 50%; background: var(--red);
  transition: border-radius .2s, width .2s, height .2s;
}
.record-btn-inner.recording { width: 28px; height: 28px; border-radius: 6px; }

.review-form {
  padding: 1.25rem; background: var(--surface);
  display: flex; flex-direction: column; gap: 1rem; flex: 1;
}
.review-textarea {
  width: 100%; padding: .6rem .85rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .9rem; font-family: var(--font); color: var(--text); resize: vertical;
}
.review-textarea:focus { outline: none; border-color: var(--brand-mid); box-shadow: 0 0 0 3px rgba(43,76,126,.12); }
.review-actions { display: flex; gap: .75rem; flex-wrap: wrap; }

.camera-switch-banner {
  text-align: center; padding: .6rem; font-size: .875rem; margin-bottom: .75rem;
}

/* ─── Vision Analysis ────────────────────────────────── */
.vision-analysis-section { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.vision-analysis-header { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.vision-analysis-header h4 {
  font-size: .68rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .08em;
}
.vision-narrative {
  background: var(--brand-pale); border: 1px solid var(--brand-light);
  border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.25rem;
}
.vision-narrative p { font-size: .9rem; color: var(--text); line-height: 1.65; }
.annotated-frames-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .75rem;
}
.annotated-frame-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.annotated-frame-image { width: 100%; height: auto; display: block; }
.frame-observation { padding: .6rem .75rem; font-size: .8rem; color: var(--text-muted); line-height: 1.4; }

/* ─── Camera UI Details ──────────────────────────────── */
.tilt-warning {
  background: var(--amber); color: #fff;
  font-size: .8rem; font-weight: 600; text-align: center;
  padding: .4rem .75rem; border-radius: var(--radius); display: none;
}
.tilt-warning.visible { display: block; }

.fps-badge {
  background: rgba(255,255,255,.18); backdrop-filter: blur(4px); color: #fff;
  font-size: .7rem; font-weight: 600; padding: .2rem .5rem;
  border-radius: 999px; border: 1px solid rgba(255,255,255,.3);
}
.fps-badge-warning { background: rgba(217,119,6,.6); border-color: var(--amber); }

.subject-detector-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 204; pointer-events: none; }
.subject-detector-wrapper { position: absolute; inset: 0; z-index: 204; pointer-events: none; }
.subject-status {
  position: absolute; top: calc(6rem + env(safe-area-inset-top)); left: 1rem;
  z-index: 207; display: inline-flex; align-items: center; gap: .35rem;
  font-size: .7rem; font-weight: 500; padding: .2rem .55rem;
  border-radius: 999px; backdrop-filter: blur(4px); pointer-events: none;
}
.subject-status-dot { width: 8px; height: 8px; border-radius: 50%; }
.subject-status[data-detected="true"]  { background: rgba(5,150,105,.25); color: #fff; border: 1px solid rgba(5,150,105,.4); }
.subject-status[data-detected="true"]  .subject-status-dot { background: var(--green); }
.subject-status[data-detected="false"] { background: rgba(217,119,6,.25); color: #fff; border: 1px solid rgba(217,119,6,.4); }
.subject-status[data-detected="false"] .subject-status-dot { background: var(--amber); }

/* ─── Recommendation Card ────────────────────────────── */
.recommendation-card {
  margin-top: 1.25rem; padding: 1rem 1.25rem;
  border-radius: var(--radius); border: 1px solid var(--border);
  border-left: 4px solid transparent;
}
.recommendation-green { background: rgba(5,150,105,.05);  border-color: rgba(5,150,105,.15); border-left-color: var(--green); }
.recommendation-amber { background: rgba(217,119,6,.05);  border-color: rgba(217,119,6,.15); border-left-color: var(--amber); }
.recommendation-red   { background: rgba(220,38,38,.05);  border-color: rgba(220,38,38,.15); border-left-color: var(--red); }
.recommendation-title { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: .4rem; }
.recommendation-text { font-size: .9rem; color: var(--text); line-height: 1.55; }

/* ─── Metric Comparison ─────────────────────────────── */
.metric-comparison { font-size: .75rem; color: var(--text-muted); margin-top: .25rem; font-family: var(--font-mono); }
.comparison-up   { color: var(--green); }
.comparison-down { color: var(--red); }

/* ─── Sparkline Card ────────────────────────────────── */
.sparkline-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1rem 1.25rem; margin-bottom: 1rem;
}
.sparkline-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.sparkline-header h4 { font-size: .68rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }
.sparkline-link { font-size: .82rem; font-weight: 600; color: var(--brand-mid); }
.sparkline-canvas { display: block; }
.sparkline-empty { font-size: .85rem; color: var(--text-light); }

/* ─── Trend Chart ───────────────────────────────────── */
.trend-chart-container {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem;
  margin-bottom: 1.5rem; height: 400px;
}
@media (max-width: 768px) { .trend-chart-container { height: 260px; } }
.trend-chart-canvas { width: 100% !important; height: 100% !important; }

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .mobile-tabbar { display: block; }
  .app-body { margin-left: 0; padding-bottom: calc(60px + env(safe-area-inset-bottom)); }

  .page-header-inner { flex-direction: column; align-items: flex-start; gap: .75rem; }
  .page-header-actions { width: 100%; display: flex; flex-wrap: wrap; gap: .5rem; }
  .page-header-actions .btn { flex: 1; min-width: 120px; }
  .page-title { font-size: 1.35rem; }

  .container, .container-narrow { padding: 1rem 1rem; }

  .stats-row    { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .animal-grid  { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .animal-header-info { flex-wrap: wrap; }

  .animal-card { padding: 1rem; gap: .5rem; }
  .stat-card   { padding: .875rem 1rem; }
  .metric-card { padding: .75rem; }
  .metric-value { font-size: 1.4rem; }

  .assessment-row { flex-wrap: wrap; gap: .5rem; padding: .75rem 1rem; }
  .assessment-row-meta { width: 100%; }

  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }

  .auth-card { padding: 1.5rem 1.25rem; }
  .assessment-status-panel { padding: 1.25rem; }
  .results-header { flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; padding-bottom: 1rem; }
  .camera-playback { height: 45vh; }
  .review-actions { flex-direction: column; }
  .review-actions .btn { width: 100%; }
  .section { margin-top: 1.25rem; }
  .section-header { flex-wrap: wrap; gap: .5rem; }
  .annotated-frames-grid { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
  .animal-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr; }
}

/* ── Plan usage bar ──────────────────────────────────────────────── */
.plan-usage-bar {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 20px;
}
.plan-usage-info {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.plan-usage-label { font-size: 0.82rem; color: var(--text-muted); }
.plan-badge {
  font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--brand); background: var(--brand-pale);
  border-radius: 4px; padding: 2px 8px;
}
.plan-usage-track {
  height: 6px; background: var(--border);
  border-radius: 3px; overflow: hidden;
}
.plan-usage-fill {
  height: 100%; background: var(--green);
  border-radius: 3px; transition: width .3s ease;
}
.plan-usage-fill.plan-usage-warning { background: #f59e0b; }
.plan-usage-hint { font-size: 0.78rem; color: var(--text-muted); margin: 8px 0 0; }

/* ── Report gating / upgrade prompt ────────────────────────────── */
.metric-card-locked {
  position: relative;
  overflow: hidden;
  user-select: none;
}
.metric-value-blur {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  filter: blur(6px);
  opacity: 0.5;
}
.metric-value-blur .metric-unit {
  font-size: 0.85rem;
  font-weight: 600;
}
.locked-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-lg);
}
.locked-icon {
  font-size: 1.25rem;
  background: var(--bg);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
}

.upgrade-gate {
  text-align: center;
  background: linear-gradient(135deg, var(--brand-pale), var(--surface));
  border: 2px dashed var(--brand-light);
  border-radius: var(--radius-xl);
  padding: 2rem 1.5rem;
  margin: 1.25rem 0;
}
.upgrade-gate-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}
.upgrade-gate h4 {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brand-deeper);
  margin-bottom: 0.5rem;
}
.upgrade-gate p {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 420px;
  margin: 0 auto 1rem;
  line-height: 1.5;
}
.upgrade-gate .btn {
  margin-top: 0.25rem;
}

/* ─── Turbo Native (iOS / Android) overrides ─────────── */
/*
 * Applied when running inside the BioStride native wrapper.
 * The <html> element gets data-turbo-native="" set by an inline
 * script in the layout as soon as the UA is detected, so these
 * rules are live before first paint.
 */

/* ── Base: system fonts, radii, scroll behaviour ─────────── */
[data-turbo-native] {
  --font:       -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  --font-serif: -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
  --font-mono:  'SF Mono', ui-monospace, monospace;
  --radius:    10px;
  --radius-lg: 12px;
  --radius-xl: 18px;

  /* Prevent rubber-band overscroll — feels more native */
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

/* Disable user-select on chrome, keep it on content */
[data-turbo-native] .page-header,
[data-turbo-native] .sidebar,
[data-turbo-native] .mobile-tabbar,
[data-turbo-native] .btn,
[data-turbo-native] .auth-footer,
[data-turbo-native] .assessment-actions {
  -webkit-user-select: none;
  user-select: none;
}

/* ── Hide web chrome — native provides nav/tab bars ────── */
[data-turbo-native] .sidebar       { display: none !important; }
[data-turbo-native] .mobile-tabbar { display: none !important; }

[data-turbo-native] .app-body {
  margin-left: 0 !important;
  padding-bottom: 0 !important;
}

/* ── Page header: hide entirely in native ───────────────── */
/* Title → native navigation bar (from <title> tag)
   Primary CTA → native bar button via bridge--nav-button
   Back link → native back button
   Nothing in .page-header is needed in native context. */
[data-turbo-native] .page-header { display: none; }

/* ── Buttons — bigger tap targets, pill shape ───────────── */
[data-turbo-native] .btn {
  min-height: 44px;
  border-radius: 12px;
  font-family: var(--font);
  font-weight: 600;
}
[data-turbo-native] .btn-sm { min-height: 36px; }

/* Primary button: bolder for iOS */
[data-turbo-native] .btn-primary {
  box-shadow: 0 1px 3px rgba(43,76,126,.25);
}

/* ── Inputs — iOS grouped/filled style ─────────────────── */
[data-turbo-native] .form-group input,
[data-turbo-native] .form-group select,
[data-turbo-native] .form-group textarea {
  border-radius: 10px;
  font-family: var(--font);
  font-size: 16px; /* prevents iOS zoom on focus */
  min-height: 44px;
  background: rgba(118,118,128,.12);
  border-color: transparent;
}
[data-turbo-native] .form-group input:focus,
[data-turbo-native] .form-group select:focus,
[data-turbo-native] .form-group textarea:focus {
  border-color: var(--brand-mid);
  background: var(--surface);
}
[data-turbo-native] .form-group label {
  font-size: .82rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
}

/* ── Cards — iOS grouped look ───────────────────────────── */
[data-turbo-native] .animal-card,
[data-turbo-native] .stat-card,
[data-turbo-native] .assessment-status-panel,
[data-turbo-native] .sparkline-card,
[data-turbo-native] .form-card,
[data-turbo-native] .video-card,
[data-turbo-native] .notes-card,
[data-turbo-native] .tutorial-card,
[data-turbo-native] .recommendation-card,
[data-turbo-native] .metric-card {
  border-radius: 12px;
}

[data-turbo-native] .assessment-list {
  border-radius: 12px;
}

/* ── Remove hover transforms — touch devices don't hover ── */
[data-turbo-native] .animal-card:hover,
[data-turbo-native] .animal-card-add:hover,
[data-turbo-native] .stat-card:hover,
[data-turbo-native] .metric-card:hover {
  transform: none;
  box-shadow: var(--shadow);
  border-color: var(--border);
}
[data-turbo-native] a:hover { text-decoration: none; }

/* iOS tap highlight */
[data-turbo-native] a,
[data-turbo-native] button { -webkit-tap-highlight-color: rgba(43,76,126,.12); }

/* ── Auth pages — full-screen, no scroll, centred ────────── */
[data-turbo-native] .auth-page {
  min-height: 100vh;
  min-height: 100dvh; /* dynamic viewport — respects keyboard */
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.5rem;
  background: var(--surface);
  background-image: none;
}

[data-turbo-native] .auth-card {
  border: none;
  box-shadow: none;
  background: var(--surface);
  border-radius: 0;
  max-width: 100%;
  width: 100%;
  padding: 0;
}
/* Smaller logo in native — nav bar takes some space */
[data-turbo-native] .auth-logo img {
  height: 48px;
}
[data-turbo-native] .auth-header {
  margin-bottom: 1.5rem;
}
[data-turbo-native] .auth-subheading {
  font-size: .8rem;
}
[data-turbo-native] .auth-footer {
  margin-top: .75rem;
  font-size: .82rem;
}
[data-turbo-native] .auth-page {
  /* Drop the 100vh flex centering — 100vh is fixed to the full screen
     height on iOS and doesn't shrink when the keyboard appears, which
     causes the page to overflow and become scrollable behind the keyboard.
     A plain block layout with top-padding is all we need. */
  display: block;
  min-height: unset;
  background: var(--surface);
  background-image: none;
  padding: 2rem 1.5rem 1.5rem;
}
}

/* ── Assessment rows — iOS list row + disclosure chevron ─── */
[data-turbo-native] .assessment-row {
  padding: .875rem 1rem .875rem 1rem;
  padding-right: 2.5rem;
  position: relative;
  cursor: pointer;
}

/* iOS-style disclosure chevron (›) on each tappable row */
[data-turbo-native] a.assessment-row::after {
  content: '';
  position: absolute;
  right: 1rem;
  top: 50%;
  width: 7px;
  height: 7px;
  border-top: 1.5px solid var(--text-light);
  border-right: 1.5px solid var(--text-light);
  transform: translateY(-50%) rotate(45deg);
}

/* ── Section titles — iOS grouped table header style ────── */
[data-turbo-native] .section-title {
  font-family: var(--font);
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

/* ── Top-of-content spacing (page-header removed) ─────── */
[data-turbo-native] .container:first-of-type,
[data-turbo-native] .container-narrow:first-of-type {
  padding-top: 1.25rem;
}

/* ── Immediate tap feedback — no hover, instant active ──── */
[data-turbo-native] a:active,
[data-turbo-native] button:active,
[data-turbo-native] [role="button"]:active {
  opacity: 0.55;
  transition: opacity 0s;
}

/* Prevent the default 300ms tap delay on iOS */
[data-turbo-native] a,
[data-turbo-native] button { touch-action: manipulation; }

/* ── Flash messages — floating toast overlay ─────────────── */
[data-turbo-native] .flash {
  position: fixed;
  top: 0;
  left: .75rem;
  right: .75rem;
  z-index: 9999;
  border-radius: 14px;
  margin: 0;
  padding: .6rem 1rem;
  font-size: .82rem;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  border-left: none;
  animation: native-toast-in .3s ease-out;
}
/* Position stacked toasts */
[data-turbo-native] .flash + .flash {
  top: 3.25rem;
}
[data-turbo-native] .flash-notice {
  background: var(--brand-deeper);
  color: #fff;
}
[data-turbo-native] .flash-alert {
  background: #dc2626;
  color: #fff;
}
[data-turbo-native] .flash-dismiss {
  color: rgba(255,255,255,.7);
}
[data-turbo-native] .flash-dismiss:hover {
  color: #fff;
}

@keyframes native-toast-in {
  from { opacity: 0; transform: translateY(-20px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Hide the inline flash in auth cards on native — the fixed
   toast handles it. Without this you get double messages. */
[data-turbo-native] .auth-card .flash {
  position: fixed;
}

/* ── Upgrade gate — tighter spacing ─────────────────────── */
[data-turbo-native] .upgrade-gate {
  border-radius: 12px;
  padding: 1.25rem;
}

/* ── Container spacing — slightly tighter on native ──────── */
[data-turbo-native] .container {
  padding-left: 1rem;
  padding-right: 1rem;
}

/* ── Smooth content appearance ───────────────────────────── */
[data-turbo-native] .main-content {
  animation: native-fade-in .15s ease-out;
}
@keyframes native-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Animal grid: full-width list on small native screens ── */
/* On native, a single column list reads better than a 2-up grid
   for most phone sizes (the cards are already descriptive enough). */
@media (max-width: 430px) {
  [data-turbo-native] .animal-grid { grid-template-columns: 1fr; }
}

/* ── Stats row: tighter on native ──────────────────────── */
[data-turbo-native] .stats-row { margin-top: 1rem; }

/* ── Empty state: give it breathing room without page-header */
[data-turbo-native] .empty-state { padding-top: 3rem; }
