/*
 * Nuuma · Interfaz 2.9
 * La capa de diseño del panel: se carga la última y define el aspecto de las piezas
 * comunes (fondo, tarjetas, botones, campos, barra, menú) y de «Mi progreso».
 * Orden: fundamentos → marco → superficies → botones y campos → indicadores →
 *        mi progreso → control GLP-1 → acceso → adaptación.
 */

/* ───────────── Fundamentos ───────────── */
:root {
  --cream: #f3f5f7;
  --soft: #f7f8fa;
  --muted: #5a6777;
  --line: rgba(27, 45, 65, 0.1);
  --ui-line: #e3e8ee;
  --ui-card: #ffffff;
  --ui-radius: 20px;
  --ui-radius-sm: 14px;
  --ui-field: 12px;
  --shadow: 0 1px 2px rgba(27, 45, 65, 0.04), 0 14px 32px -22px rgba(27, 45, 65, 0.22);
  --ui-ring: 0 0 0 3px rgba(112, 187, 224, 0.35);
  --ui-dock: 76px;
}

html {
  background: var(--cream);
}
body.nuuma-body {
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* Fondo liso: sin la cuadrícula ni el degradado que ensuciaban las tarjetas. */
body.nuuma-body::before {
  content: none;
}
body.nuuma-body :focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 2px;
}

/* ───────────── Marco: barra superior y contenido ───────────── */
body.nuuma-body .topbar {
  border-bottom: 1px solid var(--ui-line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
}
body.nuuma-body .topbar > div:first-of-type > span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
body.nuuma-body .topbar h1 {
  font-weight: 600;
  letter-spacing: -0.01em;
}
body.nuuma-body .user-pill {
  border: 1px solid var(--ui-line);
  background: var(--ui-card);
  box-shadow: none;
}
body.nuuma-body .user-pill > span {
  background: var(--navy);
  color: #fff;
  font-weight: 600;
}
body.nuuma-body .workspace {
  width: min(100%, 1360px);
  margin-inline: auto;
}

/* ───────────── Superficies ───────────── */
body.nuuma-body .panel,
body.nuuma-body .kpi {
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-card);
  box-shadow: var(--shadow);
}
body.nuuma-body .section-head h2 {
  font-weight: 600;
  letter-spacing: -0.01em;
}
body.nuuma-body .empty-state {
  border: 1px dashed var(--ui-line);
  border-radius: var(--ui-radius-sm);
  background: var(--soft);
}
body.nuuma-body .badge {
  border-radius: 999px;
  font-weight: 500;
}
/* Cabecera de sección: título y acción siempre en la misma fila; la acción baja solo si no cabe. */
body.nuuma-body .section-head {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  text-align: left;
}
body.nuuma-body .section-head > :first-child:not(:only-child) {
  flex: 1 1 auto;
  min-width: 0;
}
body.nuuma-body .soft-link {
  color: var(--navy);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: rgba(27, 45, 65, 0.25);
  text-underline-offset: 4px;
}
/* Enlace con flecha («Ver todos los pedidos ›»): se subraya solo el texto, no la flecha. */
body.nuuma-body a.soft-link:has(> .dashicons) {
  gap: 6px;
  text-decoration: none;
}
body.nuuma-body a.soft-link:has(> .dashicons) > span:not(.dashicons) {
  text-decoration: underline;
  text-decoration-color: rgba(27, 45, 65, 0.25);
  text-underline-offset: 4px;
}
/* Regresar («Volver a pacientes»): la flecha en un círculo y el texto al lado, sin subrayado. */
body.nuuma-body .back-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 4px 14px 4px 4px;
  border-radius: 999px;
  color: var(--navy);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.18s ease;
}
body.nuuma-body .back-link > .dashicons {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--ui-line);
  border-radius: 50%;
  background: var(--ui-card);
  color: var(--navy);
  font-size: 16px;
  line-height: 1;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}
