/* ==========================================================================
   نبض الأمان (Nabd Al-Aman) — Modern Medical Design System & Styles
   ========================================================================== */

:root {
  /* Color Palette: Clinical Teal & Calming Emerald */
  --primary-900: #083344;
  --primary-800: #0e4c63;
  --primary-700: #0d5c75;
  --primary-600: #0891b2;
  --primary-500: #06b6d4;
  --primary-100: #e0f2fe;
  --primary-50:  #f0f9ff;

  /* Accent & Success (Emerald Green) */
  --emerald-700: #047857;
  --emerald-600: #059669;
  --emerald-500: #10b981;
  --emerald-100: #d1fae5;
  --emerald-50:  #ecfdf5;

  /* Danger & Caution (Red / Coral) */
  --danger-700: #b91c1c;
  --danger-600: #dc2626;
  --danger-500: #ef4444;
  --danger-100: #fee2e2;
  --danger-50:  #fef2f2;

  /* Warning / Amber */
  --amber-600:  #d97706;
  --amber-100:  #fef3c7;
  --amber-50:   #fffbeb;

  /* Neutrals & Surfaces */
  --ink-900:    #0f172a;
  --ink-800:    #1e293b;
  --ink-700:    #334155;
  --ink-600:    #475569;
  --ink-500:    #64748b;
  --ink-400:    #94a3b8;
  --ink-200:    #e2e8f0;
  --ink-100:    #f1f5f9;
  --ink-50:     #f8fafc;
  --white:      #ffffff;

  /* Shadows & Elevation */
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-card: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);

  /* Typography */
  --font-arabic: 'IBM Plex Sans Arabic', 'Readex Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: var(--font-arabic);
  direction: rtl;
  text-align: right;
  background-color: var(--ink-50);
  color: var(--ink-800);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

a {
  color: var(--primary-700);
  text-decoration: none;
}

.hidden {
  display: none !important;
}

/* ================= Layout Structure ================= */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.nav-container, .content-container, .footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* ================= Top Navigation Header ================= */
.top-nav {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ink-200);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.nav-container {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 19px;
  font-weight: 800;
  color: var(--primary-900);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 11px;
  font-weight: 600;
  color: var(--emerald-600);
}

/* Nav Tabs */
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--ink-100);
  padding: 4px;
  border-radius: var(--radius-full);
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--ink-600);
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-fast);
}

.nav-btn:hover {
  color: var(--primary-800);
  background: rgba(255, 255, 255, 0.6);
}

.nav-btn.active {
  background: var(--white);
  color: var(--primary-800);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

/* Nav Actions — Sleek Professional Action Toolbar */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.top-nav-action-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1.5px solid transparent;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  white-space: nowrap;
}

.btn-pill-install {
  background: #f0fdfa;
  color: #0f766e;
  border-color: #99f6e4;
}
.btn-pill-install:hover {
  background: #0d9488;
  color: #ffffff;
  border-color: #0d9488;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.25);
}

.btn-pill-emergency {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fca5a5;
  animation: emergency-heartbeat 2.5s infinite;
}
.btn-pill-emergency:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
}

.btn-pill-print {
  background: #f8fafc;
  color: #334155;
  border-color: #cbd5e1;
}
.btn-pill-print:hover {
  background: #083344;
  color: #ffffff;
  border-color: #083344;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(8, 51, 68, 0.2);
}

.btn-pill-edit {
  background: #f0f9ff;
  color: #0284c7;
  border-color: #bae6fd;
}
.btn-pill-edit:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.2);
}

.btn-pill-logout {
  background: #fff1f2;
  color: #ef4444;
  border-color: #fecdd3;
}
.btn-pill-logout:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2);
}

/* Universal Install Guide Modal Styles */
.install-guide-modal-card {
  max-width: 580px;
  width: 92%;
  background: #ffffff;
  border-radius: var(--radius-xl);
  padding: 24px;
}

.install-platform-tabs {
  display: flex;
  gap: 6px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: var(--radius-lg);
  margin: 16px 0;
}

.platform-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: #64748b;
  font-weight: 700;
  font-size: 13px;
  font-family: inherit;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
}

.platform-tab.active {
  background: #ffffff;
  color: var(--primary-800);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.install-steps-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.install-step-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}

.install-step-item .step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-600);
  color: #ffffff;
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.install-step-item .step-desc strong {
  display: block;
  font-size: 14px;
  color: #0f172a;
  margin-bottom: 3px;
}

.install-step-item .step-desc p {
  margin: 0;
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
}

.mode-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--emerald-50);
  border: 1px solid var(--emerald-100);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  color: var(--emerald-700);
  cursor: pointer;
  transition: var(--transition-fast);
}

.mode-selector:hover {
  background: var(--emerald-100);
}

