/* TriageOS -- Clinical Decision Support */
/* AES-256-GCM encrypted · Offline-first · WHO IMCI-referenced */

:root {
  --bg: #060e0b;
  --bg2: #0d1a14;
  --bg3: #111f18;
  --surface: #162118;
  --surface2: #1c2b20;
  --border: #243028;
  --border2: #2e3e34;
  --accent: #2ecc71;
  --accent2: #27ae60;
  --accent-dim: rgba(46,204,113,0.12);
  --accent-dim2: rgba(46,204,113,0.06);
  --warn: #e67e22;
  --danger: #e74c3c;
  --danger-dim: rgba(231,76,60,0.12);
  --warn-dim: rgba(230,126,34,0.12);
  --text: #d8ede2;
  --text2: #8aab97;
  --text3: #5a7a68;
  --mono: 'Courier New', Courier, monospace;
  --sans: Georgia, 'Times New Roman', serif;
  --ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 4px;
  --radius2: 8px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4 { font-family: var(--sans); font-weight: normal; color: var(--text); }
h1 { font-size: clamp(1.8rem, 5vw, 3rem); line-height: 1.15; }
h2 { font-size: clamp(1.2rem, 3vw, 1.8rem); }
h3 { font-size: 1rem; letter-spacing: 0.05em; }
p { color: var(--text2); line-height: 1.7; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text3);
}

.mono { font-family: var(--mono); }

/* ===== LAYOUT ===== */
.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px;
}

.section { padding: 80px 0; }
.section-sm { padding: 40px 0; }

/* ===== HEADER ===== */
#site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(6,14,11,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: bold;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.logo-mark {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.logo-sub {
  color: var(--text3);
  font-size: 10px;
  font-weight: normal;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-ghost {
  background: none;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text2);
  font-size: 11px;
  padding: 5px 10px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--mono);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-primary {
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--bg);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--mono);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary:hover { background: var(--accent2); border-color: var(--accent2); text-decoration: none; color: var(--bg); }

.btn-danger {
  background: var(--danger);
  border: 1px solid var(--danger);
  color: #fff;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 700;
  padding: 6px 14px;
  cursor: pointer;
  font-family: var(--mono);
}

.lang-toggle {
  display: flex;
  gap: 2px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2px;
  border: 1px solid var(--border);
}
.lang-btn {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 11px;
  padding: 3px 8px;
  cursor: pointer;
  border-radius: 2px;
  font-family: var(--mono);
  transition: all 0.15s;
}
.lang-btn.active { background: var(--accent); color: var(--bg); }

/* ===== NOTICE BAR ===== */
#notice-bar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 6px 20px;
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text3);
}

/* ===== HERO ===== */
#hero {
  padding: 80px 0 60px;
  border-bottom: 1px solid var(--border);
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-dim);
  border: 1px solid rgba(46,204,113,0.25);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 11px;
  color: var(--accent);
  font-family: var(--mono);
  margin-bottom: 24px;
  letter-spacing: 0.05em;
}
.hero-tag .dot {
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.hero-title { margin-bottom: 20px; }
.hero-desc { max-width: 560px; font-size: 15px; color: var(--text2); margin-bottom: 32px; }
.hero-draft {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: var(--radius);
  display: inline-block;
  margin-bottom: 28px;
}

.hero-btns { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 48px; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  overflow: hidden;
  max-width: 600px;
}
.hero-stat {
  background: var(--surface);
  padding: 16px 20px;
  text-align: center;
}
.hero-stat .val {
  font-family: var(--mono);
  font-size: 1.6rem;
  color: var(--accent);
  display: block;
  line-height: 1;
}
.hero-stat .lbl {
  font-size: 10px;
  color: var(--text3);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ===== FEATURES GRID ===== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  overflow: hidden;
  margin-top: 40px;
}
.feature-card {
  background: var(--surface);
  padding: 24px;
  transition: background 0.2s;
}
.feature-card:hover { background: var(--surface2); }
.feature-icon {
  font-size: 18px;
  margin-bottom: 10px;
  color: var(--accent);
  font-family: var(--mono);
}
.feature-card h4 { font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); font-family: var(--ui); }
.feature-card p { font-size: 12px; }

