/* === RESET & BASE === */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #1a1a1a;
  --card: #222222;
  --border: #333333;
  --accent: #FFD600;
  --accent-hover: #e6c200;
  --text: #ffffff;
  --text-secondary: #999999;
  --text-muted: #666666;
  --green: #4CAF50;
  --red: #F44336;
  --orange: #FF9500;
  --blue: #2196F3;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* === HEADER === */
.header {
  background: #111;
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-logo { font-size: 28px; }
.header-brand { font-size: 20px; font-weight: 800; color: var(--accent); }
.header-sub { font-size: 13px; color: var(--text-secondary); }
.header-right { display: flex; align-items: center; gap: 16px; }
.last-update { font-size: 12px; color: var(--text-muted); }
.btn-refresh, .btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  transition: all 0.2s;
}
.btn-refresh:hover, .btn-logout:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* === FILTERS === */
.filters {
  background: #111;
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  position: sticky;
  top: 53px;
  z-index: 99;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.filter-select, .filter-input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  min-width: 140px;
}
.filter-select:focus, .filter-input:focus {
  outline: none;
  border-color: var(--accent);
}
.btn-apply {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  align-self: flex-end;
  transition: background 0.2s;
}
.btn-apply:hover { background: var(--accent-hover); }

/* === MAIN CONTENT === */
.main { padding: 24px; max-width: 1400px; margin: 0 auto; }

/* === SECTION === */
.section {
  margin-bottom: 32px;
}
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title span { color: var(--accent); }

/* === KPI CARDS === */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  transition: border-color 0.2s;
}
.kpi-card:hover { border-color: var(--accent); }
.kpi-icon { font-size: 20px; margin-bottom: 8px; }
.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}
.kpi-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.kpi-change {
  font-size: 11px;
  margin-top: 4px;
}
.kpi-change.up { color: var(--green); }
.kpi-change.down { color: var(--red); }

/* === CHARTS === */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 16px;
}
.chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.chart-container {
  position: relative;
  width: 100%;
  height: 280px;
}

/* === TABLES === */
.table-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  overflow-x: auto;
}
.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.table-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}
table {
  width: 100%;
  border-collapse: collapse;
}
th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
th:hover { color: var(--accent); }
td {
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid #2a2a2a;
  color: var(--text);
}
tr:hover td { background: rgba(255, 214, 0, 0.03); }

/* === BADGES === */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.badge-green { background: rgba(76, 175, 80, 0.15); color: #4CAF50; }
.badge-red { background: rgba(244, 67, 54, 0.15); color: #F44336; }
.badge-yellow { background: rgba(255, 214, 0, 0.15); color: #FFD600; }
.badge-orange { background: rgba(255, 149, 0, 0.15); color: #FF9500; }
.badge-blue { background: rgba(33, 150, 243, 0.15); color: #2196F3; }
.badge-gray { background: rgba(158, 158, 158, 0.15); color: #9E9E9E; }

/* === SKELETON LOADING === */
.skeleton {
  background: linear-gradient(90deg, #2a2a2a 25%, #333 50%, #2a2a2a 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-value { width: 80px; height: 32px; }
.skeleton-chart { width: 100%; height: 280px; }

/* === TOAST === */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--red);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* === FUNNEL === */
.funnel-container { display: flex; flex-direction: column; gap: 6px; }
.funnel-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}
.funnel-label {
  width: 140px;
  text-align: right;
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.funnel-track {
  flex: 1;
  height: 28px;
  background: #2a2a2a;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.funnel-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: #1a1a1a;
  min-width: fit-content;
}
.funnel-count {
  font-size: 13px;
  font-weight: 700;
  width: 40px;
  flex-shrink: 0;
}

/* === PAGINATION === */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}
.page-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
}
.page-btn.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.page-btn:hover:not(.active) { border-color: var(--accent); }

/* === WARNING BANNER === */
.warning-banner {
  background: rgba(255, 149, 0, 0.1);
  border: 1px solid rgba(255, 149, 0, 0.3);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--orange);
  margin-bottom: 16px;
}

/* === LOADING OVERLAY === */
.loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  z-index: 200;
  transition: width 0.3s;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .header { padding: 10px 16px; }
  .filters { padding: 10px 16px; }
  .main { padding: 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .kpi-value { font-size: 22px; }
  .header-sub { display: none; }
  .filter-select, .filter-input { min-width: 100px; }
  .funnel-label { width: 100px; font-size: 11px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .kpi-card { padding: 12px; }
  .kpi-value { font-size: 20px; }
  .charts-grid { grid-template-columns: 1fr; }
  .chart-container { height: 220px; }
}
