/* ═══════════════════════════════════════════════════════════════════════════
   OXFORDABLE LIVING — Design System
   Calming, warm, Oxford-inspired. Dark mode default.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── 1. Tokens ──────────────────────────────────────────────────────────────── */
:root {
  /* Surfaces */
  --bg: #1A1A1E;
  --surface: #252528;
  --surface-2: #2E2E32;
  --surface-3: #38383C;
  --border: #3A3A3E;
  --border-subtle: #2E2E32;

  /* Text */
  --text: #E8E0D5;
  --text-secondary: #B8B0A5;
  --text-muted: #7A7470;

  /* Brand — sage green */
  --primary: #8FAF93;
  --primary-hover: #9FBF9E;
  --primary-light: #1E2E20;
  --primary-text: #0F1A10;

  /* Accent — terracotta */
  --accent: #C86B4A;
  --accent-hover: #D87B5A;
  --accent-light: #2E1F1A;

  /* Oxford stone */
  --stone: #C4A882;
  --stone-light: #2A2420;

  /* Semantic */
  --success: #5DBB63;
  --success-light: #1A2E1B;
  --warning: #E8A838;
  --warning-light: #2E2518;
  --error: #E05050;
  --error-light: #2E1818;
  --info: #8FAF93;

  /* Score colours */
  --score-excellent: #5DBB63;
  --score-good: #A8C86A;
  --score-fair: #E8A838;
  --score-poor: #E05050;
  --score-muted: #7A7470;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;
  --space-2xl: 64px;

  /* Type */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Playfair Display', Georgia, serif;

  /* Radius */
  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-full: 999px;

  /* Shadow */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);

  /* Nav height */
  --nav-h: 60px;

  /* Transition */
  --t: 0.2s ease;
}

[data-theme="light"] {
  --bg: #F7F3EE;
  --surface: #FFFFFF;
  --surface-2: #F0EBE3;
  --surface-3: #E8E0D5;
  --border: #E2D9CF;
  --border-subtle: #EDE8E2;
  --text: #2C2520;
  --text-secondary: #6B5F56;
  --text-muted: #9A8E84;
  --primary: #7A9E7E;
  --primary-hover: #6A8E6E;
  --primary-light: #EEF4EF;
  --primary-text: #FFFFFF;
  --accent: #B55C3B;
  --accent-hover: #A54C2B;
  --accent-light: #F5EAE5;
  --stone-light: #FBF7F3;
  --success-light: #EEF7EF;
  --warning-light: #FEF8ED;
  --error-light: #FEF0F0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
}

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

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--t), color var(--t);
}

main { flex: 1; }

a { color: var(--primary); text-decoration: none; transition: color var(--t); }
a:hover { color: var(--primary-hover); }

img { max-width: 100%; height: auto; display: block; }

button { cursor: pointer; font-family: inherit; }