/* ===== STATS SECTION ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  overflow: hidden;
  margin: 40px 0;
}
.stat-block {
  background: var(--surface);
  padding: 32px 24px;
  text-align: center;
}
.stat-block .num {
  font-family: var(--mono);
  font-size: 2.5rem;
  color: var(--accent);
  line-height: 1;
  display: block;
}
.stat-block .stat-desc {
  font-size: 12px;
  color: var(--text3);
  margin-top: 6px;
}

/* ===== HOW IT WORKS ===== */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 40px; }
.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 24px;
}
.step-num {
  font-family: var(--mono);
  font-size: 2rem;
  color: var(--border2);
  line-height: 1;
  margin-bottom: 12px;
}
.step h3 { font-family: var(--ui); font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.step p { font-size: 12px; }

/* ===== COMPARISON TABLE ===== */
.comparison-table { width: 100%; border-collapse: collapse; margin-top: 32px; }
.comparison-table th, .comparison-table td {
  padding: 12px 16px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.comparison-table th {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: normal;
  letter-spacing: 0.05em;
  color: var(--text3);
  background: var(--surface);
}
.comparison-table th:first-child, .comparison-table td:first-child { text-align: left; }
.comparison-table tr:hover td { background: var(--accent-dim2); }
.comparison-table .triageos-col { color: var(--accent); font-weight: 600; }
.check { color: var(--accent); }
.cross { color: var(--text3); }
.partial { color: var(--warn); }

/* ===== APP SHELL ===== */
#app-shell {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  flex-direction: column;
  overflow: hidden;
}
#app-shell.active { display: flex; }

#app-header {
  height: 48px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text2);
}

.conn-badge {
  font-family: var(--mono);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.08em;
}
.conn-badge.offline { background: var(--warn-dim); color: var(--warn); border: 1px solid rgba(230,126,34,0.3); }
.conn-badge.online { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(46,204,113,0.3); }

#app-nav {
  display: flex;
  gap: 2px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
  overflow-x: auto;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
}
#app-nav::-webkit-scrollbar { display: none; }

.nav-btn {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 11px;
  padding: 10px 12px;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  font-family: var(--mono);
  letter-spacing: 0.05em;
  transition: all 0.15s;
}
.nav-btn:hover { color: var(--text2); }
.nav-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

#app-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.panel { display: none; padding: 20px; }
.panel.active { display: block; }

/* ===== PANEL HEADER ===== */
.panel-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 16px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-title { font-size: 14px; font-weight: 600; color: var(--text); }
.panel-sub { font-size: 11px; color: var(--text3); margin-top: 3px; font-family: var(--mono); }
.panel-badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.badge {
  font-family: var(--mono);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.06em;
}
.badge-offline { background: var(--warn-dim); color: var(--warn); border: 1px solid rgba(230,126,34,0.3); }
.badge-enc { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(46,204,113,0.3); }
.badge-proto { background: var(--surface2); color: var(--text2); border: 1px solid var(--border2); }

/* ===== TRIAGE PROTOCOL STATUS BAR ===== */
.proto-status {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  overflow: hidden;
  margin-bottom: 16px;
}
.proto-stat {
  background: var(--surface);
  padding: 12px 16px;
  text-align: center;
}
.proto-stat .val {
  font-family: var(--mono);
  font-size: 1.3rem;
  color: var(--text);
  display: block;
}
.proto-stat .lbl { font-size: 10px; color: var(--text3); margin-top: 2px; }

/* ===== STEP CARD ===== */
.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 20px;
  margin-bottom: 12px;
}
.step-label { font-family: var(--mono); font-size: 10px; color: var(--text3); margin-bottom: 10px; letter-spacing: 0.1em; }
.step-question { font-size: 15px; color: var(--text); font-weight: 600; margin-bottom: 6px; }
.step-hint { font-size: 12px; color: var(--text3); margin-bottom: 16px; line-height: 1.5; }

