/* Clinical Design System — Light theme for EM handoff tool */
/* Optimized for readability under fluorescent hospital lighting */

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

:root {
  /* Surfaces */
  --bg: #f4f6f8;
  --card: #ffffff;
  --surface: #edf0f4;
  --border: #d1d5db;
  --border-light: #e5e7eb;

  /* Text */
  --text: #1a1d23;
  --text-secondary: #5f6672;
  --text-muted: #9ca3af;

  /* Acuity — ESI triage scale */
  --critical: #dc2626;
  --critical-bg: #fef2f2;
  --serious: #ea580c;
  --serious-bg: #fff7ed;
  --stable: #16a34a;
  --stable-bg: #f0fdf4;
  --watch: #ca8a04;
  --watch-bg: #fefce8;

  /* Actions */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-bg: #eff6ff;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --success: #16a34a;
  --warning: #f59e0b;

  /* Priority badges */
  --stat: #dc2626;
  --urgent: #ea580c;
  --routine: #6b7280;

  /* Layout */
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;
  --lh: 1.5;
}

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

body {
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.3;
}
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-base); font-weight: 600; }

p { margin-bottom: var(--sp-3); }
p:last-child { margin-bottom: 0; }

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

/* Layout utilities */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--sp-4);
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }

.grid {
  display: grid;
  gap: var(--sp-4);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Focus styles — accessibility */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Nav */
.nav {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: var(--sp-3) var(--sp-4);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-weight: 700;
  font-size: var(--fs-lg);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.nav-brand .icon {
  width: 28px;
  height: 28px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
  background: var(--primary-bg);
  text-decoration: none;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

/* Page layout */
.page {
  padding: var(--sp-6) 0;
}

.page-header {
  margin-bottom: var(--sp-6);
}

.page-title {
  font-size: var(--fs-xl);
  margin-bottom: var(--sp-1);
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
}

/* Mobile responsive */
@media (max-width: 768px) {
  :root {
    --fs-base: 0.875rem;
    --fs-lg: 1rem;
    --fs-xl: 1.25rem;
    --fs-2xl: 1.5rem;
  }

  .container {
    padding: 0 var(--sp-3);
  }

  .nav-links {
    gap: var(--sp-2);
  }

  .page {
    padding: var(--sp-4) 0;
  }
}

@media (max-width: 480px) {
  .nav-links span.label {
    display: none;
  }
}
