/* ============================================================
   CONSISTENCIA RESPONSIVA GLOBAL
   Correcciones de desbordes, superposiciones y textos extensos
   ============================================================ */

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

@supports not (overflow: clip) {
  html,
  body { overflow-x: hidden; }
}

button,
input,
select,
textarea,
.button {
  min-width: 0;
  max-width: 100%;
}

/* Los elementos flotantes no deben competir con una ventana modal. */
body.modal-open .hotel-chat,
body.modal-open .admin-fan-menu {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal h1,
.modal h2,
.modal h3,
.modal p,
.modal strong,
.modal small,
.modal span,
.detail-grid strong,
.receipt-preview dd,
.booking-review-card dd {
  overflow-wrap: anywhere;
}

/* ============================================================
   LOGIN
   ============================================================ */

.login-layout,
.login-panel,
.login-card,
.demo-credentials,
.demo-credentials > div,
.demo-credentials p {
  min-width: 0;
}

.login-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding-top: clamp(28px, 5vh, 52px);
  padding-bottom: 26px;
  overflow-y: auto;
}

.login-card {
  flex: 0 0 auto;
}

.login-back {
  margin-bottom: clamp(26px, 6vh, 58px);
}

.login-card h2 {
  font-size: clamp(2.55rem, 3.8vw, 3.8rem);
  overflow-wrap: normal;
}

.login-subtitle {
  margin-bottom: clamp(24px, 4.2vh, 34px);
}

.login-form .button {
  white-space: normal;
  text-align: center;
  line-height: 1.25;
}

.demo-credentials {
  margin-top: clamp(22px, 3.8vh, 28px);
}

.demo-credentials p,
.demo-credentials small,
.demo-credentials code {
  overflow-wrap: anywhere;
  word-break: normal;
}

/* El pie vuelve al flujo normal: nunca se superpone con el formulario. */
.login-footer {
  position: static;
  flex: 0 0 auto;
  width: min(100%, 470px);
  margin: 22px auto 0;
  text-align: center;
  line-height: 1.45;
}

.login-visual-copy {
  bottom: clamp(30px, 6vh, 62px);
}

.login-visual-copy h1 {
  font-size: clamp(3.2rem, min(5.35vw, 9vh), 6.2rem);
  overflow-wrap: normal;
}

.login-visual-copy > p:not(.eyebrow),
.login-security-note small {
  overflow-wrap: anywhere;
}

/* ============================================================
   ADMINISTRACIÓN
   ============================================================ */

.admin-body,
.admin-main,
.admin-main .container,
.admin-panel,
.admin-panel > *,
.admin-title-row > *,
.admin-section-head > *,
.admin-stats article > div,
.admin-pro-grid > *,
.admin-premium-dashboard > *,
.admin-lower-grid > * {
  min-width: 0;
}

.admin-header {
  position: relative;
  z-index: 80;
  height: auto;
  min-height: 78px;
}

.admin-header-inner {
  min-height: 78px;
  padding-block: 10px;
}

.admin-user,
.admin-title-row,
.admin-toolbar,
.admin-filters,
.admin-section-head,
.management-copy > div,
.management-actions,
.service-admin-head,
.service-admin-actions,
.chatbot-settings-actions {
  flex-wrap: wrap;
}

.admin-user > div,
.admin-title-row > div,
.admin-section-head > div,
.management-copy,
.service-admin-card > div,
.chatbot-topic-content,
.reply-review-copy,
.reply-editor,
.reply-admin-actions {
  min-width: 0;
}

.admin-title-row p,
.admin-section-head p,
.admin-stats small,
.admin-stats strong,
.management-copy h3,
.management-copy p,
.management-copy footer,
.service-admin-card h3,
.service-admin-card p,
.catalog-card h3,
.catalog-card p,
.chatbot-topic-content strong,
.chatbot-topic-content p,
.chatbot-topic-content small,
.reply-review-copy strong,
.reply-review-copy p,
.reply-review-copy small,
.academic-note span,
.daily-task span {
  overflow-wrap: anywhere;
}

/* La navegación queda dentro del flujo. El menú flotante ya ofrece accesos rápidos. */
.admin-workspace-nav {
  position: static;
  top: auto;
  z-index: auto;
  max-width: 100%;
  background: rgba(255,255,255,.98);
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}

.admin-workspace-nav a {
  flex: 0 0 auto;
  scroll-snap-align: start;
}

.admin-panel,
.catalog-panel,
.management-list,
.service-admin-grid {
  scroll-margin-top: 24px;
}