/* ── 3. Layout ──────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}
.container-fluid {
  width: 100%;
  padding: 0 var(--space-lg);
}
.page-padded { padding-top: calc(var(--nav-h) + var(--space-xl)); padding-bottom: var(--space-2xl); }

/* ── 4. Navbar ───────────────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 100;
}
.navbar-inner {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  height: 100%;
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text);
  font-weight: 500;
  font-size: 1.1rem;
}
.brand:hover { color: var(--text); }
.brand-leaf { color: var(--primary); }
.brand-text em { font-family: var(--font-heading); font-style: italic; color: var(--primary); }
.brand-leaf.large { font-size: 2rem; }
.nav-links {
  display: flex;
  list-style: none;
  gap: var(--space-sm);
  margin-left: var(--space-lg);
}
.nav-link {
  color: var(--text-secondary);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--r-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--t);
}
.nav-link:hover, .nav-link.active { color: var(--text); background: var(--surface-2); }
.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-left: auto;
}
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  padding: 4px 8px;
  font-size: 1rem;
  transition: all var(--t);
}
.theme-toggle:hover { background: var(--surface-2); color: var(--text); }
.nav-mobile-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: var(--space-sm);
}
.nav-mobile-toggle span {
  width: 22px; height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: all var(--t);
}

/* ── 5. Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 10px 20px;
  border-radius: var(--r-md);
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all var(--t);
  line-height: 1.4;
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-hover);
  color: var(--primary-text);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger-ghost {
  background: transparent;
  color: var(--error);
  border-color: color-mix(in srgb, var(--error) 30%, transparent);
}
.btn-danger-ghost:hover { background: var(--error-light); }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-xs { padding: 4px 10px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── 6. Cards ────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.card--padded { padding: var(--space-xl); }
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
}
.card-body { padding: var(--space-md) var(--space-lg); }

/* ── 7. Forms ────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--space-xs); }
.form-label { font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); }
.form-control, .form-select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color var(--t), box-shadow var(--t);
  width: 100%;
}
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}
.form-control::placeholder { color: var(--text-muted); }
.form-hint { font-size: 0.8rem; color: var(--text-muted); }
.form-error { font-size: 0.8rem; color: var(--error); }
.form-stacked { display: flex; flex-direction: column; gap: var(--space-lg); }
.form-grid { display: grid; gap: var(--space-md); }
.form-grid--2 { grid-template-columns: repeat(2, 1fr); }
.form-grid--3 { grid-template-columns: repeat(3, 1fr); }
.form-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-subtle);
}
.form-checks { display: flex; flex-direction: column; gap: var(--space-sm); }
.form-check {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  font-size: 0.9rem;
}
.form-check-input { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
.required { color: var(--accent); }
.form-details summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: var(--space-sm) 0;
}
.input-group { position: relative; display: flex; }
.input-group .form-control { flex: 1; border-radius: var(--r-sm) 0 0 var(--r-sm); }
.input-addon {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 0 12px;
  cursor: pointer;
}

/* Weight sliders */
.weight-row { gap: var(--space-sm); }
.weight-header { display: flex; justify-content: space-between; align-items: center; }
.weight-value {
  font-size: 1.5rem;
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--primary);
  min-width: 2ch;
  text-align: right;
}
input[type="range"] {
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  outline: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: var(--shadow-sm);
  transition: transform var(--t);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }
.weight-hint { color: var(--text-muted); font-size: 0.8rem; }
.weight-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── 8. Auth pages ────────────────────────────────────────────────────────── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--nav-h) var(--space-lg) var(--space-xl);
}
.auth-container {
  width: 100%;
  max-width: 440px;
}
.auth-container--wide { max-width: 640px; }
.auth-card { padding: var(--space-xl); }
.auth-brand { text-align: center; margin-bottom: var(--space-xl); }
.auth-form { display: flex; flex-direction: column; gap: var(--space-lg); margin-top: var(--space-xl); }
.auth-footer { text-align: center; margin-top: var(--space-lg); font-size: 0.875rem; color: var(--text-secondary); }

/* Onboarding steps */
.onboarding-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: var(--space-lg);
}
.step {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 2px solid var(--border);
}
.step.active { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.step.done { background: var(--success); color: white; border-color: var(--success); }
.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  max-width: 60px;
}
.step-line--done { background: var(--success); }

/* ── 9. Dashboard ────────────────────────────────────────────────────────── */
.dashboard-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.stat-card--accent { border-color: var(--accent-light); }
.stat-card--success { border-color: var(--success-light); }
.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--text);
  line-height: 1;
}
.stat-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; letter-spacing: 0.05em; }
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-lg);
}
.dashboard-section { overflow: hidden; }
.link-sm { font-size: 0.85rem; color: var(--text-muted); }
.link-sm:hover { color: var(--primary); }

/* ── 10. Listings ────────────────────────────────────────────────────────── */
.listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
}
.listing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: all var(--t);
  color: var(--text);
  display: block;
}
.listing-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: var(--text);
}
.listing-card-image {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--surface-2);
}
.listing-card-image img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--t);
}
.listing-card:hover .listing-card-image img { transform: scale(1.03); }
.listing-card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 3rem;
  background: var(--surface-3);
}
.listing-card-score {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-weight: 700;
  font-size: 0.9rem;
  backdrop-filter: blur(4px);
}
.listing-card-body { padding: var(--space-md); }
.listing-card-title { font-weight: 600; font-size: 0.95rem; margin-bottom: var(--space-xs); line-height: 1.4; }
.listing-card-meta { display: flex; gap: var(--space-xs); flex-wrap: wrap; align-items: center; margin-bottom: var(--space-xs); }
.listing-card-address { font-size: 0.8rem; color: var(--text-muted); }
.price-sm { font-weight: 600; color: var(--text); font-size: 0.9rem; }
.price-xs { font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; }

