/* ============================================================
   BaYmax Prototype — dashboard UI (v2)
   Light medical-tech theme · inspired by soft blue clinic design
   ============================================================ */

:root {
  --bg: #e8f1fa;
  --bg-soft: #f4f9fe;
  --panel: #dbeafc;
  --card: rgba(255, 255, 255, 0.82);
  --card-hover: rgba(255, 255, 255, 0.97);
  --card-solid: #ffffff;
  --line: rgba(30, 74, 122, 0.09);
  --line-strong: rgba(30, 74, 122, 0.18);
  --ink: #123a5e;
  --body: #3a587c;
  --muted: #6f8aa9;
  --faint: #97abc3;

  --teal: #2f8bf0;
  --teal-bright: #5ea7ff;
  --teal-deep: #1d6fd6;
  --teal-glow: rgba(47, 139, 240, 0.35);
  --cyan: #2fb9e8;
  --blue: #2f8bf0;
  --rose: #f4574d;
  --amber: #f5a623;
  --green: #2fbf71;
  --purple: #8f7bf0;
  --indigo: #6f7bf0;
  --heart: #f4574d;

  --side-a: #14406b;
  --side-b: #0c2947;

  --grad: linear-gradient(135deg, #42aefc 0%, #2f7bf0 60%, #2e63ee 100%);
  --grad-hover: linear-gradient(135deg, #5cbcff 0%, #4793f7 60%, #3f7cf7 100%);
  --grad-soft: linear-gradient(135deg, rgba(66, 174, 252, 0.1), rgba(47, 123, 240, 0.08));
  --grad-warm: linear-gradient(135deg, #f4574d 0%, #ff7a6b 100%);
  --grad-cool: linear-gradient(135deg, #2fb9e8 0%, #8f7bf0 100%);
  --num-grad-teal: linear-gradient(160deg, #2f8bf0 10%, #1d6fd6 100%);
  --num-grad-cyan: linear-gradient(160deg, #2fb9e8 10%, #1d95d6 100%);

  --r-sm: 14px;
  --r-md: 20px;
  --r-lg: 26px;
  --shadow: 0 24px 50px -20px rgba(30, 84, 136, 0.28), 0 4px 14px -8px rgba(30, 84, 136, 0.14);
  --shadow-soft: 0 12px 30px -14px rgba(30, 84, 136, 0.22);
  --shadow-glow: 0 14px 40px -14px rgba(47, 139, 240, 0.45);
  --shadow-rose: 0 12px 30px -12px rgba(244, 87, 77, 0.4);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.4, 1);

  --font-head: 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  /* Sidebar */
  --sidebar-width: 280px;
  --sidebar-collapsed: 84px;
  --sidebar-gap: 18px;
}

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

html { scroll-behavior: smooth; }

::selection { background: rgba(47, 139, 240, 0.25); color: #0c2947; }

body {
  min-height: 100vh;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--body);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 { font-family: var(--font-head); color: var(--ink); line-height: 1.25; }

button, input, select, textarea { font-family: inherit; }
button { cursor: pointer; border: 0; background: none; color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
a { color: var(--blue); text-decoration: none; }

.scrollbar-light::-webkit-scrollbar,
.messages::-webkit-scrollbar { width: 5px; }
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb { background: rgba(30, 84, 136, 0.18); border-radius: 10px; }
.messages::-webkit-scrollbar-thumb:hover { background: rgba(30, 84, 136, 0.35); }

/* ---------- Background ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background:
    radial-gradient(1100px 640px at 85% -10%, #d5e9fc 0%, transparent 60%),
    radial-gradient(900px 600px at -6% 104%, #d1e5f8 0%, transparent 55%),
    radial-gradient(760px 520px at 55% 45%, rgba(255, 255, 255, 0.65) 0%, transparent 70%),
    linear-gradient(180deg, #e9f3fb 0%, #dbecfa 55%, #e3f0fc 100%); }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; animation: float 18s ease-in-out infinite; }
.orb-teal { width: 460px; height: 460px; background: #b7dbff; top: 6%; inset-inline-start: -140px; }
.orb-cyan { width: 420px; height: 420px; background: #bfe3fb; bottom: -140px; inset-inline-end: -110px; animation-delay: -7s; }
@keyframes float { 0%, 100% { transform: translate3d(0, 0, 0) scale(1); } 50% { transform: translate3d(30px, -30px, 0) scale(1.08); } }
.grid-lines { position: absolute; inset: 0; opacity: 0.5;
  background-image: linear-gradient(rgba(255, 255, 255, 0.55) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255, 255, 255, 0.55) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 78%); }

@keyframes slideIn { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
@keyframes glowPulse { 0%, 100% { box-shadow: 0 10px 26px rgba(47, 139, 240, 0.3); } 50% { box-shadow: 0 14px 40px rgba(47, 139, 240, 0.5); } }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: var(--sidebar-gap);
  bottom: var(--sidebar-gap);
  left: var(--sidebar-gap);
  width: var(--sidebar-width);
  background:
    radial-gradient(120% 55% at 50% -8%, rgba(94, 167, 255, 0.16) 0%, transparent 62%),
    linear-gradient(180deg, var(--side-a) 0%, var(--side-b) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.3s var(--ease);
  box-shadow:
    0 30px 60px -20px rgba(12, 41, 71, 0.55),
    0 10px 28px -14px rgba(12, 41, 71, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.sidebar::before {
  content: '';
  position: absolute;
  top: -70px;
  inset-inline: -20%;
  height: 170px;
  background: radial-gradient(55% 100% at 50% 0%, rgba(94, 167, 255, 0.2), transparent 70%);
  pointer-events: none;
}

.sidebar::after {
  content: '';
  position: absolute;
  inset-inline: 14px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(94, 167, 255, 0.28), transparent);
  pointer-events: none;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-header {
  padding: 22px 16px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

.sidebar.collapsed .sidebar-header { padding: 20px 12px; }

.brand { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; }

.brand-mark {
  width: 42px; height: 42px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--grad);
  border-radius: 13px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow:
    0 10px 22px -6px rgba(47, 139, 240, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -2px 6px rgba(0, 0, 0, 0.18);
}
.brand-mark svg { width: 22px; height: 22px; }

.brand-text { min-width: 0; }
.brand-text h1 { font-size: 1.05rem; font-weight: 800; color: #fff; letter-spacing: -0.2px; line-height: 1.15; }
.brand-text p { font-size: 0.62rem; color: rgba(190, 220, 248, 0.6); letter-spacing: 1px; text-transform: uppercase; }

.sidebar.collapsed .brand-text { display: none; }

.sidebar-toggle {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(214, 233, 252, 0.7);
  transition: all 0.25s var(--ease);
  flex-shrink: 0;
}

.sidebar-toggle svg { width: 16px; height: 16px; transition: transform 0.3s var(--ease); }
.sidebar.collapsed .sidebar-toggle svg { transform: rotate(180deg); }

.sidebar-toggle:hover { background: rgba(47, 139, 240, 0.32); color: #fff; border-color: rgba(94, 167, 255, 0.35); transform: translateX(-1px); }

.sidebar-nav {
  flex: 1;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.sidebar-nav::before {
  content: 'Menu';
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: rgba(206, 227, 248, 0.35);
  padding: 8px 14px 2px;
}
.sidebar.collapsed .sidebar-nav::before { content: ''; padding: 0; position: absolute; }

.nav-item::after {
  content: '';
  position: absolute;
  inset-block: 6px;
  inset-inline-start: 0;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, #6cb2ff, #2fb9e8);
  box-shadow: 0 0 10px rgba(94, 167, 255, 0.75);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.nav-item.active::after { opacity: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  color: rgba(206, 227, 248, 0.72);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  transition: all 0.25s var(--ease);
  position: relative;
}

.nav-item svg {
  width: 20px; height: 20px; flex-shrink: 0;
  transition: transform 0.25s var(--ease);
}

.nav-item.active svg { transform: scale(1.05); }

.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; transform: translateX(2px); }
.nav-item:hover svg { transform: scale(1.1); }

.nav-item.active {
  background: var(--grad);
  color: #fff;
  box-shadow:
    0 12px 26px -8px rgba(47, 139, 240, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }
.sidebar.collapsed .nav-item span { display: none; }
.sidebar.collapsed .nav-item:hover { transform: none; }

.sidebar.collapsed .nav-item::before {
  content: attr(data-view);
  position: absolute;
  left: calc(100% + 14px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: rgba(12, 41, 71, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: capitalize;
  padding: 6px 11px;
  border-radius: 9px;
  white-space: nowrap;
  box-shadow: 0 12px 26px -8px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  z-index: 20;
}
.sidebar.collapsed .nav-item:hover::before {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  justify-content: center;
}

.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  width: 100%;
  justify-content: center;
  font-size: 0.68rem; font-weight: 600; color: rgba(206, 227, 248, 0.75);
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 12px; border-radius: 999px; white-space: nowrap;
}
.status-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); animation: blink 1.6s infinite; flex-shrink: 0; }
.status-pill.is-on .dot { background: var(--green); animation: blink 1.6s infinite, pillPulse 2.2s infinite; }
.status-pill.is-off .dot { background: var(--faint); animation: none; }
.status-pill span:last-child { overflow: hidden; text-overflow: ellipsis; }

.sidebar.collapsed .status-pill span:last-child { display: none; }
.sidebar.collapsed .status-pill { width: 44px; padding: 8px 0; }

/* ---------- Main Content ---------- */
.main-content {
  margin-left: calc(var(--sidebar-width) + var(--sidebar-gap));
  margin-right: 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s var(--ease);
}

.sidebar.collapsed ~ .main-content {
  margin-left: calc(var(--sidebar-collapsed) + var(--sidebar-gap) + 6px);
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 4px 0;
}

.topbar-title-wrap { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.topbar-title-wrap h2 { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.3px; }

.topbar-tools { display: flex; align-items: center; gap: 12px; }

.topbar-date {
  font-size: 0.76rem; font-weight: 600; color: var(--muted);
  white-space: nowrap; direction: ltr;
}

.topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--card-solid);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px 4px 16px;
  width: clamp(160px, 26vw, 320px);
  box-shadow: var(--shadow-soft);
  transition: border-color 0.25s, box-shadow 0.25s;
}
.topbar-search:focus-within { border-color: rgba(47, 139, 240, 0.45); box-shadow: var(--shadow-glow); }
.topbar-search input {
  flex: 1; min-width: 0; border: 0; outline: none; background: none;
  font-size: 0.82rem; color: var(--ink);
}
.topbar-search input::placeholder { color: var(--faint); }
.topbar-search button {
  width: 32px; height: 32px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--bg-soft); border-radius: 50%; color: var(--muted);
  transition: all 0.2s var(--ease);
}
.topbar-search button:hover { background: var(--grad-soft); color: var(--blue); }
.topbar-search svg { width: 15px; height: 15px; }

.topbar-icon {
  width: 42px; height: 42px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--card-solid); border: 1px solid var(--line);
  border-radius: 50%; color: var(--muted);
  box-shadow: var(--shadow-soft);
  transition: all 0.2s var(--ease);
  position: relative;
}
.topbar-icon:hover { color: var(--blue); border-color: rgba(47, 139, 240, 0.35); transform: translateY(-2px); }
.topbar-icon svg { width: 18px; height: 18px; }

.notif-badge {
  position: absolute;
  top: -3px;
  inset-inline-end: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: grid; place-items: center;
  background: var(--heart); color: #fff;
  font-size: 0.6rem; font-weight: 800;
  border-radius: 999px;
  border: 2px solid var(--bg);
  font-variant-numeric: tabular-nums;
}
.notif-badge[hidden] { display: none; }

.topbar-avatar {
  width: 42px; height: 42px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--grad); color: #fff;
  font-family: var(--font-head); font-weight: 800; font-size: 0.9rem;
  box-shadow: 0 10px 22px -8px rgba(47, 139, 240, 0.55);
  transition: transform 0.2s var(--ease);
}
.topbar-avatar:hover { transform: translateY(-2px); }

/* ---------- Mobile Header ---------- */
.mobile-header {
  display: none;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.mobile-header h1 { font-size: 1.2rem; font-weight: 800; }

.mobile-menu-btn {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: #fff; border: 1px solid var(--line);
  color: var(--ink);
  margin-left: 12px;
  box-shadow: var(--shadow-soft);
}

.mobile-menu-btn svg { width: 20px; height: 20px; }

/* ---------- Views ---------- */
.views-container {
  flex: 1;
  padding: 22px 4px 10px;
}

.view {
  display: none;
  animation: viewFadeIn 0.3s var(--ease);
}

.view.active { display: block; }

@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Card base ---------- */
.card {
  position: relative;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  padding: 24px;
  overflow: hidden;
  transition: transform 0.35s var(--ease), background 0.35s var(--ease), border-color 0.35s var(--ease), box-shadow 0.35s var(--ease), opacity 0.3s var(--ease);
  opacity: 0;
  animation: cardFadeIn 0.5s var(--ease) forwards;
}
@keyframes cardFadeIn { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: translateY(0); } }
.card:hover {
  background: var(--card-hover);
  box-shadow: 0 30px 60px -22px rgba(30, 84, 136, 0.35);
  transform: translateY(-3px);
}

/* soft shine along the top edge */
.card::before {
  content: '';
  position: absolute; inset: 0 0 auto; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(47, 139, 240, 0.28), transparent);
  pointer-events: none;
  z-index: 2;
}

.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.card-head h2 { font-size: 1.08rem; font-weight: 800; letter-spacing: -0.3px; }
.card-head .see-all { font-size: 0.72rem; font-weight: 700; color: var(--blue); white-space: nowrap; }
.sub { font-size: 0.76rem; color: var(--muted); margin-top: 3px; }

.see-more-row { display: flex; justify-content: flex-end; margin-top: 4px; }
.see-more-row .see-all { display: inline-flex; align-items: center; gap: 5px; }
.see-more-row .see-all svg { width: 15px; height: 15px; }

/* ---------- Home Grid ---------- */
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.5fr) minmax(0, 0.95fr);
  gap: 20px;
  max-width: 1320px;
  margin: 0 auto;
  align-items: start;
}