.live-dot {
  width: 8px;
  height: 8px;
  background-color: var(--emerald-500);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.icon-action-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--ink-200);
  background: var(--white);
  color: var(--ink-600);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.icon-action-btn:hover {
  background: var(--ink-100);
  color: var(--primary-700);
}

.action-btn-outline {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--white);
  border: 1px solid var(--primary-600);
  color: var(--primary-700);
  font-weight: 700;
  font-size: 13px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}

.action-btn-outline:hover {
  background: var(--primary-50);
}

/* ================= Main Content Area ================= */
.main-content {
  flex: 1;
  padding: 28px 0 60px;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.tab-pane.active {
  display: block;
}

/* ================= Patient Hero Card ================= */
.patient-hero-card {
  background: linear-gradient(135deg, #083344 0%, #0d5c75 100%);
  border-radius: var(--radius-xl);
  color: var(--white);
  padding: 28px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
}

.patient-hero-card::after {
  content: '';
  position: absolute;
  top: -50px;
  left: -50px;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.18) 0%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}

.hero-main-info {
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
  z-index: 2;
}

.avatar-ring {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
  transition: var(--transition-fast);
}

.avatar-ring:hover {
  transform: scale(1.04);
  border-color: rgba(255, 255, 255, 0.8);
}

.avatar-inner {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--white);
  color: var(--primary-900);
  font-size: 26px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.avatar-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.btn-avatar-upload {
  position: absolute;
  bottom: -2px;
  left: -2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary-900);
  color: var(--white);
  border: 2px solid var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: transform 0.2s ease;
}

.btn-avatar-upload:hover {
  transform: scale(1.15);
  background: var(--emerald-600);
}

.hero-titles {
  flex: 1;
}

.name-badge-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.patient-full-name {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.status-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.active-pill {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.patient-meta-chips {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.meta-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
}

.blood-chip {
  background: rgba(239, 68, 68, 0.25);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font-weight: 700;
}

/* Hero Stats Grid */
.hero-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 24px;
  position: relative;
  z-index: 2;
}

.stat-card {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.stat-card:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.med-icon { background: rgba(6, 182, 212, 0.2); color: #67e8f9; }
.allergy-icon { background: rgba(239, 68, 68, 0.25); color: #fca5a5; }
.condition-icon { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.doc-icon { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }

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

.stat-num {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
}

.stat-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

/* ================= Cards & Containers ================= */
.card {
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.section-card {
  margin-bottom: 20px;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}

.card-title-group h2, .card-title-group h3 {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink-900);
}

.badge-subtle {
  font-size: 12px;
  color: var(--ink-500);
  font-weight: 500;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary-700);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-link:hover {
  color: var(--primary-900);
  text-decoration: underline;
}

/* ================= Overview 2-Column Grid ================= */
.overview-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

/* Urgent Caution Banner */
.urgent-banner {
  background: var(--danger-50);
  border: 1px solid var(--danger-100);
  border-right: 5px solid var(--danger-600);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.urgent-icon {
  color: var(--danger-600);
  flex-shrink: 0;
  margin-top: 2px;
}

.urgent-text strong {
  display: block;
  color: var(--danger-700);
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 2px;
}

.urgent-text p {
  color: #7f1d1d;
  font-size: 14px;
  line-height: 1.5;
}

/* Dose Timeline */
.dose-timeline {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dose-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-right: 5.5px solid #0d9488;
  border-radius: var(--radius-xl);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.dose-item:hover {
  background: #ffffff;
  border-color: #0d9488;
  box-shadow: 0 8px 20px -4px rgba(13, 148, 136, 0.18);
  transform: translateY(-2px);
}

.dose-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.time-badge {
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 800;
  font-size: 15px;
  padding: 8px 14px;
  border: 1.5px solid #bae6fd;
  border-radius: var(--radius-md);
  direction: ltr;
}

.dose-details h4 {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink-900);
}

.dose-details p {
  font-size: 14px;
  font-weight: 600;
  color: #475569;
  margin-top: 3px;
}

.dose-action-btn {
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 800;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--emerald-600);
  background: var(--emerald-50);
  color: var(--emerald-700);
  cursor: pointer;
  transition: var(--transition-fast);
}

.dose-action-btn.taken {
  background: var(--emerald-600);
  color: var(--white);
}
  background: var(--emerald-600);
  color: var(--white);
}

/* Conditions Tags Cloud */
.tags-cloud-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cond-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
}

.cond-chip-danger {
  background: var(--danger-50);
  border: 1px solid var(--danger-100);
  color: var(--danger-700);
}

.cond-chip-teal {
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
  color: var(--primary-800);
}

/* ================= Side Widgets ================= */
.emergency-widget-card {
  background: linear-gradient(180deg, #ffffff 0%, var(--ink-50) 100%);
  border: 2px solid var(--primary-600);
  margin-bottom: 20px;
}

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

.em-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.em-title h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary-900);
}

.em-beacon {
  width: 10px;
  height: 10px;
  background-color: var(--danger-600);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
}

.em-badge {
  font-size: 11px;
  font-weight: 700;
  background: var(--emerald-100);
  color: var(--emerald-800);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.em-desc {
  font-size: 13px;
  color: var(--ink-600);
  line-height: 1.4;
  margin-bottom: 16px;
}

.qr-box-center {
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.qr-canvas-wrapper {
  width: 170px;
  height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.storage-card {
  margin-bottom: 20px;
}

.storage-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.storage-head h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-800);
}

.storage-val {
  font-size: 13px;
  font-weight: 800;
  color: var(--primary-700);
}

.progress-bar-track {
  height: 8px;
  background: var(--ink-200);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--emerald-500), var(--primary-600));
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.storage-note {
  font-size: 12px;
  color: var(--ink-500);
}

.share-mini-card {
  background: var(--primary-50);
  border: 1px dashed var(--primary-600);
}

.share-mini-content {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.share-icon-wrap {
  color: var(--primary-700);
  flex-shrink: 0;
}

.share-mini-content h4 {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary-900);
}

.share-mini-content p {
  font-size: 12px;
  color: var(--ink-600);
  margin-top: 2px;
}

/* ================= Section Header Bar ================= */
.section-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.section-header-bar h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink-900);
  line-height: 1.2;
}

