:root {
  color-scheme: dark;
  --primary-color: #f4ca72;
  --primary-dark: #d9ac52;
  --secondary-color: #191714;
  --bg-color: #090807;
  --card-bg: #171410;
  --border-color: #403526;
  --accent: #f4ca72;
  --danger: #ef4444;
  --warning: #f97316;
  --text: #f4eee3;
  --text-muted: #bfb3a0;
  --white: #ffffff;
  --radius-xl: 18px;
  --shadow-soft: 0 18px 45px rgba(25,23,20, 0.7);
}

/* ===== Reset básico ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #302518 0, #090807 55%);
  color: var(--text);
}

/* ===== Header / Nav ===== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  background: linear-gradient(90deg, rgba(25,23,20, 0.98), rgba(145,111,53, 0.7));
  border-bottom: 1px solid rgba(189,163,115, 0.25);
}

.app-nav {
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--white);
}

.logo-img {
  display: block;
  width: 180px;
  max-width: 100%;
  height: auto;
  flex-shrink: 0;
  object-fit: contain;
}

.logo-text span {
  font-weight: 600;
  letter-spacing: 0.03em;
}

.logo-text small {
  display: block;
  font-size: 0.8rem;
  color: rgba(222,212,196, 0.9);
}

.tabs-in-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.header-right {
  display: flex;
  align-items: center;
  margin-left: 12px;
}

/* ===== Botões ===== */
.btn {
  border-radius: 999px;
  padding: 9px 16px;
  border: 1px solid transparent;
  background: var(--primary-color);
  color: var(--bg-color);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: 0.15s ease-in-out;
}

.btn i {
  font-size: 1rem;
}

.btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 12px 25px rgba(244,202,114, 0.55);
}

.btn-light {
  background: transparent;
  border-color: rgba(189,163,115, 0.8);
  color: var(--text);
}

.btn-light:hover {
  background: rgba(25,23,20, 0.8);
}

.btn-warning {
  background: var(--warning);
  color: #171410;
}

.btn-warning:hover {
  background: #ea580c;
}

.btn-del {
  background: var(--danger);
  color: var(--white);
}

.btn-del:hover {
  background: #b91c1c;
}

.btn-edit {
  background: var(--primary-color);
}

.btn-edit:hover {
  background: var(--primary-dark);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
}

/* NOVO: botão ícone (editar / excluir) mais alinhado */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border-radius: 999px;
  gap: 6px;
  white-space: nowrap;
}

.btn-icon i {
  font-size: 1.05rem;
}

/* ===== Tabs ===== */
.tab-btn {
  border-radius: 999px;
  padding: 8px 16px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(244,238,227, 0.9);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: 0.15s;
}

.tab-btn i {
  font-size: 1.1rem;
}

.tab-btn:hover {
  background: rgba(25,23,20, 0.7);
}

.tab-btn.active {
  background: linear-gradient(135deg, #f7d998, var(--primary-color));
  color: #191714;
  box-shadow: 0 12px 30px rgba(25,23,20, 0.55);
}

/* ===== Layout principal ===== */
.page-main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.section-header h1 {
  margin: 0;
  font-size: 1.6rem;
  color: var(--white);
}

.section-header p {
  margin: 4px 0 16px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ===== Cards ===== */
.card {
  background: radial-gradient(circle at top left, rgba(181,133,50, 0.38) 0, rgba(25,23,20, 0.98) 40%);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(189,163,115, 0.2);
  box-shadow: var(--shadow-soft);
  margin-bottom: 16px;
}

.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(189,163,115, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-header h2,
.card-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--white);
}

.card-body {
  padding: 16px;
}

/* ===== Formulários ===== */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.field input,
.field select,
.field textarea {
  border-radius: 999px;
  border: 1px solid rgba(189,163,115, 0.6);
  background: rgba(25,23,20, 0.9);
  color: var(--white);
  padding: 9px 12px;
  font-size: 0.9rem;
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 1px rgba(244,202,114, 0.7);
}

.form-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.form-row:nth-child(1) {
  grid-template-columns: 2fr 1fr;
}

.form-row:last-child {
  grid-template-columns: 1fr;
}

/* NOVO: alinhamento de linha com 4 campos (quando for horário de trabalho) */
.form-row.row-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* NOVO: input type file (foto do profissional / png, jpeg) */
.field input[type="file"] {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px dashed rgba(189,163,115, 0.7);
  background: rgba(9,8,7, 0.6);
  cursor: pointer;
}

.field input[type="file"]::file-selector-button {
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  margin-right: 10px;
  background: rgba(244,202,114, 0.9);
  color: var(--bg-color);
  font-weight: 600;
  cursor: pointer;
}

.field input[type="file"]::file-selector-button:hover {
  background: rgba(181,133,50, 0.95);
}

/* NOVO: mini preview de imagem */
.img-preview {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.img-preview .thumb {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255, 0.08);
}

.img-preview .img-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ===== Grid Clientes ===== */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr);
  gap: 16px;
}

