/* Painel Admin — SaaS Premium */

.admin-body {
  min-height: 100vh;
  background: var(--bg-base, #050505);
}

.admin-body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 60% 40% at 100% 0%, rgba(200, 155, 60, 0.06), transparent 50%);
  pointer-events: none;
}

/* Login */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  background:
    radial-gradient(ellipse at top right, rgba(201, 162, 39, 0.08), transparent 50%),
    var(--bg-deep);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg);
}

.login-card .logo {
  text-align: center;
  margin-bottom: 0.5rem;
}

.login-card__subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.login-error {
  background: rgba(231, 76, 60, 0.15);
  border: 1px solid rgba(231, 76, 60, 0.4);
  color: #ff6b6b;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: none;
}

.login-error.show { display: block; }

/* Dashboard layout */
.admin-layout {
  display: none;
  min-height: 100vh;
}

.admin-layout.active { display: flex; }

.admin-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 260px;
  background: var(--bg-primary);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  padding: 1.5rem 0;
  z-index: 100;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.admin-sidebar.open { transform: translateX(0); }

@media (min-width: 1024px) {
  .admin-sidebar {
    transform: translateX(0);
  }
}

.admin-sidebar__brand {
  padding: 0 1.5rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 1rem;
}

.admin-sidebar__brand small {
  display: block;
  color: var(--text-dim);
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.admin-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.admin-nav a:hover,
.admin-nav a.active {
  color: var(--gold);
  background: var(--gold-dim);
  border-left-color: var(--gold);
}

.admin-main {
  flex: 1;
  margin-left: 0;
  min-height: 100vh;
}

@media (min-width: 1024px) {
  .admin-main { margin-left: 260px; }
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: rgba(10, 10, 15, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
}

.admin-topbar h1 {
  font-size: 1.25rem;
}

.admin-content {
  padding: 1.5rem 1.25rem 3rem;
}

@media (min-width: 768px) {
  .admin-content { padding: 2rem; }
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (min-width: 600px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat-card {
  background: var(--bg-card, #121212);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: var(--radius-lg, 20px);
  padding: 1.75rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, border-color 0.3s;
}

.stat-card:hover {
  border-color: var(--border-gold, rgba(200,155,60,0.25));
  transform: translateY(-2px);
}

.dashboard-split {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 1024px) {
  .dashboard-split { grid-template-columns: 1.4fr 1fr; }
}

.admin-date-badge {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  background: var(--gold-dim, rgba(200,155,60,0.12));
  border-radius: 100px;
}

.today-agenda {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 360px;
  overflow-y: auto;
}

.agenda-slot {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  border-left: 3px solid var(--gold, #c89b3c);
}

@media (max-width: 640px) {
  .agenda-slot {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 1rem;
  }

  .agenda-slot .status-badge {
    justify-self: start;
  }

  .admin-card__header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.75rem;
  }

  .admin-topbar h1 {
    font-size: 1.05rem;
    max-width: 55vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .admin-content {
    padding: 1rem 1rem 2.5rem;
  }

  .stat-card {
    padding: 1.25rem;
  }

  .stat-card__value {
    font-size: 1.5rem !important;
    word-break: break-word;
  }

  .empty-state {
    text-align: center;
    padding: 1rem 0.5rem;
    line-height: 1.5;
    word-break: break-word;
  }

  .today-agenda {
    max-height: none;
  }

  .table-wrap {
    margin: 0 -0.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .admin-table {
    min-width: 520px;
  }

  .dashboard-split .admin-card {
    overflow: hidden;
  }
}

.agenda-slot__time {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--gold, #c89b3c);
}

.agenda-slot__name { font-weight: 600; }
.agenda-slot__meta { font-size: 0.8rem; color: var(--text-muted); }

.mini-metrics {
  display: grid;
  gap: 1rem;
}

.mini-metric {
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.mini-metric__label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mini-metric__value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold);
  margin-top: 0.35rem;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, var(--gold-dim), transparent 70%);
}

.stat-card__label {
  font-size: 0.8rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.stat-card__value {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--gold);
}

/* Panels */
.admin-panel {
  display: none;
}

.admin-panel.active { display: block; }

.admin-card {
  background: var(--bg-card, #121212);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-lg, 20px);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

.admin-card__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.admin-card__header h2 {
  font-size: 1.15rem;
  font-family: var(--font-body);
  font-weight: 600;
}

/* Filtros */
.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.filters-row select,
.filters-row input {
  padding: 0.6rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  min-width: 140px;
}

/* Tabela */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 700px;
}

.data-table th,
.data-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.data-table th {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-pendente { background: rgba(241, 196, 15, 0.2); color: #f1c40f; }
.status-confirmado { background: rgba(46, 204, 113, 0.2); color: #2ecc71; }
.status-cancelado { background: rgba(231, 76, 60, 0.2); color: #e74c3c; }
.status-concluido { background: rgba(52, 152, 219, 0.2); color: #3498db; }

.action-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.btn-sm {
  padding: 0.4rem 0.65rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-weight: 600;
  transition: 0.2s;
}

.btn-confirm { background: rgba(46, 204, 113, 0.2); color: #2ecc71; }
.btn-cancel { background: rgba(231, 76, 60, 0.2); color: #e74c3c; }
.btn-complete { background: rgba(52, 152, 219, 0.2); color: #3498db; }
.btn-delete { background: rgba(255, 255, 255, 0.08); color: var(--text-muted); }

.btn-sm:hover { filter: brightness(1.2); }

/* Serviços admin */
.services-admin-list {
  display: grid;
  gap: 1rem;
}

.service-admin-item {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
}

.service-admin-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.service-image-preview {
  max-height: 180px;
  width: auto;
  max-width: 100%;
  margin-top: 0.75rem;
}

.admin-card--highlight {
  border-color: rgba(200, 155, 60, 0.35);
  box-shadow: 0 0 40px rgba(200, 155, 60, 0.08);
}

.service-images-grid {
  display: grid;
  gap: 1.25rem;
  margin: 1.5rem 0;
}

@media (min-width: 640px) {
  .service-images-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .service-images-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.service-image-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.service-image-card__preview {
  aspect-ratio: 16/10;
  overflow: hidden;
  background: #0a0a0a;
}

.service-image-card__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.service-image-card__body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.service-image-card__body input[type="url"] {
  width: 100%;
  font-size: 0.8rem;
}

.service-image-card__body .img-file {
  font-size: 0.75rem;
}

@media (min-width: 768px) {
  .service-admin-item {
    grid-template-columns: 72px 1fr auto auto auto;
    align-items: center;
  }
}

.service-admin-item .form-group { margin-bottom: 0; }

.inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* Horários */
.hours-form {
  display: grid;
  gap: 1.25rem;
  max-width: 480px;
}

.days-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.day-chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.85rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
}

.day-chip:has(input:checked) {
  border-color: var(--gold);
  background: var(--gold-dim);
}

.blocked-list {
  margin-top: 1rem;
}

.blocked-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 { margin-bottom: 1rem; }

.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

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

.logout-btn {
  margin: 1rem 1.5rem 0;
  width: calc(100% - 3rem);
}

.admin-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

.admin-overlay.show { display: block; }

@media (min-width: 1024px) {
  .admin-overlay { display: none !important; }
}

.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

/* Configurações do site */
.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.settings-tab {
  padding: 0.6rem 1.1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.settings-tab:hover,
.settings-tab.active {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-dim);
}

.settings-pane {
  display: none;
}

.settings-pane.active {
  display: block;
}

.settings-hint {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 1.25rem;
}

.account-form {
  max-width: 520px;
  margin-top: 1.5rem;
}

.account-divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 1.5rem 0;
}

.account-form__actions {
  margin-top: 1.5rem;
}

.label-required {
  color: var(--gold);
}

.account-alert {
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.account-alert--success {
  background: rgba(46, 204, 113, 0.15);
  border: 1px solid rgba(46, 204, 113, 0.35);
  color: #2ecc71;
}

.account-alert--error {
  background: rgba(231, 76, 60, 0.12);
  border: 1px solid rgba(231, 76, 60, 0.35);
  color: #e74c3c;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.settings-save-msg {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(46, 204, 113, 0.15);
  border: 1px solid rgba(46, 204, 113, 0.35);
  color: #2ecc71;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}

.color-field label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.color-field input[type="color"] {
  width: 100%;
  height: 44px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
  padding: 0;
}

.color-hex {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: monospace;
  font-size: 0.85rem;
}

.settings-preview {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--bg-deep);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.preview-chip {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
}

.preview-gold {
  color: var(--gold);
  border: 1px solid var(--gold);
}

.preview-btn {
  background: linear-gradient(135deg, var(--gold), var(--copper));
  color: #0a0a0f;
}

.image-setting {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.image-setting:last-child {
  border-bottom: none;
}

.image-setting > label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.image-setting__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.image-setting__row input[type="url"] {
  flex: 1;
  min-width: 200px;
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
}

.img-file {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 160px;
}

.image-preview {
  margin-top: 0.75rem;
  max-width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  display: none;
}

.image-preview.visible {
  display: block;
}

.logo-preview.visible {
  max-height: 80px;
  width: auto;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.5rem;
}

.logo-setting {
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.gallery-setting-item {
  margin-bottom: 1rem;
}

/* =====================================================================
   MOBILE-FIRST OVERHAUL (90% do tráfego é mobile)
   Sobrescreve o necessário sem mexer no que já funcionava bem no desktop.
   ===================================================================== */

/* 1) Safe-area-insets para iPhones com notch */
.admin-topbar {
  padding-top: max(1rem, env(safe-area-inset-top));
  padding-left: max(1.25rem, env(safe-area-inset-left));
  padding-right: max(1.25rem, env(safe-area-inset-right));
}

.admin-content {
  padding-left: max(1.25rem, env(safe-area-inset-left));
  padding-right: max(1.25rem, env(safe-area-inset-right));
  padding-bottom: max(3rem, calc(2rem + env(safe-area-inset-bottom)));
}

.admin-sidebar {
  padding-top: max(1.5rem, env(safe-area-inset-top));
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
}

/* 2) Inputs: font-size mínimo 16px no MOBILE para iOS não dar zoom */
@media (max-width: 767px) {
  .filters-row select,
  .filters-row input,
  .color-hex,
  .image-setting__row input[type="url"],
  .service-image-card__body input[type="url"],
  .img-file,
  .day-chip,
  .settings-tab {
    font-size: 16px;
  }
}

/* 3) Topbar mobile compacta — botão "Ver site" vira ícone */
.admin-topbar {
  gap: 0.75rem;
}

.admin-topbar h1 {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .admin-topbar {
    padding: 0.85rem 1rem;
  }
  .admin-topbar h1 {
    font-size: 1rem;
  }
  /* "Ver site" no topbar — só ícone em telas pequenas */
  .admin-topbar > a.btn-ghost {
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    font-size: 0 !important;
  }
  .admin-topbar > a.btn-ghost::before {
    content: '↗';
    font-size: 1.1rem;
    line-height: 1;
  }
}

/* 4) Menu hambúrguer (admin) com touch target adequado */
.admin-topbar .menu-toggle {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

@media (min-width: 1024px) {
  .admin-topbar .menu-toggle { display: none; }
}

/* 5) Sidebar com touch targets confortáveis no mobile */
@media (max-width: 1023px) {
  .admin-sidebar {
    width: min(290px, 84vw);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.5);
  }
  .admin-nav a {
    padding: 1rem 1.5rem;
    font-size: 0.95rem;
    min-height: 48px;
  }
  .logout-btn {
    min-height: 48px;
  }
}

/* 6) Cards do dashboard menos apertados em mobile */
@media (max-width: 640px) {
  .admin-card {
    padding: 1.25rem 1rem;
    border-radius: 14px;
    margin-bottom: 1rem;
  }
  .admin-card__header {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.75rem;
  }
  .admin-card__header h2 {
    font-size: 1.05rem;
  }
  .admin-card__header .btn {
    width: 100%;
  }
}

/* 7) Stats em 2 colunas (telas estreitas) — antes era 1 só */
@media (max-width: 599px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  .stat-card {
    padding: 1rem 0.85rem;
  }
  .stat-card__label {
    font-size: 0.7rem;
  }
  .stat-card__value {
    font-size: 1.5rem;
  }
}

/* 8) =====  TABELAS VIRAM CARDS EM MOBILE (peça-chave da UX)  =====
   Cada <tr> vira um cartão; cada <td> ganha o rótulo via data-label
   (preenchido no JS). Não rola horizontalmente. */
@media (max-width: 767px) {
  .table-wrap {
    overflow-x: visible;
    margin: 0;
  }

  .data-table,
  .admin-table {
    min-width: 0;
    width: 100%;
    border-collapse: separate;
  }

  .data-table thead,
  .admin-table thead {
    /* Esconde cabeçalho — o data-label substitui */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .data-table tbody tr,
  .admin-table tbody tr {
    display: block;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.85rem;
  }

  .data-table tbody tr:hover td,
  .admin-table tbody tr:hover td {
    background: transparent;
  }

  .data-table tbody td,
  .admin-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
    text-align: right;
    font-size: 0.9rem;
    word-break: break-word;
    min-height: 36px;
  }

  .data-table tbody td:last-child,
  .admin-table tbody td:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .data-table tbody td:first-child,
  .admin-table tbody td:first-child {
    padding-top: 0;
  }

  /* Rótulo (vem do data-label) à esquerda */
  .data-table tbody td::before,
  .admin-table tbody td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    margin-right: 1rem;
  }

  /* Células sem label (ex: ações) ocupam linha inteira */
  .data-table tbody td:not([data-label]),
  .data-table tbody td[data-label=""],
  .admin-table tbody td:not([data-label]),
  .admin-table tbody td[data-label=""] {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  /* Action buttons em mobile: maiores e wrap */
  .action-btns {
    width: 100%;
    gap: 0.5rem;
  }
  .action-btns .btn-sm {
    flex: 1 1 calc(50% - 0.25rem);
    min-height: 40px;
    padding: 0.6rem 0.5rem;
    font-size: 0.8rem;
  }
}

/* 9) Cards de agendamento (dashboard "Agenda do dia") com hierarquia
   visual mesmo em 1 coluna */
@media (max-width: 640px) {
  .agenda-slot {
    grid-template-columns: 60px 1fr;
    grid-template-areas:
      'time   info'
      'status status';
    column-gap: 0.85rem;
    row-gap: 0.5rem;
    padding: 0.85rem 1rem;
  }
  .agenda-slot__time {
    grid-area: time;
    font-size: 1rem;
    align-self: center;
  }
  .agenda-slot > div:nth-child(2),
  .agenda-slot__info {
    grid-area: info;
    min-width: 0;
  }
  .agenda-slot__name {
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .agenda-slot .status-badge {
    grid-area: status;
    justify-self: flex-start;
    align-self: flex-start;
  }
}

/* 10) Serviços admin — visual de card mais limpo em mobile */
@media (max-width: 767px) {
  .service-admin-item {
    grid-template-columns: 56px 1fr;
    grid-template-areas:
      'thumb info'
      'meta meta'
      'actions actions';
    gap: 0.75rem;
    padding: 1rem;
  }
  .service-admin-thumb {
    grid-area: thumb;
    width: 56px;
    height: 56px;
  }
  .service-admin-item .form-group {
    grid-area: info;
  }
  .service-admin-item > div:nth-of-type(2),
  .service-admin-item > div:nth-of-type(3) {
    grid-area: meta;
    display: inline-flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
  }
  .service-admin-item > div:nth-of-type(2) {
    grid-area: meta;
  }
  .service-admin-item > div:nth-of-type(3) {
    grid-area: meta;
    margin-left: auto;
  }
  .service-admin-item > div:last-child {
    grid-area: actions;
    display: flex;
    gap: 0.5rem;
  }
  .service-admin-item > div:last-child .btn {
    flex: 1;
    min-height: 40px;
  }
}

/* 11) Modal — sheet-like (sobe de baixo) em mobile */
@media (max-width: 600px) {
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    max-width: 100%;
    width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 92vh;
    padding: 1.25rem 1.1rem max(1.25rem, env(safe-area-inset-bottom));
    animation: slideUp 0.25s ease;
  }
  @keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  .modal-actions {
    flex-direction: column-reverse;
    gap: 0.5rem;
  }
  .modal-actions .btn {
    min-height: 48px;
  }
}

/* 12) Forms compactos e clicáveis */
@media (max-width: 640px) {
  .inline-fields {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  /* blockSlotForm (inline style com 3 col) também 1col em mobile */
  #blockSlotForm {
    grid-template-columns: 1fr !important;
  }
  #blockSlotForm .btn {
    width: 100%;
    min-height: 44px;
  }
  .form-group input,
  .form-group textarea,
  .form-group select {
    font-size: 16px;
    min-height: 44px;
  }
  /* Selects que vêm como input */
  .filters-row select,
  .filters-row input {
    min-width: 0;
    flex: 1;
    min-height: 44px;
  }
  .filters-row {
    flex-direction: column;
    gap: 0.5rem;
  }
  .filters-row > * {
    width: 100%;
  }
}

/* 13) Settings tabs (4) ficam roláveis horizontalmente em mobile */
@media (max-width: 640px) {
  .settings-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
    margin: 0 -1rem 1rem;
    padding-left: 1rem;
    padding-right: 1rem;
    scrollbar-width: none;
  }
  .settings-tabs::-webkit-scrollbar {
    display: none;
  }
  .settings-tab {
    flex-shrink: 0;
    min-height: 40px;
    font-size: 0.85rem;
  }
}

/* 14) Color grid — 2 colunas em mobile (era 1 cheia) */
@media (max-width: 640px) {
  .color-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
}

/* 15) Image-setting (logo, hero, etc) — coluna em mobile */
@media (max-width: 640px) {
  .image-setting__row {
    flex-direction: column;
    align-items: stretch;
  }
  .image-setting__row input[type="url"] {
    min-width: 0;
    width: 100%;
  }
  .img-file {
    max-width: 100%;
    padding: 0.5rem 0;
  }
  .image-preview {
    max-height: 200px;
    width: 100%;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
  }
  /* Botões de ação em settings (salvar, restaurar) em coluna */
  .settings-actions {
    flex-direction: column;
  }
  .settings-actions .btn {
    width: 100%;
    min-height: 48px;
  }
}

/* 16) Botões grandes para toque em todo o admin */
@media (max-width: 767px) {
  .btn {
    min-height: 44px;
    padding: 0.75rem 1.5rem;
  }
  .btn-primary,
  .btn-outline {
    min-height: 48px;
  }
  .btn-sm {
    min-height: 36px;
  }
  .btn-block {
    min-height: 50px;
  }
  /* Day chips (dias da semana) maior e mais espaçado */
  .day-chip {
    padding: 0.65rem 1rem;
    font-size: 0.95rem;
    min-height: 42px;
  }
}

/* 17) Blocked list (horários bloqueados) toque maior */
@media (max-width: 640px) {
  .blocked-item {
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
  }
  .blocked-item .btn-sm {
    min-height: 36px;
    padding: 0.5rem 1rem;
  }
}

/* 18) Logout button respeita safe-area */
@media (max-width: 1023px) {
  .logout-btn {
    margin: 1rem 1.25rem max(1rem, env(safe-area-inset-bottom));
    width: calc(100% - 2.5rem);
  }
}

/* 19) Service images grid — 1 coluna em telas muito estreitas */
@media (max-width: 420px) {
  .service-images-grid {
    gap: 0.75rem;
  }
  .service-image-card__body {
    padding: 0.85rem;
  }
}

/* 20) Login responsivo */
@media (max-width: 480px) {
  .login-screen {
    padding: 1rem;
  }
  .login-card {
    padding: 2rem 1.25rem;
    border-radius: 16px;
  }
}

/* 21) Account form (conta do admin) com largura total em mobile */
@media (max-width: 640px) {
  .account-form,
  .hours-form {
    max-width: 100%;
  }
}

/* 22) Tap highlight removido (escolha do design) */
.admin-body * {
  -webkit-tap-highlight-color: rgba(200, 155, 60, 0.15);
}

/* 23) Active states visíveis (feedback de toque) */
.btn:active,
.btn-sm:active,
.day-chip:active,
.settings-tab:active {
  transform: scale(0.97);
}


/* 24) Fix crítico de overflow flex em mobile
   .admin-main é flex:1 dentro de .admin-layout (display:flex).
   Sem min-width:0, conteúdo largo (topbar título, grids) faz o flex item
   expandir além do viewport — empurrando todo o conteúdo para a direita. */
.admin-main {
  min-width: 0;
}

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

/* Garante que o topbar não tente crescer */
.admin-topbar {
  min-width: 0;
}

