/* ══════════════════════════════════════════════════════════════════════
   N1 Promotora — ` — Dashboard Styles
   ══════════════════════════════════════════════════════════════════════ */

:root {
  --bg: #0a0a1a;
  --surface: #12122a;
  --surface-2: #1a1a3a;
  --surface-3: #222248;
  --border: rgba(255,255,255,0.06);
  --border-light: rgba(255,255,255,0.10);
  --text: #e0e0f0;
  --text-muted: #7a7a9a;
  --primary: #FF6D00;
  --primary-dim: rgba(255,109,0,0.15);
  --accent: #FF6D00;
  --success: #00e676;
  --danger: #ff5252;
  --warning: #ffd740;
  --blue: #448aff;
  --purple: #b388ff;
  --shadow: 0 2px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --radius: 16px;
  --sidebar-w: 240px;
}

/* ═══ LIGHT THEME ═══ */
[data-theme="light"] {
  --bg: #f2f4f7;
  --surface: #ffffff;
  --surface-2: #f0f1f5;
  --surface-3: #e4e6ed;
  --border: rgba(0,0,0,0.08);
  --border-light: rgba(0,0,0,0.12);
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --primary: #e05a00;
  --primary-dim: rgba(224,90,0,0.10);
  --accent: #e05a00;
  --success: #0fa958;
  --danger: #dc2626;
  --warning: #d97706;
  --blue: #2563eb;
  --purple: #7c3aed;
  --shadow: 0 2px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; display: flex; }

/* BG GRID */
.bg-grid { position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 60px 60px;
}
[data-theme="light"] .bg-grid {
  background-image:
    linear-gradient(rgba(0,0,0,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.03) 1px, transparent 1px);
}

/* ═══ SIDEBAR ═══ */
.sidebar { width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; }
.sidebar-brand { padding: 24px 20px 20px; border-bottom: 1px solid var(--border); }
.sidebar-brand h1 { font-size: 16px; font-weight: 800; color: #fff; line-height: 1.3; }
[data-theme="light"] .sidebar-brand h1 { color: var(--text); }
.sidebar-brand h1 .brand-accent { color: var(--primary); }
.sidebar-brand .brand-sub { font-size: 11px; color: var(--text-muted); margin-top: 6px; letter-spacing: 0.5px; text-transform: uppercase; }
.sidebar-badge { display: inline-block; background: var(--primary); color: #fff; padding: 2px 8px; border-radius: 10px; font-size: 9px; font-weight: 700; letter-spacing: 0.5px; margin-left: 6px; vertical-align: middle; }

.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; font-size: 13px; font-weight: 500; color: var(--text-muted); cursor: pointer; transition: all 0.2s; }
.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }
[data-theme="light"] .nav-item:hover { background: rgba(0,0,0,0.04); }
.nav-item.active { background: var(--primary-dim); color: var(--primary); font-weight: 600; }
.nav-item .nav-icon { font-size: 18px; width: 24px; text-align: center; }
.nav-item .nav-label { white-space: nowrap; }
.nav-group-label { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; font-size: 13px; font-weight: 500; color: var(--text-muted); cursor: pointer; transition: all 0.2s; }
.nav-group-label:hover { background: rgba(0,0,0,0.04); color: var(--text); }
[data-theme="light"] .nav-group-label:hover { background: rgba(0,0,0,0.04); }
.nav-group-label .nav-icon { font-size: 18px; width: 24px; text-align: center; }
.nav-group-label .nav-label { white-space: nowrap; flex: 1; }
.nav-group-label .nav-arrow { font-size: 10px; transition: transform 0.2s; }
.nav-group.open .nav-arrow { transform: rotate(90deg); }
.nav-group-label.parent-active { color: var(--primary); font-weight: 600; }
.nav-sub { max-height: 0; overflow: hidden; transition: max-height 0.25s ease; }
.nav-group.open .nav-sub { max-height: 200px; }
.nav-sub .nav-item { padding: 8px 16px 8px 52px; font-size: 12px; gap: 8px; }
.nav-sub .nav-item .nav-icon { font-size: 14px; width: 18px; }

