:root {
  --brand: #154275;
  --brand-dark: #0c1f33;
  --brand-rgb: 21, 66, 117;
  --navy: var(--brand);
  --navy-strong: var(--brand-dark);
  --sky: #e7efff;
  --accent: var(--brand);
  --text: #0c1b33;
  --muted: #5b6d85;
  --border: #dce3f0;
  --surface: #ffffff;
  --shadow: 0 15px 40px rgba(var(--brand-rgb), 0.12);
  --success: #12a454;
  --danger: #d64545;
  --card-grad: linear-gradient(145deg, #ffffff 0%, #eef3ff 100%);
  --rail-btn-pad-y: 50px;
  --rail-btn-pad-x: 8px;
  --rail-btn-font: 15px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at 15% 20%, #f5f8ff 0%, #ffffff 40%);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3 {
  margin: 0;
  color: var(--navy-strong);
  line-height: 1.2;
}

p {
  margin: 0;
}

.hero {
  position: relative;
  display: block;
  padding: 12px 5vw 10px;
  background: linear-gradient(120deg, var(--navy) 0%, #154275 60%, #154275 100%);
  color: #f3f7ff;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  right: 6vw;
  top: -40px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.16), transparent 60%);
  filter: blur(6px);
  pointer-events: none;
}

.hero__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.hero__top,
body.is-mobile .hero__top {
  flex-wrap: wrap;
}

.hero__logo {
  flex-shrink: 0;
}
.hero__logo {
  flex-shrink: 0;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #f8faff;
  font-size: 13px;
}

.live-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff4d4f;
  box-shadow: 0 0 0 0 rgba(255, 77, 79, 0.7);
  animation: pulse 1.6s ease-in-out infinite;
}

.live-text {
  letter-spacing: 0.4px;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 77, 79, 0.7);
    opacity: 1;
  }
  70% {
    box-shadow: 0 0 0 10px rgba(255, 77, 79, 0);
    opacity: 0.7;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 77, 79, 0);
    opacity: 1;
  }
}

.hero__content h1 {
  font-size: clamp(18px, 3vw, 24px);
  line-height: 1.15;
  margin: 2px 0;
  color: #ffffff;
}

.hero__content .subtitle {
  margin-top: 4px;
  color: #d9e4ff;
  font-size: 12px;
  max-width: 480px;
}

.hero__cta {
  margin-top: 8px;
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
}

.hero--sticky .hero__content {
  position: relative;
  min-height: 46px;
}

.hero--sticky .hero__top {
  display: flex;
  margin-bottom: 0;
  width: 100%;
  align-items: center;
  justify-content: space-between;
}

.hero--sticky .hero__content h1 {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  text-align: center;
  width: 100%;
  max-width: calc(100% - 150px);
  font-size: clamp(12px, 3.8vw, 18px);
  line-height: 1.08;
  padding: 0 10px;
}

.hero--sticky .hero__content .subtitle,
.hero--sticky .hero__cta {
  display: none;
}

.hero--sticky .hero__logo {
  justify-self: end;
}
.hero__logo {
  display: inline-block;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  line-height: 0;
  cursor: pointer;
}

.logo-image {
  display: block;
  width: clamp(70px, 10vw, 110px);
  height: clamp(35px, 5vw, 55px);
  aspect-ratio: 2 / 1;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14);
}

.logo-mark {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  background: linear-gradient(160deg, #154275 0%, #154275 100%);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 10px;
}

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.logo-name {
  font-weight: 700;
  letter-spacing: 0.4px;
  font-size: 11px;
}

.logo-tagline {
  color: #d9e4ff;
  font-size: 10px;
}

.pill {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #f3f7ff;
  font-weight: 500;
  font-size: 13px;
}

.pill--light {
  background: var(--sky);
  color: var(--navy);
}

.layout {
  max-width: 1200px;
  margin: 16px auto 0;
  padding: 0 7vw 48px;
  display: grid;
  gap: 24px;
  width: 100%;
}

.layout--summary {
  margin-top: 0;
}

body.med-mode .layout {
  max-width: none;
  width: 100%;
  margin: 8px 0 0;
  padding: 0 8px 32px 8px;
  display: block;
}

body.is-mobile .layout {
  padding-bottom: 80px;
  overflow-x: hidden;
}

body.is-mobile.med-mode .layout {
  padding-bottom: 190px;
}

body.med-mode #medicos {
  max-width: none;
  margin: 0;
  padding: 8px 4px 8px 6px;
  width: calc(100% - 220px);
  margin-right: 220px;
}

body:not(.is-mobile) #medicos {
  width: calc(100% - 220px);
  margin-right: 220px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.panel__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.panel__header > div:first-child h2 {
  margin-top: 8px;
}

.session-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 14px;
}

.form {
  margin: 18px 0;
  display: grid;
  gap: 12px;
}

.form--compact {
  margin-top: 10px;
  gap: 10px;
}

label {
  font-weight: 500;
  color: var(--navy-strong);
}

input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f9fbff;
  font-size: 15px;
  font-family: inherit;
}

textarea {
  resize: vertical;
}

.inline {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.form-actions {
  align-items: center;
  justify-content: flex-end;
}

.spacer {
  flex: 1;
}

.inline--dense {
  gap: 8px;
}

.field {
  flex: 1;
  min-width: 160px;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
  font-size: 15px;
  transition: transform 0.1s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn.primary,
.switch-btn.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 10px 20px rgba(var(--brand-rgb), 0.25);
}

#altaForm .btn.primary {
  background: var(--success);
  box-shadow: 0 12px 22px rgba(18, 164, 88, 0.32);
}

#altaForm .btn.primary:hover {
  box-shadow: 0 14px 26px rgba(18, 164, 88, 0.4);
}

.btn.ghost {
  background: transparent;
  color: #e7efff;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.switch-btn {
  background: rgba(255, 255, 255, 0.14);
  color: #e7efff;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.btn.full {
  width: 100%;
}

#doctorCancel {
  background: #eef2fb;
  color: var(--navy-strong);
  border: 1px solid var(--border);
}

.btn.outline {
  background: transparent;
  color: var(--navy-strong);
  border: 1px solid var(--border);
}

.btn.danger {
  background: var(--danger);
  color: #ffffff;
  box-shadow: 0 12px 22px rgba(214, 69, 69, 0.35);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(var(--brand-rgb), 0.25);
}

.btn:active {
  transform: translateY(0);
}