/* Listing detail layout */
.listing-detail-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  align-items: start;
}
.listing-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}
.listing-title { font-family: var(--font-heading); }
.listing-address { margin-top: var(--space-xs); font-size: 0.9rem; }
.source-link { font-size: 0.85rem; color: var(--text-muted); border-bottom: 1px dashed var(--border); }
.listing-meta { display: flex; gap: var(--space-xs); flex-wrap: wrap; align-items: center; margin-bottom: var(--space-lg); }
.price-tag {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--text);
}
.price-tag small { font-size: 0.85rem; font-weight: 400; color: var(--text-muted); font-family: var(--font-body); }
.price-tag--secondary { font-size: 1rem; }

/* Score circle */
.score-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 3px solid currentColor;
}
.score-circle.score-excellent { color: var(--score-excellent); background: color-mix(in srgb, var(--score-excellent) 10%, transparent); }
.score-circle.score-good { color: var(--score-good); background: color-mix(in srgb, var(--score-good) 10%, transparent); }
.score-circle.score-fair { color: var(--score-fair); background: color-mix(in srgb, var(--score-fair) 10%, transparent); }
.score-circle.score-poor { color: var(--score-poor); background: color-mix(in srgb, var(--score-poor) 10%, transparent); }
.score-circle.score-muted { color: var(--text-muted); background: var(--surface-2); }
.score-number { font-size: 1.6rem; font-weight: 700; font-family: var(--font-heading); line-height: 1; }
.score-label { font-size: 0.7rem; color: var(--text-muted); }

/* Score badges */
.score-badge {
  font-weight: 700;
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: var(--r-full);
  display: inline-block;
  min-width: 36px;
  text-align: center;
}
.score-badge-sm {
  font-weight: 700;
  font-size: 0.8rem;
  padding: 2px 7px;
  border-radius: var(--r-full);
  display: inline-block;
}
.score-excellent { background: color-mix(in srgb, var(--score-excellent) 20%, transparent); color: var(--score-excellent); }
.score-good { background: color-mix(in srgb, var(--score-good) 20%, transparent); color: var(--score-good); }
.score-fair { background: color-mix(in srgb, var(--score-fair) 20%, transparent); color: var(--score-fair); }
.score-poor { background: color-mix(in srgb, var(--score-poor) 20%, transparent); color: var(--score-poor); }
.score-muted { background: var(--surface-2); color: var(--text-muted); }

/* Score bars */
.score-bars { display: flex; flex-direction: column; gap: var(--space-sm); }
.score-bar-row { display: grid; grid-template-columns: 150px 1fr 36px; align-items: center; gap: var(--space-sm); }
.score-bar-label { font-size: 0.8rem; color: var(--text-secondary); }
.score-bar-track { height: 6px; background: var(--surface-3); border-radius: var(--r-full); overflow: hidden; }
.score-bar-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: var(--primary);
  transition: width 0.6s ease;
}
.score-bar-value { font-size: 0.8rem; font-weight: 600; text-align: right; }

/* AI evaluation */
.evaluation-section { margin-top: var(--space-lg); display: flex; flex-direction: column; gap: var(--space-xl); }
.ai-description { background: var(--surface-2); border-radius: var(--r-md); padding: var(--space-md); }
.pros-cons { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
.pros ul, .cons ul { list-style: none; display: flex; flex-direction: column; gap: var(--space-xs); }
.pros li { color: var(--success); font-size: 0.875rem; }
.cons li { color: var(--warning); font-size: 0.875rem; }
.poi-list { list-style: none; display: flex; flex-direction: column; gap: var(--space-xs); }
.poi-list li { font-size: 0.85rem; display: flex; align-items: center; gap: var(--space-xs); }
.poi-type { font-size: 0.75rem; padding: 2px 6px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--text-muted); }
.poi-dist { color: var(--text-muted); font-size: 0.8rem; margin-left: auto; }
.location-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-lg); }
.listing-description { margin-top: var(--space-lg); }
.description-text { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.7; max-height: 200px; overflow-y: auto; }
.listing-actions { display: flex; gap: var(--space-sm); flex-wrap: wrap; margin-top: var(--space-xl); padding-top: var(--space-lg); border-top: 1px solid var(--border); }
.inline-form { display: flex; align-items: center; gap: var(--space-sm); }