.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--border); }
.sidebar-footer .env-info { font-size: 10px; color: var(--text-muted); line-height: 1.8; letter-spacing: 0.3px; }
.sidebar-footer .env-info span { color: var(--text); font-weight: 600; }
.sidebar-footer .update-time { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

/* ═══ MAIN CONTENT ═══ */
.main-content { flex: 1; margin-left: var(--sidebar-w); position: relative; z-index: 1; min-height: 100vh; }
.container { max-width: 1400px; margin: 0 auto; padding: 28px 32px; }

/* ═══ FILTER BAR ═══ */
.filter-bar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 20px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 24px; }
.filter-label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.5px; }
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-group label { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
select, input[type="datetime-local"] { border: 1px solid var(--border-light); border-radius: 8px; padding: 7px 12px; font-size: 12px; color: var(--text); background: var(--surface-2); cursor: pointer; transition: border-color 0.2s; font-family: 'Inter', sans-serif; }
select:focus, input[type="datetime-local"]:focus { outline: none; border-color: var(--primary); }
input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(0.7); cursor: pointer; }
[data-theme="light"] input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: none; }
.btn { border-radius: 8px; padding: 7px 14px; font-size: 12px; cursor: pointer; border: 1px solid var(--border-light); transition: all 0.2s; background: transparent; color: var(--text-muted); font-family: 'Inter', sans-serif; }
.btn-reset { background: transparent; color: var(--text-muted); }
.btn-reset:hover { background: var(--surface-2); color: var(--text); }

/* ═══ KPI CARDS ═══ */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; cursor: pointer; transition: all 0.25s; position: relative; overflow: hidden; }
.kpi-card .glow { position: absolute; top: -40%; right: -40%; width: 120px; height: 120px; border-radius: 50%; opacity: 0.08; pointer-events: none; transition: opacity 0.3s; }
.kpi-card:hover { transform: translateY(-3px); border-color: var(--border-light); }
.kpi-card:hover .glow { opacity: 0.15; }
.kpi-card.kpi-total .glow { background: radial-gradient(circle, var(--blue), transparent 70%); }
.kpi-card.kpi-success .glow { background: radial-gradient(circle, var(--success), transparent 70%); }
.kpi-card.kpi-failed .glow { background: radial-gradient(circle, var(--danger), transparent 70%); }
.kpi-card.kpi-running .glow { background: radial-gradient(circle, var(--warning), transparent 70%); }
.kpi-card.active { border-color: var(--primary); box-shadow: 0 0 20px rgba(255,109,0,0.1); }
.kpi-card.kpi-total.active { border-color: var(--blue); box-shadow: 0 0 20px rgba(68,138,255,0.1); }
.kpi-card.kpi-success.active { border-color: var(--success); box-shadow: 0 0 20px rgba(0,230,118,0.1); }
.kpi-card.kpi-failed.active { border-color: var(--danger); box-shadow: 0 0 20px rgba(255,82,82,0.1); }
.kpi-card.kpi-running.active { border-color: var(--warning); box-shadow: 0 0 20px rgba(255,215,64,0.1); }
.kpi-label { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.5px; }
.kpi-value { font-size: 2rem; font-weight: 900; margin: 8px 0 4px; line-height: 1; color: #fff; }
[data-theme="light"] .kpi-value { color: var(--text); }
.kpi-total .kpi-value { color: var(--blue); }
.kpi-success .kpi-value { color: var(--success); }
.kpi-failed .kpi-value { color: var(--danger); }
.kpi-running .kpi-value { color: var(--warning); }
.kpi-sub { font-size: 11px; color: var(--text-muted); }
.kpi-icon { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 44px; opacity: 0.04; pointer-events: none; }

/* ═══ CHARTS ═══ */
.charts-row { display: grid; grid-template-columns: 300px 1fr; gap: 16px; margin-bottom: 24px; }
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; }
.chart-title { font-size: 13px; font-weight: 600; margin-bottom: 16px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.chart-title .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); display: inline-block; }
.chart-title span { font-size: 11px; font-weight: 400; color: var(--text-muted); }
.chart-wrap { position: relative; height: 230px; }
.bank-charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px 24px; }
.bank-chart-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; }
.bank-chart-wrap { position: relative; height: 280px; }
@media (max-width: 1100px) { .bank-charts-row { grid-template-columns: 1fr; } }

