/* ============================================
   CAPTURE LOG — Carp Fishing Tracker
   Palette: Deep lake greens, reed browns, teal accent
   ============================================ */

:root,
[data-theme='light'] {
  /* Surfaces — warm lakebed tones */
  --color-bg: #f5f3ee;
  --color-surface: #faf9f6;
  --color-surface-2: #ffffff;
  --color-surface-offset: #efece5;
  --color-surface-offset-2: #e8e4db;
  --color-surface-dynamic: #ddd9d0;
  --color-divider: #ddd9d2;
  --color-border: #d1ccc2;

  /* Text */
  --color-text: #1f2e23;
  --color-text-muted: #6b7a6f;
  --color-text-faint: #a8b0aa;
  --color-text-inverse: #f9f8f4;

  /* Primary — Deep Teal (lake water) */
  --color-primary: #1a6b5e;
  --color-primary-hover: #144d44;
  --color-primary-active: #0e352e;
  --color-primary-highlight: #d0e0db;

  /* Accent — Reed Gold */
  --color-accent: #b8841a;
  --color-accent-hover: #966a12;
  --color-accent-highlight: #f0e4c8;

  /* Semantic */
  --color-warning: #8a5a1a;
  --color-error: #a12c2c;
  --color-success: #3a7a2a;
  --color-info: #2a6b8a;

  /* Data viz colors */
  --chart-1: #1a6b5e;
  --chart-2: #b8841a;
  --chart-3: #2a6b8a;
  --chart-4: #7a5a3a;
  --chart-5: #4a8a6a;
  --chart-6: #a14a3a;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1.25rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px oklch(0.25 0.02 120 / 0.08);
  --shadow-md: 0 4px 12px oklch(0.25 0.02 120 / 0.1);
  --shadow-lg: 0 12px 32px oklch(0.25 0.02 120 / 0.15);

  /* Fonts */
  --font-display: 'Clash Display', 'Segoe UI', sans-serif;
  --font-body: 'General Sans', 'Segoe UI', sans-serif;

  /* Type scale */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Transitions */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 300ms cubic-bezier(0.16, 1, 0.3, 1);

  --content-wide: 1200px;
  --content-default: 960px;
}

/* DARK MODE */
[data-theme='dark'] {
  --color-bg: #141a17;
  --color-surface: #1a201d;
  --color-surface-2: #20271f;
  --color-surface-offset: #1d2420;
  --color-surface-offset-2: #242b26;
  --color-surface-dynamic: #2d352f;
  --color-divider: #2a302c;
  --color-border: #363d37;

  --color-text: #d4dcd6;
  --color-text-muted: #8a958d;
  --color-text-faint: #5a635d;
  --color-text-inverse: #1a201d;

  --color-primary: #4f9d8e;
  --color-primary-hover: #3a8a7b;
  --color-primary-active: #2a6b5e;
  --color-primary-highlight: #2a3a35;

  --color-accent: #d4a542;
  --color-accent-hover: #c4952f;
  --color-accent-highlight: #3a3525;

  --color-warning: #c49555;
  --color-error: #d16363;
  --color-success: #6daa45;
  --color-info: #5591c7;

  --chart-1: #4f9d8e;
  --chart-2: #d4a542;
  --chart-3: #5591c7;
  --chart-4: #a08565;
  --chart-5: #6daa55;
  --chart-6: #d16363;

  --shadow-sm: 0 1px 3px oklch(0 0 0 / 0.3);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.4);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.5);
}

/* System preference fallback */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #141a17;
    --color-surface: #1a201d;
    --color-surface-2: #20271f;
    --color-surface-offset: #1d2420;
    --color-surface-offset-2: #242b26;
    --color-surface-dynamic: #2d352f;
    --color-divider: #2a302c;
    --color-border: #363d37;
    --color-text: #d4dcd6;
    --color-text-muted: #8a958d;
    --color-text-faint: #5a635d;
    --color-text-inverse: #1a201d;
    --color-primary: #4f9d8e;
    --color-primary-hover: #3a8a7b;
    --color-primary-active: #2a6b5e;
    --color-primary-highlight: #2a3a35;
    --color-accent: #d4a542;
    --color-accent-hover: #c4952f;
    --color-accent-highlight: #3a3525;
    --chart-1: #4f9d8e;
    --chart-2: #d4a542;
    --chart-3: #5591c7;
    --chart-4: #a08565;
    --chart-5: #6daa55;
    --chart-6: #d16363;
    --shadow-sm: 0 1px 3px oklch(0 0 0 / 0.3);
    --shadow-md: 0 4px 12px oklch(0 0 0 / 0.4);
    --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.5);
  }
}

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

html {
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: var(--space-16);
}

body {
  min-height: 100dvh;
  line-height: 1.6;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom);
}

img,
picture,
svg,
canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

ul, ol { list-style: none; }
input, button, textarea, select { font: inherit; color: inherit; }

h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
  line-height: 1.2;
  font-family: var(--font-display);
}

p, li, figcaption { text-wrap: pretty; max-width: 72ch; }

::selection {
  background: oklch(from var(--color-primary) l c h / 0.25);
  color: var(--color-text);
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

table { border-collapse: collapse; width: 100%; }

a, button, [role='button'], input, textarea, select {
  transition: color var(--transition-interactive),
              background var(--transition-interactive),
              border-color var(--transition-interactive),
              box-shadow var(--transition-interactive);
}

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ====== HEADER ====== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: oklch(from var(--color-surface) l c h / 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  max-width: var(--content-wide);
  margin-inline: auto;
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-primary);
}

.brand-logo {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-lg);
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--color-text);
  border-color: var(--color-primary);
}

.theme-toggle:active {
  transform: scale(0.95);
}

/* Tab bar */
.tab-bar {
  max-width: var(--content-wide);
  margin-inline: auto;
  padding: 0 var(--space-4) var(--space-2);
  display: flex;
  gap: var(--space-1);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tab-bar::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  border-radius: var(--radius-full);
  white-space: nowrap;
  border: 1px solid transparent;
  flex-shrink: 0;
}

.tab-btn:hover {
  color: var(--color-text);
  background: var(--color-surface-offset);
}

.tab-btn.active {
  color: var(--color-primary);
  background: var(--color-primary-highlight);
  border-color: oklch(from var(--color-primary) l c h / 0.2);
}

.tab-btn:active { transform: scale(0.97); }

/* ====== MAIN LAYOUT ====== */
.app-main {
  max-width: var(--content-wide);
  margin-inline: auto;
  padding: var(--space-4);
  padding-bottom: calc(var(--space-16) + env(safe-area-inset-bottom));
}

@media (min-width: 768px) {
  .app-main { padding: var(--space-8) var(--space-4); }
}

/* Views */
.view { display: none; animation: fadeIn 0.3s ease; }
.view.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.page-title {
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.view-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* ====== BUTTONS ====== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  min-height: 44px;
  transition: all var(--transition-interactive);
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}

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

.btn-secondary {
  background: var(--color-surface-2);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover {
  border-color: var(--color-primary);
  background: var(--color-surface-offset);
}

.btn-danger {
  background: var(--color-error);
  color: #fff;
}

.btn-danger:hover { filter: brightness(0.9); }

.btn-text {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-primary);
  padding: var(--space-2) var(--space-3);
  min-height: 40px;
}

.btn-text:hover { text-decoration: underline; }

/* ====== KPI CARDS ====== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-interactive);
}

.kpi-card:hover { box-shadow: var(--shadow-md); }

.kpi-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.kpi-value {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1rem + 1vw, 1.75rem);
  font-weight: 600;
  color: var(--color-text);
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1.15;
  overflow-wrap: normal;
  word-wrap: normal;
  hyphens: none;
}

.kpi-sub {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-1);
  font-variant-numeric: tabular-nums;
}

.kpi-card.highlight {
  background: linear-gradient(135deg, oklch(from var(--color-accent) l c h / 0.1), oklch(from var(--color-primary) l c h / 0.05));
  border-color: oklch(from var(--color-accent) l c h / 0.3);
}

.kpi-card.highlight .kpi-value { color: var(--color-accent); }

/* ====== CARDS ====== */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

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

