/* Newborn Early Warning Sign Score (NEWS) - Modern Medical UI/UX */
@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Prompt:wght@300;400;500;600;700;800&display=swap");

:root {
  /* Brand & Theme Palette */
  --font-main: "Prompt", "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bg: #f8fafc;
  --bg-gradient: radial-gradient(circle at 50% 0%, #ecfdf5 0%, #f8fafc 60%, #f1f5f9 100%);
  --panel: #ffffff;
  --panel-glass: rgba(255, 255, 255, 0.92);
  --ink: #0f172a;
  --ink-secondary: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --soft-line: #f1f5f9;
  
  /* Medical Brand Teal */
  --teal-50: #f0fdfa;
  --teal-100: #ccfbf1;
  --teal-200: #99f6e4;
  --teal-400: #2dd4bf;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --teal-700: #0f766e;
  --teal-800: #115e59;
  --teal-900: #134e4a;
  
  /* Clinical Risk Levels */
  --normal: #059669;
  --normal-bg: #ecfdf5;
  --normal-border: #a7f3d0;
  --normal-glow: rgba(16, 185, 129, 0.2);

  --low: #d97706;
  --low-bg: #fffbeb;
  --low-border: #fde68a;
  --low-glow: rgba(245, 158, 11, 0.2);

  --medium: #ea580c;
  --medium-bg: #fff7ed;
  --medium-border: #fed7aa;
  --medium-glow: rgba(234, 88, 12, 0.25);

  --high: #dc2626;
  --high-bg: #fef2f2;
  --high-border: #fecaca;
  --high-glow: rgba(220, 38, 38, 0.3);

  /* Shadows & Radius */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 28px -6px rgba(15, 23, 42, 0.08), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 40px -10px rgba(15, 23, 42, 0.12);

  --transition: all 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: var(--font-main);
  color: var(--ink);
  background: var(--bg-gradient);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
  font-weight: 600;
  transition: var(--transition);
}

button:active {
  transform: scale(0.97);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none !important;
}

/* App Shell */
.app-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 60px;
}

/* Header Topbar */
.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: var(--panel-glass);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 4px;
  color: var(--teal-600);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--teal-500);
  box-shadow: 0 0 8px var(--teal-400);
}

h1 {
  margin: 0 0 6px;
  font-size: clamp(1.4rem, 3.2vw, 2.1rem);
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.title-short {
  display: none;
}

.lead {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  font-weight: 400;
}

/* Header Status Card (Score Indicator) */
.status-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 140px;
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--teal-50) 0%, #ffffff 100%);
  border: 1.5px solid var(--teal-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.status-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--teal-700);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-card strong {
  display: block;
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--teal-700);
  line-height: 1;
  margin: 4px 0 2px;
}

.status-card span:last-child {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

/* Clinical Caution Note */
.clinical-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 16px;
  background: #fff8f6;
  border: 1px solid #fed7aa;
  border-left: 4px solid var(--medium);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  color: #7c2d12;
  line-height: 1.5;
}

.clinical-note strong {
  font-weight: 700;
  color: #9a3412;
  flex-shrink: 0;
}

/* Notification Control Toolbar */
.notification-toolbar {
  margin-bottom: 20px;
  background: #ffffff;
  border: 1px solid #dbeafe;
  border-left: 4px solid #3b82f6;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.notif-panel {
  padding: 12px 18px;
}

.notif-panel-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e3a8a;
}

.notif-panel-summary::-webkit-details-marker {
  display: none;
}

.notif-panel-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.notification-status-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 280px;
}

.notification-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: #eff6ff;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.notification-status-group strong {
  display: block;
  font-size: 0.94rem;
  font-weight: 700;
  color: #1e3a8a;
}

.notification-sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.notification-action-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.notif-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #ffffff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  transition: var(--transition);
}

.notif-btn:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

.notif-btn.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.notif-btn.muted-state {
  background: #f8fafc;
  color: #94a3b8;
  border-color: var(--line);
}

.notif-btn.ghost {
  background: #f1f5f9;
  border-color: transparent;
  color: var(--ink-secondary);
}