.toggle {
  background: #f1f5ff;
  border-radius: 12px;
  padding: 6px;
  display: flex;
  gap: 6px;
}

.tab {
  background: transparent;
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--navy-strong);
  font-weight: 600;
  cursor: pointer;
}

.tab.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 8px 20px rgba(var(--brand-rgb), 0.08);
}

.card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  background: linear-gradient(160deg, #ffffff 0%, #f8fbff 100%);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #eef3ff;
  color: var(--navy-strong);
  border: 1px solid var(--border);
  font-weight: 600;
}

.chip--busy {
  background: rgba(214, 69, 69, 0.1);
  border-color: rgba(214, 69, 69, 0.4);
  color: #8d1d1d;
}

.chip--free {
  background: rgba(18, 164, 88, 0.1);
  border-color: rgba(18, 164, 88, 0.3);
  color: #0f7a3e;
}

.timeline {
  margin-top: 12px;
  border-left: 3px solid var(--navy);
  padding-left: 18px;
  display: grid;
  gap: 12px;
}

.timeline__item {
  position: relative;
  padding-left: 8px;
}

.timeline__item::before {
  content: '';
  position: absolute;
  left: -23px;
  top: 2px;
  width: 18px;
  height: 18px;
  background: var(--surface);
  border: 3px solid var(--navy);
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 10px;
  color: var(--navy);
}

.timeline.editable .timeline__item::before {
  content: attr(data-step);
  background: var(--navy);
  color: #ffffff;
  width: 22px;
  height: 22px;
  border: none;
  top: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--sky);
  color: var(--navy-strong);
  font-weight: 600;
  font-size: 13px;
}

.badge__step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #154275;
  color: #ffffff;
  font-size: 11px;
  margin-right: 8px;
}

.feedback {
  min-height: 22px;
  font-weight: 500;
  color: var(--muted);
}

.feedback.success {
  color: #1c7f2a;
}

.feedback.error {
  color: #c72626;
}

.hidden {
  display: none;
}

.footer {
  text-align: center;
  padding: 18px 0 28px;
}

@media (min-width: 901px) {
  body:not(.is-mobile) .hero:not(.hero--sticky) {
    min-height: 72vh;
    display: flex;
    align-items: center;
    padding: 72px 8vw 36px;
  }

  body:not(.is-mobile) .hero:not(.hero--sticky) .hero__content {
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    text-align: center;
  }

  body:not(.is-mobile) .hero:not(.hero--sticky) .hero__top {
    position: absolute;
    top: 22px;
    left: 8vw;
    right: 8vw;
    width: calc(100% - 16vw);
    margin-bottom: 0;
    justify-content: space-between;
    align-items: center;
  }

  body:not(.is-mobile) .hero:not(.hero--sticky) .subtitle {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    max-width: 520px;
  }

  body:not(.is-mobile) .hero:not(.hero--sticky) .hero__cta {
    margin-top: 22px;
    justify-content: center;
    gap: 18px;
  }

  body:not(.is-mobile) .hero:not(.hero--sticky) .switch-btn {
    min-width: 320px;
    padding: 18px 24px;
    font-size: 16px;
  }

  body:not(.is-mobile) .footer {
    padding: 2px 0 6px;
  }

  body:not(.is-mobile) .footer .small {
    font-size: 10px;
  }
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
  z-index: 2000;
  padding: 16px;
  overflow-y: auto;
}

.modal__content {
  background: #ffffff;
  border-radius: 14px;
  padding: 20px;
  width: min(420px, 96vw);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
  max-height: 90vh;
  overflow-y: auto;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.modal__close {
  border: 1px solid var(--border);
  background: #f3f6ff;
  color: var(--navy-strong);
  border-radius: 10px;
  padding: 6px 10px;
  font-weight: 700;
  cursor: pointer;
}

.modal.hidden {
  display: none;
}

.modal__content--flow {
  width: min(640px, 96vw);
}

.modal__content--room {
  width: min(520px, 96vw);
}

.modal__content--discharge {
  width: min(560px, 96vw);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  z-index: 2100;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.toast__content {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  background: linear-gradient(140deg, #12a454 0%, #1dbf63 100%);
  color: #ffffff;
  box-shadow: 0 18px 32px rgba(18, 164, 84, 0.3);
  font-weight: 600;
}

.toast__icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.2);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.toast__text {
  max-width: min(520px, 70vw);
}

.toast__close {
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: transparent;
  color: #ffffff;
  border-radius: 10px;
  padding: 6px 10px;
  font-weight: 700;
  cursor: pointer;
}

.toast__close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.room-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.flow-grid {
  margin: 12px 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.flow-card {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(140deg, #f6f8ff 0%, #ffffff 80%);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.flow-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.flow-icon {
  min-width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(160deg, #154275, #154275);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.scene-card {
  position: relative;
  margin-top: 16px;
  padding: 22px;
  border-radius: 18px;
  background: var(--card-grad);
  border: 1px solid rgba(var(--brand-rgb), 0.08);
  box-shadow: 0 24px 60px rgba(var(--brand-rgb), 0.16);
  overflow: hidden;
}

.scene-card::after {
  content: '';
  position: absolute;
  inset: -60px auto auto 40%;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle at center, rgba(var(--brand-rgb), 0.18), transparent 60%);
  filter: blur(8px);
  pointer-events: none;
}

.scene-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.med-header {
  align-items: center;
  flex-wrap: wrap;
}

.med-heading {
  display: grid;
  gap: 6px;
}

.med-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  position: relative;
}

.nav-btn {
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--navy-strong);
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease, border 0.2s ease;
}

.nav-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(var(--brand-rgb), 0.12);
}

.nav-btn.active {
  color: #ffffff;
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 12px 24px rgba(var(--brand-rgb), 0.18);
}

.nav-btn--estado.active {
  background: var(--navy);
  border-color: var(--navy);
}

.nav-btn--alta.active {
  background: var(--success);
  border-color: var(--success);
}

.nav-btn--baja.active {
  background: var(--danger);
  border-color: var(--danger);
}

.nav-btn__icon {
  display: none;
}

.nav-btn__label {
  display: inline;
}

.doctor-badge {
  font-size: 12px;
  color: #f3f7ff;
  position: absolute;
  right: 0;
  top: -18px;
  background: transparent;
  padding: 0;
  border: none;
}

.med-layout {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  position: relative;
  width: 100%;
}

body:not(.is-mobile) #medicos .med-layout {
  width: 100%;
  margin: 0;
}