/* ===== CHOICE BUTTONS ===== */
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice-btn {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text2);
  font-size: 13px;
  padding: 12px 16px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  font-family: var(--ui);
  line-height: 1.4;
}
.choice-btn:hover { border-color: var(--accent); color: var(--text); background: var(--accent-dim); }
.choice-btn.selected { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.choice-btn.danger-choice { border-color: rgba(231,76,60,0.4); color: var(--text2); }
.choice-btn.danger-choice:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-dim); }
.choice-btn.danger-choice.selected { border-color: var(--danger); color: var(--danger); background: var(--danger-dim); }

/* ===== TIMER ===== */
.timer-wrap {
  background: var(--bg);
  border: 2px solid var(--border2);
  border-radius: var(--radius2);
  padding: 24px;
  text-align: center;
  margin-bottom: 12px;
}
.timer-display {
  font-family: var(--mono);
  font-size: 3rem;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
  transition: color 0.3s;
}
.timer-display.urgent { color: var(--danger); }
.timer-label { font-size: 11px; color: var(--text3); margin-bottom: 16px; }
.timer-sub { font-size: 12px; color: var(--text2); margin-bottom: 16px; }

/* ===== OUTCOME CARDS ===== */
.outcome-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius2);
  padding: 24px;
  margin-bottom: 12px;
}
.outcome-card.refer { border-color: var(--danger); background: var(--danger-dim); }
.outcome-card.manage { border-color: var(--accent); background: var(--accent-dim); }
.outcome-card.unlikely { border-color: var(--border2); }
.outcome-card.urgent { border-color: var(--danger); background: var(--danger-dim); }
.outcome-card.treat { border-color: var(--accent); background: var(--accent-dim); }

.outcome-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}
.outcome-card.refer .outcome-title,
.outcome-card.urgent .outcome-title { color: var(--danger); }
.outcome-card.manage .outcome-title,
.outcome-card.treat .outcome-title { color: var(--accent); }

.outcome-why {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 12px 0;
}
.outcome-why-label { font-family: var(--mono); font-size: 10px; color: var(--text3); margin-bottom: 6px; }
.outcome-why-text { font-size: 13px; color: var(--text2); line-height: 1.5; }

.next-steps {
  font-size: 12px;
  color: var(--text3);
  margin-top: 12px;
  line-height: 1.7;
}
.next-steps span { display: block; }

/* ===== FORM FIELDS ===== */
.field-group { margin-bottom: 16px; }
.field-group label {
  display: block;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text3);
  margin-bottom: 6px;
  letter-spacing: 0.08em;
}
.field-group input,
.field-group textarea,
.field-group select {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  padding: 10px 12px;
  outline: none;
  font-family: var(--ui);
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
.field-group input:focus,
.field-group textarea:focus,
.field-group select:focus { border-color: var(--accent); }
.field-group select { cursor: pointer; background-image: none; }
.field-group textarea { resize: vertical; min-height: 72px; }

/* ===== RECORDS COUNTER ===== */
.records-badge {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
  text-align: center;
  padding: 8px;
}

/* ===== DASHBOARD ===== */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  overflow: hidden;
  margin-bottom: 16px;
}
.dash-stat {
  background: var(--surface);
  padding: 16px 12px;
  text-align: center;
}
.dash-stat .num {
  font-family: var(--mono);
  font-size: 1.8rem;
  color: var(--accent);
  display: block;
  line-height: 1;
}
.dash-stat .denom {
  font-size: 10px;
  color: var(--text3);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dash-section { margin-bottom: 16px; }
.dash-section-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--text3);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.alert-list { display: flex; flex-direction: column; gap: 6px; }
.alert-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text2);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-item.pending { color: var(--text3); font-style: italic; }
.alert-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.alert-dot.green { background: var(--accent); }
.alert-dot.orange { background: var(--warn); }
.alert-dot.red { background: var(--danger); }

