/* Estilos del dashboard de salud: tarjetas, graficas y periodos. */
:root {
  color-scheme: dark;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #1e1e1e;
  color: #fff;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background: #1e1e1e;
}

body:has(.health-dashboard) {
  min-height: 100vh;
}

.gb-microapp-root,
.site-navigation {
  display: none !important;
}

.health-dashboard,
.health-dashboard * {
  box-sizing: border-box;
}

.health-dashboard {
  --surface: #2b2b2b;
  --surface-raised: #323232;
  --surface-soft: #252525;
  --border: rgba(255, 255, 255, .08);
  --text: #fff;
  --muted: #a8b0b5;
  --blue: #4fa8e2;
  --green: #00a86b;
  --heart: #ff8291;
  --oxygen: #45d6bd;
  --temperature: #f2bd68;
  min-height: 100vh;
  padding-left: 248px;
  color: var(--text);
  background:
    radial-gradient(ellipse at 80% 0, rgba(12, 59, 94, .24), transparent 38%),
    #1e1e1e;
}

.health-sidebar {
  position: fixed;
  z-index: 5;
  inset: 0 auto 0 0;
  display: flex;
  width: 248px;
  flex-direction: column;
  padding: 27px 18px 20px;
  border-right: 1px solid var(--border);
  background: #202426;
}

.health-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 9px 31px;
  color: white;
  font-size: 19px;
  font-weight: 750;
  letter-spacing: .06em;
  text-decoration: none;
}

.health-brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: #0c3b5e;
  color: #fff;
  font-size: 21px;
}

.sidebar-label {
  padding: 0 11px;
  color: #778187;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.health-links {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.health-links a {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: #aeb7bb;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease;
}

.health-links a:hover,
.health-links a[aria-current="page"] {
  border-color: rgba(79, 168, 226, .17);
  background: rgba(12, 59, 94, .42);
  color: #fff;
}

.health-links a[aria-current="page"] {
  box-shadow: inset 3px 0 #4fa8e2;
}

.health-links svg {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.sidebar-spacer {
  flex: 1;
}

.device-note {
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #252a2c;
}

.device-note strong,
.device-note span {
  display: block;
}

.device-note strong {
  font-size: 12px;
}

.device-note span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.dashboard-main {
  width: min(100%, 1600px);
  margin: 0 auto;
  padding: 27px clamp(20px, 3.2vw, 52px) 50px;
}

.dashboard-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 34px;
}

.topbar-left,
.topbar-actions,
.connection-state,
.patient-chip {
  display: flex;
  align-items: center;
}

.topbar-left {
  gap: 15px;
}

.menu-toggle {
  display: none;
}

.dashboard-kicker {
  margin: 0 0 5px;
  color: #91a1a8;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.topbar-title {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
}

.topbar-actions {
  gap: clamp(13px, 2vw, 26px);
}

.notification-link {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: #c7d1d4;
  text-decoration: none;
}

.notification-link:hover {
  background: rgba(255, 255, 255, .06);
  color: #fff;
}

.notification-link svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.connection-state {
  gap: 8px;
  color: #c4ceca;
  font-size: 12px;
  white-space: nowrap;
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(0, 168, 107, .12);
}

.update-time {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.patient-chip {
  gap: 9px;
  padding-left: 17px;
  border-left: 1px solid var(--border);
}

.patient-avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: #34566b;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.patient-name {
  color: #e9eeee;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.page-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 23px;
}

.page-intro h1 {
  margin: 0;
  font-size: clamp(25px, 3vw, 34px);
  font-weight: 650;
  letter-spacing: -.035em;
}

.page-intro p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid rgba(79, 168, 226, .2);
  border-radius: 999px;
  background: rgba(12, 59, 94, .24);
  color: #c2e4fa;
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.demo-badge span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
}

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

.vital-card,
.history-panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(48, 48, 48, .98), rgba(39, 41, 42, .98));
  box-shadow: 0 12px 30px rgba(0, 0, 0, .13);
}