.notif-btn.ghost:hover {
  background: #e2e8f0;
  color: var(--ink);
}

/* Main Workspace Grid */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, 0.82fr);
  gap: 20px;
  align-items: start;
}

/* Cards & Panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: var(--transition);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  background: #ffffff;
  border-bottom: 1px solid var(--soft-line);
}

.section-kicker {
  margin: 0 0 2px;
  color: var(--teal-600);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.22rem;
  font-weight: 800;
  color: var(--ink);
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.preset-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 13px;
  background: var(--teal-50);
  color: var(--teal-700);
  border: 1.5px solid var(--teal-200);
  border-radius: var(--radius-full);
  font-size: 0.84rem;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(13, 148, 136, 0.08);
}

.preset-button:hover {
  background: var(--teal-100);
  border-color: var(--teal-400);
}

/* Form Styles */
form {
  padding: 22px;
}

fieldset {
  margin: 0 0 22px;
  padding: 0;
  border: none;
}

fieldset:last-of-type {
  margin-bottom: 0;
}

legend {
  margin: 0 0 12px;
  padding: 0;
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--ink-secondary);
}

legend small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.bp-fieldset {
  padding-top: 18px;
  border-top: 1px solid var(--soft-line);
}

.bp-target-summary,
.bp-status-summary {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  color: var(--ink-secondary);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.5;
}

.bp-status-summary {
  margin: 12px 0 0;
}

.bp-target-summary.normal,
.bp-status-summary.normal {
  border-color: #a7f3d0;
  background: #ecfdf5;
  color: #047857;
}

.bp-target-summary.warning,
.bp-status-summary.warning {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.patient-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-secondary);
}

label small {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

input, select {
  height: 48px;
  padding: 0 14px;
  background: #ffffff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 600;
  outline: none;
  transition: var(--transition);
}

input:focus, select:focus {
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.18);
}

input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

/* Vital Grid Inputs */
.vital-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.vital-field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.vital-field:focus-within {
  background: #ffffff;
  border-color: var(--teal-400);
  box-shadow: 0 4px 14px rgba(15, 118, 110, 0.08);
}

.vital-field > span {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  color: var(--ink);
  font-size: 0.92rem;
}

.vital-field input {
  height: 46px;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--teal-900);
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  text-align: left;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  margin-top: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
  transition: var(--transition);
}

.score-pill.pending {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.score-pill.invalid {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.score-pill.score-0 {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.score-pill.score-1 {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.score-pill.score-2 {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.score-pill.score-3 {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  animation: pulse-border 2s infinite;
}

.score-pill.bp-normal {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.score-pill.bp-low {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.15); }
}

.select-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.select-grid label {
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.select-grid select {
  height: 48px;
  font-weight: 700;
}

/* Button UI Components */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  background: linear-gradient(135deg, var(--teal-600) 0%, var(--teal-700) 100%);
  color: #ffffff;
  border-radius: var(--radius-sm);
  font-size: 0.98rem;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.28);
}

.primary-button:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--teal-500) 0%, var(--teal-600) 100%);
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.38);
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  background: var(--teal-50);
  color: var(--teal-700);
  border: 1.5px solid var(--teal-200);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 700;
}

.secondary-button:hover:not(:disabled) {
  background: var(--teal-100);
  border-color: var(--teal-400);
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 16px;
  background: #f1f5f9;
  color: var(--ink-secondary);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
}

.ghost-button:hover:not(:disabled) {
  background: #e2e8f0;
  color: var(--ink);
}

.ghost-button.danger {
  color: var(--high);
  background: #fff1f2;
}

.ghost-button.danger:hover:not(:disabled) {
  background: #ffe4e6;
  border-color: #fecdd3;
}

/* Result Panel & Score Cards */
.result-panel {
  position: sticky;
  top: 20px;
}