.section-subtitle {
  font-size: 14px;
  color: var(--ink-500);
  margin-top: 4px;
}

/* ================= Medications Grid ================= */
.medications-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 24px;
}

.med-card {
  background: var(--white);
  border: 1.5px solid #cbd5e1;
  border-top: 6px solid #0d9488;
  border-radius: var(--radius-xl);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(13, 148, 136, 0.1);
  transition: all 0.25s ease;
  position: relative;
}

.med-card:hover {
  border-color: #0d9488;
  transform: translateY(-3px);
  box-shadow: 0 12px 24px -4px rgba(15, 23, 42, 0.12), 0 4px 12px -2px rgba(13, 148, 136, 0.2);
}

.med-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.med-title-area h3 {
  font-size: 20px;
  font-weight: 800;
  color: #042f2e;
  line-height: 1.3;
}

.med-generic {
  display: block;
  font-size: 14px;
  color: #0f766e;
  font-weight: 600;
  margin-top: 3px;
}

.med-strength-badge {
  background: #ccfbf1;
  color: #115e59;
  font-weight: 800;
  font-size: 13.5px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid #99f6e4;
  white-space: nowrap;
}

.med-instructions-box {
  background: #f0fdfa;
  border: 1px solid #ccfbf1;
  border-right: 4.5px solid #0d9488;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 16px;
  line-height: 1.6;
}

.med-times-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.med-time-tag {
  background: #e0f2fe;
  border: 1.5px solid #7dd3fc;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 14.5px;
  font-weight: 800;
  color: #0369a1;
  direction: ltr;
}

.med-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--ink-100);
  font-size: 13px;
}

.visibility-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-size: 12.5px;
}

.vis-emergency { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.vis-hidden { background: var(--ink-100); color: var(--ink-600); }

/* ================= Conditions & Allergies 2-Columns ================= */
.two-columns-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.column-card {
  padding: 0;
  overflow: hidden;
}

.column-card-header {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--ink-200);
}

.bg-danger-light { background: var(--danger-50); }
.bg-teal-light { background: var(--primary-50); }

.header-icon-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-icon-title h3 {
  font-size: 16px;
  font-weight: 800;
}

.count-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.danger-badge { background: var(--danger-600); color: var(--white); }
.teal-badge { background: var(--primary-700); color: var(--white); }

.items-list-body {
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-item-card {
  padding: 14px;
  background: var(--ink-50);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.item-left h4 {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink-900);
}

.item-left p {
  font-size: 13px;
  color: var(--ink-600);
  margin-top: 3px;
}

.tag-severe {
  background: var(--danger-100);
  color: var(--danger-700);
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* ================= Documents Grid ================= */
.doc-storage-overview {
  margin-bottom: 24px;
  background: linear-gradient(135deg, var(--white) 0%, var(--primary-50) 100%);
}

.storage-stats-line {
  display: flex;
  gap: 36px;
  flex-wrap: wrap;
}

.stat-item .label {
  display: block;
  font-size: 12px;
  color: var(--ink-500);
}

.stat-item .val {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary-900);
}

.documents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.doc-card {
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-xl);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  transition: var(--transition-fast);
}

.doc-card:hover {
  border-color: var(--primary-600);
  box-shadow: var(--shadow-md);
}

.doc-head {
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
}

.doc-file-icon {
  width: 44px;
  height: 44px;
  background: var(--primary-100);
  color: var(--primary-700);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.doc-meta h4 {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink-900);
  line-height: 1.3;
}

.doc-meta span {
  font-size: 12px;
  color: var(--ink-500);
}

.doc-details-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-600);
  padding: 8px 12px;
  background: var(--ink-50);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}

/* ================= Emergency Tab 2-Cols ================= */
.emergency-two-cols {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 24px;
  align-items: start;
}

.emergency-preview-frame {
  background: #faf7f0; /* Paper tint */
  border: 2px solid var(--ink-200);
  padding: 28px;
}

.preview-badge {
  background: var(--primary-900);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  display: inline-block;
  margin-bottom: 16px;
}

.em-view-header {
  background: var(--primary-900);
  color: var(--white);
  padding: 20px;
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
}

.em-brand-pill {
  color: #f4bd7a;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.em-view-header h2 {
  font-size: 20px;
  margin-top: 4px;
}

.em-patient-identity-box {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1px;
  background: var(--ink-200);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 18px;
}

.em-id-item {
  background: var(--white);
  padding: 12px;
}

.em-id-item span {
  font-size: 11px;
  color: var(--ink-500);
  display: block;
}

.em-id-item strong {
  font-size: 15px;
  color: var(--ink-900);
  display: block;
  margin-top: 2px;
}

.blood-text { color: var(--danger-600) !important; font-size: 18px !important; }

.em-alert-note-box {
  background: var(--danger-50);
  border-right: 4px solid var(--danger-600);
  padding: 14px;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
}

.em-alert-note-box span {
  font-size: 12px;
  font-weight: 800;
  color: var(--danger-700);
  display: block;
}

.em-alert-note-box p {
  color: #522119;
  font-size: 14px;
  margin-top: 2px;
}

.em-sections-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.em-sub-sec h4 {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-800);
  margin-bottom: 6px;
}

.em-sub-sec ul {
  list-style: none;
}

.em-sub-sec li {
  padding: 6px 0;
  border-bottom: 1px solid var(--ink-200);
  font-size: 13px;
}

/* Emergency Toggles */
.toggle-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 10px 14px;
  background: var(--ink-50);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-lg);
  transition: var(--transition-fast);
  user-select: none;
}

.toggle-row:hover {
  background: var(--white);
  border-color: var(--primary-600);
  box-shadow: var(--shadow-sm);
}

.toggle-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-800);
  pointer-events: none;
}

.toggle-row input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.switch {
  width: 48px;
  height: 26px;
  background: #cbd5e1;
  border-radius: var(--radius-full);
  position: relative;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  display: inline-block;
}

.switch::before {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  background: var(--white);
  border-radius: 50%;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.toggle-row input:checked + .switch {
  background: var(--primary-700);
}

.toggle-row input:checked + .switch::before {
  transform: translateX(-22px);
}

.token-status-box {
  background: var(--emerald-50);
  border: 1px solid var(--emerald-100);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 12px;
}

.token-status-active {
  color: var(--emerald-700);
  font-weight: 700;
  font-size: 13px;
  display: block;
}

.token-date {
  font-size: 11px;
  color: var(--ink-500);
}

/* ================= Clinician Share Cards ================= */
.shares-list-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.share-card {
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: var(--shadow-card);
}

.share-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.share-card-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink-900);
}

.share-url-box {
  background: var(--ink-50);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-family: monospace;
  font-size: 12px;
  color: var(--primary-800);
  margin: 12px 0;
  word-break: break-all;
  direction: ltr;
  text-align: left;
}

/* ================= Buttons & Form Controls ================= */
.btn-primary {
  background: var(--primary-700);
  color: var(--white);
  border: none;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-fast);
}

.btn-primary:hover {
  background: var(--primary-800);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--ink-100);
  color: var(--ink-800);
  border: 1px solid var(--ink-200);
  font-weight: 700;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.btn-secondary:hover {
  background: var(--ink-200);
}

.btn-outline-primary {
  background: var(--white);
  color: var(--primary-700);
  border: 1px solid var(--primary-600);
  font-weight: 700;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}

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

.btn-danger {
  background: var(--danger-600);
  color: var(--white);
  border: none;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.btn-danger:hover {
  background: var(--danger-700);
}

.btn-danger-outline {
  background: var(--white);
  color: var(--danger-600);
  border: 1px solid var(--danger-600);
  font-weight: 700;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.btn-danger-outline:hover {
  background: var(--danger-50);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-600);
  border: none;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
}

.btn-group-row {
  display: flex;
  gap: 10px;
}

.w-100 { width: 100%; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.text-danger { color: var(--danger-600); }
.text-teal { color: var(--primary-700); }
.font-bold { font-weight: 700; }

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-800);
}

.form-group input, .form-group select, .form-group textarea {
  padding: 10px 14px;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-md);
  background: var(--white);
  transition: var(--transition-fast);
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary-600);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.15);
}

.form-helper {
  font-size: 12px;
  color: var(--ink-500);
  margin-top: 2px;
}