body.med-mode #medicos .med-main {
  width: 100%;
  max-width: none;
  padding: 0 12px;
}

body:not(.is-mobile) #medicos .med-main {
  padding: 0 12px;
}

body.med-mode #medicos .med-main > * {
  width: 100%;
  margin: 0;
}

body.med-mode #medicos .list-filter,
body.med-mode #medicos .patient-list {
  width: 100%;
}

.med-main {
  flex: 1;
  min-width: 0;
}

.med-nav-rail {
  width: 200px;
  flex-shrink: 0;
}

body:not(.is-mobile) .med-layout {
  padding-right: 0;
}

body:not(.is-mobile) .med-nav-rail {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  width: 180px;
}

body:not(.is-mobile) .med-nav-rail .med-actions {
  flex-direction: column;
  align-items: stretch;
  flex-wrap: nowrap;
  width: 100%;
  gap: 10px;
}

body:not(.is-mobile) .med-nav-rail .nav-btn {
  width: 100%;
  text-align: center;
  padding: var(--rail-btn-pad-y, 16px) var(--rail-btn-pad-x, 8px);
  font-size: var(--rail-btn-font, 15px);
}

body:not(.is-mobile) #medicos .med-main {
  margin-right: 0;
}

body.is-mobile.med-mode #medicos {
  width: 100%;
  margin: 0;
  padding: 14px 8px 160px;
  box-sizing: border-box;
}

body.is-mobile .med-layout {
  display: block;
  padding: 0 6vw;
}

body.is-mobile .med-main {
  width: 100%;
}

body.is-mobile .med-nav-rail {
  width: 100%;
}
@media (max-width: 900px) {
  .med-layout {
    display: block;
    padding: 0 6vw;
  }
  .med-main {
    width: 100%;
  }
  .med-nav-rail {
    width: 100%;
  }
  body.med-mode #medicos {
    width: 100%;
    margin: 0;
    padding: 14px 8px 160px;
    box-sizing: border-box;
  }
  body.med-mode .layout {
    padding-bottom: 190px;
  }
}

.orb {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #b7d4ff 0%, #154275 75%);
  box-shadow: 0 12px 30px rgba(var(--brand-rgb), 0.4);
}

.orb--blue {
  background: radial-gradient(circle at 30% 30%, #d6e6ff 0%, #154275 70%);
}

.code-display {
  margin-top: 8px;
  padding: 14px;
  border-radius: 14px;
  border: 1px dashed var(--border);
  background: #f8fbff;
  display: grid;
  gap: 8px;
}

.code-display--danger {
  border-color: rgba(214, 69, 69, 0.4);
  background: #fff5f5;
}

.code-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  background: linear-gradient(145deg, #154275 0%, #154275 60%, #154275 100%);
  color: #ffffff;
  border-radius: 14px;
  letter-spacing: 4px;
  font-weight: 700;
  font-size: 24px;
  box-shadow: 0 18px 32px rgba(var(--brand-rgb), 0.28);
  text-transform: uppercase;
}

.code-chip--danger {
  background: linear-gradient(150deg, #d64545 0%, #a31818 70%);
  box-shadow: 0 18px 32px rgba(214, 69, 69, 0.28);
}

.code-input {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  align-items: center;
}

.code-input__slot {
  width: 56px;
  height: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--navy-strong);
  text-transform: uppercase;
}

.code-input__slot:focus {
  outline: none;
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(214, 69, 69, 0.2);
}

.code-input--error .code-input__slot {
  border-color: rgba(214, 69, 69, 0.7);
  background: #fff5f5;
}
.rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 14px;
  perspective: 1200px;
}

.room-card {
  position: relative;
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(140deg, #f7faff 0%, #ffffff 80%);
  box-shadow: 0 18px 30px rgba(var(--brand-rgb), 0.12);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border 0.2s ease;
  text-align: left;
}

.room-card__glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(var(--brand-rgb), 0.12), transparent 60%);
  opacity: 0.8;
  pointer-events: none;
}

.room-card__body {
  position: relative;
  z-index: 1;
}

.room-card__title {
  margin: 6px 0 4px;
}

.room-card__state {
  margin: 0;
  font-weight: 600;
  color: var(--navy-strong);
}

.room-card--busy {
  background: linear-gradient(140deg, #fff1f1 0%, #ffe5e5 80%);
  border-color: rgba(214, 69, 69, 0.4);
  box-shadow: 0 20px 32px rgba(214, 69, 69, 0.22);
}

.room-card--busy .room-card__glow {
  background: radial-gradient(circle at 25% 25%, rgba(214, 69, 69, 0.2), transparent 70%);
}

.room-card--free {
  background: linear-gradient(150deg, #f0f7ff 0%, #ffffff 80%);
  border-color: rgba(18, 164, 88, 0.28);
  box-shadow: 0 20px 36px rgba(18, 164, 88, 0.14);
}

.room-card--free .room-card__glow {
  background: radial-gradient(circle at 25% 25%, rgba(18, 164, 88, 0.18), transparent 70%);
}

.room-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 26px 48px rgba(var(--brand-rgb), 0.2);
}

.room-detail {
  margin-top: 14px;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.room-detail__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  background: #f5f7fd;
  cursor: pointer;
  font-weight: 600;
}

.chip-btn.active {
  background: var(--accent);
  color: #ffffff;
  border-color: transparent;
}

.map-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.map-actions .btn.ghost {
  color: var(--navy-strong);
  border-color: var(--border);
  background: #f4f6fc;
}


.map-footer {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: grid;
  gap: 8px;
}

.map-footer .btn {
  max-width: 220px;
}

.med-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.list-card {
  margin-top: 10px;
}

.list-filter {
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.list-filter select,
.list-filter input {
  background: linear-gradient(135deg, #f9fbff 0%, #ffffff 70%);
  border: 1px solid #c9d4eb;
  box-shadow: 0 8px 20px rgba(var(--brand-rgb), 0.08);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--navy-strong);
  font-weight: 600;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.list-filter select:focus,
.list-filter input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.18);
}

#patientDropdownWrapper {
  width: 100%;
}

.dropdown {
  position: relative;
  width: 100%;
}

