/* =========================================================
   HEALTHMATE — GLOBAL DESIGN SYSTEM & STYLESHEET
   Deep Juniper & Ocean Slate — Calm, Modern Health-Tech UI
   Phase 1: Personal Account Foundation & UI Polish
========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@500;600;700&display=swap');

:root {
  /* Brand Palette — Deep Juniper, Ocean Slate & Warm Terracotta */
  --color-primary: #0D6E6E;
  --color-primary-hover: #085454;
  --color-primary-dark: #064040;
  --color-primary-tint: #E6F4F4;
  --color-primary-soft: rgba(13, 110, 110, 0.08);

  --color-secondary: #335C67;
  --color-secondary-tint: #E8EFF1;
  
  --color-accent: #E07A5F;
  --color-accent-tint: #FBECE8;
  --color-accent-soft: rgba(224, 122, 95, 0.08);

  /* Backgrounds & Surfaces — Calming Cream & Warm Alabaster Canvas */
  --color-bg: #FAF8F5;
  --color-bg-subtle: #F3EFE8;
  --color-surface: #FFFFFF;
  --color-surface-hover: #F8F5EE;
  --color-border: #E8E3DA;
  --color-border-subtle: #F0EBE3;

  /* Selective Glassmorphism Tokens */
  --glass-bg: rgba(250, 248, 245, 0.88);
  --glass-bg-card: rgba(255, 255, 255, 0.92);
  --glass-border: rgba(255, 255, 255, 0.75);
  --glass-border-subtle: rgba(232, 227, 218, 0.85);
  --glass-blur: blur(12px);
  --glass-blur-lg: blur(16px);
  --glass-shadow: 0 12px 32px -10px rgba(15, 23, 42, 0.08);

  /* Typography Colors */
  --color-text: #0F172A;
  --color-text-primary: #0F172A;
  --color-text-secondary: #475569;
  --color-text-muted: #64748B;
  --color-text-inverse: #FFFFFF;

  /* Semantic Feedback Tokens */
  --color-success: #10B981;
  --color-success-dark: #059669;
  --color-success-tint: #ECFDF5;
  
  --color-warning: #F59E0B;
  --color-warning-dark: #D97706;
  --color-warning-tint: #FFFBEB;
  
  --color-error: #EF4444;
  --color-error-dark: #DC2626;
  --color-error-tint: #FEF2F2;
  
  --color-info: #0284C7;
  --color-info-dark: #0369A1;
  --color-info-tint: #F0F9FF;

  /* Typography Scales */
  --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-numeric: 'Inter', -apple-system, BlinkMacSystemFont, monospace;

  /* Border Radii */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 9999px;

  /* Spacing Scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;

  /* Refined Soft Shadows */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 6px 20px -4px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 14px 34px -8px rgba(15, 23, 42, 0.1);
  --shadow-hover: 0 10px 24px -6px rgba(13, 110, 110, 0.14);

  /* Transitions */
  --transition-fast: 0.14s ease;
  --transition-smooth: 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  margin: 0;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, .font-heading {
  font-family: var(--font-heading);
  color: var(--color-text);
  margin: 0;
  letter-spacing: -0.015em;
}

a { color: inherit; }

/* Numeric stat helper for high-contrast scannability */
.tabular-nums {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* =========================================================
   APP SHELL — sidebar (desktop) / bottom nav (mobile)
   Personal Healthmate Application
========================================================= */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--color-bg);
}

.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 var(--space-2);
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(13, 110, 110, 0.2);
}

.brand-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.nav-item svg {
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

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

.nav-item:hover svg {
  transform: translateX(2px);
}

.nav-item.active {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  box-shadow: 0 4px 14px rgba(13, 110, 110, 0.25);
  font-weight: 600;
}

.nav-item.active svg {
  stroke: var(--color-text-inverse);
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
}

/* =========================================================
   TOPBAR — Selective Glassmorphism
========================================================= */
.topbar {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border-subtle);
  padding: 14px var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 25;
}

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

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-1px);
}

.notif-dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-surface);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary-tint) 0%, #D0EBEB 100%);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: var(--font-heading);
  font-size: 0.88rem;
  cursor: pointer;
  border: 2px solid var(--color-surface);
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(13, 110, 110, 0.2);
}

.content {
  padding: var(--space-5) var(--space-5) var(--space-6);
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
}

.section { margin-bottom: var(--space-5); }
.section-head { margin-bottom: var(--space-3); }
.section-head h2 { font-size: 1.25rem; font-weight: 700; color: var(--color-text); }
.section-head p {
  color: var(--color-text-muted);
  margin-top: 4px;
  font-size: 0.9rem;
  max-width: 65ch;
}

/* Neutral container for grouped controls (not a content card) */
.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-xs);
}

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

/* =========================================================
   BUTTONS — Clear Hierarchy & Micro-interactions
========================================================= */
.btn-hm {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 9px 20px;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  transition: transform 0.1s ease, background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.btn-hm:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  box-shadow: 0 2px 8px rgba(13, 110, 110, 0.2);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 4px 14px rgba(13, 110, 110, 0.3);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
}

.btn-secondary:hover {
  background: var(--color-primary-soft);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}

.btn-ghost:hover {
  background: var(--color-bg-subtle);
  color: var(--color-text);
}

.btn-accent {
  background: var(--color-accent);
  color: white;
  box-shadow: 0 2px 8px rgba(224, 122, 95, 0.25);
}

.btn-accent:hover {
  background: #D0694F;
  box-shadow: 0 4px 14px rgba(224, 122, 95, 0.35);
  transform: translateY(-1px);
}

.btn-hm:disabled {
  background: var(--color-border);
  color: var(--color-text-muted);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-block { width: 100%; }

/* =========================================================
   FORM FIELDS — Accessible & Polished
========================================================= */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  letter-spacing: 0.01em;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field select,
.field textarea {
  font-family: var(--font-body);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.9rem;
  background: var(--color-surface);
  color: var(--color-text);
  width: 100%;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--color-surface);
  box-shadow: 0 0 0 3.5px var(--color-primary-soft);
}

.field-error {
  font-size: 0.78rem;
  color: var(--color-error);
  display: none;
  margin-top: 2px;
}

.field.has-error input,
.field.has-error select {
  border-color: var(--color-error);
}

.field.has-error .field-error {
  display: block;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  user-select: none;
}

.checkbox-row input {
  accent-color: var(--color-primary);
  width: 16px;
  height: 16px;
}

/* Modern Toggle Switch */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.toggle input { display: none; }

.toggle-track {
  width: 44px;
  height: 24px;
  border-radius: var(--radius-pill);
  background: var(--color-border);
  position: relative;
  cursor: pointer;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  transition: transform var(--transition-smooth);
  box-shadow: var(--shadow-xs);
}

.toggle input:checked + .toggle-track {
  background: var(--color-primary);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(20px);
}

/* =========================================================
   STATUS BADGES
========================================================= */
.badge-hm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.01em;
}

.badge-hm .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-success { background: var(--color-success-tint); color: var(--color-success-dark); }
.badge-success .dot { background: var(--color-success); }

.badge-warning { background: var(--color-warning-tint); color: var(--color-warning-dark); }
.badge-warning .dot { background: var(--color-warning); }

.badge-info { background: var(--color-info-tint); color: var(--color-info-dark); }
.badge-info .dot { background: var(--color-info); }

.badge-error { background: var(--color-error-tint); color: var(--color-error-dark); }
.badge-error .dot { background: var(--color-error); }

.badge-neutral { background: var(--color-bg-subtle); color: var(--color-text-secondary); }
.badge-neutral .dot { background: var(--color-text-muted); }

/* =========================================================
   CARDS & SURFACES — Depth & Selective Glassmorphism
========================================================= */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-3);
}

.hm-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

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

/* Strategic Glass Card for hero/overview areas */
.card-glass {
  background: var(--glass-bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  padding: var(--space-4);
  position: relative;
  overflow: hidden;
}

.card-glass::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
}

/* Metric Display Widget */
.metric-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

.metric-val {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.metric-val .unit {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-left: 4px;
}

.metric-sub {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

.med-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}
.med-row:last-child { border-bottom: none; }
.med-time { font-size: 0.78rem; color: var(--color-text-muted); width: 64px; flex-shrink: 0; }
.med-name { font-weight: 500; font-size: 0.9rem; flex: 1; }

/* =========================================================
   PROGRESS RING & BARS
========================================================= */
.progress-ring-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.ring-label {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.bar-track {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--color-border);
  overflow: hidden;
  width: 100%;
}

.bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--color-primary) 0%, #17A294 100%);
  transition: width 0.4s ease;
}

/* =========================================================
   EMPTY STATE
========================================================= */
.empty-state {
  text-align: center;
  padding: var(--space-6) var(--space-4);
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.empty-state svg {
  color: var(--color-text-muted);
}

.empty-state h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: var(--space-3);
  color: var(--color-text);
}

.empty-state p {
  color: var(--color-text-muted);
  font-size: 0.88rem;
  margin: var(--space-1) 0 var(--space-3);
}

/* =========================================================
   TOAST NOTIFICATION — Glassmorphic & Modern
========================================================= */
.toast-hm {
  position: fixed;
  top: 24px;
  right: 24px;
  background: var(--glass-bg-card);
  backdrop-filter: var(--glass-blur-lg);
  -webkit-backdrop-filter: var(--glass-blur-lg);
  color: var(--color-text);
  border: 1px solid var(--glass-border);
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 16px 36px -8px rgba(15, 23, 42, 0.15);
  font-size: 0.88rem;
  font-weight: 500;
  transform: translateY(-16px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition-smooth);
  z-index: 60;
}

.toast-hm.show {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.toast-hm .dot-success {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 0 3px var(--color-success-tint);
  flex-shrink: 0;
}

/* Notification Panel Dropdown */
.notif-panel {
  position: absolute;
  top: 50px;
  right: 0;
  width: 320px;
  background: var(--glass-bg-card);
  backdrop-filter: var(--glass-blur-lg);
  -webkit-backdrop-filter: var(--glass-blur-lg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.12);
  padding: 8px;
  display: none;
  z-index: 30;
}

.notif-panel.show { display: block; }

.notif-panel-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  transition: background var(--transition-fast);
}

.notif-panel-item:hover {
  background: var(--color-bg-subtle);
}

.notif-panel-item .t {
  font-weight: 600;
  color: var(--color-text);
}

.notif-panel-item .s {
  color: var(--color-text-muted);
  font-size: 0.78rem;
  margin-top: 2px;
}

/* =========================================================
   MODAL — Frosted Glass Backdrop & Elegant Container
========================================================= */
.modal-hm-backdrop,
.modal-hm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: var(--space-3);
  overflow-y: auto;
  animation: fadeIn 0.18s ease forwards;
}

.modal-hm-backdrop.show,
.modal-hm-overlay.show { display: flex; }

.modal-hm {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  box-shadow: 0 24px 48px -12px rgba(15, 23, 42, 0.22);
  border: 1px solid var(--color-border);
  transform: scale(0.96);
  animation: modalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.modal-hm-header h2,
.modal-hm-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: var(--color-text);
}

.modal-hm-close {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 1rem;
  line-height: 1;
  transition: all var(--transition-fast);
}

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

.modal-hm-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

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

@keyframes modalPop {
  from { transform: scale(0.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-hm h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: var(--space-3);
  color: var(--color-text);
}

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

/* =========================================================
   MOBILE — bottom nav, hide sidebar
========================================================= */
.bottom-nav { display: none; }

/* =========================================================
   TABLE — for "all medicines" style listings (desktop).
   On mobile, the same data renders as .med-detail-card
   instead (see page-level markup); this table is hidden then.
========================================================= */
.hm-table-wrap {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.hm-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.hm-table th {
  text-align: left;
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 0.76rem;
  text-transform: none;
  padding: 12px var(--space-3);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}
.hm-table td {
  padding: 12px var(--space-3);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.hm-table tr:last-child td { border-bottom: none; }
.hm-table .row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* Mobile per-item detail card, used where a table would be too tight */
.med-detail-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--space-3);
  margin-bottom: var(--space-2);
}
.med-detail-card .mdc-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.med-detail-card .mdc-name { font-weight: 600; font-size: 0.92rem; }
.med-detail-card .mdc-meta {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.med-detail-card .mdc-actions {
  display: flex;
  gap: 8px;
  margin-top: var(--space-2);
}

/* =========================================================
   CHECKLIST — daily routine items
========================================================= */
.routine-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}
.routine-item:last-child { border-bottom: none; }

.check-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all 0.15s ease;
}
.check-circle.done {
  background: var(--color-success);
  border-color: var(--color-success);
  color: white;
}

.routine-item-body { flex: 1; min-width: 0; }
.routine-item-name {
  font-size: 0.9rem;
  font-weight: 500;
}
.routine-item-name.done {
  color: var(--color-text-muted);
  text-decoration: line-through;
}
.routine-item-tag {
  font-size: 0.76rem;
  color: var(--color-text-muted);
}

/* Weekly mini bar chart */
.week-bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 90px;
  padding-top: var(--space-2);
}
.week-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}
.week-bar-fill {
  width: 100%;
  max-width: 26px;
  border-radius: var(--radius-pill) var(--radius-pill) 4px 4px;
  background: var(--color-primary);
}
.week-bar-fill.today { background: var(--color-secondary); }
.week-bar-day { font-size: 0.72rem; color: var(--color-text-muted); }