/* ================= Modals ================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease-out;
  cursor: pointer;
}

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

.modal-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: var(--shadow-xl);
  animation: scaleUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: default;
}

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

.modal-header h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink-900);
}

.btn-close-modal {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--ink-100);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--ink-600);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

/* Upload Dropzone */
.upload-dropzone {
  border: 2px dashed var(--primary-500);
  background: var(--primary-50);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: var(--transition-fast);
}

.upload-dropzone:hover {
  background: var(--primary-100);
}

.file-input-hidden {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-name-tag {
  background: var(--emerald-100);
  color: var(--emerald-800);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 13px;
  margin-top: 10px;
  display: inline-block;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.chk-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

/* Day Pills for Custom Days */
.days-pills-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.day-pill-label {
  cursor: pointer;
  user-select: none;
}

.day-pill-label input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.day-pill-label span {
  display: inline-block;
  padding: 8px 14px;
  background: var(--ink-100);
  border: 1.5px solid var(--ink-200);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-700);
  transition: var(--transition-fast);
}

.day-pill-label input:checked + span {
  background: var(--primary-700);
  color: var(--white);
  border-color: var(--primary-900);
  box-shadow: 0 2px 8px rgba(13, 92, 117, 0.3);
}

/* Alert Options Box in Form */
.alert-options-box {
  background: var(--ink-50);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
}

.alert-option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}

.alert-label-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-800);
}

.btn-test-sound {
  padding: 4px 10px;
  background: var(--primary-100);
  color: var(--primary-800);
  border: 1px solid var(--primary-200);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-test-sound:hover {
  background: var(--primary-200);
}

/* ================= Live Dose Alarm Modal ================= */
.dose-alarm-modal-card {
  max-width: 440px;
  text-align: center;
  padding: 28px 24px;
  border-radius: var(--radius-xl);
  border: 2px solid var(--danger-500);
  position: relative;
  overflow: hidden;
}

.alarm-header-pulse {
  position: relative;
  width: 76px;
  height: 76px;
  margin: 0 auto 16px;
}

.pulse-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: rgba(220, 38, 38, 0.3);
  animation: alarmPulse 1.4s infinite;
}

.alarm-icon-box {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.4);
}

.alarm-time-tag {
  display: inline-block;
  background: var(--danger-50);
  border: 1px solid var(--danger-100);
  color: var(--danger-700);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 8px;
}

.alarm-content-body h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink-900);
  line-height: 1.3;
}

.alarm-instructions {
  font-size: 14px;
  color: var(--ink-600);
  margin-top: 6px;
  line-height: 1.4;
}

.alarm-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}

.btn-alarm-take {
  width: 100%;
  padding: 13px 20px;
  background: var(--emerald-600);
  color: var(--white);
  border: none;
  border-radius: var(--radius-lg);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
  transition: var(--transition-fast);
}

.btn-alarm-take:hover {
  background: var(--emerald-700);
  transform: translateY(-2px);
}

.btn-alarm-snooze {
  flex: 1;
  padding: 10px 14px;
  background: var(--ink-100);
  color: var(--ink-800);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-alarm-snooze:hover {
  background: var(--ink-200);
}

@keyframes alarmPulse {
  0% { transform: scale(0.95); opacity: 0.9; }
  50% { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(0.95); opacity: 0; }
}

/* ================= Toast Notification ================= */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--primary-900);
  color: var(--white);
  padding: 12px 20px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.25s ease-out;
}

/* ================= Footer ================= */
.app-footer {
  background: var(--white);
  border-top: 1px solid var(--ink-200);
  padding: 20px 0;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--ink-500);
  flex-wrap: wrap;
  gap: 12px;
}

.footer-privacy-tag {
  color: var(--emerald-700);
  font-weight: 700;
}

/* ================= Animations ================= */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideDown {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

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

@keyframes scaleUp {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ================= PWA Store Badges Banner ================= */
.store-badges-banner {
  margin-top: 32px;
  background: linear-gradient(135deg, #083344 0%, #0d5c75 100%);
  border-radius: var(--radius-xl);
  padding: 26px 28px;
  color: var(--white);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.store-badges-banner::after {
  content: '';
  position: absolute;
  top: -40px;
  left: -40px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(5, 150, 105, 0.25) 0%, rgba(0,0,0,0) 70%);
  pointer-events: none;
}

.store-badges-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  position: relative;
  z-index: 2;
}

.store-badge-text {
  max-width: 540px;
}

.pwa-chip {
  display: inline-block;
  background: rgba(52, 211, 153, 0.2);
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: #a7f3d0;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.store-badge-text h3 {
  font-size: 20px;
  font-weight: 800;
  color: var(--white);
  line-height: 1.3;
}

.store-badge-text p {
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 4px;
}

.store-badges-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Store Badge Buttons - Official Store Standard */
.store-badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 8px 18px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  font-family: inherit;
  min-width: 175px;
}

.store-badge-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.badge-google {
  background: #000000;
  color: #ffffff;
  border-color: #334155;
}

.badge-google:hover {
  border-color: #00d3ff;
  background: #0f172a;
}

.badge-apple {
  background: #000000;
  color: #ffffff;
  border-color: #334155;
}

.badge-apple:hover {
  border-color: #e2e8f0;
  background: #18181b;
}

.store-icon {
  flex-shrink: 0;
}

.badge-text-wrap {
  display: flex;
  flex-direction: column;
  text-align: right;
}

.badge-sub {
  font-size: 9.5px;
  color: #94a3b8;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.3px;
}

.badge-title {
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
  margin-top: 3px;
  line-height: 1.1;
  letter-spacing: -0.2px;
}

/* ================= iOS Installation Modal ================= */
.ios-modal-card {
  max-width: 520px;
}

.ios-steps-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.ios-step-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  background: var(--ink-50);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-lg);
  position: relative;
}

