/* ============================================================
   COBRANÇA FILTROAMB — Design System
   ============================================================ */

:root {
  --bg-base:       #0f1117;
  --bg-card:       #1a1d27;
  --bg-card-hover: #1e2235;
  --bg-input:      #242838;
  --bg-sidebar:    #13161f;

  --border:        #2a2f45;
  --border-light:  #323756;

  --text-primary:  #e2e8f0;
  --text-secondary:#94a3b8;
  --text-muted:    #64748b;

  --accent:        #6366f1;
  --accent-hover:  #5153cc;
  --accent-glow:   #6366f130;

  --success:       #10b981;
  --success-bg:    #10b98115;
  --warning:       #f59e0b;
  --warning-bg:    #f59e0b15;
  --danger:        #ef4444;
  --danger-bg:     #ef444415;
  --info:          #3b82f6;
  --info-bg:       #3b82f615;

  --radius:        10px;
  --radius-sm:     6px;
  --radius-lg:     14px;

  --shadow:        0 4px 24px rgba(0,0,0,0.3);
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.2);
  --transition:    all 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
}

/* ============================================================ APP LAYOUT */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================ SIDEBAR */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.logo-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
}

.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-nav {
  padding: 12px 8px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
  margin-bottom: 2px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
}

.nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-item.active { background: var(--accent-glow); color: var(--accent); }
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; }

.badge {
  margin-left: auto;
  background: var(--warning);
  color: #000;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}

.badge-green { background: var(--success); color: #fff; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sync-info {
  font-size: 11px;
  color: var(--text-muted);
}

/* ============================================================ MAIN */
.main {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
}

/* ============================================================ TABS */
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.2s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================ PAGE HEADER */
.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.page-header p { color: var(--text-secondary); font-size: 13px; }

/* ============================================================ CARDS */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }
.mt-6 { margin-top: 20px; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 0;
}

.stat-card {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}

.stat-card:hover { border-color: var(--border-light); transform: translateY(-1px); }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label { font-size: 12px; color: var(--text-secondary); }

/* ============================================================ TABLE */
.table-wrapper { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table thead {
  background: var(--bg-base);
}

.table th {
  padding: 11px 16px;
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-card-hover); }

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

/* ============================================================ TOOLBAR */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ============================================================ BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

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

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

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

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-outline:hover:not(:disabled) { border-color: var(--border-light); color: var(--text-primary); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 10px; font-size: 12px; }

.btn-approve {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success);
}
.btn-approve:hover { background: var(--success); color: #fff; }

.btn-reject {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-reject:hover { background: var(--danger); color: #fff; }

/* ============================================================ BADGES STATUS */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-pendente  { background: var(--warning-bg);  color: var(--warning); }
.status-aprovado  { background: var(--info-bg);     color: var(--info); }
.status-enviado   { background: var(--success-bg);  color: var(--success); }
.status-rejeitado { background: var(--danger-bg);   color: var(--danger); }
.status-respondido{ background: #8b5cf615;          color: #8b5cf6; }
.status-falha     { background: var(--danger-bg);   color: var(--danger); }

/* ============================================================ FORM */
.form-group { margin-bottom: 16px; }
.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.input, .select, .textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  transition: var(--transition);
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.textarea { resize: vertical; }
.select { cursor: pointer; }

.config-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  gap: 24px;
}
.config-item:last-child { border-bottom: none; }
.config-key { font-weight: 600; font-size: 13px; }
.config-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.config-input { display: flex; align-items: center; gap: 8px; }
.config-input .input { width: 140px; }

/* ============================================================ MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow);
  animation: slideUp 0.2s ease;
}

.modal-lg { max-width: 640px; }

@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 4px; border-radius: 4px; }
.modal-close:hover { background: var(--bg-input); color: var(--text-primary); }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ============================================================ CHAT BUBBLE */
.chat-bubble {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px 12px 12px 0;
  padding: 16px;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--text-primary);
}

/* ============================================================ LOADING */
.loading {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  animation: pulse 1.5s ease infinite;
}

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ============================================================ TOAST */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: var(--shadow);
  animation: slideUp 0.2s ease;
  pointer-events: all;
  min-width: 280px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-info    { border-left: 3px solid var(--info); }

/* ============================================================ UTILS */
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info    { color: var(--info); }
.font-mono    { font-family: monospace; font-size: 12px; }
.truncate     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }
