:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-border: #c7d2fe;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --bg: #f8fafc;
  --surface: #ffffff;
  --ok: #059669;
  --ok-light: #ecfdf5;
  --ok-border: #a7f3d0;
  --warn: #d97706;
  --warn-light: #fffbeb;
  --warn-border: #fde68a;
  --bad: #dc2626;
  --bad-light: #fef2f2;
  --bad-border: #fecaca;
  --p: var(--primary);
  --escape: #0284c7;
  --escape-light: #f0f9ff;
  --escape-border: #bae6fd;
  --attention: #d97706;
  --attention-light: #fffbeb;
  --attention-border: #fde68a;
  --tangible: #059669;
  --tangible-light: #ecfdf5;
  --tangible-border: #a7f3d0;
  --sensory: #7c3aed;
  --sensory-light: #f5f3ff;
  --sensory-border: #ddd6fe;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--slate-800);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

/* Layout */
.layout {
  display: flex;
  min-height: 100vh;
}

nav {
  width: 250px;
  background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
  color: #fff;
  padding: 24px 16px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 20;
}

.brand-wrapper {
  margin-bottom: 24px;
  padding: 0 8px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #f8fafc;
  line-height: 1.2;
}

.brand-sub {
  font-size: 0.72rem;
  color: #94a3b8;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #cbd5e1;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

nav a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

nav a.on {
  color: #ffffff;
  background: linear-gradient(90deg, rgba(79, 70, 229, 0.4) 0%, rgba(79, 70, 229, 0.15) 100%);
  border-color: rgba(99, 102, 241, 0.4);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.nav-user {
  margin-top: auto;
  padding: 14px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
}

.nav-user-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
}

.user-info-name {
  font-weight: 600;
  color: #f1f5f9;
  line-height: 1.2;
}

.user-role-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
}

.nav-logout {
  display: block;
  margin-top: 10px;
  padding: 6px 10px;
  text-align: center;
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.nav-logout:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* Main Area */
main {
  flex: 1;
  padding: 32px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

h1 {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--slate-900);
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}

.page-sub {
  font-size: 0.88rem;
  color: var(--slate-500);
  margin: 0;
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--slate-200);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  border-color: #cbd5e1;
}

.card h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--slate-900);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card h4 {
  margin: 0 0 10px;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--slate-800);
}

/* Grid & Layouts */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  opacity: 0.8;
}

.stat-card.ok::before { background: var(--ok); }
.stat-card.warn::before { background: var(--warn); }
.stat-card.esc::before { background: var(--escape); }

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.stat {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--slate-900);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.stat-sub {
  font-size: 0.78rem;
  color: var(--slate-500);
  margin-top: 6px;
}

/* Buttons */
button, .btn {
  background: var(--primary);
  color: #fff;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 9px 16px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

button:hover, .btn:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow);
}

button:active, .btn:active {
  transform: scale(0.98);
}

button.sec, .btn.sec {
  background: var(--slate-100);
  color: var(--slate-700);
  border-color: var(--slate-200);
  box-shadow: none;
}

button.sec:hover, .btn.sec:hover {
  background: var(--slate-200);
  color: var(--slate-900);
}

button.ok, .btn.ok {
  background: var(--ok);
  color: #fff;
}
button.ok:hover, .btn.ok:hover {
  background: #047857;
}

button.bad, .btn.bad {
  background: var(--bad);
  color: #fff;
}
button.bad:hover, .btn.bad:hover {
  background: #b91c1c;
}

button.warn, .btn.warn {
  background: var(--warn);
  color: #fff;
}
button.warn:hover, .btn.warn:hover {
  background: #b45309;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Form Controls */
input, select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 0.92rem;
  color: var(--slate-800);
  background-color: #fff;
  margin: 4px 0 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--slate-600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.row > * {
  flex: 1;
  min-width: 180px;
}

/* Tables */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 8px;
}

th {
  background: var(--slate-50);
  color: var(--slate-500);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--slate-200);
}

th:first-child { border-top-left-radius: var(--radius-sm); }
th:last-child { border-top-right-radius: var(--radius-sm); }

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--slate-100);
  font-size: 0.9rem;
  color: var(--slate-700);
  vertical-align: middle;
}

tr:hover td {
  background: var(--slate-50);
}

/* Tags & Badges */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: capitalize;
}

.tag.draft {
  background: var(--warn-light);
  color: var(--warn);
  border: 1px solid var(--warn-border);
}

.tag.pending_approval {
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #ffedd5;
}

.tag.approved, .tag.signed {
  background: var(--ok-light);
  color: var(--ok);
  border: 1px solid var(--ok-border);
}

.tag.shared {
  background: var(--escape-light);
  color: var(--escape);
  border: 1px solid var(--escape-border);
}

.tag.bad {
  background: var(--bad-light);
  color: var(--bad);
  border: 1px solid var(--bad-border);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--slate-100);
  color: var(--slate-700);
  border: 1px solid var(--slate-200);
}

.badge.p {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}

