@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 · Experience 4.0.6
 * Capa visual: no modifica datos, permisos, rutas ni lógica clínica.
 */
:root {
  --nhx-green: #00b08a;
  --nhx-green-dark: #006b55;
  --nhx-deep: #12332c;
  --nhx-ink: #173b32;
  --nhx-muted: #60756f;
  --nhx-line: #cdded9;
  --nhx-soft: #eaf7f3;
  --nhx-canvas: #eef3f1;
  --nhx-paper: #ffffff;
  --nhx-alert: #a84735;
  --nhx-warning: #a76c13;
}

html,
body,
button,
input,
select,
textarea {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* El wallpaper de marca se limita a las superficies de acceso. */
body .server-login {
  isolation: isolate;
  padding: clamp(72px, 9vh, 110px) 24px 34px !important;
  background:
    linear-gradient(90deg, rgba(0, 69, 55, .52), rgba(0, 78, 62, .32)),
    url("/assets/nh-wallpaper.webp") center / cover no-repeat !important;
}

body .server-login::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(4, 45, 37, .06), rgba(4, 45, 37, .34));
}

body .server-login-card {
  width: min(458px, 100%);
  padding: 34px 34px 29px;
  border: 1px solid rgba(255,255,255,.72);
  border-top: 5px solid var(--nhx-green);
  border-radius: 2px;
  background: rgba(255,255,255,.965);
  box-shadow: 0 28px 80px rgba(3, 45, 36, .32);
  backdrop-filter: blur(12px);
}

body .server-login-logo {
  width: min(310px, 86%);
  margin-bottom: 20px;
}

body .server-profile-entry {
  border-radius: 2px;
  border-color: rgba(255,255,255,.55);
  color: #fff;
  background: rgba(0,72,57,.58);
  box-shadow: none;
  backdrop-filter: blur(12px);
}

body .server-profile-entry strong { border-radius: 1px; }

/* Acceso del paciente: misma escala y composición que el acceso profesional. */
body:has(#login-view:not([hidden])) {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 !important;
  background: #005b49;
  overflow-x: hidden;
  isolation: isolate;
}

body:has(#login-view:not([hidden]))::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background: url("/assets/nh-wallpaper.webp") center / cover no-repeat;
}

body:has(#login-view:not([hidden]))::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(0, 69, 55, .54), rgba(0, 78, 62, .28)),
    linear-gradient(180deg, rgba(4, 45, 37, .06), rgba(4, 45, 37, .34));
  pointer-events: none;
}

#login-view.auth-wide {
  position: relative;
  width: min(458px, calc(100% - 32px));
  margin: clamp(72px, 9vh, 110px) auto 34px;
  padding: 34px 34px 29px;
  border: 1px solid rgba(255,255,255,.72);
  border-top: 5px solid var(--nhx-green);
  border-radius: 2px;
  background: rgba(255,255,255,.97);
  box-shadow: 0 28px 80px rgba(3,45,36,.32);
  backdrop-filter: blur(12px);
}

#login-view .patient-login-brand img {
  width: min(310px, 86%);
  margin: 0 auto 20px;
}

#login-view .patient-login-brand h1 {
  margin: 0;
  color: var(--nhx-deep);
  font-size: 1.45rem;
  line-height: 1.15;
  letter-spacing: -.035em;
}

#login-view .patient-login-brand p {
  margin: 7px 0 0;
  color: var(--nhx-muted);
  font-size: .91rem;
}

#login-view .patient-login-intro {
  margin: 18px 0 20px;
  text-align: center;
}

#login-view .field input,
#login-view .button,
#login-view .text-button {
  border-radius: 2px;
}

#login-view .profile-entry {
  top: 22px;
  border-radius: 2px;
  color: #fff;
  border-color: rgba(255,255,255,.55);
  background: rgba(0,72,57,.58);
  box-shadow: none;
}

#login-view .profile-entry strong { border-radius: 1px; }
#login-view .security-note { border-radius: 2px; }

/* Perfil de paciente: geometría editorial, clara y consistente con la app. */
body:has(#dashboard:not([hidden])) {
  background: var(--nhx-canvas);
  color: var(--nhx-ink);
}

.patient-shell {
  width: min(1320px, calc(100% - 40px));
  padding-top: 20px;
}

