/* =====================================================================
   LONGEVICLINICS — PATIENT PORTAL PRODUCTION STYLES (V1)
   Aligned with Mobile App Design Tokens, Typography & Brand Colors
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

:root {
  /* Brand Color Tokens from Mobile App (constants/theme.ts) */
  --brand-orange: #ff993f;
  --brand-peach: #feba66;
  --brand-pink: #ffaaa7;
  --brand-cream: #fff3eb;
  --brand-gold: #ffe8b6;
  --brand-black: #000000;
  --brand-gradient: linear-gradient(135deg, #ff993f 0%, #feba66 50%, #ffaaa7 100%);
  --brand-gradient-glow: linear-gradient(135deg, rgba(255, 153, 63, 0.4), rgba(254, 186, 102, 0.25), rgba(255, 170, 167, 0.2));

  /* Dark Luxury Clinical Theme — Aligned with Homepage Tones */
  --bg-dark: #050505;
  --bg-sidebar: #0d0d0d;
  --bg-card: #131313;
  --bg-card-elevated: #1a1a1a;
  --bg-card-hover: #222222;
  --bg-input: #121212;

  /* Text Colors */
  --text-main: #fcfcfd;
  --text-muted: #9ba1b0;
  --text-dim: #6c7280;
  --text-on-gradient: #ffffff;

  /* Accent & Status Colors */
  --accent: #ff993f;
  --accent-hover: #feba66;
  --accent-soft: rgba(255, 153, 63, 0.12);
  --accent-border: rgba(255, 153, 63, 0.35);

  --color-optimal: #34C759;
  --color-optimal-bg: rgba(52, 199, 89, 0.12);
  --color-optimal-border: rgba(52, 199, 89, 0.3);

  --color-warning: #FA8C16;
  --color-warning-bg: rgba(250, 140, 22, 0.12);
  --color-warning-border: rgba(250, 140, 22, 0.3);

  --color-danger: #FF3B30;
  --color-danger-bg: rgba(255, 59, 48, 0.12);
  --color-danger-border: rgba(255, 59, 48, 0.3);

  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(255, 255, 255, 0.16);

  /* Layout */
  --sidebar-width: 275px;
  --header-height: 70px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
}

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

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(255, 153, 63, 0.05), transparent 45%),
    radial-gradient(circle at 85% 75%, rgba(254, 186, 102, 0.03), transparent 50%);
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 153, 63, 0.25);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 153, 63, 0.5);
}

/* ─── Mobile Sidebar Overlay ─── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 190;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* ═════════════════════════════════════════════════════════════
   SIDEBAR
   ═════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.25rem;
  z-index: 200;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}

/* Header & Return to Home */
.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  transition: opacity 0.2s;
}
.sidebar-logo:hover {
  opacity: 0.9;
}
.sidebar-logo img {
  height: 32px;
  width: 32px;
  object-fit: contain;
}
.sidebar-logo-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.sidebar-logo-text .brand-longevi {
  color: #ffffff;
}
.sidebar-logo-text .brand-clinics {
  color: var(--brand-orange);
  font-weight: 400;
}

/* Return to Home / Landing Button */
.back-home-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--brand-peach);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.25s ease;
}
.back-home-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: #ffffff;
  transform: translateY(-1px);
}
.back-home-btn i, .back-home-btn svg {
  width: 16px;
  height: 16px;
}

/* Navigation Menu */
.nav-menu {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin: 0.9rem 0.5rem 0.35rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  transform: translateX(2px);
}
.nav-item.active {
  background: var(--accent-soft);
  color: var(--brand-orange);
  font-weight: 600;
  border: 1px solid var(--accent-border);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  height: 50%;
  width: 4px;
  background: var(--brand-orange);
  border-radius: 0 4px 4px 0;
}
.nav-item i, .nav-item svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  stroke-width: 2;
  flex-shrink: 0;
}
.nav-item-badge {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--brand-orange);
  border: 1px solid var(--accent-border);
}