.risk-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.risk-badge.waiting {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.risk-badge.normal {
  background: var(--normal-bg);
  color: var(--normal);
  border: 1.5px solid var(--normal-border);
}

.risk-badge.low {
  background: var(--low-bg);
  color: var(--low);
  border: 1.5px solid var(--low-border);
}

.risk-badge.medium {
  background: var(--medium-bg);
  color: var(--medium);
  border: 1.5px solid var(--medium-border);
}

.risk-badge.high {
  background: var(--high-bg);
  color: var(--high);
  border: 1.5px solid var(--high-border);
  box-shadow: 0 0 12px var(--high-glow);
}

.risk-badge.bp-alert {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fca5a5;
}

.score-display {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 20px 22px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid var(--soft-line);
}

.score-display div {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 14px;
  background: #ffffff;
  border: 2px solid var(--teal-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.score-display div span {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--teal-700);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.score-display strong {
  font-size: 3.4rem;
  font-weight: 800;
  color: var(--teal-800);
  line-height: 1;
  margin-top: 4px;
}

.score-display p {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.5;
}

/* Recommendation & Alerts */
.recommendation, .alerts, .breakdown {
  padding: 20px 22px;
  border-bottom: 1px solid var(--soft-line);
}

.recommendation h3, .alerts h3, .breakdown h3 {
  margin: 0 0 8px;
  font-size: 0.94rem;
  font-weight: 800;
  color: var(--ink-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.recommendation p {
  margin: 0 0 6px;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--teal-900);
  line-height: 1.5;
}

.recommendation span {
  display: inline-block;
  padding: 4px 10px;
  background: var(--teal-50);
  border: 1px solid var(--teal-200);
  border-radius: var(--radius-full);
  color: var(--teal-700);
  font-size: 0.84rem;
  font-weight: 700;
}

.team-alert-status {
  display: inline-flex;
  align-items: center;
  margin: 0 0 10px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
}

.team-alert-status.waiting {
  background: #f1f5f9;
  color: #64748b;
}

.team-alert-status.active {
  background: #ecfdf5;
  color: #059669;
}

.alerts ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alerts li {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
}

.alerts li.muted {
  background: #f8fafc;
  color: var(--muted);
  font-weight: 500;
}

.alerts li.alert-low {
  background: var(--low-bg);
  color: var(--low);
  border-left: 3px solid var(--low);
}

.alerts li.alert-medium {
  background: var(--medium-bg);
  color: var(--medium);
  border-left: 3px solid var(--medium);
}

.alerts li.alert-high {
  background: var(--high-bg);
  color: var(--high);
  border-left: 4px solid var(--high);
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.08);
}

/* Breakdown List */
.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
}

.breakdown-item strong {
  color: var(--ink);
  font-weight: 700;
}

.breakdown-item span {
  color: var(--muted);
}

.breakdown-item em {
  font-style: normal;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: #e2e8f0;
  color: var(--ink-secondary);
}

/* Guide Reference Section */
.guide-panel, .history-panel {
  margin-top: 20px;
}

.risk-guide {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 20px 22px;
}

.guide-row {
  display: flex;
  flex-direction: column;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}

.guide-row strong {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}

.guide-row span {
  margin: 6px 0 8px;
  font-size: 0.94rem;
  font-weight: 800;
}

.guide-row p {
  margin: 0 0 10px;
  font-size: 0.84rem;
  color: var(--ink-secondary);
  line-height: 1.4;
  flex-grow: 1;
}

.guide-row em {
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  width: fit-content;
}

.guide-row.normal { background: var(--normal-bg); border-color: var(--normal-border); }
.guide-row.normal strong, .guide-row.normal span { color: var(--normal); }
.guide-row.normal em { background: #d1fae5; color: var(--normal); }

.guide-row.low { background: var(--low-bg); border-color: var(--low-border); }
.guide-row.low strong, .guide-row.low span { color: var(--low); }
.guide-row.low em { background: #fef3c7; color: var(--low); }

.guide-row.medium { background: var(--medium-bg); border-color: var(--medium-border); }
.guide-row.medium strong, .guide-row.medium span { color: var(--medium); }
.guide-row.medium em { background: #ffedd5; color: var(--medium); }

.guide-row.high { background: var(--high-bg); border-color: var(--high-border); }
.guide-row.high strong, .guide-row.high span { color: var(--high); }
.guide-row.high em { background: #fee2e2; color: var(--high); }

/* History Table */
.history-table-wrap {
  overflow-x: auto;
  padding: 0 22px 20px;
}

.history-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88rem;
}

.history-table th {
  padding: 12px 14px;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 800;
  text-align: left;
  border-bottom: 1.5px solid var(--line);
}

.history-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--soft-line);
  font-weight: 600;
}

.history-table tr:hover td {
  background: #f8fafc;
}

.empty-row {
  text-align: center;
  color: var(--muted);
  padding: 24px !important;
}

.storage-note {
  margin: 0;
  padding: 12px 22px;
  background: #f8fafc;
  border-top: 1px solid var(--soft-line);
  font-size: 0.8rem;
  color: var(--muted);
}

/* Mobile Action Bar (Floating bottom) */
.mobile-action-bar {
  display: none;
}

/* Toast Component */
.toast {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  z-index: 100;
  padding: 12px 24px;
  background: rgba(15, 23, 42, 0.94);
  color: #ffffff;
  border-radius: var(--radius-full);
  font-size: 0.92rem;
  font-weight: 700;
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(12px);
  pointer-events: none;
  opacity: 0;
  transition: all 260ms cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
  max-width: calc(100vw - 32px);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Alert Notification Banner (Top Dropdown) */
.alert-banner {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%) translateY(-140%);
  z-index: 90;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  width: min(520px, calc(100vw - 28px));
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.98);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 48px -8px rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(20px);
  cursor: pointer;
  opacity: 0;
  transition: all 340ms cubic-bezier(0.16, 1, 0.3, 1);
  text-align: left;
}

.alert-banner[hidden] {
  display: none !important;
}

.alert-banner.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.alert-banner.medium {
  border-color: #fdba74;
  background: linear-gradient(135deg, #fffbf5 0%, #ffffff 100%);
}

.alert-banner.high {
  border-color: #fca5a5;
  background: linear-gradient(135deg, #fff5f5 0%, #ffffff 100%);
  animation: banner-pulse 2s infinite;
}

@keyframes banner-pulse {
  0%, 100% { box-shadow: 0 20px 48px -8px rgba(220, 38, 38, 0.3); }
  50% { box-shadow: 0 20px 48px 2px rgba(220, 38, 38, 0.45); }
}

.alert-banner-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--teal-600);
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 800;
}

.alert-banner.medium .alert-banner-icon { background: var(--medium); }
.alert-banner.high .alert-banner-icon { background: var(--high); }

.alert-banner-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.alert-banner-meta strong {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
}

.alert-banner-meta em {
  font-style: normal;
  font-size: 0.78rem;
  color: var(--muted);
}

.alert-banner-title {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 2px;
}

.alert-banner-message {
  display: block;
  font-size: 0.88rem;
  color: var(--ink-secondary);
  line-height: 1.4;
}

/* Alert Modal Dialog */
.alert-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.alert-modal[hidden] {
  display: none !important;
}

.alert-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
}

.alert-dialog {
  position: relative;
  width: min(540px, 100%);
  background: #ffffff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modal-pop 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-pop {
  from { transform: scale(0.94) translateY(16px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.alert-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--soft-line);
}

.alert-dialog-head h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--high);
}

