/* ========================================
   CSS VARIABLES & RESET
======================================== */
:root {
  --primary: #6C63FF;
  --primary-dark: #5A52D5;
  --primary-light: #EEF0FF;
  --secondary: #FF6584;
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;

  --bg: #F0F2F8;
  --surface: #FFFFFF;
  --surface2: #F8F9FE;
  --border: #E2E8F0;
  --text: #1E2A3B;
  --text-muted: #64748B;
  --text-light: #94A3B8;

  --sidebar-w: 260px;
  --sidebar-collapsed: 72px;
  --header-h: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10), 0 8px 32px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.15);
  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

.dark {
  --bg: #0F1117;
  --surface: #1A1D2E;
  --surface2: #22253A;
  --border: #2D3148;
  --text: #E8EAF6;
  --text-muted: #8892B0;
  --text-light: #5C6078;
  --primary-light: #1E1B4B;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; }
ul { list-style: none; }

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

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

/* ========================================
   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;
  transition: width var(--transition), transform var(--transition), box-shadow var(--transition);
  overflow: hidden;
}

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

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
  min-height: var(--header-h);
  overflow: hidden;
}

.sidebar-logo .logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(108,99,255,0.3);
}

.sidebar-logo .logo-text {
  display: flex; flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
}
.sidebar-logo .logo-text span:first-child {
  font-size: 18px; font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}
.sidebar-logo .logo-text span:last-child {
  font-size: 10px; color: var(--text-muted);
  font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px;
}

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

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-light);
  padding: 8px 8px 4px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition);
}
.sidebar.collapsed .nav-section-label { opacity: 0; }

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

.nav-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 12px rgba(108,99,255,0.3);
}

.nav-item .nav-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 15px;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}
.sidebar.collapsed .nav-badge { display: none; }

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  background: none; border: none;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-toggle:hover { background: var(--surface2); color: var(--text); }
.sidebar-toggle .nav-icon { flex-shrink: 0; }
.sidebar.collapsed .sidebar-toggle .toggle-label { opacity: 0; }

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

/* ========================================
   TOPBAR
======================================== */
.topbar {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}

.topbar-left { display: flex; align-items: center; gap: 12px; flex: 1; }

.mobile-menu-btn {
  display: none;
  background: none; border: none;
  color: var(--text-muted);
  font-size: 20px;
  padding: 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

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

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.topbar-btn:hover { background: var(--surface2); color: var(--text); }
.topbar-btn.icon-only { padding: 8px; font-size: 18px; }

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid var(--border);
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

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

/* ========================================
   VIEWS
======================================== */
.view { display: none; animation: fadeIn 0.3s ease; }
.view.active { display: block; }

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

/* ========================================
   CARDS
======================================== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title i { color: var(--primary); font-size: 14px; }
.card-body { padding: 20px; }

/* ========================================
   STAT CARDS
======================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  border-radius: 4px 0 0 4px;
}
.stat-card.blue::before { background: var(--info); }
.stat-card.green::before { background: var(--success); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.red::before { background: var(--danger); }
.stat-card.purple::before { background: var(--primary); }

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

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-card.blue .stat-icon { background: #EFF6FF; color: var(--info); }
.stat-card.green .stat-icon { background: #F0FDF4; color: var(--success); }
.stat-card.orange .stat-icon { background: #FFFBEB; color: var(--warning); }
.stat-card.red .stat-icon { background: #FEF2F2; color: var(--danger); }
.stat-card.purple .stat-icon { background: var(--primary-light); color: var(--primary); }
.dark .stat-card.blue .stat-icon { background: rgba(59,130,246,0.15); }
.dark .stat-card.green .stat-icon { background: rgba(34,197,94,0.15); }
.dark .stat-card.orange .stat-icon { background: rgba(245,158,11,0.15); }
.dark .stat-card.red .stat-icon { background: rgba(239,68,68,0.15); }

.stat-info { flex: 1; }
.stat-label { font-size: 12px; font-weight: 500; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1.2; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.stat-sub .up { color: var(--success); }
.stat-sub .down { color: var(--danger); }

/* ========================================
   BUTTONS
======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.15);
  opacity: 0;
  transition: opacity var(--transition);
}
.btn:hover::after { opacity: 1; }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 12px rgba(108,99,255,0.3);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(108,99,255,0.4); transform: translateY(-1px); }

.btn-success {
  background: linear-gradient(135deg, #22C55E, #16A34A);
  color: white;
  box-shadow: 0 4px 12px rgba(34,197,94,0.3);
}
.btn-success:hover { box-shadow: 0 6px 20px rgba(34,197,94,0.4); transform: translateY(-1px); }

.btn-danger {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: white;
  box-shadow: 0 4px 12px rgba(239,68,68,0.3);
}

.btn-warning {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: white;
  box-shadow: 0 4px 12px rgba(245,158,11,0.3);
}

.btn-info {
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  color: white;
  box-shadow: 0 4px 12px rgba(59,130,246,0.3);
}

.btn-whatsapp {
  background: linear-gradient(135deg, #25D366, #128C7E);
  color: white;
  box-shadow: 0 4px 12px rgba(37,211,102,0.3);
}
.btn-whatsapp:hover { box-shadow: 0 6px 20px rgba(37,211,102,0.4); transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }

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

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }

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

/* ========================================
   FORMS
======================================== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-label span { color: var(--danger); }

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  transition: all var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.1);
}
.form-control::placeholder { color: var(--text-light); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.input-group {
  position: relative;
  display: flex;
  align-items: stretch;
}
.input-group-prefix, .input-group-suffix {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--border);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.input-group-prefix {
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.input-group-suffix {
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.input-group .form-control {
  border-radius: 0;
  flex: 1;
}
.input-group .input-group-prefix ~ .form-control { border-radius: 0; }
.input-group:not(.has-suffix) .form-control { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

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

/* ========================================
   TABLES
======================================== */
.table-container { overflow-x: auto; border-radius: var(--radius); }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table thead tr {
  background: var(--surface2);
  border-bottom: 2px solid var(--border);
}
.table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  white-space: nowrap;
}
.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--surface2); }
.table tbody tr:last-child td { border-bottom: none; }