.home-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* ---------- 3D DNA background helix ---------- */
.bg-dna {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* Health score */
.health-score-card { text-align: center; }

.health-score-ring {
  position: relative;
  width: 168px; height: 168px;
  margin: 14px auto 12px;
}

.score-ring { width: 100%; height: 100%; transform: rotate(-90deg); }

.score-ring .ring-track {
  fill: none;
  stroke: rgba(30, 84, 136, 0.09);
  stroke-width: 10;
}

.score-ring .ring-fill.score {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 326.7;
  transition: stroke-dashoffset 0.7s var(--ease), stroke 0.4s;
  filter: drop-shadow(0 5px 10px rgba(47, 139, 240, 0.35));
}

.score-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}

.score-number {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 2.6rem;
  color: var(--ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.score-label { font-size: 0.74rem; color: var(--faint); margin-top: 4px; font-weight: 600; }

.health-score-info { width: 100%; }

.health-score-info p { font-size: 0.82rem; color: var(--muted); margin-bottom: 14px; }

.score-factors {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.factor {
  padding: 12px 8px;
  border-radius: var(--r-sm);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  text-align: center;
}

.factor span { display: block; font-size: 0.66rem; color: var(--faint); font-weight: 700; margin-bottom: 3px; }
.factor strong { font-size: 1.15rem; color: var(--ink); font-weight: 800; font-variant-numeric: tabular-nums; }

.explore {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 16px;
  padding: 12px 24px;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  font-family: var(--font-head);
  font-weight: 700; font-size: 0.84rem;
  box-shadow: 0 14px 30px -10px rgba(47, 139, 240, 0.55);
  transition: all 0.25s var(--ease);
}
.explore svg { width: 16px; height: 16px; }
.explore:hover { background: var(--grad-hover); transform: translateY(-3px); box-shadow: 0 18px 38px -10px rgba(47, 139, 240, 0.6); }

/* Heart card (hero) */
.heart-card { display: flex; flex-direction: column; gap: 14px; }

.heart-glyph {
  width: 48px; height: 48px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 15px;
  background: rgba(244, 87, 77, 0.1);
  border: 1px solid rgba(244, 87, 77, 0.22);
  color: var(--heart);
  box-shadow: inset 0 1px 0 #fff, 0 8px 20px -10px rgba(244, 87, 77, 0.45);
}
.heart-glyph svg { width: 24px; height: 24px; fill: currentColor; }
.heart-glyph.beating { animation: heartBeat 1s ease-in-out infinite; }
@keyframes heartBeat { 0%, 100% { transform: scale(1); } 12% { transform: scale(1.14); } 24% { transform: scale(1); } 36% { transform: scale(1.09); } }

.heart-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.heart-stat {
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(244, 87, 77, 0.07), rgba(244, 87, 77, 0.02));
  border: 1px solid rgba(244, 87, 77, 0.16);
  display: flex; flex-direction: column; gap: 4px;
}
.heart-stat.blue {
  background: linear-gradient(180deg, rgba(47, 185, 232, 0.09), rgba(47, 139, 240, 0.03));
  border-color: rgba(47, 185, 232, 0.2);
}

.heart-label { font-size: 0.7rem; font-weight: 700; color: var(--muted); letter-spacing: 0.4px; text-transform: uppercase; }

.heart-num { display: flex; align-items: baseline; gap: 7px; line-height: 1; }
.heart-num strong {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 2.4rem;
  color: var(--heart);
  letter-spacing: -1.5px;
  font-variant-numeric: tabular-nums;
  transition: all 0.4s var(--ease);
}
.heart-num.blue strong { color: var(--blue); font-size: 2.2rem; letter-spacing: -1px; }
.heart-num em { font-style: normal; font-size: 0.74rem; font-weight: 700; color: var(--faint); }
.heart-num strong.waiting { opacity: 0.35; animation: pulse 2s infinite; }
.heart-num strong.updating { animation: numberPop 0.3s var(--ease); }

/* Home chart */
.home-chart { display: flex; flex-direction: column; gap: 10px; }

.chart-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.chart-head strong { font-size: 0.86rem; font-weight: 800; color: var(--ink); }

.chart-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.chart-dot.dot-red { background: var(--heart); box-shadow: 0 0 8px rgba(244, 87, 77, 0.6); }
.chart-dot.dot-teal { background: var(--blue); box-shadow: 0 0 8px rgba(47, 139, 240, 0.6); }
.chart-dot.dot-cyan { background: var(--cyan); box-shadow: 0 0 8px rgba(47, 185, 232, 0.6); }

.chart-unit { font-size: 0.7rem; color: var(--muted); }

.chart-tag {
  margin-inline-start: auto;
  font-size: 0.64rem; font-weight: 700;
  color: var(--muted);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.chart-container { height: 190px; position: relative; }
.chart-container.sm { height: 150px; }
.chart-container.is-empty { opacity: 0.25; }
.chart-container canvas { width: 100%; height: 100%; display: block; }

.chart-block { display: flex; flex-direction: column; gap: 10px; }
.chart-block + .chart-block { padding-top: 18px; border-top: 1px solid var(--line); }

.chart-stats {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  font-size: 0.74rem; color: var(--body);
}
.chart-stats span { display: inline-flex; align-items: baseline; gap: 5px; font-variant-numeric: tabular-nums; }
.chart-stats em { font-style: normal; color: var(--faint); font-size: 0.66rem; }
.chart-stats .chart-now strong { font-size: 1rem; font-weight: 800; color: var(--ink); }

.chart-verdict {
  margin-inline-start: auto;
  font-size: 0.68rem; font-weight: 700;
  padding: 3px 10px; border-radius: 999px;
  white-space: nowrap;
}
.chart-verdict.ok { color: #187a49; background: rgba(47, 191, 113, 0.12); border: 1px solid rgba(47, 191, 113, 0.35); }
.chart-verdict.warn { color: #b06a10; background: rgba(245, 166, 35, 0.12); border: 1px solid rgba(245, 166, 35, 0.35); }

.chart-empty { font-size: 0.76rem; color: var(--muted); text-align: center; padding: 4px 0 2px; }

/* Stat tiles */
.tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.tile {
  padding: 16px 18px;
  border-radius: 18px;
  display: flex; flex-direction: column; gap: 3px;
}
.tile span { font-size: 0.7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.tile strong { font-family: var(--font-head); font-size: 1.5rem; font-weight: 900; color: var(--ink); font-variant-numeric: tabular-nums; }
.tile.cyan { background: linear-gradient(180deg, rgba(47, 185, 232, 0.09), rgba(47, 139, 240, 0.03)); border-color: rgba(47, 185, 232, 0.2); }
.tile.cyan strong { color: var(--blue); }

/* Overview card */
.ov-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.ov-avatar {
  width: 50px; height: 50px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 16px;
  background: var(--grad);
  color: #fff;
  box-shadow: 0 12px 26px -10px rgba(47, 139, 240, 0.55);
}
.ov-avatar svg { width: 24px; height: 24px; }
.ov-head h3 { font-size: 1rem; font-weight: 800; }
.ov-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.stat-item {
  padding: 13px 14px;
  border-radius: 15px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  text-align: center;
}
.stat-label { display: block; font-size: 0.66rem; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.stat-value { font-size: 1.35rem; font-weight: 800; color: var(--ink); font-family: var(--font-head); font-variant-numeric: tabular-nums; }

/* Alerts */
.alerts-card h2 { font-size: 1.05rem; margin-bottom: 12px; }
.alerts-list { display: flex; flex-direction: column; gap: 10px; }
.no-alerts { text-align: center; color: var(--muted); font-size: 0.82rem; padding: 18px; }

.alert-item {
  padding: 12px 14px;
  border-radius: 15px;
  border-inline-start: 3px solid var(--green);
  background: rgba(47, 191, 113, 0.06);
}
.alert-item.critical { border-inline-start-color: var(--rose); background: rgba(244, 87, 77, 0.08); }
.alert-item.warning { border-inline-start-color: var(--amber); background: rgba(245, 166, 35, 0.09); }
.alert-item.info { border-inline-start-color: var(--cyan); background: rgba(47, 185, 232, 0.08); }

.alert-title { font-weight: 800; font-size: 0.82rem; margin-bottom: 3px; color: var(--ink); }
.alert-message { font-size: 0.76rem; color: var(--body); }
.alert-time { font-size: 0.68rem; color: var(--faint); margin-top: 5px; }

/* ---------- Vitals View ---------- */
.vitals-view-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  max-width: 1320px;
  margin: 0 auto;
}

.charts-card { display: flex; flex-direction: column; gap: 18px; }
.charts-card h2 { font-size: 1.08rem; }

.vitals-card { display: flex; flex-direction: column; gap: 18px; }

.vitals-main { display: flex; align-items: center; justify-content: space-around; gap: 12px; padding: 10px 0 6px; }

.hr-block, .spo2-block { display: flex; flex-direction: column; align-items: center; gap: 12px; }

.ring-wrap { position: relative; width: 200px; height: 200px; display: grid; place-items: center; }
.ring-wrap.small { width: 146px; height: 146px; }
.ring-wrap::before {
  content: ''; position: absolute; inset: -9px; border-radius: 50%;
  border: 1px dashed rgba(30, 84, 136, 0.16);
  pointer-events: none;
}
.ring-wrap.small::before { inset: -7px; }
.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring-track { fill: none; stroke: rgba(30, 84, 136, 0.09); stroke-width: 6; }
.ring-fill {
  fill: none; stroke-width: 6; stroke-linecap: round;
  stroke-dasharray: 326.7; stroke-dashoffset: 326.7;
  transition: stroke-dashoffset 0.7s var(--ease), stroke 0.4s;
  filter: drop-shadow(0 4px 10px rgba(47, 139, 240, 0.4));
}
.ring-fill.hr { stroke: var(--teal); }
.ring-fill.spo2 { stroke: var(--cyan); }

.ring-center { display: flex; flex-direction: column; align-items: center; line-height: 1; z-index: 1; }
.big-number {
  font-family: var(--font-head); font-weight: 900; color: var(--ink);
  font-size: 3.4rem; letter-spacing: -2.5px; font-variant-numeric: tabular-nums;
  transition: all 0.4s var(--ease);
}
.ring-wrap .big-number { color: var(--ink); }
.ring-wrap.small .big-number { color: var(--blue); font-size: 2.3rem; letter-spacing: -1.2px; }
.ring-wrap .big-number.waiting { color: var(--ink); opacity: 0.35; animation: pulse 2s infinite; }
.big-number.updating { animation: numberPop 0.3s var(--ease); }
@keyframes numberPop { 0% { transform: scale(1); } 50% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes pulse { 0%, 100% { opacity: 0.3; transform: scale(1); } 50% { opacity: 0.15; transform: scale(0.95); } }
.unit { font-size: 0.72rem; color: var(--muted); margin-top: 8px; font-weight: 700; }

.halo {
  position: absolute; inset: 12%; border-radius: 50%;
  background: radial-gradient(circle, rgba(47, 139, 240, 0.18), transparent 68%);
  opacity: 0.7; transition: transform 0.12s var(--ease), opacity 0.2s;
}
.hr-block.beating .halo { transform: scale(1.14); opacity: 1; animation: haloPulse 0.8s ease-in-out infinite; }
@keyframes haloPulse { 0%, 100% { transform: scale(1.14); opacity: 1; } 50% { transform: scale(1.18); opacity: 0.8; } }

.vital-label { display: inline-flex; align-items: center; gap: 6px; font-size: 0.84rem; font-weight: 700; color: var(--body); letter-spacing: 0.2px; }
.vital-label svg { width: 17px; height: 17px; color: var(--blue); }
.spo2-block .vital-label svg { color: var(--cyan); }

.finger-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.7rem; font-weight: 700; color: var(--muted);
  background: var(--bg-soft); border: 1px solid var(--line);
  padding: 5px 11px; border-radius: 999px; transition: all 0.3s;
}
.finger-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.finger-pill.is-on { color: #187a49; border-color: rgba(47, 191, 113, 0.35); background: rgba(47, 191, 113, 0.09); animation: pillPulse 2s ease-in-out infinite; }
@keyframes pillPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(47, 191, 113, 0.35); } 50% { box-shadow: 0 0 0 6px rgba(47, 191, 113, 0); } }
.finger-pill.is-on i { background: var(--green); }

/* Wave */
.wave-wrap {
  position: relative; height: 156px; border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--side-a), var(--side-b));
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  box-shadow: 0 16px 34px -16px rgba(12, 41, 71, 0.5);
}
#wave { width: 100%; height: 100%; display: block; }
.wave-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
  color: rgba(214, 233, 252, 0.55); font-size: 0.8rem; font-weight: 600;
  transition: all 0.4s var(--ease);
  background: rgba(12, 41, 71, 0.25);
  z-index: 1;
}
.wave-empty svg { width: 36px; height: 36px; opacity: 0.6; color: var(--teal-bright); animation: floatIcon 3s ease-in-out infinite; }
.wave-empty span { max-width: 80%; text-align: center; line-height: 1.5; }
.wave-empty.hidden { opacity: 0; pointer-events: none; transform: scale(0.95); }
@keyframes floatIcon { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.wave-legend {
  position: absolute; top: 11px; inset-inline-start: 14px; z-index: 2;
  display: flex; align-items: center; gap: 7px;
  font-size: 0.64rem; color: rgba(214, 233, 252, 0.6); letter-spacing: 0.4px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 10px; border-radius: 999px; backdrop-filter: blur(6px);
}
.wave-legend .dot-teal { width: 6px; height: 6px; border-radius: 50%; background: var(--teal-bright); box-shadow: 0 0 8px var(--teal-bright); }

/* Measure */
.measure-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.measure-meta { font-size: 0.75rem; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px;
  font-family: var(--font-head); font-weight: 700; font-size: 0.84rem; letter-spacing: 0.2px;
  border: 1px solid transparent; transition: all 0.3s var(--ease); white-space: nowrap;
  position: relative; overflow: hidden;
  line-height: 1.2;
  min-height: 48px;
  min-width: 48px;
}
.btn::after {
  content: ''; position: absolute; inset: 0; background: currentColor;
  opacity: 0; transition: opacity 0.3s;
}
.btn:active::after { opacity: 0.12; }

.btn svg { width: 18px; height: 18px; position: relative; z-index: 1; }
.btn span { position: relative; z-index: 1; }
.btn.primary {
  background: var(--grad); color: #fff;
  box-shadow: 0 14px 30px -10px rgba(47, 139, 240, 0.55);
}
.btn.primary:hover { transform: translateY(-3px); background: var(--grad-hover); box-shadow: 0 18px 38px -10px rgba(47, 139, 240, 0.6); }
.btn.primary:active { transform: translateY(-1px) scale(0.98); }
.btn.primary:focus-visible { outline: 2px solid var(--teal-deep); outline-offset: 3px; }
.btn.primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--body); box-shadow: var(--shadow-soft); }
.btn.ghost:hover { border-color: rgba(47, 139, 240, 0.35); color: var(--blue); transform: translateY(-2px); box-shadow: var(--shadow-glow); }
.btn.ghost:active { transform: translateY(0); }
.btn.ghost.danger { color: var(--rose); border-color: rgba(244, 87, 77, 0.3); background: rgba(244, 87, 77, 0.05); }
.btn.ghost.danger:hover { background: rgba(244, 87, 77, 0.12); border-color: rgba(244, 87, 77, 0.5); color: var(--rose); box-shadow: var(--shadow-rose); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.progress { height: 7px; border-radius: 999px; background: rgba(30, 84, 136, 0.08); overflow: hidden; position: relative; }
.progress span { display: block; height: 100%; width: 0%; border-radius: inherit; background: var(--grad); transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1); position: relative; }
.progress span::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

.sensor-strip {
  margin-top: auto;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  padding-top: 16px; border-top: 1px solid var(--line);
}
.sensor-item {
  display: flex; flex-direction: column; gap: 3px;
  padding: 10px 12px; border-radius: 13px;
  background: var(--bg-soft); border: 1px solid var(--line);
  transition: background 0.3s var(--ease);
}
.sensor-item:hover { background: rgba(66, 174, 252, 0.08); }
.sensor-key { font-size: 0.62rem; color: var(--faint); font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; }
.sensor-val { font-size: 0.8rem; color: var(--ink); font-weight: 700; font-family: var(--font-head); letter-spacing: 0.2px; }

/* Insights + tip */
.insights { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.insight {
  padding: 15px 17px; border-radius: var(--r-sm);
  background: var(--bg-soft); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 5px;
  transition: all 0.3s var(--ease);
}
.insight:hover {
  border-color: rgba(47, 139, 240, 0.3);
  transform: translateY(-3px);
  box-shadow: var(--shadow-soft);
}
.insight span { font-size: 0.66rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px; }
.insight strong { font-family: var(--font-head); font-size: 1.14rem; color: var(--ink); font-weight: 800; letter-spacing: -0.3px; }
.insight strong.good { color: var(--green); }
.insight strong.warn { color: var(--amber); }
.insight strong.bad { color: var(--rose); }

.tip-box {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-radius: var(--r-sm);
  background: linear-gradient(135deg, rgba(66, 174, 252, 0.1), rgba(47, 123, 240, 0.06));
  border: 1px solid rgba(47, 139, 240, 0.22);
  font-size: 0.8rem; color: var(--body); line-height: 1.65;
}
.tip-box .tip-icon { font-size: 0.95rem; color: var(--blue); line-height: 1.35; }

.live-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.7rem; font-weight: 800; color: #187a49;
  background: rgba(47, 191, 113, 0.1); border: 1px solid rgba(47, 191, 113, 0.32);
  padding: 6px 11px; border-radius: 999px; white-space: nowrap;
}
.live-badge i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: blink 1.6s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.25; transform: scale(0.8); } }

