* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #667eea;
  --primary-dark: #5568d3;
  --secondary: #764ba2;
  --success: #48bb78;
  --danger: #f56565;
  --warning: #ed8936;
  --info: #4299e1;
  --light: #f7fafc;
  --dark: #2d3748;
  --gray: #718096;
  --border: #e2e8f0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f7fafc;
  color: #2d3748;
  line-height: 1.6;
}

.dashboard {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg2) 100%);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  padding: 30px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
  font-size: 1.5em;
  font-weight: 700;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  color: white;
  text-decoration: none;
  transition: all 0.3s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.15);
  border-left-color: white;
}

.nav-item .icon {
  margin-right: 12px;
  font-size: 1.2em;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
  margin-bottom: 15px;
  font-size: 0.9em;
  opacity: 0.9;
}

.btn-logout {
  width: 100%;
  padding: 10px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 30px;
}

.header {
  margin-bottom: 30px;
}

.header h1 {
  font-size: 2em;
  color: #2d3748;
  margin-bottom: 10px;
}

/* Alert */
.alert {
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: none;
}

.alert.show {
  display: block;
  animation: slideDown 0.3s;
}

.alert.success {
  background: #e6fffa;
  color: #047857;
  border: 1px solid #6ee7b7;
}

.alert.error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.alert.info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Content Sections */
.content-section {
  display: none;
}