/* User Profile in Sidebar */
.user-profile {
  margin-top: auto;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(255, 153, 63, 0.25);
}
.user-info {
  flex: 1;
  min-width: 0;
}
.user-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  color: var(--brand-peach);
  font-weight: 500;
}
.user-role-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-optimal);
}
.logout-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.logout-btn:hover {
  background: var(--color-danger-bg);
  border-color: var(--color-danger-border);
  color: var(--color-danger);
}

/* ═════════════════════════════════════════════════════════════
   MAIN CONTENT & TOPBAR
   ═════════════════════════════════════════════════════════════ */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  min-width: 0;
}

/* Topbar */
.topbar {
  height: var(--header-height);
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2.5rem;
  z-index: 100;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.menu-toggle-btn {
  display: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.breadcrumb-trail {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--text-dim);
}
.breadcrumb-trail .current-view-title {
  color: var(--text-main);
  font-weight: 600;
  font-size: 1.05rem;
  font-family: 'Outfit', sans-serif;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}
.topbar-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
.topbar-action-btn.secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}
.topbar-action-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-main);
}
.topbar-action-btn.primary {
  background: var(--brand-gradient);
  border: none;
  color: #000000;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(255, 153, 63, 0.3);
}
.topbar-action-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(255, 153, 63, 0.4);
}

/* Main Scroll Area */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 2.25rem 2.75rem 4rem;
}

/* View Sections Toggle */
.view-section {
  display: none;
  animation: fadeIn 0.35s ease forwards;
}
.view-section.active {
  display: block;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* View Header */
.section-header {
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 1rem;
}
.section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}
.section-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.35rem;
}

/* ═════════════════════════════════════════════════════════════
   HERO LONGEVITY SCORE CARD (Matches Mobile App index.tsx)
   ═════════════════════════════════════════════════════════════ */
.longevity-hero-card {
  background: var(--brand-gradient);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  margin-bottom: 2.25rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 16px 36px rgba(255, 153, 63, 0.22);
  color: #ffffff;
}
.longevity-hero-card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
  pointer-events: none;
}

.hero-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.hero-score-badge-lbl {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 0.35rem;
}
.hero-score-row {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}
.hero-score-num {
  font-family: 'Outfit', sans-serif;
  font-size: 4rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  color: #ffffff;
}
.hero-score-denom {
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  opacity: 0.8;
}
.hero-trend-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.35rem 0.75rem;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 0.65rem;
}

/* Biological Age Badge */
.hero-age-badge {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  padding: 1.25rem 1.6rem;
  border-radius: var(--radius-md);
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.hero-age-badge-title {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.95);
}
.hero-age-badge-val {
  font-family: 'Outfit', sans-serif;
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1.2;
  margin: 0.2rem 0;
  color: #ffffff;
}
.hero-age-badge-val span {
  font-size: 1rem;
  font-weight: 500;
}
.hero-age-badge-chrono {
  font-size: 0.82rem;
  opacity: 0.9;
  font-weight: 600;
}
.hero-age-badge-diff {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  font-weight: 800;
  background: #ffffff;
  color: #000000;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
}

/* 6-Month Evolution Timeline Bar (from Mobile App TIMELINE) */
.hero-timeline-section {
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding-top: 1.5rem;
}
.hero-timeline-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
}
.hero-timeline-chart {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  height: 90px;
  gap: 0.75rem;
}
.timeline-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}
.timeline-score-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: #ffffff;
}
.timeline-bar-track {
  width: 14px;
  height: 52px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}
.timeline-bar-fill {
  width: 100%;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  transition: height 0.6s ease;
}
.timeline-col.current .timeline-bar-fill {
  background: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}
.timeline-month-label {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.8);
}
.timeline-col.current .timeline-month-label {
  font-weight: 800;
  color: #ffffff;
}

/* ═════════════════════════════════════════════════════════════
   CARDS & GRIDS
   ═════════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  backdrop-filter: blur(12px);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.card:hover {
  border-color: var(--border-color-hover);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}
.card-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.grid-cols-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.grid-cols-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.grid-cols-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* ─── Biomarker Quick Widgets (Mobile App Aligned) ─── */
.metric-widget-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}
.metric-widget-card:hover {
  border-color: var(--accent-border);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.widget-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
}
.widget-icon-box {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.widget-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.widget-value-row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
}
.widget-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}
.widget-unit {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}
.widget-label {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}
.widget-trend {
  font-size: 0.82rem;
  font-weight: 700;
}

/* ─── Upcoming Actions Cards ─── */
.action-card {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.4rem;
  margin-bottom: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.action-card:hover {
  border-color: var(--border-color-hover);
  background: var(--bg-card-hover);
}
.action-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.action-info {
  flex: 1;
}
.action-title {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}
.action-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.action-chip {
  padding: 0.35rem 0.75rem;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 700;
}

/* Clinical Tip Card */
.tip-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: rgba(255, 153, 63, 0.08);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  margin-top: 1.5rem;
}
.tip-icon {
  color: var(--brand-orange);
  flex-shrink: 0;
  margin-top: 2px;
}
.tip-text {
  font-size: 0.92rem;
  line-height: 1.6;
  color: #ffeedb;
  font-weight: 500;
}

/* ═════════════════════════════════════════════════════════════
   BIOMARKERS SYSTEM VIEW (Interactive Explorer)
   ═════════════════════════════════════════════════════════════ */
.biomarkers-controls {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}
.search-filter-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.search-input-box {
  flex: 1;
  min-width: 260px;
  position: relative;
}
.search-input-box i, .search-input-box svg {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  width: 18px;
  height: 18px;
}
.search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  color: var(--text-main);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s;
}
.search-input:focus {
  border-color: var(--brand-orange);
}

/* Status Filter Buttons */
.status-filter-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.status-filter-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.status-filter-btn:hover {
  color: var(--text-main);
  border-color: var(--border-color-hover);
}
.status-filter-btn.active {
  background: var(--accent-soft);
  color: var(--brand-orange);
  border-color: var(--accent-border);
}

/* Systems Pills Bar */
.systems-pills-bar {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}
.system-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.55rem 1rem;
  border-radius: 99px;
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}
.system-pill:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}
.system-pill.active {
  background: var(--brand-orange);
  color: #000000;
  border-color: var(--brand-orange);
  font-weight: 700;
}

/* Biomarker List & HBar Gauge */
.biomarkers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.25rem;
}
.biomarker-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}
.biomarker-card:hover {
  border-color: var(--accent-border);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.biomarker-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}
.biomarker-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}
.biomarker-cat {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 500;
}
.biomarker-value-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}
.biomarker-val {
  font-size: 1.55rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  color: var(--text-main);
}
.biomarker-unit {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 0.35rem;
}

/* Visual Horizontal Range Bar (HBar from Mobile App) */
.hbar-container {
  margin: 0.85rem 0 0.5rem;
}
.hbar-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  position: relative;
}
.hbar-optimal-zone {
  position: absolute;
  top: 0;
  height: 100%;
  background: var(--color-optimal-bg);
  border: 1px solid var(--color-optimal-border);
  border-radius: 4px;
}
.hbar-cursor {
  position: absolute;
  top: -4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--brand-orange);
  box-shadow: 0 0 6px rgba(0,0,0,0.5);
  transform: translateX(-50%);
}
.hbar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.4rem;
}

/* Status Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
}
.status-pill.optimal {
  background: var(--color-optimal-bg);
  color: var(--color-optimal);
  border: 1px solid var(--color-optimal-border);
}
.status-pill.warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border: 1px solid var(--color-warning-border);
}
.status-pill.danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border: 1px solid var(--color-danger-border);
}

/* ═════════════════════════════════════════════════════════════
   HÁBITOS & RUTINAS VIEW
   ═════════════════════════════════════════════════════════════ */