.card-title {
  font-size: var(--text-lg);
  font-weight: 600;
}

.dashboard-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 768px) {
  .dashboard-row {
    grid-template-columns: 1.5fr 1fr;
  }
}

/* ====== CATCH LIST (dashboard) ====== */
.catch-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.catch-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  transition: border-color var(--transition-interactive);
}

.catch-item:hover { border-color: var(--color-primary); }

.catch-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--color-surface-offset);
  flex-shrink: 0;
}

.catch-thumb-placeholder {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--color-primary-highlight);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-primary);
}

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

.catch-weight {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-base);
  font-variant-numeric: tabular-nums;
}

.catch-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catch-date {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  white-space: nowrap;
}

/* PB highlight card */
.pb-card {
  background: linear-gradient(135deg, oklch(from var(--color-accent) l c h / 0.08), var(--color-surface));
  border-color: oklch(from var(--color-accent) l c h / 0.2);
}

.pb-card .card-title { color: var(--color-accent); }

.pb-card .pb-big-weight {
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.5rem + 2vw, 3rem);
  font-weight: 700;
  color: var(--color-accent);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin: var(--space-2) 0;
}

.pb-card .pb-detail {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.pb-card .pb-detail strong { color: var(--color-text); }

/* ====== LOGBOOK ====== */
.filters-bar {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
  align-items: center;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 100%;
}

.search-wrap svg {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-faint);
  pointer-events: none;
  z-index: 1;
}

.search-wrap input[type="search"],
#logbookSearch {
  width: 100%;
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-8);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  min-height: 44px;
}

.search-wrap input[type="search"]::placeholder,
#logbookSearch::placeholder {
  color: var(--color-text-faint);
}

.search-wrap input[type="search"]:focus,
#logbookSearch:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px oklch(from var(--color-primary) l c h / 0.15);
}

.filter-select {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  min-height: 44px;
  cursor: pointer;
}

.filter-select option {
  background: var(--color-surface);
  color: var(--color-text);
}

.filter-select:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Fix all inputs, selects, textareas for dark mode */
input[type="text"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="search"],
input[type="file"],
textarea,
select {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}

input[type="text"]::placeholder,
input[type="number"]::placeholder,
input[type="search"]::placeholder,
textarea::placeholder {
  color: var(--color-text-faint);
}

input[readonly] {
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
}

select option {
  background: var(--color-surface);
  color: var(--color-text);
}

.catch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: var(--space-4);
}

.catch-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-interactive), transform var(--transition-interactive);
  display: flex;
  flex-direction: column;
}

.catch-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.catch-card-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--color-surface-offset);
}

.catch-card-photo-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, var(--color-primary-highlight), var(--color-surface-offset));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
}

.catch-card-body {
  padding: var(--space-4);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.catch-card-weight {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.catch-card-species {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.catch-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  border-radius: var(--radius-full);
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  border: 1px solid var(--color-divider);
}

.catch-card-actions {
  display: flex;
  gap: var(--space-2);
  padding: 0 var(--space-4) var(--space-4);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
}

.icon-btn:hover { color: var(--color-primary); border-color: var(--color-primary); }
.icon-btn.danger:hover { color: var(--color-error); border-color: var(--color-error); }

/* Empty states */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-4);
  color: var(--color-text-muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  opacity: 0.4;
}

.empty-state h3 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-2);
  color: var(--color-text);
}

.empty-state p {
  margin-bottom: var(--space-4);
  margin-inline: auto;
}

/* ====== SESSIONS (enhanced) ====== */
.session-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.session-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-interactive);
}

.session-card:hover { box-shadow: var(--shadow-md); }

.session-card.blank {
  border-left: 4px solid var(--color-text-faint);
}

.session-card.auto-blank {
  border-left: 4px solid var(--color-warning);
}

.session-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.session-venue {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
}

.session-date {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.session-duration {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-1);
}

.session-stats {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-top: var(--space-3);
}

.session-stat {
  display: flex;
  flex-direction: column;
}

.session-stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.session-stat-value {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-base);
  font-variant-numeric: tabular-nums;
}

.session-notes {
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.blank-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
}