.content-section.active {
  display: block;
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

.section-header h2 {
  font-size: 1.5em;
  color: #2d3748;
}

.filter-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-group select {
  padding: 8px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.95em;
  cursor: pointer;
}

/* Form Card */
.form-card {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.form-card h2 {
  margin-bottom: 25px;
  color: #2d3748;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #4a5568;
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1em;
  transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group textarea {
  resize: vertical;
  font-family: inherit;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 25px;
  justify-content: flex-end;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Password visibility toggle */
.password-wrapper {
  position: relative;
  width: 100%;
}

.password-wrapper input {
  padding-right: 44px !important;
}

.toggle-password {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  opacity: 0.8;
  padding: 6px;
  line-height: 1;
}

.toggle-password:hover {
  opacity: 1;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #e2e8f0;
  color: #4a5568;
}

.btn-secondary:hover {
  background: #cbd5e0;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.9em;
}

/* Bookings Grid */
.bookings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.booking-card {
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s;
  border-left: 4px solid var(--primary);
}

.booking-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.booking-card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 15px;
}

.booking-card-title {
  font-size: 1.2em;
  font-weight: 600;
  color: #2d3748;
}

.booking-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.85em;
  font-weight: 500;
}

.badge-success {
  background: #d1fae5;
  color: #047857;
}

.badge-info {
  background: #dbeafe;
  color: #1e40af;
}

.booking-info {
  margin: 10px 0;
}

.info-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  color: #4a5568;
  font-size: 0.95em;
}

.info-row span:first-child {
  margin-right: 8px;
}

.booking-actions {
  display: flex;
  gap: 8px;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #e2e8f0;
}

/* Tables */
.table-container {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
}

th {
  padding: 15px;
  text-align: left;
  font-weight: 600;
}

td {
  padding: 15px;
  border-bottom: 1px solid #e2e8f0;
}

tbody tr:hover {
  background: #f7fafc;
}

.table-actions {
  display: flex;
  gap: 8px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.modal.show {
  display: flex;
  animation: fadeIn 0.25s ease;
}

.modal-content {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
  border-radius: 16px 16px 0 0;
}

.modal-header h2 {
  font-size: 1.15rem;
  color: #1a1a2e;
  font-weight: 700;
  margin: 0;
}

.modal-close {
  background: #f3f4f6;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.1rem;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.modal-close:hover {
  background: #e5e7eb;
  color: #1a1a2e;
}

.modal-content form {
  padding: 20px 24px 24px;
}

/* Mobile: modal ocupa tela toda na base */
@media (max-width: 600px) {
  .modal {
    padding: 0;
    align-items: flex-end;
  }
  .modal-content {
    border-radius: 20px 20px 0 0;
    max-height: 95vh;
    max-width: 100%;
  }
  .modal-header {
    border-radius: 20px 20px 0 0;
  }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #718096;
}

.empty-state-icon {
  font-size: 4em;
  margin-bottom: 15px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.3em;
  margin-bottom: 10px;
}

/* Responsive */
@media (max-width: 768px) {
  /* .dashboard é display:flex. Sem trocar a direção, a sidebar com
     width:100% vira um item de LINHA ao lado do conteúdo — os dois
     disputam a largura e a tela fica partida ao meio. Empilhar em
     coluna é o que transforma a sidebar numa barra superior. */
  .dashboard {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    position: relative;
    height: auto;
    flex: 0 0 auto;
  }

  /* Menu horizontal rolável, para não consumir meia tela em altura */
  .sidebar-nav {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    gap: 2px;
    padding: 4px 8px;
    scrollbar-width: none;
  }

  .sidebar-nav::-webkit-scrollbar { display: none; }

  .sidebar-nav .nav-item {
    flex: 0 0 auto;
    white-space: nowrap;
    border-left: none;
    border-bottom: 3px solid transparent;
    padding: 10px 12px;
    font-size: 0.85rem;
  }

  .sidebar-nav .nav-item.active {
    border-left: none;
    border-bottom-color: currentColor;
  }

  .sidebar-header {
    padding: 12px 16px 6px;
  }

  .sidebar-header h2 {
    font-size: 1rem;
  }

  .sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 16px 12px;
  }

  .sidebar-footer .user-info { margin: 0; font-size: 0.8rem; }
  .sidebar-footer .lang-switch { margin: 0; }
  .sidebar-footer .btn-logout { width: auto; padding: 7px 14px; }

  .main-content {
    margin-left: 0;
    padding: 20px;
  }

  .bookings-grid {
    grid-template-columns: 1fr;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .table-container {
    overflow-x: auto;
  }

  table {
    min-width: 600px;
  }
}

/* Logs Table */
.log-action {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.85em;
  font-weight: 500;
}

.log-action.create {
  background: #d1fae5;
  color: #047857;
}

.log-action.update {
  background: #dbeafe;
  color: #1e40af;
}

.log-action.delete {
  background: #fee2e2;
  color: #b91c1c;
}

.log-action.cancel {
  background: #fef3c7;
  color: #92400e;
}

.log-action.login,
.log-action.logout,
.log-action.register {
  background: #e9d5ff;
  color: #6b21a8;
}


/* ========== TOGGLE CARDS/LISTA ========== */

.view-toggle {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.toggle-btn {
  padding: 8px 16px;
  border: 1px solid #e2e8f0;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #4a5568;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.toggle-btn:hover {
  background: #f7fafc;
  border-color: #cbd5e0;
}

.toggle-btn.active {
  background: #3182ce;
  color: white;
  border-color: #3182ce;
}

/* ========== VISUALIZAÇÃO EM LISTA ========== */

.list-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list-view .booking-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 16px;
}

.list-view .booking-card-header {
  flex: 0 0 200px;
  margin-bottom: 0;
}

.list-view .booking-info {
  flex: 1;
  display: flex;
  flex-direction: row;
  gap: 24px;
  margin: 0;
}

.list-view .info-row {
  margin: 0;
}

.list-view .booking-actions {
  flex: 0 0 auto;
  margin: 0;
}

/* ========== FILTER GROUP COM TOGGLE ========== */

.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-group select,
.filter-group .btn {
  margin: 0;
}

.filter-group .view-toggle {
  margin-left: auto;
}


/* ========== MODAL DE TIPO DE RESERVA ========== */

.booking-type-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.booking-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
  border: 2px solid #e2e8f0;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.booking-type-btn:hover {
  border-color: #3182ce;
  background: #f7fafc;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(49, 130, 206, 0.15);
}

.booking-type-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.booking-type-title {
  font-size: 18px;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 8px;
  display: block;
}

.booking-type-desc {
  font-size: 14px;
  color: #718096;
  display: block;
}

/* ========== VISUALIZAÇÃO EM LISTA (NOVO LAYOUT) ========== */

.list-view-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Linha da lista ────────────────────────────────────────────
   5 colunas semânticas: Sala | Quando | Objetivo | Pessoa | Ações.
   Data+hora e nome+email foram agrupados: pertencem ao mesmo
   conceito e, empilhados, liberam largura para o objetivo — que
   antes ficava com um vão vazio enorme no meio da linha. */
.list-view-item {
  display: grid;
  grid-template-columns:
    minmax(166px, 1fr)      /* sala            */
    minmax(124px, 146px)    /* data + hora     */
    minmax(196px, 2.2fr)    /* objetivo        */
    minmax(186px, 1.3fr)    /* pessoa + email  */
    auto;                   /* ações           */
  gap: 18px;
  align-items: center;
  padding: 11px 16px;
  background: white;
  border: 1px solid #e8edf3;
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 56px;
}

.list-view-item:hover {
  border-color: #cbd5e0;
  border-left-color: var(--primary);
  box-shadow: 0 1px 6px rgba(16, 24, 40, 0.07);
}

/* Ícone de campo — marcador discreto que acompanha o valor.
   Largura fixa e flex:none para nunca comprimir o texto ao lado,
   e opacidade reduzida para não competir com o conteúdo. */
.list-ico {
  flex: 0 0 auto;
  display: inline-block;
  width: 1.05em;
  margin-right: 5px;
  font-size: 11.5px;
  line-height: 1;
  opacity: 0.65;
  text-align: center;
  vertical-align: baseline;
  font-style: normal;
}

/* Sala */
.list-room-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.list-room-label {
  font-size: 14.5px;
  font-weight: 650;
  color: #1a202c;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Recorrência: ícone compacto — ocupa largura fixa mínima para não
   disputar espaço com o nome da sala em telas estreitas. */
.list-recurring {
  flex: 0 0 auto;
  font-size: 13px;
  line-height: 1;
  cursor: help;
  opacity: 0.85;
}

/* Quando: data sobre hora, com dígitos alinhados entre as linhas */
.list-when {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.list-date {
  font-size: 13.5px;
  font-weight: 600;
  color: #2d3748;
  line-height: 1.3;
  white-space: nowrap;
}

.list-time {
  font-size: 12.5px;
  font-weight: 500;
  color: #718096;
  line-height: 1.3;
  white-space: nowrap;
}

/* Objetivo — o conteúdo principal da linha */
.list-purpose {
  display: flex;
  align-items: baseline;
  font-size: 13.5px;
  color: #4a5568;
  line-height: 1.4;
  min-width: 0;
}

/* Campos com ícone: o ícone fica fixo e o valor trunca.
   O texto precisa ser um elemento próprio — text-overflow não
   funciona no container flex, só no filho que carrega o texto. */
.list-date,
.list-time,
.list-user,
.list-email {
  display: flex;
  align-items: baseline;
  min-width: 0;
}

.list-txt {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-purpose:empty::before,
.list-purpose.is-empty {
  content: attr(data-empty);
  color: #a0aec0;
  font-style: italic;
}

/* Pessoa: nome sobre email/empresa */
.list-who {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.list-user {
  font-size: 13.5px;
  font-weight: 500;
  color: #2d3748;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-email {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-room,
.list-capacity {
  font-size: 13px;
  color: #718096;
}

/* Ícone de recorrência (visão em cards) */
.recurring-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #667eea;
  cursor: help;
  animation: rotate-icon 2s linear infinite;
}

/* Respeita quem pediu menos movimento no sistema */
@media (prefers-reduced-motion: reduce) {
  .recurring-icon { animation: none; }
}

@keyframes rotate-icon {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.booking-card-title .recurring-icon {
  margin-left: 8px;
  font-size: 18px;
}

/* Ações — discretas até o hover da linha */
.list-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex: none;
}

.list-actions .btn {
  margin: 0;
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 600;
  opacity: 0.92;
  transition: opacity 0.15s ease;
}

.list-view-item:hover .list-actions .btn {
  opacity: 1;
}

/* ── Responsividade da lista ─────────────────────────────────
   Princípio: nunca esconder informação, apenas reorganizar.
   Em cada degrau os mesmos 5 blocos continuam visíveis; o que
   muda é como se distribuem em linhas. */

/* Notebook: colunas mais justas, tudo ainda numa linha */
@media (max-width: 1280px) {
  .list-view-item {
    grid-template-columns:
      minmax(144px, 1fr)
      minmax(116px, 132px)
      minmax(166px, 2fr)
      minmax(150px, 1fr)
      auto;
    gap: 13px;
  }

  /* O email vira a segunda linha do bloco "pessoa" só quando
     não couber; aqui ainda cabe, então continua visível. */
  .list-email { font-size: 11.5px; }
}

/* Tablet: pessoa e objetivo descem para a segunda linha.
   Nada some — o objetivo ganha largura e a pessoa vai ao lado. */
@media (max-width: 1024px) {
  .list-view-item {
    grid-template-columns: minmax(0, 1fr) minmax(0, 128px) auto;
    grid-template-areas:
      "sala   quando acoes"
      "obj    obj    quem";
    row-gap: 7px;
    column-gap: 14px;
    align-items: center;
  }

  .list-room-name { grid-area: sala; }
  .list-when      { grid-area: quando; }
  .list-actions   { grid-area: acoes; align-self: start; }
  .list-purpose   { grid-area: obj; }
  .list-who       { grid-area: quem; align-items: flex-end; text-align: right; }
}

/* Celular em pé: uma coluna, blocos empilhados na ordem de leitura.
   Sala > quando > objetivo > pessoa > ações. */
@media (max-width: 768px) {
  .list-view-item {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "sala   quando"
      "obj    obj"
      "quem   acoes";
    row-gap: 8px;
    column-gap: 12px;
    padding: 12px 14px;
  }

  .list-when {
    text-align: right;
    align-items: flex-end;
  }

  /* No celular o objetivo pode ocupar 2 linhas. O clamp vai no
     texto, não no container, para o ícone seguir alinhado. */
  .list-purpose {
    align-items: flex-start;
  }

  .list-purpose .list-txt {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .list-who {
    align-items: flex-start;
    text-align: left;
    align-self: center;
  }

  .list-actions {
    justify-content: flex-end;
    align-self: center;
  }
}

/* Celular estreito (≤380px): ações passam para a linha inteira
   para não espremer o nome de quem reservou. */
@media (max-width: 380px) {
  .list-view-item {
    grid-template-areas:
      "sala   quando"
      "obj    obj"
      "quem   quem"
      "acoes  acoes";
  }

  .list-actions {
    justify-content: stretch;
  }

  .list-actions .btn {
    flex: 1;
  }
}


/* ========== SELETOR DE USUÁRIO COM AUTOCOMPLETE (V2.1.6) ========== */

.user-autocomplete-list {
  display: none;
  position: absolute;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-height: 300px;
  overflow-y: auto;
  width: 100%;
  z-index: 1000;
  margin-top: 4px;
}

.user-autocomplete-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f7fafc;
  transition: background 0.2s;
}

.user-autocomplete-item:last-child {
  border-bottom: none;
}

.user-autocomplete-item:hover {
  background: #f7fafc;
}

.user-autocomplete-item strong {
  display: block;
  color: #2d3748;
  font-size: 14px;
  margin-bottom: 2px;
}

.user-autocomplete-item small {
  color: #718096;
  font-size: 12px;
}

.user-autocomplete-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 4px 0;
}

.usage-badge {
  display: inline-block;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 6px;
  font-weight: 600;
  vertical-align: middle;
}

.form-group {
  position: relative;
}


/* ========== V2.1.8: ZONA DE PERIGO ========== */
.config-section {
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 24px;
}

.config-section h3 {
  margin-top: 0;
  margin-bottom: 16px;
  color: #1e293b;
  font-size: 18px;
}

.danger-zone {
  border: 2px solid #dc2626;
  border-radius: 8px;
  padding: 20px;
  background: #fef2f2;
}

.danger-zone p {
  margin: 8px 0;
}

.warning-text {
  color: #dc2626;
  font-weight: 600;
  font-size: 14px;
  margin: 12px 0 !important;
}

.help-text {
  color: #64748b;
  font-size: 13px;
  margin-top: 12px !important;
}

.btn-danger {
  background: #dc2626;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-danger:active {
  background: #991b1b;
}


/* ========== V2.1.8: VARIÁVEL DE COR DO TEMA ========== */
:root {
  --primary-color: #8b5cf6;
}

/* Aplicar cor primária em elementos principais */
.btn-primary {
  background: var(--primary-color) !important;
}

.nav-link.active {
  background: var(--primary-color) !important;
}

.badge-primary {
  background: var(--primary-color) !important;
}

/* Estilos do seletor de cor */
#theme-color-select {
  max-width: 300px;
}


:root {
  --sidebar-bg: #667eea;
  --sidebar-bg2: #764ba2;
}


/* Branding */
.brand-block{display:flex;align-items:center;gap:10px;}
.brand-logo{width:34px;height:34px;object-fit:contain;border-radius:6px;background:rgba(255,255,255,0.08);padding:4px;}
.brand-title{line-height:1.1;}
.brand-title .brand-top{display:block;font-weight:800;font-size:0.95em;}
.brand-title .brand-bottom{display:block;font-weight:700;font-size:0.95em;opacity:0.95;}


/* Compactar títulos */
.header h2#page-title{font-size:1.4em;font-weight:700;margin:0;}
.section-header h3{font-size:1.15em;margin:0;}
.form-card h3{font-size:1.2em;}
.form-card h4{font-size:1.05em;}


/* 🔄 Modal de escopo de recorrência (3 botões) */
.recurrence-scope-modal { display:none; position:fixed; inset:0; background: rgba(0,0,0,0.45); z-index: 9999; }
.recurrence-scope-modal .modal-content {
  background:#fff;
  width: min(520px, calc(100vw - 32px));
  margin: auto;
  border-radius: 16px;
  padding: 22px 22px 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
@media (max-width:600px) {
  .recurrence-scope-modal { align-items: flex-end !important; padding: 0 !important; }
  .recurrence-scope-modal .modal-content { border-radius: 20px 20px 0 0; width: 100%; }
}
.recurrence-scope-modal .modal-title { font-weight: 700; margin: 0 0 10px; font-size: 18px; }
.recurrence-scope-modal .modal-desc { color: #4a5568; margin: 0 0 14px; line-height: 1.35; }
.recurrence-scope-modal .modal-actions { display:flex; gap:10px; justify-content:flex-end; flex-wrap:wrap; }
.recurrence-scope-modal .btn-secondary { background:#e2e8f0; color:#2d3748; }

/* prioritize purpose over email */

/* === MODAL POLISH (v2.2.3-fix3) === */
/* Backdrop + centering already exist via .modal/.modal.show. This block improves spacing, alignment and animations. */
.modal-content {
  /* keep existing sizing, add breathing room */
  border-radius: 14px;
  overflow: hidden;
}

.modal-header {
  padding: 22px 28px;
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.modal-body {
  padding: 18px 28px 26px;
  text-align: center;
}

.modal-body p {
  margin: 8px 0;
  color: #4a5568;
  line-height: 1.45;
}

.modal-actions {
  margin-top: 18px;
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

/* Steps: smooth transitions */
.modal-step {
  display: none;
  opacity: 0;
  transform: translateY(6px);
}
.modal-step.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
  animation: modalStepIn 180ms cubic-bezier(.2,.8,.2,1);
}
@keyframes modalStepIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Buttons: consistent sizing + feel */
.modal .btn {
  min-width: 118px;
  padding: 10px 16px;
  border-radius: 10px;
}

/* Primary already uses theme vars (--primary/--secondary). Add subtle hover */
.btn-primary:hover {
  filter: brightness(0.96);
}
.btn-primary:active {
  transform: translateY(1px);
}
/* === /MODAL POLISH (v2.2.3-fix3) === */



/* === MODAL BUTTON TWEAK (v2.2.3-fix6) === */
.modal-actions .btn {
  text-align: center;
  font-weight: 700;
}
/* === /MODAL BUTTON TWEAK (v2.2.3-fix6) === */


/* === USERS SORT (v2.2.3-fix8.2) === */
.sortable-th { user-select: none; }
.sort-icon { margin-left: 6px; font-size: 12px; opacity: .65; }
.sort-icon.active { opacity: 1; }
.sortable-th:hover .sort-icon { opacity: 1; }
/* === /USERS SORT (v2.2.3-fix8.2) === */


/* === MODAL BUTTONS GLOBAL (stable-fix8.2.3) === */
.modal .btn, .modal-actions .btn {
  font-weight: 700;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.modal-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}
/* === /MODAL BUTTONS GLOBAL (stable-fix8.2.3) === */


/* === NOTICE ATTENTION ICON (stable-fix8.3) === */
@keyframes noticeBlink { 0% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(1.08); } 100% { opacity: 1; transform: scale(1); } }
.notice-attn {
  margin-left: 8px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  background: #facc15; /* amarelinho */
  color: #111827;
  box-shadow: 0 0 0 2px rgba(250,204,21,0.25);
  animation: noticeBlink 1s infinite;
}
/* === /NOTICE ATTENTION ICON (stable-fix8.3) === */


/* === NOTICE INDICATOR (stable-fix8.3.1) === */
@keyframes noticePulse { 0% { transform: scale(1); } 50% { transform: scale(1.12); } 100% { transform: scale(1); } }
.notice-indicator {
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  animation: noticePulse 1.1s infinite;
  filter: drop-shadow(0 0 6px rgba(250, 204, 21, 0.65));
}
/* === /NOTICE INDICATOR (stable-fix8.3.1) === */


/* === NOTICE INDICATOR (stable-fix8.3.2) === */
@keyframes noticeBlink2 { 0% { opacity: 1; } 50% { opacity: .35; } 100% { opacity: 1; } }
.notice-indicator{
  margin-left: 8px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #facc15;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px rgba(250,204,21,0.25);
  animation: noticeBlink2 1s infinite;
}
.notice-indicator::before{ content: '🔔'; font-size: 11px; line-height: 1; }
/* === /NOTICE INDICATOR (stable-fix8.3.2) === */


/* === NOTICE INDICATOR (stable-fix8.3.3) === */
@keyframes noticeBlink3 { 0% { opacity: 1; transform: scale(1);} 50% { opacity: .4; transform: scale(1.08);} 100% { opacity: 1; transform: scale(1);} }
.notice-indicator{
  margin-left: 8px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #facc15;
  color: #111827;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px rgba(250,204,21,0.25);
  animation: noticeBlink3 1s infinite;
}
.notice-indicator::before{ content:'🔔'; font-size: 11px; line-height: 1; }
/* === /NOTICE INDICATOR (stable-fix8.3.3) === */


.recurrence-impact-box{margin-top:16px;padding:14px 16px;border:1px solid #e5e7eb;border-radius:12px;background:#f8fafc;}
.recurrence-impact-box h4{margin:0 0 8px 0;font-size:15px;}
.recurrence-impact-dates{display:flex;flex-direction:column;gap:6px;margin-top:8px;max-height:180px;overflow-y:auto;}
.recurrence-impact-date-item{padding:8px 10px;border-radius:8px;background:#fff;border:1px solid #e5e7eb;font-size:13px;}
.recurrence-impact-more{margin-top:6px;font-size:12px;opacity:.8;}


/* === EDIT BOOKING MODAL RESPONSIVE (fix8.3.9.8) === */
#edit-booking-modal {
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#edit-booking-modal .modal-content {
  width: min(920px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#edit-booking-modal .modal-header {
  flex: 0 0 auto;
}

#edit-booking-modal form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 22px 28px 18px;
}

#edit-booking-modal .form-actions {
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  background: #fff;
  padding-top: 12px;
  margin-top: 12px;
  z-index: 2;
}

#edit-booking-modal .recurrence-impact-dates {
  max-height: 160px;
  overflow-y: auto;
}

#edit-booking-modal form {
  overflow-y: auto;
}

@media (max-height: 760px) {
  #edit-booking-modal .modal-content {
    max-height: 96vh;
  }

  #edit-booking-modal form {
    padding: 18px 22px 14px;
  }

  #edit-booking-modal .recurrence-impact-dates {
    max-height: 120px;
  }
}
/* === /EDIT BOOKING MODAL RESPONSIVE (fix8.3.9.8) === */

/* FIX8.4.11 / V2.2.5 - Polimento visual da barra de filtros em Todas as Reservas */
#todas-reservas .filter-group {
  gap: 10px;
  align-items: center;
}

