/* ============================================
   Trophy Fishery Analytics - Design System
   Natural Waterscapes
   Mobile-First CSS
   ============================================ */

/* --- Brand Palette (MyPond NW Standard) --- */
:root {
  --nw-navy: #141b45;
  --nw-navy-light: #1e2a5e;
  --nw-navy-dark: #0d1230;
  --nw-green: #1c4220;
  --nw-green-light: #2a6330;
  --nw-green-bright: #2e8b38;
  --nw-brown: #8f5a2a;
  --nw-brown-light: #b3723a;
  --nw-cream: #F2E5b3;
  --nw-cream-dim: #d4c899;

  /* Surfaces (MyPond dark) */
  --bg-primary: #0b0f24;
  --bg-card: #141b45;
  --bg-surface: #1a2350;
  --border: #2a3060;

  /* Accent = cream (MyPond). Green is reserved for primary buttons + semantic on-states. */
  --accent: #F2E5b3;
  --accent-bright: #F2E5b3;
  --accent-green: #2a6330;        /* primary button / selected / on-state fills (white text) */
  --success: #27ae60;
  --header-bg: #141b45;

  /* Text — MyPond: off-white body, cream reserved for headings/accents */
  --text-primary: #f0ede4;
  --text-secondary: #c0c2d4;
  --text-muted: #8b91b0;

  /* Chart / canvas token colors (read by JS via getComputedStyle) */
  --chart-grid: #243056;
  --chart-text: #c0c2d4;
  --chart-text-light: #f0ede4;
  --chart-dot-border: #0b0f24;
  --chart-empty: #475569;
  --chart-length: #3ca448;
  --chart-weight: #b3723a;

  /* Score colors */
  --score-skinny: #c0392b;
  --score-average: #d4a017;
  --score-heavyweight: #2e8b38;
  --score-lunker: #8f5a2a;
}

/* --- Light Theme --- */

[data-theme="light"] {
  /* MyPond light-mode surfaces */
  --nw-navy: #ffffff;
  --nw-navy-light: #ddd9d0;
  --nw-navy-dark: #f0ede6;        /* bottom tab bar goes beige in light (MyPond) */
  --nw-cream: #1c4220;            /* "cream text" maps to brand green in light */
  --nw-cream-dim: #5a4a2a;

  --bg-primary: #faf8f2;
  --bg-card: #ffffff;
  --bg-surface: #f0ede6;
  --border: #d8d5cc;

  /* Accent → brand green for text/active states on light surfaces */
  --accent: #1c4220;
  --accent-bright: #1c4220;
  --accent-green: #1c4220;
  --success: #1e8e4e;
  --header-bg: #ffffff;

  --text-primary: #1a1a1a;
  --text-secondary: #3a3a3a;
  --text-muted: #6b7280;

  --chart-grid: #d4d0c8;
  --chart-text: #555555;
  --chart-text-light: #333333;
  --chart-dot-border: #ffffff;
  --chart-empty: #999999;
  --chart-length: #1c4220;
  --chart-weight: #8f5a2a;

  --score-skinny: #a02020;
  --score-average: #b38a10;
  --score-heavyweight: #1c4220;
  --score-lunker: #6b4420;
}

/* Light-mode specific overrides */

[data-theme="light"] .app-header {
  background: #ffffff;
  border-bottom-color: #d8d5cc;
}

[data-theme="light"] .header-title {
  color: #141b45;
}

[data-theme="light"] .header-btn {
  color: #141b45;
}

/* Tab bar flips to beige in light via --nw-navy-dark; items use brand green when active */
[data-theme="light"] .tab-bar {
  border-top-color: #d8d5cc;
}

[data-theme="light"] .tab-item.active {
  color: #141b45;
}

@media (min-width: 1024px) {
  [data-theme="light"] .tab-bar {
    border-right-color: #d8d5cc;
  }

  [data-theme="light"] .tab-item:hover {
    background-color: rgba(20, 27, 69, 0.06);
  }

  [data-theme="light"] .tab-item.active {
    background-color: rgba(20, 27, 69, 0.10);
    border-right-color: #141b45;
  }
}

[data-theme="light"] .stat-card,
[data-theme="light"] .section-card,
[data-theme="light"] .fish-card,
[data-theme="light"] .fish-card-compact,
[data-theme="light"] .profile-card,
[data-theme="light"] .subscription-card,
[data-theme="light"] .feature-card,
[data-theme="light"] .individual-card,
[data-theme="light"] .session-card {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .clickable-row:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .individual-card:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .toast {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .modal-overlay {
  background: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .modal-container {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .landing-logo img {
  filter: none;
}

[data-theme="light"] .header-logo {
  filter: none;
}

/* --- Reset & Base --- */

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

body {
  font-family: Tahoma, 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Utility --- */

.hidden {
  display: none;
}

/* --- App Header --- */

.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(56px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: #F2E5b3;                 /* cream bar (MyPond) */
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  z-index: 100;
  border-bottom: 1px solid #d4c899;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-logo {
  display: none;                       /* hidden on mobile to reclaim space */
  height: 28px;
  width: auto;
  object-fit: contain;
}

.header-title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.1;
  color: #141b45;                      /* navy on cream */
  max-width: 13rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* "Back to MyPond" pill — shown by mypond-return.js only when launched from MyPond */
.mypond-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 1px solid rgba(20, 27, 69, 0.4);
  color: #141b45;
  border-radius: 8px;
  padding: 4px 10px 4px 6px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.mypond-back.hidden { display: none; }
.mypond-back svg { flex-shrink: 0; }

/* While drilling into a detail view (in-app back arrow visible), hide the MyPond pill */
#back-btn:not(.hidden) ~ .mypond-back { display: none; }

.header-btn {
  background: transparent;
  border: none;
  color: #141b45;                      /* navy on cream/white header */
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.units-segmented {
  display: flex;
  border: 1px solid rgba(20, 27, 69, 0.35);
  border-radius: 8px;
  overflow: hidden;
}

.units-seg-btn {
  background: transparent;
  border: none;
  color: #141b45;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.units-seg-btn.units-seg-active {
  background: #141b45;
  color: #F2E5b3;
}

.units-seg-btn:not(.units-seg-active):hover {
  background: rgba(20, 27, 69, 0.08);
}

.photo-input-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.btn-camera {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent-green, #2a6330);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-camera:active {
  background: #246e2d;
}

/* --- Main Content --- */

main#app-content {
  padding-top: calc(56px + env(safe-area-inset-top));
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  overflow-y: auto;
  /* MyPond signature graph-paper grid (cream lines on dark) */
  background:
    repeating-linear-gradient(to right, rgba(242,229,179,0.06) 0px, transparent 1px, transparent 48px),
    repeating-linear-gradient(to bottom, rgba(242,229,179,0.06) 0px, transparent 1px, transparent 48px),
    repeating-linear-gradient(to right, rgba(242,229,179,0.03) 0px, transparent 1px, transparent 24px),
    repeating-linear-gradient(to bottom, rgba(242,229,179,0.03) 0px, transparent 1px, transparent 24px),
    var(--bg-primary);
}

[data-theme="light"] main#app-content {
  background:
    repeating-linear-gradient(to right, rgba(20,27,69,0.10) 0px, transparent 1px, transparent 48px),
    repeating-linear-gradient(to bottom, rgba(20,27,69,0.10) 0px, transparent 1px, transparent 48px),
    repeating-linear-gradient(to right, rgba(100,149,237,0.10) 0px, transparent 1px, transparent 24px),
    repeating-linear-gradient(to bottom, rgba(100,149,237,0.10) 0px, transparent 1px, transparent 24px),
    var(--bg-primary);
}

/* --- Views --- */

.view {
  display: none;
}

.view.active {
  display: block;
}

/* --- Tab Bar --- */

.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(56px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  align-items: center;
  background: var(--nw-navy-dark);
  border-top: 1px solid var(--border);
  z-index: 100;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.625rem;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0;
  /* Guarantee a 44px touch target (WCAG 2.5.5 / iOS HIG). The icon+label stack
     alone came in under that, so tabs were easy to miss with wet hands. */
  min-height: 44px;
  min-width: 44px;
}

.tab-item.active {
  color: var(--accent-bright);
}

.tab-item svg {
  width: 22px;
  height: 22px;
}

/* --- Stat Cards --- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.625rem;
}

.stat-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 0.625rem 0.5rem;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--nw-cream);
}

.stat-card .stat-label {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- Section Cards --- */

.section-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
}

.section-card h3 {
  font-size: 0.8125rem;
  color: var(--nw-cream);
  text-transform: uppercase;
  margin-bottom: 0.375rem;
}

/* --- Forms --- */

.fish-form {
  max-width: 500px;
  margin: 0 auto;
}

.form-group {
  margin-bottom: 0.625rem;
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.form-group .optional {
  font-weight: normal;
  font-style: italic;
  color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.5rem 0.625rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  /* Must be >= 16px: iOS auto-zooms on focus for anything smaller. That was
     previously masked by locking the viewport — now that pinch-zoom is restored,
     undersized inputs would visibly jump the page on every field tap. */
  font-size: 1rem;
}

.form-group select {
  -webkit-appearance: none;
  appearance: none;
}

.form-group input[type="file"] {
  padding: 0.5rem;
  cursor: pointer;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent-bright);
  outline: none;
}

.form-row {
  display: flex;
  gap: 0.75rem;
}

.form-row > * {
  flex: 1;
}

.input-with-btn {
  display: flex;
  gap: 0.5rem;
}

.input-with-btn input {
  flex: 1;
}

.custom-bait-row {
  margin-top: 0.5rem;
}

.custom-bait-row input {
  width: 100%;
}

.btn-icon {
  width: 44px;
  height: 44px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-icon:active {
  background: var(--bg-surface);
}

/* --- Buttons --- */

.btn-primary {
  width: 100%;
  padding: 0.625rem;
  background: var(--nw-green-light);
  color: #fff;
  font-weight: 600;
  font-size: 0.9375rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.btn-primary:active {
  opacity: 0.8;
}

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

.btn-secondary {
  padding: 0.625rem 1.25rem;
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-primary);
  border-radius: 8px;
  cursor: pointer;
}

.btn-danger {
  background: #c0392b;
  color: white;
}

/* --- RW Preview (compact inline) --- */

.rw-preview {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 0.375rem 0.625rem;
  margin-bottom: 0.5rem;
  border-left: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rw-preview.hidden { display: none; }
.rw-preview.skinny { border-left-color: #c0392b; }
.rw-preview.average { border-left-color: #d4a017; }
.rw-preview.heavyweight { border-left-color: #2e8b38; }
.rw-preview.lunker { border-left-color: #8f5a2a; }

.rw-value {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}

.rw-number {
  font-size: 1.25rem;
  font-weight: 700;
}

.rw-score {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  display: inline-block;
}

.rw-label {
  font-size: 0.625rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.rw-detail {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-left: auto;
}

/* --- Fish List / Cards --- */

.fish-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.fish-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 0.625rem 0.75rem;
  display: flex;
  gap: 0.625rem;
  position: relative;
}

.fish-card .fish-photo {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-surface);
}

.fish-card .fish-info {
  flex: 1;
  min-width: 0;
}

.fish-card .fish-species {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.fish-card .fish-measurements {
  font-size: 1rem;
  font-weight: 600;
}

.fish-card .fish-rw {
  position: absolute;
  top: 0.625rem;
  right: 0.75rem;
  text-align: right;
}

.fish-card .fish-rw-value {
  font-size: 1.25rem;
  font-weight: 700;
}

.fish-card .fish-rw-score {
  font-size: 0.6875rem;
  padding: 2px 6px;
  border-radius: 10px;
}

.fish-card .fish-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.fish-card .fish-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.fish-action-btn {
  background: var(--bg-surface);
  border: none;
  color: var(--text-secondary);
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
}

/* --- Fish Card (Log view) --- */

.fish-card-left {
  flex-shrink: 0;
}

.fish-card-photo {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-surface);
}

.fish-card-photo-placeholder {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
}

.fish-card-body {
  flex: 1;
  min-width: 0;
}

.fish-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.fish-card-species {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 600;
}

.fish-card-nickname {
  text-transform: none;
  font-style: italic;
  font-weight: 400;
  color: var(--accent-bright, #2e8b38);
}

.fish-card-date {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.fish-card-measurements {
  font-size: 1rem;
  font-weight: 600;
  margin: 0.125rem 0;
}

.fish-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.25rem;
}

.fish-card-meta .fish-meta-item {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.fish-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.375rem;
}

.btn-sm {
  background: var(--bg-surface);
  border: none;
  color: var(--text-secondary);
  padding: 0.25rem 0.625rem;
  border-radius: 6px;
  font-size: 0.6875rem;
  cursor: pointer;
}

.btn-sm:active {
  background: var(--border);
}

.btn-delete {
  color: #c0392b;
}

/* --- Compact Fish Card (Home recent) --- */

.fish-card-compact {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 0.375rem 0.625rem;
  margin-bottom: 0.375rem;
}

.fish-card-compact .fish-card-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.fish-card-compact .fish-card-species {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 600;
}

.fish-card-compact .fish-card-measurements {
  font-size: 0.875rem;
  font-weight: 600;
}

.fish-card-compact .fish-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

/* --- Log Controls --- */

.log-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.625rem;
}

.search-input {
  flex: 1;
  padding: 0.625rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
}

.filter-select {
  padding: 0.625rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
}

/* --- Landing Page --- */

.landing-hero {
  text-align: center;
  padding: 1.25rem 0.75rem;
  max-width: 600px;
  margin: 0 auto;
}

.landing-logo {
  width: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  overflow: hidden;
}

.landing-logo img {
  width: 100%;
  height: auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.landing-subtitle {
  color: var(--text-secondary);
  font-size: 1.125rem;
  margin-bottom: 1rem;
}

.landing-desc {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.landing-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.feature-card {
  background: var(--bg-card);
  padding: 0.875rem;
  border-radius: 10px;
  text-align: center;
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.feature-card h3 {
  font-size: 0.9375rem;
  margin-bottom: 0.375rem;
}

.feature-card p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.landing-login-hint {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* --- Modals --- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.hidden {
  display: none;
}

.modal-container {
  background: var(--bg-card);
  border-radius: 16px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

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

.modal-header h3 {
  font-size: 1.125rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary {
  flex: 1;
}

.modal-body {
  padding: 0.875rem 1rem;
}

/* --- WR Help Modal --- */

.wr-help-body p {
  margin-bottom: 1rem;
  line-height: 1.5;
}

.wr-scale {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
}

.wr-scale-item {
  padding: 0.625rem 1rem;
  border-radius: 8px;
}

.wr-scale-item.skinny {
  background: rgba(192, 57, 43, 0.15);
  color: #c0392b;
}

.wr-scale-item.average {
  background: rgba(212, 160, 23, 0.15);
  color: #d4a017;
}

.wr-scale-item.heavyweight {
  background: rgba(46, 139, 56, 0.15);
  color: #2e8b38;
}

.wr-scale-item.lunker {
  background: rgba(143, 90, 42, 0.15);
  color: #8f5a2a;
}

/* --- Toast --- */

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  font-size: 0.9375rem;
  font-weight: 600;
  z-index: 300;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  animation: toast-in 0.25s ease-out;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.toast.hidden {
  display: none;
  opacity: 0;
}

.toast-success {
  border-color: var(--success);
  color: var(--success);
}

.toast-error {
  border-color: #c0392b;
  color: #c0392b;
}

.toast-warning {
  border-color: #d4a017;
  color: #d4a017;
}

/* --- Button Success Flash --- */

@keyframes success-flash {
  0%   { background: var(--accent-green); }
  30%  { background: #4ade80; box-shadow: 0 0 12px rgba(74, 222, 128, 0.4); }
  100% { background: var(--accent-green); }
}

.btn-success-flash {
  animation: success-flash 0.8s ease-out;
}

/* --- Load More / Empty State --- */

.load-more-container {
  text-align: center;
  padding: 1rem 0;
}

.empty-state {
  text-align: center;
  padding: 2rem 0.75rem;
  color: var(--text-secondary);
}

/* --- Photo Preview --- */

.photo-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  margin-top: 0.5rem;
}

/* --- Location / GPS --- */

.location-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.btn-gps {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--accent-bright);
  font-size: 0.8125rem;
  cursor: pointer;
}

.btn-gps:active {
  background: var(--bg-card);
}

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

.btn-link-small {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0.25rem 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-link-small:hover {
  color: var(--accent-bright);
}

.manual-coords {
  margin-top: 0.5rem;
}

.manual-coords .form-row {
  margin-bottom: 0;
}

.gps-status {
  display: block;
  margin-top: 0.25rem;
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* --- Stats View --- */

.stats-section {
  margin-bottom: 0.875rem;
}

.stats-section h3 {
  font-size: 0.875rem;
  color: var(--nw-cream);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.condition-bar {
  height: 24px;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  margin-bottom: 0.5rem;
}

.condition-bar > div {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--bg-primary);
}

.bait-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.bait-row:last-child {
  border-bottom: none;
}

.species-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.species-row:last-child {
  border-bottom: none;
}

/* --- Profile View --- */

.profile-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
  margin-bottom: 0.625rem;
}

.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--nw-green-light);
  color: #fff;
  font-size: 1.375rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.625rem;
}

.profile-name {
  font-size: 1.25rem;
  font-weight: 600;
}

.profile-email {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.profile-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.profile-badge.pro {
  background: rgba(143, 90, 42, 0.2);
  color: #b3723a;
}

.profile-badge.free {
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-secondary);
}

.subscription-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 0.875rem;
  margin-bottom: 0.625rem;
}

.subscription-card h3 {
  font-size: 0.875rem;
  color: var(--nw-cream);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.usage-bar {
  height: 8px;
  background: var(--bg-surface);
  border-radius: 4px;
  overflow: hidden;
  margin: 0.75rem 0;
}

.usage-bar-fill {
  height: 100%;
  background: var(--accent-green);
  border-radius: 4px;
  transition: width 0.3s;
}

.usage-text {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* --- Canvas Charts --- */

canvas {
  width: 100%;
  max-width: 100%;
}

#health-chart {
  height: 120px;
}

/* --- Mode Toggle --- */

.mode-toggle {
  display: flex;
  gap: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.mode-btn {
  padding: 6px 16px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.mode-btn-active {
  background: var(--accent-green);
  color: #fff;
}

/* --- Toggle Switch --- */

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-surface);
  border-radius: 24px;
  transition: 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent-green);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: #fff;
}

/* --- Responsive (Tablet+) --- */

@media (min-width: 768px) {
  .stat-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .landing-features {
    grid-template-columns: repeat(3, 1fr);
  }

  main#app-content {
    max-width: 800px;
    margin: 0 auto;
  }
}

/* --- Responsive (Desktop 1024px+) --- */

@media (min-width: 1024px) {

  /* ── Sidebar Navigation ────────────────────────────── */

  .tab-bar {
    position: fixed;
    top: calc(56px + env(safe-area-inset-top));
    left: 0;
    bottom: 0;
    right: auto;
    width: 200px;
    height: auto;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 1rem 0;
    padding-bottom: 0;
    border-top: none;
    border-right: 1px solid var(--border);
    gap: 0;
  }

  .tab-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.625rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 0;
    transition: background-color 0.15s ease;
  }

  .tab-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
  }

  .tab-item.active {
    background-color: rgba(46, 139, 56, 0.12);
    border-right: 3px solid var(--accent-bright);
  }

  .tab-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
  }

  /* ── Main Content Shift ────────────────────────────── */

  main#app-content {
    margin-left: 200px;
    margin-right: 0;
    padding-bottom: 2rem;
    max-width: 1200px;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  /* ── Header extends past sidebar ───────────────────── */

  .app-header {
    padding-left: 1.25rem;
  }

  /* Room on desktop — show the NW logo (natural color on the cream/white bar) */
  .header-logo {
    display: block;
  }

  /* ── Wider forms on desktop ────────────────────────── */

  .fish-form {
    max-width: 600px;
  }

  /* ── Taller canvas charts ──────────────────────────── */

  #health-chart {
    height: 160px;
  }

  #growth-chart {
    height: 400px;
  }

  /* ── Desktop stat grid — 4 columns with larger cards ─ */

  .stat-grid {
    gap: 1rem;
  }

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

  /* ── Two-column layout for section cards on home ───── */

  #view-home {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
  }

  #view-home .stat-grid {
    grid-column: 1 / -1;
  }

  /* ── Two-column layout for stats view ──────────────── */

  #stats-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  #stats-content > .stat-grid,
  #stats-content > .section-card:has(canvas) {
    grid-column: 1 / -1;
  }

  #stats-content > .section-card {
    margin-bottom: 0;
  }

  /* ── Species detail two-column ─────────────────────── */

  #species-detail-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  #species-detail-content > .section-card:first-child,
  #species-detail-content > .section-card:has(canvas) {
    grid-column: 1 / -1;
  }

  #species-detail-content > .section-card {
    margin-bottom: 0;
  }

  /* ── Individual detail — full-width for all cards
       (chart & table need full width) ──────────────────── */

  #individual-detail-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  #individual-detail-content > .section-card:first-child {
    grid-column: 1 / -1;
  }

  #individual-detail-content > .section-card:has(canvas),
  #individual-detail-content > .section-card:has(.table-wrapper) {
    grid-column: 1 / -1;
  }

  #individual-detail-content > .section-card {
    margin-bottom: 0;
  }

  /* ── Fish log list — wider cards ───────────────────── */

  .fish-list {
    max-width: 900px;
  }

  .fish-card {
    padding: 1.25rem;
  }

  .fish-card .fish-photo {
    width: 80px;
    height: 80px;
  }

  /* ── Log controls — wider search ───────────────────── */

  .log-controls {
    max-width: 900px;
  }

  /* ── Toast positioning — above bottom instead of tab bar */

  .toast {
    bottom: 2rem;
  }

  /* ── Landing page — wider hero on desktop ──────────── */

  .landing-hero {
    max-width: 800px;
    padding: 3rem 2rem;
  }

  .landing-logo {
    width: 280px;
  }

  /* ── Modals — slightly wider on desktop ────────────── */

  .modal-container {
    max-width: 600px;
  }

  /* ── Profile — constrained width ───────────────────── */

  #view-profile {
    max-width: 600px;
  }
}