.left-column,
.right-column {
  min-width: 0;
}

/* KPIs */
.kpis,
.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.kpi {
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(181,133,50, 0.18), rgba(25,23,20, 0.96));
  border: 1px solid rgba(210,169,90, 0.45);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kpi-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--white);
}

/* ===== Toolbar Agenda / Relatórios ===== */
.toolbar,
.reports-toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  align-items: end;
}

.actions-field .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ===== Tabelas ===== */
.table-wrapper {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th,
.table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(145,111,53, 0.55);
  text-align: left;
  vertical-align: middle;
}

.table thead th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.table tbody tr:hover {
  background: rgba(25,23,20, 0.85);
}

.loading-row {
  text-align: center;
  color: var(--text-muted);
}

/* NOVO: células com ações alinhadas */
.table-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
}

.table-actions .btn {
  box-shadow: none;
}

.table-actions .btn:hover {
  transform: translateY(-1px);
}

/* Pagamentos resumo */
.payments-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

/* ===== Filtros de clientes ===== */
.client-list-controls {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.filter-tabs {
  display: inline-flex;
  gap: 6px;
  background: rgba(25,23,20, 0.8);
  border-radius: 999px;
  padding: 3px;
}

.filter-tab-btn {
  border-radius: 999px;
  border: 0;
  padding: 5px 12px;
  font-size: 0.8rem;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.filter-tab-btn.active {
  background: var(--primary-color);
  color: var(--bg-color);
}

.search-box {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(189,163,115, 0.6);
  background: rgba(25,23,20, 0.9);
}

.search-box input {
  border: 0;
  background: transparent;
  color: var(--white);
  font-size: 0.9rem;
  outline: none;
}

.search-box i {
  color: var(--text-muted);
}

/* ===== Agenda ===== */
.agenda-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.timeslot {
  border-radius: 16px;
  border: 1px solid rgba(189,163,115, 0.2);
  padding: 10px 12px;
  background: radial-gradient(circle at top, rgba(181,133,50, 0.2), rgba(25,23,20, 0.98));
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.timeslot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timeslot-hour {
  font-weight: 600;
  color: var(--white);
}

.timeslot-badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(189,163,115, 0.4);
  color: var(--text-muted);
}

.timeslot-body {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.timeslot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

/* NOVO: bloco “horário bloqueado” (fica bonito dentro do slot) */
.timeslot-blocked {
  border-radius: 12px;
  padding: 10px;
  background: rgba(239,68,68, 0.08);
  border: 1px solid rgba(239,68,68, 0.25);
  color: rgba(248,250,252, 0.92);
}

.timeslot-prof {
  margin-top: 6px;
  font-size: 0.8rem;
  color: rgba(189,163,115, 0.95);
}

/* ===== Chart legend ===== */
.chart-legend {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.8rem;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(25,23,20, 0.9);
}

.chart-legend-color {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(25,23,20, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}

#authVerifyEmail[hidden] {
  display: none;
}

.modal-dialog {
  width: 100%;
  max-width: 480px; /* ajustei um pouco pra caber forms de edição */
  background: #171410;
  border-radius: 18px;
  border: 1px solid rgba(189,163,115, 0.4);
  box-shadow: 0 22px 55px rgba(25,23,20, 0.85);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
}

.modal-header,
.modal-footer {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(189,163,115, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.modal-footer {
  border-top: 1px solid rgba(189,163,115, 0.25);
  border-bottom: 0;
}

.modal-body {
  padding: 14px 16px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-dialog:has(.client-message-form) {
  max-width: 680px;
}

.modal-dialog:has(.client-message-form) .modal-header h3 {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 1.05rem;
}

.modal-dialog:has(.client-message-form) .modal-footer {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.modal-dialog:has(.client-message-form) .modal-footer .btn {
  min-height: 44px;
}

.client-message-form {
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.client-message-form .field {
  min-width: 0;
}

.client-message-form [hidden] {
  display: none;
}

.client-message-form input,
.client-message-form select,
.client-message-form textarea {
  width: 100%;
  min-width: 0;
}

.client-message-form textarea {
  border-radius: 12px;
  resize: vertical;
  line-height: 1.5;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 400;
  height: clamp(180px, 30dvh, 320px);
  min-height: 140px;
}

.client-message-form input,
.client-message-form select {
  min-height: 44px;
  border-radius: 12px;
  font-family: inherit;
}

.client-message-form p {
  overflow-wrap: anywhere;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

@media (max-width: 480px) {
  .modal {
    padding: 8px;
  }

  .modal-dialog {
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
  }

  .modal-dialog:has(.client-message-form) .modal-footer .btn {
    flex: 1 1 0;
    white-space: normal;
  }
}

#clientesMain .timeslot-actions .btn {
  min-height: 44px;
}

.month-appointments {
  display: grid;
  gap: 12px;
  max-height: 60vh;
  overflow-y: auto;
  margin-top: 12px;
}

.month-appointment {
  padding: 12px;
  border: 1px solid rgba(189,163,115, 0.25);
  border-radius: 10px;
  overflow-wrap: anywhere;
}

.modal-close {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
}

/* NOVO: modal com conteúdo maior (se você quiser usar no JS) */
.modal-dialog.modal-lg {
  max-width: 720px;
}

/* ===== Notificações ===== */
#notification-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notification {
  min-width: 240px;
  background: #171410;
  border-radius: 999px;
  border: 1px solid rgba(189,163,115, 0.5);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
}

.notification.success {
  border-color: rgba(34,197,94, 0.7);
}

.notification.error {
  border-color: rgba(239,68,68, 0.8);
}

/* ===== Gate de Login ===== */
.auth-gate {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4000;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: #171410;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0,0,0, 0.8);
  padding: 22px;
  display: grid;
  gap: 10px;
  border: 1px solid rgba(189,163,115, 0.6);
}

.auth-card h2 {
  margin: 0;
  color: var(--white);
  font-size: 1.3rem;
}

.auth-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 6px;
}

.auth-card label {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-card input {
  border-radius: 999px;
  border: 1px solid rgba(189,163,115, 0.7);
  background: #090807;
  color: var(--white);
  padding: 9px 11px;
}

.btn-auth {
  margin-top: 6px;
  background: var(--primary-color);
  color: #f9fafb;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-auth:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.auth-error {
  min-height: 1.1em;
  font-size: 0.86rem;
  color: #f87171;
}

/* ===== Util ===== */
.hidden {
  display: none !important;
}

.hidden-block {
  display: none;
}

/* ===== Responsivo ===== */
@media (max-width: 960px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .kpis,
  .kpi-row {
    grid-template-columns: 1fr;
  }
  .toolbar,
  .reports-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .app-nav {
    flex-wrap: wrap;
  }
  .tabs-in-header {
    order: 2;
    width: 100%;
    justify-content: center;
  }
  .header-right {
    order: 3;
    width: 100%;
    justify-content: flex-end;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .toolbar,
  .reports-toolbar {
    grid-template-columns: 1fr;
  }
}

/* ===== Modal de seleção de serviços ===== */
.servicos-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(25,23,20, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999; /* acima do #mainModal */
}

.servicos-modal-box {
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  background: #090807;
  border-radius: 16px;
  border: 1px solid rgba(189,163,115, 0.5);
  box-shadow: 0 24px 60px rgba(0,0,0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.servicos-modal-header {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(145,111,53, 0.5);
  font-weight: 600;
  color: #f4eee3;
}

.servicos-modal-body {
  padding: 12px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.servicos-search input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(189,163,115, 0.5);
  background: #090807;
  color: #f4eee3;
  font-size: 0.9rem;
  outline: none;
}

.servicos-search input::placeholder {
  color: #ac9e89;
}

.servicos-list {
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 4px;
}

.servico-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 10px;
  border: none;
  background: transparent;
  color: #f4eee3;
  cursor: pointer;
  font-size: 0.9rem;
  border-radius: 10px;
  transition: background 0.15s ease, transform 0.1s ease;
}

.servico-item + .servico-item {
  margin-top: 4px;
}

.servico-item:hover {
  background: radial-gradient(circle at top left, #44331b, #090807);
  transform: translateY(-1px);
}

.servico-nome {
  flex: 1;
  text-align: left;
}

.servico-valor {
  font-weight: 600;
  font-size: 0.85rem;
  opacity: 0.9;
}

/* Deixa claro que o campo de serviço é clicável */
#newServico,
#editServico {
  cursor: pointer;
}

/* ===== Relatórios: gráficos lado a lado ===== */
.reports-charts {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: stretch;
}

.report-chart-block {
  flex: 1 1 320px;
  max-width: 50%;
  display: flex;
  flex-direction: column;
}

.report-chart-block canvas {
  max-height: 260px;
}

.report-chart-block.report-chart-block-full {
  flex-basis: 100%;
  max-width: 100%;
}

.chart-title-sm {
  font-size: 0.9rem;
  font-weight: 500;
  color: #f4eee3;
  margin-bottom: 4px;
}

@media (max-width: 900px) {
  .report-chart-block {
    max-width: 100%;
  }
}

/* === PDV / Produtos === */
.grid-pdv {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr);
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .grid-pdv {
    grid-template-columns: minmax(0, 1fr);
  }
}

.card-product-report {
  margin-top: 1.5rem;
}

.small-muted {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: #bfb3a0;
}

/* Garantir espaçamento entre cards da área de relatórios */
#reportsMain .card + .card {
  margin-top: 1rem;
}

/* Ajuste leve na tabela do PDV */
#pdvProductsTbody .btn.btn-sm {
  padding: 4px 8px;
  font-size: 0.8rem;
}

/* ====== Gestão / Resumo geral ====== */
.card-management {
  margin-top: 24px;
}

.card-management .card-subtitle {
  margin-top: 4px;
  font-size: 0.85rem;
  color: #bfb3a0;
}

.kpis-gestao {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.kpi-gestao .kpi-label {
  font-size: 0.8rem;
  opacity: 0.9;
}

.kpi-gestao .kpi-value {
  font-size: 1.1rem;
}

.management-subsection {
  margin-top: 0.5rem;
}

.table.table-sm th,
.table.table-sm td {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

/* ====== Saídas / Despesas ====== */
.card-expenses {
  margin-top: 20px;
}

.expense-form .form-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.expense-form .field {
  flex: 1;
  min-width: 150px;
}

.btn-expense-save {
  width: 100%;
}

@media (max-width: 768px) {
  .expense-form .form-row {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-expense-save {
    width: 100%;
  }
}

/* ===== Configurações (novo) ===== */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 980px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.thumb {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(255,255,255, 0.08);
}

.muted {
  opacity: 0.78;
}

/* ===========================
   NOVO: Calendário semanal / Dias de trabalho
   (vai servir pra quando você adicionar no HTML/JS)
   =========================== */
.weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.weekday-chip {
  border-radius: 999px;
  padding: 8px 10px;
  border: 1px solid rgba(189,163,115, 0.35);
  background: rgba(9,8,7, 0.55);
  color: rgba(244,238,227, 0.92);
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: 0.15s ease-in-out;
  user-select: none;
}

.weekday-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(244,202,114, 0.7);
  box-shadow: 0 12px 26px rgba(244,202,114, 0.22);
}

.weekday-chip.active {
  background: rgba(34,197,94, 0.18);
  border-color: rgba(34,197,94, 0.65);
  color: rgba(240,253,244, 0.95);
}

@media (max-width: 720px) {
  .weekdays {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* NOVO: bloco de “intervalos” (ex.: manhã/tarde ou múltiplos turnos) */
.shift-block {
  margin-top: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(189,163,115, 0.22);
  background: rgba(9,8,7, 0.35);
}

.shift-block .shift-title {
  font-size: 0.9rem;
  color: rgba(244,238,227, 0.92);
  font-weight: 600;
  margin: 0 0 10px;
}

.shift-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 720px) {
  .shift-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================
   SIDEBAR (ADICIONADO)
   ========================= */

:root {
  --sidebar-width: 260px;
  --topbar-height: 70px;
}

/* overlay mobile */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9,8,7, 0.7);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: 0.25s;
  z-index: 998;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: #090807;
  border-right: 1px solid rgba(189,163,115, 0.2);
  box-shadow: 10px 0 30px rgba(0,0,0, 0.6);
  z-index: 999;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  transition: 0.25s;
}

/* topo */
.sidebar-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
}

.sidebar-top .logo {
  width: 100%;
  min-width: 0;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

.sidebar-top .logo-img {
  width: 100%;
}

.sidebar-top .logo-text span {
  display: block;
  font-size: 15px;
  line-height: 1.5;
}

.sidebar-top .close-sidebar {
  position: absolute;
  right: 0;
  top: 0;
  transform: translateY(-50%);
  background: var(--bg-color);
  border-radius: 50%;
}

/* menu */
.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
}

.sidebar .tab-btn {
  width: 100%;
  justify-content: flex-start;
  padding: 12px;
  border-radius: 12px;
}

/* topbar */
.topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 900;
  background: rgba(25,23,20, 0.95);
  border-bottom: 1px solid rgba(189,163,115, 0.2);
}

/* botão menu */
.menu-btn,
.close-sidebar {
  border: none;
  background: transparent;
  color: var(--white);
  font-size: 1.4rem;
  cursor: pointer;
}

/* layout */
.layout {
  min-height: 100vh;
}

/* =========================
   DESKTOP
   ========================= */
@media (min-width: 961px) {

  .menu-btn,
  .close-sidebar,
  .sidebar-overlay {
    display: none;
  }

  .topbar {
    padding-left: calc(var(--sidebar-width) + 20px);
  }

  .page-main {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
  }
}

/* =========================
   MOBILE
   ========================= */
@media (max-width: 960px) {

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.active {
    transform: translateX(0);
  }
}


/* =========================
   CONTAS A PAGAR
   ========================= */

#contasapagarMain .kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#contasapagarMain .card-header h2 {
  overflow-wrap: anywhere;
}

#contasapagarMain {
  max-width: none;
}

#contasapagarMain .grid {
  grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr);
  align-items: start;
}

#contasapagarMain .right-column {
  container-type: inline-size;
}

.cp-list-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#contasapagarMain .field,
#contasapagarMain input,
#contasapagarMain select {
  min-width: 0;
  max-width: 100%;
}

