@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/Inter-VariableFont.ttf") format("truetype");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

/*
 * N&H LONGEVITY · Professional Editorial UI
 * Capa exclusivamente visual. No modifica datos, flujos, rutas ni lógica clínica.
 */

:root {
  --nh-editorial-deep: #12332c;
  --nh-editorial-ink: #173b32;
  --nh-editorial-green: #00b08a;
  --nh-editorial-green-dark: #006b55;
  --nh-editorial-canvas: #eef3f1;
  --nh-editorial-paper: #ffffff;
  --nh-editorial-soft: #e8f6f2;
  --nh-editorial-line: #c9dad5;
  --nh-editorial-line-strong: #9eb8b1;
  --nh-editorial-muted: #5b716b;
  --nh-editorial-radius: 2px;
  --nh-editorial-shadow: 0 8px 24px rgba(18, 51, 44, .065);
  --radius: var(--nh-editorial-radius);
  --nh-ui-radius: var(--nh-editorial-radius);
  --nh-ui-radius-lg: var(--nh-editorial-radius);
  --shadow: var(--nh-editorial-shadow);
  --nh-ui-shadow: var(--nh-editorial-shadow);
  --nh-ui-shadow-raised: 0 12px 34px rgba(18, 51, 44, .11);
}

html,
body {
  background: var(--nh-editorial-canvas);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  letter-spacing: -.005em;
}

/* Acceso profesional: composición editorial, sin burbujas ni degradados. */
.welcome-screen {
  position: relative;
  isolation: isolate;
  place-items: stretch;
  padding: 0;
  background: var(--nh-editorial-paper);
  overflow: hidden;
}

.welcome-screen::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  z-index: -2;
  width: min(36vw, 560px);
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  background: var(--nh-editorial-deep);
}

.welcome-screen::after {
  content: "ACCESO PROFESIONAL";
  position: absolute;
  left: 42px;
  bottom: 36px;
  z-index: -1;
  color: rgba(255,255,255,.24);
  font-size: clamp(2rem, 5vw, 5.7rem);
  font-weight: 850;
  letter-spacing: .06em;
  line-height: .9;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.welcome-panel {
  display: grid;
  grid-template-columns: minmax(260px, 32%) minmax(0, 1fr);
  column-gap: 64px;
  align-items: start;
  width: min(1180px, calc(100% - 64px));
  margin: auto;
  padding: 62px 0;
  text-align: left;
}

.welcome-logo {
  grid-column: 1;
  width: min(360px, 72vw);
  margin: 0 0 64px;
  filter: none;
}

.welcome-heading {
  grid-column: 2;
  width: min(720px, 100%);
  margin: 18px 0 0;
  padding-left: 32px;
  border-left: 5px solid var(--nh-editorial-green);
  color: var(--nh-editorial-ink);
}

.welcome-heading h1,
.welcome-heading > p:last-child,
.welcome-kicker,
.welcome-privacy {
  color: inherit;
}

.welcome-heading h1 {
  max-width: 720px;
  font-size: clamp(2.5rem, 5vw, 4.8rem);
  line-height: .98;
  letter-spacing: -.055em;
}

.welcome-heading > p:last-child {
  color: var(--nh-editorial-muted);
}

.welcome-kicker {
  color: var(--nh-editorial-green-dark);
  opacity: 1;
}

.profile-grid {
  grid-column: 2;
  width: min(900px, 100%);
  margin: 54px 0 0 auto;
  gap: 1px;
  padding: 1px;
  background: var(--nh-editorial-line);
}

.profile-card {
  min-height: 166px;
  padding: 28px;
  border: 0;
  border-radius: 0;
  background: var(--nh-editorial-paper);
  box-shadow: none;
}

.profile-card:hover {
  transform: none;
  border-color: transparent;
  background: var(--nh-editorial-soft);
  box-shadow: inset 0 -4px 0 var(--nh-editorial-green);
}

.profile-avatar {
  border-radius: 1px;
  background: var(--nh-editorial-deep);
}

.profile-arrow {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--nh-editorial-line-strong);
  color: var(--nh-editorial-green-dark);
}

.profile-card:hover .profile-arrow {
  transform: none;
  color: #fff;
  background: var(--nh-editorial-green-dark);
}

.welcome-privacy {
  grid-column: 2;
  width: min(900px, 100%);
  margin: 20px 0 0 auto;
  color: var(--nh-editorial-muted);
  opacity: 1;
}

/* Estructura general. */
.app-shell {
  grid-template-columns: 238px minmax(0, 1fr);
  background: var(--nh-editorial-canvas);
}

.app-shell .sidebar {
  padding: 22px 14px 18px;
  border-right: 0;
  color: #fff;
  background: var(--nh-editorial-deep);
  box-shadow: 8px 0 28px rgba(18, 51, 44, .08);
}