.blank-badge.auto {
  background: oklch(from var(--color-warning) l c h / 0.15);
  color: var(--color-warning);
}

.session-toggle-blank {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-primary);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  cursor: pointer;
  transition: all var(--transition-interactive);
}

.session-toggle-blank:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-highlight);
}

.session-toggle-blank:active {
  transform: scale(0.95);
}

/* ====== YEARLY SUMMARY ====== */
.yearly-table {
  width: 100%;
  font-size: var(--text-sm);
}

.yearly-table th {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-divider);
}

.yearly-table td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--color-divider);
  font-variant-numeric: tabular-nums;
}

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

.yearly-table .year-cell {
  font-family: var(--font-display);
  font-weight: 600;
}

.yearly-table .best-year {
  color: var(--color-accent);
  font-weight: 600;
}

.yearly-scroll {
  overflow-x: auto;
}

/* ====== BLANKS REGISTER ====== */
.blanks-empty {
  text-align: center;
  padding: var(--space-12) var(--space-4);
  color: var(--color-text-muted);
}

.blanks-empty svg {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  opacity: 0.4;
}

.blanks-empty h3 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-2);
  color: var(--color-text);
}

/* ====== STATS ====== */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

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

.chart-card {
  min-height: 280px;
  display: flex;
  flex-direction: column;
}

.chart-card canvas {
  flex: 1;
  max-height: 250px;
}

/* ====== PBS ====== */
.pb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: var(--space-4);
}

.pb-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  text-align: center;
  transition: box-shadow var(--transition-interactive);
}

.pb-item:hover { box-shadow: var(--shadow-md); }

.pb-item.best {
  border-color: oklch(from var(--color-accent) l c h / 0.3);
  background: linear-gradient(135deg, oklch(from var(--color-accent) l c h / 0.08), var(--color-surface));
}

.pb-species {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.pb-weight {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-primary);
}

.pb-item.best .pb-weight { color: var(--color-accent); }

.pb-detail {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}

/* ====== BACKUP ====== */
.backup-card {
  max-width: var(--content-default);
  margin-inline: auto;
}

.backup-card .card-title {
  margin-bottom: var(--space-2);
}

.muted { color: var(--color-text-muted); font-size: var(--text-sm); }

.backup-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-5);
}

.divider {
  border: none;
  border-top: 1px solid var(--color-divider);
  margin: var(--space-6) 0;
}

.danger-zone { }
.danger-title {
  font-size: var(--text-base);
  color: var(--color-error);
  margin-bottom: var(--space-2);
}

.storage-meter {
  margin-top: var(--space-5);
  padding: var(--space-4);
  background: var(--color-surface-offset);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.storage-bar {
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-surface-dynamic);
  margin-top: var(--space-2);
  overflow: hidden;
}

.storage-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  transition: width 0.3s ease;
}

/* ====== FAB ====== */
.fab {
  position: fixed;
  bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
  right: var(--space-4);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  transition: transform var(--transition-interactive), background var(--transition-interactive);
}

.fab:hover { background: var(--color-primary-hover); }
.fab:active { transform: scale(0.92); }

/* Add bottom padding on mobile so FAB doesn't overlap content or sync banner */
@media (max-width: 767px) {
  main { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
  .fab { bottom: calc(40px + env(safe-area-inset-bottom)); }
}

@media (min-width: 768px) {
  .fab { display: none; }
}

/* ====== HEADER CONTROLS ====== */
.header-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ====== FISH SETUP LIST ====== */
.fish-setup-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  max-height: 60vh;
  overflow-y: auto;
  padding: var(--space-2) var(--space-5);
  align-items: stretch;
}

.fish-setup-search-wrap {
  position: relative;
  margin-bottom: var(--space-3);
  padding: 0 var(--space-5);
}

.fish-setup-search-wrap input[type="search"] {
  width: 100%;
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-8);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  box-sizing: border-box;
}

.fish-setup-search-wrap input[type="search"]:focus {
  border-color: var(--color-primary);
  outline: none;
}

.fish-setup-search-icon {
  position: absolute;
  left: calc(var(--space-5) + var(--space-3));
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}

.fish-setup-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-interactive);
  text-align: left;
}