body.nuuma-body .back-link:hover {
  background: rgba(27, 45, 65, 0.05);
  color: var(--navy);
}
body.nuuma-body .back-link:hover > .dashicons {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
  transform: translateX(-2px);
}
body.nuuma-body .back-link:focus-visible {
  outline: none;
  box-shadow: var(--ui-ring);
}
body.nuuma-body .back-link.expedient-back {
  margin-left: -4px;
}
@media (prefers-reduced-motion: reduce) {
  body.nuuma-body .back-link,
  body.nuuma-body .back-link > .dashicons {
    transition: none;
  }
  body.nuuma-body .back-link:hover > .dashicons {
    transform: none;
  }
}
/* Listas cortas (citas, pacientes): icono, texto y estado en una fila, también en el celular. */
body.nuuma-body .mini-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-card);
}
body.nuuma-body .mini-item > div {
  min-width: 0;
}
body.nuuma-body .mini-item > div > strong,
body.nuuma-body .mini-item > div > small {
  display: block;
  overflow-wrap: anywhere;
}
body.nuuma-body a.mini-item:hover {
  border-color: rgba(27, 45, 65, 0.3);
}
/* Tablas: filas separadas por una línea fina, sin recuadros por celda. */
body.nuuma-body .data-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}
body.nuuma-body .data-table th {
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--ui-line);
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
body.nuuma-body .data-table td {
  padding: 14px 12px;
  border: 0;
  border-bottom: 1px solid var(--ui-line);
  border-radius: 0;
  background: transparent;
  vertical-align: middle;
}
body.nuuma-body .data-table tbody tr:last-child td {
  border-bottom: 0;
}
body.nuuma-body .data-table tbody tr:hover td {
  background: var(--soft);
}

/* ───────────── Botones y campos ───────────── */
body.nuuma-body .btn {
  border-radius: var(--ui-field);
  font-weight: 600;
  letter-spacing: 0;
  transition:
    background 0.2s var(--ease),
    border-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease),
    transform 0.2s var(--ease);
}
body.nuuma-body .btn.primary {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 10px 20px -14px rgba(27, 45, 65, 0.7);
}
body.nuuma-body .btn.primary:hover:not(:disabled) {
  background: var(--navy-deep);
  transform: translateY(-1px);
}
body.nuuma-body .btn.ghost {
  border: 1px solid var(--ui-line);
  background: var(--ui-card);
  color: var(--navy);
}
body.nuuma-body .btn.ghost:hover:not(:disabled) {
  border-color: rgba(27, 45, 65, 0.35);
}
body.nuuma-body .btn:disabled {
  box-shadow: none;
  cursor: not-allowed;
}
body.nuuma-body input:not([type='checkbox']):not([type='radio']):not([type='range']):not([type='file']):not([type='hidden']),
body.nuuma-body select,
body.nuuma-body textarea {
  border-color: #d7dee6;
  border-radius: var(--ui-field);
  color: var(--ink);
  transition:
    border-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}
body.nuuma-body input:not([type='checkbox']):not([type='radio']):not([type='range']):not([type='file']):focus,
body.nuuma-body select:focus,
body.nuuma-body textarea:focus {
  border-color: var(--sky);
  outline: 0;
  box-shadow: var(--ui-ring);
}
/* Fecha y hora: en iPhone el campo trae un ancho propio y se salía de su columna. */
body.nuuma-body input[type='date'],
body.nuuma-body input[type='time'],
body.nuuma-body input[type='month'],
body.nuuma-body input[type='datetime-local'] {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  -webkit-appearance: none;
  appearance: none;
  text-align: left;
}
body.nuuma-body input::-webkit-date-and-time-value {
  margin: 0;
  text-align: left;
}
body.nuuma-body label {
  min-width: 0;
}

/* ───────────── Indicadores ───────────── */
body.nuuma-body .kpi {
  position: relative;
  overflow: hidden;
}
/* Una línea de color arriba distingue cada indicador sin teñir toda la tarjeta. */
body.nuuma-body .kpi::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--navy);
  opacity: 0.85;
}
body.nuuma-body .kpi.sky::before {
  background: var(--sky);
}
body.nuuma-body .kpi.sage::before {
  background: var(--sage);
}
body.nuuma-body .kpi.sand::before {
  background: var(--sand);
}
body.nuuma-body .kpi .kpi-label {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
body.nuuma-body .kpi strong {
  color: var(--navy);
  font-weight: 600;
  letter-spacing: -0.02em;
}
body.nuuma-body .kpi .kpi-meta {
  color: var(--muted);
}
body.nuuma-body .kpi {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}
body.nuuma-body .kpi .kpi-foot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-top: auto;
  border-top: 1px solid var(--ui-line);
}
body.nuuma-body .kpi .kpi-trend {
  border: 0;
  border-radius: 999px;
  background: rgba(27, 45, 65, 0.06);
  color: var(--navy);
  font-weight: 500;
}
body.nuuma-body .kpi.sky .kpi-trend {
  background: var(--sky-soft);
}
body.nuuma-body .kpi.sage .kpi-trend {
  background: rgba(138, 188, 158, 0.24);
}
body.nuuma-body .kpi.sand .kpi-trend {
  background: var(--sand-soft);
}

