/* ════════════════════════════════════════════════════════════════════════════
   Rhodes HQ — Apple-Inspired Design System
   Dark mode, glassmorphism, mobile-first, premium aesthetic
   ════════════════════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ─────────────────────────────────────────────── */
:root {
  /* Spacing (4px/8px base grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Border radius — Apple-style generous rounding */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-pill: 22px;
  --radius-full: 9999px;

  /* Font — Apple system stack */
  --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'SF Mono', ui-monospace, monospace;
  --font-size-xs: 0.6875rem;   /* 11px */
  --font-size-sm: 0.8125rem;   /* 13px */
  --font-size-base: 0.9375rem; /* 15px */
  --font-size-lg: 1.0625rem;   /* 17px */
  --font-size-xl: 1.125rem;    /* 18px */
  --font-size-2xl: 1.25rem;    /* 20px */
  --font-size-3xl: 1.75rem;    /* 28px */
  --font-size-4xl: 2.125rem;   /* 34px */
  --font-size-stat: 2.5rem;    /* 40px */
  --font-size-temp: 3rem;      /* 48px */

  /* Transitions — smooth, silky */
  --transition-fast: 180ms ease;
  --transition-base: 280ms ease;
  --transition-slow: 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);

  /* Layout */
  --sidebar-width: 260px;
  --nav-height: 56px;
  --topbar-height: 52px;

  /* Backgrounds — deep dark with warmth */
  --bg-base: #0a0a0f;
  --bg-gradient: linear-gradient(180deg, #0a0a0f 0%, #111118 100%);
  --bg-sidebar: rgba(18, 18, 26, 0.85);
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-solid: #16161e;
  --bg-hover: rgba(255, 255, 255, 0.08);

  /* Borders — subtle, barely there */
  --border: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.05);

  /* Text — Apple-style hierarchy */
  --text-primary: #f5f5f7;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --text-muted: rgba(255, 255, 255, 0.35);

  /* Accents — Apple Blue */
  --accent: #007AFF;
  --accent-hover: #0063d1;
  --accent-light: #5ac8fa;
  --accent-subtle: rgba(0, 122, 255, 0.12);
  --accent-cyan: #5ac8fa;

  /* Status */
  --success: #30d158;
  --success-subtle: rgba(48, 209, 88, 0.12);
  --warning: #ffd60a;
  --warning-subtle: rgba(255, 214, 10, 0.12);
  --danger: #ff453a;
  --danger-subtle: rgba(255, 69, 58, 0.12);

  /* Shadows — soft, layered */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(0, 122, 255, 0.15);

  /* Glass effect */
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: blur(20px);
}

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

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

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: 1.6;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--accent-light); }

/* ── App Shell Layout ──────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100dvh;
}

.main-content {
  flex: 1;
  padding: var(--space-4);
  padding-top: calc(var(--topbar-height) + var(--space-4));
  padding-bottom: calc(var(--nav-height) + var(--space-6));
  overflow-x: hidden;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

@media (min-width: 768px) {
  .main-content {
    margin-left: var(--sidebar-width);
    margin-right: auto;
    padding: var(--space-8);
    padding-top: calc(var(--topbar-height) + var(--space-6));
    padding-bottom: var(--space-8);
    max-width: calc(720px + var(--sidebar-width));
  }
}

/* ── Top Bar ───────────────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  background: rgba(10, 10, 15, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 90;
}

@media (min-width: 768px) {
  .topbar {
    left: var(--sidebar-width);
    padding: 0 var(--space-8);
  }
}

.breadcrumb-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: background var(--transition-fast);
}

.breadcrumb-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.breadcrumb-pill svg {
  width: 14px;
  height: 14px;
  display: inline-block;
}

.breadcrumb-sep {
  opacity: 0.4;
  margin: 0 2px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent), #5856d6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: #ffffff;
  flex-shrink: 0;
}

.user-avatar-img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

/* ── Sidebar (desktop) ─────────────────────────────────────────────────── */
.sidebar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100dvh;
  background: var(--bg-sidebar);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid var(--border-subtle);
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

@media (min-width: 768px) {
  .sidebar {
    display: flex;
  }
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-logo-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--accent), #5856d6);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-weight: 700;
  font-size: var(--font-size-lg);
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.nav-group {
  margin-top: var(--space-5);
}
.nav-group:first-child {
  margin-top: 0;
}

.nav-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--font-size-base);
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
  position: relative;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(0, 122, 255, 0.15);
  color: var(--accent);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
}