/* ═══ OPERATOR RANK ═══ */
.operator-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-top: 24px; }
.op-rank-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px 24px; }
.op-rank-table { width: 100%; border-collapse: collapse; }
.op-rank-table thead th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.op-rank-table thead th:nth-child(n+3) { text-align: right; }
.op-rank-table tbody td { padding: 10px 14px; font-size: 13px; border-bottom: 1px solid var(--border); }
.op-rank-table tbody td:nth-child(n+3) { text-align: right; font-variant-numeric: tabular-nums; }
.op-rank-table tbody tr:hover { background: rgba(255,109,0,0.03); }
.op-rank { width: 26px; height: 26px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; }
.op-rank.gold { background: rgba(255,215,64,0.15); color: var(--warning); }
.op-rank.silver { background: rgba(179,136,255,0.12); color: var(--purple); }
.op-rank.bronze { background: rgba(255,109,0,0.12); color: var(--primary); }
.op-rank.normal { background: var(--surface-2); color: var(--text-muted); }
@media (max-width: 1100px) { .op-rank-row { grid-template-columns: 1fr; } }

/* ═══ TABLE ═══ */
.table-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 24px; }
.table-header { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.table-title { font-size: 14px; font-weight: 700; color: var(--text); }
.table-hint { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.table-count { font-size: 11px; color: var(--text-muted); background: var(--surface-2); padding: 4px 12px; border-radius: 20px; white-space: nowrap; }
.flows-table { width: 100%; border-collapse: collapse; }
.flows-table thead th { background: var(--surface-2); padding: 11px 14px; text-align: left; font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.flows-table tbody td { padding: 12px 14px; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
.flows-table tbody tr:last-child td { border-bottom: none; }
.flows-table tbody tr.main-row:hover { background: rgba(255,109,0,0.03); }
.flows-table tbody tr.main-row.failed-row { cursor: pointer; }
.flows-table tbody tr.main-row.failed-row:hover { background: rgba(255,82,82,0.06); }
[data-theme="light"] .flows-table tbody tr.main-row:hover { background: rgba(224,90,0,0.04); }
[data-theme="light"] .flows-table tbody tr.main-row.failed-row:hover { background: rgba(220,38,38,0.06); }

/* ═══ BADGES ═══ */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-success { background: rgba(0,230,118,0.12); color: var(--success); }
.badge-failed { background: rgba(255,82,82,0.12); color: var(--danger); }
.badge-running { background: rgba(255,215,64,0.12); color: var(--warning); }
.bdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-running .bdot { animation: blink 1.5s infinite; }
@keyframes blink { 0%,100% { opacity:1; } 50% { opacity:0.2; } }
.etag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.etag-tec { background: rgba(255,82,82,0.12); color: var(--danger); border: 1px solid rgba(255,82,82,0.2); }
.etag-neg { background: rgba(255,215,64,0.12); color: var(--warning); border: 1px solid rgba(255,215,64,0.2); }

/* ═══ EXPAND / DETAILS ═══ */
.btn-details-sm { background: none; border: 1px solid var(--border-light); border-radius: 6px; padding: 4px 10px; font-size: 11px; cursor: pointer; color: var(--primary); transition: all 0.2s; white-space: nowrap; }
.btn-details-sm:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ═══ STEP TIMELINE ═══ */
.steps-tl { display: flex; align-items: center; gap: 0; margin-bottom: 16px; overflow-x: auto; padding-bottom: 4px; }
.step-item { display: flex; align-items: center; flex-shrink: 0; }
.step-box { padding: 7px 12px; border-radius: 8px; font-size: 12px; font-weight: 500; text-align: center; min-width: 90px; cursor: pointer; transition: box-shadow 0.2s, transform 0.15s; }
.step-box:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.4); transform: translateY(-2px); }
.step-box.s-done { background: rgba(0,230,118,0.15); color: var(--success); }
.step-box.s-fail { background: rgba(255,82,82,0.15); color: var(--danger); }
.step-box.s-pend { background: var(--surface-2); color: var(--text-muted); }
.step-name { display: block; }
.step-dur { font-size: 10px; opacity: 0.7; margin-top: 2px; display: block; }
.step-arr { width: 20px; height: 2px; background: var(--border-light); position: relative; flex-shrink: 0; }
.step-arr::after { content: ''; position: absolute; right: -4px; top: -4px; border: 5px solid transparent; border-left-color: var(--border-light); }

/* ═══ ERROR BOX ═══ */
.err-box { background: rgba(255,82,82,0.08); border: 1px solid rgba(255,82,82,0.2); border-radius: 8px; padding: 14px 16px; margin-bottom: 12px; }
.err-title { font-size: 12px; font-weight: 700; color: var(--danger); margin-bottom: 6px; }
.err-msg { font-size: 13px; color: var(--text); line-height: 1.5; }
.action-box { background: rgba(0,230,118,0.08); border: 1px solid rgba(0,230,118,0.2); border-radius: 8px; padding: 14px 16px; }
.action-title { font-size: 12px; font-weight: 700; color: var(--success); margin-bottom: 8px; }
.action-list { list-style: none; padding: 0; }
.action-list li { font-size: 13px; color: var(--text); padding: 3px 0; display: flex; align-items: flex-start; gap: 8px; }
.action-list li::before { content: '\2192'; color: var(--success); font-weight: bold; flex-shrink: 0; }

/* ═══ BANK TABLE ═══ */
.bank-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tabs { display: flex; gap: 4px; padding: 0 24px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { padding: 12px 16px; font-size: 12px; font-weight: 500; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 0.2s; white-space: nowrap; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.bank-table { width: 100%; border-collapse: collapse; }
.bank-table thead th { background: var(--surface-2); color: var(--text-muted); padding: 11px 16px; font-size: 0.7rem; font-weight: 700; text-align: left; text-transform: uppercase; letter-spacing: 1px; }
.bank-table tbody td { padding: 12px 16px; font-size: 13px; border-bottom: 1px solid var(--border); color: var(--text); }
.bank-table tbody tr:hover { background: rgba(255,109,0,0.03); }
.pbar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; width: 70px; display: inline-block; vertical-align: middle; margin-left: 8px; }
.pfill { height: 100%; border-radius: 3px; }
.pfill-hi { background: var(--success); }
.pfill-md { background: var(--warning); }
.pfill-lo { background: var(--danger); }

/* ═══ PAGINATION ═══ */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--border); }
.pagination button { border: 1px solid var(--border-light); border-radius: 6px; padding: 6px 12px; font-size: 12px; cursor: pointer; background: var(--surface-2); color: var(--text); transition: all 0.2s; font-family: 'Inter', sans-serif; }
.pagination button:hover:not(:disabled) { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .page-info { font-size: 11px; color: var(--text-muted); }

/* ═══ MODAL ═══ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(4px); }
[data-theme="light"] .modal-overlay { background: rgba(0,0,0,0.35); }
.modal-overlay.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); width: 100%; max-width: 820px; max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-hdr { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-ttl { font-size: 15px; font-weight: 700; color: var(--text); }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 6px; }
.modal-close:hover { background: var(--surface-2); }
.modal-body { padding: 24px; }
.modal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.di label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; display: block; margin-bottom: 4px; }
.di span { font-size: 13px; color: var(--text); }
.payload-toggle { font-size: 12px; color: var(--primary); cursor: pointer; user-select: none; display: inline-block; margin-bottom: 8px; }
.payload-box { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; margin-bottom: 16px; overflow-x: auto; display: none; }
.payload-box pre { color: var(--primary); font-family: 'Courier New', monospace; font-size: 12px; line-height: 1.7; }
.sev-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; }
.sev-crit { background: rgba(255,82,82,0.12); color: var(--danger); border: 1px solid rgba(255,82,82,0.2); }
.sev-warn { background: rgba(255,215,64,0.12); color: var(--warning); border: 1px solid rgba(255,215,64,0.2); }

/* ═══ NAV TABS (hidden, replaced by sidebar) ═══ */
.nav { display: none; }
.nav-tab { display: none; }

/* ═══ PANES ═══ */
.pane { display: none; }
.pane.active { display: flex; flex-direction: column; }
#pane-dashboard.active { display: block; }

/* Standardized full-height panes */
#pane-clientes.active, #pane-bancos.active, #pane-pacotes.active {
  height: calc(100vh - 56px);
  overflow: hidden;
}
#pane-clientes .panel, #pane-bancos .panel, #pane-pacotes .panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
#pane-clientes .panel-body, #pane-bancos .panel-body, #pane-pacotes .panel-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
#pane-clientes #clientResult {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
#pane-clientes .client-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  margin-bottom: 0;
}
#pane-clientes .client-card .client-card-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
#pane-bancos .panel, #pane-pacotes .panel {
  height: 100%;
}