.admin-toolbar {
  min-width: 0;
}

.admin-filters > * {
  min-width: 0;
}

.admin-tabs {
  max-width: 100%;
  scrollbar-width: thin;
}

.search-field,
.date-field {
  min-width: 0;
}

.date-field select {
  width: auto;
  min-width: 108px;
  min-height: 40px;
  padding: 8px 30px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}

.reservation-table-wrap,
.users-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

.reservation-table td,
.reservation-table th,
.guest-cell strong,
.guest-cell span,
.stay-cell strong,
.stay-cell span,
.table-room strong,
.table-room small {
  overflow-wrap: anywhere;
}

.table-room,
.table-room > div {
  min-width: 0;
}

.inventory-grid,
.catalog-grid,
.service-admin-grid,
.management-list,
.chatbot-topic-list {
  min-width: 0;
}

.inventory-card,
.catalog-card,
.management-row,
.service-admin-card,
.chatbot-topic-card {
  min-width: 0;
}

.inventory-card div,
.catalog-card-body,
.catalog-card-top,
.management-row > *,
.service-admin-card > *,
.chatbot-topic-card > * {
  min-width: 0;
}

.inventory-card div span {
  max-width: none;
  overflow-wrap: anywhere;
}

.catalog-card-top {
  flex-wrap: wrap;
}

.catalog-card-top > strong {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.management-actions,
.service-admin-actions {
  justify-content: flex-end;
}

.management-actions .button,
.service-admin-actions .button,
.chatbot-topic-card .button {
  white-space: normal;
  text-align: center;
  line-height: 1.2;
}

/* Las palabras clave dejan de quedar cortadas con una elipsis. */
.chatbot-topic-content small {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.5;
}

.chatbot-topic-card .management-actions {
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
}

/* Comentarios: columnas flexibles y acciones sin invadir el texto. */
.admin-lower-grid {
  grid-template-columns: minmax(0, 1.5fr) minmax(310px, .72fr);
  align-items: start;
}

.review-management #reviewReplyList {
  min-width: 0;
}

.reply-admin-item {
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr) minmax(142px, .48fr) !important;
}

.reply-review-copy strong,
.reply-review-copy p,
.reply-review-copy small,
.reply-status {
  overflow-wrap: anywhere;
}

.reply-editor textarea {
  min-width: 0;
  max-width: 100%;
  resize: vertical;
  overflow-wrap: anywhere;
}

.reply-admin-actions {
  min-width: 0;
  width: 100%;
}

.reply-admin-actions .button {
  width: 100%;
  min-width: 0;
  padding-inline: 12px;
  white-space: normal;
  text-align: center;
  line-height: 1.25;
}

.data-management {
  min-width: 0;
}