.dropdown__native {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

.dropdown__toggle {
  width: 100%;
  border-radius: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #f7faff 0%, #ffffff 70%);
  border: 1px solid #c9d4eb;
  box-shadow: 0 10px 26px rgba(var(--brand-rgb), 0.12);
  color: var(--navy-strong);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.dropdown__toggle.is-placeholder {
  color: var(--muted);
  font-weight: 600;
}

.dropdown__toggle::after {
  content: '';
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10' viewBox='0 0 16 10'%3E%3Cpath d='M2 2l6 6 6-6' stroke='%230b2f6a' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px;
  transition: transform 0.2s ease;
  opacity: 0.8;
}

.dropdown.is-open .dropdown__toggle {
  border-color: var(--accent);
  box-shadow: 0 14px 30px rgba(var(--brand-rgb), 0.18);
  transform: translateY(-1px);
}

.dropdown.is-open .dropdown__toggle::after {
  transform: rotate(-180deg);
}

.dropdown__menu {
  position: absolute;
  inset: calc(100% + 6px) 0 auto 0;
  width: 100%;
  background: #ffffff;
  border: 1px solid #c9d4eb;
  border-radius: 14px;
  box-shadow: 0 18px 32px rgba(var(--brand-rgb), 0.18);
  padding: 6px;
  display: none;
  gap: 4px;
  max-height: 260px;
  overflow-y: auto;
  z-index: 30;
}

.dropdown__menu.hidden {
  display: none !important;
}

.dropdown.is-open .dropdown__menu {
  display: grid;
}

.dropdown__option {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  color: var(--navy-strong);
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.dropdown__option:hover {
  background: linear-gradient(140deg, #e7efff 0%, #f8faff 100%);
  transform: translateX(2px);
}

.dropdown__option.is-selected {
  background: linear-gradient(140deg, #154275 0%, #154275 90%);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(var(--brand-rgb), 0.22);
}

.dropdown__option.is-disabled {
  color: var(--muted);
  cursor: not-allowed;
}

#patientDropdown {
  min-height: 48px;
  border-radius: 12px;
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10' viewBox='0 0 16 10'%3E%3Cpath d='M2 2l6 6 6-6' stroke='%230b2f6a' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px;
}

#patientDropdown option {
  padding: 10px 12px;
  font-weight: 600;
  color: var(--navy-strong);
  background: #ffffff;
}

#patientDropdown option:checked,
#patientDropdown option:hover {
  background: #e7efff;
  color: var(--navy-strong);
}

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

.patient-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.discharge-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.discharge-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.summary-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.summary-table__wrapper {
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  background: linear-gradient(145deg, #ffffff 0%, #f7f9ff 100%);
  box-shadow: var(--shadow);
  margin-top: 12px;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.summary-table th,
.summary-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid #edf1fa;
}

.summary-table tbody tr {
  position: relative;
  transition: transform 0.16s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.summary-table thead th {
  background: #f1f4fb;
  font-weight: 700;
  color: var(--navy-strong);
  font-size: 13px;
  letter-spacing: 0.02em;
}

.summary-row {
  cursor: pointer;
}

.summary-row:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--brand-rgb), 0.4);
}

.summary-table tbody tr:nth-child(even) {
  background: #fbfcff;
}

.summary-table tbody tr:hover,
.summary-table tbody tr:nth-child(even):hover {
  background: linear-gradient(90deg, rgba(var(--brand-rgb), 0.14), rgba(var(--brand-rgb), 0.06));
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15, 74, 156, 0.08);
}

.summary-table tbody tr.summary-row--active {
  background: linear-gradient(90deg, rgba(var(--brand-rgb), 0.12), rgba(45, 212, 191, 0.08));
  box-shadow: 0 16px 34px rgba(var(--brand-rgb), 0.14);
  transform: translateY(-2px);
}

.summary-table tbody tr.summary-row--active td {
  border-bottom-color: rgba(var(--brand-rgb), 0.2);
}

.summary-table tbody tr.summary-row--active .status-chip {
  box-shadow: 0 6px 16px rgba(var(--brand-rgb), 0.18);
}

.summary-table tbody tr:last-child td {
  border-bottom: none;
}

.summary-table .patient-room {
  background: rgba(12, 27, 51, 0.05);
}

.mono {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-weight: 700;
  letter-spacing: 0.08em;
}

#listMessage {
  margin: 0;
}

.list-message-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.summary-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  background: rgba(var(--brand-rgb), 0.08);
  transition: all 0.15s ease;
  cursor: pointer;
}

.summary-link:hover {
  background: rgba(var(--brand-rgb), 0.14);
}

.patient-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: linear-gradient(150deg, #ffffff 0%, #f6f8ff 100%);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.24s ease;
}

.patient-card--highlight {
  box-shadow: 0 18px 38px rgba(var(--brand-rgb), 0.22), 0 0 0 1px rgba(var(--brand-rgb), 0.14);
  transform: translateY(-2px);
}

.patient-card--highlight::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(45, 212, 191, 0.15), transparent 32%),
    radial-gradient(circle at 80% 12%, rgba(var(--brand-rgb), 0.12), transparent 38%);
  pointer-events: none;
  animation: cardPulse 1.6s ease-in-out infinite alternate;
}

@keyframes cardPulse {
  from {
    opacity: 0.6;
  }
  to {
    opacity: 0.9;
  }
}

.patient-card__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.patient-code-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  align-items: center;
  text-align: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #154275 0%, #154275 60%, #154275 100%);
  color: #f7fbff;
  box-shadow: 0 16px 36px rgba(var(--brand-rgb), 0.28);
  border: 1px solid rgba(255, 255, 255, 0.28);
  min-width: 150px;
}

.patient-code-block--compact {
  padding: 8px 10px;
  min-width: 120px;
}

.patient-code-block--compact .patient-code {
  font-size: clamp(16px, 3vw, 20px);
  letter-spacing: 0.12em;
}

.patient-code__label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}

.patient-code {
  display: block;
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: clamp(18px, 4vw, 26px);
  line-height: 1.05;
}

.patient-card__meta {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.patient-stay {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(var(--brand-rgb), 0.06);
  border: 1px dashed var(--border);
}

.stay-counter {
  margin: 2px 0;
  font-weight: 700;
  font-size: clamp(16px, 3vw, 20px);
  letter-spacing: 0.02em;
  color: var(--navy-strong);
}

.patient-state-strong {
  font-weight: 700;
  color: var(--navy-strong);
}

.patient-stay__since {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f7f9ff;
  color: var(--muted);
  font-weight: 600;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.patient-card__status-row {
  margin: 14px 0 10px;
  justify-content: flex-start;
  gap: 10px;
}

.patient-room {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: rgba(12, 27, 51, 0.05);
  color: var(--navy-strong);
  font-weight: 700;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  border: 1px solid var(--border);
  background: #eef3ff;
  color: var(--navy-strong);
}

.discharge-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  background: linear-gradient(150deg, #ffffff 0%, #f7f9ff 100%);
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border 0.2s ease;
  font-family: inherit;
  color: inherit;
  appearance: none;
}

.discharge-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 40px rgba(214, 69, 69, 0.18);
}

.discharge-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(214, 69, 69, 0.25);
}