/* ═══ CLIENT HISTORY ═══ */
.search-bar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 24px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.search-bar input { flex: 1; min-width: 200px; border: 1px solid var(--border-light); border-radius: 8px; padding: 10px 14px; font-size: 14px; color: var(--text); background: var(--surface-2); transition: border-color 0.2s; font-family: 'Inter', sans-serif; }
.search-bar input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,109,0,0.15); }
.search-bar input::placeholder { color: var(--text-muted); }
.btn-search { background: var(--primary); color: #fff; border: none; border-radius: 8px; padding: 10px 20px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: 'Inter', sans-serif; }
.btn-search:hover { background: #e66000; }
.client-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; }
.client-card-hdr { padding: 18px 24px; background: var(--surface-2); color: var(--text); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.client-card-hdr h3 { font-size: 16px; font-weight: 700; }
.client-card-body { padding: 20px 24px; }
.client-info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.client-info-item label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; display: block; margin-bottom: 4px; }
.client-info-item span { font-size: 14px; color: var(--text); font-weight: 500; }
.crm-section { margin-top: 20px; }
.crm-section-title { font-size: 14px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; color: var(--text); }
.crm-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.crm-tag { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; background: var(--primary-dim); border: 1px solid rgba(255,109,0,0.2); border-radius: 8px; font-size: 12px; color: var(--text); }
.crm-tag .tag-label { font-weight: 700; color: var(--primary); font-size: 10px; text-transform: uppercase; }
.crm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.crm-list-item { padding: 10px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; font-size: 13px; display: flex; align-items: center; gap: 10px; }
.crm-list-item .crm-id { font-family: 'Courier New', monospace; font-size: 11px; color: var(--primary); font-weight: 600; word-break: break-all; }
.crm-list-item .crm-date { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.client-empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.client-empty .empty-icon { font-size: 48px; margin-bottom: 12px; }
.client-empty p { font-size: 15px; }
.client-empty .empty-hint { font-size: 13px; margin-top: 6px; }
.history-flow-card { border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 12px; transition: all 0.2s; cursor: pointer; background: var(--surface-2); }
.history-flow-card:hover { border-color: var(--border-light); box-shadow: var(--shadow); }
.history-flow-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; flex-wrap: wrap; gap: 8px; }
.history-flow-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.history-flow-meta strong { color: var(--text); }
.client-list { margin-top: 16px; }
.client-list-item { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.2s; }
.client-list-item:hover { background: rgba(255,109,0,0.03); }
.client-list-item:last-child { border-bottom: none; }
.client-list-name { font-weight: 600; font-size: 14px; color: var(--text); }
.client-list-cpf { font-size: 12px; color: var(--text-muted); font-family: 'Courier New', monospace; }
.client-list-flows { font-size: 12px; color: var(--primary); }

/* ═══ LOADING ═══ */
.loading { text-align: center; padding: 40px; color: var(--text-muted); }
.loading .spinner { display: inline-block; width: 24px; height: 24px; border: 3px solid var(--border-light); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ FOOTER ═══ */
.footer { text-align: center; padding: 24px; color: var(--text-muted); font-size: 11px; letter-spacing: 0.5px; }

/* ═══ STEP SUB-MODAL ═══ */
.step-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 1100; display: none; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(4px); }
[data-theme="light"] .step-modal-overlay { background: rgba(0,0,0,0.35); }
.step-modal-overlay.open { display: flex; }
.step-modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); width: 100%; max-width: 700px; max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.step-modal-hdr { padding: 16px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.step-modal-ttl { font-size: 15px; font-weight: 700; color: var(--text); }
.step-pipeline { display: flex; align-items: center; justify-content: center; gap: 0; padding: 20px 16px; flex-wrap: wrap; }
.pipe-node { padding: 10px 18px; border-radius: 24px; font-size: 13px; font-weight: 600; text-align: center; min-width: 100px; }
.pipe-node.pipe-prev { background: rgba(0,230,118,0.12); color: var(--success); border: 2px solid rgba(0,230,118,0.3); }
.pipe-node.pipe-current { background: var(--surface-3); color: #fff; border: 2px solid var(--primary); box-shadow: 0 4px 16px rgba(255,109,0,0.2); transform: scale(1.08); }
[data-theme="light"] .pipe-node.pipe-current { color: var(--text); }
.pipe-node.pipe-current.pipe-fail { background: rgba(255,82,82,0.2); border-color: var(--danger); box-shadow: 0 4px 16px rgba(255,82,82,0.2); }
.pipe-node.pipe-next { background: var(--surface-2); color: var(--text-muted); border: 2px dashed var(--border-light); }
.pipe-arrow { width: 32px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 18px; flex-shrink: 0; }
.payload-section { margin: 0 24px 20px; }
.payload-label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.payload-content { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 16px 18px; overflow-x: auto; }
.payload-content pre { color: var(--primary); font-family: 'Courier New', monospace; font-size: 12px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.payload-empty { color: var(--text-muted); font-size: 13px; font-style: italic; padding: 12px 0; }
.step-meta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin: 0 24px 20px; }
.step-meta-item label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; display: block; margin-bottom: 3px; }
.step-meta-item span { font-size: 13px; color: var(--text); font-weight: 500; }

/* ═══ BANK CRUD ═══ */
.bank-crud-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.btn-primary { background: var(--primary); color: #fff; border: none; border-radius: 8px; padding: 9px 18px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px; font-family: 'Inter', sans-serif; }
.btn-primary:hover { background: #e66000; }
.btn-danger { background: var(--danger); color: #fff; border: none; border-radius: 6px; padding: 5px 12px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-danger:hover { background: #e04040; }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 6px; border: 1px solid var(--border-light); background: var(--surface-2); color: var(--text); cursor: pointer; transition: all 0.2s; }
.btn-sm:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.crud-table { width: 100%; border-collapse: collapse; }
.crud-table thead th { background: var(--surface-2); color: var(--text-muted); padding: 11px 16px; font-size: 0.7rem; font-weight: 700; text-align: left; text-transform: uppercase; letter-spacing: 1px; }
.crud-table tbody td { padding: 12px 16px; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
.crud-table tbody tr:hover { background: rgba(255,109,0,0.03); }
.badge-active { background: rgba(0,230,118,0.12); color: var(--success); padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-inactive { background: rgba(255,82,82,0.12); color: var(--danger); padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.two-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; }
@media (max-width: 900px) { .two-panels { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.panel-hdr { padding: 16px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.panel-ttl { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; color: var(--text); }
.panel-body { padding: 0; }
.priority-row { display: flex; align-items: center; padding: 12px 24px; border-bottom: 1px solid var(--border); gap: 16px; transition: background 0.15s; cursor: grab; }
.priority-row:hover { background: rgba(255,109,0,0.03); }
.priority-row.dragging { opacity: 0.5; background: var(--primary-dim); }
.priority-row.drag-over { border-top: 2px solid var(--primary); }
.priority-num { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.priority-info { flex: 1; }
.priority-bank { font-size: 14px; font-weight: 600; color: var(--text); }
.priority-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.priority-actions { display: flex; gap: 6px; align-items: center; }
.form-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 1200; display: none; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(4px); }
[data-theme="light"] .form-overlay { background: rgba(0,0,0,0.35); }
.form-overlay.open { display: flex; }
.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); width: 100%; max-width: 460px; box-shadow: var(--shadow-lg); }
.form-hdr { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.form-ttl { font-size: 16px; font-weight: 700; color: var(--text); }
.form-body { padding: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.form-group input, .form-group select { width: 100%; border: 1px solid var(--border-light); border-radius: 8px; padding: 9px 14px; font-size: 14px; color: var(--text); background: var(--surface-2); transition: border-color 0.2s; font-family: 'Inter', sans-serif; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,109,0,0.15); }
.form-group input::placeholder { color: var(--text-muted); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.form-actions .btn-cancel { background: transparent; border: 1px solid var(--border-light); border-radius: 8px; padding: 9px 18px; font-size: 13px; cursor: pointer; color: var(--text-muted); font-family: 'Inter', sans-serif; }
.form-actions .btn-cancel:hover { background: var(--surface-2); }
.toggle-sw { position: relative; width: 44px; height: 24px; display: inline-block; }
.toggle-sw input { opacity: 0; width: 0; height: 0; }
.toggle-sw .slider { position: absolute; inset: 0; background: var(--surface-3); border-radius: 24px; cursor: pointer; transition: 0.3s; }
.toggle-sw .slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px; background: var(--text-muted); border-radius: 50%; transition: 0.3s; }
.toggle-sw input:checked + .slider { background: var(--success); }
.toggle-sw input:checked + .slider::before { background: #fff; transform: translateX(20px); }
.drag-hint { font-size: 11px; color: var(--text-muted); padding: 12px 24px; text-align: center; border-top: 1px solid var(--border); }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } .charts-row { grid-template-columns: 1fr; } .modal-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-brand h1, .sidebar-brand .brand-sub, .nav-item .nav-label, .nav-group-label .nav-label, .nav-group-label .nav-arrow, .sidebar-footer .env-info { display: none; }
  .nav-group-label { justify-content: center; padding: 12px; }
  .nav-sub .nav-item { padding: 8px 12px; justify-content: center; }
  .nav-sub .nav-item .nav-label { display: none; }
  .sidebar-badge { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .nav-item .nav-icon { font-size: 20px; }
  .main-content { margin-left: 60px; }
}
@media (max-width: 640px) { .container { padding: 16px; } .kpi-grid { grid-template-columns: repeat(2, 1fr); } .modal-grid { grid-template-columns: 1fr; } }

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.22); }

/* ═══ THEME TOGGLE ═══ */
.theme-toggle { display: flex; align-items: center; justify-content: center; padding: 10px; cursor: pointer; transition: background 0.2s; border-radius: 8px; margin: 0 12px 8px; }
.theme-toggle:hover { background: rgba(255,255,255,0.04); }
[data-theme="light"] .theme-toggle:hover { background: rgba(0,0,0,0.04); }
.theme-toggle .theme-icon { font-size: 20px; line-height: 1; }
.theme-toggle .theme-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