.habits-streak-banner {
  background: linear-gradient(135deg, rgba(255, 153, 63, 0.15), rgba(254, 186, 102, 0.05));
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.streak-info-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.streak-fire-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000000;
  font-size: 1.6rem;
}
.streak-num {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: var(--brand-orange);
}
.streak-lbl {
  font-size: 0.92rem;
  color: var(--text-muted);
}
.streak-progress-box {
  min-width: 220px;
}
.streak-progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
}
.streak-bar-track {
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
}
.streak-bar-fill {
  height: 100%;
  background: var(--brand-gradient);
  border-radius: 99px;
  transition: width 0.4s ease;
}

/* Habit Checklist */
.habit-item {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.5rem;
  margin-bottom: 0.85rem;
  transition: all 0.2s ease;
}
.habit-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color-hover);
}
.habit-item.completed {
  opacity: 0.65;
  border-color: rgba(52, 199, 89, 0.2);
}
.habit-item.completed .habit-title {
  text-decoration: line-through;
  color: var(--text-muted);
}
.habit-checkbox {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--brand-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: transparent;
  color: #000000;
  transition: all 0.2s;
  flex-shrink: 0;
}
.habit-item.completed .habit-checkbox {
  background: var(--color-optimal);
  border-color: var(--color-optimal);
  color: #ffffff;
}
.habit-content {
  flex: 1;
}
.habit-title {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}
.habit-detail {
  font-size: 0.84rem;
  color: var(--text-muted);
}
.habit-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--brand-peach);
}

/* Routines Protocol Grid */
.routine-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.75rem;
}
.routine-phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--brand-orange);
  margin-bottom: 0.85rem;
}
.routine-step-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1rem;
}
.routine-step-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text-muted);
}
.routine-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--brand-orange);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ═════════════════════════════════════════════════════════════
   ALIMENTACIÓN & NUTRICIÓN VIEW
   ═════════════════════════════════════════════════════════════ */
.fasting-timer-card {
  background: linear-gradient(135deg, rgba(255, 153, 63, 0.1), #131313);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  padding: 2rem;
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}
.fasting-status-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-peach);
  margin-bottom: 0.35rem;
}
.fasting-window-clock {
  font-family: 'Outfit', sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}
.fasting-phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--color-optimal-bg);
  border: 1px solid var(--color-optimal-border);
  color: var(--color-optimal);
  padding: 0.35rem 0.85rem;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 700;
}

/* Macro Goals */
.macro-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
}
.macro-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}
.macro-name {
  font-weight: 700;
  font-size: 1rem;
}
.macro-val {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--brand-orange);
}
.macro-bar-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
  margin: 0.5rem 0;
}
.macro-bar-fill {
  height: 100%;
  border-radius: 99px;
}
.macro-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Food Recommendations */
.food-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.food-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
}
.food-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

/* ═════════════════════════════════════════════════════════════
   CHAT IA (LONGEVIBOT DE PRECISIÓN)
   ═════════════════════════════════════════════════════════════ */
.ai-chat-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 200px);
  min-height: 520px;
  overflow: hidden;
}

/* Patient Context Bar */
.ai-context-banner {
  background: rgba(255, 153, 63, 0.08);
  border-bottom: 1px solid var(--accent-border);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
}
.ai-context-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--brand-peach);
  font-weight: 600;
}
.ai-context-tags {
  display: flex;
  gap: 0.5rem;
}
.ai-context-tag {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  font-size: 0.75rem;
  color: var(--text-main);
  font-weight: 600;
}

/* Chat Messages */
.ai-chat-messages {
  flex: 1;
  padding: 1.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.chat-msg {
  display: flex;
  gap: 0.85rem;
  max-width: 82%;
  animation: fadeIn 0.25s ease;
}
.chat-msg.bot {
  align-self: flex-start;
}
.chat-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 800;
  font-size: 0.85rem;
}
.chat-msg.bot .chat-avatar {
  background: var(--brand-gradient);
  color: #000000;
}
.chat-msg.user .chat-avatar {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}
.chat-bubble {
  padding: 1.1rem 1.35rem;
  border-radius: 18px;
  font-size: 0.94rem;
  line-height: 1.6;
}
.chat-msg.bot .chat-bubble {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-color);
  border-top-left-radius: 4px;
  color: var(--text-main);
}
.chat-msg.user .chat-bubble {
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-top-right-radius: 4px;
  color: #ffffff;
}
.chat-bubble strong {
  color: var(--brand-orange);
}
.chat-bubble ul {
  padding-left: 1.25rem;
  margin: 0.5rem 0;
}
.chat-bubble li {
  margin-bottom: 0.35rem;
}