/* Photos */
.photo-gallery { display: flex; flex-direction: column; gap: var(--space-sm); }
.photo-main { border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 4/3; background: var(--surface-2); }
.photo-main-img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.photo-thumbs { display: flex; gap: var(--space-xs); overflow-x: auto; padding-bottom: var(--space-xs); }
.photo-thumb {
  width: 72px; height: 54px;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--t);
}
.photo-thumb.active, .photo-thumb:hover { border-color: var(--primary); }
.photo-placeholder { aspect-ratio: 4/3; background: var(--surface-2); border-radius: var(--r-lg); display: flex; align-items: center; justify-content: center; font-size: 4rem; }
.floorplan-section { margin-top: var(--space-lg); }
.floorplan-img { border-radius: var(--r-md); border: 1px solid var(--border); max-width: 100%; }

/* File upload */
.file-upload { position: relative; }
.file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xl);
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: all var(--t);
}
.file-label:hover, .file-upload:has(.file-input:focus) .file-label {
  border-color: var(--primary);
  background: var(--primary-light);
}
.file-icon { font-size: 2rem; }
.file-preview { display: flex; gap: var(--space-xs); flex-wrap: wrap; margin-top: var(--space-sm); }

/* ── 11. Badges ─────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.badge-xs { padding: 2px 6px; font-size: 0.7rem; }
.badge-success { background: var(--success-light); color: var(--success); border-color: transparent; }
.badge-warning { background: var(--warning-light); color: var(--warning); border-color: transparent; }
.badge-error { background: var(--error-light); color: var(--error); border-color: transparent; }
.badge-info { background: var(--primary-light); color: var(--primary); border-color: transparent; }

/* Status badges */
.status-badge { font-size: 0.75rem; font-weight: 500; padding: 2px 8px; border-radius: var(--r-full); }
.status-new { background: var(--surface-2); color: var(--text-muted); }
.status-to_view { background: var(--primary-light); color: var(--primary); }
.status-viewed { background: var(--primary-light); color: var(--primary); }
.status-evaluated { background: var(--accent-light); color: var(--accent); }
.status-contacted { background: var(--accent-light); color: var(--accent); }
.status-rented { background: var(--success-light); color: var(--success); }
.status-discarded, .status-rejected { background: var(--surface-2); color: var(--text-muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.status-primary { background: var(--primary); }
.status-dot.status-accent { background: var(--accent); }
.status-dot.status-success { background: var(--success); }
.status-dot.status-muted { background: var(--text-muted); }
.status-dot.status-stone { background: var(--stone); }

/* ── 12. Alerts ─────────────────────────────────────────────────────────── */
.messages-container { padding: var(--space-sm) 0; }
.alert {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--r-md);
  margin-bottom: var(--space-sm);
  font-size: 0.9rem;
}
.alert-info { background: var(--primary-light); color: var(--primary); border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); }
.alert-success { background: var(--success-light); color: var(--success); }
.alert-warning { background: var(--warning-light); color: var(--warning); }
.alert-error, .alert-danger { background: var(--error-light); color: var(--error); }
.alert-close { margin-left: auto; background: none; border: none; font-size: 1.2rem; cursor: pointer; color: inherit; opacity: 0.7; }
.alert-close:hover { opacity: 1; }