#contasapagarMain .cp-form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.cp-toolbar,
.cp-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cp-search-wrap {
  min-width: 240px;
  flex: 1;
}

#cpSearch {
  width: 100%;
}

.cp-filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cp-filter-btn {
  transition: 0.15s ease-in-out;
}

.cp-filter-btn.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--bg-color);
  box-shadow: 0 10px 24px rgba(244,202,114, 0.32);
}

#contasapagarMain .form-grid .form-row.row-4 {
  margin-top: 2px;
}

#contasapagarMain .table td,
#contasapagarMain .table th {
  white-space: normal;
  overflow-wrap: anywhere;
}

#contasapagarMain .table {
  table-layout: fixed;
}

#contasapagarMain .table td:last-child,
#contasapagarMain .table th:last-child {
  text-align: right;
}

.cp-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.cp-status-pendente {
  background: rgba(249,115,22, 0.12);
  border-color: rgba(249,115,22, 0.35);
  color: #fdba74;
}

.cp-status-atrasada {
  background: rgba(239,68,68, 0.12);
  border-color: rgba(239,68,68, 0.35);
  color: #fca5a5;
}

.cp-status-paga {
  background: rgba(34,197,94, 0.12);
  border-color: rgba(34,197,94, 0.35);
  color: #86efac;
}