.fish-setup-item:hover {
  background: var(--color-surface-offset);
}

.fish-setup-checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid var(--color-border);
  border-radius: 50%;
  flex-shrink: 0;
  transition: all var(--transition-interactive);
  position: relative;
}

.fish-setup-item.selected .fish-setup-checkbox {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.fish-setup-item.selected .fish-setup-checkbox::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
}

.fish-setup-icon {
  width: 32px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.fish-setup-item-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  text-align: left;
}

.modal-intro {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
  text-align: left;
  padding: 0 var(--space-5);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
}

.fish-manager {
  margin-bottom: var(--space-2);
}

/* ====== SESSION TARGET FISH ====== */
.session-target-fish {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-divider);
}

.session-target-fish-name {
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--color-text);
}

/* ====== CHECKBOX ====== */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  margin-top: var(--space-2);
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
}

/* ====== FISH ICON ON SESSION CARDS ====== */
.session-target-fish {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-offset);
  border-radius: var(--radius-md);
}

.session-target-fish-icon {
  width: 40px;
  height: 20px;
  flex-shrink: 0;
}

.session-target-fish-name {
  font-size: var(--text-sm);
  color: var(--color-text);
  font-weight: 500;
}

.session-region-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-full);
  background: oklch(from var(--color-info) l c h / 0.15);
  color: var(--color-info);
}

.session-location-link {
  font-size: var(--text-xs);
  color: var(--color-info);
  text-decoration: underline;
  cursor: pointer;
}

.session-location-link:hover {
  text-decoration: none;
}

/* ====== MODALS ====== */
.modal-overlay[hidden] { display: none !important; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: oklch(0 0 0 / 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: block;
  padding: var(--space-4);
  overflow-y: auto;
  animation: overlayIn 0.2s ease;
}

.modal-overlay::before {
  content: '';
  display: none;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  max-width: 700px;
  width: 100%;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  margin: var(--space-4) auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

.modal-title {
  font-size: var(--text-lg);
  font-weight: 600;
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-size: 1.5rem;
  line-height: 1;
}

.modal-close:hover {
  color: var(--color-text);
  background: var(--color-surface-offset);
}

.modal-form {
  padding: var(--space-5);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 560px) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-group-full {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: var(--text-base);
  width: 100%;
  min-height: 44px;
}

.form-group select option {
  background: var(--color-surface);
  color: var(--color-text);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--color-text-faint);
}

.form-group textarea {
  resize: vertical;
  font-family: var(--font-body);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px oklch(from var(--color-primary) l c h / 0.15);
}

.weight-group .weight-inputs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.weight-inputs input {
  width: 80px !important;
  flex: none;
}

.weight-sep {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-weight: 500;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.photo-upload-wrap {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  flex-wrap: wrap;
}

.photo-input {
  font-size: var(--text-sm) !important;
  padding: var(--space-2) !important;
  min-height: 44px;
  flex: 1;
  min-width: 180px;
}

.photo-preview {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-md);
  background: var(--color-surface-offset);
  display: none;
  overflow: hidden;
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-divider);
  background: var(--color-surface);
}

/* ====== TOAST ====== */
.toast {
  position: fixed;
  bottom: calc(var(--space-8) + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-text);
  color: var(--color-text-inverse);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  z-index: 300;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 90vw;
}

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

/* ====== UTILITY ====== */
.hidden { display: none !important; }

/* Confirm dialog */
.confirm-dialog {
  position: fixed;
  inset: 0;
  background: oklch(0 0 0 / 0.5);
  backdrop-filter: blur(4px);
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: overlayIn 0.2s ease;
}

.confirm-dialog-content {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.confirm-dialog h3 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-2);
}

.confirm-dialog p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
}

.confirm-dialog-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
}

/* ====== BAIT STOCK ====== */
.bait-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-4);
}

.bait-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  transition: box-shadow var(--transition-interactive), border-color var(--transition-interactive);
}

.bait-card:hover {
  box-shadow: var(--shadow-md);
}

.bait-card.low-stock {
  border-color: var(--color-warning);
}

.bait-card.out-of-stock {
  border-color: var(--color-error);
  opacity: 0.7;
}

