/* =============================================
   TSTechStore — Sistema de Gestão
   style.css — Variáveis, animações, componentes
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* =============================================
   CSS VARIABLES
   ============================================= */
:root {
  /* TS Tech Store — Dark: preto profundo + prata metálica */
  --bg: #0A0A0A;
  --surface: #111111;
  --surface-2: #1A1A1A;
  --surface-hover: #202020;
  --border: rgba(255,255,255,0.06);
  --border-strong: rgba(255,255,255,0.12);
  --text: #E8E8E8;
  --text-muted: #909090;
  --text-dim: #505050;

  /* Prata metálica como cor primária */
  --accent: #C8C8C8;
  --accent-light: rgba(200,200,200,0.10);
  --accent-glow: rgba(200,200,200,0.18);
  --accent-2: #A0A0A0;
  --accent-2-light: rgba(160,160,160,0.12);
  --danger: #FF4757;
  --danger-light: rgba(255,71,87,0.15);
  --warning: #FFA502;
  --warning-light: rgba(255,165,2,0.15);
  --success: #2ED573;
  --success-light: rgba(46,213,115,0.15);
  --info: #60A5FA;
  --info-light: rgba(96,165,250,0.15);

  --sidebar-width: 240px;
  --sidebar-collapsed: 64px;
  --header-height: 64px;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.6);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.6);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.7);
  --shadow-accent: 0 8px 32px rgba(200,200,200,0.08);
  --shadow-card: 0 4px 20px rgba(0,0,0,0.5);

  --transition: 0.18s ease;
  --transition-slow: 0.3s cubic-bezier(0.4,0,0.2,1);
}

[data-theme="light"] {
  --bg: #F2F2F2;
  --surface: #FFFFFF;
  --surface-2: #E8E8E8;
  --surface-hover: #EFEFEF;
  --border: rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.15);
  --text: #111111;
  --text-muted: #606060;
  --text-dim: #9CA3AF;
  /* No modo claro, accent fica escuro (preto do logo) */
  --accent: #1A1A1A;
  --accent-light: rgba(0,0,0,0.07);
  --accent-glow: rgba(0,0,0,0.12);
  --accent-2: #3A3A3A;
  --accent-2-light: rgba(0,0,0,0.05);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.07);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.09);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.1);
  --shadow-card: 0 4px 20px rgba(0,0,0,0.06);
  --shadow-accent: 0 8px 32px rgba(0,0,0,0.1);
}

/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* =============================================
   APP LAYOUT
   ============================================= */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: width var(--transition-slow);
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }

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

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logo-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--accent), #9C8FFF);
  border-radius: var(--radius-md);
  display: none; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.logo-text {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
  display: none;
  overflow: hidden;
  transition: opacity var(--transition-slow), max-width var(--transition-slow);
  max-width: 160px;
}

.sidebar.collapsed .logo-text { max-width: 0; opacity: 0; }

/* Logo image na sidebar */
.sidebar-logo-img {
  height: 44px;
  width: auto;
  object-fit: contain;
  max-width: 160px;
}
.sidebar-logo-img-collapsed {
  height: 32px;
  width: 32px;
  object-fit: contain;
  object-position: left center;
  display: none;
  flex-shrink: 0;
}
/* Dark mode (padrão): mostra logo prata, esconde logo preto */
.logo-dark-img  { display: block; }
.logo-light-img { display: none; }
/* Light mode: mostra logo preto, esconde logo prata */
[data-theme="light"] .logo-dark-img  { display: none; }
[data-theme="light"] .logo-light-img { display: block; }
/* Sidebar recolhida */
.sidebar.collapsed .sidebar-logo-img          { display: none !important; }
.sidebar.collapsed .sidebar-logo-img-collapsed { display: block; }
.sidebar.collapsed .logo-dark-img  { display: block; }
.sidebar.collapsed .logo-light-img { display: none; }
[data-theme="light"] .sidebar.collapsed .logo-dark-img  { display: none; }
[data-theme="light"] .sidebar.collapsed .logo-light-img { display: block; }

.sidebar-toggle {
  background: none; border: none;
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.sidebar-toggle:hover { background: var(--surface-2); color: var(--text); }
.sidebar.collapsed .sidebar-toggle { transform: rotate(180deg); }

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

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 12px 10px 4px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition-slow);
}

.sidebar.collapsed .nav-section-label { opacity: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13.5px;
  transition: all var(--transition);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 25%; bottom: 25%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.nav-item .nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
}