.nav-item-icon {
  width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-item-icon svg {
  display: block;
}

/* Sidebar user section */
.sidebar-user {
  padding: var(--space-4);
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-user-avatar-img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sidebar-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #5856d6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.75rem;
  color: #fff;
  flex-shrink: 0;
}

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

.sidebar-user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-link {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-decoration: none;
}

.sidebar-user-sep {
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.4;
}

/* ── Bottom Navigation (mobile) ────────────────────────────────────────── */
.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(10, 10, 15, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--border-subtle);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

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

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  transition: color var(--transition-fast);
  padding: var(--space-2) var(--space-1);
  min-height: 44px;
}

.bottom-nav-item.active {
  color: var(--accent);
}

.bottom-nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.bottom-nav-icon svg {
  display: block;
}

/* ── Cards — Glassmorphism ─────────────────────────────────────────────── */
.card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

.card:hover {
  background: rgba(255, 255, 255, 0.07);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px) scale(1.005);
}

.card-accent {
  border-left: 3px solid var(--accent);
}

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

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

.card-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── Hero banner ──────────────────────────────────────────────────────── */
.hero-banner {
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.12) 0%, rgba(88, 86, 214, 0.08) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-6);
  margin-bottom: var(--space-6);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.hero-title {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
  margin-bottom: var(--space-2);
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  line-height: 1.5;
}

@media (min-width: 768px) {
  .hero-title {
    font-size: var(--font-size-4xl);
  }
}

/* ── Grid layouts ──────────────────────────────────────────────────────── */
.grid {
  display: grid;
  gap: var(--space-4);
}

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

@media (max-width: 600px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ── Page header ───────────────────────────────────────────────────────── */
.page-header {
  margin-bottom: var(--space-6);
}

.page-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.page-title-row svg {
  flex-shrink: 0;
  display: block;
}

.page-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* ── Stat cards ────────────────────────────────────────────────────────── */
.stat-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  transition: all var(--transition-base);
}

.stat-card:hover {
  background: rgba(255, 255, 255, 0.07);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  color: var(--accent);
  margin-bottom: var(--space-2);
}

.stat-icon svg {
  display: block;
}

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

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-change {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
  text-decoration: none;
}

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

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

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

/* ── Placeholder / empty state ─────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-12) var(--space-4);
  color: var(--text-muted);
  border-radius: var(--radius-lg);
}

.empty-state-icon {
  margin-bottom: var(--space-4);
  color: var(--text-muted);
  opacity: 0.5;
}

.empty-state-icon svg {
  display: block;
}

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

.empty-state-desc {
  font-size: var(--font-size-sm);
  max-width: 320px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Badge ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
}

.badge-info {
  background: var(--accent);
  color: #ffffff;
  border-radius: var(--radius-sm);
  padding: 2px 8px;
}

.badge-success { background: var(--success-subtle); color: var(--success); }
.badge-warning { background: var(--warning-subtle); color: var(--warning); }
.badge-danger  { background: var(--danger-subtle);  color: var(--danger);  }
.badge-accent  { background: var(--accent-subtle);  color: var(--accent);  }

/* ── Divider ───────────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-4) 0;
}

/* ── Utility ───────────────────────────────────────────────────────────── */
.text-sm     { font-size: var(--font-size-sm); }
.text-xs     { font-size: var(--font-size-xs); }
.text-muted  { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2       { gap: var(--space-2); }
.gap-3       { gap: var(--space-3); }
.gap-4       { gap: var(--space-4); }
.mt-4        { margin-top: var(--space-4); }
.mt-6        { margin-top: var(--space-6); }
.w-full      { width: 100%; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }

/* ── Forms ─────────────────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

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

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

.form-group-checkbox {
  justify-content: flex-end;
}

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

.form-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  color: var(--text-primary);
  font-size: var(--font-size-base);
  font-family: var(--font-sans);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  width: 100%;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
}

.form-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  cursor: pointer;
}

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

/* ── Animations ────────────────────────────────────────────────────────── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── HTMX loading indicator ────────────────────────────────────────────── */
.htmx-indicator {
  opacity: 0;
  transition: opacity 200ms;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}

/* ── User Menu ──────────────────────────────────────────────────────────── */
.user-menu {
  position: relative;
}
.user-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  z-index: 100;
  overflow: hidden;
}
.user-dropdown.show {
  display: block;
}
.user-dropdown-header {
  padding: var(--space-4);
}
.user-dropdown-name {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-primary);
}
.user-dropdown-email {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-top: 2px;
}
.user-dropdown-divider {
  height: 1px;
  background: var(--border);
}
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--font-size-sm);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.user-dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.user-dropdown-item svg {
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Dashboard — Apple-style Widgets
   ═══════════════════════════════════════════════════════════════════════════ */

/* Greeting */
.dash-greeting {
  margin-bottom: var(--space-6);
  animation: fadeInUp 0.5s ease both;
}

.dash-greeting-text {
  font-size: var(--font-size-3xl);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.dash-date {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  margin-top: var(--space-1);
  font-weight: 400;
}

/* Widget label (iOS-style) */
.widget-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

/* Dashboard grid */
.dash-grid {
  display: grid;
  gap: var(--space-4);
}

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

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

/* Widget animation stagger */
.dash-widget {
  animation: fadeInUp 0.45s ease both;
}
.dash-widget:nth-child(1) { animation-delay: 0.0s; }
.dash-widget:nth-child(2) { animation-delay: 0.05s; }
.dash-widget:nth-child(3) { animation-delay: 0.10s; }
.dash-widget:nth-child(4) { animation-delay: 0.15s; }
.dash-widget:nth-child(5) { animation-delay: 0.20s; }
.dash-widget:nth-child(6) { animation-delay: 0.25s; }
.dash-widget:nth-child(7) { animation-delay: 0.30s; }
.dash-widget:nth-child(8) { animation-delay: 0.35s; }

/* Weather widget — prominent */
.dash-weather-card {
  background: linear-gradient(135deg, rgba(0, 122, 255, 0.12) 0%, rgba(90, 200, 250, 0.06) 100%);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(0, 122, 255, 0.12);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-4);
}

.dash-weather-main {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  margin-bottom: var(--space-3);
}

.dash-weather-icon {
  font-size: 3.5rem;
  line-height: 1;
}

.dash-weather-temp {
  display: flex;
  flex-direction: column;
}

.dash-weather-degrees {
  font-size: var(--font-size-temp);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.03em;
}

.dash-weather-condition {
  font-size: var(--font-size-lg);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.dash-weather-details {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.dash-weather-sep {
  margin: 0 var(--space-1);
  opacity: 0.4;
}

/* Card headers — iOS widget style */
.dash-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.dash-card-icon {
  font-size: 1rem;
}

.dash-card-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  flex: 1;
}

.dash-card-link {
  font-size: var(--font-size-xs);
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  font-weight: 500;
}

.dash-card-link:hover {
  color: var(--accent-light);
}

/* Event lists */
.dash-event-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.dash-event-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--font-size-sm);
}