.bait-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-2);
}

.bait-card-name {
  font-weight: 600;
  font-size: var(--text-base);
}

.bait-type-badge {
  font-size: var(--text-xs);
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.bait-qty-display {
  font-size: var(--text-lg);
  font-weight: 700;
  font-family: var(--font-display);
}

.bait-qty-unit {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-weight: 400;
}

.bait-stock-bar {
  height: 6px;
  background: var(--color-surface-offset);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.bait-stock-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.bait-stock-bar-fill.ok { background: var(--color-success); }
.bait-stock-bar-fill.low { background: var(--color-warning); }
.bait-stock-bar-fill.out { background: var(--color-error); }

.bait-card-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.bait-qty-btn {
  flex: 1;
  padding: var(--space-2);
  font-size: var(--text-xs);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  text-align: center;
}

.bait-qty-btn:hover {
  background: var(--color-surface-offset);
}

.bait-qty-btn.danger:hover {
  background: var(--color-error);
  color: #fff;
  border-color: var(--color-error);
}

/* ====== DATA CENTER / ADVISOR ====== */
.advisor-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
  align-items: end;
  margin-bottom: var(--space-6);
}

.advisor-results {
  display: grid;
  gap: var(--space-4);
}

.advice-card {
  background: var(--color-surface-offset);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  border-left: 4px solid var(--color-primary);
}

.advice-card h4 {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.advice-card .advice-value {
  font-size: var(--text-lg);
  font-weight: 600;
}

.advice-card .advice-detail {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.advice-summary {
  background: var(--color-primary-highlight);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
}

.advice-summary h3 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-2);
}

/* ====== BITE TIMES ====== */
.bite-forecast-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
}

.bite-forecast-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--color-primary-highlight);
  color: var(--color-primary);
}

.bite-forecast-rating {
  font-size: var(--text-lg);
  font-weight: 700;
}

.bite-forecast-detail {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* ====== RECOGNIZE ====== */
.recognize-card {
  text-align: center;
}

.recognize-upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-12) var(--space-4);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color var(--transition-interactive), background var(--transition-interactive);
}

.recognize-upload-zone:hover,
.recognize-upload-zone.dragover {
  border-color: var(--color-primary);
  background: var(--color-primary-highlight);
}

.recognize-upload-zone p {
  font-weight: 600;
  font-size: var(--text-base);
}

.recognize-result {
  padding: var(--space-4);
}

.recognize-result img {
  max-height: 300px;
  border-radius: var(--radius-lg);
  margin: 0 auto var(--space-4);
}

.recognize-suggestion {
  background: var(--color-surface-offset);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-top: var(--space-3);
}

.recognize-species-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-3);
}

.recognize-species-item {
  background: var(--color-surface-offset);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  text-align: center;
  cursor: pointer;
  transition: box-shadow var(--transition-interactive);
}

.recognize-species-item:hover {
  box-shadow: var(--shadow-sm);
}

.recognize-species-item .species-card-icon {
  margin: 0 auto var(--space-2);
}

.recognize-species-name {
  font-size: var(--text-xs);
  font-weight: 500;
}

/* ====== SOCIAL ====== */
.social-subtabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-divider);
  overflow-x: auto;
}