.discharge-card--selected {
  border-color: rgba(214, 69, 69, 0.7);
  box-shadow: 0 22px 40px rgba(214, 69, 69, 0.24);
  background: linear-gradient(160deg, #fff1f1 0%, #ffe6e6 100%);
}

.discharge-card--selected .patient-code-block {
  background: linear-gradient(150deg, #d64545 0%, #a31818 90%);
  box-shadow: 0 16px 32px rgba(214, 69, 69, 0.35);
}

.discharge-card__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.discharge-card__meta {
  text-align: right;
  display: grid;
  gap: 4px;
}

.discharge-card__status {
  justify-content: flex-start;
}

.discharge-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(214, 69, 69, 0.3);
  background: rgba(214, 69, 69, 0.08);
}

.discharge-counter {
  font-weight: 700;
  letter-spacing: 0.06em;
}

.discharge-selected {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(214, 69, 69, 0.2);
  background: rgba(214, 69, 69, 0.08);
}

.discharge-selected__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.discharge-selected__title {
  font-weight: 700;
  color: #8d1d1d;
}

.discharge-selected__code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #8d1d1d;
  font-size: 18px;
}

.discharge-selected__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.discharge-selected__meta span {
  border-radius: 10px;
  border: 1px solid rgba(214, 69, 69, 0.2);
  padding: 4px 8px;
  background: #ffffff;
  color: #6f1d1d;
  font-weight: 600;
  font-size: 12px;
}

.status--entra {
  background: #e6f0ff;
  border-color: #c6dcff;
  color: #154275;
}

.status--prep-quirofano {
  background: #f3e8ff;
  border-color: #e1cbff;
  color: #6b21a8;
}

.status--entrada-quirofano {
  background: #e0ecff;
  border-color: #bfd5ff;
  color: #154275;
}

.status--despertar {
  background: #e0f7f1;
  border-color: #bdeade;
  color: #0f7a5f;
}

.status--prep-hospital {
  background: #fff4e5;
  border-color: #ffd8a8;
  color: #b45309;
}

.status--prep-alta {
  background: #e7f8e9;
  border-color: #c8eed0;
  color: #15803d;
}

.status--en-espera {
  background: #fff4e0;
  border-color: #ffd8a6;
  color: #b76a00;
}

.status--en-operacion {
  background: #ffe6ef;
  border-color: #f7b0ca;
  color: #a12050;
}

.status--sale {
  background: #e9fbf0;
  border-color: #b9f0cc;
  color: #0f7a3e;
}

.status--libre,
.status--sin-estado {
  background: #f3f4f7;
  border-color: #e2e6ef;
  color: var(--muted);
}

.patient-inline-form {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.patient-inline-form .inline {
  align-items: flex-start;
}

.delete-step {
  margin-top: 8px;
  border: 1px solid var(--border);
  background: #fff5f5;
  color: var(--danger);
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

.delete-step:hover {
  background: #ffeaea;
}

body.is-mobile .patient-chips {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.patient-chips {
  display: none;
}

.patient-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  background: #f3f6ff;
  font-weight: 600;
  color: var(--navy-strong);
  cursor: pointer;
  white-space: nowrap;
}

.patient-chip.active {
  background: var(--accent);
  color: #ffffff;
  border-color: transparent;
}

@media (max-width: 720px) {
  .patient-chips {
    display: flex;
  }
}

@media (max-width: 720px) {
  .hero {
    padding: 22px 6vw 14px;
  }
  .hero__top {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .layout {
    padding: 0 6vw 36px;
    margin-top: 16px;
    padding-bottom: 120px;
  }
  .inline {
    flex-direction: column;
  }
  .panel__header {
    align-items: flex-start;
  }
  .hero__cta {
    flex-wrap: wrap;
  }
  .scene-card__header {
    flex-direction: column;
    align-items: flex-start;
  }
  .rooms-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
  .list-filter {
    align-items: stretch;
  }
  .patient-card__meta {
    text-align: left;
    align-items: flex-start;
  }
  .patient-code-block {
    width: 100%;
  }
  .panel {
    padding: 18px;
  }
  .scene-card {
    padding: 18px;
  }
  .hero__cta {
    width: 100%;
  }
  .switch-btn {
    flex: 1 1 100%;
    text-align: center;
  }
  .summary-toolbar {
    justify-content: flex-start;
  }
  .med-header {
    gap: 10px;
  }
  .med-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .list-filter {
    flex-direction: column;
    gap: 12px;
  }
  .filter-actions {
    width: 100%;
  }
  .filter-actions .btn {
    flex: 1;
  }
  .patient-card {
    padding: 12px;
  }
  .patient-card__header {
    flex-direction: column;
    align-items: flex-start;
  }
  .patient-stay {
    flex-direction: column;
    align-items: flex-start;
  }
  .discharge-card__meta {
    text-align: left;
  }
  .discharge-card__footer {
    flex-direction: column;
    align-items: flex-start;
  }
  .patient-card__status-row,
  .status-row {
    gap: 6px;
    justify-content: flex-start;
  }
  .med-layout {
    display: block;
  }
  .med-nav-rail {
    width: 100%;
  }
}

@media (max-width: 540px) {
  .hero {
    padding-top: 18px;
  }
  .hero__top {
    flex-wrap: nowrap;
    gap: 8px;
  }
  .hero__logo {
    transform: scale(0.9);
  }
  .logo-image {
    width: clamp(60px, 35vw, 90px);
    height: clamp(30px, 18vw, 45px);
  }
  .logo-mark {
    width: 14px;
    height: 14px;
    font-size: 9px;
  }
  .logo-name {
    font-size: 10px;
  }
  .logo-tagline {
    font-size: 9px;
  }
  .live-indicator {
    font-size: 13px;
    gap: 6px;
  }
  .hero__content h1 {
    font-size: clamp(12px, 5vw, 16px);
    line-height: 1.12;
  }
  .panel__header h2 {
    font-size: 18px;
  }
  .btn,
  .nav-btn {
    width: 100%;
  }
  .filter-actions {
    flex-direction: column;
  }
}

@media (max-width: 400px) {
  .hero__content h1 {
    font-size: clamp(9px, 5.6vw, 13px);
    line-height: 1.08;
  }
}

@media (max-width: 360px) {
  .hero__content h1 {
    font-size: clamp(8px, 6vw, 12px);
    line-height: 1.06;
  }
}

@media (max-width: 320px) {
  .hero__content h1 {
    font-size: clamp(7px, 6.6vw, 11px);
    line-height: 1.05;
  }
}

body.is-mobile .hero.hero--sticky .logo-image {
  width: clamp(58px, 22vw, 78px);
  height: clamp(28px, 11vw, 40px);
}

body.is-mobile .hero.hero--sticky .hero__content h1 {
  font-size: clamp(11px, 4.2vw, 14px);
  line-height: 1.08;
}

body.is-mobile .modal {
  place-items: start;
  align-items: flex-start;
  padding-top: 8vh;
}

body.is-mobile .modal__content {
  width: min(520px, 94vw);
  margin: 0 auto 16px;
  padding: 16px;
}
.hero--sticky {
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Mobile-only bottom nav bar */
@media (max-width: 900px) {
  /* Fuerza el rail y botones a barra inferior en pantallas pequeñas, incluso si falla la clase is-mobile */
  .med-nav-rail {
    position: fixed !important;
    inset: auto 0 0 0;
    width: 100vw !important;
    max-width: 100vw;
    z-index: 220;
    padding: 0;
    background: transparent;
    top: auto !important;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none !important;
    pointer-events: none;
  }

  .med-layout {
    padding: 0 5vw;
  }

  body.med-mode #medicos,
  body.med-mode .layout {
    padding-bottom: 240px;
  }

  .med-actions {
    position: fixed !important;
    inset: auto 0 0 0;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    display: flex;
    flex-direction: row !important;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0));
    background: linear-gradient(120deg, var(--navy) 0%, #154275 60%, #154275 100%);
    border: none;
    border-radius: 0;
    box-shadow: 0 -10px 26px rgba(0, 0, 0, 0.24);
    z-index: 240;
    backdrop-filter: blur(10px);
    pointer-events: auto;
  }

  .med-actions::before {
    display: none;
  }

  .med-actions .nav-btn {
    flex: 1 1 0;
    max-width: none;
    width: auto !important;
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #e7efff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 3px 8px !important;
    font-size: 10px !important;
    font-weight: 700;
    box-shadow: none;
    border-radius: 10px;
    height: 39px !important;
    min-height: 26px;
    max-height: 40px;
    line-height: 1.1;
    text-align: center;
  }

  .med-actions .nav-btn__icon {
    display: none;
  }

  .med-actions .nav-btn__label {
    display: block;
    text-align: center;
    width: 100%;
    font-size: 10px;
    line-height: 1.1;
  }

  .med-actions .nav-btn.active {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    transform: translateY(-1px);
  }

  /* Orden movil: Alta - Estado - Baja */
  #navAlta {
    order: 1;
  }

  #navEstado {
    order: 2;
  }

  #navBaja {
    order: 3;
  }
}