.dash-event-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.dash-event-item:first-child {
  padding-top: 0;
}

.dash-event-time {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--accent);
  min-width: 44px;
  flex-shrink: 0;
}

.dash-event-date {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  min-width: 80px;
  flex-shrink: 0;
}

.dash-event-title {
  color: var(--text-primary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 400;
}

/* Countdown badges */
.dash-countdown {
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
}

.dash-countdown-red {
  background: var(--danger-subtle);
  color: var(--danger);
}

.dash-countdown-amber {
  background: var(--warning-subtle);
  color: var(--warning);
}

.dash-countdown-green {
  background: var(--success-subtle);
  color: var(--success);
}

/* Empty state */
.dash-empty {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  padding: var(--space-3) 0;
  font-style: italic;
}

/* Flight widget */
.dash-flight-price {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-2);
}

.dash-flight-dest {
  font-size: var(--font-size-base);
  color: var(--text-primary);
  font-weight: 500;
}

.dash-flight-amount {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-primary);
}

.dash-flight-down {
  color: var(--success);
}

.dash-flight-up {
  color: var(--danger);
}

.dash-flight-detail {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

/* Action link */
.dash-action-link {
  color: var(--accent);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-weight: 500;
}

.dash-action-link:hover {
  color: var(--accent-light);
}

/* Todo widget */
.dash-todo-count {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.dash-todo-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.dash-todo-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--text-primary);
}

.dash-todo-priority {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.dash-todo-urgent {
  background: var(--danger);
}

.dash-todo-normal {
  background: var(--accent);
}

.dash-todo-low {
  background: var(--success);
}

/* Responsive */
@media (max-width: 600px) {
  .dash-greeting-text {
    font-size: var(--font-size-2xl);
  }

  .dash-weather-icon {
    font-size: 2.5rem;
  }

  .dash-weather-degrees {
    font-size: var(--font-size-3xl);
  }

  .dash-weather-card {
    padding: var(--space-5);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Meals Page
   ═══════════════════════════════════════════════════════════════════════════ */

.meals-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: flex-end;
  margin-bottom: var(--space-6);
  padding: var(--space-4);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
}
.meals-filter-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 140px;
}
.meals-filter-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.meals-filter-select {
  appearance: none;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
  font-family: var(--font-sans);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: var(--space-8);
}
.meals-filter-select:focus {
  outline: none;
  border-color: var(--accent);
}
.meals-filter-checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--space-2) 0;
}
.meals-filter-checkbox input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.meal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}
@media (min-width: 540px) {
  .meal-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .meal-grid { grid-template-columns: repeat(3, 1fr); }
}