.patient-topbar {
  min-height: 112px;
  margin: 0 0 18px;
  padding: 12px 18px;
  border: 1px solid var(--nhx-line);
  border-top: 4px solid var(--nhx-green);
  border-radius: 2px;
  background: var(--nhx-paper);
  box-shadow: 0 7px 22px rgba(18,51,44,.06);
}

.patient-header-brand {
  flex: 0 0 auto;
  min-width: 245px;
}

.patient-header-logo {
  width: 245px;
  max-width: 32vw;
  max-height: none;
}

.patient-shell .button,
.patient-shell input,
.patient-shell textarea,
.patient-shell select,
.patient-shell .dialog-card {
  border-radius: 2px;
}

.patient-shell .button {
  box-shadow: none;
  transform: none;
}

.patient-shell .button:hover { box-shadow: inset 0 -3px 0 rgba(0,0,0,.13); }

.patient-hero {
  position: relative;
  min-height: 228px;
  align-items: center;
  padding: clamp(28px, 4.5vw, 54px);
  border: 0;
  border-radius: 2px;
  background:
    linear-gradient(105deg, var(--nhx-deep) 0%, #006b55 72%, #00866a 100%);
  box-shadow: 0 14px 36px rgba(18,51,44,.14);
  overflow: hidden;
}

.patient-hero::after {
  content: "N&H";
  position: absolute;
  right: clamp(12px, 4vw, 54px);
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,.055);
  font-size: clamp(7rem, 18vw, 15rem);
  font-weight: 900;
  letter-spacing: -.11em;
  line-height: .8;
  pointer-events: none;
}

.patient-hero > * { position: relative; z-index: 1; }
.patient-hero h2 { max-width: 750px; font-weight: 780; letter-spacing: -.045em; }
.patient-hero p { color: rgba(255,255,255,.72); }
.eyebrow-light { color: #7fe1cb; }

.doctor-chip {
  min-width: 250px;
  padding: 17px 18px;
  border: 1px solid rgba(255,255,255,.26);
  border-left: 4px solid var(--nhx-green);
  border-radius: 1px;
  background: rgba(0,40,32,.24);
  backdrop-filter: blur(7px);
}

.metric-grid { gap: 1px; padding: 1px; background: var(--nhx-line); }

.health-metric {
  min-height: 154px;
  padding: 20px 20px 18px;
  border: 0;
  border-radius: 0;
  background: var(--nhx-paper);
  box-shadow: none;
}

.health-metric::after {
  width: 4px;
  height: 46px;
  top: 20px;
  right: 0;
  border-radius: 0;
  background: var(--nhx-green);
}

.metric-heading { display: flex; align-items: center; gap: 9px; }
.metric-index {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 1px solid #b9d8cf;
  border-radius: 1px;
  color: var(--nhx-green-dark);
  background: var(--nhx-soft);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .04em;
}

.metric-label { color: var(--nhx-muted); font-size: 11px; letter-spacing: .035em; text-transform: uppercase; }
.metric-value { margin: 14px 0 6px; color: var(--nhx-deep); font-size: clamp(1.35rem, 2.4vw, 1.85rem); letter-spacing: -.035em; }

.patient-primary-module,
.patient-layout > .card {
  border: 1px solid var(--nhx-line);
  border-radius: 2px;
  background: var(--nhx-paper);
  box-shadow: 0 7px 24px rgba(18,51,44,.055);
}

.patient-primary-module { background: var(--nhx-paper); }

.section-heading {
  align-items: center;
  margin: -26px -26px 24px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--nhx-line);
  background: #f8fbfa;
}

.section-heading h2 { color: var(--nhx-deep); letter-spacing: -.022em; }
.section-icon,
.patient-primary-module .section-icon {
  height: 38px;
  flex-basis: 38px;
  border-radius: 1px;
  color: #fff;
  background: var(--nhx-green-dark);
  box-shadow: none;
}

.personal-grid { gap: 1px; padding: 1px; background: var(--nhx-line); }
.personal-item {
  min-height: 82px;
  padding: 15px 16px;
  border: 0;
  border-radius: 0;
  background: #fff;
}
.personal-item span { font-size: 10px; font-weight: 780; letter-spacing: .05em; text-transform: uppercase; }
.personal-item strong { color: var(--nhx-deep); }