@media (max-width: 767px) {
  .sidebar { display: none; }
  
  .topbar {
    padding: 10px 14px;
  }
  .topbar .font-heading {
    font-size: 0.95rem;
  }
  .icon-btn, .avatar {
    width: 34px;
    height: 34px;
    font-size: 0.8rem;
  }

  .content {
    padding: 12px 12px 76px;
  }

  .section {
    margin-bottom: 12px;
  }
  .section-head {
    margin-bottom: 6px;
  }
  .section-head h2 {
    font-size: 1.05rem;
  }
  .section-head p {
    font-size: 0.78rem;
    margin-top: 2px;
  }

  .hm-card, .panel {
    padding: 12px 14px;
    border-radius: var(--radius-md);
  }

  .page-header {
    margin-bottom: 12px;
    gap: 8px;
  }
  .page-header h1 {
    font-size: 1.25rem;
  }
  .page-header p {
    font-size: 0.8rem;
  }
  .page-header .btn-hm {
    padding: 6px 14px;
    font-size: 0.8rem;
  }

  .btn-hm {
    padding: 7px 15px;
    font-size: 0.82rem;
  }

  .field {
    margin-bottom: 10px;
  }
  .field label {
    font-size: 0.76rem;
    margin-bottom: 4px;
  }
  .field input[type="text"],
  .field input[type="date"],
  .field input[type="time"],
  .field input[type="email"],
  .field input[type="password"],
  .field input[type="number"],
  .field select,
  .field textarea {
    padding: 8px 12px;
    font-size: 0.86rem;
  }

  .tab-row {
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: 10px;
  }
  .tab-row::-webkit-scrollbar {
    display: none;
  }
  .tab-btn {
    padding: 6px 12px;
    font-size: 0.78rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .list-row {
    padding: 10px 12px;
    gap: 10px;
  }
  .list-row-icon {
    width: 34px;
    height: 34px;
  }
  .list-row-main .name {
    font-size: 0.88rem;
  }
  .list-row-main .meta {
    font-size: 0.76rem;
  }

  .chart-wrap {
    height: 180px;
    margin-top: 10px;
  }
  .record-hero .value {
    font-size: 1.55rem;
  }

  .week-bars {
    height: 72px;
  }

  .modal-hm {
    padding: 18px 16px;
    border-radius: var(--radius-md);
    max-height: 90vh;
    overflow-y: auto;
  }
  .modal-hm h3 {
    font-size: 1.05rem;
    margin-bottom: 10px;
  }
  .modal-hm-actions {
    margin-top: 14px;
  }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur-lg);
    -webkit-backdrop-filter: var(--glass-blur-lg);
    border-top: 1px solid var(--glass-border-subtle);
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
    align-items: center;
    z-index: 40;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.05);
  }
  .bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    min-height: 42px;
    min-width: 48px;
    transition: all var(--transition-fast);
  }
  .bottom-nav a svg {
    width: 18px;
    height: 18px;
    transition: transform var(--transition-fast);
  }
  .bottom-nav a:hover {
    color: var(--color-primary);
  }
  .bottom-nav a.active {
    color: var(--color-primary);
    font-weight: 600;
    background: var(--color-primary-soft);
  }
  .bottom-nav a.active svg {
    stroke: var(--color-primary);
    transform: translateY(-1px);
  }
}

/* =========================================================
   PAGE HEADER — title + primary action, used on every
   feature page (Medicines, Daily Routine, Health Records...)
========================================================= */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-5);
}
.page-header h1 { font-size: 1.5rem; font-weight: 600; }
.page-header p { color: var(--color-text-muted); font-size: 0.9rem; margin-top: 2px; }

/* =========================================================
   LIST ROW — used for the "All medicines" / "All routines"
   management lists. A row on desktop, a stacked card on
   mobile (handled by the media query below).
========================================================= */
.list-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}
.list-row:last-child { border-bottom: none; }