/* Mobile Landing Page Optimization */
@media (max-width: 900px) {
  /* Transform hero into a full Landing Page when not sticky */
  body.is-mobile .hero:not(.hero--sticky) {
    min-height: 85vh; /* Occupy most of the screen height */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px 24px;
    box-sizing: border-box;
  }

  body.is-mobile .hero:not(.hero--sticky) .hero__content {
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  /* Reorder Logo to be on top of Live Indicator */
  body.is-mobile .hero:not(.hero--sticky) .hero__top {
    width: 100%;
    flex-direction: column-reverse;
    gap: 20px;
    margin-bottom: 30px;
    justify-content: center;
  }

  /* Enlarge Logo */
  body.is-mobile .hero:not(.hero--sticky) .logo-image {
    width: 150px;
    height: auto;
    aspect-ratio: 2/1;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  }

  /* Make title bigger and more readable */
  body.is-mobile .hero:not(.hero--sticky) h1 {
    font-size: 28px;
    margin-bottom: 16px;
    line-height: 1.3;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }

  body.is-mobile .hero:not(.hero--sticky) .subtitle {
    font-size: 16px;
    margin-bottom: 48px;
    opacity: 0.95;
    line-height: 1.5;
  }

  /* Stack buttons with plenty of space */
  body.is-mobile .hero:not(.hero--sticky) .hero__cta {
    flex-direction: column;
    width: 100%;
    gap: 16px;
    margin-top: 0;
  }

  /* Big, tappable buttons */
  body.is-mobile .hero:not(.hero--sticky) .switch-btn {
    width: 100%;
    padding: 20px;
    font-size: 17px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, background 0.2s ease;
  }

  body.is-mobile .hero:not(.hero--sticky) .switch-btn:active {
    transform: scale(0.97);
    background: rgba(255, 255, 255, 0.25);
  }
}

/* ===========================================================
   Estado de pacientes (Día QX / Día post-QX) + menú personal
   =========================================================== */

:root {
  --estado-pending-bg: #fffbea;
  --estado-pending-border: #f5e08a;
  --estado-done-bg: #f0faf4;
  --estado-done-border: #c4e8d2;
  --estado-bad-bg: #fdeaea;
  --estado-bad-border: #f0b9b9;
  --estado-pending-bg-strong: #fff3c4;
  --estado-done-bg-strong: #ddf3e6;
}

/* --- Menú del personal y menú de Estado de pacientes --- */

.menu-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.menu-card {
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
  padding: 22px 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(150deg, #ffffff 0%, #f6f8ff 100%);
  box-shadow: var(--shadow);
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.16s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.menu-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 40px rgba(var(--brand-rgb), 0.18);
  border-color: rgba(var(--brand-rgb), 0.35);
}

.menu-card:active {
  transform: translateY(-1px);
}

.menu-card:focus-visible {
  outline: 3px solid rgba(var(--brand-rgb), 0.4);
  outline-offset: 2px;
}

.menu-card__icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--sky);
  color: var(--brand);
}

.menu-card__icon svg {
  width: 30px;
  height: 30px;
}

.menu-card__icon--estado,
.menu-card__icon--new {
  background: #e9f8ef;
  color: var(--success);
}