.step-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-800);
  color: var(--white);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-info h4 {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-900);
}

.step-info p {
  font-size: 12.5px;
  color: var(--ink-600);
  margin-top: 2px;
  line-height: 1.4;
}

/* ================= Mobile Bottom Navigation Bar ================= */
.mobile-bottom-nav {
  display: none; /* Hidden on Desktop */
}

/* ================= Responsive Adjustments ================= */
@media (max-width: 900px) {
  .overview-grid, .two-columns-section, .emergency-two-cols {
    grid-template-columns: 1fr;
  }

  .patient-full-name {
    font-size: 22px;
  }
}

@media (max-width: 960px) {
  /* Hide Desktop Nav in Header on Tablets & Mobile */
  .top-nav .nav-links {
    display: none;
  }

  .nav-container {
    padding: 0 12px;
    height: 56px;
    min-height: 56px;
    justify-content: space-between;
    overflow: hidden;
  }

  .brand-logo img {
    width: 32px !important;
    height: 32px !important;
  }

  .brand-title {
    font-size: 16px;
  }

  .brand-subtitle {
    display: none;
  }

  .nav-actions {
    gap: 6px;
  }

  .top-nav-action-pill {
    padding: 5px 9px;
    font-size: 11.5px;
    gap: 4px;
  }

  .content-container {
    padding: 0 12px;
  }

  .main-content {
    padding: 10px 0 85px; /* bottom padding so content doesn't get hidden behind bottom nav */
  }

  /* Show Bottom Navigation Bar */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--ink-200);
    z-index: 1000;
    justify-content: space-between;
    align-items: center;
    padding: 3px 4px max(4px, env(safe-area-inset-bottom));
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.06);
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: transparent;
    border: none;
    color: var(--ink-500);
    padding: 3px 1px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
  }

  .mobile-nav-item span {
    font-size: 10.5px;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 100%;
  }

  .mobile-nav-item svg {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
  }

  .mobile-nav-item.active {
    color: var(--primary-700);
    font-weight: 800;
  }

  .mobile-nav-item.active svg {
    transform: scale(1.12);
  }

  .mobile-nav-item.em-nav-highlight.active {
    color: var(--danger-600);
  }

  /* Mobile Bottom Sheet Modals */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-card {
    width: 100%;
    max-width: 100%;
    border-radius: 24px 24px 0 0;
    max-height: 88vh;
    overflow-y: auto;
    padding: 22px 18px 30px;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.2);
  }

  .modal-header {
    margin-bottom: 16px;
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 5;
    padding-bottom: 8px;
  }

  /* Reflow Grids for Mobile */
  .overview-grid, .two-columns-section, .emergency-two-cols, .medications-grid, .documents-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .patient-hero-card {
    padding: 16px 14px;
    margin-bottom: 14px;
    border-radius: 18px;
  }

  .hero-main-info {
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
  }

  .avatar-ring {
    width: 58px;
    height: 58px;
  }

  .avatar-inner {
    width: 48px;
    height: 48px;
    font-size: 20px;
  }

  .name-badge-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
  }

  .patient-full-name {
    font-size: 19px;
    line-height: 1.2;
  }

  .btn-edit-profile {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
    border: 1.5px solid rgba(255, 255, 255, 0.45) !important;
    padding: 3px 9px !important;
    border-radius: 7px !important;
    font-size: 11.5px !important;
    font-weight: 800 !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: inherit;
    transition: all 0.2s;
  }

  .patient-meta-chips {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    flex-wrap: wrap;
  }

  .meta-chip {
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 6px;
    gap: 4px;
  }

  .hero-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 14px;
  }

  .stat-card {
    padding: 10px 12px;
    gap: 10px;
    border-radius: 12px;
  }

  .stat-icon {
    width: 34px;
    height: 34px;
  }

  .stat-icon svg {
    width: 17px;
    height: 17px;
  }

  .stat-num {
    font-size: 16px;
  }

  .stat-label {
    font-size: 11px;
  }

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

  .store-badges-banner {
    padding: 16px 14px;
  }

  .store-badges-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .store-badge-btn {
    justify-content: center;
  }
}