/* ========================================
   BADGES
======================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-draft { background: #F1F5F9; color: var(--text-muted); }
.badge-sent { background: #EFF6FF; color: var(--info); }
.badge-accepted { background: #F0FDF4; color: var(--success); }
.badge-rejected { background: #FEF2F2; color: var(--danger); }
.badge-expired { background: #FFF7ED; color: var(--warning); }
.badge-pending { background: #FFFBEB; color: var(--warning); }

.dark .badge-draft { background: rgba(100,116,139,0.2); }
.dark .badge-sent { background: rgba(59,130,246,0.2); }
.dark .badge-accepted { background: rgba(34,197,94,0.2); }
.dark .badge-rejected { background: rgba(239,68,68,0.2); }
.dark .badge-expired { background: rgba(245,158,11,0.2); }

/* ========================================
   MODAL
======================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(20px);
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
  border: 1px solid var(--border);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-sm { max-width: 440px; }
.modal-md { max-width: 640px; }
.modal-lg { max-width: 880px; }
.modal-xl { max-width: 1100px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.modal-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-title i { color: var(--primary); }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--surface2);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--danger); color: white; }
.modal-body { padding: 22px; }
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
  border-radius: 0 0 16px 16px;
}

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

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  min-width: 280px;
  max-width: 400px;
  pointer-events: all;
  animation: toastIn 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.toast.removing { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(40px) scale(0.95); }
}

.toast-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.toast.success .toast-icon { background: #F0FDF4; color: var(--success); }
.toast.error .toast-icon { background: #FEF2F2; color: var(--danger); }
.toast.warning .toast-icon { background: #FFFBEB; color: var(--warning); }
.toast.info .toast-icon { background: #EFF6FF; color: var(--info); }
.toast-msg { flex: 1; line-height: 1.4; }
.toast-close-btn {
  background: none; border: none;
  color: var(--text-muted); font-size: 16px;
  cursor: pointer; padding: 2px;
  transition: color var(--transition);
}
.toast-close-btn:hover { color: var(--text); }

/* ========================================
   ITEMS TABLE (Quote)
======================================== */
.items-table {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}
.items-table-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1.2fr 1fr 0.8fr 40px;
  gap: 0;
  background: var(--surface2);
  border-bottom: 1.5px solid var(--border);
  padding: 0;
}
.items-table-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1.2fr 1fr 0.8fr 40px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.items-table-row:last-child { border-bottom: none; }
.items-cell {
  padding: 10px 12px;
  font-size: 13px;
}
.items-table-header .items-cell {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.items-cell .form-control {
  border: 1px solid transparent;
  background: transparent;
  padding: 6px 8px;
  font-size: 13px;
}
.items-cell .form-control:focus {
  border-color: var(--primary);
  background: var(--surface);
}

.item-total { font-weight: 700; color: var(--primary); }

.items-cell .remove-item-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: none;
  background: none;
  color: var(--text-light);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
}
.items-cell .remove-item-btn:hover { background: #FEF2F2; color: var(--danger); }

/* ========================================
   QUOTE TOTALS
======================================== */
.quote-totals {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 12px;
}
.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.totals-row:last-child { border-bottom: none; }
.totals-row.total-final {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  border-top: 2px solid var(--border);
  padding-top: 12px;
  margin-top: 4px;
}
.totals-row.total-final span:last-child { color: var(--primary); }

/* ========================================
   SEARCH & FILTERS
======================================== */
.search-bar {
  position: relative;
  flex: 1;
  max-width: 360px;
}
.search-bar input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: all var(--transition);
}
.search-bar input:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.1);
}
.search-bar i {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 14px;
  pointer-events: none;
}