.triage-table { width: 100%; border-collapse: collapse; }
.triage-table th, .triage-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.triage-table th { font-family: var(--mono); font-size: 10px; color: var(--text3); letter-spacing: 0.08em; background: var(--surface); }
.triage-table td { color: var(--text2); }
.outcome-pill {
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  display: inline-block;
}
.outcome-pill.refer { background: var(--danger-dim); color: var(--danger); }
.outcome-pill.manage { background: var(--accent-dim); color: var(--accent); }
.outcome-pill.unlikely { background: var(--surface2); color: var(--text3); }
.outcome-pill.treat { background: var(--accent-dim); color: var(--accent); }
.outcome-pill.urgent { background: var(--danger-dim); color: var(--danger); }

/* ===== PROTOCOLS ===== */
.protocol-list { display: grid; gap: 8px; }
.protocol-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.protocol-item.available { cursor: pointer; transition: background 0.15s; }
.protocol-item.available:hover { background: var(--surface2); border-color: var(--border2); }
.proto-info h4 { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; font-family: var(--ui); }
.proto-info .proto-meta { font-family: var(--mono); font-size: 10px; color: var(--text3); }
.proto-status-pill {
  font-family: var(--mono);
  font-size: 10px;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
.proto-status-pill.active { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(46,204,113,0.3); }
.proto-status-pill.soon { background: var(--surface2); color: var(--text3); border: 1px solid var(--border); }

/* ===== ASSESSMENT ===== */
.assessment-grid { display: grid; gap: 12px; }

.assessment-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  overflow: hidden;
}
.assessment-card-header {
  padding: 12px 16px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.assessment-card-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text2);
  font-weight: 600;
}
.assessment-card-body { padding: 16px; }