.list-row-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-tint);
  color: var(--color-primary-dark);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.list-row-main { flex: 1; min-width: 160px; }
.list-row-main .name { font-weight: 600; font-size: 0.92rem; }
.list-row-main .meta { font-size: 0.8rem; color: var(--color-text-muted); margin-top: 2px; }

.list-row-side {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.icon-action {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-muted);
  cursor: pointer;
}
.icon-action:hover { background: var(--color-bg); }
.icon-action.danger:hover { background: var(--color-error-tint); color: var(--color-error); border-color: var(--color-error-tint); }

/* Week dot row — Mon..Sun completion glance */
.week-dots { display: flex; gap: 5px; }
.week-dots .d {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--color-border);
  font-size: 0;
}
.week-dots .d.done { background: var(--color-success); }
.week-dots .d.today { box-shadow: 0 0 0 2px var(--color-primary-tint); }

/* Simple tab filter (e.g. Today / All) */
.tab-row {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.tab-btn {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
}
.tab-btn.active { background: var(--color-primary); border-color: var(--color-primary); color: white; }

@media (max-width: 600px) {
  .list-row { flex-wrap: wrap; }
  .list-row-side { width: 100%; justify-content: space-between; margin-top: 8px; }
}

/* =========================================================
   FAMILY & PROFILE — Phase 3
========================================================= */
.role-switch-wrap { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.role-switch-wrap label { font-size: 0.8rem; color: var(--color-text-muted); }
.role-switch {
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
}

.demo-note {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  background: var(--color-accent-tint);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: var(--space-4);
}

.profile-hero { display: flex; align-items: center; gap: var(--space-3); }
.profile-hero-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--color-secondary-tint);
  color: #9c6a1f;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-weight: 600; font-size: 1.3rem;
  flex-shrink: 0;
}
.profile-hero-name { font-size: 1.2rem; font-weight: 600; }
.profile-hero-role { font-size: 0.8rem; color: var(--color-text-muted); }

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-3);
}
.info-item .label { font-size: 0.76rem; color: var(--color-text-muted); }
.info-item .value { font-size: 0.92rem; font-weight: 500; margin-top: 2px; }

.tag-chip {
  display: inline-flex;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--color-primary-tint);
  color: var(--color-primary-dark);
  font-size: 0.78rem;
  font-weight: 500;
  margin: 0 6px 6px 0;
}
.tag-chip.muted { background: var(--color-bg); color: var(--color-text-muted); }

.locked-panel {
  text-align: center;
  padding: var(--space-5) var(--space-3);
  color: var(--color-text-muted);
  font-size: 0.88rem;
}
.locked-panel svg { color: var(--color-text-muted); margin-bottom: 8px; }
.locked-panel h3 { font-size: 0.95rem; color: var(--color-text); margin-bottom: 4px; }

.permission-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
  gap: var(--space-3);
}
.permission-row:last-child { border-bottom: none; }
.permission-row .p-label { font-weight: 500; }
.permission-row .p-sub { font-size: 0.78rem; color: var(--color-text-muted); margin-top: 2px; }

.member-card-locked {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: var(--space-4) var(--space-3);
}