.meal-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}
.meal-card:hover {
  background: rgba(255, 255, 255, 0.07);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.meal-card-image {
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}
.meal-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.meal-card-body {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.meal-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}
.meal-card-title {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.meal-card-price {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--accent);
}
.meal-card-category {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.meal-card-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-sm);
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  margin-top: var(--space-1);
}
.meal-card-link:hover {
  color: var(--accent-light);
}

.meal-macros {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}
.macro-badge {
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.macro-cal {
  background: rgba(48, 209, 88, 0.12);
  color: #30d158;
}
.macro-protein {
  background: rgba(90, 200, 250, 0.12);
  color: #5ac8fa;
}
.macro-carbs {
  background: rgba(255, 214, 10, 0.12);
  color: #ffd60a;
}
.macro-fat {
  background: rgba(255, 55, 95, 0.12);
  color: #ff375f;
}

.meal-fav-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: var(--space-1);
  border-radius: var(--radius-full);
  transition: color var(--transition-fast), transform var(--transition-fast);
  flex-shrink: 0;
}
.meal-fav-btn:hover {
  color: #ff375f;
  transform: scale(1.15);
}
.meal-fav-btn.favorited {
  color: #ff375f;
}
.meal-fav-btn.favorited svg {
  fill: #ff375f;
}

.meal-cart-controls {
  display: flex;
  align-items: center;
  margin-top: var(--space-1);
}
.meal-add-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-sm);
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.meal-add-btn:hover {
  background: var(--accent-hover);
}
.meal-add-btn:active {
  transform: scale(0.95);
}
.meal-qty-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.meal-qty-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: var(--font-size-base);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  line-height: 1;
  padding: 0;
}
.meal-qty-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.meal-qty-count {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--text-primary);
  min-width: 20px;
  text-align: center;
}

/* ── Cart bar (sticky bottom) ────────────────────────────────────────── */
.cart-bar {
  position: fixed;
  bottom: var(--nav-height);
  left: 0;
  right: 0;
  background: var(--bg-card-solid);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
  z-index: 95;
  animation: cartSlideUp 0.25s ease;
}
@media (min-width: 768px) {
  .cart-bar {
    bottom: 0;
    left: var(--sidebar-width);
  }
}
@keyframes cartSlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.cart-bar-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
}
.cart-bar-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.cart-bar-icon {
  font-size: var(--font-size-lg);
}
.cart-bar-count {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
}
.cart-bar-total {
  font-size: var(--font-size-base);
  font-weight: 700;
  color: var(--accent);
}
.cart-bar-view {
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-sm);
}

.cart-bar-details {
  border-top: 1px solid var(--border);
  padding: var(--space-4);
  max-height: 50vh;
  overflow-y: auto;
  animation: cartExpand 0.2s ease;
}
@keyframes cartExpand {
  from { opacity: 0; max-height: 0; }
  to { opacity: 1; max-height: 50vh; }
}
.cart-item-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.cart-item-row:last-child {
  border-bottom: none;
}
.cart-item-name {
  flex: 1;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cart-item-qty-controls {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}
.cart-item-price {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
  min-width: 56px;
  text-align: right;
}
.cart-item-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--font-size-sm);
  padding: var(--space-1);
  border-radius: var(--radius-full);
  transition: color var(--transition-fast);
  flex-shrink: 0;
}
.cart-item-remove:hover {
  color: var(--danger);
}
.cart-bar-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}

.cart-toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 80px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--success);
  color: #000;
  font-size: var(--font-size-sm);
  font-weight: 600;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  z-index: 200;
  animation: toastFade 3.5s ease forwards;
  white-space: nowrap;
}
.cart-toast-error {
  background: var(--danger);
  color: #fff;
}
@keyframes toastFade {
  0%, 75% { opacity: 1; }
  100% { opacity: 0; }
}
@media (min-width: 768px) {
  .cart-toast {
    bottom: 100px;
  }
}

.meals-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-12) var(--space-4);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--font-size-base);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Chat Page
   ═══════════════════════════════════════════════════════════════════════════ */

.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-height) - var(--space-6));
  max-height: calc(100dvh - var(--topbar-height) - var(--space-6));
  position: relative;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  gap: var(--space-3);
  opacity: 0.7;
}

.chat-welcome-icon {
  font-size: 3rem;
}

.chat-welcome-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-primary);
}

.chat-welcome-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  max-width: 300px;
}

.chat-row {
  display: flex;
  max-width: 85%;
}

.chat-row-user {
  align-self: flex-end;
}

.chat-row-assistant {
  align-self: flex-start;
}

.chat-row-system {
  align-self: center;
  max-width: 100%;
}