#todas-reservas #filter-company {
  min-width: 175px;
  max-width: 175px;
}

#todas-reservas #filter-user-search {
  min-width: 160px;
  max-width: 160px;
}

#todas-reservas #filter-user {
  min-width: 185px;
  max-width: 185px;
}

#todas-reservas .view-toggle {
  margin-left: auto;
  align-self: center;
}


/* FIX8.4.12 / V2.2.6 - Gestão de empresas */
.company-status{display:inline-flex;align-items:center;padding:4px 10px;border-radius:999px;font-size:.85rem;font-weight:700;}
.company-status.active{background:rgba(34,197,94,.12);color:#166534;}
.company-status.inactive{background:rgba(239,68,68,.12);color:#991b1b;}
#companies-list .btn-sm{padding:6px 10px;font-size:.9rem;}
#gerenciar-empresas .info-text{color:#475569;}

/* Transfer-delete modal responsivo */
#transfer-delete-modal .modal-content {
  max-width: 520px !important;
}
@media (max-width:600px) {
  #transfer-delete-modal.modal { padding: 0; align-items: flex-end; }
  #transfer-delete-modal .modal-content { border-radius: 20px 20px 0 0; max-width: 100% !important; }
}

/* Confirm modal genérico responsivo */
.confirm-modal .modal-content {
  max-width: 420px;
}
@media (max-width:600px) {
  .confirm-modal.modal { padding: 0; align-items: flex-end; }
  .confirm-modal .modal-content { border-radius: 20px 20px 0 0; max-width: 100%; }
}

/* Botões no modal em mobile: empilhar */
@media (max-width:480px) {
  .modal-content .form-actions,
  .modal-content [style*="display:flex"][style*="gap"],
  .modal-actions {
    flex-direction: column !important;
  }
  .modal-content .form-actions button,
  .modal-actions button {
    width: 100%;
  }
}

/* =============================================
   MODAIS RESPONSIVOS — Flux v3.2
   ============================================= */

/* Base modal */
.modal {
  padding: 12px !important;
}

.modal-content {
  width: 100% !important;
  max-width: 620px;
  max-height: 92vh;
  overflow-y: auto;
  margin: auto;
  display: flex;
  flex-direction: column;
  border-radius: 16px !important;
}

/* Header fixo no topo ao rolar */
.modal-header {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 10;
  border-radius: 16px 16px 0 0;
  padding: 16px 20px !important;
  flex-shrink: 0;
}

.modal-header h2,
.modal-header h3 {
  font-size: 1rem !important;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 40px);
}