/* ---------- Placeholder Views ---------- */
.placeholder-view {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 400px; text-align: center; color: var(--muted);
}
.placeholder-view h2 { font-size: 1.5rem; margin-bottom: 12px; color: var(--ink); }
.placeholder-view p { font-size: 0.95rem; }

/* ---------- Medication View ---------- */
.medication-view {
  max-width: 800px;
  margin: 0 auto;
  display: flex; flex-direction: column; gap: 20px;
}

.medication-header-card {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 24px;
}
.medication-header-card h2 { font-size: 1.25rem; margin-bottom: 4px; }
.medication-header-card .sub { margin-bottom: 0; }

.medication-list { display: flex; flex-direction: column; gap: 16px; }

.medication-item {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 20px;
  border-radius: var(--r-md);
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: all 0.3s var(--ease);
  overflow: hidden;
}
.medication-item:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.medication-item.taken { opacity: 0.65; border-color: rgba(47, 191, 113, 0.35); }

.medication-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: grid; place-items: center;
  background: rgba(47, 139, 240, 0.09);
  border: 1px solid rgba(47, 139, 240, 0.2);
  color: var(--blue);
  flex-shrink: 0;
}
.medication-icon svg { width: 24px; height: 24px; }

.medication-info { flex: 1; min-width: 0; }
.medication-name { font-size: 0.98rem; font-weight: 800; color: var(--ink); margin-bottom: 4px; }
.medication-details { display: flex; gap: 12px; font-size: 0.76rem; color: var(--muted); flex-wrap: wrap; }
.medication-details span { display: flex; align-items: center; gap: 4px; }