/* Typing Indicator */
.typing-indicator {
  display: none;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-card-elevated);
  border-radius: 18px;
  border-top-left-radius: 4px;
  border: 1px solid var(--border-color);
  width: fit-content;
}
.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-orange);
  animation: typingBounce 1.4s infinite ease-in-out both;
}
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Quick Prompt Suggestions */
.ai-quick-prompts {
  display: flex;
  gap: 0.6rem;
  padding: 0.75rem 1.5rem;
  overflow-x: auto;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.15);
}
.prompt-chip {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--brand-peach);
  padding: 0.5rem 0.9rem;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}
.prompt-chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: #ffffff;
}

/* Chat Input Bar */
.ai-chat-input-bar {
  display: flex;
  gap: 0.85rem;
  padding: 1rem 1.5rem;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-color);
}
.ai-chat-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 99px;
  padding: 0.85rem 1.35rem;
  color: var(--text-main);
  font-size: 0.94rem;
  outline: none;
  transition: border-color 0.2s;
}
.ai-chat-input:focus {
  border-color: var(--brand-orange);
}
.ai-chat-send-btn {
  background: var(--brand-gradient);
  border: none;
  border-radius: 99px;
  padding: 0 1.6rem;
  color: #000000;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: transform 0.2s, box-shadow 0.2s;
}
.ai-chat-send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(255, 153, 63, 0.35);
}

/* ═════════════════════════════════════════════════════════════
   HISTORIAL MÉDICO & ANÁLISIS INTEGRADO
   ═════════════════════════════════════════════════════════════ */
.evolution-banner {
  background: var(--bg-card);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  margin-bottom: 2rem;
}
.evolution-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}
.evolution-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}
.evolution-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1.1rem;
}
.evolution-metric-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}
.evolution-delta-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.evolution-val-now {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
}
.evolution-val-prev {
  font-size: 0.85rem;
  color: var(--text-dim);
  text-decoration: line-through;
}
.evolution-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-optimal);
}

/* Upload Clinical Study Dropzone */
.upload-dropzone {
  border: 2px dashed var(--accent-border);
  background: rgba(255, 153, 63, 0.04);
  border-radius: var(--radius-md);
  padding: 2.25rem;
  text-align: center;
  margin-bottom: 2rem;
  cursor: pointer;
  transition: all 0.25s ease;
}
.upload-dropzone:hover {
  background: rgba(255, 153, 63, 0.08);
  border-color: var(--brand-orange);
}
.upload-icon {
  width: 48px;
  height: 48px;
  color: var(--brand-orange);
  margin-bottom: 0.85rem;
}
.upload-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}
.upload-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Medical History Timeline Items */
.history-timeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.35rem 1.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  transition: all 0.2s;
}
.history-item:hover {
  border-color: var(--border-color-hover);
  background: var(--bg-card-hover);
}
.history-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.history-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.history-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}
.history-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.history-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.history-date {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-weight: 500;
}
.btn-doc-pdf {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--brand-orange);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-doc-pdf:hover {
  background: var(--brand-orange);
  color: #000000;
}

/* ═════════════════════════════════════════════════════════════
   MÉTRICAS CLAVE VIEW (Visual Dynamic Charts)
   ═════════════════════════════════════════════════════════════ */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.75rem;
}
.chart-canvas-wrapper {
  position: relative;
  width: 100%;
  height: 260px;
  margin-top: 1rem;
}

/* Systems Radar / Breakdown Bars */
.system-score-row {
  margin-bottom: 1.25rem;
}
.system-score-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
}
.system-score-track {
  height: 9px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
}
.system-score-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.6s ease;
}