.menu-card__icon--postqx {
  background: #fff4e8;
  color: #c97a1f;
}

.menu-card__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.menu-card__title {
  font-size: 18px;
  font-weight: 600;
  color: var(--navy-strong);
  line-height: 1.25;
}

.menu-card__desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.45;
}

.menu-card__arrow {
  margin-left: auto;
  font-size: 30px;
  color: var(--muted);
  line-height: 1;
}

.menu-card--vertical {
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding: 24px 22px;
}

.menu-grid--three {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* .menu-card define display:flex después de .hidden: hace falta esta regla para que
   los módulos desactivados (p.ej. Tracking) queden realmente ocultos. */
.menu-card.hidden {
  display: none;
}

/* --- Cabecera y barra de herramientas del listado --- */

#estadoLista {
  /* El panel es un grid item: sin esto la tabla ancha lo desborda en vez de hacer scroll interno. */
  min-width: 0;
  max-width: 100%;
}

/* Modo ancho: el listado de estado aprovecha toda la pantalla del ordenador, igual que Tracking. */
body.estado-mode .layout {
  max-width: none;
  width: 100%;
  margin: 8px 0 0;
  padding: 0 24px 32px;
  display: block;
}

body.is-mobile.estado-mode .layout {
  padding: 0 10px 80px;
}

.estado-header {
  align-items: flex-start;
}

.estado-toolbar {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.estado-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.estado-save-indicator {
  display: none;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.estado-save-indicator.is-visible {
  display: inline-flex;
}

.estado-save-indicator.is-saving {
  background: var(--sky);
  color: var(--brand);
}

.estado-save-indicator.is-saved {
  background: #e9f8ef;
  color: var(--success);
}

.estado-save-indicator.is-saved::before {
  content: '✓';
  margin-right: 6px;
}

.estado-save-indicator.is-error {
  background: var(--estado-bad-bg);
  color: var(--danger);
}

.estado-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  flex-wrap: wrap;
}

.estado-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}

.estado-legend__swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid transparent;
}

.estado-legend__swatch--pending {
  background: var(--estado-pending-bg);
  border-color: var(--estado-pending-border);
}

.estado-legend__swatch--done {
  background: var(--estado-done-bg);
  border-color: var(--estado-done-border);
}

.estado-legend__swatch--bad {
  background: var(--estado-bad-bg);
  border-color: var(--danger);
}

/* --- Tabla / panel clínico --- */

.estado-table__wrapper {
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow-x: auto;
  background: linear-gradient(145deg, #ffffff 0%, #f7f9ff 100%);
  box-shadow: var(--shadow);
  margin-top: 14px;
}

.estado-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1160px;
}

.estado-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f1f4fb;
  font-weight: 700;
  color: var(--navy-strong);
  font-size: 13px;
  letter-spacing: 0.02em;
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.estado-td {
  padding: 10px 8px;
  border-bottom: 1px solid #edf1fa;
  vertical-align: middle;
}

.estado-row:last-child .estado-td {
  border-bottom: none;
}