.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: #f1f5f9;
  color: var(--muted);
  font-size: 1.4rem;
}

.icon-button:hover {
  background: #e2e8f0;
  color: var(--ink);
}

.alert-dialog-body {
  padding: 24px;
  max-height: 65vh;
  overflow-y: auto;
}

.alert-score-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px;
  background: #fef2f2;
  border: 1.5px solid #fecaca;
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
  text-align: center;
}

.alert-score-box span {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--high);
  text-transform: uppercase;
}

.alert-score-box strong {
  font-size: 3.6rem;
  font-weight: 800;
  color: var(--high);
  line-height: 1;
  margin: 4px 0 6px;
}

.alert-score-box em {
  font-style: normal;
  font-size: 1rem;
  font-weight: 800;
  color: var(--high);
}

.modal-recommendation {
  padding: 14px 18px;
  background: #f8fafc;
  border-radius: var(--radius-md);
  margin: 16px 0;
}

.modal-recommendation strong {
  display: block;
  font-size: 0.84rem;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.modal-recommendation p {
  margin: 0 0 6px;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ink);
}

.modal-recommendation span {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--teal-700);
}

.modal-alert-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-alert-list li {
  padding: 10px 14px;
  background: #fff5f5;
  border-left: 3px solid var(--high);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
  color: #991b1b;
}