.filters-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface2);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.filter-tab {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-muted);
  transition: all var(--transition);
  white-space: nowrap;
}
.filter-tab.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(108,99,255,0.3);
}

/* ========================================
   EMPTY STATE
======================================== */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.3;
}
.empty-state h3 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 14px; margin-bottom: 20px; max-width: 320px; margin-left: auto; margin-right: auto; }

/* ========================================
   PAGE HEADER
======================================== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header-left h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
}
.page-header-left p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 2px;
}
.page-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ========================================
   DASHBOARD
======================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-top: 0;
}

.recent-list { display: flex; flex-direction: column; gap: 0; }
.recent-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  cursor: pointer;
}
.recent-item:last-child { border-bottom: none; }
.recent-item:hover { background: var(--surface2); }

.recent-item-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  background: var(--primary-light);
  color: var(--primary);
}

.recent-item-info { flex: 1; min-width: 0; }
.recent-item-name { font-size: 14px; font-weight: 600; truncate: ellipsis; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-item-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.recent-item-right { text-align: right; flex-shrink: 0; }
.recent-item-value { font-size: 15px; font-weight: 700; color: var(--primary); }
.recent-item-date { font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* Activity panel */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.activity-dot.green { background: var(--success); }
.activity-dot.blue { background: var(--info); }
.activity-dot.orange { background: var(--warning); }
.activity-dot.red { background: var(--danger); }
.activity-dot.purple { background: var(--primary); }
.activity-text { font-size: 13px; color: var(--text); line-height: 1.5; }
.activity-time { font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* ========================================
   QUOTE PREVIEW (for PDF)
======================================== */
#quote-preview-container {
  background: white;
  color: #1a1a2e;
  font-family: 'Inter', sans-serif;
  padding: 0;
  display: none;
}

.quote-preview {
  padding: 40px 48px;
  max-width: 820px;
  margin: 0 auto;
  background: white;
  color: #1a1a2e;
  font-size: 13px;
}

.qp-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 2px solid #6C63FF;
}