.cp-parcela-text {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.cp-actions {
  display: inline-flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cp-actions .btn {
  box-shadow: none;
}

.cp-actions .btn:hover {
  transform: translateY(-1px);
}

#contasapagarMain .cp-account-actions-row td {
  text-align: left;
  padding-top: 0;
  padding-bottom: 16px;
}

#contasapagarMain .cp-account-actions-row .cp-actions {
  display: flex;
  justify-content: flex-start;
}

#contasapagarMain .cp-account-actions-row .btn {
  min-height: 44px;
}

#contasapagarMain .left-column .card,
#contasapagarMain .right-column .card {
  height: 100%;
}

#contasapagarMain .right-column .card-body.table-wrapper {
  min-height: 420px;
}

#contasapagarMain .loading-row {
  text-align: center;
}

@media (max-width: 1100px) {
  #contasapagarMain .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* A lista se adapta ao espaço real disponível ao lado do formulário. */
@container (max-width: 720px) {
  #contasapagarMain .table,
  #contasapagarMain .table tbody {
    display: block;
  }

  #contasapagarMain .table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  #contasapagarMain .cp-account-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 16px 0;
  }

  #contasapagarMain .cp-account-row td {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 0;
    border: 0;
    text-align: left;
    min-width: 0;
  }

  #contasapagarMain .cp-account-row td:first-child {
    grid-column: 1 / -1;
  }

  #contasapagarMain .cp-account-row td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
  }

  #contasapagarMain .cp-account-actions-row,
  #contasapagarMain .cp-account-actions-row td {
    display: block;
    width: 100%;
  }

  #contasapagarMain .cp-account-actions-row td {
    padding: 0 0 16px;
  }
}