.nav-label {
  transition: opacity var(--transition-slow), max-width var(--transition-slow);
  max-width: 160px;
}

.sidebar.collapsed .nav-label { max-width: 0; opacity: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
  transition: opacity var(--transition-slow);
}

.sidebar.collapsed .nav-badge { opacity: 0; }

/* Tooltip para sidebar collapsed */
.nav-item[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface-2);
  color: var(--text);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  display: none;
}

.sidebar.collapsed .nav-item[data-tooltip]:hover::after { display: block; }

/* =============================================
   MAIN CONTENT
   ============================================= */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left var(--transition-slow);
  display: flex;
  flex-direction: column;
}

.sidebar.collapsed ~ .main-content,
body.sidebar-collapsed .main-content {
  margin-left: var(--sidebar-collapsed);
}

/* =============================================
   HEADER
   ============================================= */
.header {
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.header-left { display: flex; align-items: center; gap: 16px; }
.header-right { display: flex; align-items: center; gap: 12px; }

.header-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.header-datetime {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.header-datetime .dot { color: var(--success); }

.alert-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--danger-light);
  color: var(--danger);
  padding: 5px 10px;
  border-radius: var(--radius-xl);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255,71,87,0.2);
  cursor: pointer;
  transition: all var(--transition);
}

.alert-badge:hover { background: var(--danger); color: white; }
.alert-badge.hidden { display: none; }

/* Theme toggle */
.theme-toggle {
  width: 38px; height: 21px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background var(--transition);
  flex-shrink: 0;
}

.theme-toggle::after {
  content: '';
  position: absolute;
  width: 15px; height: 15px;
  background: var(--text-muted);
  border-radius: 50%;
  top: 2px; left: 2px;
  transition: all var(--transition-slow);
}

[data-theme="light"] .theme-toggle { background: var(--accent-light); border-color: var(--accent); }
[data-theme="light"] .theme-toggle::after { background: var(--accent); transform: translateX(17px); }

/* =============================================
   PAGE CONTENT
   ============================================= */
.page-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

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

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* =============================================
   CARDS
   ============================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
  box-shadow: var(--shadow-card);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

/* Metric cards */
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: var(--card-accent, var(--accent));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.metric-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-accent); }

.metric-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  background: var(--card-accent-light, var(--accent-light));
}

.metric-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1;
  margin-bottom: 5px;
}

.metric-label {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 12px;
}

.metric-change {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
}

.metric-change.up { color: var(--success); }
.metric-change.down { color: var(--danger); }

.metric-bar {
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  margin-top: 12px;
  overflow: hidden;
}

.metric-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--card-accent, var(--accent));
  transition: width 1s ease;
}

/* =============================================
   GRID LAYOUTS
   ============================================= */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }
.col-span-4 { grid-column: span 4; }

/* =============================================
   BADGES / PILLS
   ============================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-xl);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid rgba(46,213,115,0.25);
}

.badge-warning {
  background: var(--warning-light);
  color: var(--warning);
  border: 1px solid rgba(255,165,2,0.25);
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(255,71,87,0.25);
  animation: pulse-red 2s infinite;
}

.badge-accent {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid rgba(108,99,255,0.25);
}

.badge-cyan {
  background: var(--accent-2-light);
  color: var(--accent-2);
  border: 1px solid rgba(0,212,170,0.25);
}

.badge-orange {
  background: var(--warning-light);
  color: var(--warning);
  border: 1px solid rgba(255,165,2,0.25);
}

.badge-muted {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
  line-height: 1;
}

.btn-primary {
  background: var(--accent);
  color: #0A0A0A;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-primary:hover {
  background: #E0E0E0;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--accent-glow);
}

[data-theme="light"] .btn-primary {
  color: #FFFFFF;
}

.btn-success {
  background: var(--success);
  color: #0A1F14;
  box-shadow: 0 4px 12px rgba(46,213,115,0.3);
}

.btn-success:hover { background: #42E882; transform: translateY(-1px); }

.btn-danger {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 12px var(--danger-light);
}

.btn-danger:hover { background: #FF5F6B; transform: translateY(-1px); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--surface-hover); border-color: var(--border-strong); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-icon {
  width: 34px; height: 34px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }

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

.btn-loading { position: relative; color: transparent !important; }
.btn-loading::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* =============================================
   TABLES
   ============================================= */
.table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

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

.table-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-dim);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.data-table tbody tr:last-child { border-bottom: none; }

.data-table tbody tr:hover { background: var(--surface-hover); }

.data-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.015); }
[data-theme="light"] .data-table tbody tr:nth-child(even) { background: rgba(0,0,0,0.015); }

.data-table td {
  padding: 11px 16px;
  font-size: 13.5px;
  color: var(--text);
  vertical-align: middle;
}

.table-actions { display: flex; align-items: center; gap: 6px; }

/* =============================================
   FORMS
   ============================================= */
.form-group {
  position: relative;
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
}

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

.form-input::placeholder { color: var(--text-dim); }

.form-input.has-icon { padding-left: 38px; }

.form-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 15px; height: 15px;
  pointer-events: none;
}

.form-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238888A8' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-textarea { resize: vertical; min-height: 80px; }

.form-error {
  font-size: 11.5px;
  color: var(--danger);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-row {
  display: grid;
  gap: 16px;
}

.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* =============================================
   MODAIS
   ============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity var(--transition);
}

.modal-overlay.active { opacity: 1; }
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-strong);
  animation: slideUp 0.25s ease;
  overflow: hidden;
}

.modal-lg { max-width: 720px; }
.modal-sm { max-width: 380px; }

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 9px;
}

.modal-close {
  background: none; border: none;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover { background: var(--danger-light); color: var(--danger); }

.modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: var(--bg);
}

/* =============================================
   DRAWER
   ============================================= */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  opacity: 0;
  transition: opacity var(--transition);
}

.drawer-overlay.active { opacity: 1; }
.drawer-overlay.hidden { display: none; }

.drawer {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  width: 420px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 201;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  transition: transform var(--transition-slow);
}

.drawer.open { transform: translateX(0); }

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

.drawer-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-close {
  background: none; border: none;
  color: var(--text-muted);
  padding: 4px;
  display: flex; align-items: center;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.drawer-close:hover { background: var(--surface-2); color: var(--text); }

.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px; }

/* =============================================
   TOASTS
   ============================================= */
.toast-container {
  position: fixed;
  bottom: 20px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 13px 16px;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-strong);
  animation: slideInRight 0.25s ease;
  pointer-events: all;
  position: relative;
  overflow: hidden;
}

.toast-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-content { flex: 1; }

.toast-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
}

.toast-message {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.toast-progress {
  position: absolute;
  bottom: 0; left: 0;
  height: 3px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  transition: width linear;
}

.toast-success .toast-progress { background: var(--success); }
.toast-error .toast-progress { background: var(--danger); }
.toast-warning .toast-progress { background: var(--warning); }
.toast-info .toast-progress { background: var(--accent); }

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--accent); }

/* =============================================
   SKELETON LOADING
   ============================================= */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-2) 0px,
    var(--surface-hover) 100px,
    var(--surface-2) 200px
  );
  background-size: 400px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius-md);
}

.skeleton-text { height: 14px; border-radius: var(--radius-xs); margin-bottom: 8px; }
.skeleton-title { height: 22px; border-radius: var(--radius-xs); margin-bottom: 10px; }
.skeleton-card { height: 120px; border-radius: var(--radius-lg); }
.skeleton-metric { height: 100px; border-radius: var(--radius-lg); }

/* =============================================
   SEARCH & FILTERS
   ============================================= */
.search-bar {
  position: relative;
  flex: 1;
  max-width: 360px;
}

.search-icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 15px; height: 15px;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  background: var(--bg);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: all var(--transition);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.search-input::placeholder { color: var(--text-dim); }

/* Filter pills */
.filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 5px 14px;
  border-radius: var(--radius-xl);
  font-size: 12.5px;
  font-weight: 600;
  border: 1.5px solid var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.filter-pill:hover { background: var(--surface-2); color: var(--text); }

.filter-pill.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: rgba(108,99,255,0.35);
}

/* =============================================
   WIZARD STEPS
   ============================================= */
.wizard-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 32px;
  gap: 0;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-circle {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
  border: 2px solid var(--border-strong);
  color: var(--text-muted);
  background: var(--surface);
  transition: all var(--transition);
  z-index: 1;
  position: relative;
}

.wizard-step.active .step-circle {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.wizard-step.done .step-circle {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.step-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.wizard-step.active .step-label { color: var(--accent); }
.wizard-step.done .step-label { color: var(--success); }

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border-strong);
  margin: 0 8px;
  max-width: 60px;
  transition: background var(--transition);
}

.step-line.done { background: var(--success); }

/* Payment type cards */
.payment-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.payment-card {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}

.payment-card:hover { border-color: var(--border-strong); background: var(--surface-2); }