.social-subtab {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.social-subtab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.social-panel {
  display: none;
}

.social-panel.active {
  display: block;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
}

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

.leaderboard-rank {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: var(--text-sm);
  flex-shrink: 0;
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
}

.leaderboard-rank.gold { background: #d4a542; color: #fff; }
.leaderboard-rank.silver { background: #a0a0a0; color: #fff; }
.leaderboard-rank.bronze { background: #cd7f32; color: #fff; }

.leaderboard-info {
  flex: 1;
}

.leaderboard-name {
  font-weight: 600;
  font-size: var(--text-sm);
}

.leaderboard-stat {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.leaderboard-value {
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--color-primary);
}

.group-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.group-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-2);
}

.group-name {
  font-size: var(--text-lg);
  font-weight: 600;
}

.group-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

.group-members {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.member-chip {
  background: var(--color-surface-offset);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.member-chip-remove {
  cursor: pointer;
  opacity: 0.5;
  font-weight: bold;
}

.member-chip-remove:hover {
  opacity: 1;
}

.community-post {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.community-post-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-2);
}

.community-post-title {
  font-weight: 600;
  font-size: var(--text-base);
}

.community-post-category {
  font-size: var(--text-xs);
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.community-post-content {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
  white-space: pre-wrap;
}

.community-post-meta {
  display: flex;
  gap: var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.community-post-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.like-btn {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

.like-btn:hover {
  background: var(--color-surface-offset);
}

.like-btn.liked {
  color: var(--color-error);
}

/* ====== PRIVACY INDICATORS ====== */
.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
}

.privacy-badge.shared {
  background: var(--color-success);
  color: #fff;
}

.privacy-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-offset);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}

.privacy-toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-interactive);
}

.privacy-toggle-switch.on {
  background: var(--color-success);
}

.privacy-toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: var(--radius-full);
  transition: transform var(--transition-interactive);
}

.privacy-toggle-switch.on::after {
  transform: translateX(16px);
}

/* ====== SESSION COMPLETE BUTTON ====== */
.session-complete-btn {
  background: var(--color-success);
  color: #fff;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}

.session-complete-btn:hover {
  background: var(--color-success);
  filter: brightness(0.9);
}

.session-complete-btn.completed {
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
}

/* ====== CONDITIONS DISPLAY ====== */
.conditions-display {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.condition-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
}

/* ====== MOBILE TAB SCROLL ====== */
@media (max-width: 768px) {
  .tab-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tab-bar::-webkit-scrollbar {
    display: none;
  }
}

/* Ensure hidden attribute always works (overrides display:flex etc) */
[hidden] { display: none !important; }

/* ====== ACCOUNT / AUTH ====== */
.header-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--color-surface-offset);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition-interactive);
  position: relative;
}

.header-icon-btn:hover {
  background: var(--color-surface-offset-2);
  color: var(--color-primary);
}

.header-icon-btn.active {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* Profile dropdown */
.profile-dropdown {
  position: fixed;
  top: 56px;
  right: var(--space-4);
  width: 280px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
}

.profile-dropdown-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-surface-offset);
}

.profile-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  flex-shrink: 0;
}

.profile-dropdown-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.profile-email {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-status {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.profile-dropdown-actions {
  padding: var(--space-2);
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3);
  border: none;
  background: none;
  color: var(--color-text);
  font-size: var(--text-sm);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-interactive);
}

.profile-dropdown-item:hover {
  background: var(--color-surface-offset);
}

.profile-dropdown-item svg {
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.profile-dropdown-item:hover svg {
  color: var(--color-primary);
}

/* Settings modal sections */
.settings-section {
  margin-bottom: var(--space-4);
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-section-title {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--color-text);
}

/* Auth modal */
.modal-sm {
  max-width: 420px;
}

.auth-tabs {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--color-divider);
}

.auth-tab {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  cursor: pointer;
  transition: color var(--transition-interactive), border-color var(--transition-interactive);
}

.auth-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.auth-tab:hover:not(.active) {
  color: var(--color-text);
}

.auth-error {
  color: var(--color-error);
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-3);
  background: oklch(from var(--color-error) l c h / 0.1);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
}

.form-error {
  color: var(--color-error);
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-3);
  background: oklch(from var(--color-error) l c h / 0.1);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
}

.auth-hint {
  margin-bottom: var(--space-4);
  text-align: center;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-divider);
}

/* Sync status banner */
.sync-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-4);
  background: var(--color-surface-2);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  z-index: 100;
}

.sync-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sync-indicator.local {
  background: var(--color-text-faint);
}

.sync-indicator.synced {
  background: var(--color-success, #4caf50);
}

.sync-indicator.syncing {
  background: var(--color-accent);
  animation: pulse 1.5s ease-in-out infinite;
}

.sync-indicator.error {
  background: var(--color-error);
}

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

/* Add bottom padding for sync banner */
main {
  padding-bottom: calc(var(--space-8) + env(safe-area-inset-bottom));
}

@media (max-width: 767px) {
  .profile-dropdown { width: 240px; right: var(--space-2); }
}