.app-shell .brand.brand-manual {
  min-height: 74px;
  margin: -22px -14px 18px;
  padding: 22px 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,.14);
}

.sidebar-brand-logo {
  width: min(180px, 100%);
  filter: brightness(0) invert(1);
}

.app-shell #main-nav {
  gap: 1px;
  padding: 0;
  border-top: 1px solid rgba(255,255,255,.08);
}

.app-shell .nav-button {
  min-height: 43px;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
  border-radius: 0;
  color: rgba(255,255,255,.72);
  background: transparent;
  font-size: .8rem;
  font-weight: 680;
}

.app-shell .nav-button:hover {
  color: #fff;
  background: rgba(255,255,255,.06);
}

.app-shell .nav-button.active {
  color: #fff;
  background: var(--nh-editorial-green-dark);
  box-shadow: inset 4px 0 0 var(--nh-editorial-green);
}

.app-shell .nav-index,
.app-shell .nav-button.active .nav-index {
  width: 25px;
  height: 25px;
  flex-basis: 25px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 0;
  color: rgba(255,255,255,.72);
  background: transparent;
}

.app-shell .nav-button.active .nav-index {
  border-color: rgba(255,255,255,.55);
  color: #fff;
}

.app-shell .privacy-note {
  padding: 16px 6px 0;
  border-top-color: rgba(255,255,255,.14);
  color: rgba(255,255,255,.72);
}

.app-shell .privacy-note strong,
.app-shell .privacy-note small {
  color: inherit;
}

.app-shell .privacy-dot {
  border-radius: 0;
  background: var(--nh-editorial-green);
  box-shadow: none;
}

.app-shell .topbar {
  min-height: 66px;
  gap: 16px;
  padding: 9px 22px;
  border-bottom: 1px solid var(--nh-editorial-line);
  border-top: 3px solid var(--nh-editorial-green);
  background: var(--nh-editorial-paper);
  backdrop-filter: none;
}

.patient-lookup {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(220px, 520px) auto;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--nh-editorial-line-strong);
  border-radius: 0;
  background: var(--nh-editorial-paper);
}

.patient-lookup:focus-within {
  border-color: var(--nh-editorial-green-dark);
  box-shadow: 0 0 0 2px rgba(0,176,138,.12);
}

.patient-lookup-icon {
  display: grid;
  place-items: center;
  color: var(--nh-editorial-green-dark);
  font-size: 1.2rem;
  font-weight: 800;
}

.patient-lookup input {
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px 8px 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.patient-lookup input:focus { box-shadow: none; }

.patient-lookup-submit {
  align-self: stretch;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-left: 1px solid var(--nh-editorial-line);
  border-radius: 0;
  color: #fff;
  background: var(--nh-editorial-green-dark);
  font-weight: 760;
}

.patient-lookup-submit:hover { background: var(--nh-editorial-deep); }

.patient-lookup-status {
  position: absolute;
  left: 33px;
  top: calc(100% + 5px);
  max-width: 540px;
  overflow: hidden;
  color: var(--nh-editorial-muted);
  font-size: .67rem;
  font-weight: 650;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  margin-left: auto;
  flex-wrap: nowrap;
}

.header-actions .button,
.header-actions .server-secondary-button {
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--nh-editorial-line-strong);
  border-radius: 0;
  color: var(--nh-editorial-deep);
  background: var(--nh-editorial-paper);
  font: 700 .75rem/1.15 "Inter", sans-serif;
  white-space: nowrap;
}

.header-actions .button:hover,
.header-actions .server-secondary-button:hover {
  border-color: var(--nh-editorial-green-dark);
  color: #fff;
  background: var(--nh-editorial-green-dark);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

#app-content {
  max-width: 1540px;
  padding: 30px;
}

.page-heading {
  position: relative;
  align-items: center;
  min-height: 92px;
  margin-bottom: 20px;
  padding: 18px 20px 18px 25px;
  border-left: 5px solid var(--nh-editorial-green);
  background: var(--nh-editorial-paper);
  box-shadow: var(--nh-editorial-shadow);
}

.page-heading h1 {
  font-size: clamp(1.65rem, 2vw, 2.3rem);
  letter-spacing: -.04em;
}

.page-heading .eyebrow,
.eyebrow,
.module-kicker,
.report-eyebrow {
  color: var(--nh-editorial-green-dark);
}

/* Controles rectos y sobrios. */
.button,
.app-shell .button,
button.server-2fa-action,
.server-login-card button[type="submit"] {
  border: 1px solid var(--nh-editorial-green-dark);
  border-radius: var(--nh-editorial-radius);
  background: var(--nh-editorial-green-dark);
  box-shadow: none;
  font-weight: 760;
  letter-spacing: .005em;
}