/* --- Survey Mode --- */

.survey-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.survey-header h2 {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin: 0;
}

.survey-counter {
  background: var(--accent-green);
  color: #fff;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
}

.survey-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.survey-actions .btn-secondary {
  flex: 1;
}

.btn-danger {
  background: #c0392b !important;
  color: #fff !important;
  border-color: #c0392b !important;
}

.survey-sessions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.session-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.session-card:hover {
  border-color: var(--accent);
}

.session-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.session-info strong {
  color: var(--text-primary);
}

.session-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.session-meta {
  display: flex;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.session-method {
  text-transform: capitalize;
}

.empty-hint {
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-align: center;
  padding: 16px 0;
}

/* ── Species Detail / Individual Detail ─────────────── */

.clickable-row {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.clickable-row:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.row-chevron {
  color: var(--text-secondary);
  font-size: 1.2em;
  margin-left: 4px;
}

.detail-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-header h3 {
  margin: 0;
}

.detail-header-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

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

.detail-tag {
  font-family: monospace;
}

.individual-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.individual-card:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: var(--accent);
}

.individual-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.individual-name {
  font-weight: 600;
  color: var(--text-primary);
}

.individual-catches {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
}

.individual-card-meta {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.growth-summary {
  text-align: center;
}

.growth-period {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 8px;
  text-align: center;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.catch-history-table td {
  vertical-align: middle;
}

.btn-growth {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-growth:hover {
  background-color: var(--accent-green);
  color: #fff;
}

/* ── Compact Summary (stats bottom) ──────────────── */

.compact-summary {
  opacity: 0.8;
}

.compact-summary h3 {
  font-size: 0.75rem;
}

.compact-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 0.25rem 0;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--border);
}

.compact-summary-row:last-child {
  border-bottom: none;
}

.compact-summary-row span:first-child {
  color: var(--text-secondary);
}

.compact-summary-row span:last-child {
  color: var(--text-primary);
  font-weight: 600;
}

/* ── Stats Table ─────────────────────────────────── */

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.stats-table th {
  text-align: left;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.375rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.stats-table td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.stats-table tbody tr:last-child td {
  border-bottom: none;
}

.table-wrapper {
  overflow-x: auto;
}

/* ── Species & Individual Detail — tighter spacing ── */

#species-detail-content .section-card,
#individual-detail-content .section-card {
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
}

#species-detail-content .section-card h3,
#individual-detail-content .section-card h4 {
  margin-bottom: 0.375rem;
  font-size: 0.75rem;
}

#species-detail-content .stat-grid,
#individual-detail-content .stat-grid {
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

#species-detail-content .stat-card,
#individual-detail-content .stat-card {
  padding: 0.5rem;
  border-radius: 8px;
}