.badge.esc {
  background: var(--escape-light);
  color: var(--escape);
  border-color: var(--escape-border);
}

.badge.att {
  background: var(--attention-light);
  color: var(--attention);
  border-color: var(--attention-border);
}

.badge.tan {
  background: var(--tangible-light);
  color: var(--tangible);
  border-color: var(--tangible-border);
}

.badge.sen {
  background: var(--sensory-light);
  color: var(--sensory);
  border-color: var(--sensory-border);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  padding: 4px;
  background: var(--slate-100);
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
}

.tabs button {
  background: transparent;
  color: var(--slate-600);
  border: 0;
  box-shadow: none;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.tabs button:hover {
  color: var(--slate-900);
  background: rgba(255, 255, 255, 0.6);
}

.tabs button.on {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

/* Unified Clinical Vitals Banner */
.vitals-banner {
  background: #ffffff;
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: 24px;
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.vitals-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #4f46e5 0%, #06b6d4 50%, #10b981 100%);
}

.vitals-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--slate-100);
}

.vitals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.vital-item {
  background: var(--slate-50);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
  font-size: 0.88rem;
}

.vital-label {
  font-weight: 700;
  color: var(--slate-500);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.vital-item b {
  color: var(--slate-800);
  font-size: 0.95rem;
}

.crisis-box {
  background: var(--bad-light);
  border: 1px solid var(--bad-border);
  color: #991b1b;
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-top: 16px;
  animation: slideDown 0.2s ease;
}

/* ABC Matrix */
.abc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.abc-metric {
  background: #ffffff;
  padding: 14px;
  border-radius: var(--radius-md);
  text-align: center;
  border: 1px solid var(--slate-200);
  border-top: 4px solid var(--primary);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.abc-metric:hover {
  transform: translateY(-2px);
}

.abc-metric.Escape { border-top-color: var(--escape); }
.abc-metric.Attention { border-top-color: var(--attention); }
.abc-metric.Tangible { border-top-color: var(--tangible); }
.abc-metric.Sensory { border-top-color: var(--sensory); }

.abc-metric h4, .abc-metric .abc-num {
  font-size: 1.8rem;
  font-weight: 800;
  margin: 0;
  color: var(--slate-900);
}

.abc-metric small, .abc-metric b {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate-500);
}

/* Active Session Cockpit */
.cockpit-banner {
  background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
  color: #fff;
  border-radius: var(--radius-xl);
  padding: 24px;
  margin-bottom: 24px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.big {
  font-size: 3.2rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: #f8fafc;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  margin-bottom: 4px;
}

.units-pill {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 9999px;
  background: rgba(99, 102, 241, 0.3);
  border: 1px solid rgba(165, 180, 252, 0.3);
  color: #e0e7ff;
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 16px;
}

/* Ergonomic Prompt Buttons for Handheld Tablets */
.levels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.levels button {
  padding: 16px 20px;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 2px solid transparent;
  background: var(--slate-50);
  color: var(--slate-800);
  box-shadow: var(--shadow-sm);
  transition: all 0.12s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 60px;
}

.levels button:hover {
  background: #ffffff;
  border-color: var(--slate-300);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

.levels button.ok {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  color: #065f46;
  border-color: #a7f3d0;
}
.levels button.ok:hover {
  background: #a7f3d0;
  color: #064e3b;
}

.levels button.bad {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  color: #991b1b;
  border-color: #fecaca;
}
.levels button.bad:hover {
  background: #fecaca;
  color: #7f1d1d;
}

.levels button.btn-m {
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  color: #5b21b6;
  border-color: #ddd6fe;
}
.levels button.btn-m:hover {
  background: #ddd6fe;
}

.levels button.btn-v {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  color: #0369a1;
  border-color: #bae6fd;
}
.levels button.btn-v:hover {
  background: #bae6fd;
}

.levels button.btn-g {
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  color: #3730a3;
  border-color: #c7d2fe;
}
.levels button.btn-g:hover {
  background: #c7d2fe;
}

.levels button.btn-p {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  color: #92400e;
  border-color: #fde68a;
}
.levels button.btn-p:hover {
  background: #fde68a;
}

.bar {
  height: 18px;
  background: var(--slate-100);
  border-radius: 9999px;
  overflow: hidden;
  margin: 4px 0 10px;
  border: 1px solid var(--slate-200);
}

.bar > div {
  height: 100%;
  background: linear-gradient(90deg, #6366f1 0%, #4f46e5 100%);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* Modals & Dialogs */
.modal-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
  animation: fadeIn 0.15s ease-out;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-xl);
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 26px;
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(255, 255, 255, 0.5);
  animation: modalScale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Login Card */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top left, #1e1b4b 0%, #0f172a 100%);
  padding: 20px;
}

.login-box {
  background: #ffffff;
  border-radius: var(--radius-xl);
  padding: 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.demo-pills {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--slate-100);
}

.demo-pill {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  color: var(--slate-600);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s ease;
}

.demo-pill:hover {
  background: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--primary);
}

/* Social Story Sentences */
.sentence {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}

.sentence .ic {
  font-size: 1.8rem;
  flex-shrink: 0;
}

/* Drawer & Collapsible */
.drawer {
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  background: var(--slate-50);
  padding: 14px 18px;
  margin: 14px 0;
  transition: background 0.15s ease;
}

.drawer summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--slate-800);
  user-select: none;
}