.button:hover,
.app-shell .button:hover {
  transform: none;
  box-shadow: none;
  background: var(--nh-editorial-deep);
}

.button.secondary,
.app-shell .button.secondary {
  border-color: var(--nh-editorial-green);
  color: var(--nh-editorial-deep);
  background: var(--nh-editorial-green);
}

.button.ghost,
.app-shell .button.ghost {
  border-color: var(--nh-editorial-line-strong);
  color: var(--nh-editorial-deep);
  background: var(--nh-editorial-paper);
}

.button.ghost:hover,
.app-shell .button.ghost:hover {
  border-color: var(--nh-editorial-green-dark);
  color: var(--nh-editorial-deep);
  background: var(--nh-editorial-soft);
}

select,
input,
textarea,
.app-shell select,
.app-shell input,
.app-shell textarea {
  border-color: var(--nh-editorial-line-strong);
  border-radius: var(--nh-editorial-radius);
  box-shadow: none;
}

select:focus,
input:focus,
textarea:focus {
  box-shadow: 0 0 0 2px rgba(0,176,138,.18);
}

/* Superficies: cuadrícula editorial y bordes funcionales. */
.card,
.app-shell .card,
.history-panel,
.app-shell .history-panel,
.professional-consultation,
dialog,
.dialog-card,
.clinical-card,
.visual-card,
.health-metric,
.nutrition-frame,
.nutrition-statusbar,
.nutrition-optin,
.server-login-card {
  border: 1px solid var(--nh-editorial-line);
  border-radius: var(--nh-editorial-radius);
  background: var(--nh-editorial-paper);
  box-shadow: var(--nh-editorial-shadow);
}

.card-header,
.app-shell .card-header,
.history-toolbar,
.lab-analysis-heading {
  border-bottom: 1px solid var(--nh-editorial-line);
  background: #f7faf9;
}

.card-header::before {
  content: "";
  align-self: stretch;
  width: 3px;
  margin: -14px 0 -14px -17px;
  background: var(--nh-editorial-green);
}

.metric,
.app-shell .metric {
  min-height: 116px;
  border-top: 4px solid var(--nh-editorial-green-dark);
  border-radius: var(--nh-editorial-radius);
  box-shadow: var(--nh-editorial-shadow);
}

.metric::after,
.app-shell .metric::after {
  display: none;
}

.metric-value {
  color: var(--nh-editorial-deep);
  font-variant-numeric: tabular-nums;
}

.dashboard-grid,
.metrics,
.patient-list-summary,
.form-grid,
.lab-category-grid,
.record-detail-grid,
.health-component-grid {
  column-gap: 12px;
  row-gap: 12px;
}

.lab-category,
.lab-analyte,
.lab-results,
.history-entry,
.record-detail,
.health-component,
.questionnaire-score,
.questionnaire-row,
.questionnaire-secondary,
.rockwood-level,
.pathology-search-panel,
.pathology-selected-panel,
.pathology-result,
.pathology-item,
.pathology-empty,
.exam-status-card,
.ecg-upload,
.file-drop,
.professional-consultation-message,
.selected-record-note,
.alert,
.consultation-form,
.consultation-item,
.consultation-reply,
.personal-item {
  border-radius: var(--nh-editorial-radius);
}

.lab-category,
.pathology-search-panel,
.pathology-selected-panel,
.questionnaire-secondary,
.record-detail,
.health-component {
  background: #f8fbfa;
}

.lab-category-header > span,
.questionnaire-row > span strong,
.rockwood-number,
.report-section-heading > span,
.section-icon {
  border-radius: 1px;
  background: var(--nh-editorial-green-dark);
}

.history-entry {
  border-left: 3px solid var(--nh-editorial-line-strong);
  box-shadow: none;
}

.history-entry:hover {
  transform: none;
  border-color: var(--nh-editorial-green-dark);
  box-shadow: none;
}

.history-entry.active {
  border-color: var(--nh-editorial-green);
  background: var(--nh-editorial-soft);
  box-shadow: none;
}

.selected-record-note {
  border-left-width: 5px;
}