.medication-actions { display: flex; gap: 8px; flex-shrink: 0; }

.medication-btn {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.78rem; font-weight: 700;
  transition: all 0.25s var(--ease);
  border: 1px solid var(--line);
}
.medication-btn.take { background: rgba(47, 191, 113, 0.12); color: #187a49; border-color: rgba(47, 191, 113, 0.35); }
.medication-btn.take:hover { background: rgba(47, 191, 113, 0.2); transform: translateY(-1px); }
.medication-btn.take.taken { background: var(--bg-soft); color: var(--muted); border-color: var(--line); }
.medication-btn.delete { background: rgba(244, 87, 77, 0.07); color: var(--rose); border-color: rgba(244, 87, 77, 0.25); }
.medication-btn.delete:hover { background: rgba(244, 87, 77, 0.15); }

.medication-empty {
  text-align: center; padding: 50px 20px; color: var(--muted);
}
.medication-empty svg { width: 60px; height: 60px; margin-bottom: 14px; opacity: 0.4; color: var(--blue); }
.medication-empty h3 { font-size: 1.15rem; margin-bottom: 8px; color: var(--ink); }
.medication-empty p { font-size: 0.88rem; margin-bottom: 20px; }

/* Medication select */
.med-select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 13px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.med-select:focus { border-color: rgba(47, 139, 240, 0.45); box-shadow: 0 0 0 3px rgba(47, 139, 240, 0.1); }

.checkbox-label {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; font-size: 0.84rem; color: var(--body);
}
.checkbox-label input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--blue); }