.chat-bubble {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-xl);
  font-size: var(--font-size-base);
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.chat-bubble-user {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: var(--radius-sm);
}

.chat-bubble-assistant {
  background: var(--glass-bg);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  border-bottom-left-radius: var(--radius-sm);
}

.chat-bubble-content {
  white-space: pre-wrap;
}

.chat-system-msg {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  padding: var(--space-2) var(--space-4);
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-pill);
}

.typing-dots {
  display: flex;
  gap: 4px;
  padding: var(--space-1) 0;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingDot 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

.chat-input-area {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-subtle);
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.chat-form {
  max-width: 800px;
  margin: 0 auto;
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-2) var(--space-3);
  transition: border-color var(--transition-fast);
}

.chat-input-wrapper:focus-within {
  border-color: var(--accent);
}

.chat-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: 1.5;
  resize: none;
  max-height: 150px;
  padding: var(--space-1) 0;
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-send-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.chat-send-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

@media (max-width: 768px) {
  .chat-container {
    height: calc(100vh - var(--topbar-height) - var(--nav-height));
    max-height: calc(100dvh - var(--topbar-height) - var(--nav-height));
  }

  .chat-row {
    max-width: 90%;
  }

  .chat-messages {
    padding: var(--space-3);
  }

  .chat-input-area {
    padding: var(--space-2) var(--space-3);
    padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom, 0px));
  }
}

/* ── To-Do ── */

.todo-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  transition: opacity 150ms ease, background 150ms ease;
  min-height: 44px;
}

.todo-item:last-child { border-bottom: none; }

.todo-item:hover { background: var(--bg-hover); }

.todo-done .todo-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.todo-check {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.todo-check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent);
}

.todo-content {
  flex: 1;
  min-width: 0;
}

.todo-title {
  font-size: var(--font-size-base);
  color: var(--text-primary);
  word-break: break-word;
}

.todo-meta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: var(--space-2);
}

.todo-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
}

.todo-badge-urgent {
  background: var(--danger-subtle);
  color: var(--danger);
}

.todo-badge-low {
  background: var(--success-subtle);
  color: var(--success);
}

.todo-time {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.todo-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.125rem;
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  line-height: 1;
  opacity: 0.4;
  transition: opacity 150ms ease, color 150ms ease;
  flex-shrink: 0;
}

.todo-item:hover .todo-delete { opacity: 1; }
.todo-delete:active { opacity: 1; }

.todo-delete:hover { color: var(--danger); }

.todo-count {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.todo-chevron {
  transition: transform 200ms ease;
  color: var(--text-muted);
}

.todo-chevron.rotated { transform: rotate(180deg); }

.hidden { display: none; }

.todo-form {
  display: flex;
  gap: var(--space-3);
  align-items: flex-end;
}

.todo-completed-toggle {
  cursor: pointer;
  user-select: none;
}

@media (max-width: 768px) {
  .todo-delete { opacity: 1; }
  .todo-form {
    flex-direction: column;
    align-items: stretch;
  }
  .todo-form .form-group { width: 100%; }
  .todo-form button { width: 100%; height: 44px; }
  .todo-check input[type="checkbox"] {
    width: 24px;
    height: 24px;
  }
  .todo-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 12px;
  }
  .todo-check {
    flex-shrink: 0;
  }
  .todo-content {
    flex: 1;
    min-width: 0;
  }
  .todo-delete {
    flex-shrink: 0;
  }
}

/* ── Flights ──────────────────────────────────────────────────────────── */

.flights-search-form {
  margin-bottom: var(--space-6);
}

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

.form-group-btn {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.flights-search-btn {
  width: 100%;
  padding: var(--space-2) var(--space-4);
  gap: var(--space-2);
  white-space: nowrap;
}

.flights-sort-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding: var(--space-2) 0;
}

.flights-sort-label {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-right: var(--space-1);
}

.flights-sort-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: var(--space-1) var(--space-3);
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.flights-sort-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.flights-sort-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.flights-loading {
  margin-top: var(--space-4);
}