/* Form dentro do modal */
.modal-content form {
  padding: 16px 20px 20px !important;
  overflow-y: auto;
}

.modal-body {
  padding: 16px 20px 20px;
  overflow-y: auto;
}

/* form-row vira coluna em telas pequenas */
.form-row {
  display: flex;
  gap: 12px;
}

/* form-actions: botões sempre visíveis na base */
.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
  position: sticky;
  bottom: 0;
  background: #fff;
  z-index: 5;
  border-radius: 0 0 16px 16px;
}

.form-actions .btn {
  flex: 1;
  min-width: 100px;
  justify-content: center;
}

/* Recorrência scope modal */
.recurrence-scope-modal {
  align-items: center;
  justify-content: center;
  padding: 12px !important;
}

.recurrence-scope-modal .modal-content {
  max-width: 480px !important;
  border-radius: 16px !important;
  padding: 22px !important;
}

.modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.modal-actions .btn {
  flex: 1;
  min-width: 90px;
  justify-content: center;
  text-align: center;
}

/* Booking type modal */
.booking-type-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.booking-type-btn {
  flex: 1;
  min-width: 140px;
}

/* Transfer-delete modal */
#transfer-delete-modal .modal-content {
  max-width: 500px !important;
}

/* ── Telas até 1366px (17") ── */
@media (max-width: 1366px) {
  .modal-content {
    max-width: 560px;
    max-height: 88vh;
  }
  .modal-header h2,
  .modal-header h3 { font-size: 0.95rem !important; }
  .form-group label { font-size: 0.82rem; }
  input, select, textarea { font-size: 0.875rem; }
}