/* =========================================================
   HEALTH RECORDS — Phase 4
========================================================= */
.record-hero { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.record-hero .value { font-family: var(--font-heading); font-size: 2rem; font-weight: 600; }
.record-hero .unit { color: var(--color-text-muted); font-size: 0.9rem; }
.record-hero .trend {
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-weight: 600;
}
.trend-up { background: var(--color-error-tint); color: var(--color-error); }
.trend-down { background: var(--color-success-tint); color: var(--color-success); }
.trend-flat { background: var(--color-bg); color: var(--color-text-muted); }

.chart-wrap { position: relative; height: 220px; margin-top: var(--space-4); }

.record-entry-note {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

/* =========================================================
   COMPACT MOBILE APP OVERRIDES (Eliminates excessive scroll)
========================================================= */
@media (max-width: 767px) {
  .page-header {
    margin-bottom: 12px;
    gap: 8px;
  }
  .page-header h1 {
    font-size: 1.25rem;
  }
  .page-header p {
    font-size: 0.78rem;
    margin-top: 1px;
  }

  .med-row {
    padding: 6px 0;
    gap: 6px;
  }
  .med-time {
    font-size: 0.74rem;
    width: 58px;
  }
  .med-name {
    font-size: 0.85rem;
  }

  .empty-state {
    padding: 24px 14px;
  }
  .empty-state svg {
    width: 32px;
    height: 32px;
  }
  .empty-state h3 {
    font-size: 0.95rem;
  }
  .empty-state p {
    font-size: 0.78rem;
  }

  .profile-hero {
    gap: 10px;
  }
  .profile-hero-avatar {
    width: 48px;
    height: 48px;
    font-size: 1.1rem;
  }
  .profile-hero-name {
    font-size: 1.05rem;
  }

  .info-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .info-item .label {
    font-size: 0.7rem;
  }
  .info-item .value {
    font-size: 0.85rem;
  }

  .demo-note {
    padding: 6px 10px;
    margin-bottom: 10px;
    font-size: 0.75rem;
  }

  .permission-row {
    padding: 8px 0;
    font-size: 0.82rem;
  }

  .record-hero .value {
    font-size: 1.55rem;
  }
  .chart-wrap {
    height: 170px;
    margin-top: 8px;
  }
}

/* =========================================================
   PHASE 5: EMERGENCY MEDICAL ID & DOCTOR REPORT STYLES
========================================================= */
.emergency-card-visual {
  background: linear-gradient(135deg, #FFF5F5 0%, #FFFFFF 100%);
  border: 1.5px solid #FCA5A5;
  border-radius: var(--radius-md);
  padding: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.08);
}
.emergency-card-visual::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--color-error);
}
.emergency-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.emergency-blood-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--color-error);
  color: #FFFFFF;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.1;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.25);
}
.emergency-blood-badge span {
  font-size: 0.58rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.emergency-call-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--color-error);
  color: #FFFFFF;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background var(--transition-fast);
}
.emergency-call-btn:hover {
  background: var(--color-error-dark);
  color: #FFFFFF;
}

/* Report Styles */
.report-sheet {
  background: #FFFFFF;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 32px 36px;
  max-width: 860px;
  margin: 0 auto 32px;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
}
.report-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--color-primary);
  margin-bottom: 20px;
}
.report-brand-name {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-primary);
}
.report-meta-tag {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}
.report-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 0.85rem;
}
.report-table th, .report-table td {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  text-align: left;
}
.report-table th {
  background: var(--color-bg-subtle);
  font-weight: 600;
  color: var(--color-text);
}
.report-table tr:nth-child(even) td {
  background: #FAFAFA;
}
.report-signature-block {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px dashed var(--color-border);
}

/* =========================================================
   MEDICAL DOCUMENTS & VAULT STYLES
========================================================= */
.vault-search-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}
.vault-search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 240px;
}
.vault-search-input-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}
.vault-search-input-wrap input {
  padding-left: 36px;
  width: 100%;
}

.doc-tab-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: var(--space-4);
}
.doc-tab-btn {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}
.doc-tab-btn:hover {
  background: var(--color-bg-subtle);
  color: var(--color-text);
  border-color: rgba(13, 110, 110, 0.4);
}
.doc-tab-btn.active {
  background: var(--color-primary);
  color: #FFFFFF;
  border-color: var(--color-primary);
  box-shadow: 0 2px 6px rgba(13, 110, 110, 0.25);
}

.vault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}
.vault-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}
.vault-card:hover {
  transform: translateY(-2px);
  border-color: rgba(13, 110, 110, 0.4);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.07);
}
.vault-card-thumb {
  height: 120px;
  background: linear-gradient(135deg, #F8FAFC 0%, #F1F5F9 100%);
  border-bottom: 1px solid var(--color-border);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}
.vault-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-fast);
}
.vault-card:hover .vault-thumb-img {
  transform: scale(1.03);
}
.vault-thumb-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--color-text-muted);
}
.vault-thumb-ext {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
}
.vault-thumb-icon svg {
  width: 22px;
  height: 22px;
}
.vault-badge-cat {
  position: absolute;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid;
  backdrop-filter: blur(4px);
  z-index: 2;
}

