/* =====================================================
   FLOW ERP — CSS Principal
   Flow Commerce | Gaspar-SC
   ===================================================== */

:root {
  --primary: #0066CC;
  --primary-light: #00AAFF;
  --primary-dark: #004499;
  --primary-glow: rgba(0,102,204,0.3);
  --accent: #00D4FF;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;

  /* Dark theme */
  --bg-sidebar: #0d1117;
  --bg-main: #f0f2f7;
  --bg-card: #ffffff;
  --bg-header: #ffffff;
  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --sidebar-text: #a0aec0;
  --sidebar-text-active: #ffffff;
  --sidebar-item-hover: rgba(255,255,255,0.05);
  --sidebar-item-active: rgba(0,102,204,0.2);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.1), 0 10px 10px rgba(0,0,0,0.04);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition: all 0.2s ease;
  --transition-slow: all 0.4s ease;
}

[data-theme="light"] {
  --bg-sidebar: #1a1a2e;
  --bg-main: #f8fafc;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.5;
}

/* =====================================================
   SCROLLBAR
   ===================================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c1c9d4; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #a0aec0; }

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

.layout {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

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

.sidebar.collapsed {
  width: 70px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  text-decoration: none;
}

.sidebar-logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: var(--transition);
}

.sidebar-logo-name {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
  white-space: nowrap;
}

.sidebar-logo-sub {
  font-size: 11px;
  color: #4a7ab5;
  font-weight: 500;
  white-space: nowrap;
}

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

.sidebar-section {
  margin-bottom: 4px;
}

.sidebar-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #3a4a5c;
  padding: 8px 18px 4px;
  white-space: nowrap;
  overflow: hidden;
  transition: var(--transition);
}

.sidebar.collapsed .sidebar-section-title {
  opacity: 0;
  height: 0;
  padding: 0;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: var(--transition);
  border-radius: 0;
  position: relative;
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
}

.sidebar-item:hover {
  background: var(--sidebar-item-hover);
  color: #ffffff;
}

.sidebar-item.active {
  background: var(--sidebar-item-active);
  color: var(--primary-light);
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--primary), var(--primary-light));
  border-radius: 0 3px 3px 0;
}

.sidebar-item-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-item-text {
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
}

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

.sidebar-item-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-user:hover {
  background: var(--sidebar-item-hover);
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.sidebar-user-info {
  overflow: hidden;
  transition: var(--transition);
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
}

.sidebar-user-role {
  font-size: 11px;
  color: #4a7ab5;
  white-space: nowrap;
}

.sidebar.collapsed .sidebar-user-info {
  opacity: 0;
  width: 0;
}

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

.main-content.collapsed {
  margin-left: 70px;
}

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

.header-toggle {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: var(--transition);
}

.header-toggle:hover {
  background: var(--bg-main);
  color: var(--text-primary);
}

.header-search {
  flex: 1;
  max-width: 400px;
  position: relative;
}

.header-search input {
  width: 100%;
  padding: 8px 12px 8px 38px;
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
}

.header-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.header-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.header-btn {
  width: 38px;
  height: 38px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  transition: var(--transition);
  position: relative;
}

.header-btn:hover {
  background: var(--bg-main);
  color: var(--primary);
}

.header-btn-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  background: var(--danger);
  color: white;
  font-size: 9px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
}

.header-avatar:hover {
  border-color: var(--primary);
}

.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.header-breadcrumb .current {
  color: var(--text-primary);
  font-weight: 600;
}

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

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 3px;
}

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

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

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

.card-body {
  padding: 20px;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  cursor: default;
}

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

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  opacity: 0.06;
  transform: translate(20px, -20px);
}

.kpi-card.blue::after { background: var(--primary); }
.kpi-card.green::after { background: var(--success); }
.kpi-card.orange::after { background: var(--warning); }
.kpi-card.red::after { background: var(--danger); }
.kpi-card.purple::after { background: #8B5CF6; }
.kpi-card.teal::after { background: #14B8A6; }

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
}

.kpi-card.blue .kpi-icon { background: rgba(0,102,204,0.1); color: var(--primary); }
.kpi-card.green .kpi-icon { background: rgba(16,185,129,0.1); color: var(--success); }
.kpi-card.orange .kpi-icon { background: rgba(245,158,11,0.1); color: var(--warning); }
.kpi-card.red .kpi-icon { background: rgba(239,68,68,0.1); color: var(--danger); }
.kpi-card.purple .kpi-icon { background: rgba(139,92,246,0.1); color: #8B5CF6; }
.kpi-card.teal .kpi-icon { background: rgba(20,184,166,0.1); color: #14B8A6; }

.kpi-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-label {
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 500;
}

.kpi-change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11.5px;
  font-weight: 600;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 20px;
}

.kpi-change.up { color: var(--success); background: rgba(16,185,129,0.1); }
.kpi-change.down { color: var(--danger); background: rgba(239,68,68,0.1); }

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  outline: none;
  text-decoration: none;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--primary-glow);
  filter: brightness(1.05);
}

.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background: var(--bg-main);
  color: var(--text-primary);
}

.btn-success {
  background: var(--success);
  color: white;
  box-shadow: 0 4px 12px rgba(16,185,129,0.25);
}

.btn-success:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  filter: brightness(1.1);
}

.btn-warning {
  background: var(--warning);
  color: white;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
}

.btn-lg {
  padding: 13px 28px;
  font-size: 15px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
}

/* =====================================================
   BADGES / STATUS
   ===================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: rgba(16,185,129,0.12); color: #059669; }
.badge-warning { background: rgba(245,158,11,0.12); color: #D97706; }
.badge-danger { background: rgba(239,68,68,0.12); color: #DC2626; }
.badge-info { background: rgba(59,130,246,0.12); color: #2563EB; }
.badge-primary { background: rgba(0,102,204,0.12); color: var(--primary); }
.badge-secondary { background: rgba(107,114,128,0.12); color: #4B5563; }
.badge-purple { background: rgba(139,92,246,0.12); color: #7C3AED; }
.badge-teal { background: rgba(20,184,166,0.12); color: #0D9488; }
.badge-orange { background: rgba(249,115,22,0.12); color: #EA580C; }

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

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

.data-table thead th {
  background: #f8fafc;
  padding: 11px 14px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}

.data-table thead th:hover {
  color: var(--primary);
}

.data-table tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

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

.data-table tbody tr:hover td {
  background: #f8fafc;
}

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

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

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 9px 13px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control::placeholder {
  color: var(--text-muted);
}

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

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

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

/* =====================================================
   MODALS
   ===================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.3s ease;
}

.modal-lg { max-width: 860px; }
.modal-sm { max-width: 420px; }

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

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

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-main);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: var(--transition);
}

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

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* =====================================================
   TABS
   ===================================================== */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-main);
  padding: 4px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  padding: 8px 16px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}