/* Hide install button on small phones or when already in standalone PWA mode */
@media (max-width: 640px) {
  .hide-on-installed-pwa {
    display: none !important;
  }
}

body.is-standalone-pwa .hide-on-installed-pwa {
  display: none !important;
}

/* ================= Print Stylesheet (CR80 Medical Wallet Card) ================= */
@media print {
  body {
    background: #ffffff !important;
  }
  
  .app-shell, .modal-overlay, .toast-container, .mobile-bottom-nav {
    display: none !important;
  }

  .printable-area {
    display: block !important;
    max-width: 85.6mm;
    margin: 20mm auto;
  }

  .wallet-card-front, .wallet-card-back {
    width: 85.6mm;
    height: 53.98mm;
    border: 1px solid #102c2b;
    border-radius: 4mm;
    padding: 4mm;
    page-break-inside: avoid;
    box-sizing: border-box;
    font-family: var(--font-arabic);
    position: relative;
    overflow: hidden;
  }

  .wallet-card-back {
    margin-top: 10mm;
  }
}

.printable-area {
  display: none;
}

/* ================= High-Visibility Emergency & Severe Allergies ================= */
@keyframes emergency-glow-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.55), 0 4px 12px rgba(220, 38, 38, 0.2);
    border-color: #dc2626;
  }
  50% {
    box-shadow: 0 0 0 10px rgba(220, 38, 38, 0), 0 8px 22px rgba(220, 38, 38, 0.35);
    border-color: #ef4444;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0), 0 4px 12px rgba(220, 38, 38, 0.2);
    border-color: #dc2626;
  }
}

@keyframes emergency-heartbeat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.3); }
  28% { transform: scale(1); }
  42% { transform: scale(1.22); }
  70% { transform: scale(1); }
}

.emergency-pulse-icon {
  display: inline-block;
  animation: emergency-heartbeat 1.6s infinite ease-in-out;
  color: #dc2626;
  font-size: 1.2em;
  vertical-align: middle;
  margin-left: 4px;
}

.list-item-card.item-severe {
  background: linear-gradient(135deg, #fff5f5 0%, #fee2e2 100%) !important;
  border: 2px solid #ef4444 !important;
  border-right: 7px solid #b91c1c !important;
  animation: emergency-glow-pulse 2.2s infinite ease-in-out;
}

.cond-chip-severe {
  background: linear-gradient(135deg, #fff1f2 0%, #fee2e2 100%) !important;
  border: 1.5px solid #ef4444 !important;
  border-right: 5px solid #b91c1c !important;
  color: #991b1b !important;
  font-weight: 800 !important;
  animation: emergency-glow-pulse 2.2s infinite ease-in-out;
}

.tag-severe {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 12.5px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid #fecaca;
}

.tag-severe.pulse-tag {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #f87171;
}

.hero-note-box {
  border-right: 5px solid #dc2626 !important;
  animation: emergency-glow-pulse 3s infinite ease-in-out;
}

/* =======================================================
 * MEDICATION PHOTO UPLOADER & DISPLAY STYLES
 * ======================================================= */
.med-photo-uploader-box {
  background: var(--surface-subtle);
  border: 1.5px dashed var(--brand-300);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  transition: all var(--transition-fast);
}

.med-photo-uploader-box:hover {
  border-color: var(--brand-500);
  background: #f0fdfa;
}

.med-photo-preview-wrap {
  position: relative;
  display: inline-block;
  margin: 6px auto;
}

.med-photo-preview-img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 2px solid var(--brand-500);
  box-shadow: var(--shadow-sm);
}

.btn-remove-photo {
  position: absolute;
  top: -8px;
  left: -8px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  transition: transform 0.15s ease;
}

.btn-remove-photo:hover {
  transform: scale(1.15);
  background: #dc2626;
}

.btn-upload-med-photo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  padding: 8px 16px;
  cursor: pointer;
}

/* Card Photo Thumbnail Badge */
.med-photo-thumb-container {
  margin: 10px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--ink-200);
}

.med-photo-thumb-img {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid var(--brand-500);
  box-shadow: 0 3px 8px rgba(13, 148, 136, 0.2);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.med-photo-thumb-img:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 14px rgba(13, 148, 136, 0.35);
}

.med-photo-thumb-info {
  font-size: 12.5px;
  color: var(--ink-600);
}

.med-photo-thumb-info strong {
  display: block;
  color: var(--brand-700);
  font-size: 13px;
  margin-bottom: 2px;
}

/* =======================================================
 * SENIOR-FRIENDLY MEDICATION WIZARD STYLES
 * ======================================================= */
.med-wizard-modal-card {
  max-width: 640px !important;
  width: 100%;
}