/* Wearables Metric Cards */
.wearable-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}
.wearable-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
}
.wearable-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.wearable-num {
  font-family: 'Outfit', sans-serif;
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
}
.wearable-note {
  font-size: 0.78rem;
  color: var(--color-optimal);
  font-weight: 600;
  margin-top: 0.35rem;
}

/* ═════════════════════════════════════════════════════════════
   SUSCRIPCIÓN & MEMBRESÍA
   ═════════════════════════════════════════════════════════════ */
.plan-hero-card {
  background: linear-gradient(135deg, rgba(255, 153, 63, 0.15), rgba(19, 19, 19, 0.98));
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  padding: 2.25rem;
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.75rem;
}
.plan-badge {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  background: var(--brand-gradient);
  color: #000000;
  font-weight: 800;
  font-size: 0.78rem;
  border-radius: 99px;
  text-transform: uppercase;
  margin-bottom: 0.65rem;
}
.plan-title {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}
.plan-price-large {
  font-family: 'Outfit', sans-serif;
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--brand-orange);
}
.plan-price-large span {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Benefits list */
.plan-benefits-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  margin-top: 1.25rem;
}
.plan-benefit-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}
.plan-benefit-item i, .plan-benefit-item svg {
  color: var(--color-optimal);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Plan Comparison Cards */
.tiers-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}
.tier-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all 0.25s ease;
}
.tier-card.featured {
  border-color: var(--brand-orange);
  background: rgba(255, 153, 63, 0.05);
  box-shadow: 0 12px 30px rgba(255, 153, 63, 0.15);
}
.tier-popular-tag {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--brand-gradient);
  color: #000000;
  padding: 0.25rem 0.85rem;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}
.tier-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.tier-price {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: var(--brand-orange);
  margin: 0.75rem 0 1.25rem;
}
.tier-btn {
  margin-top: auto;
  width: 100%;
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

/* ═════════════════════════════════════════════════════════════
   CONFIGURACIONES & PERFIL
   ═════════════════════════════════════════════════════════════ */
.settings-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}
.form-group {
  margin-bottom: 1.25rem;
}
.form-label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}
.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text-main);
  font-size: 0.94rem;
  outline: none;
  transition: border-color 0.2s;
}
.form-control:focus {
  border-color: var(--brand-orange);
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border-color);
}
.settings-row-text h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.settings-row-text p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.12);
  transition: .3s;
  border-radius: 34px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: var(--brand-orange);
}
input:checked + .slider:before {
  transform: translateX(22px);
}

/* Device Sync Card */
.device-sync-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 0.85rem;
}
.device-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.device-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-card-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-orange);
}

/* ═════════════════════════════════════════════════════════════
   MODALS & TOASTS
   ═════════════════════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.modal-overlay.active {
  display: flex;
}
.modal-card {
  background: var(--bg-card-elevated);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
  max-width: 620px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2.25rem;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  animation: zoomIn 0.25s ease;
}
@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
.modal-close-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}
.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-main);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.toast {
  background: var(--bg-card-elevated);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-main);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═════════════════════════════════════════════════════════════
   RESPONSIVE DESIGN (Tablets & Mobile)
   ═════════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .grid-cols-4, .wearable-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-3, .tiers-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-layout { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .menu-toggle-btn {
    display: inline-flex;
  }
  .main-content {
    padding: 1.5rem 1.25rem 3rem;
  }
  .topbar {
    padding: 0 1.25rem;
  }
  .grid-cols-4, .grid-cols-3, .grid-cols-2, .tiers-grid, .wearable-grid {
    grid-template-columns: 1fr;
  }
  .hero-card-top {
    flex-direction: column;
    align-items: stretch;
  }
  .hero-age-badge {
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .biomarkers-grid {
    grid-template-columns: 1fr;
  }
  .plan-hero-card {
    flex-direction: column;
    align-items: flex-start;
  }
  .plan-benefits-grid {
    grid-template-columns: 1fr;
  }
}


/* ═════════════════════════════════════════════════════════════
   ENHANCED FUNCTIONALITIES (Habits, Timeline, Telemed, Doctor UI)
   ═════════════════════════════════════════════════════════════ */