.tab-btn.active {
  background: white;
  color: var(--primary);
  font-weight: 700;
  box-shadow: var(--shadow);
}

/* =====================================================
   ALERTS
   ===================================================== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  border-left: 4px solid;
}

.alert-success { background: rgba(16,185,129,0.08); border-color: var(--success); color: #065F46; }
.alert-warning { background: rgba(245,158,11,0.08); border-color: var(--warning); color: #92400E; }
.alert-danger { background: rgba(239,68,68,0.08); border-color: var(--danger); color: #991B1B; }
.alert-info { background: rgba(59,130,246,0.08); border-color: var(--info); color: #1E40AF; }

/* =====================================================
   FILTER BAR
   ===================================================== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.filter-bar .form-control {
  flex: 1;
  min-width: 150px;
  max-width: 200px;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  max-width: 300px;
}

.search-input-wrapper input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
}

.search-input-wrapper input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-input-wrapper i {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* =====================================================
   CHANNEL BADGES (Marketplaces)
   ===================================================== */
.channel-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.channel-shopee { background: #FFF0E6; color: #FF6633; }
.channel-ml { background: #FFF8E1; color: #FFE600; border: 1px solid #FFE600; color: #996B00; }
.channel-amazon { background: #FFF4E5; color: #FF9900; }
.channel-tiktok { background: #F0F0F0; color: #000000; }
.channel-temu { background: #FFE8E8; color: #E0174A; }
.channel-manual { background: #EFF6FF; color: var(--primary); }

/* =====================================================
   PROGRESS BARS
   ===================================================== */
.progress {
  height: 6px;
  background: var(--border);
  border-radius: 20px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width 0.6s ease;
}

.progress-bar.success { background: linear-gradient(90deg, #059669, var(--success)); }
.progress-bar.warning { background: linear-gradient(90deg, #D97706, var(--warning)); }
.progress-bar.danger { background: linear-gradient(90deg, #DC2626, var(--danger)); }

/* =====================================================
   TIMELINE
   ===================================================== */
.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 16px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: -20px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid white;
  box-shadow: 0 0 0 2px var(--primary);
}

.timeline-dot.success { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
.timeline-dot.warning { background: var(--warning); box-shadow: 0 0 0 2px var(--warning); }

.timeline-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.timeline-time {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

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

/* =====================================================
   STATS ROW
   ===================================================== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  padding: 16px;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* =====================================================
   CHANNEL ICONS
   ===================================================== */
.channel-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
}

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

.empty-state i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* =====================================================
   TOAST NOTIFICATIONS
   ===================================================== */
#toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease;
  border-left: 4px solid;
}

.toast-success { background: white; border-color: var(--success); color: #065F46; }
.toast-error { background: white; border-color: var(--danger); color: #991B1B; }
.toast-warning { background: white; border-color: var(--warning); color: #92400E; }
.toast-info { background: white; border-color: var(--info); color: #1E40AF; }

.toast-close {
  margin-left: auto;
  cursor: pointer;
  opacity: 0.5;
  font-size: 16px;
  transition: var(--transition);
}

.toast-close:hover { opacity: 1; }

/* =====================================================
   CHART CONTAINERS
   ===================================================== */
.chart-container {
  position: relative;
  width: 100%;
}

/* =====================================================
   LOADING / SKELETON
   ===================================================== */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 22px; margin-bottom: 12px; width: 60%; }
.skeleton-circle { border-radius: 50%; }

/* =====================================================
   DROPDOWN
   ===================================================== */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  min-width: 200px;
  z-index: 100;
  overflow: hidden;
  animation: slideDown 0.15s ease;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13.5px;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: 'Inter', sans-serif;
}

.dropdown-item:hover {
  background: var(--bg-main);
  color: var(--primary);
}

.dropdown-item.danger:hover {
  background: rgba(239,68,68,0.08);
  color: var(--danger);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* =====================================================
   PRODUCT IMAGE
   ===================================================== */
.product-img {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-main);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

/* =====================================================
   STATUS INDICATOR
   ===================================================== */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.online { background: var(--success); box-shadow: 0 0 0 2px rgba(16,185,129,0.2); }
.status-dot.offline { background: var(--danger); }
.status-dot.warning { background: var(--warning); }

/* =====================================================
   SIDEBAR SUB-MENU
   ===================================================== */
.sidebar-submenu {
  padding-left: 48px;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.sidebar-submenu.open {
  max-height: 500px;
}

.sidebar-submenu .sidebar-item {
  padding: 7px 12px 7px 8px;
  font-size: 13px;
}

/* =====================================================
   SPARKLINE
   ===================================================== */
.sparkline-container {
  height: 40px;
  width: 100%;
}

/* =====================================================
   NOTIFICATION PANEL
   ===================================================== */
.notification-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 340px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 200;
  overflow: hidden;
  animation: slideDown 0.2s ease;
}

.notification-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}

.notification-item:hover {
  background: var(--bg-main);
}

.notification-item.unread {
  background: rgba(0,102,204,0.03);
}

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

.notification-content {
  flex: 1;
}

.notification-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
}

.notification-time {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* =====================================================
   ANIMATIONS
   ===================================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

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

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

.animate-pulse { animation: pulse 2s infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-fade { animation: fadeIn 0.3s ease; }
.animate-slide-up { animation: slideUp 0.3s ease; }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .form-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .page-content { padding: 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; align-items: stretch; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 18px; }
}

/* =====================================================
   LOGIN PAGE
   ===================================================== */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0d1117 0%, #1a1a2e 50%, #16213e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-bg-shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0.08;
  pointer-events: none;
}

.login-bg-shape-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--primary-light), transparent);
  top: -100px;
  right: -100px;
}

.login-bg-shape-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #8B5CF6, transparent);
  bottom: -50px;
  left: -80px;
}

.login-card {
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px;
  padding: 48px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  box-shadow: 0 25px 50px rgba(0,0,0,0.4);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 900;
  color: white;
  margin: 0 auto 16px;
  box-shadow: 0 10px 30px var(--primary-glow);
}

.login-title {
  font-size: 26px;
  font-weight: 800;
  color: white;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 14px;
  color: rgba(255,255,255,0.5);
}

.login-form .form-label {
  color: rgba(255,255,255,0.7);
  font-size: 13px;
}

.login-form .form-control {
  background: rgba(255,255,255,0.05);
  border: 1.5px solid rgba(255,255,255,0.1);
  color: white;
}

.login-form .form-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(0,170,255,0.15);
}

.login-form .form-control::placeholder {
  color: rgba(255,255,255,0.25);
}

.btn-google {
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(255,255,255,0.15);
  color: white;
  width: 100%;
  justify-content: center;
  gap: 10px;
}

.btn-google:hover {
  background: rgba(255,255,255,0.12);
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
}

.login-divider::before, .login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.1);
}

.login-divider span {
  font-size: 12px;
  color: rgba(255,255,255,0.3);
}

.login-lgpd {
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  margin-top: 20px;
  line-height: 1.6;
}

.login-lgpd a {
  color: rgba(0,170,255,0.7);
  text-decoration: none;
}

/* =====================================================
   CHART WRAPPER
   ===================================================== */
.chart-wrapper {
  padding: 16px;
}

/* =====================================================
   API DOCS
   ===================================================== */
.api-endpoint {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  overflow: hidden;
}

.api-endpoint-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: var(--transition);
}

.api-endpoint-header:hover {
  background: var(--bg-main);
}

.method-badge {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  font-family: monospace;
}

.method-get { background: rgba(16,185,129,0.15); color: #059669; }
.method-post { background: rgba(59,130,246,0.15); color: #2563EB; }
.method-put { background: rgba(245,158,11,0.15); color: #D97706; }
.method-delete { background: rgba(239,68,68,0.15); color: #DC2626; }

.api-path {
  font-family: monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.api-endpoint-body {
  display: none;
  padding: 16px;
  border-top: 1px solid var(--border);
  background: white;
}

.api-endpoint-body.open {
  display: block;
}

.code-block {
  background: #1a1a2e;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: monospace;
  font-size: 12.5px;
  color: #e2e8f0;
  overflow-x: auto;
  line-height: 1.7;
}

.code-block .key { color: #79c0ff; }
.code-block .string { color: #a5f3fc; }
.code-block .number { color: #fca5a5; }
.code-block .bool { color: #86efac; }

/* =====================================================
   FISCAL / NF-e  
   ===================================================== */
.danfe-preview {
  background: white;
  border: 2px solid #333;
  border-radius: 4px;
  padding: 16px;
  font-family: monospace;
  font-size: 11px;
  max-width: 600px;
}

.danfe-header {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 8px;
  border: 1px solid #333;
  padding: 8px;
  margin-bottom: 8px;
}

/* =====================================================
   SIDEBAR TOGGLE BUTTON (mobile)
   ===================================================== */
.mobile-menu-btn {
  display: none;
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 20px;
  cursor: pointer;
  z-index: 200;
  box-shadow: 0 8px 20px var(--primary-glow);
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

@media (max-width: 1024px) {
  .mobile-menu-btn {
    display: flex;
  }
}

/* =====================================================
   DRE / FINANCIAL
   ===================================================== */
.dre-table {
  width: 100%;
  border-collapse: collapse;
}

.dre-table tr td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

.dre-table tr.section-header td {
  background: #f0f2f7;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.dre-table tr.total td {
  background: #f8fafc;
  font-weight: 700;
  font-size: 14px;
}

.dre-table tr.subtotal td {
  font-weight: 600;
  color: var(--text-primary);
}

.dre-table .positive { color: var(--success); }
.dre-table .negative { color: var(--danger); }

/* =====================================================
   PRODUCT GRID
   ===================================================== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.product-card-img {
  width: 100%;
  height: 160px;
  background: #f0f2f7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  border-bottom: 1px solid var(--border);
}

.product-card-body {
  padding: 14px;
}

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

.product-card-sku {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.product-card-price {
  font-size: 17px;
  font-weight: 800;
  color: var(--primary);
}

.product-card-stock {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* =====================================================
   PERMISSION MATRIX
   ===================================================== */
.permission-matrix {
  overflow-x: auto;
}

.permission-matrix table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.permission-matrix th, .permission-matrix td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  text-align: center;
  vertical-align: middle;
}

.permission-matrix th {
  background: #f8fafc;
  font-weight: 700;
  font-size: 11.5px;
}

.permission-matrix th:first-child {
  text-align: left;
}

.permission-matrix td:first-child {
  text-align: left;
  font-weight: 500;
  background: #fafbfc;
}

.perm-check {
  color: var(--success);
  font-size: 16px;
}

.perm-x {
  color: #d1d5db;
  font-size: 16px;
}

/* =====================================================
   INTEGRATION STATUS
   ===================================================== */
.integration-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.integration-card:hover {
  box-shadow: var(--shadow-md);
}

.integration-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.integration-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
}

/* =====================================================
   MISC UTILITIES
   ===================================================== */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary-color { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-16 { font-size: 16px; }
.fs-18 { font-size: 18px; }
.fs-22 { font-size: 22px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.w-100 { width: 100%; }
.cursor-pointer { cursor: pointer; }
.font-mono { font-family: monospace; }
.hidden { display: none !important; }
.visible { display: block !important; }
