/* ==========================================================================
   PulseGrid Health - design system
   Navy + blue + teal on white. Offline-safe: no external fonts or CDNs.
   ========================================================================== */

:root {
  --navy-950: #06172c;
  --navy-900: #0b2545;
  --navy-800: #12345c;
  --navy-700: #1a4470;
  --blue-700: #1557b0;
  --blue-600: #1d6fd6;
  --blue-500: #2f86ea;
  --blue-200: #b9d8ff;
  --blue-100: #dcecff;
  --blue-50: #eef6ff;
  --teal-700: #0b7f70;
  --teal-600: #0f9d8a;
  --teal-500: #14b8a6;
  --teal-100: #c9f5ee;
  --teal-50: #e7fbf7;
  --ink: #102a46;
  --ink-soft: #284766;
  --muted: #627c99;
  --line: #dce8f6;
  --line-strong: #c7dbef;
  --bg: #f5f9fe;
  --white: #ffffff;
  --surface: #ffffff;
  --surface-2: #f2f7fd;
  --accent: var(--teal-500);
  --accent-strong: var(--teal-700);
  --accent-soft: rgba(20, 184, 166, 0.14);
  --accent-glow: rgba(20, 184, 166, 0.32);
  --font-scale: 1;
  --danger: #d92d3a;
  --danger-soft: #fdecee;
  --warning: #b26a00;
  --warning-soft: #fff5e0;
  --success: #0f7a4f;
  --success-soft: #e7f8ef;
  --info-soft: #e8f2ff;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --shadow-xs: 0 2px 8px rgba(11, 37, 69, 0.05);
  --shadow-sm: 0 8px 24px rgba(11, 37, 69, 0.07);
  --shadow: 0 14px 40px rgba(11, 37, 69, 0.09);
  --shadow-lg: 0 30px 70px rgba(11, 37, 69, 0.16);
  --sidebar-w: 276px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; font-size: calc(100% * var(--font-scale, 1)); }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system,
    "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 500px at 85% -10%, rgba(47, 134, 234, 0.1), transparent 65%),
    radial-gradient(700px 480px at 0% 100%, rgba(20, 184, 166, 0.08), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .display-font {
  font-family: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--navy-900);
}

a { color: var(--blue-700); text-decoration: none; }
a:hover { color: var(--blue-600); }

::selection { background: var(--teal-100); color: var(--navy-900); }

/* --------------------------------------------------------------- scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c3d6ea; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #a9c4de; background-clip: content-box; }

/* =============================================================== app shell */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  z-index: 1045;
  display: flex;
  flex-direction: column;
  padding: 20px 16px 16px;
  color: #fff;
  background:
    radial-gradient(420px 260px at 110% -10%, rgba(20, 184, 166, 0.22), transparent 70%),
    radial-gradient(360px 300px at -20% 110%, rgba(47, 134, 234, 0.2), transparent 70%),
    linear-gradient(180deg, #0b2545 0%, #0a2140 55%, #06172c 100%);
  box-shadow: 12px 0 40px rgba(6, 23, 44, 0.18);
  transition: transform 0.35s var(--ease);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 20px;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  margin-bottom: 14px;
}
.brand:hover { color: #fff; }
.brand-mark {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--teal-500), var(--blue-600));
  box-shadow: 0 10px 24px rgba(20, 184, 166, 0.3);
}
.brand-mark svg { width: 26px; height: 26px; }
.brand-mark-img { position: relative; width: 60px; height: 60px; border-radius: 14px; background: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.16), 0 6px 14px rgba(0, 0, 0, 0.18); overflow: hidden; }
.brand-mark-img img {
  position: absolute;
  left: 50%; top: 50%;
  width: calc(100% - 8px);
  height: calc(100% - 8px);
  object-fit: contain;
  transform: translate(-50%, -50%);
  transition: transform 0.35s var(--ease);
}
.brand:hover .brand-mark-img img { transform: translate(-50%, -50%) scale(1.06); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 1.03rem; letter-spacing: -0.02em; white-space: nowrap; }
.brand-text small { font-size: 0.66rem; color: rgba(255, 255, 255, 0.58); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 2px 2px 10px; }
.sidebar-scroll::-webkit-scrollbar { width: 6px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); border: none; }

.nav-group { margin-bottom: 18px; }
.nav-label {
  margin: 0 0 8px 12px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
}
.side-nav { display: flex; flex-direction: column; gap: 3px; }
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.22s ease, color 0.22s ease, transform 0.22s var(--ease);
}
.nav-link i { font-size: 1.02rem; width: 20px; text-align: center; opacity: 0.9; }
.nav-link span { flex: 1; }
.nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(3px);
}
.nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, var(--accent-glow), rgba(255, 255, 255, 0.06));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.nav-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 22%;
  height: 56%;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent-glow);
}
.nav-link.active i { color: #fff; }
.nav-badge {
  font-size: 0.64rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
}

.sidebar-foot { padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.09); }
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.user-card .meta { flex: 1; min-width: 0; }
.user-card .meta strong { display: block; font-size: 0.82rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .meta small { display: block; font-size: 0.68rem; color: rgba(255, 255, 255, 0.55); }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); transform: translateY(-1px); }
.sidebar .icon-btn { color: rgba(255, 255, 255, 0.7); }

.offline-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  padding: 7px 10px;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.6);
}
.offline-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); animation: pulseDot 2.4s infinite; }

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1040;
  background: rgba(6, 23, 44, 0.5);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.app-main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ================================================================== topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding: 12px 32px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.page-heading { min-width: 0; }
.page-heading h1 {
  margin: 0;
  font-size: 1.3rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.page-heading p { margin: 2px 0 0; font-size: 0.78rem; color: var(--muted); }
.menu-toggle { display: none; color: var(--navy-800); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.sos-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(135deg, #e5484d, #bd1f2d);
  box-shadow: 0 6px 18px rgba(217, 45, 58, 0.28);
  transition: transform 0.2s var(--ease), box-shadow 0.2s ease;
}
.sos-btn:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 10px 24px rgba(217, 45, 58, 0.36); }
.sos-btn i { animation: pulseSoft 2.2s infinite; }

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 600;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.lang-toggle:hover { border-color: var(--blue-200); box-shadow: var(--shadow-xs); color: var(--blue-700); }
.lang-code { font-size: 0.68rem; padding: 2px 6px; border-radius: 6px; background: var(--blue-50); color: var(--blue-700); }
.language-menu { max-height: 420px; overflow-y: auto; min-width: 270px; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; }
.language-menu .dropdown-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-radius: 9px; padding: 8px 10px; font-size: 0.84rem; }
.language-menu .dropdown-item small { color: var(--muted); font-size: 0.68rem; }
.language-menu .dropdown-item.active { background: var(--blue-50); color: var(--blue-700); }
.lang-soon { font-size: 0.58rem; font-weight: 700; color: var(--muted); background: #f1f6fc; padding: 2px 5px; border-radius: 5px; }

.avatar {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--blue-600), var(--teal-600));
  box-shadow: 0 4px 12px rgba(29, 111, 214, 0.24);
  flex: 0 0 auto;
}
.avatar.sm { width: 32px; height: 32px; font-size: 0.68rem; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.15rem; }
.avatar.xl { width: 88px; height: 88px; font-size: 1.5rem; }

.user-menu-toggle { display: flex; align-items: center; gap: 9px; padding: 4px 6px 4px 4px; border: 1px solid transparent; background: transparent; border-radius: 999px; }
.user-menu-toggle:hover { background: var(--blue-50); border-color: var(--line); }
.user-menu-toggle .name { font-size: 0.8rem; font-weight: 600; color: var(--navy-800); line-height: 1.1; }
.user-menu-toggle .role { font-size: 0.66rem; color: var(--muted); }

/* ================================================================== layout */
.page-content {
  flex: 1;
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px 32px 44px;
}
.app-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 32px 22px;
  font-size: 0.7rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.app-footer span { display: inline-flex; align-items: center; gap: 6px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h2 { margin: 0; font-size: 1.55rem; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 0.88rem; max-width: 720px; }
.page-head .actions { display: flex; gap: 9px; flex-wrap: wrap; }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin: 28px 0 16px; }
.section-head h2 { margin: 0; font-size: 1.35rem; }
.section-head p { margin: 3px 0 0; color: var(--muted); font-size: 0.86rem; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dash-grid { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-gap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.muted { color: var(--muted); }
.small { font-size: 0.78rem; }
.tiny { font-size: 0.68rem; }
.nowrap { white-space: nowrap; }
.text-teal { color: var(--accent); }
.text-navy { color: var(--navy-900); }

/* =================================================================== cards */
.panel {
  position: relative;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 22px;
  transition: transform 0.3s var(--ease), box-shadow 0.3s ease, border-color 0.3s ease;
}
.panel.hover:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--blue-200); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h3 { margin: 0; font-size: 1.02rem; }
.panel-head p { margin: 2px 0 0; font-size: 0.76rem; color: var(--muted); }
.panel-body { min-width: 0; }
.panel.flush { padding: 0; overflow: hidden; }

.stat-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: transform 0.3s var(--ease), box-shadow 0.3s ease;
}
.stat-card::after { content: ""; position: absolute; inset: auto 0 0 0; height: 3px; background: linear-gradient(90deg, var(--blue-500), var(--teal-500)); opacity: 0; transition: opacity 0.3s ease; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.stat-card:hover::after { opacity: 1; }
.stat-icon {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-size: 1.2rem;
  background: var(--blue-50);
  color: var(--blue-700);
}
.stat-icon.teal { background: var(--teal-50); color: var(--teal-600); }
.stat-icon.red { background: var(--danger-soft); color: var(--danger); }
.stat-icon.amber { background: var(--warning-soft); color: var(--warning); }
.stat-card .value { font-size: 1.65rem; font-weight: 700; line-height: 1; color: var(--navy-900); letter-spacing: -0.03em; }
.stat-card .label { margin-top: 5px; font-size: 0.76rem; color: var(--muted); }
.stat-card .hint { margin-top: 7px; font-size: 0.68rem; color: var(--teal-600); font-weight: 600; }

.feature-card {
  height: 100%;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  transition: transform 0.3s var(--ease), box-shadow 0.3s ease, border-color 0.3s ease;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--blue-200); }