/* Estados: etiquetas compactas, no cápsulas. */
.pill,
.section-tab,
.lab-status,
.review-badge,
.consultation-badge,
.review-chip,
.service-status {
  border: 1px solid currentColor;
  border-radius: 2px;
  padding: 4px 7px;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.review-badge::before {
  border-radius: 0;
}

.section-tabs {
  gap: 1px;
  padding: 1px;
  background: var(--nh-editorial-line);
}

.section-tab {
  border: 0;
  background: var(--nh-editorial-paper);
}

.section-tab.active,
.section-tab[aria-selected="true"] {
  color: #fff;
  background: var(--nh-editorial-green-dark);
}

/* Tablas densas inspiradas en paneles clínicos y administrativos. */
.table-wrap,
.patient-list-wrap {
  border: 1px solid var(--nh-editorial-line);
  background: var(--nh-editorial-paper);
}

table {
  border-collapse: collapse;
}

thead th,
.app-shell table thead th {
  border-bottom: 2px solid var(--nh-editorial-green-dark);
  color: var(--nh-editorial-deep);
  background: #eef5f3;
  font-size: .7rem;
  letter-spacing: .045em;
  text-transform: uppercase;
}

th,
td,
.app-shell th,
.app-shell td {
  border-bottom: 1px solid #dfe9e6;
}

tbody tr:nth-child(even) {
  background: #fbfdfc;
}

tbody tr:hover,
.app-shell tbody tr:hover {
  background: var(--nh-editorial-soft);
}

/* Barras lineales; los medidores clínicos circulares mantienen su geometría. */
.progress-track,
.progress-track span,
.pressure-track,
.pressure-fill,
.professional-nutrition-metrics i,
.professional-nutrition-metrics b,
.bar,
.bar i {
  border-radius: 0;
}

.progress-track span,
.pressure-fill,
.professional-nutrition-metrics b,
.bar i {
  background: var(--nh-editorial-green-dark);
}

.trend-line {
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.trend-point {
  rx: 0;
}

.toast {
  border: 1px solid var(--nh-editorial-green);
  border-radius: 2px;
  background: var(--nh-editorial-deep);
  box-shadow: var(--nh-editorial-shadow);
}

/* Documentos e informes: estructura editorial limpia. */
.report-title {
  border-top: 5px solid var(--nh-editorial-green);
  border-radius: 0;
  color: #fff;
  background: #12332c;
}

.report-title .report-eyebrow,
.report-title h2,
.report-title p,
.report-title .report-doctor span,
.report-title .report-doctor strong {
  color: #fff;
}

.report-title .report-eyebrow {
  color: #72e1c8;
  opacity: 1;
}

.report-title p,
.report-title .report-doctor span {
  color: #d5e9e3;
  opacity: 1;
}

.report-title .report-logo {
  filter: none !important;
  opacity: 1;
}

.report-content {
  border-radius: 0;
}

.report-stat,
.report-chart-card,
.report-ecg-missing,
.consent-paper,
.consent-choice,
.consent-field input,
.consent-signature canvas {
  border-radius: 2px;
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell .sidebar {
    left: -272px;
    width: 264px;
    height: 100vh;
    padding: 18px 14px;
    box-shadow: 14px 0 34px rgba(18, 51, 44, .22);
  }

  .app-shell .sidebar.open {
    left: 0;
  }

  .app-shell .brand.brand-manual {
    margin: -18px -14px 14px;
  }

  .topbar {
    border-top: 4px solid var(--nh-editorial-green);
    align-items: stretch;
    flex-wrap: wrap;
  }

  .patient-lookup {
    order: 2;
    width: 100%;
    grid-template-columns: 30px minmax(0, 1fr) auto;
  }

  .header-actions {
    max-width: calc(100% - 54px);
    overflow-x: auto;
    scrollbar-width: thin;
  }

  #app-content {
    padding: 18px 14px 30px;
  }

  .page-heading {
    align-items: flex-start;
    padding: 17px 17px 17px 20px;
  }

  .welcome-screen::before {
    width: 18px;
    background: var(--nh-editorial-green);
  }

  .welcome-screen::after {
    display: none;
  }

  .welcome-panel {
    display: block;
    width: min(100% - 48px, 760px);
    padding: 38px 0;
  }

  .welcome-logo {
    width: min(320px, 80vw);
    margin-bottom: 42px;
    filter: brightness(0) saturate(100%) invert(15%) sepia(16%) saturate(1248%) hue-rotate(113deg) brightness(95%);
  }

  .welcome-heading {
    margin-left: 0;
    padding-left: 20px;
  }

  .profile-grid,
  .welcome-privacy {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .welcome-screen {
    align-items: stretch;
  }

  .profile-grid {
    grid-template-columns: 1fr;
    margin-top: 36px;
  }

  .profile-card {
    min-height: 128px;
    padding: 20px;
  }

  .profile-avatar {
    border-radius: 1px;
  }

  .topbar {
    padding: 9px 12px;
  }

  .patient-lookup-status { display: none; }

  .patient-lookup-submit { padding-inline: 11px; }
}

@media print {
  .page-heading,
  .card,
  .history-panel,
  .metric,
  .report-content {
    box-shadow: none;
  }
}