/* ── Telas até 1024px (tablets, laptops pequenos) ── */
@media (max-width: 1024px) {
  .modal { padding: 8px !important; }
  .modal-content { max-height: 90vh; }
  .form-row { flex-direction: column; gap: 8px; }
  .booking-type-options { flex-direction: column; }
  .booking-type-btn { min-width: auto; width: 100%; }
}

/* ── Telas até 768px (mobile/tablet) ── */
@media (max-width: 768px) {
  .modal {
    padding: 0 !important;
    align-items: flex-end !important;
  }
  .modal-content {
    border-radius: 20px 20px 0 0 !important;
    max-height: 95vh;
    max-width: 100% !important;
  }
  .modal-header {
    border-radius: 20px 20px 0 0 !important;
  }
  .recurrence-scope-modal {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  .recurrence-scope-modal .modal-content {
    border-radius: 20px 20px 0 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 20px !important;
  }
  .modal-actions .btn,
  .form-actions .btn {
    min-width: 0;
    font-size: 0.82rem;
    padding: 10px 12px;
  }
  #transfer-delete-modal .modal-content {
    max-width: 100% !important;
  }
}

/* ── Sidebar em telas pequenas ──────────────────────────────
   REMOVIDO: havia aqui um sistema antigo (1200px/900px) que
   encolhia a sidebar com `!important`. Ele competia com o modo
   rail (controlado por layout.js) e vencia por causa do
   !important, produzindo estados híbridos: sidebar de 60px
   exibindo texto, ou de 200px exibindo só ícones.
   O modo rail agora é a única implementação — veja
   "MODO RAIL" mais abaixo. Apenas o ajuste de fonte dos
   filtros foi preservado. */