.data-management > p,
.academic-note,
.data-action-grid {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Ventanas administrativas y formularios. */
.admin-detail-card,
.admin-review-card,
.confirm-action-card,
.maintenance-card,
.management-form-card {
  max-width: calc(100vw - 28px);
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.detail-reservation-hero > div,
.maintenance-unit-summary > div {
  min-width: 0;
}

.detail-reservation-hero strong,
.detail-reservation-hero span,
.maintenance-unit-summary strong,
.maintenance-unit-summary span,
.detail-price-breakdown span,
.detail-price-breakdown strong {
  overflow-wrap: anywhere;
}

.detail-price-breakdown div {
  min-width: 0;
  gap: 16px;
}

.detail-price-breakdown strong {
  flex: 0 1 auto;
  text-align: right;
}

/* ============================================================
   TABLET
   ============================================================ */

@media (max-width: 1180px) {
  .admin-lower-grid {
    grid-template-columns: 1fr;
  }

  .data-management {
    width: 100%;
  }

  .admin-user {
    justify-content: flex-end;
  }
}

@media (max-width: 900px) {
  .reply-admin-item {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  }

  .reply-admin-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .reply-admin-actions .button {
    flex: 1 1 190px;
    width: auto;
  }

  .login-panel {
    justify-content: flex-start;
  }
}

/* ============================================================
   MÓVIL
   ============================================================ */

@media (max-width: 700px) {
  .container {
    width: min(calc(100% - 28px), var(--container));
  }

  .admin-header-inner {
    min-height: 70px;
    gap: 8px;
    flex-wrap: nowrap;
  }

  .admin-header .brand {
    gap: 7px;
  }

  .admin-header .brand img {
    width: 34px;
    height: 34px;
  }

  .admin-header .brand strong {
    font-size: .8rem;
  }

  .admin-header .brand small {
    display: none;
  }

  .admin-user {
    margin-left: auto;
    gap: 5px;
    flex-wrap: nowrap;
  }

  .admin-user .button {
    min-height: 36px;
    padding-inline: 9px;
    font-size: .62rem;
    white-space: nowrap;
  }

  .admin-main {
    padding-top: 36px;
    padding-bottom: 105px;
  }

  .admin-title-row {
    gap: 20px;
    margin-bottom: 26px;
  }

  .admin-title-row > .button {
    width: 100%;
  }

  .admin-workspace-nav {
    margin-bottom: 22px;
  }

  .admin-toolbar {
    padding: 14px;
  }

  .admin-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 4px;
    overflow: visible;
  }

  .admin-tabs button {
    min-width: 0;
    min-height: 42px;
    padding: 6px 3px;
    font-size: .62rem;
    line-height: 1.15;
    white-space: normal;
  }

  .admin-tabs span {
    min-width: 17px;
    height: 17px;
    margin-left: 2px;
    padding-inline: 3px;
    font-size: .55rem;
  }

  .admin-filters {
    width: 100%;
  }

  .admin-filters .button,
  .admin-filters label,
  .admin-filters input,
  .admin-filters select {
    width: 100%;
  }

  .date-field {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .admin-section-head,
  .admin-section-head.compact-head {
    gap: 16px;
    padding: 22px 18px 18px;
  }

  .admin-section-head > .button,
  .admin-section-head > .search-field,
  .inventory-date {
    width: 100%;
  }

  .inventory-date {
    align-items: flex-start;
    flex-direction: column;
  }

  .inventory-date input {
    width: 100%;
  }

  .inventory-legend {
    padding-inline: 18px;
  }

  .inventory-grid {
    padding: 18px;
  }

  .catalog-grid,
  .management-list,
  .service-admin-grid,
  .chatbot-topic-list {
    padding-left: 14px;
    padding-right: 14px;
  }

  .management-row,
  .service-admin-card,
  .chatbot-topic-card {
    padding: 15px;
  }

  .management-actions,
  .service-admin-actions,
  .chatbot-topic-card .management-actions {
    width: 100%;
    justify-content: stretch;
  }

  .management-actions .button,
  .service-admin-actions .button,
  .chatbot-topic-card .management-actions .button {
    flex: 1 1 120px;
  }

  .chatbot-settings-grid {
    margin-inline: 14px;
    padding: 15px;
  }

  .reply-admin-item {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .reply-admin-actions {
    grid-column: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .reply-admin-actions .button {
    width: 100%;
    min-height: 44px;
    padding: 8px;
    font-size: .72rem;
  }

  .admin-fan-menu {
    display: none;
  }

  .detail-grid,
  .field-grid.two {
    grid-template-columns: 1fr;
  }

  .detail-actions,
  .confirm-action-buttons {
    flex-direction: column;
  }

  .detail-actions .button,
  .confirm-action-buttons .button {
    width: 100%;
  }

  .admin-detail-card,
  .admin-review-card,
  .confirm-action-card,
  .maintenance-card,
  .management-form-card {
    padding: 30px 18px 22px;
  }

  .detail-reservation-hero,
  .maintenance-unit-summary {
    align-items: flex-start;
  }

  .detail-reservation-hero img,
  .maintenance-unit-summary img {
    width: 76px;
    height: 62px;
    flex: 0 0 auto;
  }

  .login-panel {
    padding: 32px 20px 26px;
  }

  .login-card h2 {
    font-size: clamp(2.35rem, 12vw, 2.9rem);
  }

  .demo-credentials > div {
    align-items: flex-start;
  }

  .login-footer {
    margin-top: 20px;
  }
}

@media (max-width: 430px) {
  .admin-header .brand span {
    display: none;
  }

  .admin-user .button {
    padding-inline: 8px;
  }

  .admin-stats article {
    padding: 18px;
  }

  .admin-tabs button {
    font-size: .58rem;
  }

  .reply-admin-actions {
    grid-template-columns: 1fr;
  }
}

/* Pantallas bajas de escritorio: evita que el login quede comprimido. */
@media (min-width: 981px) and (max-height: 820px) {
  .login-panel {
    justify-content: flex-start;
    padding-top: 28px;
  }

  .login-back {
    margin-bottom: 30px;
  }

  .login-subtitle {
    margin-bottom: 24px;
  }

  .login-form {
    gap: 14px;
  }

  .demo-credentials {
    margin-top: 20px;
  }

  .login-visual-copy {
    bottom: 34px;
  }

  .login-security-note {
    margin-top: 22px;
  }
}

/* ============================================================
   AJUSTE FINAL — LOGIN BAJO Y GESTIÓN DE COMENTARIOS
   ============================================================ */

/* En una ventana de escritorio baja, todo el acceso debe quedar visible
   sin que las credenciales ni el pie legal queden fuera del primer cuadro. */
@media (min-width: 981px) and (max-height: 760px) {
  .login-panel {
    justify-content: flex-start;
    padding-top: 12px;
    padding-bottom: 10px;
  }

  .login-back {
    margin-bottom: 10px;
    font-size: .66rem;
  }

  .login-card > .eyebrow {
    margin-bottom: 3px;
  }

  .login-card h2 {
    margin: 3px 0 4px;
    font-size: clamp(2.35rem, 3.3vw, 3.15rem);
    line-height: 1;
  }

  .login-subtitle {
    margin-bottom: 11px;
    font-size: .88rem;
  }

  .login-form {
    gap: 8px;
  }

  .login-form .field {
    gap: 4px;
  }

  .login-form .field > span {
    font-size: .67rem;
  }

  .login-form .field:not(.invalid) .error {
    display: none;
  }

  .login-form .field.invalid .error {
    min-height: 12px;
    font-size: .6rem;
  }

  .login-input input {
    min-height: 47px;
  }

  .login-form .button {
    min-height: 47px;
  }

  .demo-credentials {
    margin-top: 10px;
    padding: 10px 12px;
  }

  .demo-credentials > div {
    gap: 9px;
  }

  .demo-credentials > div > span {
    width: 23px;
    height: 23px;
  }

  .demo-credentials p {
    font-size: .66rem;
    line-height: 1.42;
  }

  .demo-credentials > small {
    margin: 6px 0 0 32px;
    font-size: .55rem;
    line-height: 1.35;
  }

  .login-footer {
    margin-top: 8px;
    font-size: .55rem;
    line-height: 1.25;
  }

  .login-visual-copy {
    bottom: 18px;
  }

  .login-visual-copy h1 {
    margin: 7px 0 11px;
    font-size: clamp(2.8rem, min(4.8vw, 7.3vh), 4.9rem);
    line-height: .94;
  }

  .login-visual-copy > p:not(.eyebrow) {
    font-size: .88rem;
    line-height: 1.45;
  }

  .login-security-note {
    margin-top: 13px;
    padding: 9px 12px;
  }
}

/* Cada comentario funciona como una tarjeta autocontenida. La respuesta y
   las acciones comparten una columna amplia, evitando botones angostos y
   saltos de texto artificiales. */
.review-management #reviewReplyList {
  display: grid;
  gap: 14px;
  padding: 18px 20px 22px;
}

.review-management #reviewReplyList .reply-admin-item {
  grid-template-columns: minmax(0, .9fr) minmax(300px, 1.1fr) !important;
  grid-template-areas:
    "review editor"
    "review actions";
  align-items: start !important;
  gap: 11px 18px;
  margin: 0;
  padding: 18px;
  border: 1px solid rgba(9, 75, 106, .12);
  border-radius: 10px;
  background: linear-gradient(135deg, #ffffff, #f8fcfe);
}

.review-management .reply-review-copy {
  grid-area: review;
}

.review-management .reply-editor {
  grid-area: editor;
}

.review-management .reply-admin-actions {
  grid-area: actions;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.review-management .reply-editor textarea {
  min-height: 88px;
}

.review-management .reply-admin-actions .button {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 9px 8px;
  font-size: .7rem;
  line-height: 1.2;
  white-space: nowrap;
}

body.dark-mode .review-management #reviewReplyList .reply-admin-item {
  border-color: rgba(176, 220, 233, .14);
  background: linear-gradient(135deg, #102630, #0d2028);
}

@media (max-width: 900px) {
  .review-management #reviewReplyList .reply-admin-item {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas:
      "review"
      "editor"
      "actions";
  }
}

@media (max-width: 520px) {
  .review-management #reviewReplyList {
    padding: 14px;
  }

  .review-management #reviewReplyList .reply-admin-item {
    padding: 15px;
  }

  .review-management .reply-admin-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .review-management .reply-admin-actions .button {
    white-space: normal;
  }
}
