:root {
  /* Color Palette - CareCrew */
  --primary: #03256c;    /* Imperial Blue - Trust, Headers, Primary Actions */
  --bg-body: #bce7fd;    /* Icy Blue - Main Background, Calm */
  --bg-card: #ffffff;    /* White - Cards */
  --accent-warm: #f0bcd4; /* Soft Blossom - Highlights, Notes */
  --accent-gold: #f1da70; /* Straw Gold - Progress, Success */
  --alert: #7d1128;      /* Burgundy - Alerts, Emergency */
  
  --text-dark: #03256c;  /* Deep Blue for primary text */
  --text-body: #334155;  /* Slate for body text */
  --text-light: #f8fafc; /* Light text for dark backgrounds */
  
  /* Spacing & Layout */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  
  /* UI Properties */
  --radius-card: 20px;
  --radius-btn: 50px; /* Pill shape */
  --radius-input: 12px;
  --shadow-soft: 0 8px 24px rgba(3, 37, 108, 0.08);
  --shadow-elevated: 0 12px 32px rgba(3, 37, 108, 0.15);
  
  --header-height: 60px;
  --nav-height: 70px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-body);
  margin: 0;
  padding: 0;
  padding-bottom: 100px; /* Space for bottom nav/emergency btn */
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  color: var(--text-dark);
  margin: 0 0 var(--spacing-sm) 0;
  font-weight: 700;
}

p {
  margin: 0 0 var(--spacing-sm) 0;
}

a {
  text-decoration: none;
  color: inherit;
}

/* --- Layout & Containers --- */
.container {
  max-width: 600px; /* Mobile-focused width on desktop */
  margin: 0 auto;
  padding: var(--spacing-md);
  min-height: 100vh;
}

/* --- App Bar --- */
.app-bar {
  background-color: var(--primary);
  color: var(--text-light);
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--spacing-md);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-soft);
}

.app-bar-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.app-bar-actions {
  display: flex;
  gap: var(--spacing-md);
}

/* --- Cards --- */
.card {
  background-color: var(--bg-card);
  border-radius: var(--radius-card);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

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

.card-title {
  font-size: 1.1rem;
  color: var(--primary);
  margin: 0;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  text-align: center;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(3, 37, 108, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(3, 37, 108, 0.4);
}

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

.btn-accent {
  background-color: var(--accent-gold);
  color: var(--text-dark);
}

.btn-alert {
  background-color: var(--alert);
  color: white;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
  width: auto;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* --- Forms --- */
.form-group {
  margin-bottom: var(--spacing-md);
}

.form-label {
  display: block;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: var(--spacing-xs);
  font-size: 0.9rem;
}

.form-input {
  width: 100%;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-input);
  background-color: #f8fafc;
  font-size: 1rem;
  color: var(--text-dark);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  background-color: white;
}

/* --- Badges --- */
.badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-block;
}

.badge-gold {
  background-color: var(--accent-gold);
  color: var(--text-dark);
}

.badge-warm {
  background-color: var(--accent-warm);
  color: var(--text-dark);
}

.badge-alert {
  background-color: #fee2e2;
  color: var(--alert);
}

/* --- Bottom Navigation --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: white;
  height: var(--nav-height);
  display: flex;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
  z-index: 1000;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  gap: 4px;
  width: 100%;
  height: 100%;
  justify-content: center;
}

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

.nav-icon {
  width: 24px;
  height: 24px;
  background-color: #e2e8f0;
  border-radius: 6px;
  margin-bottom: 2px;
}

.nav-item.active .nav-icon {
  background-color: var(--primary);
}

/* --- Emergency Bar (Fixed) --- */
.emergency-bar {
  position: fixed;
  bottom: var(--nav-height);
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(188, 231, 253, 0), rgba(188, 231, 253, 1));
  padding: 10px var(--spacing-md) 10px;
  z-index: 900;
  display: flex;
  justify-content: center;
  pointer-events: none; /* Let clicks pass through transparent part */
}

.emergency-btn-wrapper {
  pointer-events: auto;
  width: 100%;
  max-width: 600px;
}

/* --- Utility / Placeholders --- */
.placeholder-icon {
  width: 24px;
  height: 24px;
  background-color: currentColor;
  opacity: 0.5;
  border-radius: 4px;
  display: inline-block;
}

.placeholder-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: #e2e8f0;
  border: 2px solid white;
}

.flex-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-md);
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--spacing-sm);
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.text-alert { color: var(--alert); }
.mt-2 { margin-top: var(--spacing-md); }
.mb-0 { margin-bottom: 0; }

/* Progress Bar */
.progress-track {
  width: 100%;
  height: 8px;
  background-color: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin-top: var(--spacing-sm);
}

.progress-fill {
  height: 100%;
  background-color: var(--accent-gold);
}

/* Tab Bar (Top) */
.tab-bar {
  display: flex;
  background: white;
  padding: 4px;
  border-radius: var(--radius-btn);
  margin-bottom: var(--spacing-md);
}

.tab-btn {
  flex: 1;
  padding: 10px;
  text-align: center;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

.tab-btn.active {
  background-color: var(--bg-body);
  color: var(--primary);
}

/* Timeline */
.timeline-item {
  border-left: 2px solid var(--primary);
  padding-left: var(--spacing-md);
  margin-left: 8px;
  padding-bottom: var(--spacing-lg);
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 0;
  width: 10px;
  height: 10px;
  background-color: var(--primary);
  border-radius: 50%;
}

.timeline-item.muted {
  border-left-color: #cbd5e1;
}

.timeline-item.muted::before {
  background-color: #cbd5e1;
}
