/* =========================================
   ValeControl — style.css
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── CSS VARIABLES ─────────────────────── */
:root {
  --bg:           #f5f6fa;
  --bg-card:      #ffffff;
  --sidebar-bg:   #111827;
  --sidebar-w:    240px;

  --text-primary:   #111827;
  --text-secondary: #6b7280;
  --text-muted:     #9ca3af;
  --text-inverse:   #ffffff;

  --brand:        #3b82f6;
  --brand-dark:   #2563eb;
  --brand-light:  #dbeafe;

  --success:      #10b981;
  --success-bg:   #d1fae5;
  --danger:       #ef4444;
  --danger-bg:    #fee2e2;
  --warning:      #f59e0b;
  --warning-bg:   #fef3c7;

  --border:       #e5e7eb;
  --border-focus: #3b82f6;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:     0 4px 16px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.05);
  --shadow-lg:  0 10px 40px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.06);

  --radius-sm:  8px;
  --radius:     12px;
  --radius-lg:  16px;

  --transition: all .2s cubic-bezier(.4,0,.2,1);
}

[data-theme="dark"] {
  --bg:           #0f172a;
  --bg-card:      #1e293b;
  --sidebar-bg:   #020617;
  
  --text-primary:   #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  --text-inverse:   #ffffff;

  --border:       #334155;
  --brand-light:  rgba(59, 130, 246, 0.15);
  
  --success-bg:   rgba(16, 185, 129, 0.15);
  --danger-bg:    rgba(239, 68, 68, 0.15);
  --warning-bg:   rgba(245, 158, 11, 0.15);
}

/* ─── RESET & BASE ───────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
a { text-decoration: none; }

/* ─── SIDEBAR ────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 200;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.125rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.logo {
  display: flex;
  align-items: center;
  gap: .625rem;
}

.logo-icon {
  width: 36px; height: 36px;
  background: var(--brand);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: white;
  flex-shrink: 0;
}

.logo-text {
  font-size: .9375rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.02em;
}

.sidebar-close {
  display: none;
  background: none; border: none;
  color: rgba(255,255,255,.5);
  padding: .25rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.sidebar-close:hover { color: white; background: rgba(255,255,255,.1); }

/* NAV */
.sidebar-nav {
  flex: 1;
  padding: 1rem .75rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem .875rem;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.55);
  font-size: .875rem;
  font-weight: 500;
  transition: var(--transition);
}
.nav-item:hover {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.85);
}
.nav-item.active {
  background: var(--brand);
  color: white;
}
.nav-item svg { flex-shrink: 0; }

.sidebar-footer {
  padding: 1rem .75rem;
  border-top: 1px solid rgba(255,255,255,.07);
}

.user-info {
  display: flex; align-items: center; gap: .75rem;
}

.user-avatar {
  width: 36px; height: 36px;
  background: var(--brand);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .875rem; font-weight: 700; color: white;
  flex-shrink: 0;
  text-transform: uppercase;
}