/* ── 13. Tracker & Kanban ───────────────────────────────────────────────── */
.tracker-header {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  flex-wrap: wrap;
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
}
.tracker-header-left { display: flex; align-items: center; gap: var(--space-md); }
.tracker-members { display: flex; gap: 4px; }
.view-switcher { display: flex; gap: var(--space-xs); background: var(--surface-2); border-radius: var(--r-md); padding: 4px; }
.view-btn {
  padding: 6px 12px;
  border-radius: var(--r-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: all var(--t);
  text-decoration: none;
}
.view-btn:hover, .view-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.filter-bar { display: flex; gap: var(--space-sm); align-items: center; flex-wrap: wrap; margin-bottom: var(--space-xl); }
.filter-bar--inline { margin-bottom: 0; margin-left: auto; }
.filter-input, .filter-select { width: auto; }
.filter-input-sm, .filter-select-sm { width: auto; padding: 6px 10px; font-size: 0.85rem; }

/* Kanban */
.kanban-board {
  display: flex;
  gap: var(--space-md);
  overflow-x: auto;
  padding-bottom: var(--space-md);
  align-items: flex-start;
}
.kanban-col {
  min-width: 230px;
  max-width: 260px;
  flex-shrink: 0;
  background: var(--surface-2);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.kanban-col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-3);
}
.kanban-col-title { font-size: 0.8rem; font-weight: 600; }
.kanban-col-count { font-size: 0.75rem; background: var(--surface-2); padding: 2px 6px; border-radius: var(--r-full); }
.kanban-cards { padding: var(--space-sm); display: flex; flex-direction: column; gap: var(--space-sm); min-height: 60px; }
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: all var(--t);
}
.kanban-card:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.kanban-card-link { display: block; color: var(--text); }
.kanban-card-link:hover { color: var(--text); }
.kanban-card-img { width: 100%; height: 80px; object-fit: cover; }
.kanban-card-body { padding: var(--space-sm); }
.kanban-card-title { font-size: 0.8rem; font-weight: 500; display: block; margin-bottom: 2px; line-height: 1.3; }
.kanban-card-actions { padding: var(--space-xs) var(--space-sm); border-top: 1px solid var(--border); }
.kanban-empty { text-align: center; color: var(--text-muted); font-size: 0.8rem; padding: var(--space-md); }
.status-select { width: 100%; font-size: 0.8rem; padding: 4px; background: transparent; border: none; color: var(--text-secondary); cursor: pointer; }
.status-select:focus { outline: 1px solid var(--primary); border-radius: var(--r-sm); }

/* Map */
.tracker-map { width: 100%; height: calc(100vh - 200px); min-height: 500px; border-radius: var(--r-lg); border: 1px solid var(--border); overflow: hidden; }
.map-marker {
  width: 36px; height: 36px;
  border-radius: 50% 50% 50% 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  transform: rotate(-45deg);
  box-shadow: var(--shadow-md);
}
.map-marker > * { transform: rotate(45deg); }

/* ── 14. Social ─────────────────────────────────────────────────────────── */
.friends-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-lg); }
.friend-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.friend-actions { margin-left: auto; display: flex; gap: var(--space-xs); }
.user-search { max-width: 400px; }

/* ── 15. Avatar ─────────────────────────────────────────────────────────── */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
}
.avatar-initials {
  background: var(--primary-light);
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.avatar-xs { width: 24px; height: 24px; font-size: 0.7rem; }
.avatar-btn { display: flex; }

/* ── 16. Notes ──────────────────────────────────────────────────────────── */
.notes-section { margin-top: var(--space-xl); }
.note {
  background: var(--surface-2);
  border-radius: var(--r-md);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  border-left: 3px solid var(--primary);
}
.note-header { display: flex; gap: var(--space-sm); margin-bottom: var(--space-xs); }
.note-author { font-size: 0.8rem; font-weight: 600; color: var(--primary); }
.note-date { font-size: 0.75rem; color: var(--text-muted); }
.note-content { font-size: 0.875rem; color: var(--text-secondary); }
.note-form { margin-top: var(--space-md); }

/* ── 17. Misc helpers ───────────────────────────────────────────────────── */
.heading-xl { font-family: var(--font-heading); font-size: 2.2rem; font-weight: 700; line-height: 1.2; }
.heading-lg { font-family: var(--font-heading); font-size: 1.75rem; font-weight: 700; line-height: 1.3; }
.heading-md { font-family: var(--font-heading); font-size: 1.4rem; font-weight: 600; }
.heading-sm { font-size: 1rem; font-weight: 600; }
.heading-xs { font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: var(--space-sm); }
.text-secondary { color: var(--text-secondary); }
.mb-4 { margin-bottom: var(--space-md); }
.mt-2 { margin-top: var(--space-sm); }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-xl); }
.breadcrumb { font-size: 0.875rem; color: var(--text-muted); display: inline-block; margin-bottom: var(--space-lg); }
.breadcrumb:hover { color: var(--text-secondary); }
.empty-state { text-align: center; padding: var(--space-2xl) var(--space-xl); color: var(--text-secondary); }
.empty-state--large { border: 1px dashed var(--border); border-radius: var(--r-lg); }
.empty-icon { font-size: 4rem; margin-bottom: var(--space-md); }
.pagination { display: flex; align-items: center; justify-content: center; gap: var(--space-md); padding: var(--space-xl) 0; }
.pagination-info { font-size: 0.875rem; color: var(--text-muted); }