.alert-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px 24px;
  background: #f8fafc;
  border-top: 1px solid var(--soft-line);
}

.alert-dialog-actions button {
  flex: 1 1 140px;
  min-height: 48px;
}

/* ==========================================================================
   Responsive Breakpoints & Mobile Optimization
   ========================================================================== */
@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  
  .result-panel {
    position: static;
  }

  .risk-guide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: calc(100% - 20px);
    padding: 14px 0 100px;
  }

  .topbar {
    grid-template-columns: 1fr;
    padding: 16px;
    margin-bottom: 12px;
  }

  .title-full {
    display: none;
  }

  .title-short {
    display: inline;
  }

  .status-card {
    display: none;
  }

  .notification-toolbar {
    margin-bottom: 14px;
  }

  .notif-panel {
    padding: 12px 14px;
  }

  .notification-action-group {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .notif-btn {
    justify-content: center;
    padding: 10px 6px;
    font-size: 0.82rem;
  }

  .patient-grid {
    grid-template-columns: 1fr;
  }

  .vital-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .vital-field {
    padding: 10px;
  }

  .vital-field input {
    height: 46px;
    font-size: 1.2rem;
  }

  .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .actions button {
    min-height: 48px;
    width: 100%;
  }

  .score-display {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .score-display div {
    min-height: 100px;
  }

  .risk-guide {
    grid-template-columns: 1fr;
  }

  .toast {
    bottom: calc(76px + env(safe-area-inset-bottom));
  }

  /* Sticky Floating Mobile Bar */
  .mobile-action-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 130px;
    gap: 12px;
    align-items: center;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid var(--line);
    box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(16px);
  }

  .mobile-action-bar div {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0 8px;
    align-items: center;
  }

  .mobile-action-bar span {
    font-size: 0.76rem;
    font-weight: 800;
    color: var(--muted);
  }

  .mobile-action-bar strong {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--teal-700);
    line-height: 1;
  }

  .mobile-action-bar em {
    grid-column: 1 / -1;
    font-style: normal;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--ink-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-action-bar button {
    min-height: 48px;
    font-size: 1rem;
  }

  /* Bottom sheet modal on mobile */
  .alert-modal {
    align-items: flex-end;
    padding: 0;
  }

  .alert-dialog {
    width: 100%;
    max-height: 88vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }

  .alert-dialog-actions {
    flex-direction: column;
  }
}

/* Print Optimization */
@media print {
  body {
    background: #ffffff;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .notification-toolbar,
  .form-panel,
  .guide-panel,
  .history-panel,
  .actions,
  .history-actions,
  .toast,
  .alert-banner,
  .mobile-action-bar,
  .alert-modal {
    display: none !important;
  }

  .topbar,
  .workspace {
    display: block;
  }

  .panel, .status-card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}
/* ==========================================================================
   Reporter & Staff Member System
   ========================================================================== */
.reporter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal-600);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.reporter-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 280px;
}

.reporter-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--teal-50);
  border: 1.5px solid var(--teal-200);
  font-size: 1.3rem;
  color: var(--teal-700);
  flex-shrink: 0;
}

.reporter-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.reporter-badge {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  background: var(--teal-50);
  color: var(--teal-700);
  border-radius: var(--radius-full);
  border: 1px solid var(--teal-200);
}

.reporter-title-row strong {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--ink);
}

.reporter-meta {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.reporter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--teal-50);
  color: var(--teal-700);
  border: 1.5px solid var(--teal-200);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 700;
  transition: var(--transition);
}

.reporter-btn:hover {
  background: var(--teal-100);
  border-color: var(--teal-400);
}