.user-details {
  display: flex; flex-direction: column; gap: .1rem; overflow: hidden;
}
.user-name {
  font-size: .8125rem; font-weight: 600; color: white;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-role { font-size: .75rem; color: rgba(255,255,255,.4); }

/* ─── MAIN CONTENT ───────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .3s cubic-bezier(.4,0,.2,1);
}

/* ─── TOPBAR ─────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  height: 68px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  gap: 1rem;
}

.topbar-left { display: flex; align-items: center; gap: .875rem; }

.menu-toggle {
  display: none;
  background: none; border: none;
  color: var(--text-secondary);
  padding: .375rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.menu-toggle:hover { background: var(--bg); color: var(--text-primary); }

.page-title {
  font-size: 1.1rem; font-weight: 700; color: var(--text-primary);
  letter-spacing: -.02em; line-height: 1.2;
}
.page-subtitle { font-size: .75rem; color: var(--text-muted); }

/* Month Selector */
.month-selector {
  display: flex; align-items: center; gap: .5rem;
  background: var(--bg);
  padding: .375rem .625rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.month-btn {
  background: none; border: none;
  color: var(--text-secondary);
  padding: .2rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  transition: var(--transition);
}
.month-btn:hover { background: var(--border); color: var(--text-primary); }
.month-label {
  font-size: .8125rem; font-weight: 600;
  color: var(--text-primary);
  min-width: 110px; text-align: center;
}

/* ─── PAGE CONTENT ───────────────────────── */
.page-content { padding: 1.75rem; max-width: 1200px; width: 100%; }


.page { display: none; }
.page.active { display: block; }

/* ─── CARD ───────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}

/* ─── SUMMARY CARDS ─────────────────────── */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.summary-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 0;
}

.card-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.salary-icon          { background: #dbeafe; color: #2563eb; }
.recebido-icon        { background: #dcfce7; color: #16a34a; }
.renda-pendente-icon  { background: #fef3c7; color: #d97706; }
.vales-icon           { background: #fef3c7; color: #d97706; }
.contas-icon    { background: #fce7f3; color: #db2777; }
.pendentes-icon { background: #ffedd5; color: #ea580c; }
.balance-icon   { background: #d1fae5; color: #059669; }
.gastos-icon    { background: #ede9fe; color: #7c3aed; }

.card-label {
  display: block;
  font-size: .75rem; font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .25rem;
}
.card-value {
  display: block;
  font-size: 1.375rem; font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.03em;
  line-height: 1;
}

/* ─── PROGRESS ───────────────────────────── */
.progress-section { }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.section-title { font-size: .9375rem; font-weight: 700; color: var(--text-primary); }
.section-badge {
  font-size: .75rem; font-weight: 600;
  background: var(--brand-light);
  color: var(--brand-dark);
  padding: .2rem .625rem;
  border-radius: 999px;
}
.section-actions { display: flex; gap: .5rem; }

.progress-track {
  height: 10px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: .875rem;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--brand) 0%, #7c3aed 100%);
  border-radius: 999px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
}
.progress-bar.danger  { background: linear-gradient(90deg, #f59e0b 0%, #ef4444 100%); }
.progress-bar.full    { background: var(--danger); }

.progress-legend {
  display: flex; gap: 1.5rem; flex-wrap: wrap;
}
.legend-item {
  display: flex; align-items: center; gap: .4rem;
  font-size: .8125rem; color: var(--text-secondary);
}
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.vales-dot   { background: var(--warning); }
.contas-dot    { background: #db2777; }
.gastos-dot    { background: #8b5cf6; }
.pendentes-dot { background: #ea580c; }
.balance-dot   { background: var(--success); }

/* ─── TRANSACTIONS LIST ──────────────────── */
.transactions-list { min-height: 80px; }

.tx-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--bg);
  transition: var(--transition);
}
.tx-item:last-child { border-bottom: none; }
.tx-item:hover { background: transparent; }

.tx-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}
.tx-icon.vale  { background: #fef3c7; }
.tx-icon.conta { background: #fce7f3; }

.tx-info { flex: 1; min-width: 0; }
.tx-desc {
  font-size: .875rem; font-weight: 500; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tx-date { font-size: .75rem; color: var(--text-muted); }

.tx-amount {
  font-size: .9375rem; font-weight: 700;
  color: var(--danger);
  white-space: nowrap;
}

/* ─── EMPTY STATE ────────────────────────── */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
}
.empty-icon { color: var(--text-muted); margin-bottom: 1rem; }
.empty-title { font-size: .9375rem; font-weight: 600; color: var(--text-secondary); margin-bottom: .375rem; }
.empty-desc { font-size: .8125rem; color: var(--text-muted); margin-bottom: 1.25rem; }
.empty-actions { display: flex; gap: .625rem; justify-content: center; flex-wrap: wrap; }

/* ─── PAGE TOOLBAR ───────────────────────── */
.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.search-box {
  display: flex; align-items: center; gap: .5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .5rem .875rem;
  flex: 1; max-width: 320px;
  transition: var(--transition);
}
.search-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.search-box svg { color: var(--text-muted); flex-shrink: 0; }
.search-box input {
  border: none; outline: none;
  background: transparent;
  color: var(--text-primary);
  font-size: .875rem; width: 100%;
}
.search-box input::placeholder { color: var(--text-muted); }

/* ─── DATA TABLE ─────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%; border-collapse: collapse;
  font-size: .875rem;
}
.data-table th {
  padding: .625rem 1rem;
  text-align: left;
  font-size: .6875rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.data-table th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.data-table th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }
.data-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--bg);
  color: var(--text-primary);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover td { background: #fafbff; }

.table-empty { display: none; }
.table-empty.visible { display: block; }

.table-footer {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: .875rem 1rem 0;
  border-top: 1px solid var(--bg);
  font-size: .8125rem; color: var(--text-muted);
  margin-top: .5rem;
}
.total-badge {
  font-weight: 700; color: var(--danger);
}

/* ─── STATUS BADGE ───────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .625rem;
  border-radius: 999px;
  font-size: .6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}
.badge-pending    { background: var(--warning-bg); color: #92400e; }
.badge-done       { background: var(--success-bg); color: #065f46; }

/* ─── ACTION BUTTONS ─────────────────────── */
.action-btns { display: flex; gap: .375rem; }
.action-btn {
  background: none; border: none;
  padding: .3rem .4rem;
  border-radius: 6px;
  color: var(--text-muted);
  transition: var(--transition);
  display: flex; align-items: center;
}
.action-btn:hover { color: var(--text-primary); background: var(--bg); }
.action-btn.del:hover { color: var(--danger); background: var(--danger-bg); }

/* ─── FILTER ROW ─────────────────────────── */
.filter-row {
  display: flex; gap: .75rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.filter-select {
  padding: .5rem .875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: .875rem;
  outline: none;
  transition: var(--transition);
  cursor: pointer;
}
.filter-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59,130,246,.12); }

/* ─── CATEGORY ICON ──────────────────────── */
.cat-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .8rem; color: var(--text-secondary);
}

/* ─── CONFIGURAÇÕES ──────────────────────── */
.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.config-stats { display: flex; flex-direction: column; gap: 0; }
.config-stat {
  display: flex; align-items: center; justify-content: space-between;
  padding: .875rem 0;
  border-bottom: 1px solid var(--bg);
}
.config-stat:last-child { border-bottom: none; }
.config-stat.border-top { border-top: 1px solid var(--border); border-bottom: none; padding-top: 1rem; margin-top: .25rem; }
.config-stat-label { font-size: .875rem; color: var(--text-secondary); }
.config-stat-value { font-size: .9375rem; font-weight: 600; color: var(--text-primary); }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }

.danger-zone {
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--danger-bg);
  border-radius: var(--radius-sm);
  border: 1px solid #fca5a5;
}
.danger-title { font-size: .875rem; font-weight: 700; color: var(--danger); margin-bottom: .25rem; }
.danger-desc  { font-size: .8rem; color: #7f1d1d; margin-bottom: .75rem; }

/* ─── BUTTONS ────────────────────────────── */
.btn-primary, .btn-secondary, .btn-outline, .btn-danger, .btn-success {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 600;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--brand); color: white;
}
.btn-primary:hover { background: var(--brand-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59,130,246,.35); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg); color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-outline {
  background: transparent; color: var(--brand);
  border: 1px solid var(--brand);
}
.btn-outline:hover { background: var(--brand-light); }

.btn-success {
  background: var(--success); color: white;
}
.btn-success:hover { background: #059669; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16,185,129,.35); }
.btn-success:active { transform: translateY(0); }

.btn-danger {
  background: var(--danger); color: white;
}
.btn-danger:hover { background: #dc2626; }

/* ─── FORM ELEMENTS ──────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: .8125rem; font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: .4rem;
}
.form-input {
  width: 100%;
  padding: .625rem .875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: .875rem;
  outline: none;
  transition: var(--transition);
}
.form-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.form-textarea { resize: vertical; min-height: 72px; }

/* ─── MODAL ──────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 300;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(.97);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .25s ease;
  max-height: 90vh; overflow-y: auto;
}
.modal-backdrop.open .modal { transform: translateY(0) scale(1); }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close {
  background: none; border: none;
  color: var(--text-muted);
  padding: .25rem; border-radius: 6px;
  display: flex; transition: var(--transition);
}
.modal-close:hover { color: var(--text-primary); background: var(--bg); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: .625rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

/* ─── TOAST ──────────────────────────────── */
.toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  display: flex; flex-direction: column; gap: .5rem;
  z-index: 500;
}
.toast {
  display: flex; align-items: center; gap: .75rem;
  padding: .875rem 1.125rem;
  background: #1f2937;
  color: white;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: .875rem; font-weight: 500;
  min-width: 260px;
  animation: slideInToast .3s cubic-bezier(.34,1.56,.64,1);
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error   { border-left: 4px solid var(--danger); }
.toast.info    { border-left: 4px solid var(--brand); }

@keyframes slideInToast {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ─── OVERLAY ────────────────────────────── */
.overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 150;
}
.overlay.show { display: block; }

/* ─── INCOME SOURCES (dashboard) ─────────── */
.income-sources-card { padding: 1.25rem 1.5rem; }

.income-chips-wrap {
  display: flex; flex-wrap: wrap; gap: .625rem;
  margin-top: .75rem; min-height: 36px;
}

.income-chip {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .35rem .875rem;
  font-size: .8125rem;
  transition: var(--transition);
}
.income-chip:hover { border-color: var(--brand); background: var(--brand-light); }
.income-chip-icon  { font-size: 1rem; line-height: 1; }
.income-chip-name  { font-weight: 500; color: var(--text-primary); }
.income-chip-val   { font-weight: 700; color: var(--success); }

.income-hint { font-size: .8125rem; color: var(--text-muted); }

/* ─── INCOME SOURCES (config) ────────────── */
.income-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.income-section-header {
  display: flex; align-items: flex-start; flex-wrap: wrap;
  justify-content: space-between; gap: 1rem;
  margin-bottom: 1rem;
}
.income-section-title { font-size: .9375rem; font-weight: 700; color: var(--text-primary); }
.income-section-desc  { font-size: .8rem; color: var(--text-muted); margin-top: .1rem; }

.income-sources-list { display: flex; flex-direction: column; gap: .5rem; }

.income-source-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: .75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.income-source-row:hover { border-color: #d1d5db; }
.income-source-row.inactive { opacity: .5; }

.income-source-left {
  display: flex; align-items: center; gap: .75rem; flex: 1; min-width: 0;
}
.income-type-badge {
  font-size: .8rem; white-space: nowrap;
  background: var(--brand-light); color: var(--brand-dark);
  padding: .2rem .6rem; border-radius: 999px;
  font-weight: 600; flex-shrink: 0;
}
.income-source-info {
  display: flex; flex-direction: column; gap: .1rem; min-width: 0;
}
.income-source-name {
  font-size: .875rem; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.income-source-val { font-size: .8rem; color: var(--success); font-weight: 600; }

.income-source-actions {
  display: flex; align-items: center; gap: .375rem; flex-shrink: 0;
}

.income-status-btn {
  border: none;
  cursor: pointer;
  padding: .25rem .65rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  transition: all .15s ease;
  white-space: nowrap;
}
.income-status-btn.paid {
  background: rgba(16, 185, 129, .12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, .3);
}
.income-status-btn.paid:hover {
  background: rgba(16, 185, 129, .22);
  transform: translateY(-1px);
}
.income-status-btn.pending {
  background: rgba(245, 158, 11, .12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, .3);
}
.income-status-btn.pending:hover {
  background: rgba(245, 158, 11, .22);
  transform: translateY(-1px);
}


/* Toggle Switch */
.toggle-switch { position: relative; display: inline-block; width: 36px; height: 20px; cursor: pointer; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: #d1d5db; border-radius: 999px;
  transition: var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 3px; top: 3px;
  background: white; border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--success); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }

.income-empty {
  padding: 1.25rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: .875rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
}

/* ─── RESPONSIVE ─────────────────────────── */
@media (max-width: 1024px) {
  .summary-cards { grid-template-columns: repeat(2, 1fr); }
  .config-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: flex; }
  .menu-toggle { display: flex; }

  .main-content { margin-left: 0; }

  .topbar { padding: 0 1rem; }
  .page-content { padding: 1rem; }

  .summary-cards { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .summary-card { padding: 1rem 1.125rem; }
  .card-value { font-size: 1.125rem; }

  .page-toolbar { flex-direction: column; align-items: stretch; }
  .search-box { max-width: 100%; }

  .filter-row { flex-direction: column; }

  .month-label { min-width: 90px; font-size: .75rem; }
  .page-title { font-size: 1rem; }
  .page-subtitle { display: none; }

  .modal { max-width: calc(100% - 2rem); margin: 0 1rem; }
}

@media (max-width: 480px) {
  .summary-cards { grid-template-columns: 1fr; }
  .progress-legend { flex-direction: column; gap: .5rem; }
  .table-footer { flex-direction: column; gap: .375rem; align-items: flex-start; }
}



/* ─── SEARCH BAR ─────────────────────────── */
.search-bar-wrap {
  display: flex; align-items: center; gap: .625rem;
  padding: .625rem 1rem !important;
  margin-bottom: 1rem;
}
.search-bar-wrap svg { color: var(--text-muted); flex-shrink: 0; }
.search-input {
  flex: 1; border: none; outline: none;
  background: transparent;
  font-size: .875rem; color: var(--text-primary);
  font-family: inherit;
}
.search-input::placeholder { color: var(--text-muted); }

/* ─── CLIENTS STATS ──────────────────────── */
.clients-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: .875rem; margin-bottom: 1rem;
}
.client-stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem;
  display: flex; flex-direction: column; gap: .25rem;
}
.csc-label { font-size: .75rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.csc-value { font-size: 1.375rem; font-weight: 800; color: var(--text-primary); }
.csc-value.success { color: var(--success); }
.csc-value.brand   { color: var(--brand); }

/* ─── CLIENT TABLE ───────────────────────── */
.clients-list {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.clients-table {
  width: 100%;
  min-width: 700px;           /* force scroll before crushing */
  border-collapse: collapse;
  font-size: .875rem;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.clients-table thead tr {
  background: var(--bg);
  border-bottom: 2px solid var(--border);
}
.clients-table th {
  padding: .8rem 1rem;
  text-align: left;
  font-size: .7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
  user-select: none;
}

.clients-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.clients-table tbody tr:last-child { border-bottom: none; }
.clients-table tbody tr:hover     { background: #f5f8ff; }
.clients-table tbody tr.ct-inactive { opacity: .5; }

.clients-table td {
  padding: .85rem 1rem;
  vertical-align: middle;
}

/* col: avatar + name */
.ct-name-cell {
  display: flex; align-items: center; gap: .75rem;
}
.client-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white; font-size: .875rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  text-transform: uppercase;
}
.ct-name { font-weight: 700; color: var(--text-primary); font-size: .875rem; }
.ct-cpf  { font-size: .72rem; color: var(--text-muted); margin-top: .1rem; font-family: monospace; letter-spacing: .03em; }

/* col: contact */
.ct-contact { font-size: .8rem; color: var(--text-secondary); line-height: 1.6; }
.ct-contact span { display: block; }

/* col: address */
.ct-address { font-size: .8rem; color: var(--text-secondary); line-height: 1.5; }
.ct-address .ct-neigh { font-weight: 600; color: var(--text-primary); font-size: .8125rem; }

/* col: due / value */
.ct-due   { font-size: .8125rem; color: var(--text-secondary); white-space: nowrap; text-align: center; }
.ct-due strong { color: var(--text-primary); font-size: .9rem; }
.ct-value {
  font-weight: 800; color: var(--success);
  font-size: .9375rem; white-space: nowrap;
}
.ct-value small { font-size: .68rem; color: var(--text-muted); font-weight: 400; }

/* col: status */
.client-status-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .71rem; padding: .25rem .65rem;
  border-radius: 999px; font-weight: 700; white-space: nowrap;
  letter-spacing: .02em;
}
.client-status-badge::before {
  content: ''; width: 6px; height: 6px;
  border-radius: 50%; display: inline-block; flex-shrink: 0;
}
.client-status-badge.active  { background: #dcfce7; color: #15803d; }
.client-status-badge.active::before  { background: #22c55e; }
.client-status-badge.inactive{ background: #f3f4f6; color: #6b7280; }
.client-status-badge.inactive::before{ background: #9ca3af; }

/* col: notes */
.ct-notes {
  font-size: .775rem; color: var(--text-muted);
  max-width: 140px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: help;
}

/* col: actions */
.ct-actions { display: flex; gap: .25rem; justify-content: flex-end; }
.client-actions { display: flex; gap: .25rem; flex-shrink: 0; }


/* ══════════════════════════════════════════
   MOBILE: transform table → cards
   ══════════════════════════════════════════ */
@media (max-width: 720px) {

  .clients-list { overflow-x: visible; }

  /* hide table structure */
  .clients-table          { min-width: unset; border: none; box-shadow: none; background: transparent; }
  .clients-table thead    { display: none; }
  .clients-table tbody,
  .clients-table tr       { display: block; width: 100%; }

  /* each row = a card */
  .clients-table tbody tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: .75rem;
    padding: 0;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
  }
  .clients-table tbody tr:hover { background: #f8f9ff; }
  .clients-table tbody tr.ct-inactive { opacity: .55; }
  .clients-table tbody tr:last-child { border-bottom: 1px solid var(--border); margin-bottom: 0; }

  /* each cell = a labeled row */
  .clients-table td {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .6rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: .8125rem;
  }
  .clients-table td:last-child { border-bottom: none; }

  /* label prefix via data-label */
  .clients-table td::before {
    content: attr(data-label);
    font-size: .68rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    min-width: 80px;
    padding-top: .15rem;
    flex-shrink: 0;
  }

  /* first cell: name — no label, full width header style */
  .clients-table td:first-child {
    background: var(--bg);
    padding: .85rem 1rem;
    border-bottom: 2px solid var(--border);
  }
  .clients-table td:first-child::before { display: none; }

  /* actions cell: right-align, no label */
  .clients-table td:last-child::before { display: none; }
  .ct-actions { justify-content: flex-start; }

  /* fix widths inside cells */
  .ct-contact, .ct-address { max-width: unset; }
  .ct-notes { max-width: unset; white-space: normal; }
  .ct-due { text-align: left; }
}

/* ─── MENSALIDADES SUMMARY ───────────────── */
.mensalidades-summary {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: .875rem; margin-bottom: 1rem;
}
.ms-card {
  border-radius: var(--radius); padding: 1.1rem 1.25rem;
  border: 1px solid transparent;
  display: flex; flex-direction: column; gap: .2rem;
}
.ms-card.pending  { background: #fffbeb; border-color: #fde68a; }
.ms-card.received { background: #f0fdf4; border-color: #bbf7d0; }
.ms-card.overdue  { background: #fff1f2; border-color: #fecdd3; }

.ms-label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.ms-card.pending  .ms-label { color: #92400e; }
.ms-card.received .ms-label { color: #166534; }
.ms-card.overdue  .ms-label { color: #9f1239; }

.ms-value { font-size: 1.375rem; font-weight: 800; }
.ms-card.pending  .ms-value { color: #d97706; }
.ms-card.received .ms-value { color: #16a34a; }
.ms-card.overdue  .ms-value { color: #e11d48; }

.ms-count { font-size: .8rem; color: var(--text-muted); }

/* ─── MENSALIDADES TABLE ─────────────────── */
.mens-table-wrap { overflow-x: auto; }

.mens-table {
  width: 100%; border-collapse: collapse;
  font-size: .875rem;
}
.mens-table thead tr {
  background: var(--bg);
  border-bottom: 2px solid var(--border);
}
.mens-table th {
  padding: .75rem 1rem;
  text-align: left; font-size: .75rem;
  font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap;
}
.mens-table td { padding: .75rem 1rem; vertical-align: middle; }
.mens-table tbody tr { border-bottom: 1px solid var(--border); transition: var(--transition); }
.mens-table tbody tr:hover { background: var(--bg); }
.mens-table tbody tr:last-child { border-bottom: none; }

.mens-row.atrasado td:first-child { border-left: 3px solid #e11d48; }
.mens-row.recebido td:first-child { border-left: 3px solid #16a34a; }
.mens-row.pendente td:first-child { border-left: 3px solid #d97706; }

.mens-client-name { font-weight: 600; color: var(--text-primary); }
.mens-client-sub  { font-size: .75rem; color: var(--text-muted); }
.mens-value       { font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.mens-actions     { display: flex; gap: .25rem; }

/* ─── RECEIVABLE BADGES ──────────────────── */
.rec-badge {
  display: inline-block; padding: .2rem .625rem;
  border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap;
}
.badge-pending  { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.badge-received { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.badge-overdue  { background: #fff1f2; color: #9f1239; border: 1px solid #fecdd3; }

/* ─── RECEIVABLE MODAL HEADER ────────────── */
.rec-detail-header { background: var(--bg); border-radius: var(--radius-sm); padding: .875rem 1rem; }
.rec-client-info   { display: flex; align-items: center; gap: .875rem; }
.rec-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: white; font-size: 1rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.rec-client-name { font-size: .9375rem; font-weight: 700; color: var(--text-primary); }
.rec-client-val  { font-size: .8rem; color: var(--text-secondary); }

/* ─── STATUS OPTIONS (radio row) ─────────── */
.status-options {
  display: flex; gap: .875rem; flex-wrap: wrap; margin-top: .375rem;
}
.status-opt {
  display: flex; align-items: center; gap: .375rem;
  cursor: pointer; font-size: .875rem; color: var(--text-primary);
  padding: .45rem .875rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: var(--transition);
}
.status-opt:hover { border-color: var(--brand); background: var(--brand-light); }
.status-opt input { accent-color: var(--brand); }

/* ─── MODAL LARGE ────────────────────────── */
.modal-lg { max-width: 680px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.form-col-2  { grid-column: span 2; }
.form-label.required::after { content: ' *'; color: var(--danger); }

/* ─── BTN ICON VARIANTS ──────────────────── */
.btn-icon.success:hover { color: var(--success); background: #f0fdf4; }

/* ─── RESPONSIVE NEW SECTIONS ────────────── */
@media (max-width: 768px) {
  .clients-stats, .mensalidades-summary { grid-template-columns: 1fr; }
  .form-grid-2   { grid-template-columns: 1fr; }
  .form-col-2    { grid-column: span 1; }
  .modal-lg      { max-width: calc(100% - 2rem); }
  .mens-table th, .mens-table td { padding: .6rem .75rem; }
}
@media (max-width: 480px) {
  .clients-stats { grid-template-columns: 1fr 1fr; }
  .client-card { flex-wrap: wrap; }
}

/* ─── PRINT RECEIPT (PDF) ────────────────── */
.print-area {
  display: none;
}

@media print {
  @page { margin: 1cm; }
  
  body {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  body > :not(.print-area) {
    display: none !important;
  }
  
  .print-area {
    display: block !important;
    position: static;
    width: 100%;
    color: #000;
    background: #fff;
    padding: 2rem;
  }
  
  /* Ensure background colors and borders show in PDF */
  .receipt-box {
    border: 2px solid #000 !important;
    padding: 2rem !important;
    border-radius: 8px !important;
    max-width: 600px;
    margin: 0 auto;
  }
  .receipt-header {
    text-align: center;
    border-bottom: 2px dashed #ccc;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
  }
  .receipt-title {
    font-size: 1.5rem;
    font-weight: bold;
    text-transform: uppercase;
  }
  .receipt-value {
    font-size: 1.25rem;
    font-weight: bold;
    margin-top: 0.5rem;
  }
  .receipt-body {
    font-size: 1.1rem;
    line-height: 1.8;
    text-align: justify;
  }
  .receipt-footer {
    margin-top: 4rem;
    text-align: center;
  }
  .receipt-signature {
    border-top: 1px solid #000;
    width: 60%;
    margin: 0 auto;
    padding-top: 0.5rem;
  }
}

/* ─── VALES FILTER BUTTONS ───────────────── */
.vales-filter-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.vales-filter-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--brand);
}
.vales-filter-btn.active {
  background: rgba(59, 130, 246, 0.12);
  color: var(--brand);
  border-color: var(--brand);
}
#valesFilterPegos.active {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border-color: #d97706;
}
#valesFilterAdiant.active {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border-color: #059669;
}

/* ─── CHART TOGGLE BUTTONS ───────────────── */
.chart-toggle-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.chart-toggle-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--brand);
}
.chart-toggle-btn.active {
  background: var(--brand);
  color: #ffffff !important;
  border-color: var(--brand);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

/* ══════════════════════════════════════════
   ADMIN PANEL RESPONSIVE STYLES
   ══════════════════════════════════════════ */
#page-admin {
  max-width: 100%;
  overflow-x: hidden;
}

.adm-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.adm-manual-form {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.adm-manual-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.adm-manual-fields .adm-input-email {
  flex: 2;
  min-width: 220px;
}

.adm-manual-fields .adm-input-name {
  flex: 1.5;
  min-width: 180px;
}

.adm-manual-fields .adm-select-plan {
  flex: 1;
  min-width: 140px;
}

.adm-manual-fields .adm-select-provider {
  flex: 1;
  min-width: 120px;
}

.adm-input, .adm-select {
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.adm-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.adm-table {
  width: 100%;
  border-collapse: collapse;
}

.adm-table th {
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  font-weight: 500;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}

.adm-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  vertical-align: middle;
}

.adm-actions-wrap {
  display: inline-flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.adm-btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 6px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

/* ─── MOBILE ADAPTATIONS (max-width: 768px) ─── */
@media (max-width: 768px) {
  #page-admin .card {
    padding: 1rem 0.75rem;
  }

  .adm-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .adm-card-header button {
    width: 100%;
    justify-content: center;
  }

  .adm-manual-fields {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }

  .adm-manual-fields .adm-input-email,
  .adm-manual-fields .adm-input-name,
  .adm-manual-fields .adm-select-plan,
  .adm-manual-fields .adm-select-provider,
  .adm-manual-fields button {
    width: 100% !important;
    min-width: 0 !important;
    flex: none !important;
  }

  .adm-manual-fields button {
    padding: 0.7rem;
    font-size: 0.95rem;
  }

  .adm-filter-bar {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.6rem !important;
  }

  .adm-filter-bar .search-box {
    width: 100% !important;
    min-width: 0 !important;
    flex: none !important;
  }

  .adm-filter-bar select {
    width: 100% !important;
  }

  #adminUserCount {
    text-align: center;
    padding: 0.25rem 0;
  }

  /* Transform tables into beautiful touch-friendly cards on mobile */
  .adm-table {
    min-width: 0 !important;
    border: none;
    display: block;
    width: 100%;
  }

  .adm-table thead {
    display: none;
  }

  .adm-table tbody {
    display: block;
    width: 100%;
  }

  .adm-table tr {
    display: block;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border) !important;
    border-radius: var(--radius, 10px);
    margin-bottom: 0.85rem;
    padding: 0.85rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  }

  .adm-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0 !important;
    border-bottom: 1px dashed var(--border) !important;
    font-size: 0.85rem;
  }

  .adm-table td:last-child {
    border-bottom: none !important;
    padding-top: 0.75rem !important;
    padding-bottom: 0 !important;
    justify-content: stretch;
  }

  .adm-table td::before {
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    margin-right: 0.5rem;
  }

  .adm-table td.adm-cell-name {
    flex-direction: column;
    align-items: flex-start;
    padding-bottom: 0.6rem !important;
    border-bottom: 2px solid var(--border) !important;
    background: transparent;
  }

  .adm-table td.adm-cell-name::before {
    display: none;
  }

  .adm-table td.adm-cell-name .adm-user-name {
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    color: var(--text-primary);
  }

  .adm-table td.adm-cell-name .adm-user-sub {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 2px;
    word-break: break-all;
  }

  .adm-table td.adm-cell-actions::before {
    display: none;
  }

  .adm-actions-wrap {
    width: 100%;
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem !important;
  }

  .adm-actions-wrap .adm-btn {
    width: 100%;
    justify-content: center;
    padding: 0.55rem 0.4rem !important;
    font-size: 0.8rem !important;
    margin: 0 !important;
  }

  .adm-actions-wrap .adm-btn:first-child:nth-last-child(1) {
    grid-column: span 2;
  }

  .adm-actions-wrap .adm-btn:first-child:nth-last-child(3) {
    grid-column: span 2;
  }
}


/* ══════════════════════════════════════════
   MOBILE RESPONSIVE: ALL APP TABS (max-width: 768px)
   ══════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Global Page Container: Zero horizontal blowout */
  .page {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  /* ──────────────────────────────────────────
     1. DATA-TABLE → CARDS
     (Vales, Contas Pagas, Gastos Pessoais, Histórico)
     ────────────────────────────────────────── */
  .table-wrap {
    overflow-x: visible !important;
  }

  .data-table {
    min-width: 0 !important;
    border: none !important;
    display: block !important;
    width: 100% !important;
  }

  .data-table thead {
    display: none !important;
  }

  .data-table tbody {
    display: block !important;
    width: 100% !important;
  }

  .data-table tbody tr {
    display: block !important;
    width: 100% !important;
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius, 10px) !important;
    margin-bottom: 0.85rem !important;
    padding: 0.85rem !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05) !important;
    box-sizing: border-box !important;
  }

  .data-table tbody tr:hover td {
    background: transparent !important;
  }

  .data-table td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0.45rem 0 !important;
    border-bottom: 1px dashed var(--border) !important;
    font-size: 0.85rem !important;
    min-height: 32px !important;
    text-align: right !important;
    box-sizing: border-box !important;
  }

  .data-table td:last-child {
    border-bottom: none !important;
    padding-top: 0.65rem !important;
    padding-bottom: 0 !important;
    justify-content: flex-end !important;
  }

  .data-table td::before {
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    margin-right: 0.5rem;
    text-align: left;
  }

  .data-table td[data-label="Ações"]::before {
    display: none !important;
  }

  .data-table .action-btns {
    display: flex !important;
    gap: 0.5rem !important;
    align-items: center !important;
    justify-content: flex-end !important;
    width: 100% !important;
  }

  .data-table .action-btn {
    min-width: 36px !important;
    min-height: 36px !important;
    padding: 0.4rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: var(--radius-sm, 6px) !important;
  }

  /* ──────────────────────────────────────────
     2. MENSALIDADES TABLE → CARDS
     ────────────────────────────────────────── */
  .mens-table-wrap {
    overflow-x: visible !important;
  }

  .mens-table {
    min-width: 0 !important;
    border: none !important;
    display: block !important;
    width: 100% !important;
  }

  .mens-table thead {
    display: none !important;
  }

  .mens-table tbody {
    display: block !important;
    width: 100% !important;
  }

  .mens-table tbody tr {
    display: block !important;
    width: 100% !important;
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius, 10px) !important;
    margin-bottom: 0.85rem !important;
    padding: 0.85rem !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05) !important;
    box-sizing: border-box !important;
  }

  .mens-row.atrasado { border-left: 4px solid #e11d48 !important; }
  .mens-row.recebido { border-left: 4px solid #16a34a !important; }
  .mens-row.pendente { border-left: 4px solid #d97706 !important; }

  .mens-row.atrasado td:first-child,
  .mens-row.recebido td:first-child,
  .mens-row.pendente td:first-child {
    border-left: none !important;
  }

  .mens-table td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0.45rem 0 !important;
    border-bottom: 1px dashed var(--border) !important;
    font-size: 0.85rem !important;
    min-height: 32px !important;
    text-align: right !important;
    box-sizing: border-box !important;
  }

  .mens-table td:first-child {
    flex-direction: column !important;
    align-items: flex-start !important;
    text-align: left !important;
    border-bottom: 2px solid var(--border) !important;
    padding-bottom: 0.5rem !important;
    margin-bottom: 0.35rem !important;
  }

  .mens-table td:first-child::before {
    display: none !important;
  }

  .mens-table td:last-child {
    border-bottom: none !important;
    padding-top: 0.65rem !important;
    padding-bottom: 0 !important;
    justify-content: flex-end !important;
  }

  .mens-table td:last-child::before {
    display: none !important;
  }

  .mens-table td::before {
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    margin-right: 0.5rem;
    text-align: left;
  }

  .mens-actions {
    display: flex !important;
    gap: 0.5rem !important;
    align-items: center !important;
    justify-content: flex-end !important;
    width: 100% !important;
  }

  .mens-actions .btn-icon {
    min-width: 36px !important;
    min-height: 36px !important;
    padding: 0.4rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: var(--radius-sm, 6px) !important;
  }

  /* ──────────────────────────────────────────
     3. VALES TOOLBARS & FILTERS
     ────────────────────────────────────────── */
  #page-vales .page-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }

  #page-vales .page-toolbar > div:last-child {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.5rem !important;
  }

  #page-vales .page-toolbar > div:last-child button {
    width: 100% !important;
    justify-content: center !important;
    min-height: 42px !important;
    font-size: 0.88rem !important;
  }

  .vales-filter-bar {
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.45rem !important;
  }

  .vales-filter-btn {
    width: 100% !important;
    justify-content: center !important;
    padding: 0.65rem 0.85rem !important;
    font-size: 0.85rem !important;
  }

  /* ──────────────────────────────────────────
     4. CONTAS PAGAS TOOLBAR
     ────────────────────────────────────────── */
  #page-contas .page-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }

  #page-contas .page-toolbar .search-box {
    width: 100% !important;
    max-width: 100% !important;
  }

  #page-contas .page-toolbar button {
    width: 100% !important;
    justify-content: center !important;
    min-height: 42px !important;
  }

  /* ──────────────────────────────────────────
     5. GASTOS PESSOAIS TOOLBAR, CARDS & CHART
     ────────────────────────────────────────── */
  #page-gastos .summary-cards {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  #page-gastos .page-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }

  #page-gastos .page-toolbar > div:first-child {
    max-width: 100% !important;
    width: 100% !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
  }

  #page-gastos .page-toolbar > div:first-child .search-box,
  #page-gastos #filterGastoCat {
    max-width: 100% !important;
    width: 100% !important;
  }

  #page-gastos .page-toolbar > button {
    width: 100% !important;
    justify-content: center !important;
    min-height: 42px !important;
  }

  #gastosCategoryList {
    min-width: 0 !important;
    width: 100% !important;
  }

  /* ──────────────────────────────────────────
     6. MINHAS FONTES DE RENDA (Rendas Page & Recorrentes)
     ────────────────────────────────────────── */
  .income-section-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }

  .income-section-header button {
    width: 100% !important;
    justify-content: center !important;
    min-height: 42px !important;
  }

  .income-section-desc {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.35rem !important;
  }

  .income-source-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.65rem !important;
    padding: 0.85rem !important;
    box-sizing: border-box !important;
  }

  .income-source-left {
    width: 100% !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  .income-source-actions {
    width: 100% !important;
    justify-content: space-between !important;
    border-top: 1px dashed var(--border) !important;
    padding-top: 0.5rem !important;
    gap: 0.5rem !important;
  }

  .income-status-btn {
    flex: 1 !important;
    justify-content: center !important;
    min-height: 36px !important;
    padding: 0.4rem 0.75rem !important;
    font-size: 0.8rem !important;
  }

  .income-source-actions .action-btn {
    min-width: 36px !important;
    min-height: 36px !important;
  }

  /* ──────────────────────────────────────────
     7. HISTÓRICO COMPLETO
     ────────────────────────────────────────── */
  #page-historico .section-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }

  #page-historico .section-header button {
    width: 100% !important;
    justify-content: center !important;
    min-height: 40px !important;
  }

  #page-historico .filter-row {
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.5rem !important;
  }

  #page-historico .filter-row .filter-select {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* ──────────────────────────────────────────
     8. CLIENTES
     ────────────────────────────────────────── */
  #page-clientes .page-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.6rem !important;
  }

  #page-clientes .page-toolbar button {
    width: 100% !important;
    justify-content: center !important;
    min-height: 42px !important;
  }

  .clients-stats {
    grid-template-columns: 1fr !important;
    gap: 0.6rem !important;
  }

  /* ──────────────────────────────────────────
     9. MENSALIDADES
     ────────────────────────────────────────── */
  #page-mensalidades .page-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.6rem !important;
  }

  #page-mensalidades .page-toolbar button {
    width: 100% !important;
    justify-content: center !important;
    min-height: 42px !important;
  }

  .mensalidades-summary {
    grid-template-columns: 1fr !important;
    gap: 0.6rem !important;
  }

  /* ──────────────────────────────────────────
     10. CONFIGURAÇÕES
     ────────────────────────────────────────── */
  #page-configuracoes .btn-secondary,
  #page-configuracoes .btn-outline,
  #page-configuracoes .btn-danger {
    width: 100% !important;
    justify-content: center !important;
    min-height: 42px !important;
  }

  /* ──────────────────────────────────────────
     11. RELATÓRIOS ANUAIS
     ────────────────────────────────────────── */
  #reportYearSelect {
    width: 100% !important;
    min-height: 42px !important;
  }

  /* ──────────────────────────────────────────
     12. ASSINATURA & MODAIS
     ────────────────────────────────────────── */
  #page-assinatura .card {
    padding: 1.25rem 1rem !important;
  }
}


/* ─── CLIENTS TABLE MOBILE ENHANCEMENTS ─── */
@media (max-width: 768px) {
  .clients-table td[data-label="Pagamento"] {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  .clients-table td[data-label="Ações"] {
    justify-content: flex-end !important;
    border-bottom: none !important;
    padding-top: 0.65rem !important;
  }

  .clients-table td[data-label="Ações"]::before {
    display: none !important;
  }

  .clients-table .ct-actions {
    display: flex !important;
    gap: 0.5rem !important;
    justify-content: flex-end !important;
    width: 100% !important;
  }

  .clients-table .ct-actions .btn-icon {
    min-width: 36px !important;
    min-height: 36px !important;
    padding: 0.4rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .clients-month-info {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.4rem !important;
  }
}