/* Row lists */
.listing-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--r-md);
  color: var(--text);
  transition: background var(--t);
}
.listing-row:hover { background: var(--surface-2); color: var(--text); }
.listing-row-img { width: 48px; height: 36px; object-fit: cover; border-radius: var(--r-sm); flex-shrink: 0; }
.listing-row-img--placeholder { display: flex; align-items: center; justify-content: center; background: var(--surface-3); font-size: 1.2rem; }
.listing-row-info { flex: 1; min-width: 0; }
.listing-row-title { font-size: 0.875rem; font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.listing-row-price { font-size: 0.8rem; color: var(--text-muted); }

.activity-row { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-sm) var(--space-md); border-radius: var(--r-md); color: var(--text); transition: background var(--t); }
.activity-row:hover { background: var(--surface-2); color: var(--text); }
.activity-title { flex: 1; font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.list-row { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-sm) var(--space-md); border-radius: var(--r-md); color: var(--text); transition: background var(--t); }
.list-row:hover { background: var(--surface-2); color: var(--text); }
.list-icon { color: var(--primary); font-size: 1.1rem; }
.list-name { flex: 1; font-size: 0.875rem; font-weight: 500; }
.list-members { font-size: 0.8rem; color: var(--text-muted); }

/* ── 18. Footer ─────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: var(--space-lg) 0;
  margin-top: auto;
}
.footer-inner { display: flex; justify-content: space-between; align-items: center; }
.footer-brand { color: var(--primary); font-size: 0.875rem; }
.footer-copy { font-size: 0.8rem; color: var(--text-muted); }

/* ── 19. Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .listing-detail-layout { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-mobile-toggle { display: flex; }
  .nav-links.open { display: flex; flex-direction: column; position: fixed; top: var(--nav-h); left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: var(--space-md); z-index: 99; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-hero { flex-direction: column; gap: var(--space-md); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid--2, .form-grid--3 { grid-template-columns: 1fr; }
  .pros-cons, .location-grid { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar--inline { flex-direction: row; }
  .tracker-header { flex-direction: column; align-items: flex-start; }
  .container { padding: 0 var(--space-md); }
  .heading-xl { font-size: 1.6rem; }
  .heading-lg { font-size: 1.4rem; }
  .friends-grid { grid-template-columns: 1fr; }
  .score-bar-row { grid-template-columns: 100px 1fr 30px; }
  .auth-card { padding: var(--space-lg); }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .listings-grid { grid-template-columns: 1fr; }
  .kanban-board { flex-direction: column; overflow-x: initial; }
  .kanban-col { min-width: unset; max-width: unset; width: 100%; }
  .page-padded { padding-top: calc(var(--nav-h) + var(--space-lg)); }
}

/* ── 20. Transitions & animations ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.htmx-request .htmx-indicator { opacity: 1; }
.htmx-indicator { opacity: 0; transition: opacity var(--t); }

/* Respect browser font settings on compact interfaces. */
.form-label, .form-hint, .tracker-table th { font-size: max(0.875rem, 14px); }