/* ─── Water Hydration Tracker (Notebook Sketch 3 & 5) ─── */
.water-tracker-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.water-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}
.water-amount-large {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  color: var(--brand-peach);
}
.water-amount-large span {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 500;
}
.water-cups-grid {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.water-cup-btn {
  width: 44px;
  height: 52px;
  border-radius: 8px 8px 14px 14px;
  border: 2px solid rgba(254, 186, 102, 0.3);
  background: rgba(254, 186, 102, 0.08);
  color: var(--brand-peach);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.72rem;
  font-weight: 700;
}
.water-cup-btn.filled {
  background: linear-gradient(180deg, var(--brand-orange) 0%, #e07f2b 100%);
  border-color: var(--brand-orange);
  color: #000000;
  box-shadow: 0 4px 12px rgba(255, 153, 63, 0.35);
}
.water-actions {
  display: flex;
  gap: 0.75rem;
}

/* ─── Emotion / Mood Picker (Notebook Sketch 3 & 5) ─── */
.mood-picker-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.mood-options-row {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding: 0.5rem 0;
}
.mood-btn {
  flex: 1;
  min-width: 90px;
  padding: 0.85rem 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-muted);
}
.mood-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-color-hover);
  color: var(--text-main);
}
.mood-btn.active {
  background: var(--accent-soft);
  border-color: var(--brand-orange);
  color: var(--brand-orange);
  font-weight: 700;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(255, 153, 63, 0.2);
}
.mood-emoji {
  font-size: 1.75rem;
}
.mood-label {
  font-size: 0.75rem;
}

/* ─── Mi Línea de Vida (Timeline Interactivo - Notebook Sketch 5) ─── */
.life-timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-left: 2rem;
  margin: 1.5rem 0;
}
.life-timeline::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 9px;
  width: 2px;
  background: linear-gradient(180deg, var(--brand-orange) 0%, rgba(255, 153, 63, 0.2) 100%);
}
.life-event-item {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  transition: all 0.2s ease;
}
.life-event-item:hover {
  border-color: var(--accent-border);
  background: var(--bg-card-hover);
}
.life-event-item::after {
  content: '';
  position: absolute;
  top: 1.5rem;
  left: -2.35rem;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--brand-orange);
  border: 3px solid var(--bg-dark);
  box-shadow: 0 0 8px rgba(255, 153, 63, 0.5);
}
.life-event-item.goal::after {
  background: #FFD700;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}
.event-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}
.event-badge-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  text-transform: uppercase;
}
.event-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}
.event-detail {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ─── Telemedicina Video Consultation Suite ─── */
.telemed-suite-container {
  display: grid;
  grid-template-columns: 2.2fr 1fr;
  gap: 1.5rem;
  height: calc(100vh - 190px);
  min-height: 560px;
}
.video-main-box {
  background: #000000;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.video-feed-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(255, 153, 63, 0.08), #050505);
  position: relative;
}
.doctor-call-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--brand-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 800;
  color: #000;
  margin-bottom: 1rem;
  box-shadow: 0 0 25px rgba(255, 153, 63, 0.4);
  animation: pulseAvatar 2s infinite ease-in-out;
}
@keyframes pulseAvatar {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.self-pip-video {
  position: absolute;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 140px;
  height: 100px;
  background: #121212;
  border: 2px solid var(--brand-orange);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}
.video-controls-bar {
  height: 72px;
  background: rgba(14, 14, 14, 0.98);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}
.call-btn-control {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}
.call-btn-control:hover {
  background: rgba(255, 255, 255, 0.2);
}
.call-btn-control.active-off {
  background: var(--color-danger);
}
.call-btn-end {
  background: #FF3B30 !important;
  color: #ffffff !important;
  width: 52px;
  height: 52px;
}
.call-btn-end:hover {
  background: #E02B20 !important;
  transform: scale(1.05);
}

.telemed-side-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Doctor Portal Specific Styling ─── */
.patient-row-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  transition: all 0.2s;
  cursor: pointer;
}
.patient-row-card:hover {
  border-color: var(--accent-border);
  background: var(--bg-card-hover);
}
.patient-avatar-mini {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
}
.doctor-quick-actions {
  display: flex;
  gap: 0.5rem;
}