.flights-skeleton {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.skeleton-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  height: 140px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

.flight-results {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.flight-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  transition: all var(--transition-fast);
}

.flight-card:hover {
  background: rgba(255, 255, 255, 0.07);
  box-shadow: var(--shadow-md);
}

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

.flight-airline {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.airline-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.airline-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.flight-number {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.flight-price {
  text-align: right;
}

.price-amount {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--accent);
}

.price-label {
  display: block;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.flight-card-body {
  margin-bottom: var(--space-4);
}

.flight-times {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.flight-time-point {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.flight-time {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.flight-airport {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.flight-duration-line {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  min-width: 80px;
}

.flight-duration {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

.duration-track {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}

.duration-line {
  width: 100%;
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  position: relative;
}

.duration-line::before,
.duration-line::after {
  content: '';
  position: absolute;
  top: -2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.duration-line::before { left: 0; }
.duration-line::after { right: 0; }

.stops-badge {
  font-size: 0.625rem;
  font-weight: 600;
  padding: 1px var(--space-2);
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stops-nonstop {
  color: var(--success);
  background: var(--success-subtle);
}

.stops-connecting {
  color: var(--warning);
  background: var(--warning-subtle);
}

.flight-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.flight-cabin {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.btn-flight-book {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  padding: var(--space-1) var(--space-3);
  color: var(--accent);
  font-size: var(--font-size-sm);
  font-weight: 500;
  font-family: var(--font-sans);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

@media (max-width: 767px) {
  .flights-form-grid {
    grid-template-columns: 1fr;
  }

  .flight-times {
    gap: var(--space-2);
  }

  .flight-time {
    font-size: var(--font-size-base);
  }

  .flight-card {
    padding: var(--space-3) var(--space-4);
  }

  .price-amount {
    font-size: var(--font-size-xl);
  }
}

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

/* Flight results header / search loading */
.flight-results-header {
  margin-bottom: var(--space-4);
}
.flight-results-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.flight-card-route {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex: 1;
  flex-wrap: wrap;
}
.flight-card-leg-label {
  margin-bottom: var(--space-1);
}
.flight-card-times {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.flight-arrow {
  color: var(--text-muted);
}
.flight-card-meta {
  margin-top: 2px;
}
.flight-card-price {
  text-align: right;
  flex-shrink: 0;
}
.flight-price-amount {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  color: var(--success);
}
.search-loading {
  color: var(--text-secondary);
  font-size: var(--font-size-base);
}

/* ── Modal ─────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: var(--space-4);
  display: none;
}

.modal-overlay.modal-open {
  display: flex;
}

.modal {
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

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

.modal-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: var(--space-1);
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.modal form {
  padding: var(--space-5) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

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

.form-error {
  color: var(--danger);
  font-size: var(--font-size-sm);
  padding: var(--space-2) var(--space-3);
  background: var(--danger-subtle);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 69, 58, 0.2);
}

.modal-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  padding-top: var(--space-2);
}

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-xs);
}

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

/* ── Packages ─────────────────────────────────────────────────────────── */
.pkg-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.pkg-stat-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: center;
}

.pkg-stat-value {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-primary);
}

.pkg-stat-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.pkg-sync-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
}

.pkg-sync-icon { flex-shrink: 0; }

.pkg-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid var(--text-muted);
  border-top-color: transparent;
  border-radius: 50%;
  animation: pkg-spin 0.6s linear infinite;
}

.htmx-request .pkg-spinner,
.htmx-request.pkg-spinner { display: inline-block; }

.htmx-request .pkg-sync-icon { display: none; }

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

.pkg-table-wrap { overflow: hidden; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.pkg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.pkg-table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-weight: 600;
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.pkg-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  white-space: nowrap;
}

.pkg-table tbody tr:hover { background: var(--bg-hover); }
.pkg-table tbody tr:last-child td { border-bottom: none; }

.pkg-cell-item {
  white-space: normal;
  max-width: 280px;
  font-weight: 500;
  color: var(--text-primary);
}

.pkg-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.pkg-badge-store {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.pkg-status-ordered { background: rgba(0, 122, 255, 0.15); color: var(--accent); }
.pkg-status-shipped { background: var(--warning-subtle); color: var(--warning); }
.pkg-status-ofd { background: rgba(90, 200, 250, 0.15); color: var(--accent-cyan); }
.pkg-status-delivered { background: var(--success-subtle); color: var(--success); }

.pkg-track-link {
  color: var(--accent);
  text-decoration: none;
  font-size: var(--font-size-xs);
  font-family: var(--font-mono);
}

.pkg-track-link:hover { text-decoration: underline; }

.pkg-price {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--success);
  margin-left: var(--space-2);
}

.btn-sm {
  font-size: var(--font-size-xs);
  padding: 4px 10px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.15s;
}

.btn-sm:hover { opacity: 0.85; }

.pkg-section {
  margin-bottom: var(--space-6);
}

.pkg-section-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.pkg-section-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.pkg-section-count {
  font-size: var(--font-size-xs);
  font-weight: 700;
  background: var(--bg-hover);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.pkg-card-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.pkg-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  transition: all var(--transition-fast);
}

.pkg-card:hover {
  background: rgba(255, 255, 255, 0.07);
}

.pkg-card-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.pkg-card-title {
  font-weight: 500;
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pkg-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.pkg-card-details {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
  flex-wrap: wrap;
}

.pkg-card-date {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

@media (max-width: 600px) {
  .pkg-stats { grid-template-columns: repeat(2, 1fr); gap: var(--space-2); }

  .pkg-card-main {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .pkg-card-title {
    white-space: normal;
  }
}

/* ── Trip Planner ──────────────────────────────────────────────────────── */

.trip-card {
  overflow: hidden;
}

.trip-card-header {
  padding: var(--space-4);
  position: relative;
}

.trip-expand-icon {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

.trip-expand-rotated {
  transform: rotate(180deg);
}

.trip-card-details {
  overflow: hidden;
  max-height: 2000px;
  transition: max-height 0.3s ease, opacity 0.2s ease;
  opacity: 1;
}

.trip-card-collapsed {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.trip-details-inner {
  padding: 0 var(--space-4) var(--space-4);
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-4);
}

.trip-type-badge {
  font-size: var(--font-size-xs);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.trip-type-wedding {
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
}

.trip-type-vacation {
  background: rgba(90, 200, 250, 0.15);
  color: #5ac8fa;
}

.trip-type-business {
  background: rgba(142, 142, 147, 0.15);
  color: #8e8e93;
}

.trip-type-bachelor_party {
  background: rgba(175, 82, 222, 0.15);
  color: #bf5af2;
}

.trip-type-family {
  background: var(--success-subtle);
  color: var(--success);
}

.trip-type-general {
  background: var(--accent-subtle);
  color: var(--accent);
}

.trip-status-pill {
  font-size: var(--font-size-xs);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  white-space: nowrap;
}

.trip-status-booked,
.trip-status-bought {
  background: var(--success-subtle);
  color: var(--success);
}

.trip-status-not-booked {
  background: var(--warning-subtle);
  color: var(--warning);
}

.trip-checklist-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.trip-checklist-item:last-child {
  border-bottom: none;
}

.trip-card-past {
  opacity: 0.6;
}

.trip-card-past .trip-card-header {
  opacity: 0.8;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.btn-icon:hover {
  color: var(--danger);
  background: var(--danger-subtle);
}

.btn-icon-sm {
  width: 24px;
  height: 24px;
}

/* ── Calendar — View Toggle & Month Grid ─────────────────────────────── */
.cal-view-toggle {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.cal-view-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.cal-view-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.cal-view-btn-active {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent);
}

.cal-view-hidden {
  display: none !important;
}

/* Month navigation */
.cal-month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
}

.cal-month-label {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.cal-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-full);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.cal-nav-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Day-of-week headers */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-grid-header {
  padding: 0 var(--space-3);
}

.cal-dow {
  text-align: center;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-2) 0;
}

/* Calendar grid body */
.cal-grid-body {
  padding: 0 var(--space-3) var(--space-3);
  gap: 2px;
}

.cal-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-2) var(--space-1);
  min-height: 52px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.cal-cell:hover {
  background: var(--bg-hover);
}

.cal-cell-muted {
  opacity: 0.3;
}

.cal-cell-today {
  background: var(--accent-subtle);
  border: 1px solid var(--accent);
}

.cal-cell-today:hover {
  background: rgba(0, 122, 255, 0.18);
}

.cal-cell-selected {
  background: var(--bg-hover);
  box-shadow: inset 0 0 0 1px var(--accent-light);
}

.cal-day-num {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1;
}

.cal-cell-muted .cal-day-num {
  color: var(--text-muted);
}

.cal-cell-today .cal-day-num {
  color: var(--accent);
  font-weight: 700;
}

/* Event dots */
.cal-event-dots {
  display: flex;
  gap: 3px;
  margin-top: 4px;
}

.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: var(--radius-full);
  background: var(--accent);
}

/* Day detail panel */
.cal-day-detail {
  padding: 0 var(--space-5) var(--space-5);
}

.cal-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-3);
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--font-size-sm);
}

.cal-day-count {
  font-weight: 400;
  color: var(--text-muted);
  font-size: var(--font-size-xs);
}

.cal-day-event {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-hover);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
}

.cal-day-event-time {
  min-width: 65px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--accent);
  padding-top: 1px;
}

.cal-day-event-info {
  flex: 1;
  min-width: 0;
}

.cal-day-event-title {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-day-event-location {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.cal-day-event-duration {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.cal-day-empty {
  padding: var(--space-4);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

/* Responsive: tighter cells on mobile */
@media (max-width: 600px) {
  .cal-cell {
    min-height: 40px;
    padding: var(--space-1) 0;
  }

  .cal-day-num {
    font-size: var(--font-size-xs);
  }

  .cal-dot {
    width: 4px;
    height: 4px;
  }

  .cal-month-label {
    font-size: var(--font-size-base);
  }

  .cal-day-event-time {
    min-width: 55px;
  }
}

/* ── Small mobile fixes (≤480px) ─────────────────────────────────────── */
@media (max-width: 480px) {
  .modal {
    max-width: calc(100vw - 32px);
  }

  .modal form {
    padding: var(--space-4);
    padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  }

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

  .cal-cell {
    min-height: 36px;
    padding: 2px 0;
  }

  .cal-day-num {
    font-size: 0.625rem;
  }

  .cal-dot {
    width: 3px;
    height: 3px;
  }

  .cal-event-dots {
    gap: 2px;
    margin-top: 2px;
  }
}

/* ── Birthdays ─────────────────────────────────────────────────────────── */

/* Upcoming birthdays */
.upcoming-birthdays {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
}

.upcoming-birthday-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--glass-bg);
}

.upcoming-birthday-item.upcoming-today {
  background: rgba(52, 199, 89, 0.15);
  border: 1px solid rgba(52, 199, 89, 0.3);
}

.upcoming-birthday-item.upcoming-soon {
  background: rgba(255, 159, 10, 0.1);
  border: 1px solid rgba(255, 159, 10, 0.2);
}

.upcoming-birthday-name {
  font-weight: 600;
  font-size: var(--font-size-base);
  min-width: 120px;
}

.upcoming-birthday-meta {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  flex: 1;
  text-align: center;
}

.upcoming-birthday-countdown {
  font-weight: 600;
  font-size: var(--font-size-sm);
  min-width: 100px;
  text-align: right;
}

/* Add birthday form */
.birthday-add-form {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.birthday-form-row {
  display: flex;
  gap: var(--space-3);
  align-items: flex-end;
}

/* Birthday cards */
.birthday-card {
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--space-4);
}

.birthday-card:last-child {
  border-bottom: none;
}

.birthday-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.birthday-card-info {
  flex: 1;
}

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

.birthday-card-meta {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  margin-top: var(--space-1);
}

.birthday-card-sep {
  margin: 0 var(--space-1);
  opacity: 0.5;
}

.birthday-card-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.birthday-card-countdown {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  white-space: nowrap;
}

.birthday-card-countdown.birthday-soon {
  color: var(--accent-warning);
  font-weight: 600;
}

.birthday-card-notes {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  margin-top: var(--space-2);
  font-style: italic;
}

.birthday-delete-btn {
  opacity: 0.4;
  transition: opacity var(--transition-fast);
}

.birthday-delete-btn:hover {
  opacity: 1;
  color: var(--accent-red);
}

/* Gift section */
.birthday-gifts-section {
  margin-top: var(--space-3);
}

.birthday-gifts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: var(--space-2) 0;
  user-select: none;
}

.birthday-gifts-title {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-weight: 500;
}

.birthday-gifts-chevron {
  color: var(--text-secondary);
  transition: transform var(--transition-fast);
}

.birthday-gifts-chevron.rotated {
  transform: rotate(180deg);
}

.birthday-gifts-list {
  overflow: hidden;
  transition: max-height var(--transition-base);
}

.birthday-gifts-list.collapsed {
  display: none;
}

/* Gift rows */
.gift-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--font-size-sm);
}

.gift-row:last-of-type {
  border-bottom: none;
}

.gift-year {
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 40px;
}

.gift-desc {
  flex: 1;
}

.gift-cost {
  color: var(--accent-green);
  font-weight: 500;
  white-space: nowrap;
}

.gift-notes {
  color: var(--text-secondary);
  font-style: italic;
}

.gift-delete-btn {
  opacity: 0.3;
  transition: opacity var(--transition-fast);
}

.gift-delete-btn:hover {
  opacity: 1;
  color: var(--accent-red);
}

.gift-summary {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  padding: var(--space-2) 0;
  border-top: 1px solid var(--border-subtle);
}

/* Gift add form */
.gift-add-form {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
}

.gift-form-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.gift-input-year {
  width: 70px;
}

.gift-input-desc {
  flex: 1;
}

.gift-input-cost {
  width: 80px;
}

/* Mobile adjustments */
@media (max-width: 640px) {
  .birthday-form-row {
    flex-direction: column;
    align-items: stretch;
  }

  .birthday-form-row .btn {
    width: 100%;
  }

  .upcoming-birthday-item {
    flex-wrap: wrap;
    gap: var(--space-1);
  }

  .upcoming-birthday-meta {
    text-align: left;
    order: 3;
    width: 100%;
  }

  .gift-form-row {
    flex-wrap: wrap;
  }

  .gift-input-year {
    width: 60px;
  }

  .gift-input-cost {
    width: 70px;
  }
}