/* Profile Modal Dialog */
.profile-modal {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.profile-modal[hidden] {
  display: none !important;
}

.profile-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
}

.profile-dialog {
  position: relative;
  width: min(520px, 100%);
  background: #ffffff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modal-pop 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--soft-line);
}

.profile-dialog-head h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink);
}

.profile-dialog-body {
  padding: 24px;
  max-height: 70vh;
  overflow-y: auto;
}

.profile-form-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 0 16px;
  padding: 0;
  border: none;
}

.profile-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.profile-form-actions {
  display: flex;
  margin-bottom: 20px;
}

.profile-form-actions button {
  width: 100%;
}

.saved-profiles-section {
  padding-top: 16px;
  border-top: 1px solid var(--soft-line);
}

.saved-profiles-section h3 {
  margin: 0 0 12px;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--ink-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.saved-profiles-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.profile-card.active {
  background: var(--teal-50);
  border-color: var(--teal-400);
}

.profile-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-card-info strong {
  font-size: 0.94rem;
  font-weight: 800;
  color: var(--ink);
}

.profile-card-info span {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.profile-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.active-pill {
  padding: 3px 10px;
  background: var(--teal-600);
  color: #ffffff;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 800;
}

.switch-profile-btn {
  padding: 4px 10px;
  background: #ffffff;
  color: var(--teal-700);
  border: 1px solid var(--teal-300);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
}

.switch-profile-btn:hover {
  background: var(--teal-50);
}

.delete-profile-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  color: var(--muted);
  font-size: 0.9rem;
}

.delete-profile-btn:hover {
  background: #fee2e2;
  color: var(--high);
}

.muted-profile {
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
  padding: 12px;
}

.reporter-tag {
  display: inline-block;
  margin-top: 2px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--teal-700);
}

/* Profile Onboarding Banner & Mandatory Mode */
.profile-onboarding-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px 16px;
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  border-left: 4px solid #2563eb;
  border-radius: var(--radius-md);
  color: #1e3a8a;
}

.profile-onboarding-banner[hidden] {
  display: none !important;
}

.profile-onboarding-banner .onboarding-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.profile-onboarding-banner strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 2px;
}

.profile-onboarding-banner p {
  margin: 0;
  font-size: 0.82rem;
  color: #1d4ed8;
  line-height: 1.4;
}

.profile-modal.mandatory-mode .profile-backdrop {
  backdrop-filter: blur(12px);
  background: rgba(15, 23, 42, 0.75);
}

.profile-modal.mandatory-mode #closeProfileBtn {
  display: none !important;
}

/* Header settings menu (gear) */
.org-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.org-bar-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.org-bar-badge {
  padding: 3px 10px;
  background: var(--teal-50);
  border: 1px solid var(--teal-200);
  border-radius: var(--radius-full);
  color: var(--teal-700);
  font-size: 0.74rem;
  font-weight: 800;
}

.settings-menu {
  position: relative;
  flex-shrink: 0;
}

.settings-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
  cursor: pointer;
  list-style: none;
  font-size: 1.15rem;
  transition: var(--transition);
}

.settings-trigger::-webkit-details-marker {
  display: none;
}

.settings-trigger:hover,
.settings-menu[open] .settings-trigger {
  background: var(--teal-50);
  border-color: var(--teal-300);
}

.settings-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: min(330px, calc(100vw - 32px));
  max-height: min(70vh, 560px);
  overflow-y: auto;
  padding: 6px 0;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.settings-group {
  padding: 14px 16px;
  border-bottom: 1px solid var(--soft-line);
}

.settings-group:last-child {
  border-bottom: none;
}

.settings-group-title {
  margin: 0 0 8px;
  color: var(--teal-700);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.settings-line {
  display: block;
  margin: 0;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
}

.settings-sub {
  margin: 2px 0 10px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
  word-break: break-word;
}

.settings-panel .notification-action-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.settings-panel .notif-btn {
  justify-content: center;
  padding: 9px 6px;
  font-size: 0.8rem;
  text-align: center;
}