/* AI Copilot in Doctor Dashboard */
.ai-copilot-card {
  background: linear-gradient(135deg, rgba(255, 153, 63, 0.08), #131313);
  border: 1px solid rgba(255, 153, 63, 0.25);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}
.copilot-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  background: rgba(255, 153, 63, 0.15);
  color: var(--brand-orange);
  border: 1px solid rgba(255, 153, 63, 0.35);
  padding: 0.25rem 0.65rem;
  border-radius: 99px;
  margin-bottom: 0.65rem;
}

/* ─── Doctor Portal Enhanced Styles ─── */
.doctor-tabs-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
}
.doctor-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.doctor-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}
.doctor-tab-btn.active {
  color: #000;
  background: var(--brand-orange);
  font-weight: 700;
}
.clinical-note-textarea {
  width: 100%;
  min-height: 180px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 1rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}
.clinical-note-textarea:focus {
  border-color: var(--brand-orange);
}
.protocol-card-select {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.protocol-card-select:hover {
  border-color: var(--accent-border);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}
.protocol-card-select.selected {
  border-color: var(--brand-orange);
  box-shadow: 0 0 15px rgba(255, 153, 63, 0.2);
}
.protocol-badge-phase {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(255, 153, 63, 0.15);
  color: var(--brand-orange);
  text-transform: uppercase;
}

/* ═════════════════════════════════════════════════════════════
   PRODUCTION POLISH: STAT CARDS, DATA TABLES & FILTERS
   ═════════════════════════════════════════════════════════════ */
.dashboard-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.brand-badge-role {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(255, 153, 63, 0.18);
  border: 1px solid rgba(255, 153, 63, 0.35);
  color: var(--brand-orange);
  margin-left: 8px;
  vertical-align: middle;
}
.brand-badge-role.admin {
  background: rgba(114, 46, 209, 0.18);
  border-color: rgba(114, 46, 209, 0.45);
  color: #b37feb;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: 0.3px;
  line-height: 1.2;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
.stat-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-border);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.stat-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.stat-value {
  font-family: 'Outfit', sans-serif;
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}
.stat-trend.positive {
  color: #34C759;
}
.stat-trend.negative {
  color: #FF4D4F;
}

/* Production Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}
.data-table thead {
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-color);
}
.data-table th {
  padding: 1.1rem 1.4rem;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.75px;
  color: var(--text-muted);
  white-space: nowrap;
}
.data-table td {
  padding: 1.15rem 1.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  vertical-align: middle;
}
.data-table tbody tr {
  transition: background-color 0.2s ease;
}
.data-table tbody tr:hover {
  background: rgba(255, 153, 63, 0.04);
}
.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Filter and Tab Buttons */
.doc-filter-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.doc-filter-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}
.doc-filter-btn.active {
  background: rgba(255, 153, 63, 0.15);
  border-color: var(--brand-orange);
  color: var(--brand-orange);
}

.nav-group-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 1.25rem 0.5rem 0.4rem;
}
.user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.topbar-title {
  color: var(--text-main);
  font-weight: 700;
  font-size: 1.05rem;
  font-family: 'Outfit', sans-serif;
}
.clinic-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 153, 63, 0.12);
  border: 1px solid rgba(255, 153, 63, 0.3);
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 0.8rem;
  color: var(--brand-orange);
  font-weight: 600;
}

.doc-tab-content {
  display: none;
}
.doc-tab-content.active {
  display: block;
}
.doc-ai-prompt {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.85rem 1.1rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}
.doc-ai-prompt:hover {
  background: rgba(255, 153, 63, 0.12);
  border-color: rgba(255, 153, 63, 0.4);
  color: #fff;
  transform: translateX(4px);
}

.page-header {
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 1rem;
}
.page-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