/* AVPU scale */
.avpu-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.avpu-btn {
  background: var(--bg2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.avpu-btn:hover { border-color: var(--border2); }
.avpu-btn.selected { border-color: var(--accent); background: var(--accent-dim); }
.avpu-btn.danger-level { border-color: rgba(231,76,60,0.3); }
.avpu-btn.danger-level.selected { border-color: var(--danger); background: var(--danger-dim); }
.avpu-letter { font-family: var(--mono); font-size: 1.5rem; color: var(--text); line-height: 1; margin-bottom: 4px; }
.avpu-word { font-size: 10px; color: var(--text3); }
.avpu-btn.selected .avpu-letter { color: var(--accent); }
.avpu-btn.danger-level.selected .avpu-letter { color: var(--danger); }
.avpu-note { margin-top: 8px; font-size: 11px; color: var(--text3); font-family: var(--mono); }

/* CRT */
.crt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.crt-option {
  background: var(--bg2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.crt-option:hover { border-color: var(--border2); }
.crt-option.selected { border-color: var(--accent); background: var(--accent-dim); }
.crt-option.danger { border-color: rgba(231,76,60,0.3); }
.crt-option.danger.selected { border-color: var(--danger); background: var(--danger-dim); }
.crt-val { font-family: var(--mono); font-size: 1.2rem; margin-bottom: 4px; }
.crt-desc { font-size: 11px; color: var(--text3); }

/* MUAC */
.muac-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.muac-option {
  background: var(--bg2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.muac-option:hover { border-color: var(--border2); }
.muac-option.selected.ok { border-color: var(--accent); background: var(--accent-dim); }
.muac-option.selected.moderate { border-color: var(--warn); background: var(--warn-dim); }
.muac-option.selected.severe { border-color: var(--danger); background: var(--danger-dim); }
.muac-range { font-family: var(--mono); font-size: 11px; color: var(--text); margin-bottom: 4px; }
.muac-status { font-size: 11px; color: var(--text3); }

/* Assessment summary */
.assessment-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 16px;
  margin-top: 12px;
}
.summary-title { font-family: var(--mono); font-size: 11px; color: var(--text3); letter-spacing: 0.1em; margin-bottom: 12px; }
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.summary-row:last-child { border-bottom: none; }
.summary-key { color: var(--text3); font-family: var(--mono); }
.summary-val { color: var(--text); font-family: var(--mono); }
.summary-val.danger { color: var(--danger); }
.summary-val.ok { color: var(--accent); }
.summary-val.warn { color: var(--warn); }

.danger-indicators {
  background: var(--danger-dim);
  border: 1px solid rgba(231,76,60,0.3);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-top: 12px;
}
.danger-label { font-family: var(--mono); font-size: 10px; color: var(--danger); letter-spacing: 0.1em; margin-bottom: 8px; }
.danger-list { font-size: 12px; color: var(--text2); line-height: 1.7; }
.no-danger { font-size: 12px; color: var(--text3); font-style: italic; }

/* Save confirm */
.save-confirm {
  background: var(--accent-dim);
  border: 1px solid rgba(46,204,113,0.3);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  margin-top: 8px;
  display: none;
  text-align: center;
}
.save-confirm.visible { display: block; }

/* ===== OUTBREAK ===== */
.outbreak-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  overflow: hidden;
  margin-bottom: 16px;
}
.outbreak-stat {
  background: var(--surface);
  padding: 16px 12px;
  text-align: center;
}
.outbreak-stat .num {
  font-family: var(--mono);
  font-size: 1.8rem;
  color: var(--accent);
  display: block;
  line-height: 1;
}
.outbreak-stat .denom { font-size: 10px; color: var(--text3); margin-top: 4px; }

.chart-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 16px;
  margin-bottom: 12px;
  min-height: 120px;
}
.chart-title { font-family: var(--mono); font-size: 10px; color: var(--text3); letter-spacing: 0.1em; margin-bottom: 12px; }
.chart-bars { display: flex; gap: 6px; align-items: flex-end; height: 80px; }
.chart-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.chart-bar {
  width: 100%;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  opacity: 0.7;
  transition: height 0.3s ease;
}
.chart-bar-label { font-size: 9px; color: var(--text3); font-family: var(--mono); }

.pattern-alert {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 16px;
  margin-bottom: 12px;
}
.pattern-status { font-family: var(--mono); font-size: 11px; color: var(--text3); margin-bottom: 8px; letter-spacing: 0.08em; }
.pattern-msg { font-size: 12px; color: var(--text3); font-style: italic; }
.pattern-msg.active { color: var(--warn); font-style: normal; }

/* ===== COGNITIVE LOAD INDEX (NEW - replaces camera rPPG) ===== */
.cli-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 20px;
  margin-bottom: 12px;
}
.cli-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.cli-title { font-family: var(--mono); font-size: 11px; color: var(--text3); letter-spacing: 0.1em; }
.cli-badge {
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(46,204,113,0.25);
}
.cli-score-wrap { text-align: center; margin: 16px 0; }
.cli-score {
  font-family: var(--mono);
  font-size: 3rem;
  color: var(--accent);
  line-height: 1;
}
.cli-score.moderate { color: var(--warn); }
.cli-score.high { color: var(--danger); }
.cli-score-label { font-size: 11px; color: var(--text3); margin-top: 4px; }
.cli-bar-track {
  height: 6px;
  background: var(--bg2);
  border-radius: 3px;
  overflow: hidden;
  margin: 12px 0;
}
.cli-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.5s ease, background 0.5s ease;
}
.cli-factors { display: grid; gap: 6px; margin-top: 12px; }
.cli-factor {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.cli-factor:last-child { border-bottom: none; }
.cli-factor-name { color: var(--text3); font-family: var(--mono); font-size: 11px; }
.cli-factor-val { color: var(--text2); font-family: var(--mono); font-size: 11px; }
.cli-source {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 11px;
  color: var(--text3);
  margin-top: 12px;
  line-height: 1.6;
}
.cli-source a { color: var(--accent); }

/* ===== ABOUT ===== */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.about-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 20px;
}
.about-card h3 { font-family: var(--ui); font-size: 13px; font-weight: 600; margin-bottom: 12px; color: var(--text); }
.about-meta-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.about-meta-row:last-child { border-bottom: none; }
.about-meta-key { color: var(--text3); font-family: var(--mono); font-size: 11px; }
.about-meta-val { color: var(--text2); font-size: 12px; }

.privacy-list { display: grid; gap: 4px; margin-top: 8px; }
.privacy-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.privacy-row:last-child { border-bottom: none; }
.privacy-key { color: var(--text3); font-family: var(--mono); font-size: 11px; }
.privacy-val { color: var(--accent); font-family: var(--mono); font-size: 11px; }

.roadmap-list { display: grid; gap: 6px; margin-top: 8px; }
.roadmap-item {
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: var(--text2);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.roadmap-item:last-child { border-bottom: none; }
.roadmap-plus { color: var(--accent); font-family: var(--mono); flex-shrink: 0; }

/* ===== SESSION MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6,14,11,0.9);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; }
.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius2);
  padding: 28px;
  width: 100%;
  max-width: 380px;
}
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.modal-sub { font-size: 12px; color: var(--text3); margin-bottom: 20px; }
.modal-close {
  position: absolute;
  top: 12px; right: 14px;
  background: none;
  border: none;
  color: var(--text3);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.modal-privacy { font-size: 11px; color: var(--text3); text-align: center; margin-top: 12px; }

/* ===== INSTALL TOAST ===== */
#install-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius2);
  padding: 14px 18px;
  z-index: 400;
  display: none;
  align-items: center;
  gap: 12px;
  max-width: 300px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
#install-toast.active { display: flex; }
.toast-text { font-size: 12px; color: var(--text2); }
.toast-text strong { color: var(--text); display: block; font-size: 13px; margin-bottom: 2px; }
.toast-dismiss { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 16px; flex-shrink: 0; }

/* ===== SECTION HEADERS ===== */
.section-header { margin-bottom: 40px; }
.section-tag { font-family: var(--mono); font-size: 11px; color: var(--text3); letter-spacing: 0.15em; margin-bottom: 10px; text-transform: uppercase; }
.section-title { margin-bottom: 10px; }
.section-desc { color: var(--text2); max-width: 560px; }

/* ===== FOOTER ===== */
#site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  margin-top: 40px;
}
.footer-grid { display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: start; }
.footer-copy { font-size: 12px; color: var(--text3); margin-top: 8px; }
.footer-links { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text3); }

/* ===== RESPONSIVE ===== */
@media (max-width: 720px) {
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
  .triage-table th:nth-child(3),
  .triage-table td:nth-child(3) { display: none; }
  .footer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .avpu-grid { grid-template-columns: repeat(2, 1fr); }
  .muac-grid { grid-template-columns: repeat(3, 1fr); }
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== RESPONSIVE TABLE WRAPPER ===== */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius2);
}
.table-responsive .comparison-table {
  min-width: 560px;
  border: none;
}
.table-responsive .comparison-table th:first-child,
.table-responsive .comparison-table td:first-child {
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 1;
}

/* ===== CHART EMPTY STATE ===== */
.chart-empty {
  color: var(--text3);
  font-size: 12px;
  align-self: center;
  font-style: italic;
}

/* ===== MUAC COLOR MODIFIERS ===== */
.muac-option.ok.selected { border-color: var(--accent); background: var(--accent-dim); }
.muac-option.moderate.selected { border-color: var(--warn); background: var(--warn-dim); }
.muac-option.severe.selected { border-color: var(--danger); background: var(--danger-dim); }

/* ===== TAP PATHWAY ===== */
.tap-pathway {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text3);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ===== HIDDEN UTILITY ===== */
.hidden { display: none !important; }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-warn { color: var(--warn); }
.text-muted { color: var(--text3); }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }

/* ===== TRANSLATIONS (hidden by default) ===== */
[data-lang="el"] { display: none; }
body.lang-el [data-lang="en"] { display: none; }
body.lang-el [data-lang="el"] { display: initial; }
body.lang-el span[data-lang="el"] { display: inline; }
body.lang-el div[data-lang="el"] { display: block; }