.estado-row {
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.estado-row:hover {
  background: rgba(var(--brand-rgb), 0.04);
}

.estado-row--selected {
  background: linear-gradient(90deg, rgba(var(--brand-rgb), 0.1), rgba(var(--brand-rgb), 0.04));
  box-shadow: inset 4px 0 0 var(--brand);
}

.estado-row--selected .estado-cell.is-pending {
  background: var(--estado-pending-bg-strong);
  border-color: #d4b53a;
}

.estado-row--selected .estado-cell.is-done {
  background: var(--estado-done-bg-strong);
  border-color: #93d8b1;
}

.estado-row--flash {
  animation: estadoFlash 1.2s ease 2;
}

@keyframes estadoFlash {
  0%, 100% { background: rgba(var(--brand-rgb), 0.08); }
  50% { background: rgba(18, 164, 84, 0.18); }
}

.estado-td--id {
  white-space: nowrap;
}

.estado-th--intervention,
.estado-td--intervention {
  min-width: 200px;
  width: 20%;
}

.estado-input--wrap {
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.4;
  min-height: 28px;
  padding-top: 4px;
  padding-bottom: 4px;
}

/* --- Identificador compuesto del modal (iniciales / habitación / año) --- */

.estado-id-parts {
  display: flex;
  align-items: center;
  gap: 8px;
}

.estado-id-parts input {
  text-align: center;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.estado-id-parts input:first-child {
  flex: 1.4;
}

.estado-id-parts input {
  flex: 1;
  min-width: 0;
}

.estado-id-parts__sep {
  color: var(--muted);
  font-weight: 700;
  font-size: 18px;
}

/* --- Tablet horizontal (≤1280px): compactar para que las 9 columnas quepan sin scroll --- */

@media (max-width: 1280px) {
  body.estado-mode .layout {
    padding: 0 12px 28px;
  }

  body.estado-mode #estadoLista {
    padding: 18px 14px;
  }

  .estado-table {
    min-width: 880px;
  }

  .estado-table thead th {
    padding: 10px 6px;
    font-size: 12px;
  }

  .estado-td {
    padding: 8px 4px;
  }

  .estado-td--intervention,
  .estado-th--intervention {
    min-width: 150px;
  }

  .estado-cell--note {
    min-width: 130px;
  }

  .estado-input--time {
    min-width: 70px;
  }

  .estado-cell {
    padding: 4px;
    gap: 4px;
  }
}

.estado-id {
  display: block;
  font-size: 16px;
  color: var(--navy-strong);
}

.estado-move {
  display: none;
  margin-top: 6px;
  padding: 4px 8px;
  border: 1px solid rgba(var(--brand-rgb), 0.4);
  border-radius: 8px;
  background: #ffffff;
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.estado-row--selected .estado-move {
  display: inline-block;
}

.estado-move:hover {
  background: var(--sky);
}

.estado-th--delete,
.estado-td--delete {
  width: 44px;
  min-width: 44px;
  text-align: center;
  padding: 0 4px;
}

.estado-manage-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 0 auto;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #7a86a3;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.estado-manage-btn:hover {
  color: var(--primary, #2b59c3);
  background: #eef3ff;
  border-color: rgba(43, 89, 195, 0.3);
}

.estado-life-badge {
  display: block;
  margin: 0 auto 4px;
  font-size: 10px;
  line-height: 1.4;
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
}
.estado-life-badge--closed { background: #eef1f6; color: #5b6478; }
.estado-life-badge--pending { background: #fff5e6; color: #9a6a10; }
.estado-life-badge--void { background: #fdeaea; color: #b0322f; }

.estado-lifecycle-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0;
}

.estado-state-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.estado-state-filter select {
  padding: 6px 8px;
  border: 1px solid #d5dbe8;
  border-radius: 8px;
  background: #fff;
}

.estado-initials {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef3ff;
  color: var(--navy-strong);
  font-weight: 600;
  letter-spacing: 0.08em;
}

/* --- Celdas editables y estados visuales --- */

.estado-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 46px;
  padding: 4px 6px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.estado-cell.is-pending {
  background: var(--estado-pending-bg);
  border-color: var(--estado-pending-border);
}

.estado-cell.is-done {
  background: var(--estado-done-bg);
  border-color: var(--estado-done-border);
}

.estado-cell.is-bad {
  background: var(--estado-bad-bg);
  border-color: var(--estado-bad-border);
}

.estado-cell.is-error {
  box-shadow: 0 0 0 2px rgba(214, 69, 69, 0.45);
}

.estado-cell:not(.estado-cell--time):not(.estado-cell--stamp):focus-within {
  box-shadow: 0 0 0 2px rgba(var(--brand-rgb), 0.35);
}

.estado-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 8px 6px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
}

.estado-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.85);
}

.estado-input::placeholder {
  color: #a09060;
  font-style: italic;
}

.estado-cell.is-done .estado-input::placeholder {
  color: var(--muted);
}

.estado-input--time {
  min-width: 84px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 2px 4px;
  transition: border-color 0.15s, background 0.15s;
  color-scheme: light;
}

.estado-input--time:focus {
  outline: none;
  border-color: var(--accent, #4a90d9);
  background: #ffffff;
  box-shadow: none;
}

.estado-input--time::-webkit-calendar-picker-indicator {
  opacity: 0.5;
  cursor: pointer;
}

.estado-input--time:focus::-webkit-calendar-picker-indicator {
  opacity: 0.8;
}

.estado-cell--time {
  justify-content: center;
}

/* --- Celda de tolerancia (hora manual + tick/cruz) --- */

.estado-td--tolerance {
  min-width: 100px;
  width: 100px;
  text-align: center;
}

.estado-cell--tolerance {
  flex-direction: column;
  gap: 5px;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
}

.estado-time-split {
  display: flex;
  align-items: center;
  gap: 1px;
}

.estado-time-split__part {
  width: 26px;
  padding: 4px 3px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: rgba(0, 0, 0, 0.05);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: inherit;
}

.estado-time-split__part:focus {
  outline: none;
  border-color: var(--accent);
  background: #ffffff;
}

.estado-time-split__part::placeholder {
  font-weight: 400;
  color: #bbb;
}

.estado-time-split__sep {
  font-size: 14px;
  font-weight: 700;
  color: #999;
  line-height: 1;
  user-select: none;
  padding: 0 1px;
}

/* --- Celdas de sello de hora --- */

.estado-cell--stamp {
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
}

.estado-td--stamp {
  min-width: 90px;
  width: 90px;
  text-align: center;
}

.estado-stamp-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border: 1px dashed var(--estado-pending-border);
  border-radius: 8px;
  background: var(--estado-pending-bg);
  color: #a09060;
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.estado-stamp-btn:hover {
  background: var(--estado-pending-bg-strong);
  border-color: #d4b53a;
  color: #7a6a30;
}

.estado-stamp-time {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #1a5c1a;
  letter-spacing: 0.03em;
}

.estado-stamp-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #7aaa7a;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.estado-stamp-clear svg {
  width: 11px;
  height: 11px;
}

.estado-stamp-clear:hover {
  background: #ffe0e0;
  color: var(--danger);
}

/* --- Constantes (tick verde / cruz roja) --- */

.estado-cell--vitals {
  flex-direction: column;
  gap: 3px;
  justify-content: center;
  padding: 6px;
}

.estado-vitals__buttons {
  display: flex;
  gap: 8px;
}

.estado-vital {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: #ffffff;
  color: #9aa7bd;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.estado-vital svg {
  width: 18px;
  height: 18px;
}

.estado-vital:hover {
  transform: translateY(-1px);
}

.estado-vital--ok:hover {
  border-color: var(--success);
  color: var(--success);
}

.estado-vital--bad:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.estado-vital--ok.active {
  background: var(--success);
  border-color: var(--success);
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(18, 164, 84, 0.35);
}

.estado-vital--bad.active {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(214, 69, 69, 0.35);
}

.estado-cell__hint {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.estado-cell.is-bad .estado-cell__hint {
  color: var(--danger);
}

.estado-cell.is-done .estado-cell__hint {
  color: var(--success);
}

/* --- Valoración enfermero / Cuidados (tick + nota) --- */

.estado-cell--note {
  min-width: 170px;
}

.estado-check {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: #ffffff;
  color: #9aa7bd;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.estado-check svg {
  width: 16px;
  height: 16px;
}

.estado-check:hover {
  border-color: var(--success);
  color: var(--success);
  transform: translateY(-1px);
}

.estado-check.active {
  background: var(--success);
  border-color: var(--success);
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(18, 164, 84, 0.35);
}

/* --- Estado vacío de la tabla --- */

.estado-empty {
  text-align: center;
  padding: 42px 16px !important;
}

.estado-empty__title {
  display: block;
  font-weight: 600;
  color: var(--navy-strong);
  margin-bottom: 6px;
}

/* --- Selector de tipo de día en el modal --- */

.estado-day-picker {
  display: flex;
  gap: 10px;
}

.estado-day-option {
  flex: 1;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: #f9fbff;
  color: var(--navy-strong);
  font-weight: 600;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

.estado-day-option:hover {
  border-color: rgba(var(--brand-rgb), 0.5);
}

.estado-day-option.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(var(--brand-rgb), 0.3);
}

/* --- Responsive --- */

@media (max-width: 900px) {
  .estado-header {
    flex-direction: column;
    align-items: stretch;
  }

  .estado-toolbar {
    align-items: stretch;
  }

  .estado-toolbar .toggle {
    width: 100%;
  }

  .estado-toolbar .toggle .tab {
    flex: 1;
  }

  .estado-toolbar .inline {
    justify-content: stretch;
  }

  .estado-toolbar .inline .btn {
    flex: 1;
  }

  .estado-legend {
    margin-left: 0;
  }

  .menu-card__title {
    font-size: 16.5px;
  }
}
