* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #f3f5f9;
  color: #1f2937;
}
.hidden { display: none !important; }
.muted { color: #6b7280; }
.small { font-size: 0.85rem; }
.error { color: #dc2626; margin-top: 0.5rem; min-height: 1.2em; }

button {
  background: #2563eb;
  color: #fff;
  border: 0;
  padding: 0.55rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}
button:hover { background: #1d4ed8; }
button.ghost { background: transparent; color: #1f2937; border: 1px solid #d1d5db; }
button.ghost:hover { background: #e5e7eb; }
button.danger { background: #dc2626; }
button.danger:hover { background: #b91c1c; }
button.small { padding: 0.3rem 0.6rem; font-size: 0.85rem; }

input, select, textarea {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1rem;
  margin-top: 0.25rem;
}
label { display: block; margin-bottom: 0.75rem; font-size: 0.9rem; color: #374151; }

.card {
  background: #fff;
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
}
.login-card { width: 360px; }
.login-card h1 { margin: 0 0 0.25rem; font-size: 1.4rem; }
.login-card button { width: 100%; margin-top: 0.5rem; }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 2rem;
  background: #fff;
  padding: 0.8rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { font-weight: 700; font-size: 1.1rem; }
.topbar-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.topbar nav { flex: 1; display: flex; gap: 0.5rem; }
.topbar nav button {
  background: transparent;
  color: #4b5563;
  font-weight: 500;
}
.topbar nav button.active {
  background: #eff6ff;
  color: #1d4ed8;
}
.user-info { display: flex; align-items: center; gap: 1rem; }

main { padding: 1.5rem; max-width: 1300px; margin: 0 auto; }
.tab { display: none; }
.tab.active { display: block; }
.tab-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.tab-header h2 { margin: 0; }
.filters { margin-bottom: 1rem; }
.filters label { display: inline-flex; align-items: center; gap: 0.5rem; }
.filters select { width: auto; }

/* Quartos */
.rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.room-card {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.room-card.room-status-disponivel {
  background: #ecfdf5;
  border-color: #86efac;
}
.room-card.room-status-ocupado {
  background: #fef2f2;
  border-color: #fca5a5;
}
.room-card.room-status-reservado {
  background: #fffbeb;
  border-color: #fcd34d;
}
.room-card.room-status-manutencao {
  background: #fffbeb;
  border-color: #fcd34d;
}
.room-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
}
.room-photo {
  width: 100%;
  height: 180px;
  background: #e5e7eb center / cover no-repeat;
  position: relative;
}
.room-gallery {
  width: 100%;
  height: 190px;
  position: relative;
  background: #e5e7eb;
}
.room-gallery-viewport {
  width: 100%;
  height: 100%;
  position: relative;
  cursor: zoom-in;
}
.room-photo-slide {
  position: absolute;
  inset: 0;
  background: #e5e7eb center / cover no-repeat;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.room-photo-slide.active { opacity: 1; }

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0;
  z-index: 2;
}
.gallery-nav:hover { background: rgba(0, 0, 0, 0.7); }
.gallery-nav.prev { left: 8px; }
.gallery-nav.next { right: 8px; }
.gallery-dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 2;
}
.gallery-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: rgba(255, 255, 255, 0.55);
}
.gallery-dot.active { background: #fff; }

.room-photo .placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #9ca3af;
  font-size: 2.5rem;
}
.room-gallery .photos-count {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  z-index: 3;
}

.room-body { padding: 1rem 1rem 0.75rem; flex: 1; }
.room-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}
.room-name {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.room-type {
  margin-top: 0.2rem;
  color: #6b7280;
  font-size: 0.9rem;
  font-weight: 500;
}
.room-price {
  font-weight: 700;
  color: #16a34a;
  font-size: 1.05rem;
  white-space: nowrap;
}
.room-meta {
  color: #6b7280;
  font-size: 0.85rem;
  margin: 0.65rem 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.room-hotel {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.74rem;
}
.room-desc {
  font-size: 0.92rem;
  color: #475569;
  min-height: 2.7em;
}
.room-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
  padding: 0 1rem 1rem;
}
.room-actions button { width: 100%; }
.room-actions button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.room-actions .reserve { background: #0f766e; }
.room-actions .reserve:hover { background: #0d5f59; }
.room-settings-btn {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
}

.room-settings-shell {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.room-settings-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.8rem;
}
.room-settings-head h3 {
  margin: 0 0 0.2rem;
}
.room-settings-tabs {
  display: flex;
  gap: 0.45rem;
}
.room-settings-tabs button.active {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #93c5fd;
}
.room-settings-panel { display: none; }
.room-settings-panel.active { display: block; }
.room-settings-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.room-settings-actions button {
  flex: 1;
}
.check-label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.check-label input[type='checkbox'] {
  width: 18px;
  height: 18px;
  margin-top: 0;
}
.inline-copy-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
}
.inline-copy-row button {
  white-space: nowrap;
}
.room-ical-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.3rem;
  color: #475569;
  font-size: 0.85rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  margin: 0.2rem 0 0.5rem;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}
.status-disponivel { background: #dcfce7; color: #15803d; }
.status-ocupado { background: #fee2e2; color: #b91c1c; }
.status-manutencao { background: #fef3c7; color: #b45309; }
.status-reservado { background: #fef3c7; color: #b45309; }
.status-checkin { background: #fee2e2; color: #b91c1c; }
.status-checkout { background: #e5e7eb; color: #374151; }
.status-cancelado { background: #f3f4f6; color: #6b7280; }

/* Tabelas */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.92rem;
}
.data-table th {
  background: #f8fafc;
  font-weight: 600;
  color: #475569;
}
.data-table tr:last-child td { border-bottom: none; }

/* Cards de resumo */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
.metric { display: flex; flex-direction: column; }
.metric span { color: #6b7280; font-size: 0.85rem; }
.metric strong { font-size: 1.5rem; margin-top: 0.4rem; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal-content {
  width: 520px;
  max-width: 92vw;
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: transparent;
  color: #6b7280;
  font-size: 1.6rem;
  padding: 0;
  line-height: 1;
}
.modal-content h3 { margin-top: 0; }

.modal.manager-modal .modal-content {
  width: 900px;
  max-width: 94vw;
  border-radius: 14px;
  padding: 1.3rem;
}
.modal.booking-modal .modal-content {
  width: min(1120px, 95vw);
  max-width: 95vw;
  max-height: 93vh;
  border-radius: 14px;
  padding: 1.2rem;
}
.modal.reservations-modal .modal-content {
  width: min(1240px, 97vw);
  max-width: 97vw;
  max-height: 94vh;
  border-radius: 14px;
  padding: 1.25rem;
}
.modal.fullscreen {
  align-items: stretch;
  justify-content: stretch;
}
.modal.fullscreen .modal-content {
  width: 100vw;
  max-width: 100vw;
  max-height: 100vh;
  height: 100vh;
  border-radius: 0;
  padding: 1rem 1.25rem 1.2rem;
  display: flex;
  flex-direction: column;
}

/* Popup de reservas do quarto */
.room-resv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}
.room-resv-header h3 { margin: 0; }
.room-resv-actions {
  display: flex;
  gap: 0.5rem;
}
.room-resv-table-wrap {
  max-height: 74vh;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.room-resv-table {
  box-shadow: none;
  border-radius: 0;
}
.room-resv-table td:last-child {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.room-resv-calendar-wrap {
  margin-bottom: 0.9rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.8rem;
}
.room-resv-calendar-title {
  font-weight: 700;
  color: #334155;
  margin-bottom: 0.45rem;
}
.cal-legend {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-bottom: 0.55rem;
  color: #475569;
  font-size: 0.82rem;
}
.legend-box {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px solid #93c5fd;
  border-radius: 4px;
  margin-right: 0.35rem;
  vertical-align: middle;
}
.legend-box.middle {
  background: #dbeafe;
}
.legend-box.start {
  background: linear-gradient(to top, #dbeafe 50%, transparent 50%);
}
.legend-box.end {
  background: linear-gradient(to bottom, #dbeafe 50%, transparent 50%);
}

.room-resv-calendar .cal-day.readonly {
  pointer-events: auto;
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
}
.room-resv-calendar .cal-day.booked {
  cursor: pointer;
}

.resv-cal-tooltip {
  position: fixed;
  z-index: 10000;
  display: none;
  pointer-events: none;
  background: #0f172a;
  color: #f8fafc;
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  font-size: 0.82rem;
  line-height: 1.35;
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.35);
  max-width: 280px;
}
.resv-cal-tooltip .resv-tt-item + .resv-tt-item {
  margin-top: 0.45rem;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(248, 250, 252, 0.18);
}
.resv-cal-tooltip .resv-tt-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
}
.resv-cal-tooltip .resv-tt-role {
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
}
.resv-cal-tooltip .resv-tt-role.role-start { background: #16a34a; color: #fff; }
.resv-cal-tooltip .resv-tt-role.role-end { background: #dc2626; color: #fff; }
.resv-cal-tooltip .resv-tt-role.role-middle { background: #475569; color: #fff; }
.resv-cal-tooltip .resv-tt-id { color: #94a3b8; font-size: 0.74rem; }
.resv-cal-tooltip .resv-tt-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.resv-cal-tooltip .resv-tt-guest { font-weight: 600; }
.resv-cal-tooltip .resv-tt-meta { color: #cbd5e1; font-size: 0.78rem; margin-top: 0.1rem; }
.resv-cal-tooltip .resv-tt-meta .status-badge { font-size: 0.7rem; }


/* Booking form */
.booking-head h3 {
  margin-bottom: 0.2rem;
}
.booking-form-shell {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 1rem;
}
.booking-form-main {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.9rem;
}
.booking-form-guest {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.9rem;
  height: fit-content;
}
.booking-form-guest h4 {
  margin-top: 0;
  margin-bottom: 0.6rem;
}
.booking-form-guest button {
  width: 100%;
}
.booking-range-summary {
  margin: 0.2rem 0 0.7rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
}
#booking-new-guest {
  margin-bottom: 0.7rem;
}
.booking-plus-btn {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
}

.range-calendar {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.75rem;
}
.cal-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}
.cal-months {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}
.cal-month {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0.5rem;
}
.cal-month-title {
  text-align: center;
  font-weight: 700;
  color: #334155;
  margin-bottom: 0.35rem;
}
.cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 0.2rem;
}
.cal-week span {
  text-align: center;
  font-size: 0.74rem;
  color: #64748b;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-day {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #0f172a;
  height: 34px;
  font-size: 0.84rem;
  padding: 0;
}
.cal-day.empty {
  visibility: hidden;
}
.cal-day:hover {
  background: #f1f5f9;
}
.cal-day.in-range {
  background: #dbeafe;
  color: #1e3a8a;
}
.booking-cal-legend {
  margin-top: -0.1rem;
}

#range-calendar .cal-day.in-range {
  background: #2563eb;
  color: #fff;
  font-weight: 700;
}
#range-calendar .cal-day.start,
#range-calendar .cal-day.end {
  color: #0f172a;
  font-weight: 700;
}
#range-calendar .cal-day.start {
  background-image: linear-gradient(#2563eb, #2563eb);
  background-size: 100% 50%;
  background-position: bottom;
  background-repeat: no-repeat;
}
#range-calendar .cal-day.end {
  background-image: linear-gradient(#2563eb, #2563eb);
  background-size: 100% 50%;
  background-position: top;
  background-repeat: no-repeat;
}
#range-calendar .cal-day.start.end {
  background: #2563eb;
  color: #fff;
}

#range-calendar .cal-day.unavailable {
  color: #1e3a8a;
  font-weight: 700;
  cursor: pointer;
}
#range-calendar .cal-day.unavailable.booked-middle {
  background: #dbeafe;
}
#range-calendar .cal-day.unavailable.booked-start {
  background-image: linear-gradient(#dbeafe, #dbeafe);
  background-size: 100% 50%;
  background-position: bottom;
  background-repeat: no-repeat;
}
#range-calendar .cal-day.unavailable.booked-end {
  background-image: linear-gradient(#dbeafe, #dbeafe);
  background-size: 100% 50%;
  background-position: top;
  background-repeat: no-repeat;
}
#range-calendar .cal-day:disabled {
  opacity: 1;
}

#range-calendar .cal-day.start.booked-start {
  background-image: linear-gradient(to right, #dbeafe 0 50%, #2563eb 50% 100%);
  background-size: 100% 50%;
  background-position: bottom;
  background-repeat: no-repeat;
}
#range-calendar .cal-day.end.booked-end {
  background-image: linear-gradient(to right, #dbeafe 0 50%, #2563eb 50% 100%);
  background-size: 100% 50%;
  background-position: top;
  background-repeat: no-repeat;
}
#range-calendar .cal-day.start.booked-end {
  background-image: linear-gradient(#dbeafe, #dbeafe), linear-gradient(#2563eb, #2563eb);
  background-size: 100% 50%, 100% 50%;
  background-position: top, bottom;
  background-repeat: no-repeat;
}
#range-calendar .cal-day.end.booked-start {
  background-image: linear-gradient(#2563eb, #2563eb), linear-gradient(#dbeafe, #dbeafe);
  background-size: 100% 50%, 100% 50%;
  background-position: top, bottom;
  background-repeat: no-repeat;
}

/* Viewer fullscreen */
.modal.gallery-modal {
  background: rgba(3, 8, 20, 0.92);
}
.modal.gallery-modal .modal-content {
  background: transparent;
  box-shadow: none;
}
.modal.gallery-modal .modal-close {
  display: none;
}
.viewer-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: #e5e7eb;
  margin-bottom: 0.8rem;
}
.viewer-title {
  margin: 0;
  text-align: left;
  font-size: 1rem;
  font-weight: 600;
  color: #f8fafc;
}
.viewer-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.viewer-btn {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(17, 24, 39, 0.35);
  color: #fff;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  font-size: 0.88rem;
  backdrop-filter: blur(4px);
}
.viewer-btn:hover { background: rgba(31, 41, 55, 0.6); }
.viewer-btn.accent {
  border-color: #93c5fd;
  background: rgba(37, 99, 235, 0.35);
}
.viewer-close-x {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(2, 6, 23, 0.55);
  color: #fff;
  font-size: 1.45rem;
  line-height: 1;
  padding: 0;
}
.viewer-close-x:hover { background: rgba(15, 23, 42, 0.85); }
.viewer-empty {
  min-height: 52vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
}

.room-modal-gallery {
  margin-bottom: 0.8rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.room-main-swiper {
  width: 100%;
  height: min(72vh, 820px);
  border-radius: 14px;
  overflow: hidden;
  background: #020617;
}
.room-main-swiper .swiper-slide {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #111827 0%, #020617 70%);
}
.room-main-swiper .swiper-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.room-main-swiper .swiper-button-prev,
.room-main-swiper .swiper-button-next {
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.room-main-swiper .swiper-button-prev::after,
.room-main-swiper .swiper-button-next::after {
  font-size: 1rem;
  font-weight: 700;
}
.room-main-swiper .swiper-pagination {
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  text-shadow: 0 1px 6px rgba(0,0,0,0.45);
}
.room-thumbs-swiper {
  margin-top: 0.8rem;
  width: 100%;
  padding: 0.4rem 0.2rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.25);
}
.room-thumbs-swiper .swiper-slide {
  width: 110px;
  height: 74px;
  border-radius: 10px;
  overflow: hidden;
  opacity: 0.5;
  cursor: pointer;
  position: relative;
  border: 2px solid transparent;
}
.room-thumbs-swiper .swiper-slide-thumb-active {
  opacity: 1;
  border-color: #60a5fa;
  transform: translateY(-1px);
}
.room-thumbs-swiper .swiper-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gallery-thumb-wrap { position: relative; }
.gallery-thumb-del {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 0;
  background: #dc2626;
  color: #fff;
  font-size: 0.8rem;
}
.modal.gallery-modal #modal-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

/* Gerenciador de fotos */
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 0.5rem; }
.thumbs .thumb {
  position: relative;
  width: 80px;
  height: 60px;
  border-radius: 6px;
  background: center/cover no-repeat #e5e7eb;
}
.thumbs .thumb button {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #dc2626;
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  padding: 0;
  font-size: 0.8rem;
}
.photo-manager-shell {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.photo-manager-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid #e2e8f0;
}
.photo-manager-header h3 { margin-bottom: 0.2rem; }
.photo-manager-tools {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.photo-count {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
}
.photo-manager-body {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
}
.photo-manager-gallery-panel {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.9rem;
}
.panel-label {
  margin: 0 0 0.7rem;
  font-weight: 600;
  color: #334155;
}
.photo-manager-upload {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.9rem;
  height: fit-content;
}
.upload-label {
  display: block;
  margin-bottom: 0.65rem;
}
.manager-thumbs .thumb {
  width: 140px;
  height: 102px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}
.manager-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.manager-actions button { flex: 1; }

@media (max-width: 980px) {
  .topbar {
    gap: 1rem;
    align-items: flex-start;
    flex-direction: column;
    padding: 0.75rem 1rem;
  }
  .topbar-main {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }
  .topbar nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
    white-space: nowrap;
    scrollbar-width: thin;
  }
  .topbar nav button { flex: 0 0 auto; }
  .user-info {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  #user-name { font-size: 0.88rem; }
  #hotel-switcher { width: 100%; }
  #hotel-switcher label { margin-bottom: 0; }
  #hotel-filter { width: 100%; }
  main { padding: 1rem; }
  .summary-cards { grid-template-columns: 1fr; }
  .metric strong { font-size: 1.25rem; }
  .tab-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
  }
  .tab-header button { width: 100%; }
  .data-table { min-width: 760px; }

  .modal.reservations-modal .modal-content {
    width: 96vw;
    max-width: 96vw;
    max-height: 92vh;
    padding: 1rem;
  }
  .modal.booking-modal .modal-content {
    width: 96vw;
    max-width: 96vw;
    max-height: 92vh;
    padding: 1rem;
  }
  .booking-form-shell {
    grid-template-columns: 1fr;
  }
  .room-resv-header {
    flex-direction: column;
    align-items: stretch;
  }
  .room-resv-actions {
    width: 100%;
  }
  .room-resv-actions button { flex: 1; }
}

@media (max-width: 640px) {
  .login-wrap { padding: 1rem; }
  .login-card {
    width: 100%;
    max-width: 420px;
    padding: 1.15rem;
  }
  .rooms-grid { grid-template-columns: 1fr; }
  .room-title {
    flex-direction: row;
    align-items: flex-start;
    gap: 0.55rem;
  }
  .room-name { font-size: 1.15rem; }
  .room-actions { grid-template-columns: 1fr; }
  .room-actions button { width: 100%; }

  .room-settings-head {
    flex-direction: column;
    align-items: stretch;
  }
  .room-settings-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .room-settings-actions {
    flex-direction: column;
  }
  .inline-copy-row {
    grid-template-columns: 1fr;
  }

  .gallery-nav {
    width: 30px;
    height: 30px;
  }
  .room-main-swiper { height: 46vh; }
  .room-thumbs-swiper .swiper-slide {
    width: 84px;
    height: 58px;
  }

  .viewer-topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .viewer-title { text-align: left; }
  .viewer-actions {
    width: 100%;
    justify-content: space-between;
  }
  .viewer-btn { flex: 1; }
  .viewer-close-x { flex: 0 0 38px; }

  .photo-manager-header {
    flex-direction: column;
    align-items: stretch;
  }
  .photo-manager-tools { justify-content: space-between; }
  .photo-manager-body { grid-template-columns: 1fr; }
  .manager-thumbs .thumb {
    width: 112px;
    height: 84px;
  }
  .manager-actions { flex-direction: column; }

  .filters label {
    width: 100%;
    display: block;
  }
  .filters select { width: 100%; }

  .modal {
    align-items: flex-end;
  }
  .modal-content {
    width: 100%;
    max-width: 100%;
    border-radius: 12px 12px 0 0;
    max-height: 88vh;
    padding: 1rem;
  }
  .modal.fullscreen {
    align-items: stretch;
  }
  .modal.fullscreen .modal-content {
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    padding: 0.9rem;
  }
  .modal.gallery-modal .room-main-swiper {
    height: 50vh;
    border-radius: 8px;
  }
  .modal.reservations-modal .modal-content {
    border-radius: 12px 12px 0 0;
    max-height: 90vh;
  }
  .modal.booking-modal .modal-content {
    border-radius: 12px 12px 0 0;
    max-height: 90vh;
  }
  .cal-months {
    grid-template-columns: 1fr;
  }

  .table-wrap { overflow: visible; }
  .data-table {
    min-width: 0;
    width: 100%;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }
  .data-table thead { display: none; }
  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }
  .data-table tr {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    margin-bottom: 0.75rem;
    padding: 0.25rem 0.75rem;
  }
  .data-table td {
    border-bottom: 1px solid #f1f5f9;
    text-align: right;
    padding: 0.5rem 0;
    position: relative;
    font-size: 0.9rem;
    min-height: 1.9rem;
  }
  .data-table td:last-child { border-bottom: none; }
  .data-table td::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }

  #bookings-table tr.booking-status-reservado {
    border-left: 5px solid #2563eb;
    background: linear-gradient(90deg, #eff6ff 0%, #ffffff 26%);
  }
  #bookings-table tr.booking-status-checkin {
    border-left: 5px solid #dc2626;
    background: linear-gradient(90deg, #fef2f2 0%, #ffffff 26%);
  }
  #bookings-table tr.booking-status-checkout {
    border-left: 5px solid #6b7280;
    background: linear-gradient(90deg, #f3f4f6 0%, #ffffff 26%);
  }
  #bookings-table tr.booking-status-cancelado {
    border-left: 5px solid #9ca3af;
    background: linear-gradient(90deg, #f8fafc 0%, #ffffff 26%);
  }
  #finance-table tr.finance-type-receita {
    border-left: 5px solid #16a34a;
    background: linear-gradient(90deg, #ecfdf5 0%, #ffffff 26%);
  }
  #finance-table tr.finance-type-despesa {
    border-left: 5px solid #dc2626;
    background: linear-gradient(90deg, #fef2f2 0%, #ffffff 26%);
  }

  #bookings-table td:nth-child(1)::before { content: 'Reserva'; }
  #bookings-table td:nth-child(2)::before { content: 'Hotel'; }
  #bookings-table td:nth-child(3)::before { content: 'Quarto'; }
  #bookings-table td:nth-child(4)::before { content: 'Hospede'; }
  #bookings-table td:nth-child(5)::before { content: 'Entrada'; }
  #bookings-table td:nth-child(6)::before { content: 'Saida'; }
  #bookings-table td:nth-child(7)::before { content: 'Total'; }
  #bookings-table td:nth-child(8)::before { content: 'Status'; }
  #bookings-table td:nth-child(9)::before { content: 'Acoes'; }

  #finance-table td:nth-child(1)::before { content: 'Data'; }
  #finance-table td:nth-child(2)::before { content: 'Hotel'; }
  #finance-table td:nth-child(3)::before { content: 'Tipo'; }
  #finance-table td:nth-child(4)::before { content: 'Descricao'; }
  #finance-table td:nth-child(5)::before { content: 'Valor'; }

  #hotels-table td:nth-child(1)::before { content: 'ID'; }
  #hotels-table td:nth-child(2)::before { content: 'Nome'; }
  #hotels-table td:nth-child(3)::before { content: 'Endereco'; }
  #hotels-table td:nth-child(4)::before { content: 'Telefone'; }
  #hotels-table td:nth-child(5)::before { content: 'Acoes'; }

  #bookings-table td:last-child button,
  #hotels-table td:last-child button {
    width: 100%;
    margin-top: 0.3rem;
  }
}
