/* Rediseño aprobado en Stitch (docs/diseno/stitch/, 2026-11-08).
   Solo presentación: se carga después de styles.css y stitch-theme.css y no cambia
   comportamiento. Los estados siempre llevan icono y palabra, nunca solo color. */
:root {
  --teal: #006b62;
  --teal-soft: #dcf7f1;
  --amber: #a45a08;
  --amber-soft: #fff1d6;
  --danger: #b4232f;
  --danger-soft: #fde4e6;
  --info: #2f5bd3;
  --info-soft: #e6edff;
  --radius-card: 16px;
  --radius-control: 12px;
  --tap: 48px;
  --icon-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4 3 19.5h18L12 4Z'/%3E%3Cpath d='M12 10v4M12 17h.01'/%3E%3C/svg%3E");
  --icon-clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 7.5V12l3 2'/%3E%3C/svg%3E");
  --icon-shield: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linejoin='round'%3E%3Cpath d='M12 3 5 6v5.5c0 4.3 3 7.8 7 9.5 4-1.7 7-5.2 7-9.5V6l-7-3Z'/%3E%3C/svg%3E");
  --icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E");
  --icon-skip: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='m6 6 12 12'/%3E%3C/svg%3E");
}
html[data-theme="dark"] {
  --teal-soft: #12403b;
  --amber-soft: #4a3210;
  --danger-soft: #4c1d23;
  --info-soft: #383d43;
  --amber: #ffc56b;
  --danger: #ff9aa2;
  --info: #a9bfff;
}

body { font-size: 17px; line-height: 1.5; }
.page-intro { font-size: 16px; }

/* ---------- Legibilidad: ningún texto informativo por debajo de 12-13 px ---------- */
.eyebrow { font-size: 12px; letter-spacing: 1.2px; }
.care-note { font-size: 14px; }
.demo-note { font-size: 13px; }
.auth-message { font-size: 14px; }
.treatment-person { font-size: 13px; }
.treatment-card-heading p { font-size: 14px; }
.medicine-name { font-size: 17px; }
.cell-caption { font-size: 12px; }
.medicine-name-button small, .leaflet-link { font-size: 12px; }

/* ---------- Navegación: 5 secciones con icono de línea y texto ---------- */
.sidebar-bottom #settings-nav-link svg.nav-icon { width: 22px; height: 22px; flex-basis: 22px; padding: 0; background: transparent; }
.nav-link { gap: 12px; }
.nav-link svg.nav-icon { flex: none; width: 22px; height: 22px; font-size: 0; }
.sidebar .nav-link { min-height: var(--tap); font-size: 16px; }
.avatar-settings-link { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; border-radius: 999px; text-decoration: none; }
.avatar-settings-link:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.sidebar-bottom .account-row { min-height: var(--tap); }