@media (max-width: 1200px) {
  .sidebar .nav-item {
    font-size: 0.86rem;
  }
}

/* ── Filtros de reservas responsivos ── */
@media (max-width: 1100px) {
  .filter-group {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .filter-group select,
  .filter-group input {
    min-width: 100px !important;
    font-size: 0.8rem !important;
  }
}

/* ── Tabelas responsivas ── */
@media (max-width: 900px) {
  .data-table {
    font-size: 0.78rem;
  }
  .data-table th,
  .data-table td {
    padding: 8px 10px !important;
  }
}

/* ── Cards de reserva responsivos ── */
@media (max-width: 768px) {
  .bookings-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ── Configurações tabs em telas pequenas ── */
@media (max-width: 700px) {
  .config-tabs-header {
    gap: 2px !important;
  }
  .config-tab {
    padding: 8px 10px !important;
    font-size: 0.78rem !important;
  }
  .backup-info-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .cal-provider-grid {
    grid-template-columns: 1fr !important;
  }
}


/* =============================================
   LOGS DE ATIVIDADES — Estilos melhorados
   ============================================= */

.log-action-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
}

.log-success  { background: #d1fae5; color: #065f46; }
.log-danger   { background: #fee2e2; color: #991b1b; }
.log-warning  { background: #fef3c7; color: #92400e; }
.log-info     { background: #dbeafe; color: #1e40af; }
.log-neutral  { background: #f3f4f6; color: #4b5563; }

/* Célula de detalhes com campos formatados */
.log-details-cell {
  font-size: 0.82rem;
  color: #374151;
  line-height: 1.8;
}

.log-detail-part {
  display: inline-block;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 1px 6px;
  margin: 2px 3px 2px 0;
  font-size: 0.78rem;
}

.log-detail-part strong {
  color: #6b7280;
  font-weight: 600;
  margin-right: 3px;
}

.log-detail-plain {
  color: #4b5563;
}

.log-table td {
  vertical-align: top;
  padding: 10px 12px !important;
}

.log-table tbody tr:hover {
  background: #f8faff;
}

/* Responsivo logs */
@media (max-width: 768px) {
  .log-details-cell .log-detail-part {
    display: block;
    margin: 2px 0;
  }
}

/* ============================================================
   LAYOUT RESPONSIVO — PAISAGEM DE CELULAR (v3.3.1)
   ------------------------------------------------------------
   Motivo: celular deitado tem ~800-950px de largura, então nunca
   entrava no breakpoint de 768px e herdava o layout de desktop
   (sidebar fixa 260px + altura 100vh), quebrando menu e conteúdo.
   ============================================================ */

/* 1) Correção global: tabelas nunca mais são cortadas.
      Antes, .table-container tinha overflow:hidden e o overflow-x:auto
      só existia dentro do @media 768px — por isso a visão "Lista"
      quebrava em paisagem e em telas intermediárias. */
.table-container {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.table-container > table {
  min-width: 640px; /* garante colunas legíveis; o container rola */
}

/* 2) Cards nunca estouram a largura disponível */
.bookings-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
}

/* Botões de ação dentro dos cards quebram linha em vez de vazar */
.booking-card-actions,
.booking-card .card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Cabeçalhos de seção com filtros: permitem quebra */
.section-header .filter-group {
  flex-wrap: wrap;
}

/* ── Botão flutuante do menu e fundo escuro (criados por layout.js) ── */
#flux-sidebar-toggle {
  display: none;
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 10001;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: var(--sidebar-bg, #1a2744);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

#flux-sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9998;
}

/* ── Modo "rail": paisagem de celular ───────────────────────── */
body.flux-rail-mode #flux-sidebar-toggle {
  display: block;
}

/* Não flutuar por cima de modais abertos (modais usam z-index 1000/9999) */
body.flux-rail-mode:has(.modal.show) #flux-sidebar-toggle,
body.flux-rail-mode:has(.recurrence-scope-modal.show) #flux-sidebar-toggle,
body.flux-rail-mode:has(#recurrence-extend-modal.show) #flux-sidebar-toggle {
  display: none;
}

/* Sidebar vira uma faixa estreita só com ícones */
body.flux-rail-mode .sidebar {
  width: 56px;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 9999;
  transition: width 0.22s ease;
  padding-top: 52px; /* espaço para o botão ☰ não cobrir o 1º item */
}

/* Esconde textos, mantém ícones centralizados */
body.flux-rail-mode .sidebar .sidebar-header,
body.flux-rail-mode .sidebar .sidebar-footer .user-info,
body.flux-rail-mode .sidebar .nav-item > span:not(.icon),
body.flux-rail-mode .sidebar .btn-logout,
body.flux-rail-mode .sidebar select[data-language-selector] {
  display: none;
}

body.flux-rail-mode .sidebar .nav-item {
  justify-content: center;
  padding: 12px 0;
  border-left-width: 3px;
}

body.flux-rail-mode .sidebar .nav-item .icon {
  margin-right: 0;
  font-size: 1.25em;
}

body.flux-rail-mode .sidebar-nav {
  padding: 6px 0;
}

/* Conteúdo ocupa o espaço liberado */
body.flux-rail-mode .main-content {
  margin-left: 56px;
  padding: 12px 14px;
}

body.flux-rail-mode .header {
  margin-bottom: 12px;
}

body.flux-rail-mode .header h2 {
  font-size: 1.15em;
}

/* ── Sidebar expandida por cima do conteúdo ── */
body.flux-rail-mode.flux-rail-open .sidebar {
  width: 240px;
}

/* Ao expandir, cada elemento volta ao seu display próprio.
   Evitamos `revert` aqui: o suporte é irregular e uma falha dele
   deixa a sidebar estreita exibindo texto quebrado. */
body.flux-rail-mode.flux-rail-open .sidebar .sidebar-header,
body.flux-rail-mode.flux-rail-open .sidebar .sidebar-footer .user-info {
  display: block;
}

body.flux-rail-mode.flux-rail-open .sidebar .nav-item > span:not(.icon) {
  display: inline;
}

body.flux-rail-mode.flux-rail-open .sidebar .btn-logout,
body.flux-rail-mode.flux-rail-open .sidebar select[data-language-selector] {
  display: block;
}

/* Nada de texto quebrando em "Adm / Pane" enquanto a largura anima */
body.flux-rail-mode .sidebar .sidebar-header h2,
body.flux-rail-mode .sidebar .nav-item {
  white-space: nowrap;
}

body.flux-rail-mode .sidebar .nav-item > span:not(.icon) {
  overflow: hidden;
  text-overflow: ellipsis;
}

body.flux-rail-mode.flux-rail-open .sidebar .nav-item {
  justify-content: flex-start;
  padding: 11px 16px;
}

body.flux-rail-mode.flux-rail-open .sidebar .nav-item .icon {
  margin-right: 12px;
}

body.flux-rail-mode.flux-rail-open #flux-sidebar-scrim {
  display: block;
}

/* Densidade: aproveita melhor a altura reduzida */
body.flux-rail-mode .booking-card {
  padding: 12px 14px;
}

body.flux-rail-mode .bookings-grid {
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
}

body.flux-rail-mode .section-header {
  gap: 8px;
}

body.flux-rail-mode .stats-row {
  gap: 10px;
}

/* Modais precisam caber em ~400px de altura */
body.flux-rail-mode .modal-content {
  max-height: 88vh;
  overflow-y: auto;
}

/* ── Visão "Lista" em paisagem ──────────────────────────────
   Duas linhas, mantendo TODOS os blocos visíveis: o rail já
   devolveu ~200px de largura, o que permite manter a pessoa. */
body.flux-rail-mode .list-view-item {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 122px) minmax(0, auto);
  grid-template-areas:
    "sala  quando acoes"
    "obj   obj    quem";
  row-gap: 5px;
  column-gap: 12px;
  padding: 9px 12px;
  min-height: 0;
}

body.flux-rail-mode .list-room-name { grid-area: sala; }
body.flux-rail-mode .list-when      { grid-area: quando; }
body.flux-rail-mode .list-purpose   { grid-area: obj; white-space: nowrap; }

body.flux-rail-mode .list-who {
  grid-area: quem;
  align-items: flex-end;
  text-align: right;
}

body.flux-rail-mode .list-actions {
  grid-area: acoes;
  justify-content: flex-end;
  gap: 6px;
  align-self: start;
}

body.flux-rail-mode .list-actions .btn {
  padding: 5px 10px;
  font-size: 12px;
}

body.flux-rail-mode .list-email { display: block; font-size: 11px; }

/* Nada estoura a coluna — trunca com reticências */
body.flux-rail-mode .list-room-label,
body.flux-rail-mode .list-txt {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.flux-rail-mode .list-ico {
  font-size: 10.5px;
  margin-right: 4px;
}

body.flux-rail-mode .list-view-container {
  gap: 6px;
}

/* Paisagem muito baixa (ex.: iPhone SE deitado) — aperta um pouco mais.
   Classe aplicada pelo layout.js, não por @media, para não haver duas
   fontes de verdade discordando. */
body.flux-rail-tight .main-content {
  padding: 8px 10px;
}

body.flux-rail-tight .booking-card {
  padding: 10px 12px;
}

body.flux-rail-tight .header h2 {
  font-size: 1.05em;
}

/* ── Seletor de idioma: bandeiras redondas ───────────────────
   A selecionada fica levemente maior e com anel de destaque. */
.lang-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}

.lang-flag {
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  line-height: 0;
  cursor: pointer;
  opacity: 0.55;
  transform: scale(1);
  transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Bandeira desenhada em SVG, não emoji: o Windows não renderiza
   emoji de bandeira — mostra as duas letras do país no lugar.
   O SVG preenche o botão e o border-radius recorta em círculo. */
.lang-flag svg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.lang-flag:hover {
  opacity: 0.85;
}

.lang-flag[aria-pressed="true"] {
  opacity: 1;
  transform: scale(1.2);
  background: rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.lang-flag:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .lang-flag { transition: none; }
}

/* No login o fundo é claro — anel escuro para haver contraste */
.login-form .lang-switch { justify-content: flex-end; margin-bottom: 4px; }

.login-form .lang-flag {
  background: rgba(0, 0, 0, 0.06);
}

.login-form .lang-flag[aria-pressed="true"] {
  background: rgba(0, 0, 0, 0.10);
  box-shadow: 0 0 0 2px rgba(45, 55, 72, 0.35);
}

/* Em paisagem a sidebar vira rail: as bandeiras somem junto com
   o resto dos rótulos e voltam quando ela é expandida. */
body.flux-rail-mode .sidebar .lang-switch { display: none; }
body.flux-rail-mode.flux-rail-open .sidebar .lang-switch { display: flex; }

/* ── Convidados em reservas (v3.5.0) ─────────────────────────── */

.guest-picker {
  position: relative;
  display: none;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.10);
  max-height: 220px;
  overflow-y: auto;
  z-index: 30;
}

.guest-picker.is-open { display: block; }

.guest-option {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
}

.guest-option:last-child { border-bottom: none; }
.guest-option:hover { background: #f7fafc; }

.guest-option.is-empty {
  cursor: default;
  color: #a0aec0;
  font-style: italic;
  font-size: 13px;
}

.guest-option-name { font-size: 13.5px; font-weight: 500; color: #2d3748; }
.guest-option-mail { font-size: 11.5px; color: #94a3b8; }

.guest-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.guest-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  font-size: 12.5px;
  color: #3730a3;
}

.guest-chip-x {
  border: none;
  background: transparent;
  color: #6366f1;
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
  border-radius: 50%;
}

.guest-chip-x:hover { background: rgba(99, 102, 241, 0.15); }

/* Cards de convite recebido */
.invite-card { border-left-color: #8b5cf6; }

.invite-card.invite-pending {
  border-left-color: #f59e0b;
  background: #fffdf7;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

/* Lista de convidados dentro de uma reserva */
.guest-list-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.guest-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  border: 1px solid transparent;
}

.guest-pill--pending  { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.guest-pill--accepted { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.guest-pill--declined { background: #fee2e2; color: #991b1b; border-color: #fecaca; text-decoration: line-through; }

/* Reserva em que o usuário é apenas convidado */
.badge-guest {
  background: #ede9fe;
  color: #5b21b6;
}

.booking-card:has(.badge-guest) {
  border-left-color: #8b5cf6;
}

/* Contador de convites pendentes no menu */
#invite-indicator {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #f59e0b;
  color: #422006;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  align-items: center;
  justify-content: center;
}

/* Atalhos de convite por empresa no seletor de convidados */
.guest-option--grupo {
  background: #f8fafc;
}

.guest-option--grupo:hover {
  background: #eef2ff;
}

.guest-grupo-tag {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #4338ca;
  background: #e0e7ff;
  border-radius: 4px;
  padding: 1px 5px;
  margin-right: 6px;
  vertical-align: 1px;
}

.guest-chip-count {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: #1e3a6f;
  color: #fff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