#species-detail-content .stat-card .stat-value,
#individual-detail-content .stat-card .stat-value {
  font-size: 1.25rem;
}

#species-detail-content .stat-card .stat-label,
#individual-detail-content .stat-card .stat-label {
  font-size: 0.65rem;
}

/* ── CSV Import Portal ──────────────────────────────── */

.csv-import-portal {
  margin-top: 1rem;
  max-width: 600px;
}

.csv-import-portal h3 {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.csv-import-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.csv-import-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.csv-template-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
}

.csv-drop-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 1rem 0.75rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
}

.csv-drop-zone svg {
  color: var(--text-muted);
}

.csv-drop-zone:hover,
.csv-drop-zone.dragover {
  border-color: var(--accent-bright);
  background: rgba(46, 139, 56, 0.06);
}

.csv-drop-zone.dragover {
  background: rgba(46, 139, 56, 0.12);
}

.csv-preview-container {
  margin-top: 0.75rem;
}

.csv-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.8125rem;
}

.csv-preview-errors {
  color: #c0392b;
  font-weight: 600;
}

.csv-preview-table {
  font-size: 0.75rem;
}

.csv-preview-table .row-error {
  color: #c0392b;
  opacity: 0.7;
}

.csv-preview-table .row-error td {
  color: #c0392b;
}