.qp-company { flex: 1; }
.qp-company-name {
  font-size: 24px;
  font-weight: 800;
  color: #6C63FF;
  margin-bottom: 6px;
}
.qp-company-info { font-size: 12px; color: #555; line-height: 1.7; }

.qp-logo-area {
  width: 100px; height: 80px;
  border-radius: 12px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #6C63FF, #FF6584);
  color: white;
  font-size: 28px;
  font-weight: 800;
  flex-shrink: 0;
}
.qp-logo-area img { width: 100%; height: 100%; object-fit: cover; }

.qp-title-box {
  background: linear-gradient(135deg, #6C63FF, #FF6584);
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  margin-bottom: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.qp-title-box h2 { font-size: 20px; font-weight: 800; margin: 0; }
.qp-number { font-size: 13px; opacity: 0.9; }

.qp-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.qp-info-box {
  background: #F8F9FE;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 16px;
}
.qp-info-box h4 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #6C63FF;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.qp-info-row { display: flex; gap: 6px; margin-bottom: 4px; font-size: 12px; }
.qp-info-label { color: #64748B; font-weight: 500; min-width: 80px; }
.qp-info-value { color: #1E2A3B; font-weight: 600; }

.qp-items-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #6C63FF;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.qp-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}
.qp-items-table thead tr {
  background: #6C63FF;
  color: white;
}
.qp-items-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.qp-items-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #E2E8F0;
  font-size: 12px;
  color: #1E2A3B;
}
.qp-items-table tbody tr:nth-child(even) { background: #F8F9FE; }
.qp-items-table .td-right { text-align: right; }
.qp-items-table .td-num { text-align: center; }
.qp-items-table tfoot tr { background: #EEF0FF; }
.qp-items-table tfoot td {
  padding: 8px 14px;
  font-size: 12px;
  color: #555;
  border-bottom: none;
}
.qp-items-table tfoot .td-label { font-weight: 600; }
.qp-items-table .total-final-row td {
  background: #6C63FF !important;
  color: white !important;
  font-size: 14px;
  font-weight: 800;
}

.qp-notes {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 20px;
  font-size: 12px;
  color: #555;
}
.qp-notes strong { color: #D97706; display: block; margin-bottom: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }

.qp-footer {
  border-top: 2px solid #E2E8F0;
  padding-top: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.qp-signature-area {
  text-align: center;
}
.qp-signature-line {
  border-bottom: 1.5px dashed #aaa;
  margin-bottom: 8px;
  height: 40px;
}
.qp-signature-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.qp-payment-info { font-size: 12px; color: #555; }
.qp-payment-info h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6C63FF;
  margin-bottom: 6px;
}

.qp-watermark {
  text-align: center;
  margin-top: 24px;
  font-size: 10px;
  color: #aaa;
  letter-spacing: 0.5px;
}

/* ========================================
   REPORTS
======================================== */
.chart-bar-wrapper { margin: 12px 0; }
.chart-bar-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.chart-bar-track {
  height: 10px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.chart-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 1s cubic-bezier(0.4,0,0.2,1);
}

/* ========================================
   CATALOG GRID
======================================== */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.catalog-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: all var(--transition);
  cursor: pointer;
}
.catalog-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(108,99,255,0.15);
  transform: translateY(-2px);
}
.catalog-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.catalog-card-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.catalog-card.service .catalog-card-icon { background: #EEF0FF; color: var(--primary); }
.catalog-card.product .catalog-card-icon { background: #F0FDF4; color: var(--success); }
.catalog-card.labor .catalog-card-icon { background: #FFF7ED; color: var(--warning); }
.catalog-card-type { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.catalog-card.service .catalog-card-type { color: var(--primary); }
.catalog-card.product .catalog-card-type { color: var(--success); }
.catalog-card.labor .catalog-card-type { color: var(--warning); }
.catalog-card-name { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.catalog-card-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.catalog-card-footer { display: flex; align-items: center; justify-content: space-between; }
.catalog-card-price { font-size: 16px; font-weight: 800; color: var(--primary); }
.catalog-card-unit { font-size: 11px; color: var(--text-light); }

/* ========================================
   CLIENTS
======================================== */
.client-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  cursor: pointer;
}
.client-card:last-child { border-bottom: none; }
.client-card:hover { background: var(--surface2); }
.client-avatar {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}
.client-avatar img { width: 100%; height: 100%; object-fit: cover; }
.client-info { flex: 1; min-width: 0; }
.client-name { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 10px; }
.client-sub span { display: flex; align-items: center; gap: 4px; }
.client-right { text-align: right; flex-shrink: 0; }
.client-quotes { font-size: 13px; font-weight: 600; color: var(--text); }
.client-total { font-size: 12px; color: var(--primary); margin-top: 2px; }

/* ========================================
   SETTINGS
======================================== */
.settings-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
}
.settings-menu { display: flex; flex-direction: column; gap: 4px; }
.settings-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: none;
  text-align: left;
}
.settings-menu-item:hover { background: var(--surface2); color: var(--text); }
.settings-menu-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.settings-panel { display: none; }
.settings-panel.active { display: block; animation: fadeIn 0.2s ease; }

.logo-upload-area {
  width: 120px; height: 120px;
  border-radius: var(--radius);
  border: 2px dashed var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  overflow: hidden;
  background: var(--surface2);
  position: relative;
}
.logo-upload-area:hover { border-color: var(--primary); background: var(--primary-light); }
.logo-upload-area img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.logo-upload-area i { font-size: 24px; color: var(--text-light); margin-bottom: 6px; }
.logo-upload-area span { font-size: 11px; color: var(--text-light); }

/* ========================================
   QUICK ACTIONS
======================================== */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.quick-action {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}
.quick-action:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.quick-action-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  background: var(--surface2);
  color: var(--primary);
  transition: all var(--transition);
}
.quick-action:hover .quick-action-icon {
  background: var(--primary);
  color: white;
}

/* ========================================
   PROGRESS RING
======================================== */
.progress-ring-wrap { display: flex; align-items: center; gap: 16px; }
.progress-ring { position: relative; width: 80px; height: 80px; }
.progress-ring svg { transform: rotate(-90deg); }
.progress-ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
}

/* ========================================
   RESPONSIVE
======================================== */
@media (max-width: 1200px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-menu { flex-direction: row; flex-wrap: wrap; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 260px; }

  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
    width: var(--sidebar-w) !important;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

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

  .mobile-menu-btn { display: flex; }

  .page-content { padding: 16px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .items-table-header,
  .items-table-row {
    grid-template-columns: 2fr 0.8fr 1fr 0.8fr 0.7fr 36px;
  }

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

  .page-header { flex-direction: column; align-items: flex-start; }

  .topbar { padding: 0 16px; }

  .toast-container { right: 12px; bottom: 12px; left: 12px; }
  .toast { min-width: 0; }

  .qp-info-grid { grid-template-columns: 1fr; }
  .qp-footer { grid-template-columns: 1fr; }
  .quote-preview { padding: 24px 20px; }

  .qp-header { flex-direction: column; gap: 16px; }
  .qp-header .qp-logo-area { width: 70px; height: 60px; font-size: 20px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
  .catalog-grid { grid-template-columns: 1fr; }

  .items-table-header .items-cell:nth-child(4),
  .items-table-row .items-cell:nth-child(4) { display: none; }
  .items-table-header,
  .items-table-row {
    grid-template-columns: 2fr 0.8fr 1fr 0.7fr 36px;
  }
}

/* Mobile overlay when sidebar open */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ========================================
   MISC
======================================== */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--text-muted) !important; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.mt-0 { margin-top: 0; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

.color-swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all var(--transition);
  flex-shrink: 0;
}
.color-swatch.selected { border-color: var(--text); transform: scale(1.1); }

/* Loading spinner */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Greeting */
.greeting-card {
  background: linear-gradient(135deg, var(--primary) 0%, #FF6584 100%);
  border-radius: var(--radius);
  padding: 24px 28px;
  color: white;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  position: relative;
}
.greeting-card::before {
  content: '';
  position: absolute;
  right: -30px; top: -30px;
  width: 160px; height: 160px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}
.greeting-card::after {
  content: '';
  position: absolute;
  right: 40px; bottom: -40px;
  width: 120px; height: 120px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}
.greeting-text h2 { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.greeting-text p { font-size: 14px; opacity: 0.85; }
.greeting-icon { font-size: 52px; opacity: 0.4; z-index: 1; }

/* Invoice list item actions */
.action-btns { display: flex; gap: 6px; align-items: center; }

/* Tab indicator animation */
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; height: 60%;
  width: 3px;
  background: rgba(255,255,255,0.5);
  border-radius: 0 2px 2px 0;
}

/* Print styles */
@media print {
  .sidebar, .topbar, .modal-overlay, .toast-container { display: none !important; }
  .main-content { margin: 0 !important; }
  body { background: white; }
}

/* Number in badge for nav */
.nav-count {
  background: rgba(255,255,255,0.2);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  margin-left: auto;
}
.nav-item:not(.active) .nav-count {
  background: var(--border);
  color: var(--text-muted);
}

/* Horizontal scrollable chips */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}
.chip.active, .chip:hover { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }

/* ========================================
   WELCOME SCREEN
======================================== */
#welcome-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #6C63FF 0%, #FF6584 100%);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  color: white;
  transition: opacity 0.5s, transform 0.5s;
}
#welcome-screen.active {
  display: flex;
}
#welcome-screen.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(1.05);
}
.welcome-logo {
  font-size: 56px;
  margin-bottom: 16px;
  animation: bounceIn 0.6s cubic-bezier(0.34,1.56,0.64,1);
}
.welcome-title {
  font-size: 40px;
  font-weight: 800;
  margin-bottom: 8px;
  animation: bounceIn 0.7s cubic-bezier(0.34,1.56,0.64,1);
}
.welcome-subtitle {
  font-size: 16px;
  opacity: 0.85;
  margin-bottom: 32px;
  animation: bounceIn 0.8s cubic-bezier(0.34,1.56,0.64,1);
}
.welcome-loading {
  width: 200px;
  height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 99px;
  overflow: hidden;
}
.welcome-progress {
  height: 100%;
  background: white;
  border-radius: 99px;
  width: 0;
  transition: width 1.5s ease;
}
@keyframes bounceIn {
  from { opacity: 0; transform: scale(0.6) translateY(30px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ========================================
   LOGIN SCREEN
======================================== */
#login-screen {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0d0e1a 0%, #1a1040 50%, #0d0e1a 100%);
  padding: 16px;
}
.login-box {
  width: 100%; max-width: 420px;
}
.login-logo {
  text-align: center; margin-bottom: 2rem;
}
.login-logo .logo-icon-big {
  width: 68px; height: 68px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: white;
  margin: 0 auto 1rem;
  box-shadow: 0 8px 32px rgba(108,99,255,0.4);
}
.login-logo h2 { font-size: 1.75rem; font-weight: 800; color: #fff; margin-bottom: 4px; }
.login-logo p  { color: #8892b0; font-size: .875rem; }
.login-tabs {
  display: flex; background: rgba(255,255,255,0.05);
  border-radius: 10px; padding: 4px; margin-bottom: 1.25rem;
  border: 1px solid rgba(255,255,255,0.08);
}
.login-tab-btn {
  flex: 1; padding: 8px; border-radius: 7px; border: none;
  font-size: .875rem; font-weight: 600; cursor: pointer;
  transition: all .2s;
}
.login-tab-btn.active { background: var(--primary); color: #fff; }
.login-tab-btn:not(.active) { background: transparent; color: #8892b0; }
.login-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 1.5rem;
  backdrop-filter: blur(10px);
}
.login-card .form-label { color: #8892b0; }
.login-card .form-control {
  background: rgba(255,255,255,0.07) !important;
  border-color: rgba(255,255,255,0.12) !important;
  color: #fff !important;
}
.login-card .form-control::placeholder { color: rgba(255,255,255,0.3); }
.login-card .form-control:focus {
  border-color: var(--primary) !important;
  background: rgba(108,99,255,0.08) !important;
}
.login-trial-badge {
  background: rgba(108,99,255,0.15);
  border: 1px solid rgba(108,99,255,0.3);
  border-radius: 10px; padding: .875rem;
  margin-bottom: 1.25rem; text-align: center;
}
.login-trial-badge p:first-child { color: #a78bfa; font-size:.82rem; font-weight:600; }
.login-trial-badge p:last-child  { color: #8892b0; font-size:.75rem; margin-top:3px; }
.login-footer { text-align:center; margin-top:1.25rem; font-size:.72rem; color:#444; }

/* ========================================
   PLAN BADGE (sidebar)
======================================== */
.plan-badge { font-size: .7rem; font-weight: 700; margin-top: 3px; }
.plan-badge.admin  { color: #f59e0b; }
.plan-badge.pro    { color: #10b981; }
.plan-badge.basico { color: var(--primary); }
.plan-badge.trial  { color: #f59e0b; }

/* ========================================
   LOGOUT NAV ITEM
======================================== */
.nav-item.logout {
  color: var(--danger) !important;
}
.nav-item.logout:hover { background: rgba(239,68,68,.08); }

/* ========================================
   RELATÓRIOS AVANÇADOS
======================================== */
.reports-period-card { margin-bottom: 20px; }
.report-metric-grid { display: grid; grid-template-columns: repeat(3,1fr); gap:12px; margin-bottom:16px; }
.report-metric { text-align:center; padding:16px; background:var(--surface2); border-radius:var(--radius-sm); border:1px solid var(--border); }
.report-metric .metric-val { font-size:1.5rem; font-weight:800; color:var(--primary); }
.report-metric .metric-lbl { font-size:12px; color:var(--text-muted); margin-top:4px; }
.report-chart-wrap { height:200px; margin-top:12px; }
.report-export-btn { display:flex; flex-direction:column; gap:8px; }

/* ========================================
   DOCUMENTOS (nova aba settings)
======================================== */
.doc-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex; align-items: flex-start; gap: 16px;
  transition: box-shadow var(--transition);
}
.doc-card:hover { box-shadow: var(--shadow-md); }
.doc-card-icon { width:44px; height:44px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:1.25rem; flex-shrink:0; }
.doc-card-icon.purple { background:var(--primary-light); color:var(--primary); }
.doc-card-icon.green  { background:#f0fdf4; color:#16a34a; }
.doc-locked { text-align:center; padding:2rem; color:var(--text-muted); }
.doc-locked i { font-size:2.5rem; margin-bottom:12px; color:var(--text-light); }
.wa-preview-box {
  background: var(--surface2); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:12px;
  font-size:13px; color:var(--text-muted);
  white-space:pre-wrap; line-height:1.6; margin-top:12px;
  max-height:120px; overflow-y:auto;
}

/* ========================================
   COLOR SWATCHES EXPANDIDOS
======================================== */
.color-swatch-row { display:flex; gap:8px; flex-wrap:wrap; }
.color-swatch-lg {
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  border: 2.5px solid transparent; transition: all .2s; flex-shrink:0;
}
.color-swatch-lg:hover  { transform: scale(1.12); }
.color-swatch-lg.selected { border-color: var(--text) !important; transform: scale(1.12); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--primary); }
.color-custom-row { display:flex; align-items:center; gap:10px; margin-top:12px; }
#custom-color-picker { width:40px; height:36px; border-radius:8px; border:1px solid var(--border); cursor:pointer; padding:2px; background:var(--surface2); }
.color-preview-bar { height:6px; border-radius:3px; margin-top:10px; background:var(--primary); transition:background .3s; }

/* ========================================
   CEP FIELD
======================================== */
.cep-row { display:flex; gap:10px; }
.cep-row .cep-input { max-width:140px; }
.cep-row .address-input { flex:1; }
/* ========================================
   QTY STEPPER — Controle de quantidade
======================================== */
.qty-cell {
  padding: 6px 8px !important;
}

.qty-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  min-width: 90px;
}

.qty-btn {
  background: var(--surface2);
  border: none;
  color: var(--primary);
  font-size: 18px;
  font-weight: 700;
  width: 32px;
  min-width: 32px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.qty-btn:hover { background: var(--primary); color: white; }
.qty-btn:active { background: var(--primary-dark); color: white; }

.qty-btn.qty-minus { border-right: 1px solid var(--border); border-radius: 0; }
.qty-btn.qty-plus  { border-left:  1px solid var(--border); border-radius: 0; }

.qty-input {
  border: none !important;
  background: transparent !important;
  text-align: center !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  padding: 0 4px !important;
  min-width: 0;
  width: 100%;
  height: 36px;
  box-shadow: none !important;
  -moz-appearance: textfield;
}
.qty-input::-webkit-inner-spin-button,
.qty-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* Mobile: stepper maior para toque fácil */
@media (max-width: 768px) {
  .qty-stepper { min-width: 0; }
  .qty-btn { width: 36px; min-width: 36px; height: 40px; font-size: 20px; }
  .qty-input { height: 40px; font-size: 15px !important; }
}

@media (max-width: 480px) {
  .qty-btn { width: 38px; min-width: 38px; height: 44px; font-size: 22px; }
  .qty-input { height: 44px; font-size: 16px !important; }
}