@media (max-width: 960px) {
  #contasapagarMain .grid {
    grid-template-columns: 1fr;
  }

  #contasapagarMain .right-column .card-body.table-wrapper {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  #contasapagarMain {
    padding-inline: 12px;
  }

  #contasapagarMain .card-header,
  #contasapagarMain .card-body {
    padding-inline: 14px;
  }

  #contasapagarMain .cp-form-row {
    grid-template-columns: 1fr;
  }

  #contasapagarMain .btn {
    min-height: 44px;
    white-space: normal;
  }

  #contasapagarMain .kpis {
    grid-template-columns: 1fr;
  }

  .cp-header-actions,
  .cp-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .cp-search-wrap {
    min-width: 100%;
  }

  .cp-filter-group {
    width: 100%;
  }

  .cp-filter-group .cp-filter-btn {
    flex: 1 1 calc(50% - 8px);
    justify-content: center;
  }

  #contasapagarMain .table td:last-child,
  #contasapagarMain .table th:last-child {
    text-align: left;
  }

  .cp-actions {
    justify-content: flex-start;
  }
}

.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #25d366;
  color: #fff;
  border: none;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: 0.2s;
}

.btn-whatsapp:hover {
  background: #1ebe5d;
  transform: scale(1.05);
}

.btn-whatsapp i {
  font-size: 16px;
}
/* Controles do fluxo de pagamentos */
[hidden] { display: none !important; }
#pagamentosMain select, #pagamentosMain button { min-height: 44px; }
#pagamentosMain select { max-width: 100%; }
#pagamentosMain .toolbar { flex-wrap: wrap; }
#pagamentosMain :focus-visible { outline: 2px solid #f4ca72; outline-offset: 3px; }