.visual-grid { gap: 14px; }
.visual-card {
  position: relative;
  min-height: 300px;
  padding: 21px;
  border: 1px solid var(--nhx-line);
  border-top: 4px solid var(--nhx-green-dark);
  border-radius: 2px;
  background: #fff;
}
.visual-card h3 { color: var(--nhx-deep); font-size: .98rem; }
.visual-subtitle { display: block; margin-top: 4px; }
.visual-card-head { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.chart-latest {
  flex: 0 0 auto;
  padding-left: 13px;
  border-left: 2px solid var(--nhx-green);
  color: var(--nhx-green-dark);
  font-size: 12px;
  font-weight: 850;
  text-align: right;
}
.chart-latest small { display: block; margin-top: 2px; color: var(--nhx-muted); font-size: 9px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.chart-legend { padding: 9px 0; border-bottom: 1px solid #e7efec; }
.legend-dot { border-radius: 1px; }
.line-chart { height: 184px; margin-top: 5px; }
.chart-grid { stroke: #dce8e4; stroke-dasharray: 3 4; }
.chart-axis { stroke: #9fb8b1; stroke-width: 1; }
.chart-point { stroke: #fff; stroke-width: 2; }
.chart-area { opacity: .11; }
.chart-label { fill: #6f837d; font-family: "Inter", sans-serif; }

.risk-gauge::before {
  background: conic-gradient(from 270deg at 50% 100%, #00b08a 0deg, #7ccab7 65deg, #d9a83e 110deg, #b95a4d 145deg, #e8efed 145deg 180deg);
}
.risk-gauge::after { background: #fff; }
.gauge-value { color: var(--nhx-deep); }

.lab-visual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 1px;
  margin-top: 18px;
  padding: 1px;
  background: var(--nhx-line);
}
.lab-visual-item { min-height: 74px; padding: 12px 13px; background: #fff; }
.lab-visual-item span { display: block; color: var(--nhx-muted); font-size: 10px; line-height: 1.25; }
.lab-visual-item strong { display: block; margin-top: 7px; color: var(--nhx-deep); font-size: 16px; }
.lab-visual-item[data-status="alert"] { box-shadow: inset 3px 0 0 var(--nhx-alert); }
.lab-visual-item[data-status="alert"] strong { color: var(--nhx-alert); }

.clinical-grid { gap: 1px; padding: 1px; background: var(--nhx-line); }
.clinical-card {
  padding: 20px;
  border: 0;
  border-radius: 0;
  background: #fff;
}
.clinical-card-head { padding-bottom: 12px; border-bottom: 1px solid #e4ece9; }
.result-row { padding: 11px 0; border-color: #e6eeeb; }
.pill { border-radius: 1px; }

.patient-footer { color: var(--nhx-muted); }

@media (max-width: 760px) {
  body .server-login { padding: 72px 14px 24px !important; background-position: 42% center !important; }
  body .server-login-card,
  #login-view.auth-wide { padding: 25px 20px; }
  #login-view.auth-wide { margin-top: 72px; margin-bottom: 24px; }
  .patient-shell { width: min(100% - 18px, 1320px); padding-top: 9px; }
  .patient-topbar { min-height: 94px; padding: 10px; }
  .patient-header-brand { min-width: 200px; }
  .patient-header-logo { width: 200px; max-width: 64vw; max-height: none !important; }
  .patient-hero { min-height: 260px; padding: 26px 22px; }
  .patient-hero::after { right: -15px; font-size: 9rem; }
  .section-heading { margin: -18px -18px 20px; padding: 15px 16px; }
  .visual-card { min-height: 270px; padding: 17px; }
  .visual-card-head { display: block; }
  .chart-latest { margin-top: 12px; padding-left: 10px; text-align: left; }
  .patient-app-nav { border-radius: 0; }
  .patient-app-nav a { border-radius: 1px; }
}

@media (max-width: 420px) {
  .lab-visual-grid { grid-template-columns: 1fr; }
  #login-view .profile-entry { right: 12px; }
  #login-view .patient-login-brand img { width: min(270px, 84%); }
  .patient-header-brand { min-width: 178px; }
  .patient-header-logo { width: 178px; max-width: 60vw; }
}

@media (prefers-reduced-motion: reduce) {
  .patient-shell *,
  .server-login * { scroll-behavior: auto !important; transition: none !important; }
}