.vital-card {
  overflow: hidden;
  padding: 19px 19px 13px;
  animation: dashboard-rise 320ms ease-out both;
}

.vital-card:nth-child(2) { animation-delay: 55ms; }
.vital-card:nth-child(3) { animation-delay: 110ms; }

.vital-heading,
.vital-reading,
.vital-meta,
.history-heading,
.filter-row,
.history-toolbar,
.chart-legend,
.legend-item,
.range-control,
.date-controls {
  display: flex;
  align-items: center;
}

.vital-heading,
.history-heading {
  justify-content: space-between;
  gap: 12px;
}

.vital-title {
  margin: 0;
  color: #dce2e4;
  font-size: 12px;
  font-weight: 600;
}

.vital-symbol {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 11px;
  background: rgba(255, 255, 255, .035);
  font-size: 17px;
}

.vital-card[data-vital="heart"] .vital-symbol,
.vital-card[data-vital="heart"] .vital-value { color: var(--heart); }
.vital-card[data-vital="oxygen"] .vital-symbol,
.vital-card[data-vital="oxygen"] .vital-value { color: var(--oxygen); }
.vital-card[data-vital="temperature"] .vital-symbol,
.vital-card[data-vital="temperature"] .vital-value { color: var(--temperature); }

.vital-reading {
  gap: 8px;
  margin: 17px 0 4px;
}

.vital-value {
  font-size: clamp(30px, 3vw, 39px);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: -.05em;
  line-height: 1;
}

.vital-unit {
  padding-top: 12px;
  color: #aab4b8;
  font-size: 12px;
  font-weight: 600;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(0, 168, 107, .12);
  color: #82e3b7;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill[data-status="caution"] {
  background: rgba(233, 177, 66, .13);
  color: #f2cf7f;
}

.status-pill[data-status="alert"] {
  background: rgba(235, 89, 89, .14);
  color: #ff9999;
}

.vital-meta {
  justify-content: space-between;
  gap: 8px;
  color: #9da8ac;
  font-size: 10px;
}

.vital-meta strong {
  color: #d2d9db;
  font-weight: 550;
}

.sparkline-wrap {
  height: 66px;
  margin: 7px -7px -1px;
}

.sparkline-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.history-panel {
  margin-top: 20px;
  padding: 22px;
}

.history-heading {
  align-items: flex-start;
  margin-bottom: 20px;
}

.history-heading h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
}

.history-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.range-control {
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #222526;
}

.range-button {
  min-width: 56px;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #aab4b8;
  font: inherit;
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
}

.range-button[aria-pressed="true"] {
  background: #0c3b5e;
  color: white;
}