.feature-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  margin-bottom: 15px;
  font-size: 1.3rem;
  color: var(--blue-700);
  background: linear-gradient(135deg, var(--blue-50), var(--teal-50));
  border: 1px solid var(--line);
}
.feature-card h3 { font-size: 1.02rem; margin: 0 0 7px; }
.feature-card p { margin: 0; color: var(--muted); font-size: 0.85rem; line-height: 1.55; }

/* ================================================================== buttons */
.btn {
  --bs-btn-border-radius: 12px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.86rem;
  padding: 0.66rem 1.05rem;
  transition: transform 0.2s var(--ease), box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-700));
  border: none;
  color: #fff;
  box-shadow: 0 8px 20px rgba(29, 111, 214, 0.24);
}
.btn-primary:hover, .btn-primary:focus { background: linear-gradient(135deg, var(--blue-500), var(--blue-700)); color: #fff; box-shadow: 0 12px 26px rgba(29, 111, 214, 0.32); transform: translateY(-1px); }
.btn-teal { background: linear-gradient(135deg, var(--accent), var(--accent-strong)); border: none; color: #fff; box-shadow: 0 8px 20px var(--accent-glow); }
.btn-teal:hover, .btn-teal:focus { color: #fff; transform: translateY(-1px); box-shadow: 0 12px 26px var(--accent-glow); background: linear-gradient(135deg, var(--accent-strong), var(--accent)); }
.btn-soft { background: var(--blue-50); color: var(--blue-700); border: 1px solid var(--line); }
.btn-soft:hover { background: var(--blue-100); color: var(--blue-700); border-color: var(--blue-200); }
.btn-ghost { background: transparent; border: 1px solid rgba(255, 255, 255, 0.22); color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.btn-outline-secondary { border-color: var(--line-strong); color: var(--ink-soft); }
.btn-outline-secondary:hover { background: var(--blue-50); border-color: var(--blue-200); color: var(--blue-700); }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); border: 1px solid #f7c9ce; }
.btn-danger-soft:hover { background: #fbdfe2; color: var(--danger); }
.btn-sm { padding: 0.42rem 0.75rem; font-size: 0.76rem; border-radius: 10px; }
.btn-lg { padding: 0.9rem 1.35rem; font-size: 0.95rem; border-radius: 14px; }
.btn-icon { width: 38px; height: 38px; padding: 0; display: inline-grid; place-items: center; }

/* =================================================================== forms */
.form-label { font-weight: 600; font-size: 0.82rem; color: var(--navy-800); margin-bottom: 0.35rem; }
.form-label .req { color: var(--danger); }
.form-control, .form-select {
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background-color: #fff;
  padding: 0.66rem 0.85rem;
  font-size: 0.88rem;
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-control::placeholder { color: #9db1c6; }
.form-control:focus, .form-select:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 4px rgba(47, 134, 234, 0.12);
  background-color: #fff;
}
textarea.form-control { min-height: 96px; resize: vertical; }
.form-text, .form-hint { font-size: 0.72rem; color: var(--muted); margin-top: 4px; }
.invalid-feedback { font-size: 0.74rem; }
.form-check-input { width: 1.05em; height: 1.05em; margin-top: 0.18em; border-color: var(--line-strong); }
.form-check-input:checked { background-color: var(--blue-600); border-color: var(--blue-600); }
.form-check-label { font-size: 0.82rem; color: var(--ink-soft); }
.form-section { padding: 18px 0 4px; border-top: 1px dashed var(--line); margin-top: 18px; }
.form-section:first-of-type { border-top: none; margin-top: 0; padding-top: 0; }
.form-section-title { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--teal-700); margin-bottom: 12px; }
.input-group-text { border-radius: 12px 0 0 12px; border-color: var(--line-strong); background: var(--blue-50); color: var(--blue-700); }
.password-wrap { position: relative; }
.password-wrap .toggle-password { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: none; background: transparent; color: var(--muted); padding: 6px; }

/* =================================================================== badges */
.badge-soft {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--blue-50);
  color: var(--blue-700);
  white-space: nowrap;
}
.badge-soft.success { background: var(--success-soft); color: var(--success); }
.badge-soft.warning { background: var(--warning-soft); color: var(--warning); }
.badge-soft.danger { background: var(--danger-soft); color: var(--danger); }
.badge-soft.secondary { background: #eef2f7; color: #5d6f84; }
.badge-soft.info { background: var(--info-soft); color: var(--blue-700); }
.badge-soft.teal { background: var(--accent-soft); color: var(--accent-strong); border: 1px solid var(--accent-glow); }
.urgency-red { background: var(--danger-soft) !important; color: var(--danger) !important; border: 1px solid #f7c9ce; }
.urgency-yellow { background: var(--warning-soft) !important; color: var(--warning) !important; border: 1px solid #f5dda4; }
.urgency-green { background: var(--success-soft) !important; color: var(--success) !important; border: 1px solid #bde8cf; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 0.7rem; font-weight: 600; background: var(--blue-50); color: var(--blue-700); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.teal { background: var(--teal-50); color: var(--teal-700); }
.pill.red { background: var(--danger-soft); color: var(--danger); }
.pill.amber { background: var(--warning-soft); color: var(--warning); }

/* =================================================================== tables */
.table-wrap { width: 100%; overflow-x: auto; border-radius: var(--radius); }
.table { margin: 0; color: var(--ink); font-size: 0.83rem; }
.table > :not(caption) > * > * { padding: 0.8rem 0.75rem; border-bottom-color: var(--line); vertical-align: middle; }
.table thead th { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; background: #f7fbff; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tbody tr { transition: background 0.18s ease; }
.table tbody tr:hover { background: #f9fcff; }
.table tbody tr:last-child td { border-bottom: none; }
.table .name-cell { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.table .name-cell strong { display: block; font-size: 0.84rem; }
.table .name-cell small { color: var(--muted); font-size: 0.7rem; }
.table-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* =================================================================== alerts */
.flash-stack { display: flex; flex-direction: column; gap: 9px; margin-bottom: 18px; }
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.84rem;
  box-shadow: var(--shadow-xs);
  animation: fadeUp 0.4s var(--ease) both;
}
.alert i { font-size: 1rem; line-height: 1.2; }
.alert-success { background: var(--success-soft); border-color: #bde8cf; color: #0b5e3d; }
.alert-danger { background: var(--danger-soft); border-color: #f7c9ce; color: #9e1b26; }
.alert-warning { background: var(--warning-soft); border-color: #f5dda4; color: #7a4a00; }
.alert-info { background: var(--info-soft); border-color: var(--blue-200); color: var(--blue-700); }
.alert .btn-close { margin-left: auto; font-size: 0.65rem; }

/* =================================================================== hero */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  padding: 54px 52px;
  color: #fff;
  background:
    radial-gradient(700px 420px at 88% 10%, rgba(20, 184, 166, 0.3), transparent 65%),
    linear-gradient(135deg, #0b2545 0%, #12345c 55%, #0d3a63 100%);
  box-shadow: var(--shadow-lg);
}
.hero::before {
  content: "";
  position: absolute;
  width: 620px;
  height: 620px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  top: -300px;
  right: -180px;
  box-shadow: 0 0 0 60px rgba(255, 255, 255, 0.02), 0 0 0 120px rgba(255, 255, 255, 0.015);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 78% 30%, black, transparent 62%);
  pointer-events: none;
}
.hero-content { position: relative; z-index: 2; max-width: 720px; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal-100);
  background: rgba(20, 184, 166, 0.16);
  border: 1px solid rgba(20, 184, 166, 0.3);
  margin-bottom: 18px;
}
.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.hero h1 { color: #fff; font-size: clamp(2rem, 4vw, 3.15rem); line-height: 1.06; margin: 0 0 16px; letter-spacing: -0.035em; }
.hero p { color: rgba(255, 255, 255, 0.72); font-size: 1.02rem; line-height: 1.65; max-width: 620px; margin: 0 0 26px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 11px; }
.hero .btn-soft { background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.18); color: #fff; backdrop-filter: blur(8px); }
.hero .btn-soft:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 22px; margin-top: 30px; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.hero-meta div strong { display: block; font-size: 1.3rem; color: #fff; }
.hero-meta div span { font-size: 0.7rem; color: rgba(255, 255, 255, 0.55); }
.hero-visual {
  position: absolute;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);
  width: 330px;
  z-index: 2;
  perspective: 1000px;
  transform-style: preserve-3d;
}
.float-card {
  position: relative;
  transform-style: preserve-3d;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05) 55%, rgba(20, 184, 166, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-top-color: rgba(255, 255, 255, 0.38);
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 26px 55px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  animation: cardDriftA 9s ease-in-out infinite;
}
.float-card + .float-card { margin-top: 18px; margin-left: 44px; animation: cardDriftB 9s ease-in-out infinite; animation-delay: -4.5s; }
/* moving light sweep across the glass */
.float-card::before {
  content: "";
  position: absolute;
  top: -60%; left: -80%;
  width: 55%; height: 220%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  transform: rotate(12deg) translateZ(30px);
  pointer-events: none;
  animation: sheen 7s ease-in-out infinite;
}
.float-card + .float-card::before { animation-delay: -3.2s; }
/* soft glow puddle under the card */
.float-card::after {
  content: "";
  position: absolute;
  left: 12%; right: 12%; bottom: -20px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(20, 184, 166, 0.4), transparent 70%);
  filter: blur(14px);
  transform: translateZ(-24px);
  animation: glowPulse 9s ease-in-out infinite;
}
.float-card + .float-card::after { background: radial-gradient(ellipse, rgba(47, 134, 234, 0.38), transparent 70%); animation-delay: -4.5s; }
/* depth layers: icon sits closest, then title, subtitle, bars */
.float-card .fc-top { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.float-card .fc-icon {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(20, 184, 166, 0.5), rgba(20, 184, 166, 0.22));
  box-shadow: 0 0 0 1px rgba(127, 231, 213, 0.35), 0 6px 16px rgba(20, 184, 166, 0.35);
  color: #e6fffb;
  transform: translateZ(38px);
  animation: iconDrift 4.5s ease-in-out infinite;
}
.float-card + .float-card .fc-icon {
  background: linear-gradient(145deg, rgba(47, 134, 234, 0.5), rgba(47, 134, 234, 0.22));
  box-shadow: 0 0 0 1px rgba(147, 197, 253, 0.35), 0 6px 16px rgba(47, 134, 234, 0.35);
  animation-delay: -2.2s;
}
.float-card strong { font-size: 0.8rem; color: #fff; display: block; transform: translateZ(24px); }
.float-card small { font-size: 0.65rem; color: rgba(255, 255, 255, 0.6); display: block; transform: translateZ(18px); margin-top: 2px; }
.float-line { height: 7px; border-radius: 99px; background: rgba(255, 255, 255, 0.14); margin-top: 8px; transform: translateZ(14px); transform-origin: left center; animation: barFill 6s ease-in-out infinite; overflow: hidden; position: relative; }
.float-card + .float-line, .float-card + .float-card .float-line { animation-delay: -1.2s; }
.float-line.w-80 { width: 80%; }
.float-line.w-60 { width: 60%; animation-delay: -2.4s; }
.float-line.teal { background: linear-gradient(90deg, rgba(20, 184, 166, 0.85), rgba(20, 184, 166, 0.15), rgba(94, 234, 212, 0.6)); background-size: 200% 100%; animation: barFill 6s ease-in-out infinite, gradientShift 3s linear infinite; }
.float-line.teal.w-60 { animation-delay: -2.4s, -2.4s; }

@keyframes cardDriftA {
  0%, 100% { transform: rotateX(7deg) rotateY(-11deg) rotateZ(-0.5deg) translateY(0) translateZ(0); }
  50% { transform: rotateX(-5deg) rotateY(9deg) rotateZ(0.5deg) translateY(-16px) translateZ(30px); }
}
@keyframes cardDriftB {
  0%, 100% { transform: rotateX(-6deg) rotateY(10deg) rotateZ(0.5deg) translateY(0) translateZ(0); }
  50% { transform: rotateX(5deg) rotateY(-9deg) rotateZ(-0.5deg) translateY(14px) translateZ(24px); }
}
@keyframes iconDrift {
  0%, 100% { transform: translateZ(38px) translateY(0); }
  50% { transform: translateZ(46px) translateY(-4px); }
}
@keyframes barFill {
  0% { transform: translateZ(14px) scaleX(0.1); opacity: 0.4; }
  55% { transform: translateZ(14px) scaleX(1); opacity: 1; }
  100% { transform: translateZ(14px) scaleX(1); opacity: 1; }
}
@keyframes glowPulse {
  0%, 100% { opacity: 0.5; transform: translateZ(-24px) scaleX(1); }
  50% { opacity: 0.95; transform: translateZ(-24px) scaleX(1.15); }
}

.emergency-strip {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--danger-soft), #fff7f8);
  border: 1px solid #f7c9ce;
}
.emergency-strip .icon { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px; background: var(--surface); color: var(--danger); font-size: 1.15rem; box-shadow: var(--shadow-xs); }
.emergency-strip h3 { margin: 0 0 3px; font-size: 0.95rem; color: #8f1a24; }
.emergency-strip p { margin: 0; font-size: 0.8rem; color: #a63b44; }

/* ==================================================================== auth */
.auth-shell {
  display: grid;
  grid-template-columns: 1.02fr 0.98fr;
  max-width: 1120px;
  margin: 8px auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.auth-visual {
  position: relative;
  overflow: hidden;
  padding: 48px 44px;
  color: #fff;
  background:
    radial-gradient(520px 380px at 90% 0%, rgba(20, 184, 166, 0.35), transparent 70%),
    linear-gradient(155deg, #0b2545 0%, #12345c 62%, #0b4a63 100%);
}
.auth-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at 70% 30%, black, transparent 70%);
}
.auth-visual > * { position: relative; z-index: 1; }
.auth-visual h2 { color: #fff; font-size: 1.9rem; line-height: 1.15; margin: 26px 0 14px; }
.auth-visual p { color: rgba(255, 255, 255, 0.7); font-size: 0.9rem; line-height: 1.65; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-direction: column; gap: 13px; }
.auth-points li { display: flex; gap: 11px; align-items: flex-start; font-size: 0.82rem; color: rgba(255, 255, 255, 0.78); }
.auth-points i { color: var(--teal-100); font-size: 1rem; margin-top: 1px; }
.auth-form-wrap { padding: 44px 48px; }
.auth-form-wrap h1 { font-size: 1.7rem; margin: 0 0 6px; }
.auth-form-wrap .sub { color: var(--muted); font-size: 0.86rem; margin-bottom: 24px; }
.auth-switch { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 0.82rem; color: var(--muted); text-align: center; }
.auth-switch a { font-weight: 600; }
.auth-legal { margin-top: 16px; font-size: 0.68rem; color: var(--muted); line-height: 1.55; }
.trust-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.trust-strip span { display: inline-flex; align-items: center; gap: 5px; font-size: 0.66rem; color: rgba(255, 255, 255, 0.7); background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.1); padding: 5px 9px; border-radius: 999px; }

/* ----------------------------------------------------------- demo accounts */
.demo-accounts { margin-top: 18px; border: 1px dashed var(--blue-200); border-radius: 12px; background: var(--blue-50); overflow: hidden; }
.demo-accounts summary { display: flex; align-items: center; gap: 8px; padding: 11px 13px; font-size: 0.76rem; font-weight: 600; color: var(--navy-800); cursor: pointer; list-style: none; }
.demo-accounts summary::-webkit-details-marker { display: none; }
.demo-accounts summary > i { color: var(--teal-600); }
.demo-accounts summary .demo-password { margin-left: auto; font-family: "Cascadia Mono", Consolas, monospace; font-size: 0.72rem; background: var(--surface); border: 1px solid var(--blue-200); border-radius: 6px; padding: 2px 7px; color: var(--blue-700); }
.demo-list { display: flex; flex-direction: column; gap: 6px; padding: 0 10px 8px; }
.demo-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 1px solid transparent; border-radius: 9px; background: var(--surface); text-align: left; transition: all 0.16s ease; }
.demo-row:hover, .demo-row:focus-visible { border-color: var(--blue-200); background: #fbfdff; transform: translateX(2px); }
.demo-row.is-filled { border-color: var(--teal-500); background: var(--teal-50); }
.demo-icon { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--blue-50); color: var(--blue-600); }
.demo-meta { min-width: 0; }
.demo-meta strong { display: block; font-size: 0.74rem; color: var(--navy-800); }
.demo-meta small { display: block; font-size: 0.68rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demo-fill { color: var(--blue-500); font-size: 0.8rem; }
.demo-note { margin: 0; padding: 0 13px 12px; font-size: 0.66rem; line-height: 1.55; color: var(--muted); }

/* ================================================================== patient */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, #fff, var(--blue-50));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}
.profile-hero .who { flex: 1; min-width: 200px; }
.profile-hero h2 { margin: 0; font-size: 1.35rem; }
.profile-hero .meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 6px; font-size: 0.76rem; color: var(--muted); }
.profile-hero .meta span { display: inline-flex; align-items: center; gap: 5px; }
.qr-card { text-align: center; }
.qr-frame { display: inline-block; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-sm); }
.qr-frame img { display: block; width: 190px; height: 190px; image-rendering: pixelated; border-radius: 8px; }
.qr-id { margin-top: 12px; font-family: "Cascadia Mono", Consolas, monospace; font-size: 0.85rem; letter-spacing: 0.08em; color: var(--navy-800); font-weight: 700; }
.qr-note { max-width: 260px; margin: 10px auto 0; font-size: 0.7rem; color: var(--muted); line-height: 1.5; }

.vital-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 10px; }
.vital-tile { padding: 12px; border-radius: 13px; background: #f7fbff; border: 1px solid var(--line); }
.vital-tile .label { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; }
.vital-tile .value { font-size: 1.15rem; font-weight: 700; color: var(--navy-900); margin-top: 3px; }
.vital-tile .unit { font-size: 0.64rem; color: var(--muted); font-weight: 500; }
.vital-tile.alert { background: var(--danger-soft); border-color: #f7c9ce; }
.vital-tile.alert .value { color: var(--danger); }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: linear-gradient(var(--blue-200), var(--teal-100)); border-radius: 99px; }
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before { content: ""; position: absolute; left: -21px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--blue-500); box-shadow: 0 0 0 3px var(--blue-50); }
.timeline-item.red::before { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.timeline-item.yellow::before { border-color: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.timeline-item.green::before { border-color: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.timeline-item .when { font-size: 0.68rem; color: var(--muted); font-weight: 600; }
.timeline-item .what { font-size: 0.84rem; color: var(--ink); margin-top: 2px; }
.timeline-item .detail { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }

.record-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.record-tabs a { padding: 7px 13px; border-radius: 999px; font-size: 0.76rem; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--line); }
.record-tabs a.active, .record-tabs a:hover { background: var(--blue-50); color: var(--blue-700); border-color: var(--blue-200); }

/* =================================================================== triage */
.category-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.category-card { position: relative; display: flex; flex-direction: column; gap: 7px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; transition: all 0.2s var(--ease); }
.category-card input { position: absolute; opacity: 0; pointer-events: none; }
.category-card i { font-size: 1.2rem; color: var(--blue-600); }
.category-card span { font-size: 0.78rem; font-weight: 600; color: var(--ink-soft); line-height: 1.25; }
.category-card:hover { border-color: var(--blue-200); background: #fbfdff; transform: translateY(-2px); }
.category-card.selected { border-color: var(--blue-500); background: var(--blue-50); box-shadow: 0 0 0 3px rgba(47, 134, 234, 0.1); }
.category-card.selected i { color: var(--teal-600); }

/* ------------------------------------------------------- interactive body map */
.body-map-layout { display: grid; grid-template-columns: minmax(200px, 280px) 1fr; gap: 22px; align-items: center; }
.body-map { display: flex; justify-content: center; }
.body-map svg { width: 100%; max-width: 280px; height: auto; overflow: visible; }
.body-figure { fill: url(#bodyFill); stroke: var(--blue-200); stroke-width: 2; }
.body-hotspot { cursor: pointer; outline: none; }
.body-hotspot .hit { fill: transparent; stroke: transparent; stroke-width: 2; transition: fill 0.2s ease, stroke 0.2s ease; }
.body-hotspot .marker { fill: #fff; stroke: var(--blue-500); stroke-width: 2.4; transition: fill 0.2s ease, stroke 0.2s ease, transform 0.2s ease; transform-box: fill-box; transform-origin: center; }
.body-hotspot .marker-dot { fill: var(--blue-500); transition: fill 0.2s ease; }
.body-hotspot .leader { stroke: var(--blue-200); stroke-width: 1.6; stroke-dasharray: 3 3; pointer-events: none; }
.body-hotspot:hover .hit, .body-hotspot:focus-visible .hit { fill: rgba(47, 134, 234, 0.13); stroke: var(--blue-500); }
.body-hotspot:hover .marker, .body-hotspot:focus-visible .marker { stroke: var(--teal-500); transform: scale(1.18); }
.body-hotspot.is-active .hit { fill: rgba(20, 184, 166, 0.2); stroke: var(--teal-600); }
.body-hotspot.is-active .marker { fill: var(--teal-600); stroke: #fff; animation: bodyPulse 1.8s ease-out infinite; }
.body-hotspot.is-active .marker-dot { fill: #fff; }

.body-map-side { min-width: 0; }
.body-selected { padding: 10px 13px; border-radius: 11px; background: var(--blue-50); border: 1px solid var(--blue-100); font-size: 0.76rem; color: var(--muted); }
.body-selected strong { color: var(--navy-900); }
.body-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 12px; }
.body-chip { display: flex; align-items: center; gap: 7px; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); font-size: 0.72rem; font-weight: 600; color: var(--ink-soft); text-align: left; transition: all 0.18s ease; }
.body-chip i { font-size: 0.86rem; color: var(--blue-600); flex: 0 0 auto; }
.body-chip:hover { border-color: var(--blue-200); background: var(--blue-50); transform: translateY(-1px); }
.body-chip.is-active { border-color: var(--teal-500); background: var(--teal-50); color: var(--teal-700); box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1); }
.body-chip.is-active i { color: var(--teal-600); }
.body-map-note { margin: 12px 0 0; font-size: 0.68rem; line-height: 1.6; color: var(--muted); }

@keyframes bodyPulse {
  0% { filter: drop-shadow(0 0 0 rgba(20, 184, 166, 0.45)); }
  70% { filter: drop-shadow(0 0 7px rgba(20, 184, 166, 0.55)); }
  100% { filter: drop-shadow(0 0 0 rgba(20, 184, 166, 0)); }
}

.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { position: relative; cursor: pointer; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 0.78rem; color: var(--ink-soft); transition: all 0.18s ease; }
.chip-check span::before { content: "\F26E"; font-family: "bootstrap-icons"; font-size: 0.8rem; color: #b6c8db; }
.chip-check:hover span { border-color: var(--blue-300, var(--blue-200)); background: #fbfdff; }
.chip-check input:checked + span { background: var(--blue-50); border-color: var(--blue-500); color: var(--blue-700); }
.chip-check input:checked + span::before { content: "\F26B"; color: var(--teal-600); }

.danger-box { padding: 16px; border-radius: 14px; background: linear-gradient(135deg, #fff8f8, #fdecee); border: 1px solid #f7c9ce; }
.danger-box .title { display: flex; align-items: center; gap: 7px; font-size: 0.8rem; font-weight: 700; color: #9e1b26; margin-bottom: 10px; }
.danger-list { display: flex; flex-direction: column; gap: 7px; }
.danger-check { display: flex; gap: 9px; align-items: flex-start; padding: 7px 9px; border-radius: 9px; font-size: 0.77rem; color: #7d2a32; cursor: pointer; transition: background 0.18s ease; }
.danger-check:hover { background: rgba(255, 255, 255, 0.6); }
.danger-check input { margin-top: 2px; }

.urgency-banner { display: flex; align-items: flex-start; gap: 14px; padding: 20px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface); }
.urgency-banner .mark { width: 54px; height: 54px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 16px; font-size: 1.4rem; }
.urgency-banner h2 { margin: 0 0 4px; font-size: 1.25rem; }
.urgency-banner p { margin: 0; font-size: 0.84rem; line-height: 1.55; }
.urgency-banner.red { background: linear-gradient(135deg, #fff, var(--danger-soft)); border-color: #f7c9ce; }
.urgency-banner.red .mark { background: #fff; color: var(--danger); box-shadow: 0 0 0 5px rgba(217, 45, 58, 0.1); }
.urgency-banner.red h2 { color: #9e1b26; }
.urgency-banner.yellow { background: linear-gradient(135deg, #fff, var(--warning-soft)); border-color: #f5dda4; }
.urgency-banner.yellow .mark { background: #fff; color: var(--warning); box-shadow: 0 0 0 5px rgba(178, 106, 0, 0.1); }
.urgency-banner.yellow h2 { color: #7a4a00; }
.urgency-banner.green { background: linear-gradient(135deg, #fff, var(--success-soft)); border-color: #bde8cf; }
.urgency-banner.green .mark { background: #fff; color: var(--success); box-shadow: 0 0 0 5px rgba(15, 122, 79, 0.1); }
.urgency-banner.green h2 { color: #0b5e3d; }

.severity { display: flex; align-items: center; gap: 14px; }
.severity input[type="range"] { flex: 1; accent-color: var(--blue-600); }
.severity .value { min-width: 46px; text-align: center; font-weight: 700; font-size: 1.1rem; color: var(--blue-700); background: var(--blue-50); border-radius: 10px; padding: 4px 8px; }

/* ============================================================== telemedicine */
.video-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.video-tile { position: relative; overflow: hidden; border-radius: 18px; background: #08172a; aspect-ratio: 16 / 10; border: 1px solid rgba(255, 255, 255, 0.08); }
.video-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-tile .label { position: absolute; left: 12px; bottom: 12px; display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: rgba(6, 23, 44, 0.7); color: #fff; font-size: 0.68rem; backdrop-filter: blur(6px); }
.video-tile .state { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255, 255, 255, 0.5); font-size: 0.8rem; text-align: center; padding: 20px; }
.video-controls { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.video-btn { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--navy-800); display: grid; place-items: center; font-size: 1.1rem; box-shadow: var(--shadow-sm); transition: transform 0.2s var(--ease), background 0.2s ease; }
.video-btn:hover { transform: translateY(-2px); background: var(--blue-50); }
.video-btn.end { background: var(--danger); color: #fff; border-color: var(--danger); }
.video-btn.end:hover { background: #b8232f; }
.video-btn.off { background: var(--warning-soft); color: var(--warning); border-color: #f5dda4; }
.call-status { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px; background: var(--blue-50); color: var(--blue-700); font-size: 0.7rem; font-weight: 600; }
.call-status i { animation: pulseSoft 1.8s ease-in-out infinite; }
.video-btn { transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.video-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(29,111,214,.18); }
.call-timer { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; background: var(--teal-50); color: var(--teal-700); font-size: 0.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.video-tile video { transition: opacity 0.3s ease; }
#localVideo { transform: scaleX(-1); }
.video-tile .tile-action { position: absolute; inset: auto 0 34% 0; margin: 0 auto; width: max-content; display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.28); background: rgba(6, 23, 44, 0.82); color: #fff; font-size: 0.78rem; font-weight: 600; cursor: pointer; backdrop-filter: blur(8px); transition: transform 0.2s var(--ease), background 0.2s ease; }
.video-tile .tile-action:hover { transform: translateY(-2px); background: rgba(20, 184, 166, 0.9); }
.video-tile .tile-action[hidden] { display: none; }
.device-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--blue-50); border: 1px solid var(--blue-100); }
.device-row[hidden] { display: none; }
.device-field { display: flex; align-items: center; gap: 8px; flex: 1 1 220px; min-width: 0; }
.device-field > span { display: inline-flex; align-items: center; gap: 6px; font-size: 0.7rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.device-field select { flex: 1; min-width: 0; padding: 6px 9px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 0.74rem; }

/* ==================================================================== misc */
.empty-state { text-align: center; padding: 34px 20px; }
.empty-state .icon { width: 58px; height: 58px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 18px; background: var(--blue-50); color: var(--blue-600); font-size: 1.4rem; }
.empty-state h3 { margin: 0 0 5px; font-size: 0.98rem; }
.empty-state p { margin: 0 auto; max-width: 340px; font-size: 0.8rem; color: var(--muted); line-height: 1.55; }
.empty-state .btn { margin-top: 14px; }

.list-clean { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: none; padding-bottom: 0; }
.list-row:first-child { padding-top: 0; }
.list-row .body { flex: 1; min-width: 0; }
.list-row .body strong { display: block; font-size: 0.84rem; }
.list-row .body small { display: block; color: var(--muted); font-size: 0.72rem; margin-top: 2px; }
.list-row .end { text-align: right; font-size: 0.72rem; color: var(--muted); }

.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.info-box { padding: 14px; border-radius: 13px; background: #f8fbff; border: 1px solid var(--line); }
.info-box .label { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 700; }
.info-box .value { margin-top: 4px; font-size: 0.86rem; font-weight: 600; color: var(--navy-900); word-break: break-word; }

.knowledge-result { padding: 14px; border-radius: 13px; background: #f9fcff; border: 1px solid var(--line); }
.knowledge-result + .knowledge-result { margin-top: 10px; }
.knowledge-result .src { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.7rem; color: var(--muted); margin-bottom: 6px; }
.knowledge-result p { margin: 0; font-size: 0.78rem; line-height: 1.55; color: var(--ink-soft); white-space: pre-line; }

.upload-zone { border: 1.5px dashed var(--blue-200); border-radius: var(--radius); background: linear-gradient(135deg, #fbfdff, var(--blue-50)); padding: 26px; text-align: center; transition: border-color 0.2s ease, background 0.2s ease; }
.upload-zone:hover { border-color: var(--blue-500); background: #f7fbff; }
.upload-zone i { font-size: 1.8rem; color: var(--blue-600); }
.upload-zone h3 { margin: 8px 0 4px; font-size: 0.95rem; }
.upload-zone p { margin: 0; font-size: 0.76rem; color: var(--muted); }

.progress-soft { height: 7px; border-radius: 99px; background: #eaf2fb; overflow: hidden; }
.progress-soft span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--blue-500), var(--teal-500)); }

.divider { height: 1px; background: var(--line); margin: 18px 0; }

.network-url { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 13px; background: var(--navy-900); color: #fff; font-family: "Cascadia Mono", Consolas, monospace; font-size: 0.9rem; overflow-x: auto; }
.network-url .copy { margin-left: auto; color: var(--teal-100); background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 8px; padding: 5px 9px; font-size: 0.68rem; font-family: inherit; white-space: nowrap; }

.offline-banner { display: none; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--warning-soft); color: var(--warning); font-size: 0.72rem; font-weight: 600; }
body.is-offline .offline-banner { display: inline-flex; }

/* ================================================================ analytics */
.bar-row { margin-bottom: 12px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-label { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 5px; font-size: 0.72rem; font-weight: 600; color: var(--ink-soft); }
.bar-label span:last-child { color: var(--navy-900); font-variant-numeric: tabular-nums; }
.bar-track { height: 8px; border-radius: 99px; background: #eef4fb; overflow: hidden; }
.bar-track > span { display: block; height: 100%; min-width: 2px; border-radius: 99px; background: linear-gradient(90deg, var(--blue-500), var(--teal-500)); transition: width 0.6s var(--ease); }
.bar-track > span.bar-red { background: linear-gradient(90deg, #e35b66, var(--danger)); }
.bar-track > span.bar-yellow { background: linear-gradient(90deg, #e7b64a, var(--warning)); }
.bar-track > span.bar-green { background: linear-gradient(90deg, #33b27f, var(--success)); }

.chart-columns { display: flex; align-items: flex-end; gap: 12px; height: 200px; padding: 8px 4px 0; }
.chart-column { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.chart-value { font-size: 0.72rem; font-weight: 700; color: var(--navy-800); }
.chart-track { flex: 1; width: 100%; display: flex; align-items: flex-end; border-radius: 10px; background: #f2f7fd; overflow: hidden; }
.chart-track > span { display: block; width: 100%; min-height: 2px; border-radius: 10px 10px 0 0; background: linear-gradient(180deg, var(--teal-500), var(--blue-600)); transition: height 0.6s var(--ease); }
.chart-label { font-size: 0.62rem; color: var(--muted); text-align: center; white-space: nowrap; }

/* ================================================================= secrets */
.secret-box { display: flex; align-items: center; gap: 12px; padding: 15px 16px; border-radius: 13px; background: var(--navy-900); color: #fff; font-family: "Cascadia Mono", Consolas, monospace; font-size: 0.95rem; line-height: 1.5; overflow-x: auto; word-break: break-all; }
.secret-box .copy { margin-left: auto; flex: 0 0 auto; color: var(--teal-100); background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 8px; padding: 6px 10px; font-size: 0.7rem; font-family: inherit; white-space: nowrap; }
.secret-box .copy:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }

/* ============================================================== LAN diagram */
.lan-diagram { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.65fr); gap: 24px; align-items: center; }
.lan-map { display: flex; justify-content: center; }
.lan-map svg { width: 100%; max-width: 560px; height: auto; }
.lan-link { stroke: var(--blue-200); stroke-width: 2; stroke-dasharray: 5 6; animation: lanDash 22s linear infinite; }
.lan-node { cursor: pointer; outline: none; transform-box: fill-box; transform-origin: center; transition: transform 0.25s var(--ease); }
.lan-node .device { fill: #fff; stroke: var(--blue-200); stroke-width: 1.8; transition: stroke 0.2s ease, filter 0.2s ease; }
.lan-node .screen { fill: var(--blue-50); }
.lan-node .node-label { fill: var(--navy-800); font-size: 10px; font-weight: 700; letter-spacing: 0.02em; }
.lan-node .node-sub { fill: var(--muted); font-size: 8.5px; }
.lan-node:hover, .lan-node:focus-visible { transform: translateY(-4px); }
.lan-node:hover .device, .lan-node:focus-visible .device { stroke: var(--blue-500); filter: drop-shadow(0 7px 12px rgba(29, 111, 214, 0.2)); }
.lan-node:hover .node-label, .lan-node:focus-visible .node-label { fill: var(--blue-700); }
.lan-server { fill: var(--navy-900); stroke: var(--teal-500); stroke-width: 2.5; }
.lan-server-led { fill: var(--teal-500); animation: pulseSoft 2s ease-in-out infinite; }
.lan-hub-glow { fill: rgba(20, 184, 166, 0.12); }
.lan-side { display: flex; flex-direction: column; gap: 9px; }
.lan-side .info-box { margin: 0; }
.lan-side .lan-tip { font-size: 0.7rem; line-height: 1.6; color: var(--muted); margin: 4px 0 0; }
@keyframes lanDash { to { stroke-dashoffset: -220; } }

/* ================================================================ animation */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes floatY { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes pulseDot { 0%, 100% { box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.14); } 50% { box-shadow: 0 0 0 7px rgba(20, 184, 166, 0.05); } }
@keyframes pulseSoft { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
@keyframes sheen { from { transform: translateX(-120%); } to { transform: translateX(220%); } }

.animate-in { animation: fadeUp 0.55s var(--ease) both; animation-delay: var(--d, 0s); }
.animate-fade { animation: fadeIn 0.4s ease both; }
.stagger > * { animation: fadeUp 0.55s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: 0.02s; }
.stagger > *:nth-child(2) { animation-delay: 0.08s; }
.stagger > *:nth-child(3) { animation-delay: 0.14s; }
.stagger > *:nth-child(4) { animation-delay: 0.2s; }
.stagger > *:nth-child(5) { animation-delay: 0.26s; }
.stagger > *:nth-child(6) { animation-delay: 0.32s; }
.stagger > *:nth-child(7) { animation-delay: 0.38s; }
.stagger > *:nth-child(8) { animation-delay: 0.44s; }

/* ================================================================ responsive */
@media (max-width: 1240px) {
  .hero-visual { display: none; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { opacity: 1; visibility: visible; }
  .app-main { margin-left: 0; }
  .menu-toggle { display: inline-grid; }
  .topbar { padding: 10px 18px; min-height: 68px; }
  .page-content { padding: 22px 18px 36px; }
  .app-footer { padding: 14px 18px 20px; }
  .split { grid-template-columns: 1fr; }
  .auth-shell { grid-template-columns: 1fr; margin: 0 auto; }
  .auth-visual { padding: 30px 28px; }
  .auth-visual h2 { font-size: 1.45rem; margin-top: 18px; }
  .auth-points { margin-top: 18px; }
  .auth-form-wrap { padding: 30px 28px; }
  .hero { padding: 38px 30px; }
  .hero h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); }
  .video-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .page-heading p { display: none; }
  .page-heading h1 { font-size: 1.08rem; }
  .user-menu-toggle .name, .user-menu-toggle .role { display: none; }
  .sos-btn span { display: none; }
  .sos-btn { padding: 9px; }
  .lang-toggle .lang-code { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hero { padding: 30px 22px; border-radius: 22px; }
  .hero p { font-size: 0.92rem; }
  .hero-meta { gap: 14px; }
  .hero-meta div strong { font-size: 1.1rem; }
  .photo-gallery { grid-template-columns: 1fr; }
  .photo-tile { aspect-ratio: 16 / 10; }
  .panel { padding: 17px; border-radius: 17px; }
  .stat-card { padding: 16px; }
  .auth-form-wrap { padding: 26px 20px; }
  .auth-visual { padding: 24px 20px; }
  .page-content { padding: 16px 12px 30px; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .qr-frame img { width: 160px; height: 160px; }
  .profile-hero { padding: 18px; }
  .network-url { font-size: 0.76rem; }
  .body-map-layout, .body-layout { grid-template-columns: 1fr; }
  .body-map svg { max-width: 240px; }
  .body-3d { max-width: 260px; height: 380px; margin: 0 auto; }
  .clip-layout { grid-template-columns: 1fr; }
  .kid-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lan-diagram { grid-template-columns: 1fr; }
  .demo-accounts .demo-row { grid-template-columns: auto 1fr; }
  .demo-fill { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ===================================================== pain locator / 3D body */
.pain-locator .pain-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tool-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); font-size: .74rem; font-weight: 600;
  transition: all .18s ease;
}
.tool-chip:hover, .tool-chip.is-active { border-color: var(--teal-500); background: var(--teal-50); color: var(--teal-700); }

.pain-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.pain-tab {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .78rem; font-weight: 600;
  transition: all .18s ease;
}
.pain-tab:hover { border-color: var(--blue-200); color: var(--blue-700); background: var(--blue-50); }
.pain-tab.is-active { border-color: var(--teal-500); color: var(--teal-700); background: var(--teal-50); box-shadow: 0 0 0 3px rgba(20,184,166,.1); }
.pain-pane[hidden] { display: none !important; }
.pane-lead { font-size: .82rem; color: var(--muted); margin: 0 0 12px; }

.body-layout { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 22px; align-items: start; }
.body-stage { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.body-3d {
  width: 100%; max-width: 290px; height: 430px; position: relative; perspective: 1100px;
  border-radius: 18px; background: radial-gradient(120% 90% at 50% 0%, #f6fbff 0%, #eaf4ff 55%, #e3efff 100%);
  border: 1px solid var(--blue-100); overflow: hidden;
}
.body-3d-inner {
  position: relative; width: 100%; height: 100%; transform-style: preserve-3d;
  transition: transform .7s cubic-bezier(.2,.8,.2,1);
}
.body-face {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  backface-visibility: hidden; -webkit-backface-visibility: hidden; padding: 8px;
}
.body-face svg { width: 100%; max-width: 260px; height: auto; overflow: visible; }
.body-face-back { transform: rotateY(180deg); }
.body-controls { display: flex; gap: 8px; align-items: center; justify-content: center; }
.body-ctrl {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--navy-800); font-size: .74rem; font-weight: 600;
}
.body-ctrl:hover { background: var(--blue-50); border-color: var(--blue-200); color: var(--blue-700); }
.body-hint { margin: 0; text-align: center; }
.body-legend-wrap { min-width: 0; }
.body-selected { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; background: var(--blue-50); border: 1px solid var(--blue-100); }
.body-selected-label { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.body-selected strong { font-size: .9rem; color: var(--navy-900); }
.speak-selected { margin-left: auto; width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--blue-200); background: var(--surface); color: var(--blue-700); display: inline-grid; place-items: center; }
.speak-selected:hover { background: var(--teal-50); border-color: var(--teal-500); color: var(--teal-700); }

/* kid / picture cards */
.kid-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.kid-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 12px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--surface); text-align: center; transition: all .2s var(--ease);
}
.kid-card:hover { transform: translateY(-3px); border-color: var(--blue-200); box-shadow: var(--shadow-sm); }
.kid-card.is-active { border-color: var(--teal-500); background: var(--teal-50); box-shadow: 0 0 0 3px rgba(20,184,166,.12); }
.kid-card strong { font-size: .78rem; color: var(--navy-900); line-height: 1.2; }
.kid-card small { font-size: .66rem; color: var(--muted); line-height: 1.3; }
.kid-art { width: 92px; height: 92px; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #eaf4ff); }
.kid-art svg { width: 100%; height: 100%; overflow: visible; }
.kid-body { fill: #ffe3c4; stroke: #f2c89a; stroke-width: 1.5; }
.kid-face { fill: #5a4636; }
.kid-mouth { fill: none; stroke: #5a4636; stroke-width: 2.2; stroke-linecap: round; }
.kid-mouth.open { fill: #ff9aa8; stroke: #d76b7a; }
.kid-arm, .kid-limb, .kid-ear { fill: none; stroke: #f2c89a; stroke-width: 4; stroke-linecap: round; }
.kid-ouch { fill: rgba(239,68,68,.16); stroke: #ef4444; stroke-width: 1.5; animation: pulseSoft 1.8s infinite; }
.kid-bolt { fill: none; stroke: #f59e0b; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.kid-lungs { fill: rgba(47,134,234,.18); stroke: #2f86ea; stroke-width: 1.4; animation: breathe 3s ease-in-out infinite; }
.kid-heart { fill: #ff6b7a; stroke: #e24d5d; stroke-width: 1.2; transform-origin: 60px 58px; animation: heartbeat 1.2s ease-in-out infinite; }
.kid-ecg { fill: none; stroke: #14b8a6; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 180; stroke-dashoffset: 180; animation: ecgDraw 2.2s linear infinite; }
.kid-tummy { fill: rgba(47,134,234,.12); stroke: #8fc0f5; stroke-width: 1.4; }
.kid-wave { fill: none; stroke: #2f86ea; stroke-width: 2; stroke-linecap: round; animation: waveMove 2s ease-in-out infinite; }
.kid-spot { fill: #f87171; }
.kid-plaster { fill: #fcd34d; stroke: #d97706; stroke-width: 1.2; }

/* clips / animated guides */
.clip-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 16px; align-items: start; }
.clip-stage {
  position: relative; min-height: 280px; border-radius: 18px; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, #0e355f 0%, #0b2545 55%, #082038 100%);
  border: 1px solid rgba(47,134,234,.25);
}
.clip-scene { position: absolute; inset: 0; padding: 10px 14px 54px; opacity: 0; transform: scale(.98); transition: opacity .35s ease, transform .35s ease; }
.clip-scene.is-active { opacity: 1; transform: scale(1); }
.clip-scene svg { width: 100%; height: 100%; }
.clip-figure circle, .clip-figure path { fill: rgba(238,246,255,.16); stroke: rgba(185,216,255,.55); stroke-width: 2; }
.clip-zone { fill: rgba(239,68,68,.18); stroke: #f87171; stroke-width: 2; animation: pulseSoft 1.8s infinite; }
.clip-heart { fill: #ff6b7a; transform-origin: 160px 108px; animation: heartbeat 1.2s ease-in-out infinite; }
.clip-ecg { fill: none; stroke: #2dd4bf; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 420; stroke-dashoffset: 420; animation: ecgDraw 2.4s linear infinite; }
.clip-lungs { fill: rgba(47,134,234,.25); stroke: #8ec5ff; stroke-width: 2; transform-origin: 160px 120px; animation: breathe 3s ease-in-out infinite; }
.clip-air { fill: rgba(173,216,255,.9); animation: floatY 2.4s ease-in-out infinite; }
.clip-air.delay { animation-delay: .6s; } .clip-air.delay2 { animation-delay: 1.2s; }
.clip-spin { transform-origin: 160px 78px; animation: spinSlow 8s linear infinite; }
.clip-spark { fill: #fbbf24; animation: pulseSoft 1.4s infinite; }
.clip-spark.delay { animation-delay: .4s; } .clip-spark.delay2 { animation-delay: .8s; }
.clip-wave { fill: none; stroke: #5eead4; stroke-width: 3; stroke-linecap: round; animation: waveMove 2s ease-in-out infinite; }
.clip-ring { fill: none; stroke: rgba(94,234,212,.7); stroke-width: 2; animation: ringPulse 2.2s ease-out infinite; }
.clip-ring.delay { animation-delay: 1.1s; }
.clip-badge { position: absolute; left: 14px; top: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); color: #fff; font-size: .72rem; font-weight: 600; backdrop-filter: blur(4px); }
.clip-caption { position: absolute; left: 14px; right: 14px; bottom: 26px; color: rgba(255,255,255,.92); font-size: .78rem; line-height: 1.45; }
.clip-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.12); }
.clip-bar > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #14b8a6, #2f86ea); }
.clip-side { display: flex; flex-direction: column; gap: 10px; }
.clip-list { display: flex; flex-direction: column; gap: 8px; }
.clip-option {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); font-size: .78rem; font-weight: 600; text-align: left;
}
.clip-option i { color: var(--blue-600); }
.clip-option:hover, .clip-option.is-active { border-color: var(--teal-500); background: var(--teal-50); color: var(--teal-700); }
.clip-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===================================================== health animations / decor */
.health-orbit {
  position: relative; width: 100%; max-width: 320px; aspect-ratio: 1; margin: 0 auto;
  border-radius: 50%; background: radial-gradient(circle at 50% 50%, rgba(20,184,166,.08), rgba(47,134,234,.04) 55%, transparent 70%);
}
.health-orbit .orbit-ring { position: absolute; inset: 14%; border-radius: 50%; border: 1px dashed rgba(47,134,234,.35); animation: spinSlow 22s linear infinite; }
.health-orbit .orbit-ring.r2 { inset: 26%; animation-duration: 16s; animation-direction: reverse; border-color: rgba(20,184,166,.35); }
.health-orbit .orbit-core { position: absolute; inset: 38%; border-radius: 50%; background: linear-gradient(145deg, var(--accent-strong), var(--accent)); display: grid; place-items: center; color: #fff; box-shadow: 0 10px 30px var(--accent-glow); }
.health-orbit .orbit-core i { font-size: 2rem; color: #7dd3fc; animation: heartbeat 1.6s ease-in-out infinite; }
.orbit-node {
  position: absolute; width: 42px; height: 42px; margin: -21px; border-radius: 14px; background: var(--surface);
  border: 1px solid var(--blue-100); box-shadow: var(--shadow-sm); display: grid; place-items: center; color: var(--blue-700);
  animation: floatY 5s ease-in-out infinite;
}
.orbit-node.n1 { top: 8%; left: 50%; } .orbit-node.n2 { top: 50%; left: 94%; animation-delay: -1s; }
.orbit-node.n3 { top: 92%; left: 50%; animation-delay: -2s; } .orbit-node.n4 { top: 50%; left: 6%; animation-delay: -3s; }

.ecg-strip { height: 54px; border-radius: 12px; background: #081b30; padding: 8px 10px; overflow: hidden; position: relative; }
.ecg-strip svg { width: 100%; height: 100%; }
.ecg-strip path { fill: none; stroke: #2dd4bf; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 600; stroke-dashoffset: 600; animation: ecgDraw 2.6s linear infinite; }

.health-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.health-tile {
  position: relative; padding: 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface);
  overflow: hidden; transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.health-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.health-tile .tile-art { height: 88px; display: grid; place-items: center; margin-bottom: 8px; }
.health-tile .tile-art svg { width: 88px; height: 88px; overflow: visible; }
.health-tile h4 { margin: 0 0 4px; font-size: .86rem; }
.health-tile p { margin: 0; font-size: .7rem; color: var(--muted); line-height: 1.5; }
.tile-glow { position: absolute; width: 120px; height: 120px; border-radius: 50%; right: -30px; top: -30px; background: radial-gradient(circle, rgba(47,134,234,.12), transparent 70%); pointer-events: none; }

@keyframes heartbeat { 0%, 100% { transform: scale(1); } 14% { transform: scale(1.12); } 28% { transform: scale(1); } 42% { transform: scale(1.08); } 70% { transform: scale(1); } }
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: .9; } 50% { transform: scale(1.06); opacity: 1; } }
@keyframes ecgDraw { to { stroke-dashoffset: 0; } }
@keyframes waveMove { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(3px); } }
@keyframes spinSlow { to { transform: rotate(360deg); } }
@keyframes ringPulse { 0% { transform: scale(.7); opacity: .8; } 100% { transform: scale(1.5); opacity: 0; } }

/* ===================================================== photo gallery / care in motion */
.photo-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.photo-tile {
  position: relative; margin: 0; border-radius: 18px; overflow: hidden;
  aspect-ratio: 4 / 3; background: #0b2545; box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
  animation: fadeUp 0.6s var(--ease) both;
}
.photo-tile:nth-child(1) { animation-delay: 0.05s; }
.photo-tile:nth-child(2) { animation-delay: 0.14s; }
.photo-tile:nth-child(3) { animation-delay: 0.23s; }
.photo-tile:nth-child(4) { animation-delay: 0.32s; }
.photo-tile img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  animation: kenburns 18s ease-in-out infinite alternate;
  transition: transform 0.4s var(--ease);
}
.photo-tile:nth-child(2) img { animation-delay: -6s; }
.photo-tile:nth-child(3) img { animation-delay: -11s; }
.photo-tile:nth-child(4) img { animation-delay: -3s; }
.photo-tile:hover { transform: translateY(-5px); box-shadow: 0 16px 34px rgba(11, 37, 69, 0.22); }
.photo-tile:hover img { animation-play-state: paused; transform: scale(1.07); }
.photo-tile::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11, 37, 69, 0) 38%, rgba(11, 37, 69, 0.82) 100%);
  pointer-events: none;
}
.photo-sheen {
  position: absolute; top: -60%; left: -80%; width: 60%; height: 220%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: rotate(12deg); pointer-events: none;
  animation: sheen 6.5s ease-in-out infinite;
}
.photo-tile:nth-child(2) .photo-sheen { animation-delay: -2s; }
.photo-tile:nth-child(3) .photo-sheen { animation-delay: -4s; }
.photo-tile:nth-child(4) .photo-sheen { animation-delay: -1s; }
.photo-badge {
  position: absolute; z-index: 1; top: 10px; inset-inline-end: 10px;
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px;
  background: rgba(255, 255, 255, 0.18); border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff; backdrop-filter: blur(6px); animation: floatY 4.5s ease-in-out infinite;
}
.photo-tile:nth-child(2) .photo-badge { animation-delay: -1.5s; }
.photo-tile:nth-child(3) .photo-badge { animation-delay: -3s; color: #ffd9de; animation-name: heartbeat; }
.photo-tile:nth-child(4) .photo-badge { animation-delay: -2s; color: #ffd9de; animation-name: heartbeat; animation-duration: 1.4s; }
.photo-tile figcaption {
  position: absolute; z-index: 1; inset: auto 0 0 0; padding: 30px 14px 12px;
  color: #fff; display: flex; flex-direction: column; gap: 2px; pointer-events: none;
}
.photo-tile figcaption strong { font-size: 0.84rem; letter-spacing: -0.01em; }
.photo-tile figcaption span { font-size: 0.68rem; opacity: 0.85; line-height: 1.4; }

@keyframes kenburns {
  from { transform: scale(1) translate(0, 0); }
  to { transform: scale(1.12) translate(-2%, 2%); }
}
@keyframes sheen {
  0%, 55% { left: -80%; opacity: 0; }
  65% { opacity: 1; }
  85%, 100% { left: 120%; opacity: 0; }
}
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ===================================================== site-wide motion boost */
.hero .aurora {
  position: absolute; border-radius: 50%; filter: blur(60px); pointer-events: none; z-index: 0;
  mix-blend-mode: screen; opacity: 0.55;
}
.hero .aurora-a {
  width: 340px; height: 340px; left: -110px; bottom: -140px;
  background: radial-gradient(circle, rgba(20, 184, 166, 0.5), transparent 70%);
  animation: driftA 14s ease-in-out infinite alternate;
}
.hero .aurora-b {
  width: 300px; height: 300px; right: 18%; top: -110px;
  background: radial-gradient(circle, rgba(47, 134, 234, 0.45), transparent 70%);
  animation: driftB 18s ease-in-out infinite alternate;
}
@keyframes driftA {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(90px, -50px) scale(1.25); }
}
@keyframes driftB {
  from { transform: translate(0, 0) scale(1.1); }
  to { transform: translate(-70px, 60px) scale(0.9); }
}
.hero-ecg {
  position: absolute; left: 0; right: 0; bottom: 0; height: 58px;
  opacity: 0.5; pointer-events: none;
}
.hero-ecg svg { width: 100%; height: 100%; }
.hero-ecg path {
  fill: none; stroke: #2dd4bf; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 700; stroke-dashoffset: 700; animation: ecgDraw 3.4s linear infinite;
}

.section-head h2 { position: relative; padding-bottom: 8px; }
.section-head h2::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 4px; width: 58px; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--blue-600), var(--accent));
  background-size: 200% 100%;
  animation: gradientShift 5s ease-in-out infinite;
}
[dir="rtl"] .section-head h2::after { left: auto; right: 0; }

.btn { position: relative; overflow: hidden; }
.btn::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -70%; width: 40%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-18deg); transition: left 0.55s ease; pointer-events: none;
}
.btn:hover::after { left: 130%; }

.panel { transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease); }
.panel:hover { box-shadow: 0 12px 30px rgba(11, 37, 69, 0.09); }
.feature-card, .stat-card { transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease); }
.feature-card:hover, .stat-card:hover { transform: translateY(-4px); box-shadow: 0 14px 32px rgba(11, 37, 69, 0.12); }
.feature-card .feature-icon { animation: floatY 5s ease-in-out infinite; }
.feature-card:nth-child(2n) .feature-icon { animation-delay: -2.2s; }
.feature-card:hover .feature-icon { animation: heartbeat 1.2s ease-in-out infinite; color: #fff; background: linear-gradient(135deg, var(--blue-600), var(--teal-500)); }

.nav-link i { transition: transform 0.2s var(--ease); }
.nav-link:hover i { transform: scale(1.18); }
.nav-link.active::before { content: ""; position: absolute; left: 0; top: 18%; bottom: 18%; width: 3px; border-radius: 999px; background: linear-gradient(180deg, var(--accent), var(--accent-strong)); background-size: 100% 200%; animation: gradientShift 4s ease-in-out infinite; }

.badge-soft { transition: transform 0.18s var(--ease); }
.badge-soft:hover { transform: translateY(-1px); }

/* ===================================================== dark theme */
[data-theme="dark"] {
  --bg: #081426;
  --surface: #0f2036;
  --surface-2: #142a48;
  --white: #0f2036;
  --ink: #e6f0fb;
  --ink-soft: #c3d5ea;
  --muted: #8fa9c7;
  --line: #21395a;
  --line-strong: #2c4a72;
  --blue-50: #122642;
  --blue-100: #183054;
  --blue-200: #27497a;
  --blue-700: #8ab6f2;
  --teal-50: #0b2a35;
  --teal-100: #114b58;
  --teal-700: #3ecfbf;
  --navy-900: #dce9fa;
  --navy-800: #c8dcf3;
  --navy-700: #a9c6e8;
  --danger-soft: #3a1220;
  --warning-soft: #33240d;
  --success-soft: #0d2e1f;
  --info-soft: #122642;
  --shadow-xs: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 30px 70px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] body {
  background-image:
    radial-gradient(900px 500px at 85% -10%, rgba(47, 134, 234, 0.08), transparent 65%),
    radial-gradient(700px 480px at 0% 100%, rgba(20, 184, 166, 0.06), transparent 60%);
}
[data-theme="dark"] .topbar {
  background: rgba(8, 20, 38, 0.86);
  border-bottom-color: var(--line);
}
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background-color: #0c1c33;
  color: var(--ink);
}
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
  background-color: #0c1c33;
  box-shadow: 0 0 0 4px rgba(47, 134, 234, 0.22);
}
[data-theme="dark"] .form-control::placeholder { color: #5f7793; }
[data-theme="dark"] .input-group-text {
  background: var(--blue-50);
  border-color: var(--line-strong);
  color: var(--ink-soft);
}
[data-theme="dark"] .table > :not(caption) > * > * { color: var(--ink); }
[data-theme="dark"] .table thead th {
  background: #122642;
  color: var(--muted);
  border-bottom-color: var(--line);
}
[data-theme="dark"] .table-hover > tbody > tr:hover > * {
  --bs-table-accent-bg: #122642;
  color: var(--ink);
}
[data-theme="dark"] .dropdown-menu {
  background: #10233d;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--ink);
}
[data-theme="dark"] .dropdown-item { color: var(--ink-soft); }
[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus { background: var(--blue-50); color: #fff; }
[data-theme="dark"] .dropdown-item.active,
[data-theme="dark"] .dropdown-item:active { background: var(--accent-strong, #1557b0); color: #fff; }
[data-theme="dark"] .dropdown-divider { border-color: var(--line); }
[data-theme="dark"] .dropdown-item.text-danger { color: #ff8f98 !important; }
[data-theme="dark"] .modal-content {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
}
[data-theme="dark"] .btn-primary {
  background: linear-gradient(135deg, #1d6fd6, #1557b0);
}
[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] .btn-primary:focus {
  background: linear-gradient(135deg, #2f86ea, #1d6fd6);
}
[data-theme="dark"] .btn-outline-secondary {
  color: var(--ink-soft);
  border-color: var(--line-strong);
}
[data-theme="dark"] .btn-outline-secondary:hover {
  background: var(--blue-50);
  border-color: var(--blue-200);
  color: var(--blue-700);
}
[data-theme="dark"] .btn-soft {
  background: var(--blue-50);
  color: var(--blue-700);
  border-color: var(--line);
}
[data-theme="dark"] .btn-soft:hover { background: var(--blue-100); border-color: var(--blue-200); }
[data-theme="dark"] .category-card { background: var(--surface-2); }
[data-theme="dark"] .category-card:hover { background: #183054; }
[data-theme="dark"] .record-tabs a { background: var(--surface-2); color: var(--muted); }
[data-theme="dark"] .record-tabs a.active,
[data-theme="dark"] .record-tabs a:hover { background: var(--blue-50); color: var(--blue-700); }
[data-theme="dark"] .demo-row:hover,
[data-theme="dark"] .demo-row:focus-visible { background: #183054; }
[data-theme="dark"] .info-box { background: #10233d; }
[data-theme="dark"] .knowledge-result { background: #10233d; }
[data-theme="dark"] .danger-box {
  background: linear-gradient(135deg, #2a0d14, #1c0a10);
  border-color: #5a2430;
}
[data-theme="dark"] .network-url,
[data-theme="dark"] .secret-box { background: #071527; border: 1px solid var(--line); }
[data-theme="dark"] .offline-banner { background: #33240d; color: #ffc36b; }
[data-theme="dark"] .alert-info { border-color: var(--blue-200); }
[data-theme="dark"] .alert.alert-info .btn-close { filter: invert(1); }
[data-theme="dark"] .auth-shell { border-color: var(--line); }
[data-theme="dark"] .emergency-strip .icon {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
}
[data-theme="dark"] .timeline-item::before { background: var(--surface-2); border-color: var(--line-strong); }
[data-theme="dark"] .lang-toggle,
[data-theme="dark"] .user-menu-toggle,
[data-theme="dark"] .icon-btn,
[data-theme="dark"] .speak-selected,
[data-theme="dark"] .tool-chip,
[data-theme="dark"] .pain-tab,
[data-theme="dark"] .body-ctrl,
[data-theme="dark"] .clip-option { color: var(--ink-soft); }
[data-theme="dark"] .page-heading p,
[data-theme="dark"] .muted { color: var(--muted); }
[data-theme="dark"] .text-navy { color: var(--navy-900); }
[data-theme="dark"] ::selection { background: var(--teal-100); color: #e6f0fb; }
[data-theme="dark"] .video-btn:hover { background: #fff; }

/* =============================================== theme + font-size controls */
.theme-toggle,
.font-stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.theme-toggle {
  width: 38px;
  height: 38px;
  justify-content: center;
  color: var(--ink-soft);
  font-size: 0.95rem;
  cursor: pointer;
}
.theme-toggle:hover {
  border-color: var(--blue-200);
  color: var(--blue-700);
  box-shadow: var(--shadow-xs);
}
.theme-toggle i { transition: transform 0.35s var(--ease); }
.theme-toggle:hover i { transform: rotate(-18deg) scale(1.08); }
.theme-toggle .tog-dark { display: none; }
[data-theme="dark"] .theme-toggle .tog-light { display: none; }
[data-theme="dark"] .theme-toggle .tog-dark { display: inline-block; }
.font-stepper { padding: 0 4px; height: 38px; }
.font-stepper button {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  width: 26px;
  height: 30px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}
.font-stepper button:hover { background: var(--blue-50); color: var(--blue-700); }
.font-stepper .font-value {
  min-width: 34px;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.font-stepper .font-value small { display: block; font-size: 0.55rem; color: var(--muted); }
html[data-font-anim] { transition: font-size 0.25s var(--ease); }

/* ================================================= admin appearance page */
.role-color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.role-color-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s ease;
}
.role-color-row:hover {
  transform: translateY(-2px);
  border-color: var(--blue-200);
  box-shadow: var(--shadow-xs);
}
.role-swatch {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 12px;
  border: 3px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 12px rgba(11, 37, 69, 0.18);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.role-color-row:hover .role-swatch { transform: scale(1.07) rotate(-3deg); box-shadow: 0 8px 18px rgba(11, 37, 69, 0.24); }
.role-color-meta { min-width: 0; flex: 1; }
.role-color-meta strong { display: block; font-size: 0.84rem; color: var(--ink); }
.role-color-meta small { color: var(--muted); font-size: 0.68rem; }
.role-color-input {
  width: 44px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  cursor: pointer;
}
.role-hex {
  width: 92px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.76rem !important;
  text-transform: lowercase;
}
.preview-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 18px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.preview-nav { display: flex; gap: 8px; }
.preview-nav-item {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  transition: all 0.25s var(--ease);
}
.preview-nav-item.is-active {
  background: var(--preview-accent, var(--accent));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 16px rgba(11, 37, 69, 0.16);
}

/* ===================================================== RTL support */
[dir="rtl"] body { text-align: right; }
[dir="rtl"] .sidebar { inset: 0 0 0 auto; }
[dir="rtl"] .app-main { margin-left: 0; margin-right: var(--sidebar-w); }
[dir="rtl"] .nav-link:hover { transform: translateX(-3px); }
[dir="rtl"] .nav-link.active::before { left: auto; right: 0; }
[dir="rtl"] .timeline { padding-left: 0; padding-right: 22px; }
[dir="rtl"] .timeline::before { left: auto; right: 6px; }
[dir="rtl"] .timeline-item::before { left: auto; right: -21px; }
[dir="rtl"] .table-actions { justify-content: flex-start; }
[dir="rtl"] .network-url .copy { margin-left: 0; margin-right: auto; }
@media (max-width: 992px) {
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  [dir="rtl"] body.sidebar-open .sidebar { transform: translateX(0); }
  [dir="rtl"] .app-main { margin-right: 0; }
}

/* Print: reports and prescriptions */
@media print {
  body { background: #fff !important; background-image: none !important; }
  .sidebar, .topbar, .app-footer, .sidebar-backdrop, .no-print, .flash-stack, .sos-btn { display: none !important; }
  .app-main { margin: 0 !important; }
  .page-content { padding: 0 !important; max-width: none !important; }
  .panel { box-shadow: none !important; border: none !important; padding: 0 !important; }
  .print-only { display: block !important; }
  a { color: #000 !important; text-decoration: none !important; }
  .table { font-size: 10pt; }
  .table thead th { background: #eef6ff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .badge-soft { border: 1px solid #ccc !important; }
  @page { margin: 16mm; }
}