/* A cor acompanha um texto que identifica a situação. */
.atendimento-aguardando { --at-cor: #fbbf24; --at-fundo: #292211; }
.atendimento-realizado { --at-cor: #93c5fd; --at-fundo: #142638; }
.atendimento-finalizado { --at-cor: #86efac; --at-fundo: #132c21; }
.atendimento-cancelado { --at-cor: #cbd5e1; --at-fundo: #252b36; }
.atendimento-atencao { --at-cor: #fca5a5; --at-fundo: #3b171d; }
#pagTbody tr[class^="atendimento-"] > td { background: var(--at-fundo); }
#pagTbody tr[class^="atendimento-"] > td:first-child { border-left: 4px solid var(--at-cor); }
.timeslot[class*="atendimento-"] {
  background: var(--at-fundo);
  border-left: 4px solid var(--at-cor);
}
.atendimento-indicador {
  display: block;
  color: var(--at-cor);
  font-weight: 600;
  margin-bottom: 8px;
}

/* Acabamento inspirado no dourado da marca. */
.section-header h1,
.logo-text span,
.kpi-value {
  color: var(--primary-color);
}
.card-header h2,
.card-header h3,
.modal-header h2 {
  color: #f7dfb0;
}
.sidebar .tab-btn:hover:not(.active) {
  background: rgba(244, 202, 114, 0.08);
  border-color: var(--border-color);
}
.sidebar .tab-btn.active {
  border-color: #f7d998;
  box-shadow: 0 6px 18px rgba(181, 133, 50, 0.16);
}
#installAppBtn[hidden] { display: none; }
.booking-request-count { margin-left: auto; padding: 2px 8px; border-radius: 999px; background: var(--primary-color); color: var(--bg-color); font-weight: 700; }
.booking-request-count[hidden] { display: none; }
#bookingaccessMain [hidden] { display: none !important; }
#bookingaccessMain .card-body { display: grid; gap: 16px; }
#bookingaccessMain .toolbar { align-items: end; }
#bookingaccessMain button, #bookingaccessMain .btn { min-height: 44px; }
#bookingaccessMain textarea { width: 100%; box-sizing: border-box; resize: vertical; }
#bookingaccessMain .booking-access-actions { display: flex; flex-wrap: wrap; gap: 12px; }
#bookingaccessMain #accessGeneratedCode { font-family: monospace; font-size: 1.1rem; }
#bookingaccessMain #bookingRequestsList article { padding: 16px 0; border-top: 1px solid var(--border-color); }

input, select, textarea {
  accent-color: var(--primary-color);
}
input::placeholder, textarea::placeholder {
  color: var(--text-muted);
  opacity: 1;
}
:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 3px;
}
::selection {
  color: var(--bg-color);
  background: var(--primary-color);
}