.payment-card.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}

.payment-card .payment-emoji { font-size: 28px; margin-bottom: 8px; }

.payment-card .payment-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 4px;
}

.payment-card .payment-desc {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* =============================================
   CLIENT CARDS (GRID)
   ============================================= */
.client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.client-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-card);
  text-align: center;
}

.client-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-accent);
}

.client-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 16px;
  color: white;
  margin: 0 auto 11px;
}

.client-name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-phone {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* =============================================
   PARCELA CARDS
   ============================================= */
.parcela-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 15px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all var(--transition);
  box-shadow: var(--shadow-card);
  margin-bottom: 8px;
}

.parcela-card:hover { border-color: var(--border-strong); transform: translateX(2px); }

.parcela-info { flex: 1; min-width: 0; }

.parcela-client {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.parcela-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.parcela-amount {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
}

/* =============================================
   STATS
   ============================================= */
.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.stat-row:last-child { border-bottom: none; }

.stat-label { font-size: 13px; color: var(--text-muted); }
.stat-value { font-size: 13px; font-weight: 600; color: var(--text); }

/* =============================================
   PROGRESS BAR
   ============================================= */
.progress-bar {
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.8s ease;
}

/* =============================================
   EMPTY STATE
   ============================================= */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.empty-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 18px;
}

/* =============================================
   TOOLBAR
   ============================================= */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.toolbar-right { margin-left: auto; display: flex; gap: 8px; }

/* =============================================
   COUNTER BADGE
   ============================================= */
.counter-hero {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--danger-light);
  border: 1px solid rgba(255,71,87,0.2);
  border-radius: var(--radius-xl);
  padding: 6px 14px;
  color: var(--danger);
  font-weight: 700;
  font-size: 14px;
  animation: pulse-red 2.5s infinite;
}

/* =============================================
   VIEW TOGGLE
   ============================================= */
.view-toggle {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.view-toggle-btn {
  background: none; border: none;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition);
  display: flex; align-items: center;
}

.view-toggle-btn.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }

/* =============================================
   DONUT CHART LEGEND
   ============================================= */
.chart-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-value {
  margin-left: auto;
  font-weight: 600;
  color: var(--text);
}

/* =============================================
   PAGINAÇÃO
   ============================================= */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.page-btn {
  min-width: 30px; height: 30px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
}

.page-btn:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: white; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* =============================================
   MARGIN INDICATOR
   ============================================= */
.margin-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-xl);
  font-size: 11px;
  font-weight: 700;
}

.margin-high { background: var(--success-light); color: var(--success); }
.margin-mid { background: var(--warning-light); color: var(--warning); }
.margin-low { background: var(--danger-light); color: var(--danger); }

/* =============================================
   FINANCIAL SUMMARY
   ============================================= */
.fin-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.fin-summary-row:last-child { border-bottom: none; }
.fin-summary-row.total { font-weight: 700; font-size: 15px; }

/* =============================================
   ANIMATIONS
   ============================================= */
@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: calc(400px + 100%) 0; }
}

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,71,87,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(255,71,87,0); }
}

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

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes countUp {
  from { opacity: 0.3; }
  to { opacity: 1; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* =============================================
   UTILITY CLASSES
   ============================================= */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-lg { font-size: 16px; }
.text-right { text-align: right; }
.w-full { width: 100%; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* =============================================
   RESPONSIVE — MOBILE
   ============================================= */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
    transition: transform var(--transition-slow);
  }

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

  .main-content { margin-left: 0 !important; }

  .bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 58px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: var(--radius-md);
    transition: color var(--transition);
  }

  .bottom-nav-item.active { color: var(--accent); }

  .page-content { padding: 16px; padding-bottom: 74px; }

  .grid-4, .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }

  .col-span-2, .col-span-3, .col-span-4 { grid-column: span 1; }

  .payment-cards { grid-template-columns: 1fr; }

  .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr; }

  .drawer { width: 100%; }

  .wizard-steps { gap: 8px; }

  .modal { border-radius: var(--radius-lg); }

  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-right { margin-left: 0; }
}

@media (max-width: 480px) {
  .grid-4 { grid-template-columns: 1fr; }
  .metric-value { font-size: 20px; }
}

/* =============================================
   SCROLLBAR ESTILIZADA
   ============================================= */
.modal-body::-webkit-scrollbar,
.drawer-body::-webkit-scrollbar,
.sidebar-nav::-webkit-scrollbar { width: 4px; }