/* ───────────── Mi progreso ───────────── */
body.nuuma-body .weight-month-stat {
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius-sm);
  background: var(--soft);
}
body.nuuma-body .weight-month-stat > strong {
  font-weight: 600;
}
body.nuuma-body .weekly-measures-alert {
  border-radius: var(--ui-radius-sm);
}
body.nuuma-body .team-box {
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius-sm);
  background: var(--soft);
}

/* ───────────── Control semanal GLP-1 ─────────────
   Tarjeta propia: cabecera, contador con su texto, las dos fechas y el registro de dosis.
   Todo en rejillas con columnas que pueden encogerse, para que nada se salga de la tarjeta. */
.glp1-weekly {
  container-type: inline-size;
  display: grid;
  gap: 18px;
  padding: clamp(18px, 2.4vw, 28px);
}
.glp1-weekly.is-due {
  border-color: #f4d3b3;
  background: linear-gradient(180deg, #fffaf4 0, #fff 140px);
}
.glp1-weekly-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.glp1-weekly-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.glp1-weekly-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--navy);
  color: #fff;
}
.glp1-weekly-icon .dashicons {
  width: 22px;
  height: 22px;
  font-size: 22px;
}
.glp1-kicker {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.glp1-weekly-title h2 {
  margin: 2px 0 0;
  color: var(--navy);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.glp1-status {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(138, 188, 158, 0.22);
  color: #2f6e5e;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.glp1-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.glp1-weekly.is-due .glp1-status {
  background: var(--sand-soft);
  color: #a8571b;
}
.glp1-weekly-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}
.glp1-count-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.glp1-count {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 84px;
  height: 84px;
  border: 5px solid rgba(138, 188, 158, 0.35);
  border-radius: 50%;
  background: #fff;
  color: #2f6e5e;
}
.glp1-count.is-zero {
  border-color: #f9d9bd;
  color: #a8571b;
}
.glp1-count strong {
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
}
.glp1-count span {
  margin-top: 3px;
  font-size: 11px;
  font-weight: 500;
}
.glp1-count-copy {
  min-width: 0;
}
.glp1-count-copy strong {
  display: block;
  margin-bottom: 4px;
  color: var(--navy);
  font-size: 15.5px;
  font-weight: 600;
}
.glp1-count-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
  text-wrap: pretty;
}
.glp1-dates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.glp1-dates > div {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius-sm);
  background: var(--soft);
}
.glp1-dates span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
}
.glp1-dates strong {
  display: block;
  color: var(--navy);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.glp1-dates strong small {
  display: inline-block;
  margin-left: 6px;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
/* Activar el recordatorio (primera vez) y corregir la última dosis. */
.glp1-setup {
  display: grid;
  gap: 16px;
}
.glp1-setup-copy strong {
  display: block;
  margin-bottom: 4px;
  color: var(--navy);
  font-size: 15px;
  font-weight: 600;
}
.glp1-setup-copy p {
  max-width: 62ch;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.glp1-setup-form,
.glp1-correct-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}
.glp1-correct-form {
  margin-top: 12px;
}
.glp1-setup-form label,
.glp1-correct-form label,
.glp1-dose-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.glp1-setup-form label > span,
.glp1-correct-form label > span,
.glp1-dose-field > span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
}
.glp1-setup-form .btn,
.glp1-correct-form .btn {
  grid-column: 1 / -1;
}
.glp1-setup-btn,
.glp1-confirm-btn,
.glp1-correct-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
}
/* Registrar dosis */
.glp1-confirm-form {
  display: grid;
  gap: 12px;
}
.glp1-pending {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.glp1-dose-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius-sm);
  background: #fff;
  transition:
    border-color 0.2s var(--ease),
    background 0.2s var(--ease);
}
.glp1-dose-row.is-checked {
  border-color: rgba(138, 188, 158, 0.75);
  background: rgba(138, 188, 158, 0.1);
}
.glp1-dose-row:not(.is-checked) .glp1-dose-field {
  opacity: 0.62;
}
.glp1-check {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius-sm);
  background: #fff;
  cursor: pointer;
  transition:
    border-color 0.2s var(--ease),
    background 0.2s var(--ease);
}
.glp1-dose-row .glp1-check {
  grid-column: 1 / -1;
  padding: 2px;
  border: 0;
  background: none;
}
.glp1-check.is-disabled {
  background: var(--soft);
  cursor: not-allowed;
  opacity: 0.7;
}
/* La casilla real queda oculta (sigue recibiendo el foco); se ve la caja dibujada. */
.glp1-check input[type='checkbox'] {
  position: absolute;
  width: 1px;
  height: 1px;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  clip-path: inset(50%);
}
.glp1-check-box {
  display: grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1.5px solid #b4c0cc;
  border-radius: 9px;
  background: #fff;
  transition:
    background 0.2s var(--ease),
    border-color 0.2s var(--ease);
}
.glp1-check-box .dashicons {
  width: 18px;
  height: 18px;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  opacity: 0;
}
.glp1-check input:checked + .glp1-check-box {
  border-color: var(--success);
  background: var(--success);
}
.glp1-check input:checked + .glp1-check-box .dashicons {
  opacity: 1;
}
.glp1-check input:focus-visible + .glp1-check-box {
  outline: 2px solid var(--sky);
  outline-offset: 3px;
}
.glp1-check > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.glp1-check strong {
  color: var(--navy);
  font-size: 14px;
  font-weight: 600;
}
.glp1-check small {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
}
.glp1-dose-field input {
  min-height: 44px;
}
.glp1-older {
  border: 1px dashed #d3dbe3;
  border-radius: var(--ui-radius-sm);
  background: var(--soft);
}
.glp1-older[open] {
  border-style: solid;
  background: #fff;
}
.glp1-older > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 14px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 500;
  list-style: none;
  cursor: pointer;
}
.glp1-older > summary::-webkit-details-marker {
  display: none;
}
.glp1-older > summary [data-glp1-older-label] {
  flex: 1;
  min-width: 0;
}
.glp1-older-count {
  flex: none;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(138, 188, 158, 0.22);
  color: #2f6e5e;
  font-size: 11px;
  white-space: nowrap;
}
.glp1-older > summary .dashicons {
  width: 18px;
  height: 18px;
  color: var(--muted);
  font-size: 18px;
  transition: transform 0.2s var(--ease);
}
.glp1-older[open] > summary .dashicons {
  transform: rotate(90deg);
}
.glp1-older-list {
  display: grid;
  gap: 8px;
  padding: 0 8px 8px;
}
.glp1-confirm-btn:disabled {
  opacity: 0.45;
}
.glp1-correct {
  padding-top: 14px;
  border-top: 1px solid var(--ui-line);
}
.glp1-correct summary {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  cursor: pointer;
}
.glp1-correct summary {
  list-style: none;
}
.glp1-correct summary::-webkit-details-marker {
  display: none;
}
.glp1-correct summary::after {
  content: ' ›';
}
/* Tarjeta angosta: el estado arriba y el título debajo, sin partirse. */
@container (max-width: 460px) {
  .glp1-weekly-head {
    flex-direction: column-reverse;
    align-items: flex-start;
  }
  .glp1-dates strong small {
    display: block;
    margin: 2px 0 0;
  }
}
/* Con espacio: el contador a la izquierda, las fechas a la derecha y cada dosis en una fila. */
@container (min-width: 640px) {
  .glp1-weekly-body {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    align-items: center;
  }
  .glp1-confirm-form,
  .glp1-correct,
  .glp1-setup {
    grid-column: 1 / -1;
  }
  .glp1-dose-row {
    grid-template-columns: minmax(0, 1fr) 170px 130px;
    align-items: end;
  }
  .glp1-dose-row .glp1-check {
    grid-column: auto;
    align-self: center;
  }
  .glp1-setup-form,
  .glp1-correct-form {
    grid-template-columns: 190px 150px auto;
    justify-content: start;
  }
  .glp1-setup-form .btn,
  .glp1-correct-form .btn {
    grid-column: auto;
    width: auto;
  }
  .glp1-confirm-form:not(.glp1-pending-form) {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
  .glp1-confirm-form:not(.glp1-pending-form) .glp1-confirm-btn {
    width: auto;
    min-width: 200px;
  }
}

/* ───────────── Contenido que no se sale de su caja ─────────────
   Un nombre largo, un correo o una fila de botones bajan de línea antes que empujar la tarjeta
   fuera de la pantalla. Vale para todas las secciones. */
body.nuuma-body .workspace :where(.panel, .grid, .split, .mini-list, .stack-form, .table-wrap) > * {
  min-width: 0;
}
body.nuuma-body .workspace :where(h1, h2, h3, strong, p, small, dd, td, a) {
  overflow-wrap: anywhere;
}
/* Tarjetas en lista (tomas de laboratorio, exámenes): una columna que puede encogerse. */
body.nuuma-body :where(.lab-orders, .onb-list) {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
body.nuuma-body :where(.lab-order-card, .onb-card, .order-card) {
  min-width: 0;
  max-width: 100%;
}
body.nuuma-body :where(.lab-order-toggle, .order-toggle) > * {
  min-width: 0;
}
/* Cabeceras y filas de acciones: lo que no cabe pasa a la línea siguiente. */
body.nuuma-body :where(.onb-head, .onb-head-right, .mini-actions, .row-actions, .lab-order-head, .users-table .role-inline-form, .appt-agenda .ev .meta) {
  flex-wrap: wrap;
  min-width: 0;
}
body.nuuma-body :where(.onb-head-right, .mini-actions > .inline-form, .ph-lab-value, .section-head .patient-initial-status) {
  flex-shrink: 1;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
}
body.nuuma-body .inline-form {
  max-width: 100%;
}
body.nuuma-body :where(.lab-order-action, .lab-order-note, .mini-chart-head) {
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
}
body.nuuma-body :where(.mini-chart-delta, .role-chip, .ev-link) {
  min-width: 0;
  white-space: normal;
}
body.nuuma-body :where(.chip, .badge, .ev-link) {
  max-width: 100%;
}

/* ───────────── Acceso ───────────── */
body.nuuma-body .login-panel {
  background: var(--ui-card);
}
body.nuuma-body .access-form .panel-heading h2 {
  font-weight: 600;
  letter-spacing: -0.015em;
}

/* ───────────── Adaptación: celular y tablet (hasta 860 px, con la barra inferior) ───────────── */
@media (max-width: 860px) {
  /* La barra superior es la cabecera de la app: color de marca y bordes inferiores redondeados. */
  body.nuuma-body .topbar {
    border-bottom: 0;
    border-radius: 0 0 24px 24px;
    background: var(--navy);
    backdrop-filter: none;
  }
  body.nuuma-body .topbar > div:first-of-type > span {
    color: rgba(255, 255, 255, 0.66);
  }
  body.nuuma-body .user-pill {
    border: 0;
    background: none;
  }
  body.nuuma-body .user-pill > span {
    background: #fff;
    color: var(--navy);
  }
  body.nuuma-body .workspace {
    padding-bottom: calc(var(--ui-dock) + 40px + env(safe-area-inset-bottom, 0px));
  }
  /* Barra inferior: flotante, clara, con la sección activa en el color de marca. */
  body.nuuma-body .side-nav {
    border: 1px solid var(--ui-line);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 18px 40px -18px rgba(27, 45, 65, 0.45);
    backdrop-filter: blur(16px);
  }
  body.nuuma-body .side-nav a,
  body.nuuma-body .side-nav .nav-more-btn {
    border-radius: 16px;
    color: var(--muted);
  }
  body.nuuma-body .side-nav a.is-active,
  body.nuuma-body .side-nav .nav-more-btn.is-active {
    background: var(--navy);
    color: #fff;
    box-shadow: none;
  }
  body.nuuma-body .side-nav a.is-active .dashicons,
  body.nuuma-body .side-nav .nav-more-btn.is-active .dashicons {
    color: #fff;
  }
  /* Los campos a 16 px: con menos, el iPhone amplía la pantalla al escribir. */
  body.nuuma-body input:not([type='checkbox']):not([type='radio']):not([type='range']):not([type='file']),
  body.nuuma-body select,
  body.nuuma-body textarea {
    min-height: 46px;
    font-size: 16px;
  }
  body.nuuma-body .btn {
    min-height: 46px;
  }
}

/* Tablet: el contenido no se estira de borde a borde y tres indicadores caben en una fila. */
@media (min-width: 621px) and (max-width: 860px) {
  body.nuuma-body .workspace {
    width: min(100%, 780px);
  }
  body.nuuma-body .kpi-grid.cards-count-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  /* En pantallas muy angostas el estado de una fila baja debajo del texto. */
  body.nuuma-body .mini-item {
    grid-template-columns: auto minmax(0, 1fr);
  }
  body.nuuma-body .mini-item > :nth-child(3) {
    grid-column: 2;
    justify-self: start;
  }
  .glp1-weekly-icon {
    display: none;
  }
  .glp1-count {
    width: 70px;
    height: 70px;
    border-width: 4px;
  }
  .glp1-count strong {
    font-size: 25px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.nuuma-body .btn,
  .glp1-older > summary .dashicons {
    transition: none;
  }
}