.csv-preview-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.csv-preview-actions .btn-primary,
.csv-preview-actions .btn-secondary {
  flex: 1;
}

/* ── Electrofishing run parameters + MyPond linkage ───────────── */
.field-hint {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.electro-fieldset {
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  border-radius: 10px;
  padding: 12px 14px 4px;
  margin: 4px 0 16px;
}

.electro-fieldset legend {
  padding: 0 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.survey-active-meta {
  margin: -4px 0 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Admin org-wide view — owner label on records */
.fish-owner-badge {
  background: var(--bg-surface, rgba(255, 255, 255, 0.06));
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  border-radius: 10px;
  padding: 1px 8px;
  font-weight: 600;
}

/* Marks where a catch-log entry came from (stocking / survey vs. angler). */
.fish-source-badge {
  color: #fff;
  border-radius: 10px;
  padding: 1px 8px;
  font-weight: 600;
}
.fish-source-stocking { background: var(--score-lunker, #8f5a2a); }
.fish-source-electrofishing { background: var(--score-heavyweight, #2e8b38); }
.fish-source-survey { background: var(--text-secondary, #5b6472); }

/* Statistics source scope selector (All / Stocked / Electrofishing / …). */
.stats-source-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.stats-source-filter label {
  font-weight: 600;
  color: var(--text-secondary);
}
.stats-source-filter select {
  flex: 1;
}

/* ── Header mode switcher (Fishing / Survey / Stocking) ───────── */
.mode-switch {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  margin-right: 8px;
}
.mode-switch-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #141b45;                 /* navy — readable on the cream/white header in both themes */
  opacity: 0.8;
  line-height: 1;
}
#mode-switcher {
  background: var(--nw-green, #2e8b38);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 0.9rem;
  font-weight: 600;
  max-width: 130px;
}
#mode-switcher option { color: #000; }

/* ── Admin "all users" banner ─────────────────────────────────── */
.admin-banner {
  position: fixed;
  top: calc(56px + env(safe-area-inset-top));
  left: 0;
  right: 0;
  z-index: 99;
  height: 32px;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #8f5a2a;
  color: #fff;
  font-size: 0.8rem;
}
body.admin-scope-active .admin-banner {
  display: flex;
}
.admin-banner-exit {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 2px 10px;
  font-size: 0.75rem;
  cursor: pointer;
}
body.admin-scope-active main#app-content {
  padding-top: calc(56px + 32px + env(safe-area-inset-top));
}

/* ── Reporting filters (Home admin bar + Log date range / export) ── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.filter-date {
  background: var(--bg-surface, rgba(255, 255, 255, 0.06));
  color: var(--text-primary, #fff);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 0.85rem;
}
.log-export-btn {
  white-space: nowrap;
}

/* Make side-by-side form fields share width and shrink (fixes overlap) */
.form-row > .form-group {
  flex: 1 1 0;
  min-width: 0;
  margin-bottom: 0;
}
.form-row { margin-bottom: 0.625rem; }

/* ── In-app numeric keypad ───────────────────────────────────── */
.numpad {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.35);
}
.numpad-display {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 2px 6px 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}
.numpad-value {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
}
.numpad-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.numpad-key {
  font-size: 1.3rem;
  font-weight: 600;
  padding: 16px 0;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.numpad-key:active { background: var(--accent-green); color: #fff; }
.numpad-back, .numpad-clear, .numpad-neg { font-size: 1.1rem; color: var(--text-secondary); }
.numpad-next { background: var(--nw-brown, #8f5a2a); color: #fff; border-color: transparent; font-size: 1rem; }
.numpad-done { background: var(--nw-green-bright, #2e8b38); color: #fff; border-color: transparent; font-size: 1rem; }

/* Make room so the active field can scroll above the pad */
body.numpad-open main#app-content { padding-bottom: 340px; }

/* ── Hardware-keyboard tip (Android) ─────────────────────────── */
.kbd-tip {
  display: none;
  align-items: flex-start;
  gap: 10px;
  background: var(--nw-brown, #8f5a2a);
  color: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.8rem;
  line-height: 1.35;
}
.kbd-tip.show { display: flex; }
.kbd-tip-dismiss {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
}

/* ── CSV import column mapping ────────────────────────────────── */
.csv-cfg-head { margin-bottom: 10px; font-size: 0.9rem; color: var(--text-secondary); }
.csv-map { margin: 8px 0 12px; }
.csv-map-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.csv-map-row .csv-col {
  flex: 0 0 42%;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
  font-weight: 600;
}
.csv-map-row select { flex: 1 1 auto; min-width: 0; }

/* ── Fish card clickable + detail modal ──────────────────────── */
.fish-card { cursor: pointer; }
.fish-card .fish-card-actions button { cursor: pointer; }

#fish-detail-modal .modal-body {
  max-height: 75vh;
  overflow-y: auto;
}
.fish-detail-photo {
  width: 100%;
  max-height: 55vh;
  object-fit: contain;
  border-radius: 10px;
  background: #000;
  display: block;
}
.fish-detail-photo-placeholder {
  width: 100%;
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: 10px;
}
.fish-detail-headline { margin: 12px 0 4px; }
.fish-detail-nickname {
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.fish-detail-subhead {
  margin: 16px 0 6px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.fish-detail-rows .detail-row,
.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.detail-label { color: var(--text-secondary); }
.detail-value { font-weight: 600; text-align: right; }

/* ── Voice entry ─────────────────────────────────────────────── */

/* Per-field mic button — sits inline to the right of the field, using the same
   flex-row pattern as the tag line (.input-with-btn): the field shrinks to make
   room so the mic is a clean 44px tap target that never overlaps or wraps below.
   Cream accent (dark) / brand green (light); fills green on tap. */
.input-with-mic {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.input-with-mic > input,
.input-with-mic > select {
  flex: 1 1 0;
  min-width: 0;
}
.btn-mic {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--accent);
  cursor: pointer;
}
.btn-mic:active {
  background: var(--accent-green);
  color: #fff;
  border-color: transparent;
}

/* Prominent "start the guided loop" button atop the survey rapid form. */
.voice-start-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 0.85rem;
  margin-bottom: 0.75rem;
  background: var(--accent-green);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
.voice-start-btn:active { opacity: 0.9; }

/* Bottom-sheet heads-up display for the guided loop. */
.voice-hud {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 300;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.4);
}
.voice-hud.hidden { display: none; }
.voice-hud-inner {
  max-width: 520px;
  margin: 0 auto;
  position: relative;
  text-align: center;
}
.voice-stop {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
}
.voice-hud-step {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.voice-hud-mic {
  width: 52px;
  height: 52px;
  margin: 0 auto 0.5rem;
  border-radius: 50%;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
}
.voice-mic-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.2s;
}
.voice-hud-mic.listening { background: rgba(42, 99, 48, 0.18); }
.voice-hud-mic.listening .voice-mic-dot {
  background: var(--accent-green);
  animation: voice-pulse 1s ease-in-out infinite;
}
@keyframes voice-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.5; }
}
.voice-hud-prompt {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}
.voice-hud-transcript {
  font-size: 0.85rem;
  color: var(--text-secondary);
  min-height: 1.1em;
  font-style: italic;
}
.voice-hud-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--nw-cream);
  margin: 0.3rem 0;
  min-height: 1em;
}
.voice-hud-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.6rem;
}
.voice-btn {
  flex: 1;
  max-width: 130px;
  padding: 0.7rem 0.5rem;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
}
.voice-btn.hidden { display: none; }
.voice-confirm { background: var(--accent-green); color: #fff; border-color: transparent; }
.voice-tap {
  display: block;
  width: 100%;
  margin-top: 0.6rem;
  padding: 0.9rem;
  border-radius: 10px;
  background: var(--accent-green);
  color: #fff;
  border: none;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
.voice-tap.hidden { display: none; }
