/* ==========================================================================
   SALDO MANSÃO - ESTILOS VISUAIS DE ALTO CONTRASTE E OPERAÇÃO MOBILE
   Design Elegante Noturno: Preto Profundo, Dourado Mansão e Alto Contraste
   ========================================================================== */

:root {
  --bg-main: #05090d;
  --bg-surface: #15191e;
  --bg-surface-elevated: #1b2027;
  --bg-surface-highlight: #232933;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-card: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --border-focus: #e5b94c;

  --text-main: #ffffff;
  --text-muted: #94a3b8;
  --text-inverse: #05090d;

  --gold-primary: #d4af37;
  --gold-hover: #e5b94c;
  --gold-active: #b89628;
  --gold-gradient: linear-gradient(135deg, #f5cf72 0%, #d4af37 50%, #b2881a 100%);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --info: #3b82f6;

  --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-card: 0 6px 24px rgba(0, 0, 0, 0.45);
  --shadow-modal: 0 12px 48px rgba(0, 0, 0, 0.85);

  --touch-target-min: 52px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

/* --------------------------------------------------------------------------
   BARRA SUPERIOR E STATUS DE CONEXÃO
   -------------------------------------------------------------------------- */
header.app-header {
  background: var(--bg-main);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 18px;
  padding-top: max(12px, env(safe-area-inset-top));
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
}

.brand-logo-img {
  height: 46px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  display: block;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.connection-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  font-size: 0.86rem;
  font-weight: 500;
  color: #f1f5f9;
  background: transparent;
  border: none;
}

.connection-badge .status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.connection-badge.online .status-dot {
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
}

.connection-badge.offline .status-dot {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.7);
  animation: pulse-danger 1.5s infinite;
}

.user-avatar-btn {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-avatar-circle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--gold-primary);
  background: linear-gradient(135deg, #2c2415 0%, #15191e 100%);
  color: #f5cf72;
  font-weight: 800;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  transition: transform 0.12s ease;
}

.user-avatar-btn:active .user-avatar-circle {
  transform: scale(0.92);
}

.role-tag {
  background: var(--gold-primary);
  color: var(--text-inverse);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Banner de Alerta Offline */
.connection-badge.checking .status-dot { background: var(--warning); box-shadow: 0 0 8px rgba(245, 158, 11, 0.6); }

.offline-banner {
  background: var(--danger);
  color: #fff;
  padding: 10px 16px;
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
  display: none;
}

.offline-banner.active {
  display: block;
}

/* --------------------------------------------------------------------------
   LAYOUT PRINCIPAL
   -------------------------------------------------------------------------- */
main.app-main {
  flex: 1;
  max-width: 768px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 18px 40px;
}

/* --------------------------------------------------------------------------
   TELA INICIAL: ATENDIMENTO E CARTÕES 3D (COMPOSIÇÃO APROVADA)
   -------------------------------------------------------------------------- */
.home-title-wrap {
  margin: 18px 0 24px;
}

.home-title {
  font-size: 2.15rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
  line-height: 1.15;
  margin: 0 0 4px 0;
}

.home-subtitle {
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.35;
  margin: 0;
}

.home-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.action-card-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  min-height: 98px;
  display: flex;
  align-items: center;
  gap: 18px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
  color: var(--text-main);
  box-shadow: var(--shadow-card);
  -webkit-tap-highlight-color: transparent;
}

.action-card-btn:hover {
  background: #191e25;
  border-color: rgba(255, 255, 255, 0.14);
}

.action-card-btn:active {
  transform: scale(0.985);
  background: #1a2027;
  border-color: rgba(212, 175, 55, 0.35);
}

.action-card-btn:focus-visible {
  outline: 3px solid var(--gold-primary);
}

.card-icon-wrap {
  width: 74px;
  height: 74px;
  min-width: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-3d-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.45));
}

.card-text-wrap {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 4px;
  line-height: 1.2;
  letter-spacing: -0.2px;
}

.card-desc {
  font-size: 0.92rem;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.35;
  margin: 0;
}

.card-chevron {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  flex-shrink: 0;
  margin-left: 4px;
}

.home-footer {
  text-align: center;
  margin: 34px 0 20px;
  font-size: 0.88rem;
  font-weight: 500;
  color: #64748b;
}

/* --------------------------------------------------------------------------
   FORMULÁRIOS, INPUTS E BOTÕES
   -------------------------------------------------------------------------- */
.form-group {
  margin-bottom: 18px;
}

label.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-main);
}

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

.form-control {
  width: 100%;
  height: var(--touch-target-min);
  background: var(--bg-surface-elevated);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0 16px;
  font-size: 1.1rem;
  color: #fff;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--gold-primary);
  background: var(--bg-surface-highlight);
}

.form-control.money-input {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gold-primary);
  text-align: center;
  letter-spacing: 1px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--touch-target-min);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  text-decoration: none;
  width: 100%;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

.btn-gold {
  background: var(--gold-primary);
  color: var(--text-inverse);
}
.btn-gold:hover:not(:disabled) {
  background: var(--gold-hover);
}

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover:not(:disabled) {
  background: #059669;
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border: 2px solid var(--border-strong);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-surface-highlight);
}

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

.btn-whatsapp {
  background: #25d366;
  color: #fff;
}
.btn-whatsapp:hover:not(:disabled) {
  background: #1ebc59;
}

/* --------------------------------------------------------------------------
   BOX DE ORIENTAÇÃO BAR FÁCIL (ALTO DESTAQUE)
   -------------------------------------------------------------------------- */
.bar-facil-instruction-box {
  background: rgba(245, 158, 11, 0.12);
  border: 2px solid var(--warning);
  border-radius: var(--radius-md);
  padding: 18px;
  margin: 18px 0;
}

.instruction-header {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--warning);
  font-weight: 800;
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.instruction-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-main);
}

.confirmation-checkbox-wrap {
  background: var(--bg-surface-elevated);
  border: 2px solid var(--gold-primary);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 16px 0;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
}

.confirmation-checkbox-wrap input[type="checkbox"] {
  width: 26px;
  height: 26px;
  accent-color: var(--gold-primary);
  cursor: pointer;
  margin-top: 2px;
  flex-shrink: 0;
}

.confirmation-checkbox-wrap span {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   MODAIS E DIÁLOGOS
   -------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 0;
}

@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
    padding: 20px;
  }
}

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

.modal-content {
  background: var(--bg-surface);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
}

@media (min-width: 640px) {
  .modal-content {
    border-radius: var(--radius-lg);
  }
}

.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  z-index: 10;
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
}

.close-modal-btn {
  background: transparent;
  border: none;
  font-size: 26px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
}

.modal-body {
  padding: 20px;
  flex: 1;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-surface);
}

/* --------------------------------------------------------------------------
   COMPROVANTE OFICIAL DE ALTO CONTRASTE (PRONTO PARA FOTO / WHATSAPP)
   -------------------------------------------------------------------------- */
.receipt-card {
  background: #0f1218;
  border: 2px dashed var(--gold-primary);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  color: #fff;
  box-shadow: var(--shadow-card);
  margin-bottom: 18px;
}

.receipt-header {
  text-align: center;
  border-bottom: 1px dashed var(--border-strong);
  padding-bottom: 14px;
  margin-bottom: 14px;
}

.receipt-logo {
  height: 42px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  margin: 0 auto 8px;
  display: block;
}

.receipt-header h3 {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--gold-primary);
  letter-spacing: 1px;
}

.receipt-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.95rem;
}

.receipt-row.highlight {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--gold-primary);
  padding: 12px 0;
  border-bottom: 2px solid var(--gold-primary);
}

.receipt-row.sub-highlight {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--success);
}