.history-toolbar {
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.date-controls {
  flex-wrap: wrap;
  gap: 9px;
}

.date-controls label,
.vital-filter label {
  color: #aab4b8;
  font-size: 10px;
}

.date-controls input,
.vital-filter select {
  min-height: 35px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #222526;
  color: #e8edee;
  color-scheme: dark;
  font: inherit;
  font-size: 10px;
}

.date-controls label {
  display: flex;
  align-items: center;
  gap: 7px;
}

.vital-filter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.export-button {
  display: inline-flex;
  min-height: 35px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid rgba(79, 168, 226, .35);
  border-radius: 8px;
  background: rgba(12, 59, 94, .3);
  color: #d6edfc;
  font: inherit;
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
  transition: background 160ms ease;
}

.export-button:hover {
  background: rgba(12, 59, 94, .58);
}

.export-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.chart-legend {
  flex-wrap: wrap;
  gap: 17px;
  margin: 17px 0 7px;
}

.legend-item {
  gap: 7px;
  color: #cbd2d4;
  font-size: 10px;
}

.legend-line {
  width: 17px;
  height: 3px;
  border-radius: 4px;
  background: var(--legend-color);
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: clamp(245px, 29vw, 360px);
}

.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.chart-fallback {
  display: none;
  padding: 25px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.chart-fallback.is-visible {
  display: block;
}

.reference-note {
  margin: 13px 0 0;
  color: #8e9a9e;
  font-size: 10px;
  line-height: 1.6;
}

.reference-note strong {
  color: #c5ced1;
}

.settings-panel {
  margin-top: 16px;
  padding: 18px 21px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.settings-heading h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}

.settings-heading p,
.settings-message {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.settings-controls {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 13px;
}

.settings-controls label {
  display: grid;
  grid-template-columns: auto auto;
  gap: 6px;
  align-items: center;
  color: #cbd2d4;
  font-size: 10px;
}

.settings-controls label span {
  color: var(--muted);
}

.settings-controls input {
  grid-column: 1 / 3;
  width: 125px;
  min-height: 35px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #222526;
  color: #e8edee;
  font: inherit;
  font-size: 11px;
}

.settings-message.is-error {
  color: #ff9999;
}

.health-dashboard button:focus-visible,
.health-dashboard a:focus-visible,
.health-dashboard select:focus-visible,
.health-dashboard input:focus-visible {
  outline: 3px solid rgba(79, 168, 226, .65);
  outline-offset: 3px;
}

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

@media (max-width: 1080px) {
  .health-dashboard { padding-left: 76px; }
  .health-sidebar { width: 76px; align-items: center; padding-right: 9px; padding-left: 9px; }
  .health-brand { padding-right: 0; padding-left: 0; }
  .health-brand > span:last-child,
  .sidebar-label,
  .health-links a > span,
  .device-note { display: none; }
  .health-links { width: 100%; }
  .health-links a { justify-content: center; padding: 0; }
  .health-links a[aria-current="page"] { box-shadow: inset 0 -3px #4fa8e2; }
  .vital-grid { gap: 12px; }
  .vital-card { padding: 16px 14px 11px; }
}

@media (max-width: 760px) {
  .health-dashboard { padding: 0 0 25px; }
  .health-sidebar {
    position: fixed;
    z-index: 10;
    inset: 0 0 auto;
    display: none;
    width: 100%;
    height: auto;
    align-items: stretch;
    padding: 69px 16px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    background: #202426;
  }
  .health-sidebar.is-open { display: block; }
  .health-brand { position: absolute; top: 14px; left: 16px; padding: 0; }
  .health-brand > span:last-child { display: inline; }
  .sidebar-label { display: block; padding: 8px 4px; }
  .health-links { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 7px; }
  .health-links a { justify-content: flex-start; padding: 0 12px; }
  .health-links a > span { display: inline; }
  .health-links a[aria-current="page"] { box-shadow: inset 3px 0 #4fa8e2; }
  .sidebar-spacer,
  .device-note { display: none; }
  .dashboard-main { padding: 14px 16px 24px; }
  .dashboard-topbar { margin-bottom: 27px; }
  .menu-toggle {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
  }
  .topbar-title { font-size: 15px; }
  .connection-state { font-size: 0; }
  .connection-dot { width: 9px; height: 9px; }
  .update-time { display: none; }
  .patient-chip { padding-left: 11px; }
  .patient-name { display: none; }
  .page-intro { align-items: flex-start; flex-direction: column; gap: 12px; margin-bottom: 17px; }
  .page-intro h1 { font-size: 27px; }
  .vital-grid { grid-template-columns: 1fr; gap: 11px; }
  .vital-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 14px 16px 10px; }
  .vital-heading { grid-column: 1 / 2; grid-row: 1; }
  .vital-heading .vital-symbol { grid-column: 2; }
  .vital-reading { grid-column: 1 / 3; grid-row: 2; margin: 12px 0 3px; }
  .vital-meta { grid-column: 1 / 3; grid-row: 3; }
  .sparkline-wrap { grid-column: 1 / 3; grid-row: 4; height: 52px; margin-top: 3px; }
  .history-panel { margin-top: 13px; padding: 16px 13px; }
  .history-heading { flex-direction: column; margin-bottom: 15px; }
  .history-toolbar { align-items: stretch; flex-direction: column; }
  .date-controls { justify-content: space-between; }
  .date-controls label { gap: 5px; }
  .date-controls input { width: 126px; }
  .vital-filter { justify-content: space-between; }
  .vital-filter select { flex: 1; }
  .export-button { width: 100%; }
  .chart-wrap { height: 260px; }
  .chart-legend { gap: 11px; }
}

@media (max-width: 370px) {
  .date-controls { align-items: flex-start; flex-direction: column; }
  .date-controls input { width: 150px; }
  .range-button { min-width: 49px; padding: 0 7px; }
  .demo-badge { font-size: 9px; }
}

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

:root {
  color-scheme: light;
  color: #17211e;
  background: #f6f6f6;
}

html,
body {
  background: #f6f6f6;
}

.gb-microapp-root {
  display: none !important;
}

.site-navigation {
  display: flex !important;
}

.health-dashboard {
  --surface: #fff;
  --surface-raised: #fff;
  --surface-soft: #edf4f0;
  --border: #e7ebe8;
  --text: #17211e;
  --muted: #53615b;
  --blue: #456e60;
  --green: #315f50;
  --heart: #083833;
  --oxygen: #456e60;
  --temperature: #79a492;
  padding-left: 0;
  background: #f6f6f6;
  color: #17211e;
}

.health-sidebar,
.dashboard-topbar {
  display: none !important;
}

.dashboard-main {
  max-width: 1024px;
  padding: 10px 20px 120px;
}

.dashboard-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #083833;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: .02em;
  text-decoration: none;
}

.dashboard-brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: #083833;
  color: #fff;
  font-size: 20px;
}

.page-intro {
  align-items: center;
  margin: 0 0 16px;
}

.page-intro h1 {
  color: #083833;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: clamp(30px, 5vw, 40px);
  font-weight: 400;
  letter-spacing: 0;
}

.page-intro p {
  color: #53615b;
  font-size: 14px;
}

.demo-badge {
  border-color: #dce8e1;
  background: #edf4f0;
  color: #315f50;
}

.vital-card,
.history-panel,
.settings-panel {
  border-color: #e7ebe8;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(8, 56, 51, .045);
}

.vital-title,
.history-heading h2,
.settings-heading h2 {
  color: #083833;
}

.vital-symbol {
  border: 0;
  background: #edf4f0;
}

.vital-card[data-vital="heart"] .vital-symbol,
.vital-card[data-vital="heart"] .vital-value,
.vital-card[data-vital="oxygen"] .vital-symbol,
.vital-card[data-vital="oxygen"] .vital-value,
.vital-card[data-vital="temperature"] .vital-symbol,
.vital-card[data-vital="temperature"] .vital-value {
  color: #083833;
}

.vital-unit,
.vital-meta,
.vital-meta strong,
.history-heading p,
.settings-heading p,
.settings-message {
  color: #53615b;
}

.status-pill {
  background: #eaf2ee;
  color: #315f50;
}

.status-pill[data-status="caution"] {
  background: #fff5d9;
  color: #715b1d;
}

.status-pill[data-status="alert"] {
  background: #fde9e6;
  color: #9a382e;
}

.range-control,
.date-controls input,
.vital-filter select,
.settings-controls input {
  border-color: #d6ddd9;
  background: #fff;
  color: #17211e;
  color-scheme: light;
}

.range-button {
  color: #53615b;
}

.range-button[aria-pressed="true"] {
  background: #083833;
  color: #fff;
}

.date-controls label,
.vital-filter label,
.settings-controls label {
  color: #53615b;
}

.export-button {
  border-color: #b6cec2;
  background: #f5f9f6;
  color: #083833;
}

.export-button:hover {
  background: #eaf2ee;
}

.legend-item {
  color: #53615b;
}

.reference-note {
  color: #626a66;
}

.reference-note strong {
  color: #315f50;
}

.settings-panel {
  margin-top: 16px;
  padding: 16px 18px;
}

@media (max-width: 760px) {
  .dashboard-main {
    padding: 10px 20px 118px;
  }

  .page-intro {
    margin-top: 0;
  }
}