.vault-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.vault-doc-date {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}
.vault-doc-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 6px;
  line-height: 1.35;
  cursor: pointer;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.vault-doc-title:hover {
  color: var(--color-primary);
}
.vault-meta-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.76rem;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}
.vault-meta-item b {
  color: var(--color-text);
}
.vault-doc-notes {
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  background: var(--color-bg-subtle);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.vault-card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--color-border);
}
.vault-filesize {
  font-size: 0.74rem;
  color: var(--color-text-muted);
  font-weight: 500;
}
.vault-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-sm {
  padding: 4px 8px !important;
  font-size: 0.75rem !important;
  border-radius: 6px !important;
}
.icon-delete {
  color: var(--color-error) !important;
}
.icon-delete:hover {
  background: #FEF2F2 !important;
  border-color: #FCA5A5 !important;
}

/* Upload Drop Zone */
.doc-drop-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  background: #FAFAF8;
  transition: all var(--transition-fast);
}
.doc-drop-zone:hover, .doc-drop-zone.drag-active {
  border-color: var(--color-primary);
  background: var(--color-primary-tint);
}
.doc-file-preview-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FFFFFF;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  text-align: left;
}

.form-group-hm {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-3);
  text-align: left;
}
.form-group-hm label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--color-text);
}
.form-group-hm input[type="text"],
.form-group-hm input[type="date"],
.form-group-hm select,
.form-group-hm textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--color-text);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-group-hm input:focus,
.form-group-hm select:focus,
.form-group-hm textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-tint);
}
.form-row-hm {
  display: flex;
  gap: var(--space-3);
}
.form-row-hm > * {
  flex: 1;
  min-width: 0;
}

.empty-vault-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 20px;
  background: var(--color-surface);
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-md);
}
.empty-icon-circle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--color-primary-tint);
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.empty-vault-state h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.empty-vault-state p {
  font-size: 0.84rem;
  color: var(--color-text-muted);
  max-width: 420px;
  margin: 0 auto;
}

/* =========================================================
   APPOINTMENTS & CLINICAL FOLLOW-UP SCHEDULER STYLES
========================================================= */
.appt-search-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.appt-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: var(--space-4);
}

.appt-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  position: relative;
}

.appt-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -4px rgba(15, 23, 42, 0.08);
  border-color: rgba(13, 110, 110, 0.3);
}

.appt-card.is-completed {
  opacity: 0.9;
  background: #FAFCFC;
}

.appt-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.appt-doc-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.appt-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-primary-tint);
  color: var(--color-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
  border: 1px solid rgba(13, 110, 110, 0.15);
}

.appt-doc-info h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 2px 0;
}

.appt-specialty-pill {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--color-primary-dark);
  background: var(--color-primary-tint);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.appt-time-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
}

.appt-countdown-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.appt-countdown-tag.soon {
  background: #FEF3C7;
  color: #B45309;
}
.appt-countdown-tag.normal {
  background: #ECFDF5;
  color: #047857;
}
.appt-countdown-tag.done {
  background: #F1F5F9;
  color: #475569;
}

.appt-meta-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.83rem;
  color: var(--color-text-secondary);
}

.appt-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.appt-checklist-block {
  background: #FAFAFA;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.appt-checklist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}

.appt-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--color-text);
  padding: 4px 0;
  cursor: pointer;
}

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

.appt-check-item.done span {
  text-decoration: line-through;
  color: var(--color-text-muted);
}

.appt-checklist-add-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--color-border);
}

.appt-checklist-add-row input {
  flex: 1;
  font-size: 0.78rem;
  padding: 5px 8px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: #FFFFFF;
}

.appt-checklist-add-row button {
  font-size: 0.75rem;
  padding: 5px 8px;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
}

.appt-notes-box {
  background: #FFFFFF;
  border-left: 3px solid var(--color-primary);
  padding: 6px 10px;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  border-radius: 0 4px 4px 0;
}

.appt-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--color-border);
  margin-top: auto;
}

/* Quick Action theme for Appointments */
.quick-action-card.qa-theme-appt {
  background: linear-gradient(145deg, #FFFFFF 0%, #F0FDF4 100%);
  border-color: rgba(16, 185, 129, 0.24);
}
.quick-action-card.qa-theme-appt:hover {
  transform: translateY(-2px);
  border-color: #10B981;
  box-shadow: 0 8px 20px -4px rgba(16, 185, 129, 0.16);
}

@media print {
  .sidebar, .topbar, .bottom-nav, .no-print, button:not(.print-keep), .page-header {
    display: none !important;
  }
  body, .app-shell, .main, .content {
    background: #FFFFFF !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .report-sheet {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    max-width: 100% !important;
  }
}