/* ---------- Chips de estado: icono + palabra ---------- */
.overview-badge, .status-badge, .calendar-take-status {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 28px; padding: 3px 10px; border: 0; border-radius: 999px;
  font-size: 13px; font-weight: 700; line-height: 1.2; white-space: nowrap;
}
.overview-badge::before, .calendar-take-status::before {
  content: ""; flex: none; width: 14px; height: 14px; background: currentColor;
  -webkit-mask: var(--chip-icon, var(--icon-check)) center / contain no-repeat;
  mask: var(--chip-icon, var(--icon-check)) center / contain no-repeat;
}
.badge-red, .status-badge.warning-badge, .status-badge.danger-badge { color: var(--danger); background: var(--danger-soft); --chip-icon: var(--icon-alert); }
.badge-orange, .status-badge.expiry-badge { color: var(--amber); background: var(--amber-soft); --chip-icon: var(--icon-clock); }
.badge-blue, .status-badge.essential-badge { color: var(--info); background: var(--info-soft); --chip-icon: var(--icon-shield); }
.status-badge.okay-badge { color: var(--teal); background: var(--teal-soft); }
.calendar-take-status.status-pending { color: var(--info); background: var(--info-soft); --chip-icon: var(--icon-clock); }
.calendar-take-status.status-confirmed { color: var(--teal); background: var(--teal-soft); --chip-icon: var(--icon-check); }
.calendar-take-status.status-omitted { color: #526477; background: #edf1f6; --chip-icon: var(--icon-skip); }
html[data-theme="dark"] .calendar-take-status.status-omitted { color: #c6d2e2; background: #2a3a50; }

/* ---------- Resumen ---------- */
.overview-metric {
  position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "icon number" "label label" "link link";
  align-items: center; row-gap: 8px; min-height: 150px; padding: 18px;
  border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--paper); color: var(--ink);
  box-shadow: 0 4px 16px rgb(16 37 59 / 5%);
}
.overview-metric .metric-icon { grid-area: icon; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: var(--teal); background: var(--teal-soft); font-style: normal; }
.overview-metric strong { grid-area: number; justify-self: end; font-size: 40px; line-height: 1; color: var(--ink); }
.overview-metric span { grid-area: label; font-size: 16px; font-weight: 700; color: var(--ink); }
.overview-metric small { grid-area: link; font-size: 15px; font-weight: 700; color: var(--teal); }
.overview-metric-red .metric-icon { color: var(--danger); background: var(--danger-soft); }
.overview-metric-orange .metric-icon { color: var(--amber); background: var(--amber-soft); }
.overview-metric-sage .metric-icon { color: var(--info); background: var(--info-soft); }
.overview-metric:hover { border-color: var(--teal); }
html[data-theme="dark"] .overview-metric.overview-metric { color: var(--ink); background: var(--paper); border-color: var(--line); }
html[data-theme="dark"] .overview-metric.overview-metric small { color: #7fe0d2; }
html[data-theme="dark"] .overview-metric .metric-icon { color: #7fe0d2; }
html[data-theme="dark"] .overview-metric-red .metric-icon, html[data-theme="dark"] .overview-metric-orange .metric-icon, html[data-theme="dark"] .overview-metric-sage .metric-icon { color: inherit; }
html[data-theme="dark"] .overview-metric-red .metric-icon { color: var(--danger); }
html[data-theme="dark"] .overview-metric-orange .metric-icon { color: var(--amber); }
html[data-theme="dark"] .overview-metric-sage .metric-icon { color: var(--info); }
html[data-theme="dark"] .overview-take time { color: var(--ink); background: #31353b; }
html[data-theme="dark"] .take-person-initial { color: #7fe0d2; }
.overview-panel-heading h2 { font-size: 22px; }
.overview-entry { min-height: 64px; gap: 12px; border-radius: 14px; }
.overview-entry strong { font-size: 16px; }
.overview-entry small { font-size: 14px; }
.overview-entry-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: none; }
/* Próximas tomas: una fila compacta (hora, inicial, medicamento y persona). */
.overview-take { display: grid; grid-template-columns: 58px 32px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 56px; padding: 7px 12px 7px 8px; }
.overview-take time { display: grid; padding: 4px 2px; border-radius: 10px; background: var(--paper); text-align: center; line-height: 1.1; }
.overview-take time strong { font-size: 16px; font-weight: 800; }
.overview-take time small { color: var(--muted); font-size: 12px; font-weight: 700; }
.overview-take .take-person-initial { width: 32px; height: 32px; font-size: 15px; }
.overview-take-copy { display: grid; min-width: 0; line-height: 1.25; }
.overview-take-copy :is(strong, small) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overview-take-copy strong { font-size: 15px; }
.overview-take-copy small { font-size: 13px; }
#overview-takes-list { gap: 8px; }
.take-person-initial { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 999px; color: var(--teal); background: var(--teal-soft); font-weight: 800; }

/* ---------- Tratamientos: selector de persona ---------- */
.person-chips { display: flex; gap: 10px; margin: 0 0 22px; padding: 2px 2px 6px; overflow-x: auto; scrollbar-width: thin; }
.person-chip {
  display: inline-flex; flex: none; align-items: center; gap: 8px; min-height: var(--tap); padding: 4px 16px 4px 5px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink);
  font-size: 16px; font-weight: 700; text-decoration: none;
}
.person-chip.is-selected { border-color: var(--teal); color: #fff; background: var(--teal); }
.person-chip:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.person-chip-avatar { display: grid; width: 38px; height: 38px; overflow: hidden; border-radius: 999px; background: #fff; }
.person-chip-avatar > * { width: 100%; height: 100%; }
.person-chips-empty { margin: 0; color: var(--muted); }
#tratamientos.is-treatments-tab .profile-management { display: none; }

/* ---------- Calendario ---------- */
.calendar-view-toggle { display: none; }
.calendar-day-takes .calendar-take { min-height: 64px; border-radius: 14px; }
.calendar-take time { font-size: 17px; font-weight: 800; }

/* ---------- Ajustes: lista agrupada ---------- */
.settings-card { border-radius: var(--radius-card); }
.settings-card h2 { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.settings-card .button { min-height: var(--tap); }
#settings-logout { color: var(--danger); }

/* ---------- Teléfono ---------- */
@media (max-width: 620px) {
  body { font-size: 16px; }
  .app-shell { position: relative; }
  .sidebar { padding-right: 112px; }
  .botiquin-switcher-wrap { width: auto; max-width: 150px; margin-left: auto; }
  .topbar {
    position: absolute; z-index: 6; top: 0; right: 12px; height: 59px; padding: 0;
    border: 0; background: transparent; backdrop-filter: none; box-shadow: none;
  }
  html[data-theme="dark"] .topbar { background: transparent; }
  .topbar-actions { width: auto; gap: 6px; }
  .topbar .demo-pill { display: none; }
  .topbar .notification-button { width: 44px; min-width: 44px; height: 44px; margin: 0; padding: 0; justify-content: center; border-radius: 999px; }
  .topbar .notification-button #notification-button-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .main-content { min-height: calc(100dvh - 59px); }

  .main-nav { grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .main-nav .nav-link { min-height: 56px; gap: 2px; padding: 4px 0; border-radius: 12px; font-size: 11.5px; font-weight: 700; letter-spacing: -.1px; }
  .main-nav .nav-link svg.nav-icon { width: 24px; height: 24px; }
  .main-nav .nav-link .nav-text { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .main-nav .nav-link.active, .main-nav .nav-link.active .nav-icon { color: var(--teal); background: var(--teal-soft); }
  .main-nav .nav-link.active .nav-icon { background: transparent; }
  html[data-theme="dark"] .main-nav .nav-link.active .nav-icon { color: #7fe0d2; }
  .avatar-settings-link.active .person-avatar { box-shadow: 0 0 0 3px var(--teal); }
  .overview-entry strong, .calendar-take strong { overflow: visible; white-space: normal; text-overflow: clip; }
  .calendar-take { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; }
  .calendar-take .calendar-take-status { grid-column: 2; justify-self: start; }
  .settings-card p { font-size: 15px; }
  #treatments-nav-link .nav-icon { font-size: inherit; }

  .page-intro { max-width: none; font-size: 15px; }
  .eyebrow { font-size: 11px; }
  .demo-note { max-width: none; font-size: 13px; }
  .medicine-name { font-size: 15px; }
  .cell-caption, .expiry-cell .cell-caption { font-size: 11.5px; }
  .medicine-name-button small, .leaflet-link { font-size: 11.5px; }
  .overview-grid { gap: 12px; }
  .overview-metric { min-height: 138px; padding: 14px; }
  .overview-metric strong { font-size: 34px; }
  .overview-metric span { font-size: 15px; }
  .overview-metric small { font-size: 13.5px; }
  .overview-panel-heading h2 { font-size: 19px; }
  .overview-entry-badges { max-width: 140px; }

  .calendar-view-toggle {
    display: flex; align-items: center; justify-content: center; width: 100%; min-height: var(--tap); margin-top: 8px;
    border: 0; border-radius: var(--radius-control); color: var(--teal); background: transparent; font: inherit; font-size: 15px; font-weight: 700;
  }
  .calendar-view-toggle:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
  .calendar-grid.is-week-view .calendar-day:not(.in-selected-week) { display: none; }
  .calendar-weekdays { font-size: 12px; font-weight: 700; }
  .calendar-day { min-height: 54px; }
  .calendar-day strong { font-size: 15px; }
  .calendar-take strong { font-size: 15px; }
  .calendar-take { flex-wrap: wrap; }

  .person-chips { margin-inline: -16px; padding-inline: 16px; }
}

/* Los enlaces de cabecera de los paneles del Resumen son el acceso principal a cada sección, así que se muestran legibles y no como un enlace secundario. */
.overview-panel-heading a { font-size: 14px; }

/* ---------- Inventario: búsqueda compacta, filtros en una línea y modo selección ---------- */
.inventory-search-row { gap: 8px; padding: 14px 22px 10px; border-bottom: 0; }
.inventory-search-row .search-box { height: 56px; border-radius: var(--radius-control); }
.inventory-search-row .search-box > span { flex-basis: 40px; width: 40px; height: 40px; font-size: 26px; }
.inventory-cima-button { flex: none; min-width: 0; min-height: 56px; gap: 8px; padding-inline: 18px; border-radius: var(--radius-control); font-size: 15px; }
.inventory-cima-button .plus { font-size: 22px; line-height: 1; }
.inventory-more { position: relative; flex: none; }
.inventory-more-button { width: 56px; min-width: 56px; min-height: 56px; padding: 0; border-radius: var(--radius-control); font-size: 26px; line-height: 1; }
.inventory-more-menu {
  position: absolute; z-index: 20; top: calc(100% + 6px); right: 0; min-width: 270px; padding: 6px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: 0 14px 34px rgb(16 37 59 / 16%);
}
.inventory-more-menu[hidden] { display: none; }
.inventory-more-item {
  display: flex; align-items: center; width: 100%; min-height: var(--tap); padding: 0 14px; border: 0; border-radius: 10px;
  color: var(--ink); background: transparent; font: inherit; font-size: 16px; font-weight: 700; text-align: left; white-space: nowrap; cursor: pointer;
}
.inventory-more-item:hover, .inventory-more-item:focus-visible { background: var(--teal-soft); outline: none; }
.inventory-more-button:focus-visible, .inventory-cima-button:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
html[data-theme="dark"] .inventory-more-menu { background: #2c3035; border-color: #545b65; }

.inventory-panel .inventory-counter-row {
  display: grid; grid-template-columns: repeat(3, minmax(0, 180px)); gap: 8px; padding: 0 22px 12px; border-bottom: 1px solid var(--line);
}
.inventory-panel .inventory-counter-row .inventory-counter {
  height: auto; min-height: 44px; flex-direction: row; justify-content: center; gap: 7px; padding: 4px 8px;
  border-radius: 999px; font-size: 14px; line-height: 1.1; white-space: nowrap;
}
.inventory-panel .inventory-counter-row .inventory-counter strong { min-width: 24px; min-height: 24px; border-radius: 999px; font-size: 13px; }

/* Selección: las casillas y la barra están siempre visibles. */
.inventory-panel .inventory-bulk-bar[hidden] { display: none; }
.inventory-panel.is-selecting .medicine-select input, .inventory-bulk-bar .select-all-medicines input { width: 22px; height: 22px; }
.inventory-bulk-bar { flex-wrap: wrap; gap: 8px 14px; padding: 8px 22px; }
.inventory-bulk-bar .selection-status { margin-left: auto; font-size: 14px; }
.inventory-bulk-bar .select-all-medicines { min-height: 44px; font-size: 14px; }
.inventory-bulk-bar .button { min-height: 44px; font-size: 14px; }
@media (max-width: 620px) {
  .inventory-search-row { flex-wrap: nowrap; gap: 8px; padding: 12px 12px 8px; }
  .inventory-search-row .search-box { flex: 1 1 auto; gap: 4px; min-width: 0; height: 52px; padding-inline: 6px 2px; }
  .inventory-search-row .search-box > span { flex-basis: 40px; width: 40px; height: 40px; font-size: 24px; }
  .inventory-search-row .search-box input { min-width: 0; font-size: 16px; }
  .inventory-cima-button { width: 52px; min-width: 52px; min-height: 52px; padding: 0; justify-content: center; }
  .inventory-cima-button .inventory-cima-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .inventory-cima-button .plus { margin: 0; font-size: 26px; }
  .inventory-more-button { width: 52px; min-width: 52px; min-height: 52px; }
  .inventory-more-menu { min-width: min(250px, calc(100vw - 24px)); }
  .inventory-panel .inventory-counter-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 0 12px 10px; }
  .inventory-panel .inventory-counter-row .inventory-counter { min-height: 44px; gap: 5px; padding: 4px 6px; font-size: 13px; }
  .inventory-panel .inventory-counter-row .inventory-counter strong { min-width: 22px; min-height: 22px; font-size: 13px; }
  .inventory-bulk-bar { padding: 8px 12px; }
  .inventory-bulk-bar:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 10px; }
  .inventory-bulk-bar .selection-status { margin: 0; font-size: 13px; text-align: right; }
  .inventory-bulk-bar .delete-selected-button { width: auto; min-width: 0; }
}
@media (max-width: 360px) {
  .inventory-search-row .search-box > span { display: none; }
}
@media (max-width: 380px) {
  .inventory-panel .inventory-counter-row .inventory-counter { flex-direction: column; gap: 1px; padding-inline: 2px; }
}
.people-demo-notice { margin: 0 0 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--info-soft); font-size: 15px; }
.people-demo-notice[hidden] { display: none; }

/* ---------- Acceso ---------- */
/* El aviso del simulador es secundario: una línea plegada bajo el formulario. */
.local-simulator-note { margin: 16px 0 0; padding: 10px 14px; border-radius: var(--radius-control); box-shadow: none; font-size: 14px; }
.local-simulator-note summary { min-height: 28px; font-size: 14px; line-height: 1.4; }
.local-simulator-note p { font-size: 14px; }
.auth-intro { font-size: 16px; }
.auth-card .field-label { font-size: 14px; }
.auth-secondary-actions { gap: 0; padding-top: 6px; border-top-color: var(--line); }
.auth-secondary-actions .auth-mode-toggle, .auth-secondary-actions .auth-recovery-toggle { min-height: 44px; padding: 0; font-size: 15px; }
.auth-secondary-actions .auth-mode-toggle { color: var(--teal); }
html[data-theme="dark"] .auth-secondary-actions .auth-mode-toggle { color: #7fe0d2; }
@media (max-width: 620px) {
  /* En el teléfono el acceso ocupa toda la pantalla, sin tarjeta flotante. */
  .auth-screen { place-items: stretch; padding: 0; }
  .auth-card {
    width: 100%; min-height: 100vh; min-height: 100dvh;
    padding: calc(32px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
    border: 0; border-radius: 0; box-shadow: none;
  }
  .auth-intro { font-size: 15px; }
}

/* ---------- Ajustes de móvil: menú de botiquines, día del calendario y alturas ---------- */
/* Botones de una sola acción: el texto no se parte en dos líneas. */
#export-calendar-from-calendar, #scan-code-button, #stop-scanner-button,
#invite-member-form button[type=submit], #cima-search-button { white-space: nowrap; }
/* El buscador de CIMA y «Buscar» tienen la altura de cualquier otro campo. */
#presentation-dialog .cima-search-controls input { min-height: 48px; height: 48px !important; }
#presentation-dialog .cima-search-controls .button { min-height: 48px; height: 48px; padding-inline: 18px; font-size: 16px; }
@media (max-width: 620px) {
  /* El menú de botiquines se abre a lo ancho, bajo la cabecera, sin salirse de la pantalla. */
  .sidebar .botiquin-switcher-wrap { position: static; }
  .sidebar .botiquin-switcher-menu { top: calc(100% + 6px); right: 12px; left: 12px; width: auto; max-width: none; }
  /* El día elegido se presenta centrado, con el número de tomas como etiqueta debajo. */
  .calendar-day-panel .overview-panel-heading { flex-direction: column; align-items: center; gap: 8px; text-align: center; }
  .calendar-day-panel .overview-panel-heading h2 { margin: 0; }
  #calendar-day-count { padding: 4px 12px; border-radius: 999px; color: var(--teal); background: var(--teal-soft); font-size: 14px; font-weight: 700; }
  .calendar-day-panel .overview-empty { text-align: center; }
  #export-calendar-from-calendar { flex: 0 0 auto; width: auto; max-width: 100%; padding-inline: 18px; }
  /* Cabeceras con una sola acción: el botón toma el ancho de su texto, no media columna. */
  #calendario .heading-actions, #tratamientos .heading-actions { grid-template-columns: max-content; }
  /* «Crear invitación» toma el ancho de su texto y el campo de correo se queda con el resto. */
  #invite-member-form { grid-template-columns: minmax(0, 1fr) auto; }
  #invite-member-form .button { width: auto; padding-inline: 14px; }
  /* «Buscar» sin icono en el teléfono para que el texto de ejemplo del campo quepa entero. */
  #presentation-dialog .cima-search-controls .button { padding-inline: 14px; }
  #presentation-dialog .cima-search-controls .button span { display: none; }
  #presentation-dialog .cima-search-controls input { padding-inline: 10px !important; }
  html[data-theme="dark"] #calendar-day-count { color: #7fe0d2; background: #12403b; }
}
html[data-theme="dark"] .calendar-take time { color: var(--ink); }
@media (max-width: 360px) {
  /* En pantallas muy estrechas el campo de CIMA ocupa su propia fila y «Buscar» va debajo. */
  #presentation-dialog .cima-search-controls { flex-wrap: wrap; }
  #presentation-dialog .cima-search-controls input, #presentation-dialog .cima-search-controls .button { flex: 1 1 100%; }
}

/* ---------- Tratamientos: persona elegida con un desplegable junto a «Crear tratamiento» ---------- */
#tratamientos.is-treatments-tab .heading-actions { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: center; gap: 10px; }
/* Desplegable propio de la app (no el selector nativo del móvil). */
.person-picker { position: relative; min-width: 0; }
.person-picker[hidden] { display: none; }
.person-picker-button {
  display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; height: 48px; padding: 0 12px 0 6px;
  border: 1px solid var(--line); border-radius: var(--radius-control); color: var(--ink); background: var(--paper);
  font: inherit; font-size: 16px; font-weight: 700; text-align: left; cursor: pointer;
}
.person-picker-button:hover, .person-picker-button[aria-expanded="true"] { border-color: var(--teal); }
.person-picker-button:focus-visible, .person-picker-option:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.person-picker-avatar { flex: 0 0 36px; width: 36px; height: 36px; overflow: hidden; border-radius: 999px; background: var(--teal-soft); }
.person-picker-avatar :is(svg, img, .avatar-art) { display: block; width: 100%; height: 100%; }
.person-picker-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-picker-age { flex: none; color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; }
.person-picker-button .person-picker-age { display: none; }
.person-picker-chevron { flex: 0 0 20px; width: 20px; height: 20px; margin-left: auto; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23006b62' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / 20px no-repeat; }
html[data-theme="dark"] .person-picker-chevron { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237fe0d2' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.person-picker-list {
  position: absolute; z-index: 20; top: calc(100% + 6px); right: 0; width: max(100%, 240px); max-width: calc(100vw - 24px);
  max-height: min(320px, 60vh); overflow: auto; padding: 6px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--paper); box-shadow: 0 14px 32px rgb(16 37 59 / 22%);
}
.person-picker-list[hidden] { display: none; }
.person-picker-option {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 6px 10px 6px 6px;
  border: 0; border-radius: 10px; color: var(--ink); background: transparent; font: inherit; font-size: 16px; font-weight: 700; text-align: left; cursor: pointer;
}
.person-picker-option .person-picker-age { margin-left: auto; }
.person-picker-option:hover { background: var(--teal-soft); }
.person-picker-option[aria-selected="true"] { color: var(--teal); background: var(--teal-soft); }
html[data-theme="dark"] :is(.person-picker-button, .person-picker-list) { color: var(--ink); border-color: #526a88; background: #2c3035; }
html[data-theme="dark"] .person-picker-option { color: var(--ink); }
html[data-theme="dark"] :is(.person-picker-option:hover, .person-picker-option[aria-selected="true"]) { color: #e5edfb; background: #40454d; }
@media (min-width: 621px) {
  #tratamientos.is-treatments-tab .heading-actions { grid-template-columns: max-content minmax(200px, 280px); }
}

/* ---------- Usuarios: «＋» para añadir, edad junto al nombre ---------- */
.profile-management .users-list-heading { order: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 0; }
.profile-management .users-list-heading .users-list-title { order: 0; margin: 0; }
.add-profile-button { width: 48px; min-width: 48px; height: 48px; min-height: 48px; padding: 0; justify-content: center; border-radius: 14px; font-size: 26px; line-height: 1; }
.add-profile-button[hidden] { display: none; }
.profile-age { color: var(--muted); font-weight: 600; }
.profile-dialog-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin: 6px 0 4px; }
.profile-dialog-fields .profile-avatar-control { display: flex; align-items: center; gap: 12px; width: auto; }
.profile-dialog-fields .profile-avatar-button { width: 56px; height: 56px; }
.profile-dialog-fields .profile-inline-field { display: grid; gap: 6px; min-width: 0; }
.profile-dialog-fields input { width: 100%; min-width: 0; height: 48px; font-size: 16px; }
#profile-dialog-message:empty { display: none; }

/* ---------- Inventario en móvil horizontal: una fila ordenada por medicamento ---------- */
@media (min-width: 621px) and (max-width: 850px) {
  .inventory-panel.is-selecting .medicine-row { grid-template-columns: 32px minmax(0, 1fr) auto 96px; align-items: center; gap: 4px 14px; padding: 12px 16px; }
  .inventory-panel.is-selecting .medicine-select { grid-column: 1; grid-row: 1; align-self: center; padding: 0; }
  .inventory-panel.is-selecting .medicine-name-cell { grid-column: 2; grid-row: 1; }
  .inventory-panel.is-selecting .expiry-cell { grid-column: 3; grid-row: 1; }
  .inventory-panel.is-selecting .stock-cell { grid-column: 4; grid-row: 1; }
  .inventory-panel.is-selecting .expiry-cell strong { white-space: nowrap; }
  .inventory-panel.is-selecting .status-cell { display: none; }
  .inventory-panel.is-selecting .medicine-meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 4px; }
  .inventory-panel.is-selecting .mobile-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
  .inventory-panel.is-selecting .mobile-status .cell-caption { display: none; }
  .inventory-panel.is-selecting :is(.expiry-cell, .stock-cell) { display: grid; gap: 2px; justify-items: start; padding: 0; }
}

/* Móvil en horizontal: el menú lateral es más alto que la pantalla, así que se desplaza. */
@media (min-width: 621px) and (max-height: 520px) {
  .sidebar { overflow-y: auto; overscroll-behavior: contain; padding-block: 14px; }
}

/* ---------- Usuarios: «Editar» en cada tarjeta ---------- */
.care-profile-heading { position: relative; }
.edit-profile-button {
  position: absolute; top: 0; right: 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 44px; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px;
  color: var(--teal); background: var(--paper); font: inherit; font-size: 15px; font-weight: 800; cursor: pointer;
}
.edit-profile-button:hover { border-color: var(--teal); }
.edit-profile-button:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.care-profile-heading:has(.edit-profile-button) .care-profile-identity strong { padding-right: 104px; }
html[data-theme="dark"] .edit-profile-button { color: #7fe0d2; border-color: #526a88; background: #2c3035; }
@media (max-width: 360px) {
  .edit-profile-button { width: 44px; padding: 0; }
  .edit-profile-button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .care-profile-heading:has(.edit-profile-button) .care-profile-identity strong { padding-right: 52px; }
}

/* ---------- Inventario: selección siempre visible; «Eliminar» solo con algo marcado ---------- */
.inventory-bulk-bar .delete-selected-button[hidden] { display: none; }

/* ---------- Añadir unidades: aviso cuando el medicamento escaneado ya está en el botiquín ---------- */
.lot-dialog-notice { margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--teal); border-radius: 12px; color: var(--ink); background: var(--teal-soft); font-size: 15px; font-weight: 600; line-height: 1.4; }
.lot-dialog-notice[hidden] { display: none; }
html[data-theme="dark"] .lot-dialog-notice { color: #e5edfb; background: #1d3b3d; border-color: #2f8f86; }

/* ==========================================================================
   Tema gris moderno: superficies grafito (sin verdes) y texto con buen contraste.
   Los colores verdes y azul marino de las superficies se convirtieron a gris en
   styles.css / stitch-theme.css; aquí se fija el color del texto que heredaba
   tonos pensados para el fondo claro y el turquesa de las acciones principales.
   ========================================================================== */
html[data-theme="dark"] {
  --ink: #f1f3f5;
  --muted: #b4bcc6;
  --teal-strong: #0f766e;
}
html[data-theme="dark"] :is(#cima-search-title, #medicine-fields-title, .manual-entry-summary strong, .essential-toggle strong,
  .lot-details-heading strong, .expiry-cell strong, .medicine-title, .initial-stock-fields h3, .cima-search strong,
  .lot-detail-batch strong, .lot-detail-quantity strong, .stock-cell strong, .treatment-card h2, .care-profile-identity strong) { color: var(--ink) !important; }
html[data-theme="dark"] :is(.manual-entry-summary small, .essential-toggle small, .lot-details-heading span, .medicine-format,
  .cell-caption, .expiry-hint, .lot-detail-batch small, .lot-detail-expiry, .initial-stock-fields p) { color: var(--muted) !important; }
html[data-theme="dark"] .nav-link:not(.active), html[data-theme="dark"] .nav-link:not(.active) .nav-text,
html[data-theme="dark"] #refresh-button { color: #c3cad3 !important; }
html[data-theme="dark"] .calendar-view-toggle { color: #5eead4; }
/* Turquesa más profundo en las acciones principales para que el texto blanco se lea bien. */
html[data-theme="dark"] .button-primary { color: #fff; background: var(--teal-strong); border-color: var(--teal-strong); }
html[data-theme="dark"] .button-primary:hover { background: #115e59; border-color: #115e59; }
.nav-link:not(.active), .nav-link:not(.active) .nav-text, #refresh-button { color: #4b5563; }
/* Día elegido del calendario: acento turquesa (antes un fondo claro que en oscuro dejaba el número ilegible). */
.calendar-day.is-selected { border-color: var(--teal); background: var(--teal-soft); box-shadow: inset 0 0 0 1px var(--teal); }
html[data-theme="dark"] .calendar-day.is-selected { border-color: #2dd4bf; background: var(--teal-strong); box-shadow: inset 0 0 0 1px #2dd4bf; }
html[data-theme="dark"] .calendar-day.is-selected :is(strong, .calendar-day-meta) { color: #fff; }
html[data-theme="dark"] .text-button { color: #c3cad3; }
html[data-theme="dark"] .calendar-day.is-today strong { color: #fff; background: var(--teal-strong); box-shadow: 0 0 0 1px #2dd4bf; }
html[data-theme="dark"] .select-all-medicines, html[data-theme="dark"] .select-all-medicines span { color: var(--ink); }

/* «Escanear con la cámara»: naranja suave (coral) para que destaque sobre el panel gris. */
#scan-code-button.scan-button, html[data-theme="dark"] #scan-code-button.scan-button {
  border-color: #e8875a; color: #3a1706; background: #f59f72; box-shadow: 0 6px 16px rgb(232 135 90 / 0.28);
}
#scan-code-button.scan-button:hover:not(:disabled), html[data-theme="dark"] #scan-code-button.scan-button:hover:not(:disabled) { border-color: #dc7444; background: #f28d5c; }
#scan-code-button.scan-button:focus-visible { outline: 3px solid #f59f72; outline-offset: 3px; }
#scan-code-button.scan-button:disabled { opacity: .65; box-shadow: none; }

html[data-theme="dark"] #calendar-profile-label { color: var(--muted); }

/* Acciones principales en el verde turquesa de la app (texto blanco legible). */
html body .button-primary { border-color: var(--teal); color: #fff; background: var(--teal); }
html body .button-primary:hover:not(:disabled) { border-color: #00544d; background: #00544d; }
html[data-theme="dark"] body .button-primary { border-color: var(--teal-strong); color: #fff; background: var(--teal-strong); }
html[data-theme="dark"] body .button-primary:hover:not(:disabled) { border-color: #115e59; background: #115e59; }

/* Botones secundarios (antes verde militar o gris sobre gris): azul discreto a juego con el fondo.
   Los colores salen de variables por tema; la lista de botones aparece una sola vez.
   html[data-theme] siempre existe (lo fija el script del <head>) y da la especificidad necesaria. */
:root {
  --secondary-bg: #eaf0f8; --secondary-border: #c3d0e2; --secondary-ink: #1f3550;
  --secondary-bg-hover: #dde6f2; --secondary-border-hover: #9fb3cf;
}
html[data-theme="dark"] {
  --secondary-bg: #243450; --secondary-border: #3f5578; --secondary-ink: #dbe6f5;
  --secondary-bg-hover: #2c3f5f; --secondary-border-hover: #56709a;
}
html[data-theme] body :is(.button-secondary, .icon-button.close-button, .lot-action:not(.lot-remove-action), .edit-profile-button, .remove-profile-button,
  .person-picker-button, .calendar-nav-button, .calendar-today-button, .calendar-profile-trigger) {
  border-color: var(--secondary-border); color: var(--secondary-ink); background: var(--secondary-bg);
}
html[data-theme] body :is(.button-secondary, .icon-button.close-button, .lot-action:not(.lot-remove-action), .edit-profile-button, .remove-profile-button,
  .person-picker-button, .calendar-nav-button, .calendar-today-button, .calendar-profile-trigger):hover:not(:disabled) {
  border-color: var(--secondary-border-hover); background: var(--secondary-bg-hover);
}
html body :is(.edit-profile-button, .person-picker-button) svg { color: inherit; }

/* Naranja solo en «Escanear con la cámara» y «Exportar calendario». */
html body #export-calendar-from-calendar, html[data-theme="dark"] body #export-calendar-from-calendar {
  border-color: #e8875a; color: #3a1706; background: #f59f72; box-shadow: 0 6px 16px rgb(232 135 90 / 0.28);
}
html body #export-calendar-from-calendar:hover:not(:disabled), html[data-theme="dark"] body #export-calendar-from-calendar:hover:not(:disabled) { border-color: #dc7444; background: #f28d5c; }

/* Aviso (toast) en la capa superior: se ve también encima de los diálogos abiertos. */
#toast[popover] { inset: auto 22px 22px auto; margin: 0; overflow: visible; border: 0; max-width: min(420px, calc(100vw - 24px)); }
#toast[popover]:not(:popover-open) { display: none; }
@media (max-width: 620px) {
  #toast[popover] { inset: auto 12px calc(68px + env(safe-area-inset-bottom)) 12px; max-width: none; }
}

/* ==========================================================================
   Pantalla de inicio de la cuenta: cabecera turquesa con el logo (propuesta B) y,
   debajo, lista compacta de botiquines, «＋ Añadir botiquín», enlaces de cuenta y el
   aviso del simulador al final (propuesta A). Ocupa justo la pantalla del móvil.
   ========================================================================== */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.auth-card.is-account { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.auth-card.is-account .auth-hero {
  display: grid; justify-items: center; gap: 6px; padding: 30px 20px 24px; color: #fff; background: #0f766e; text-align: center;
}
.auth-card.is-account .auth-brand { display: grid; justify-items: center; gap: 8px; margin: 0; color: #fff; font-size: 32px; font-weight: 800; letter-spacing: -.02em; }
.auth-card.is-account .auth-brand .brand-mark { width: 72px; height: 72px; border-radius: 20px; background: #fff; transform: rotate(-6deg); box-shadow: 0 10px 24px rgb(4 52 44 / .35); }
.auth-card.is-account .auth-brand .brand-mark span:first-child { top: 12px; left: 30px; width: 12px; height: 48px; border-radius: 6px; background: #0f766e; }
.auth-card.is-account .auth-brand .brand-mark span:last-child { top: 30px; left: 12px; width: 48px; height: 12px; border-radius: 6px; background: #0f766e; }
.auth-card.is-account .auth-hero .eyebrow { display: none; }
.auth-card.is-account #auth-title { margin: 4px 0 0; color: #f2fffc; font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.auth-card.is-account .auth-intro { margin: 0; color: #c9f3ec; font-size: 14px; }
html[data-theme="dark"] .auth-card.is-account :is(.auth-hero, .auth-hero *) { color: inherit; }
html[data-theme="dark"] .auth-card.is-account .auth-hero { color: #fff; background: #0f766e; }
html[data-theme="dark"] .auth-card.is-account #auth-title { color: #f2fffc; }
html[data-theme="dark"] .auth-card.is-account .auth-intro { color: #c9f3ec; }
.auth-card.is-account > .auth-message:empty { display: none; }
.auth-card.is-account .auth-session { display: grid; gap: 14px; margin: 0; padding: 20px 20px 0; border: 0; background: transparent; box-shadow: none; }
.auth-card.is-account .botiquin-management { margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; }
.auth-card.is-account #botiquin-management-title { margin: 0 0 10px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.auth-card.is-account #botiquin-message:empty { display: none; }
.auth-card.is-account #botiquin-list { display: grid; gap: 8px; margin: 0; }
.auth-card.is-account #botiquin-list[hidden] { display: none; }
.auth-card.is-account #botiquin-list li { min-height: 0; padding: 0; border: 0; border-radius: 12px; background: transparent; box-shadow: none; }
.auth-card.is-account .botiquin-choice {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%;
  min-height: 52px; padding: 8px 14px 8px 10px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--paper);
}
.auth-card.is-account .botiquin-choice:hover { border-color: var(--teal); }
.auth-card.is-account .botiquin-choice-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: var(--teal); background: var(--teal-soft); font-size: 16px; font-weight: 800; }
.auth-card.is-account .botiquin-choice-name { min-width: 0; overflow: hidden; color: var(--ink); font-size: 17px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.auth-card.is-account .botiquin-choice-go { color: var(--teal); font-size: 26px; font-weight: 700; line-height: 1; }
html[data-theme="dark"] .auth-card.is-account .botiquin-choice-mark, html[data-theme="dark"] .auth-card.is-account .botiquin-choice-go { color: #7fe0d2; }
.add-botiquin-button { display: inline-flex; align-items: center; gap: 12px; min-height: 48px; margin-top: 12px; padding: 0; border: 0; color: var(--ink); background: transparent; font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; }
.add-botiquin-plus { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: #fff; background: #0f766e; font-size: 24px; line-height: 1; box-shadow: 0 6px 14px rgb(15 118 110 / .3); }
.add-botiquin-button[aria-expanded="true"] .add-botiquin-plus { transform: rotate(45deg); }
.add-botiquin-button:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; border-radius: 999px; }
.auth-card.is-account .create-botiquin-form { display: grid; gap: 6px; margin: 10px 0 0; padding: 0; border: 0; background: transparent; box-shadow: none; }
.auth-card.is-account .create-botiquin-form[hidden] { display: none; }
.create-botiquin-row { display: flex; gap: 8px; }
.auth-card.is-account .create-botiquin-row input { flex: 1 1 auto; min-width: 0; height: 48px; margin: 0; }
.auth-card.is-account .create-botiquin-row .button { height: 48px; min-height: 48px; padding-inline: 18px; }
.account-links { display: flex; justify-content: center; gap: 18px; }
.auth-card.is-account .account-links .text-button { min-height: 44px; padding: 0 4px; color: var(--muted); font-size: 14px; font-weight: 600; }
.auth-card.is-account .auth-password-form { margin: 0; }
.auth-card.is-account .local-simulator-note {
  margin: auto 20px calc(16px + env(safe-area-inset-bottom)); padding: 6px 14px; border-radius: 999px; font-size: 13px;
}
.auth-card.is-account .local-simulator-note[open] { border-radius: 14px; }
.auth-card.is-account .local-simulator-note summary { min-height: 24px; font-size: 13px; }
.auth-card.is-account .local-simulator-note p { font-size: 13px; }
@media (max-width: 620px) {
  .auth-card.is-account { padding: 0; }
  .auth-card.is-account .auth-hero { padding-top: calc(30px + env(safe-area-inset-top)); }
}
@media (min-width: 621px) {
  .auth-card.is-account { min-height: min(720px, calc(100vh - 48px)); }
}
.auth-card.is-account .account-links { align-items: center; }
.auth-card.is-account .account-links .text-button { display: inline-flex; align-items: center; height: 44px; margin: 0; }
/* «Información del simulador local» centrado dentro de la píldora (con su triángulo). */
.auth-card.is-account .local-simulator-note summary { text-align: center; list-style-position: inside; }

/* Selección: solo la casilla y, justo a su lado, el estado en gris («Ningún medicamento seleccionado»). */
.inventory-panel .inventory-bulk-bar:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 8px 12px; }
.inventory-panel .inventory-bulk-bar .select-all-medicines { min-height: 44px; min-width: 44px; justify-content: center; }
.inventory-panel .inventory-bulk-bar .selection-status { flex: 1 1 auto; margin: 0; text-align: left; }
.inventory-panel .inventory-bulk-bar .delete-selected-button { flex: 1 0 100%; }
@media (min-width: 621px) {
  .inventory-panel .inventory-bulk-bar .delete-selected-button { flex: 0 0 auto; margin-left: auto; }
}

/* Usuarios: «Editar» solo con el lápiz y botones de la tarjeta algo más pequeños. */
html body .edit-profile-button { width: 44px; min-width: 44px; padding: 0; }
.edit-profile-button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.care-profile-heading:has(.edit-profile-button) .care-profile-identity strong { padding-right: 52px; }
.care-profile-card :is(.profile-open-button, .remove-profile-button) { min-height: 42px !important; height: 42px; padding-block: 0 !important; font-size: 14px !important; }

/* «Tratamientos» con el número en una insignia turquesa (gris si es 0). */
.care-profile-card .profile-open-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
.treatment-count-badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; color: #fff; background: #0f766e; font-size: 13px; font-weight: 800; line-height: 1; }
.treatment-count-badge.is-zero { color: #526477; background: #e3e8ef; }
html[data-theme="dark"] .treatment-count-badge { color: #fff; background: #0f766e; box-shadow: inset 0 0 0 1px #2dd4bf; }
html[data-theme="dark"] .treatment-count-badge.is-zero { color: #b5c3d7; background: #3a4a63; }
@media (max-width: 360px) {
  .care-profile-card :is(.profile-open-button, .remove-profile-button) { padding-inline: 6px !important; font-size: 13px !important; white-space: nowrap; }
  .care-profile-card .profile-open-button { gap: 6px; }
  .treatment-count-badge { min-width: 20px; height: 20px; padding: 0 6px; font-size: 12px; }
}

/* ==========================================================================
   Inventario: tarjetas compactas. Nombre principal realzado; a la derecha la cantidad con
   el icono de estado y debajo la caducidad. Un toque abre las opciones; una pulsación larga
   (o «⋯ → Seleccionar varios») activa la selección.
   ========================================================================== */
#inventory-list { display: grid; gap: 8px; padding: 10px 12px 4px; }
#inventory-list .medicine-row.medicine-card {
  display: block; min-height: 0; margin: 0; padding: 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: none;
}
.medicine-summary {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  width: 100%; min-height: 64px; padding: 10px 12px; border: 0; border-radius: 14px; color: inherit; background: transparent;
  font: inherit; text-align: left; cursor: pointer; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
}
.medicine-summary:focus-visible { outline: 3px solid var(--teal); outline-offset: -3px; }
#inventory-list .medicine-card .medicine-symbol { display: grid; place-items: center; width: 36px; height: 36px; margin: 0; border-radius: 10px; font-size: 16px; }
.medicine-main { display: grid; grid-template-columns: minmax(0, auto) auto; justify-content: start; align-items: center; column-gap: 6px; row-gap: 2px; min-width: 0; }
#inventory-list .medicine-card .medicine-title { min-width: 0; overflow: hidden; color: var(--ink); font-size: 18px; font-weight: 800; line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.medicine-essential { color: var(--info, #3b5bdb); font-size: 13px; }
#inventory-list .medicine-card .medicine-format { grid-column: 1 / -1; min-width: 0; overflow: hidden; color: var(--muted); font-size: 12.5px; font-weight: 500; line-height: 1.3; text-overflow: ellipsis; text-transform: none; white-space: nowrap; }
.medicine-stock { display: grid; justify-items: end; gap: 3px; text-align: right; }
.medicine-quantity { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.medicine-quantity strong { color: var(--ink); font-size: 18px; font-weight: 800; line-height: 1; }
.medicine-quantity small { color: var(--muted); font-size: 11px; font-weight: 700; }
.medicine-status-icon { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-left: 2px; border-radius: 50%; font-size: 12px; font-weight: 800; line-height: 1; }
.status-ok .medicine-status-icon { color: #006b62; background: #dcf7f1; }
.status-danger .medicine-status-icon { color: #a32d2d; background: #fde3e3; }
.status-expiring .medicine-status-icon { color: #854f0b; background: #fdebd3; }
.medicine-expiry { color: var(--muted); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.status-expiring .medicine-expiry { color: #9a5b0c; }
html[data-theme="dark"] .status-ok .medicine-status-icon { color: #7fe0d2; background: #12403b; }
html[data-theme="dark"] .status-danger .medicine-status-icon { color: #ffb4b8; background: #4c1d23; }
html[data-theme="dark"] .status-expiring .medicine-status-icon { color: #ffc56b; background: #4a3210; }
html[data-theme="dark"] .status-expiring .medicine-expiry { color: #ffc56b; }
.medicine-options { display: flex; gap: 8px; padding: 0 12px 12px; }
.medicine-options[hidden] { display: none; }
.medicine-options .button { flex: 1 1 0; justify-content: center; min-height: 40px; padding-inline: 10px; font-size: 14px; text-decoration: none; }
.medicine-options .medicine-name-button small { font-size: 14px; }
#inventory-list .medicine-card.is-open { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal); }
#inventory-list .medicine-card.is-selected { border-color: var(--teal); background: var(--teal-soft); box-shadow: 0 0 0 1px var(--teal); }
#inventory-list .medicine-card.is-selected .medicine-symbol { color: #fff; background: #0f766e; border-radius: 50%; font-weight: 800; }
.inventory-select-hint { margin: 2px 12px 8px; color: var(--muted); font-size: 12px; text-align: center; }
.inventory-select-hint[hidden] { display: none; }
.inventory-search-row[hidden] { display: none !important; }
/* Barra de selección en lugar del buscador. */
.inventory-panel #inventory-bulk-bar:not([hidden]) {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 10px; margin: 12px 12px 10px; padding: 6px 6px 6px 8px;
  border: 0; border-radius: 12px; color: #fff; background: #10253b;
}
.inventory-panel #inventory-bulk-bar .inventory-select-cancel { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; color: #fff; background: transparent; font-size: 24px; cursor: pointer; }
.inventory-panel #inventory-bulk-bar .selection-status { flex: 1 1 auto; margin: 0; color: #fff; font-size: 15px; font-weight: 700; text-align: left; }
.inventory-panel #inventory-bulk-bar .delete-selected-button { flex: 0 0 auto; min-height: 40px; margin: 0; padding-inline: 14px; border: 0; color: #a32d2d; background: #ffdede; font-size: 14px; font-weight: 800; }
.inventory-panel #inventory-bulk-bar .delete-selected-button:disabled { opacity: .55; }
html[data-theme="dark"] .inventory-panel #inventory-bulk-bar:not([hidden]) { background: #0b1220; border: 1px solid #34445a; }
#inventory-list .medicine-card .medicine-summary > .medicine-symbol { grid-column: 1; grid-row: 1; align-self: center; }
#inventory-list .medicine-card .medicine-summary > .medicine-main { grid-column: 2; grid-row: 1; }
#inventory-list .medicine-card .medicine-summary > .medicine-stock { grid-column: 3; grid-row: 1; }
#inventory-list .medicine-card .medicine-options .leaflet-link { padding-inline: 10px; }
#inventory-list .medicine-card .medicine-main { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; row-gap: 2px; min-width: 0; }
#inventory-list .medicine-card .medicine-title { flex: 0 1 auto; max-width: 100%; }
#inventory-list .medicine-card .medicine-essential { flex: 0 0 auto; }
#inventory-list .medicine-card .medicine-format { flex: 1 0 100%; max-width: 100%; }
#inventory-list .medicine-card .medicine-options .medicine-name-button small { padding: 0; border: 0; border-radius: 0; color: inherit; background: none; box-shadow: none; }
/* Letra más contenida: el nombre principal en negrita cabe entero (hasta dos líneas). */
#inventory-list .medicine-card .medicine-summary { grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; padding: 9px 12px; }
#inventory-list .medicine-card .medicine-symbol { width: 32px; height: 32px; font-size: 14px; }
#inventory-list .medicine-card .medicine-title { font-size: 15px; font-weight: 800; line-height: 1.25; white-space: normal; overflow-wrap: anywhere; }
/* Solo la tarjeta cerrada recorta el nombre a dos líneas; la abierta no hereda ningún recorte. */
#inventory-list .medicine-card:not(.is-open) .medicine-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
#inventory-list .medicine-card .medicine-format { font-size: 12px; }
#inventory-list .medicine-card .medicine-quantity strong { font-size: 16px; }
#inventory-list .medicine-card .medicine-quantity small { font-size: 11px; }
#inventory-list .medicine-card .medicine-status-icon { width: 18px; height: 18px; font-size: 11px; }
#inventory-list .medicine-card .medicine-expiry { font-size: 11px; }

/* ==========================================================================
   Usuarios: tarjetas compactas. Un toque muestra la información (Tratamientos, Editar,
   cuidadores); una pulsación larga selecciona para eliminar uno o varios.
   ========================================================================== */
#profile-management-list { display: grid; gap: 8px; }
#profile-management-list .care-profile-card { display: block; min-height: 0; margin: 0; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: none; }
.care-profile-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 12px; }
#profile-management-list .care-profile-row .profile-avatar-button { flex: 0 0 44px; width: 44px; height: 44px; margin: 0; }
.care-profile-check { display: grid; flex: 0 0 44px; place-items: center; width: 44px; height: 44px; overflow: hidden; border-radius: 50%; color: #fff; font-size: 20px; font-weight: 800; cursor: pointer; }
.care-profile-check .avatar-art, .care-profile-check svg, .care-profile-check img { width: 100%; height: 100%; }
.is-selected .care-profile-check { background: #0f766e; }
.care-profile-summary {
  display: grid; flex: 1 1 auto; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; min-width: 0; min-height: 48px;
  padding: 0; border: 0; color: inherit; background: transparent; font: inherit; text-align: left; cursor: pointer;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
}
.care-profile-summary:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 10px; }
#profile-management-list .care-profile-identity { display: grid; gap: 2px; min-width: 0; }
#profile-management-list .care-profile-identity .care-profile-name { grid-column: auto; grid-row: auto; margin: 0; padding: 0; overflow: hidden; color: var(--ink); font-size: 15px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.care-profile-sub { color: var(--muted); font-size: 12px; font-weight: 600; }
.care-profile-details { display: grid; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.care-profile-details[hidden] { display: none; }
.care-profile-actions { display: flex; gap: 8px; }
#profile-management-list .care-profile-actions .button { flex: 1 1 0; justify-content: center; min-height: 44px !important; height: 44px; padding: 0 10px !important; font-size: 14px !important; }
#profile-management-list .care-profile-actions .edit-profile-button { position: static; display: inline-flex; align-items: center; gap: 6px; width: auto; min-width: 0; }
#profile-management-list .care-profile-actions .edit-profile-button span { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: nowrap; }
#profile-management-list .care-profile-details .profile-caregiver-list { margin: 0; padding: 0; }
#profile-management-list .care-profile-card.is-open { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal); }
#profile-management-list .care-profile-card.is-selected { border-color: var(--teal); background: var(--teal-soft); box-shadow: 0 0 0 1px var(--teal); }
.profile-management .profile-select-bar { order: 1; }
.profile-management #profile-select-hint { order: 2; margin: 0; }
.profile-select-bar:not([hidden]) {
  display: flex; align-items: center; gap: 10px; margin: 0; padding: 6px 6px 6px 8px; border-radius: 12px; color: #fff; background: #10253b;
}
.profile-select-bar[hidden], .users-list-heading[hidden] { display: none !important; }
.profile-select-bar .inventory-select-cancel { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; color: #fff; background: transparent; font-size: 24px; cursor: pointer; }
.profile-select-bar .selection-status { flex: 1 1 auto; margin: 0; color: #fff; font-size: 15px; font-weight: 700; }
.profile-select-bar .delete-selected-button { flex: 0 0 auto; min-height: 40px; margin: 0; padding-inline: 14px; border: 0; color: #a32d2d; background: #ffdede; font-size: 14px; font-weight: 800; }
.profile-select-bar .delete-selected-button:disabled { opacity: .55; }
html[data-theme="dark"] .profile-select-bar:not([hidden]) { background: #0b1220; border: 1px solid #34445a; }
#profile-select-bar .delete-selected-button { width: auto !important; min-width: 0; }
#profile-select-bar .selection-status { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#profile-select-bar .selection-status { text-align: left; }

/* ==========================================================================
   Resumen «Hoy primero»: progreso, próxima toma con acciones, resto de hoy y avisos.
   ========================================================================== */
.overview-progress { height: 8px; margin: -6px 0 18px; overflow: hidden; border-radius: 999px; background: var(--line); }
.overview-progress[hidden] { display: none; }
.overview-progress span { display: block; height: 100%; border-radius: inherit; background: #0f766e; transition: width .3s ease; }
.overview-section { margin: 0 0 18px; }
.overview-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.overview-section-heading a { color: var(--teal); font-size: 14px; font-weight: 800; text-decoration: none; }
html[data-theme="dark"] .overview-section-heading a { color: #7fe0d2; }
.overview-section-title { margin: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.overview-next-card { display: grid; gap: 4px; padding: 14px; border-radius: 16px; color: #fff; background: #0f766e; box-shadow: 0 10px 24px rgb(15 118 110 / .25); }
.overview-next-card p { margin: 0; }
.overview-next-when { font-size: 13px; opacity: .9; }
.overview-next-when strong { font-size: 15px; }
.overview-next-medicine { font-size: 19px; font-weight: 800; line-height: 1.2; }
.overview-next-user { font-size: 14px; opacity: .9; }
.overview-next-actions { display: flex; gap: 8px; margin-top: 8px; }
.overview-next-actions .button { flex: 1 1 0; justify-content: center; min-height: 44px; border-radius: 12px; font-size: 15px; font-weight: 800; }
html body .overview-next-actions .overview-confirm { border: 0; color: #0f766e; background: #fff; }
html body .overview-next-actions .overview-confirm:disabled { opacity: .6; }
html body .overview-next-actions .overview-omit { border: 1px solid rgb(255 255 255 / 0.6); color: #fff; background: transparent; }
.overview-next-note { font-size: 12px; opacity: .85; }
#overview-later, #overview-attention-list { display: grid; gap: 6px; }
.overview-later-row { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--paper); text-decoration: none; }
.overview-later-row time { font-size: 15px; font-weight: 800; }
.overview-later-row span { display: grid; min-width: 0; }
.overview-later-row strong, .overview-warning-name { overflow: hidden; color: var(--ink); font-size: 15px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.overview-later-row small, .overview-warning small { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.overview-warning { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.overview-warning-main { display: grid; flex: 1 1 auto; min-width: 0; color: inherit; text-decoration: none; }
.overview-warning .overview-add-units { flex: 0 0 auto; min-height: 36px; padding: 0 10px; font-size: 13px; }
.overview-warning .medicine-status-icon { flex: 0 0 auto; }
.overview-footer { margin: 4px 0 0; color: var(--muted); font-size: 13px; text-align: center; }
#resumen .overview-empty { padding: 12px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 14px; }

/* Buscador del inventario: sin el anillo verde al tocarlo; un borde gris azulado discreto en la caja. */
.inventory-search-row .search-box #search-input:focus, .inventory-search-row .search-box #search-input:focus-visible { border-color: transparent; outline: none; box-shadow: none; }
.inventory-search-row .search-box:focus-within { border-color: #9fb3cf; box-shadow: none; }
html[data-theme="dark"] .inventory-search-row .search-box:focus-within { border-color: #56709a; }

/* Inventario en modo oscuro: los iconos de los medicamentos recuperan sus tres tonos. */
html[data-theme="dark"] .medicine-symbol.medicine-icon-sage { color: #7fe0d2; background: #12403b; }
html[data-theme="dark"] .medicine-symbol.medicine-icon-peach { color: #f6b796; background: #4a2c20; }
html[data-theme="dark"] .medicine-symbol.medicine-icon-lavender { color: #cdbcf2; background: #362c4f; }
/* Tarjeta abierta: el nombre entero registrado, sin recortar. */
#inventory-list .medicine-card.is-open .medicine-title { display: block; height: auto; max-height: none; overflow: visible; white-space: normal; }
#inventory-list .medicine-card.is-open .medicine-summary { align-items: start; }
/* El navegador del móvil no agranda el texto por su cuenta (descuadraría las tarjetas). */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* Tratamientos: «Ver en inventario» bajo la dosis. */
.treatment-dose-block { display: grid; justify-items: stretch; gap: 8px; }
.treatment-card .treatment-inventory-button { min-height: 40px; padding-inline: 12px; font-size: 13px; white-space: nowrap; }
.treatment-inventory-missing { color: var(--muted); font-size: 12px; text-align: center; }

/* «Ver en inventario»: the medicine lands at the top with a little air. */
.medicine-row { scroll-margin-top: 16px; }
/* «Todos» in the Tratamientos user picker: the Usuarios icon, centred. */
.person-picker-avatar.person-picker-all { display: grid; place-items: center; color: var(--teal, #0f766e); }
.person-picker-avatar.person-picker-all svg { width: 22px; height: 22px; }
html[data-theme="dark"] .person-picker-avatar.person-picker-all { color: #7fe0d2; }

/* ==========================================================================
   «Puntos clave del prospecto» (ADR 0005): «i» azul información y hoja inferior.
   ========================================================================== */
.medicine-options .prospectus-info-button {
  flex: 0 0 32px; width: 32px; height: 32px; min-height: 32px; margin-left: auto; padding: 0; align-self: center;
  display: grid; place-items: center; border: 0; border-radius: 999px; cursor: pointer;
  color: #fff; background: var(--info); box-shadow: 0 2px 6px rgb(47 91 211 / 0.3);
  font: italic 800 16px/1 Georgia, "Times New Roman", serif;
}
.medicine-options .prospectus-info-button:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }
html[data-theme="dark"] .medicine-options .prospectus-info-button { color: #10213f; background: #a9bfff; box-shadow: none; }

.prospectus-dialog { width: min(560px, calc(100vw - 30px)); }
.prospectus-content { padding: 22px; }
.prospectus-content h2 { overflow-wrap: anywhere; }
.prospectus-content h2:focus { outline: none; }
.prospectus-notice { margin: 12px 0 8px; padding: 10px 12px; border-radius: 12px; color: #1f3a8a; background: var(--info-soft); font-size: 13px; line-height: 1.45; }
.prospectus-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.prospectus-link { color: var(--info); font-weight: 700; text-decoration: none; }
.prospectus-key-points { display: grid; gap: 8px; }
.prospectus-state { margin: 6px 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.prospectus-state a { color: var(--info); font-weight: 700; }
.key-point { border: 1px solid var(--line, #e3e8ee); border-radius: 14px; background: var(--surface, #fff); }
.key-point summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 10px 14px; cursor: pointer; list-style: none; }
.key-point summary::-webkit-details-marker { display: none; }
.key-point summary::after { content: ""; flex: 0 0 9px; width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); opacity: .6; }
.key-point[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.key-point-title { flex: 1 1 auto; font-weight: 800; font-size: 15px; color: var(--ink); }
.key-point summary small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.key-point-body { padding: 0 14px 12px; font-size: 14px; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.key-point-body p { margin: 0 0 8px; }
.key-point-body h4 { margin: 12px 0 4px; font-size: 14px; font-weight: 800; }
.key-point-body h4:first-child { margin-top: 2px; }
.key-point-body ul { margin: 0 0 8px; padding-left: 20px; }
.key-point-body li { margin-bottom: 4px; }
html[data-theme="dark"] .prospectus-notice { color: #dfe6ff; background: #26304a; }
html[data-theme="dark"] .prospectus-link, html[data-theme="dark"] .prospectus-state a { color: #a9bfff; }
html[data-theme="dark"] .key-point { border-color: #3a4350; background: #1f262f; }

/* On the phone the key points open as a sheet anchored to the bottom. */
@media (max-width: 620px) {
  .prospectus-dialog.lot-dialog {
    width: 100vw; max-width: 100vw; max-height: 88dvh; margin: auto 0 0; border-radius: 20px 20px 0 0; border-bottom: 0;
  }
  .prospectus-content { padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
}

/* Tratamiento: the seven weekdays always in one row, as equal circles that fit the width. */
#treatment-dialog .weekday-options { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
#treatment-dialog .weekday-options label { display: flex; justify-content: center; min-width: 0; }
#treatment-dialog .weekday-options span { width: 100%; max-width: 46px; height: auto; aspect-ratio: 1; }

/* ==========================================================================
   Tratamiento: selector propio de medicamento (botón + hoja con buscador).
   ========================================================================== */
.native-select-hidden { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; opacity: 0; pointer-events: none; overflow: hidden; }
.medicine-picker-button {
  display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; min-height: 56px; padding: 8px 12px 8px 8px;
  border: 1px solid var(--line); border-radius: var(--radius-control, 12px); color: var(--ink); background: var(--paper, #fff);
  font: inherit; text-align: left; cursor: pointer;
}
.medicine-picker-button:hover { border-color: var(--teal); }
.medicine-picker-button:focus-visible, .medicine-picker-option:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.medicine-picker-button:disabled { cursor: default; opacity: .7; }
:is(.medicine-picker-button, .medicine-picker-option) .medicine-symbol { flex: 0 0 36px; display: grid; place-items: center; width: 36px; height: 36px; margin: 0; border-radius: 10px; font-size: 16px; }
.medicine-picker-name { display: grid; flex: 1 1 auto; min-width: 0; gap: 1px; }
.medicine-picker-name strong { overflow: hidden; color: var(--ink); font-size: 15px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.medicine-picker-name small { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.medicine-picker-dialog { width: min(520px, calc(100vw - 30px)); }
.medicine-picker-content { display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: 12px; max-height: min(80dvh, 700px); padding: 20px; }
.medicine-picker-content h2 { margin: 0; }
.medicine-picker-content h2:focus { outline: none; }
.medicine-picker-search { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-control, 12px); background: var(--paper, #fff); }
.medicine-picker-search input { flex: 1 1 auto; min-width: 0; min-height: 44px; border: 0 !important; outline: 0; box-shadow: none !important; background: transparent !important; color: var(--ink); font-size: 16px; }
.medicine-picker-list { display: grid; align-content: start; gap: 6px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.medicine-picker-option {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; padding: 8px 10px 8px 8px;
  border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--paper, #fff); font: inherit; text-align: left; cursor: pointer;
}
.medicine-picker-option[aria-selected="true"] { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.medicine-picker-stock { display: flex; flex: none; align-items: baseline; gap: 3px; }
.medicine-picker-stock strong { font-size: 15px; font-weight: 800; }
.medicine-picker-stock small { color: var(--muted); font-size: 11px; font-weight: 700; }
.medicine-picker-stock .medicine-status-icon { align-self: center; }
.medicine-picker-empty { margin: 8px 2px; color: var(--muted); font-size: 14px; }

@media (max-width: 620px) {
  .medicine-picker-dialog.lot-dialog { width: 100vw; max-width: 100vw; max-height: 88dvh; margin: auto 0 0; border-radius: 20px 20px 0 0; border-bottom: 0; }
  .medicine-picker-content { max-height: 88dvh; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); }
}

/* Buscador de «Elegir medicamento»: letra grande y legible, caja de altura normal. */
#medicine-picker-dialog .medicine-picker-search { height: 52px; min-height: 52px; padding: 0 14px; gap: 10px; border-width: 1.5px; color: var(--ink); }
#medicine-picker-dialog .medicine-picker-search:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
#medicine-picker-dialog .medicine-picker-search > span { font-size: 22px; color: var(--teal); }
#medicine-picker-dialog .medicine-picker-search input { height: 100%; min-height: 0; padding: 0; font-size: 17px !important; font-weight: 600; color: var(--ink); }
#medicine-picker-dialog .medicine-picker-search input::placeholder { color: var(--muted); opacity: 1; font-size: 17px; font-weight: 500; }
html[data-theme="dark"] #medicine-picker-dialog .medicine-picker-search > span { color: #7fe0d2; }
/* The searched text, marked in each result. */
.medicine-picker-name mark { padding: 0 1px; border-radius: 3px; color: inherit; background: #fff1a8; }
html[data-theme="dark"] .medicine-picker-name mark { color: #10213f; background: #ffe17a; }
/* While searching on the phone: the sheet goes to the top and fits above the keyboard. */
@media (max-width: 620px) {
  .medicine-picker-dialog.lot-dialog.is-searching {
    margin: 8px 0 auto; border-radius: 20px; border-bottom: 1px solid var(--line);
    height: calc(var(--picker-visible-height, 100dvh) - 16px); max-height: calc(var(--picker-visible-height, 100dvh) - 16px);
  }
  .medicine-picker-dialog.is-searching .medicine-picker-content { height: 100%; max-height: 100%; padding-bottom: 12px; }
}

/* Modificar tratamiento (ADR 0006): «Modificar» encima de «Finalizar» y «Eliminar». */
.treatment-card-actions { flex-wrap: wrap; }
@media (max-width: 620px) {
  .treatment-card-actions > .treatment-edit-button { flex: 1 1 100%; }
}
.treatment-locked-hint { margin: 6px 0 0; }
:is(.person-picker-button, .medicine-picker-button):disabled { cursor: default; opacity: .75; }
:is(.person-picker-button, .medicine-picker-button):disabled .person-picker-chevron { display: none; }