/* ---------- Chat ---------- */
.chat-card { display: flex; flex-direction: column; min-height: min(620px, 82vh); padding: 22px 22px 20px; }
.chat-head { padding: 6px 6px 16px; border-bottom: 1px solid var(--line); }
.bot-id { display: flex; align-items: center; gap: 13px; }

.baymax-avatar {
  position: relative; width: 52px; height: 52px; flex: 0 0 auto;
  border-radius: 50% 50% 46% 46%;
  background: linear-gradient(160deg, #ffffff 0%, #dff0fd 100%);
  box-shadow: 0 10px 24px -8px rgba(30, 84, 136, 0.35), 0 0 0 1px rgba(47, 139, 240, 0.12), inset 0 -4px 10px rgba(47, 139, 240, 0.12);
  transition: all 0.3s var(--ease);
  animation: avatarBounce 0.6s var(--ease);
}
@keyframes avatarBounce { 0% { transform: scale(0) rotate(-10deg); } 50% { transform: scale(1.1) rotate(5deg); } 100% { transform: scale(1) rotate(0deg); } }
.baymax-avatar.small { width: 34px; height: 34px; box-shadow: 0 5px 12px -4px rgba(30, 84, 136, 0.3); }

.baymax-avatar .eye { position: absolute; top: 20px; width: 7px; height: 9px; border-radius: 50%; background: #123a5e; }
.baymax-avatar.small .eye { top: 13px; width: 4.5px; height: 6px; }
.baymax-avatar .eye.left { left: 15px; }
.baymax-avatar.small .eye.left { left: 9.5px; }
.baymax-avatar .eye.right { right: 15px; }
.baymax-avatar.small .eye.right { right: 9.5px; }
.baymax-avatar .line { position: absolute; top: 23px; left: 22px; right: 22px; height: 2.5px; border-radius: 3px; background: #123a5e; }
.baymax-avatar.small .line { top: 15px; left: 14.5px; right: 14.5px; height: 1.5px; }
.baymax-avatar.talking { animation: bob 0.9s ease-in-out infinite; }
.baymax-avatar.talking .line { animation: mouth 0.45s ease-in-out infinite alternate; }
.baymax-avatar.listening { animation: avatarPing 1.6s infinite; }
.baymax-avatar.thinking { animation: think 1.2s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes mouth { from { transform: scaleX(0.55); } to { transform: scaleX(1); } }
@keyframes avatarPing { 0% { box-shadow: 0 0 0 0 rgba(47, 139, 240, 0.45); } 70% { box-shadow: 0 0 0 13px rgba(47, 139, 240, 0); } 100% { box-shadow: 0 0 0 0 rgba(47, 139, 240, 0); } }
@keyframes think { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }

.voice-bars { display: flex; align-items: flex-end; gap: 3px; height: 22px; opacity: 0; transition: opacity 0.25s; }
.voice-bars.active { opacity: 1; }
.voice-bars i { width: 3px; height: 8px; border-radius: 2px; background: var(--blue); animation: eq 0.9s ease-in-out infinite; box-shadow: 0 0 6px rgba(47, 139, 240, 0.5); }
.voice-bars i:nth-child(1) { animation-delay: 0s; }
.voice-bars i:nth-child(2) { animation-delay: 0.12s; }
.voice-bars i:nth-child(3) { animation-delay: 0.24s; }
.voice-bars i:nth-child(4) { animation-delay: 0.36s; }
.voice-bars i:nth-child(5) { animation-delay: 0.48s; }
@keyframes eq { 0%, 100% { height: 6px; } 50% { height: 20px; } }

.messages {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
  padding: 18px 4px 12px; scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

.msg { display: flex; gap: 10px; max-width: 86%; animation: msgIn 0.4s var(--ease) both; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg.bot { align-self: flex-start; }
@keyframes msgIn { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
.msg.leaving { animation: msgOut 0.3s var(--ease) forwards; }
@keyframes msgOut { to { opacity: 0; transform: translateX(20px); } }

.msg-avatar {
  width: 34px; height: 34px; flex: 0 0 auto; border-radius: 11px;
  display: grid; place-items: center; font-size: 0.78rem; font-weight: 800;
  background: var(--bg-soft); color: var(--muted);
  border: 1px solid var(--line);
}
.msg.bot .msg-avatar { background: linear-gradient(160deg, #fff, #dff0fd); color: #123a5e; border: 1px solid rgba(47, 139, 240, 0.14); }
.bubble {
  padding: 13px 17px; border-radius: 18px;
  font-size: 0.92rem; line-height: 1.65; color: var(--body);
  background: #fff;
  border: 1px solid var(--line);
  border-end-start-radius: 5px;
  box-shadow: var(--shadow-soft);
  white-space: pre-wrap; word-break: break-word;
  transition: all 0.2s var(--ease);
}
.bubble:hover { border-color: var(--line-strong); }
.msg.user .bubble {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
  border-end-start-radius: 18px; border-end-end-radius: 5px;
  box-shadow: 0 12px 26px -10px rgba(47, 139, 240, 0.5);
}
.bubble strong { color: var(--ink); }
.msg.user .bubble strong { color: #fff; }
.bubble code {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 0.82em; direction: ltr; unicode-bidi: embed;
  background: rgba(47, 139, 240, 0.08); border: 1px solid rgba(47, 139, 240, 0.16);
  padding: 1px 6px; border-radius: 6px; color: var(--teal-deep);
}
.msg.user .bubble code { background: rgba(255, 255, 255, 0.18); color: #fff; border-color: rgba(255, 255, 255, 0.25); }
.bubble .src { display: block; margin-top: 8px; font-size: 0.62rem; color: var(--faint); }
.bubble .src.ai { color: var(--blue); opacity: 0.9; font-weight: 600; }
.msg.user .bubble .src { color: rgba(255, 255, 255, 0.7); }

.typing { display: inline-flex; gap: 5px; padding: 15px 17px; animation: typingFadeIn 0.3s var(--ease); }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); opacity: 0.35; animation: typing 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.18s; }
.typing i:nth-child(3) { animation-delay: 0.36s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: 0.3; } 30% { transform: translateY(-5px); opacity: 1; } }
@keyframes typingFadeIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

.composer {
  display: flex; align-items: center; gap: 10px;
  background: #fff;
  border: 1px solid var(--line); border-radius: 24px;
  padding: 8px 10px;
  transition: all 0.3s var(--ease);
  margin-top: 8px;
  box-shadow: var(--shadow-soft);
}
.composer:focus-within {
  border-color: rgba(47, 139, 240, 0.45);
  box-shadow: 0 0 0 4px rgba(47, 139, 240, 0.08), 0 16px 34px -14px rgba(30, 84, 136, 0.35);
}
.composer input {
  flex: 1; min-width: 0; background: none; border: 0; outline: none;
  color: var(--ink); font-size: 0.92rem; padding: 10px 6px;
}
.composer input::placeholder { color: var(--faint); }

/* ---------- Attachments / multimodal composer ---------- */
.composer-wrap { position: relative; }

.attach-btn {
  width: 46px; height: 46px; flex: 0 0 auto;
  border-radius: 14px; display: grid; place-items: center;
  background: var(--bg-soft); color: var(--muted);
  border: 1px solid var(--line); transition: all 0.25s var(--ease);
  min-width: 46px; min-height: 46px;
}
.attach-btn svg { width: 20px; height: 20px; }
.attach-btn:hover, .attach-btn.active {
  color: var(--blue); border-color: rgba(47, 139, 240, 0.4);
  background: rgba(66, 174, 252, 0.09);
}
.attach-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.attach-menu {
  position: absolute; bottom: calc(100% + 12px); inset-inline-start: 0; z-index: 25;
  width: min(295px, calc(100vw - 44px)); padding: 8px;
  background: #fff; border: 1px solid var(--line-strong);
  border-radius: 18px; box-shadow: var(--shadow);
  animation: pop 0.2s var(--ease-spring);
}
.attach-menu[hidden] { display: none; }
.attach-menu button {
  display: flex; width: 100%; align-items: center; gap: 11px;
  padding: 11px 12px; border-radius: 12px; color: var(--body);
  font-size: 0.82rem; font-weight: 600; text-align: start;
  transition: all 0.2s var(--ease);
}
.attach-menu button:hover { background: rgba(66, 174, 252, 0.09); color: var(--blue); }
.attach-menu button svg { width: 18px; height: 18px; flex: none; }
.attach-note {
  padding: 9px 12px 5px; margin-top: 6px; border-top: 1px solid var(--line);
  font-size: 0.64rem; color: var(--faint); line-height: 1.5;
}

.attach-tray { display: flex; gap: 8px; overflow-x: auto; padding: 8px 2px 2px; scrollbar-width: thin; }
.attach-tray[hidden] { display: none; }
.attach-list { display: flex; gap: 8px; }
.attach-item {
  display: flex; align-items: center; gap: 9px; flex: 0 0 auto; max-width: 240px;
  padding: 6px 9px; border-radius: 14px;
  background: #fff; border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}
.attach-thumb {
  width: 40px; height: 40px; flex: 0 0 auto; border-radius: 11px;
  object-fit: cover; background: var(--bg-soft);
  display: grid; place-items: center; font-size: 1.05rem;
}
.attach-meta { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.attach-meta strong {
  font-size: 0.72rem; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px;
}
.attach-meta span { font-size: 0.6rem; color: var(--faint); }
.attach-remove {
  width: 28px; height: 28px; flex: 0 0 auto; border-radius: 9px;
  display: grid; place-items: center; color: var(--faint); font-size: 1.1rem; line-height: 1;
  transition: all 0.2s var(--ease);
}
.attach-remove:hover { color: var(--rose); background: rgba(244, 87, 77, 0.09); }

.recorder-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 15px; margin-top: 8px; border-radius: 15px;
  background: rgba(244, 87, 77, 0.06); border: 1px solid rgba(244, 87, 77, 0.28);
  font-size: 0.78rem; color: var(--body);
}
.recorder-bar[hidden] { display: none; }
.recorder-bar strong { font-family: var(--font-head); color: var(--rose); }
.recorder-time { font-family: var(--font-head); font-weight: 800; color: var(--rose); direction: ltr; }
.recorder-stop {
  margin-inline-start: auto; padding: 8px 13px; border-radius: 10px;
  background: rgba(244, 87, 77, 0.12); color: var(--rose);
  border: 1px solid rgba(244, 87, 77, 0.3); font-size: 0.72rem; font-weight: 700;
  transition: background 0.2s var(--ease);
}
.recorder-stop:hover { background: rgba(244, 87, 77, 0.22); }

.bubble-media { display: flex; flex-direction: column; gap: 9px; margin-bottom: 9px; }
.bubble-media img, .bubble-media video {
  max-width: min(270px, 62vw); max-height: 270px;
  border-radius: 13px; border: 1px solid var(--line); display: block;
}
.bubble-media audio { width: min(270px, 66vw); }
.bubble-audio { display: flex; flex-direction: column; gap: 5px; }
.bubble-audio .file-name { font-size: 0.64rem; color: var(--muted); }
.bubble-file {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px;
  border-radius: 12px; background: var(--bg-soft);
  border: 1px solid var(--line); font-size: 0.72rem; color: var(--body);
  max-width: 270px;
}
.bubble-file .file-icon { font-size: 1rem; flex: none; }
.bubble-file .file-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bubble-file .file-size { margin-inline-start: auto; color: var(--faint); font-size: 0.6rem; flex: none; }
.msg-text:empty { display: none; }
.bubble.streaming::after {
  content: '▍'; color: var(--blue); margin-inline-start: 2px;
  animation: caretBlink 1s steps(2) infinite;
}
@keyframes caretBlink { 50% { opacity: 0; } }

.drop-overlay {
  position: fixed; inset: 0; z-index: 55;
  display: grid; place-items: center;
  background: rgba(226, 240, 250, 0.75); backdrop-filter: blur(8px);
}
.drop-overlay[hidden] { display: none; }
.drop-card {
  display: flex; flex-direction: column; gap: 10px; align-items: center;
  border: 2px dashed rgba(47, 139, 240, 0.55); border-radius: 28px;
  padding: 44px 38px; background: rgba(255, 255, 255, 0.95);
  text-align: center; color: var(--ink); box-shadow: var(--shadow), 0 0 60px rgba(47, 139, 240, 0.15);
  animation: scaleIn 0.25s var(--ease-spring);
}
.drop-card strong { font-family: var(--font-head); font-size: 1.15rem; }
.drop-card span { font-size: 0.78rem; color: var(--muted); max-width: 340px; line-height: 1.6; }

.ai-status {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 13px; margin-bottom: 9px; border-radius: 13px;
  background: var(--bg-soft); border: 1px solid var(--line);
  font-size: 0.76rem; color: var(--muted); font-weight: 600;
}
.ai-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.ai-status.is-on { color: #187a49; border-color: rgba(47, 191, 113, 0.3); background: rgba(47, 191, 113, 0.08); }
.ai-status.is-on .dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.ai-status.is-warn { color: #b06a10; border-color: rgba(245, 166, 35, 0.3); background: rgba(245, 166, 35, 0.08); }
.ai-status.is-warn .dot { background: var(--amber); }
.ai-status.is-off { color: var(--faint); }
.ai-status.is-off .dot { background: var(--faint); }

.mic-btn {
  position: relative; width: 46px; height: 46px; flex: 0 0 auto;
  border-radius: 14px; display: grid; place-items: center;
  background: rgba(47, 139, 240, 0.1); color: var(--blue);
  border: 1px solid rgba(47, 139, 240, 0.3);
  transition: all 0.25s var(--ease);
  box-shadow: 0 6px 16px -8px rgba(47, 139, 240, 0.35);
  min-width: 46px;
  min-height: 46px;
}
.mic-btn svg { width: 21px; height: 21px; position: relative; z-index: 1; }
.mic-btn:hover { background: rgba(47, 139, 240, 0.16); }
.mic-btn.listening { background: var(--blue); color: #fff; border-color: var(--blue); animation: micBounce 0.3s ease-out; box-shadow: 0 12px 26px -8px rgba(47, 139, 240, 0.6); }
.mic-btn:focus-visible { outline: 2px solid var(--teal-deep); outline-offset: 2px; }
.mic-rings { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; }
.mic-btn.listening .mic-rings::before,
.mic-btn.listening .mic-rings::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  border: 2px solid rgba(47, 139, 240, 0.55); animation: micPulse 1.8s ease-out infinite;
}
.mic-btn.listening .mic-rings::after { animation-delay: 0.6s; }
@keyframes micPulse { 0% { transform: scale(1); opacity: 0.8; } 100% { transform: scale(1.65); opacity: 0; } }
@keyframes micBounce { 0% { transform: scale(1); } 50% { transform: scale(0.95); } 100% { transform: scale(1); } }

.send-btn {
  width: 46px; height: 46px; flex: 0 0 auto; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--grad); color: #fff;
  box-shadow: 0 12px 26px -10px rgba(47, 139, 240, 0.6);
  transition: all 0.25s var(--ease);
  min-width: 46px;
  min-height: 46px;
}
.send-btn svg { width: 20px; height: 20px; }
.send-btn:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -10px rgba(47, 139, 240, 0.65); }
.send-btn:active { transform: translateY(0) scale(0.96); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.send-btn:focus-visible { outline: 2px solid var(--teal-deep); outline-offset: 2px; }

.mic-hint {
  margin-top: 9px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 0.74rem; color: var(--blue); padding: 0 4px;
}
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rose); animation: recPulse 1s infinite; }
@keyframes recPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.2); opacity: 0.7; } }
.transcript { color: var(--muted); font-style: italic; }

/* ---------- Footer ---------- */
.foot {
  width: 100%; max-width: 1320px; margin: 0 auto;
  padding: 16px 4px 22px;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  font-size: 0.74rem; color: var(--muted); text-align: center; flex-wrap: wrap;
  line-height: 1.5; letter-spacing: 0.2px;
}
.foot .shield { display: grid; place-items: center; color: var(--blue); }
.foot svg { width: 16px; height: 16px; }
.foot a { color: var(--blue); font-weight: 800; text-decoration: none; }
.foot a:hover { text-decoration: underline; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(18, 53, 88, 0.4); backdrop-filter: blur(8px); animation: fade 0.25s; }
.modal-panel {
  position: relative; width: min(470px, 100%);
  background: #ffffff; border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
  padding: 22px; animation: pop 0.3s var(--ease-spring);
  max-height: 90vh; overflow-y: auto;
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(0.97); } }

.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h3 { font-size: 1.08rem; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--bg-soft); color: var(--muted);
  transition: all 0.2s var(--ease);
}
.icon-btn:hover { color: var(--rose); background: rgba(244, 87, 77, 0.08); }
.icon-btn svg { width: 16px; height: 16px; }

.field { margin-bottom: 17px; }
.field label { display: block; font-size: 0.76rem; font-weight: 700; color: var(--body); margin-bottom: 8px; letter-spacing: 0.3px; }
.field input, .input-row input {
  width: 100%; padding: 12px 14px; border-radius: 13px;
  background: var(--bg-soft); border: 1px solid var(--line);
  color: var(--ink); font-size: 0.85rem; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s; direction: ltr; text-align: left;
}
.field input::placeholder { color: var(--faint); }
.field input:focus { border-color: rgba(47, 139, 240, 0.45); box-shadow: 0 0 0 3px rgba(47, 139, 240, 0.1); }
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; min-width: 0; }
.hint { font-size: 0.7rem; color: var(--faint); margin-top: 7px; line-height: 1.5; letter-spacing: 0.2px; }
.hint code { background: rgba(47, 139, 240, 0.08); padding: 1px 6px; border-radius: 6px; color: var(--teal-deep); font-weight: 600; }
.or { display: flex; align-items: center; gap: 10px; margin: 4px 0 17px; color: var(--faint); font-size: 0.7rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 0; border-top: 1px solid var(--line);
}
.switch-row strong { font-size: 0.86rem; color: var(--ink); font-family: var(--font-head); letter-spacing: 0.2px; }
.switch-row p { font-size: 0.71rem; color: var(--muted); line-height: 1.5; margin-top: 2px; }
.switch { position: relative; width: 48px; height: 28px; flex: 0 0 auto; }
.switch span::after { width: 20px; height: 20px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; border-radius: 999px;
  background: rgba(30, 84, 136, 0.1); border: 1px solid var(--line);
  transition: all 0.25s var(--ease); cursor: pointer;
}
.switch input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.switch span::after {
  content: ''; position: absolute; top: 3px; inset-inline-start: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #ffffff; box-shadow: 0 2px 6px rgba(30, 84, 136, 0.3);
  transition: all 0.25s var(--ease);
}
.switch input:checked + span { background: var(--grad); border-color: transparent; }
.switch input:checked + span::after { background: #fff; transform: translateX(20px); animation: switchSlide 0.3s var(--ease); }
@keyframes switchSlide { from { transform: translateX(0); } to { transform: translateX(20px); } }
[dir="rtl"] .switch input:checked + span::after { transform: translateX(-20px); }

.modal-foot { display: flex; gap: 10px; justify-content: space-between; margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--line); }
.modal-foot .btn { flex: 1; }

.settings-tabs {
  display: flex; gap: 6px; margin: 14px 0 6px;
  padding: 5px; background: var(--bg-soft); border-radius: 15px;
  border: 1px solid var(--line);
}
.settings-tab {
  flex: 1; padding: 10px 12px; border-radius: 11px;
  font-size: 0.78rem; font-weight: 700; color: var(--muted);
  transition: all 0.25s var(--ease);
}
.settings-tab:hover { color: var(--blue); }
.settings-tab.active { background: #fff; color: var(--blue); box-shadow: var(--shadow-soft); }

/* ---------- Voice mute ---------- */
.voice-mute-btn {
  width: 40px; height: 40px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--bg-soft); color: var(--muted);
  border: 1px solid var(--line);
  transition: all 0.25s var(--ease);
}
.voice-mute-btn svg { width: 18px; height: 18px; }
.voice-mute-btn .ic-off { display: none; }
.voice-mute-btn.muted { color: var(--rose); background: rgba(244, 87, 77, 0.08); border-color: rgba(244, 87, 77, 0.3); }
.voice-mute-btn.muted .ic-on { display: none; }
.voice-mute-btn.muted .ic-off { display: block; }
.voice-mute-btn:hover { color: var(--blue); border-color: rgba(47, 139, 240, 0.35); }
.voice-mute-btn.muted:hover { color: var(--rose); }

.chat-actions { display: flex; align-items: center; gap: 10px; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chat-head .bot-id { flex: 1; min-width: 0; }
.chat-head .bot-id > div { min-width: 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 20px);
  background: #123a5e; border: 1px solid rgba(255, 255, 255, 0.14);
  color: #eaf4fd; padding: 13px 24px; border-radius: 999px;
  font-size: 0.82rem; font-weight: 600; letter-spacing: 0.3px;
  box-shadow: 0 24px 50px -12px rgba(12, 41, 71, 0.55);
  opacity: 0; pointer-events: none; transition: all 0.35s var(--ease); z-index: 60;
  max-width: min(90vw, 500px); text-align: center;
  line-height: 1.4;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .home-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
  .home-side { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
    top: 0; bottom: 0; left: 0;
    border-radius: 0 24px 24px 0;
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar .brand-text, .sidebar .nav-item span { display: block !important; }
  .sidebar .nav-item { justify-content: flex-start; padding: 12px 14px; }
  .sidebar.collapsed .nav-item::before { content: none; }
  .sidebar .status-pill span:last-child { display: block; }
  .sidebar .status-pill { width: 100%; padding: 8px 12px; }

  .main-content, .sidebar.collapsed ~ .main-content { margin-left: 0; margin-right: 0; }

  .mobile-header { display: flex; align-items: center; }

  .topbar { padding: 14px 4px 0; }
  .topbar-date { display: none; }
  .topbar-search { width: clamp(140px, 32vw, 240px); }

  .home-grid { grid-template-columns: 1fr; }
  .home-side { grid-column: auto; display: flex; }

  .vitals-view-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .views-container { padding: 14px 2px 6px; }

  .bg-dna { opacity: 0.55; }

  .card { padding: 18px; border-radius: 22px; }

  .topbar { flex-wrap: wrap; gap: 10px; }
  .topbar-title-wrap h2 { font-size: 1rem; }
  .topbar-search { display: none; }

  .card-head h2 { font-size: 1rem; }

  .heart-main { grid-template-columns: 1fr 1fr; gap: 10px; }
  .heart-num strong { font-size: 2rem; }
  .heart-num.blue strong { font-size: 1.7rem; }
  .chart-container { height: 150px; }
  .chart-container.sm { height: 130px; }

  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile strong { font-size: 1.2rem; }

  .ov-stats { grid-template-columns: 1fr 1fr; }

  .health-score-ring { width: 148px; height: 148px; }
  .score-number { font-size: 2.2rem; }

  .vitals-card { gap: 16px; }
  .vitals-main { gap: 14px; padding: 10px 0 6px; }

  .ring-wrap { width: 156px; height: 156px; }
  .ring-wrap.small { width: 116px; height: 116px; }
  .big-number { font-size: 2.7rem; }
  .ring-wrap.small .big-number { font-size: 1.9rem; }
  .vital-label { font-size: 0.8rem; }
  .vital-label svg { width: 15px; height: 15px; }

  .wave-wrap { height: 116px; }
  .wave-empty svg { width: 32px; height: 32px; }
  .wave-empty span { font-size: 0.76rem; }

  .btn { padding: 14px 20px; font-size: 0.86rem; min-height: 50px; }
  .btn svg { width: 20px; height: 20px; }

  .insights { grid-template-columns: 1fr; gap: 12px; }
  .insight { padding: 14px 16px; }
  .insight strong { font-size: 1.1rem; }
  .tip-box { padding: 13px 15px; font-size: 0.78rem; }

  .sensor-strip { grid-template-columns: 1fr 1fr; row-gap: 10px; gap: 10px; }
  .sensor-item { padding: 9px 11px; }
  .sensor-item:last-child { grid-column: span 2; }

  .chat-card { min-height: 64vh; padding: 18px 16px 16px; }
  .chat-head { padding: 4px 4px 12px; }

  .baymax-avatar { width: 46px; height: 46px; }
  .baymax-avatar .eye { top: 18px; width: 6px; height: 8px; }
  .baymax-avatar .eye.left { left: 13px; }
  .baymax-avatar .eye.right { right: 13px; }
  .baymax-avatar .line { top: 21px; left: 19px; right: 19px; }

  .messages { padding: 14px 4px 8px; gap: 14px; }
  .msg { max-width: 92%; gap: 8px; }
  .msg-avatar { width: 36px; height: 36px; }
  .bubble { padding: 12px 15px; font-size: 0.88rem; }

  .composer { padding: 8px; gap: 8px; margin-top: 6px; border-radius: 20px; }
  .mic-btn, .send-btn, .attach-btn {
    width: 44px; height: 44px; min-width: 44px; min-height: 44px; border-radius: 13px;
  }
  .mic-btn svg { width: 22px; height: 22px; }
  .composer input { font-size: 0.9rem; padding: 12px 2px; }
  .attach-meta strong { max-width: 104px; }
  .attach-menu { inset-inline-start: -2px; }
  .recorder-bar { flex-wrap: wrap; }
  .mic-hint { font-size: 0.72rem; }

  .foot { padding: 0 16px 18px; font-size: 0.72rem; }

  .modal-panel { padding: 18px; border-radius: 22px; }
  .field { margin-bottom: 14px; }
  .field input { padding: 12px 14px; font-size: 0.86rem; }
  .switch-row { padding: 12px 0; }
  .settings-tabs { flex-wrap: wrap; }
  .settings-tab { flex: 1 1 40%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .orb, .voice-bars i, .typing i { animation: none; }
}

@media (prefers-contrast: high) {
  :root {
    --line: rgba(30, 74, 122, 0.32);
    --line-strong: rgba(30, 74, 122, 0.5);
    --card: rgba(255, 255, 255, 0.96);
    --card-hover: #ffffff;
  }
  .card { border: 2px solid var(--line-strong); }
  .btn { border: 2px solid transparent; }
}