.med-wizard-modal-header {
  border-bottom: 1px solid var(--ink-200);
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.wizard-mode-pill {
  display: inline-block;
  background: #ccfbf1;
  color: #0f766e;
  font-size: 12.5px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid #99f6e4;
}

/* Stepper Progress Header */
.wizard-stepper-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1.5px solid var(--ink-200);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  margin-bottom: 20px;
}

.wizard-step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  opacity: 0.55;
  transition: all var(--transition-fast);
}

.wizard-step-item.active {
  opacity: 1;
}

.wizard-step-item.completed .step-num {
  background: #10b981;
  color: white;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ink-300);
  color: var(--ink-800);
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.wizard-step-item.active .step-num {
  background: var(--brand-600);
  color: white;
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.2);
}

.step-label {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-800);
}

.step-connector {
  flex: 1;
  height: 2px;
  background: var(--ink-200);
  margin: 0 8px;
}

/* Step Intros */
.wizard-step-intro {
  background: #f0fdfa;
  border-right: 4px solid var(--brand-500);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
}

.wizard-step-intro h4 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 800;
  color: #042f2e;
}

.wizard-step-intro p {
  margin: 0;
  font-size: 13.5px;
  color: #334155;
  line-height: 1.5;
}

/* Large Inputs for Seniors */
.label-large {
  font-size: 15.5px !important;
  font-weight: 800 !important;
  color: #0f172a !important;
  margin-bottom: 6px !important;
}

.input-large, .select-large {
  padding: 12px 14px !important;
  font-size: 16px !important;
  border-radius: 12px !important;
  font-weight: 600 !important;
}

.required-star {
  color: #dc2626;
}

/* Quick Time Selection Chips */
.quick-time-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.quick-time-chip {
  background: #f1f5f9;
  border: 1px solid var(--ink-300);
  color: var(--ink-700);
  font-size: 13px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-time-chip:hover {
  background: #ccfbf1;
  border-color: var(--brand-500);
  color: var(--brand-800);
}

/* Wizard Navigation Actions */
.wizard-nav-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--ink-200);
}

.btn-wizard-next {
  padding: 12px 24px !important;
  font-size: 15.5px !important;
  font-weight: 800 !important;
}

.btn-wizard-prev {
  padding: 12px 20px !important;
  font-size: 15px !important;
  font-weight: 700 !important;
}

/* Review Stack Cards (Step 4) */
.wizard-review-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wizard-review-card {
  background: #ffffff;
  border: 1.5px solid var(--ink-200);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.review-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.review-head-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-step-badge {
  background: var(--brand-500);
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.review-head-title h5 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

.btn-review-edit {
  background: #f0fdfa;
  color: var(--brand-700);
  border: 1px solid var(--brand-300);
  border-radius: var(--radius-md);
  padding: 4px 10px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-review-edit:hover {
  background: var(--brand-600);
  color: white;
  border-color: var(--brand-600);
}

.review-data-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.review-item span {
  display: block;
  font-size: 12px;
  color: var(--ink-600);
  margin-bottom: 2px;
}

.review-item strong {
  font-size: 14.5px;
  color: var(--ink-800);
}

.rev-times-badge {
  color: #0f766e !important;
  font-size: 15px !important;
  font-weight: 800 !important;
}

.review-photo-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  margin-top: 10px;
}

.review-photo-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  border: 1.5px solid var(--brand-500);
}

.btn-confirm-save {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35) !important;
  padding: 13px 26px !important;
  font-size: 16px !important;
  font-weight: 900 !important;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-confirm-save:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(16, 185, 129, 0.45) !important;
}

@media (max-width: 640px) {
  .wizard-stepper-bar {
    padding: 8px;
  }
  .step-label {
    display: none;
  }
  .wizard-step-item {
    gap: 0;
  }
}

/* =======================================================
 * DEVELOPER & TEAM ATTRIBUTION BAR
 * ======================================================= */
.developer-attribution-bar {
  background: #f8fafc;
  border-top: 1px solid var(--ink-200, #e2e8f0);
  padding: 14px 20px;
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-700, #334155);
  line-height: 1.6;
  margin-top: 20px;
  border-radius: var(--radius-md, 10px);
}

.developer-attribution-bar .team-name-highlight {
  color: #0d9488 !important;
  font-weight: 800 !important;
  font-size: 14.5px !important;
  background: #ccfbf1;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid #99f6e4;
  display: inline-block;
}

.developer-attribution-bar .wa-contact-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #16a34a !important;
  font-weight: 800 !important;
  text-decoration: none;
  background: #f0fdf4;
  padding: 3px 10px;
  border-radius: 8px;
  border: 1.5px solid #86efac;
  transition: all 0.2s ease;
  vertical-align: middle;
}

.developer-attribution-bar .wa-contact-link:hover {
  background: #16a34a;
  color: #ffffff !important;
  border-color: #16a34a;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.25);
}

.developer-attribution-bar .wa-icon {
  fill: currentColor;
  display: inline-block;
  vertical-align: middle;
}