.receipt-footer-warning {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-strong);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   PAINEL ADMINISTRATIVO & ABAS
   -------------------------------------------------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--gold-primary);
}

.stat-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   TABELAS E LISTAS RESPONSIVAS
   -------------------------------------------------------------------------- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

table.data-table th, table.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

table.data-table th {
  background: var(--bg-surface-highlight);
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
}

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

.status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}
.status-badge.concluido { background: var(--success-bg); color: var(--success); }
.status-badge.pendente { background: var(--warning-bg); color: var(--warning); }
.status-badge.cancelado { background: var(--danger-bg); color: var(--danger); }
.status-badge.estornado { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }
.status-badge.valido { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.status-badge.alerta { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }
.status-badge.urgente { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.3); }
.status-badge.vencido { background: rgba(100, 116, 139, 0.2); color: #94a3b8; border: 1px solid rgba(100, 116, 139, 0.3); text-decoration: line-through; }
.status-badge.sem_validade { background: rgba(99, 102, 241, 0.15); color: #a5b4fc; border: 1px solid rgba(99, 102, 241, 0.3); }
.status-badge.utilizado { background: rgba(148, 163, 184, 0.1); color: #64748b; }
.status-badge.expirado { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }

.parcel-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
  transition: border-color 0.15s ease;
}
.parcel-card:hover {
  border-color: rgba(212, 160, 23, 0.35);
}
.parcel-card.vencida-item {
  opacity: 0.65;
  background: rgba(15, 23, 42, 0.4);
}

/* Animação */
@keyframes pulse-danger {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Administração: navegação visível e leitura em celulares compactos. */
#modalAdmin { padding: 0; align-items: stretch; }
#modalAdmin > .modal-content { width:100%; max-width:760px !important; height:100dvh; max-height:100dvh; margin:auto; border:0; border-radius:0; }
#modalAdmin .modal-header { gap:16px; }
#modalAdmin .modal-header h2 { font-size:1.2rem; line-height:1.4; }
#modalAdmin .admin-tab-content { min-width:0; }
#modalAdmin h3, #modalAdmin h4 { line-height:1.4; overflow-wrap:anywhere; }
#modalAdmin .btn { min-height:48px; line-height:1.4; white-space:normal; }
#modalAdmin input, #modalAdmin select, #modalAdmin textarea { min-width:0; max-width:100%; font-size:16px; }
#modalAdmin code, #modalAdmin .stat-sub { overflow-wrap:anywhere; }
#modalAdmin .stat-value { font-variant-numeric:tabular-nums; }
.app-toast { position:fixed; bottom:24px; left:16px; right:16px; margin:auto; max-width:520px; z-index:9999; padding:16px; border:1px solid var(--gold-primary); border-radius:12px; background:#20252b; color:white; box-shadow:0 8px 30px #0008; }
.app-toast.danger { border-color:var(--danger); }
@media(max-width:540px) {
 #modalAdmin .modal-body { padding:16px; }
 #modalAdmin .stat-grid { grid-template-columns:1fr; }
 #modalAdmin [style*="grid-template-columns: 1fr 1fr"], #modalAdmin [style*="grid-template-columns: repeat(auto-fit"] { grid-template-columns:1fr !important; }
 #modalAdmin [style*="justify-content: space-between"] { flex-wrap:wrap; gap:12px; }
 #finBuscaCliente { width:100%; }
}

/* ==========================================================================
   MODO SEM INTERNET E SINCRONIZAÇÃO (v2.3.2)
   ========================================================================== */
.sync-strip {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; min-height: 44px; padding: 8px 16px;
  border: 0; border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface); color: var(--text-muted);
  font: inherit; font-size: 0.85rem; font-weight: 600; text-align: left; cursor: pointer;
}
.sync-strip span:first-child { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.sync-strip-more { flex: 0 0 auto; color: var(--gold-primary); font-weight: 800; white-space: nowrap; }
.sync-strip.ok { color: #6ee7b7; }
.sync-strip.info { color: #93c5fd; }
.sync-strip.warn { background: rgba(245, 158, 11, 0.16); color: #fcd34d; }
.sync-strip.danger { background: rgba(239, 68, 68, 0.2); color: #fecaca; }

.sync-summary { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.sync-summary > div { background: var(--bg-surface-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 10px; }
.sync-summary span { display: block; font-size: 0.72rem; color: var(--text-muted); line-height: 1.25; margin-bottom: 4px; }
.sync-summary strong { font-size: 1rem; color: #fff; overflow-wrap: anywhere; }
.sync-error-line { background: var(--warning-bg); border: 1px solid rgba(245, 158, 11, 0.4); color: #fcd34d; border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.85rem; margin-bottom: 12px; }
.sync-rule { font-size: 0.78rem; color: var(--text-muted); margin: 12px 0 14px; line-height: 1.45; }
.sync-empty { color: var(--text-muted); font-size: 0.9rem; padding: 16px 0; text-align: center; }
.sync-item { background: var(--bg-surface-elevated); border: 1px solid var(--border-subtle); border-left: 4px solid var(--warning); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px; }
.sync-item.confirmado, .sync-item.resolvido { border-left-color: var(--success); }
.sync-item.atencao { border-left-color: var(--danger); }
.sync-item-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.sync-item-line { font-size: 0.85rem; color: var(--text-muted); overflow-wrap: anywhere; }
.sync-value { color: var(--gold-primary); font-weight: 800; }
.sync-check { color: var(--success); font-weight: 900; }
.sync-note { font-size: 0.8rem; color: #fcd34d; margin-top: 6px; }
.sync-note.danger { color: #fca5a5; }
.sync-receipt-btn { margin-top: 10px; min-height: 44px; font-size: 0.85rem; }

.receipt-provisional { background: rgba(245, 158, 11, 0.16); border: 1px dashed var(--warning); color: #fde68a; border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.8rem; margin: 12px 0; line-height: 1.4; }

.offline-note { background: var(--warning-bg); border: 1px solid rgba(245, 158, 11, 0.45); color: #fcd34d; border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.82rem; margin-bottom: 12px; line-height: 1.4; }
.offline-reserva-btn { display: block; width: 100%; text-align: left; min-height: 56px; margin-bottom: 8px; }


/* ==========================================================================
   LEGIBILIDADE NO CELULAR (v2.3.2): tabelas viram cartões; extrato compacto
   ========================================================================== */
.extrato-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.extrato-cell { padding: 12px 14px; margin: 0; }
.extrato-cell .stat-label { font-size: 0.72rem; line-height: 1.25; }
.extrato-cell .stat-value { font-size: 1.15rem; overflow-wrap: anywhere; }
.extrato-final { border-color: rgba(212, 175, 55, 0.6); background: rgba(212, 175, 55, 0.07); }
.extrato-final .stat-value { color: var(--gold-primary); }
.extrato-conferencia { font-size: 0.82rem; border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 14px; line-height: 1.4; }
.extrato-conferencia:empty { display: none; }
.extrato-conferencia.ok { background: var(--success-bg); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.35); }
.extrato-conferencia.divergente { background: var(--danger-bg); color: #fecaca; border: 1px solid rgba(239, 68, 68, 0.45); }

@media (max-width: 700px) {
  .table-responsive { border: 0; overflow: visible; }
  table.data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table thead { display: none; }
  .data-table tr { background: var(--bg-surface-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); margin-bottom: 10px; padding: 8px 12px; }
  table.data-table td { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 7px 0; border: 0; border-bottom: 1px dashed var(--border-subtle); text-align: right !important; overflow-wrap: anywhere; white-space: normal !important; }
  table.data-table td:last-child { border-bottom: 0; }
  .data-table td::before { content: attr(data-label); flex: 0 0 34%; text-align: left; color: var(--text-muted); font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.02em; }
  .data-table td[data-label=""]::before, .data-table td:not([data-label])::before { content: none; }
  .data-table td[colspan] { display: block; text-align: center !important; }
  .data-table td[colspan]::before { content: none; }
  .data-table td code { word-break: break-word; }
  .data-table .cell-content { flex: 1 1 auto; min-width: 0; text-align: right; overflow-wrap: anywhere; }
  .data-table .cell-content .btn { width: auto; }
  .data-table td .btn { min-height: 44px !important; padding: 8px 12px !important; font-size: 0.85rem !important; margin: 4px 0 0 6px !important; }
  .data-table td[data-label="Ações"], .data-table td[data-label="Acoes"], .data-table td[data-label="AÇÕES"] { flex-wrap: wrap; justify-content: flex-end; }
}


/* ==========================================================================
   ADMINISTRAÇÃO v2.3.2: menu com ícones 3D e cabeçalhos padronizados
   (estilos centralizados aqui; todas as seções usam as mesmas classes)
   ========================================================================== */
#modalAdmin .modal-header h2.admin-modal-title { display: flex; align-items: center; gap: 10px; }
.admin-modal-icon { width: 32px; height: 32px; object-fit: contain; flex: 0 0 32px; }

.admin-menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.admin-menu-btn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 6px;
  min-height: 96px; min-width: 0;
  padding: 10px 6px 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font: inherit; font-size: 0.92rem; font-weight: 700; line-height: 1.2;
  text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.admin-menu-btn:active { background: var(--bg-surface-highlight); }
.admin-menu-btn:focus-visible { outline: 2px solid var(--gold-hover); outline-offset: 2px; }
.admin-menu-btn.active {
  border-color: var(--gold-primary);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.18), rgba(212, 175, 55, 0.05));
  box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.4);
  color: var(--gold-primary);
}
.admin-menu-btn:disabled { opacity: .5; cursor: not-allowed; }
.admin-menu-iconwrap { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; flex: 0 0 48px; }
.admin-menu-icon { width: 48px; height: 48px; object-fit: contain; display: block; }
.admin-menu-label { display: block; width: 100%; overflow-wrap: anywhere; hyphens: auto; text-wrap: balance; }
.admin-menu-badge {
  position: absolute; top: 6px; right: 6px;
  min-width: 22px; height: 22px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full);
  background: var(--warning); color: #1a1200;
  font-size: 0.75rem; font-weight: 900; line-height: 1;
}
.admin-menu-badge[hidden] { display: none; }
.admin-menu-badge[data-state=loading] { background: var(--bg-surface-highlight); color: var(--text-muted); border: 1px solid var(--border-strong); }
.admin-menu-badge[data-state=error] { background: var(--danger); color: #fff; }
@media (max-width: 300px) { .admin-menu { grid-template-columns: minmax(0, 1fr); } }

.admin-section-head {
  display: grid; grid-template-columns: minmax(0, 1fr);
  row-gap: 4px; align-items: start;
  margin: 4px 0 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border-subtle);
}
.admin-section-title { grid-column: 1; grid-row: 1; margin: 0; font-size: 1.2rem; font-weight: 800; line-height: 1.25; color: var(--gold-primary); }
.admin-section-desc { grid-column: 1; grid-row: 2; margin: 0; font-size: 0.88rem; line-height: 1.4; color: var(--text-muted); }
.admin-section-meta { font-size: 0.85rem; line-height: 1.45; color: var(--text-muted); margin: -4px 0 12px; }
.admin-section-meta strong { color: #fff; }
.admin-section-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; }
.admin-section-actions .btn { width: auto; flex: 1 1 140px; min-height: 48px; padding: 0 16px; font-size: 0.9rem; }
.admin-block { margin-top: 18px; }
.admin-block-title { font-size: 1.02rem; font-weight: 800; color: #fff; margin: 0 0 4px; line-height: 1.3; }
.admin-block-desc { font-size: 0.84rem; color: var(--text-muted); margin: 0 0 12px; line-height: 1.4; }
.admin-empty { padding: 18px 14px; text-align: center; color: var(--text-muted); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); font-size: 0.95rem; }
.admin-error { padding: 12px 14px; color: #fecaca; background: var(--danger-bg); border: 1px solid rgba(239, 68, 68, 0.4); border-radius: var(--radius-sm); font-size: 0.9rem; }
.audit-details { font-size: 0.8rem; line-height: 1.45; color: var(--text-muted); }
.audit-k { color: var(--text-main); font-weight: 700; }
#modalAdmin button:disabled, #modalAdmin .btn:disabled { opacity: .5; cursor: not-allowed; }


/* ==========================================================================
   BOTÕES DE AÇÃO COM ÍCONE 3D (Atualizar, Registrar ajuste, Concluir, Cancelar)
   Um único padrão; as variantes mudam apenas a borda.
   ========================================================================== */
.acao-par { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 10px; margin: 0 0 16px; }
.btn-acao {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; min-width: 0; width: 100%;
  padding: 8px 14px;
  background: #1b2027;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font: inherit; font-size: 0.95rem; font-weight: 800; line-height: 1.2; text-align: center;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-acao:active { background: var(--bg-surface-highlight); }
.btn-acao:focus-visible { outline: 2px solid var(--gold-hover); outline-offset: 2px; }
.btn-acao-icone { width: 30px; height: 30px; flex: 0 0 30px; object-fit: contain; display: block; }
.btn-acao-texto { min-width: 0; overflow-wrap: anywhere; }
.btn-acao--ouro { border-color: var(--gold-primary); box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.25); }
.btn-acao--neutro { border-color: rgba(255, 255, 255, 0.28); }
.btn-acao--perigo { border-color: rgba(239, 68, 68, 0.55); box-shadow: inset 3px 0 0 var(--danger); }
.btn-acao:disabled, .btn-acao[aria-busy="true"] { opacity: 0.6; cursor: not-allowed; }
.btn-acao[aria-busy="true"] .btn-acao-icone { display: none; }
.btn-acao[aria-busy="true"]::before {
  content: ""; flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.25); border-top-color: var(--gold-primary);
  animation: acaoGira 0.8s linear infinite;
}
@keyframes acaoGira { to { transform: rotate(360deg); } }

/* Cartão de pendência: dados em linhas legíveis, botões ao final */
.pend-card { background: var(--bg-surface-elevated); border: 1px solid var(--border-subtle); border-left: 4px solid var(--warning); border-radius: var(--radius-md); padding: 14px; margin-bottom: 14px; }
.pend-topo { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.pend-tipo { font-size: 1.05rem; font-weight: 800; color: #fff; }
.pend-dados { margin: 0 0 12px; display: grid; grid-template-columns: minmax(0, 38%) minmax(0, 1fr); gap: 0; }
.pend-dados dt, .pend-dados dd { padding: 7px 0; border-bottom: 1px dashed var(--border-subtle); font-size: 0.88rem; line-height: 1.35; margin: 0; }
.pend-dados dt { color: var(--text-muted); font-weight: 700; padding-right: 8px; }
.pend-dados dd { color: var(--text-main); overflow-wrap: anywhere; text-align: right; }
.pend-dados dd.valor { color: var(--gold-primary); font-weight: 800; }
.pend-info { font-size: 0.84rem; color: #fcd34d; background: var(--warning-bg); border-radius: var(--radius-sm); padding: 8px 10px; margin: 0 0 12px; line-height: 1.4; }
.resolver-intro { font-size: 0.92rem; line-height: 1.45; margin: 0 0 12px; color: var(--text-main); }
.resolver-check { display: flex; align-items: flex-start; gap: 12px; padding: 12px; margin: 0 0 14px; border: 1px solid var(--gold-primary); border-radius: var(--radius-sm); background: rgba(212, 175, 55, 0.08); font-size: 0.9rem; line-height: 1.4; cursor: pointer; }
.resolver-check input { width: 26px; height: 26px; flex: 0 0 26px; margin-top: 1px; accent-color: var(--gold-primary); }


/* Campos opcionais, aviso de nome sugerido, links e dicas */
.opcional { font-weight: 600; font-size: 0.78rem; color: var(--text-muted); }
.nome-aviso { display: block; margin-top: 6px; font-size: 0.8rem; line-height: 1.35; color: #fcd34d; }
.admin-hint { font-size: 0.84rem; line-height: 1.45; color: var(--text-muted); margin: 0 0 12px; }
.link-btn { background: none; border: 0; padding: 4px 2px; font: inherit; font-weight: 800; color: var(--gold-primary); text-decoration: underline; cursor: pointer; min-height: 32px; }
.btn-linha { min-height: 44px; padding: 8px 14px; font-size: 0.85rem; width: auto; }

.aparelho-linha { padding: 10px 12px; margin-bottom: 8px; border-left: 3px solid var(--border-strong); background: rgba(255,255,255,0.04); border-radius: 6px; font-size: 0.85rem; line-height: 1.4; }
.aparelho-detalhe { color: var(--text-muted); font-size: 0.8rem; overflow-wrap: anywhere; }


/* ==========================================================================
   ÍCONES PADRONIZADOS (v2.3.2) — uma função, um arquivo (ver js/icons.js)
   ========================================================================== */
.modal-header h2.modal-h2 { display: flex; align-items: center; gap: 10px; min-width: 0; line-height: 1.25; }
.modal-h2 > span:not(.ico) { min-width: 0; overflow-wrap: anywhere; }
.ico { display: inline-block; object-fit: contain; flex: 0 0 auto; vertical-align: middle; }
.ico-h { width: 34px; height: 34px; }
.ico-inline { width: 22px; height: 22px; margin-right: 6px; }
.ico-destaque { width: 64px; height: 64px; }
.ico-pendente { display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem; line-height: 1; }  /* função ainda sem arte aprovada */
.status-badge .ico { width: 18px; height: 18px; margin-right: 4px; vertical-align: -4px; }
.modal-header .close-modal-btn { min-width: 48px; min-height: 48px; }

/* Perfil do Atendimento */
.perfil-secao { background: rgba(255,255,255,0.03); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 14px; margin-bottom: 14px; }
.perfil-secao-topo { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.perfil-secao-titulo { margin: 0; font-size: 1.05rem; font-weight: 800; color: var(--gold-primary); }
.versao-selo { font-size: 0.75rem; font-weight: 800; padding: 3px 10px; border-radius: var(--radius-full); color: var(--gold-primary); background: rgba(212,175,55,0.12); border: 1px solid rgba(212,175,55,0.35); white-space: nowrap; }
.perfil-secao-desc { margin: 0 0 12px; font-size: 0.86rem; line-height: 1.4; color: var(--text-muted); }
.perfil-acoes-largas { display: flex; flex-direction: column; gap: 10px; }
.btn-acao--larga { width: 100%; justify-content: flex-start; padding-left: 16px; }
.btn-acao--sair { border-color: rgba(239, 68, 68, 0.6); box-shadow: inset 3px 0 0 var(--danger); background: #1f1719; }
.btn-acao--sair .btn-acao-texto { color: #fecaca; }

/* Perfil: rótulo e valor nunca colados; valores longos quebram à direita */
#modalPerfil .info-item { gap: 14px; align-items: flex-start; }
#modalPerfil .info-item > span { flex: 0 0 auto; }
#modalPerfil .info-item > strong { min-width: 0; text-align: right; overflow-wrap: anywhere; }

/* Regularização de período anterior: aparece à parte, sem parecer movimento da noite */
.regul-box { margin: 0 0 16px; padding: 12px; border: 1px dashed var(--gold-primary); border-radius: var(--radius-sm); background: rgba(212,175,55,0.05); }
.regul-titulo { font-size: 0.92rem; font-weight: 800; color: var(--gold-primary); margin: 0 0 6px; }
.regul-aviso { font-size: 0.78rem; color: var(--text-muted); margin: 0 0 8px; line-height: 1.4; }
.regul-item { font-size: 0.82rem; padding: 8px 10px; margin-bottom: 6px; border-radius: 6px; background: rgba(255,255,255,0.04); border-left: 2px solid var(--gold-primary); overflow-wrap: anywhere; }
.regul-item small { color: var(--text-muted); }
.regul-total { font-size: 0.82rem; text-align: right; margin-top: 6px; }
.regul-tag { display: inline-block; margin-top: 4px; padding: 2px 6px; font-size: 0.7rem; color: var(--gold-primary); border: 1px dashed var(--gold-primary); border-radius: 6px; line-height: 1.3; }

.regul-conf { margin-top: 6px; font-size: 0.78rem; }
.regul-conf small { color: var(--text-muted); }
.regul-btn { min-height: 40px; padding: 6px 12px; font-size: 0.82rem; width: auto; margin-top: 6px; }

/* Atualização do aplicativo (fluxo único) */
.upd-versoes { text-align: center; margin-bottom: 16px; }
.upd-titulo { font-size: 1.2rem; font-weight: 800; color: var(--gold-primary); margin: 0 0 4px; }
.upd-linha { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; font-size: 0.88rem; color: var(--text-muted); }
.upd-linha strong { color: #fff; }
.upd-linha .upd-nova { color: var(--gold-primary); }
.upd-notas { background: rgba(255,255,255,0.03); border: 1px solid var(--border-subtle); border-radius: 10px; padding: 14px; margin-bottom: 16px; }
.upd-notas-titulo { font-size: 0.82rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 8px; }
.upd-notas-texto { font-size: 0.9rem; color: #fff; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.upd-progresso { margin-bottom: 16px; }
.upd-trilho { height: 12px; border-radius: 6px; background: rgba(255,255,255,0.1); overflow: hidden; }
.upd-barra { height: 100%; background: var(--gold-primary); border-radius: 6px; transition: width 0.25s ease; }
.upd-status { margin-top: 8px; font-size: 0.88rem; line-height: 1.4; color: #fff; overflow-wrap: anywhere; }
.upd-aviso { margin-bottom: 16px; padding: 12px; border: 1px solid var(--gold-primary); border-radius: 10px; background: rgba(212,175,55,0.08); }
.upd-aviso p { margin: 0 0 10px; font-size: 0.9rem; line-height: 1.45; color: #fff; }
.upd-aviso .upd-dica { margin: 10px 0 0; font-size: 0.8rem; color: var(--text-muted); }
.upd-erro { margin-bottom: 16px; padding: 12px; border-radius: 10px; border: 1px solid var(--danger); background: rgba(239,68,68,0.1); color: #fecaca; font-size: 0.9rem; line-height: 1.45; overflow-wrap: anywhere; }
.upd-acoes { display: flex; flex-direction: column; gap: 10px; }
.perfil-update-aviso { margin: 6px 0 10px; font-size: 0.85rem; font-weight: 700; color: var(--gold-primary); }
[hidden] { display: none !important; }

/* Envio manual do comprovante pelo WhatsApp */
.recibo-wa-status { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--gold-primary); background: rgba(212,175,55,0.08); font-size: 0.85rem; line-height: 1.45; color: #fff; overflow-wrap: anywhere; }
.recibo-wa-alt { padding: 12px; border-radius: 10px; border: 1px solid var(--border-subtle); background: rgba(255,255,255,0.04); }
.recibo-wa-alt p { margin: 0 0 10px; font-size: 0.88rem; line-height: 1.45; color: #fff; }