.drawer[open] {
  background: #ffffff;
  border-color: var(--primary-border);
  box-shadow: var(--shadow-sm);
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.err {
  color: var(--bad);
  font-size: 0.85rem;
  margin: 8px 0;
  font-weight: 600;
}

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

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* CentralReach Enhancement: Clinical Mastery & Plateau Banners */
.mastery-banner {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-left: 5px solid #16a34a;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 10px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.mastery-banner b { color: #15803d; }
.stalled-banner {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 5px solid #d97706;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 10px 0;
  color: #92400e;
}

/* CentralReach Enhancement: Interactive Kid Mode & Token Board */
.token-board {
  background: linear-gradient(135deg, #fdf4ff 0%, #ede9fe 50%, #e0e7ff 100%);
  border: 2px dashed #a855f7;
  border-radius: 16px;
  padding: 16px;
  margin: 16px 0;
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.1);
}
.token-track {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 14px 0;
}
.token-slot {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 3px solid #cbd5e1;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  user-select: none;
}
.token-slot:hover {
  transform: scale(1.1);
  border-color: #a855f7;
}
.token-slot.earned {
  background: linear-gradient(135deg, #fef08a 0%, #facc15 100%);
  border-color: #eab308;
  box-shadow: 0 0 15px rgba(250, 204, 21, 0.6);
  animation: modalScale 0.3s ease-out;
}
.token-reward-msg {
  text-align: center;
  background: #15803d;
  color: #fff;
  padding: 10px 16px;
  border-radius: 99px;
  font-weight: 700;
  font-size: 1.1rem;
  animation: slideDown 0.3s ease-out;
  margin-top: 10px;
}

/* Digital First/Then Board */
.first-then-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 14px 0;
}
.first-box {
  background: #eff6ff;
  border: 2px solid #60a5fa;
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}
.then-box {
  background: #f0fdf4;
  border: 2px solid #4ade80;
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}
.ft-label {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* Natural Environment Teaching (NET) Multi-Target Grid */
.net-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.net-card {
  background: var(--surface);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.net-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
}
.net-actions {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin-top: 8px;
}
.net-btn {
  padding: 8px 4px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  transition: transform 0.1s ease, filter 0.15s ease;
}
.net-btn:active {
  transform: scale(0.95);
}
.net-btn.btn-i { background: #dcfce7; color: #15803d; }
.net-btn.btn-i:hover { background: #bbf7d0; }
.net-btn.btn-v { background: #ede9fe; color: #6d28d9; }
.net-btn.btn-v:hover { background: #ddd6fe; }
.net-btn.btn-g { background: #e0f2fe; color: #0369a1; }
.net-btn.btn-g:hover { background: #bae6fd; }
.net-btn.btn-p { background: #fef3c7; color: #b45309; }
.net-btn.btn-p:hover { background: #fde68a; }
.net-btn.btn-n { background: #fee2e2; color: #b91c1c; }
.net-btn.btn-n:hover { background: #fecaca; }

/* Temporal Behavior Scatterplot & Hourly Heatmap */
.heatmap-track {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(75px, 1fr));
  gap: 8px;
}
.heat-slot {
  padding: 10px 4px;
  border-radius: var(--radius-md);
  text-align: center;
  border: 1px solid var(--slate-200);
  transition: all 0.15s ease;
}
.heat-slot:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.heat-0 { background: #fff; color: var(--slate-400); }
.heat-1 { background: #fef9c3; border-color: #fef08a; color: #854d0e; }
.heat-2 { background: #fed7aa; border-color: #fdba74; color: #9a3412; }
.heat-4 { background: #fee2e2; border-color: #fca5a5; color: #991b1b; font-weight: 700; }
.heat-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.heat-count { font-size: 1.25rem; font-weight: 800; margin: 2px 0; font-family: 'JetBrains Mono', monospace; }
.heat-sub { font-size: 0.68rem; opacity: 0.85; }

/* Print styling for Clinical Re-Authorization Reports */
@media print {
  body { background: #fff !important; }
  nav, .page-header, .tabs, button { display: none !important; }
  .modal-bg { position: static !important; background: none !important; }
  .modal-card { box-shadow: none !important; border: none !important; max-width: 100% !important; width: 100% !important; padding: 0 !important; }
  #report_text_body { border: none !important; padding: 0 !important; }
}

/* Responsive Tablet & Mobile Media Queries */
@media (max-width: 860px) {
  .layout {
    flex-direction: column;
  }
  nav {
    width: 100%;
    padding: 16px;
  }
  .nav-links {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }
  .nav-user {
    display: none;
  }
  main {
    padding: 16px;
  }
}
