/* ===== INSPIRAR BI MARKETING — DARK THEME ===== */
:root {
  --bg:        #0d1117;
  --surface:   #161b22;
  --surface-2: #1c2333;
  --border:    #30363d;
  --text:      #e6edf3;
  --muted:     #7d8590;
  --blue:      #2f81f7;
  --green:     #3fb950;
  --purple:    #a371f7;
  --orange:    #ffa657;
  --pink:      #e56ecb;
  --yellow:    #e3b341;
  --radius:    8px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

.app {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px 48px;
}

/* ===== HEADER ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  height: 30px;
  filter: brightness(0) invert(1);
}

.header-sep {
  color: var(--border);
  font-size: 20px;
  font-weight: 300;
}

.header-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.header-title .accent { color: var(--blue); }

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

.badge {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px 12px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.text-muted { color: var(--muted); font-size: 12px; }

/* ===== FILTERS ===== */
.filters-bar {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  padding: 0 0 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.filter-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* Pills */
.pill-group { display: flex; gap: 6px; }

.pill {
  padding: 6px 16px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  font-family: inherit;
}

.pill:hover { border-color: var(--blue); color: var(--text); }
.pill.active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* Selects */
.select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 7px 32px 7px 12px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  appearance: none;
  min-width: 180px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%237d8590' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.15s;
}
.select:hover, .select:focus { border-color: var(--blue); }

/* Custom dropdown */
.custom-select { position: relative; }

.custom-select-btn {
  text-align: left;
  width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 200;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  width: 280px;
}

.custom-select-search {
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

.custom-select-search input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.custom-select-search input:focus { border-color: var(--blue); }

.custom-select-options {
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
}
.custom-select-options::-webkit-scrollbar { width: 5px; }
.custom-select-options::-webkit-scrollbar-track { background: transparent; }
.custom-select-options::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.unit-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
  user-select: none;
}
.unit-option:hover { background: var(--surface); }
.unit-option input[type="checkbox"] { accent-color: var(--blue); flex-shrink: 0; }

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

.btn-link {
  background: none;
  border: none;
  color: var(--blue);
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  padding: 0;
  transition: opacity 0.15s;
}
.btn-link:hover { opacity: 0.7; }

.btn-clear-all {
  padding: 7px 18px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  align-self: flex-end;
  transition: border-color 0.15s, color 0.15s;
}
.btn-clear-all:hover { border-color: var(--muted); color: var(--text); }

/* ===== KPI GRID ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.kpi-blue::after   { background: var(--blue); }
.kpi-purple::after { background: var(--purple); }
.kpi-green::after  { background: var(--green); }
.kpi-orange::after { background: var(--orange); }
.kpi-pink::after   { background: var(--pink); }
.kpi-yellow::after { background: var(--yellow); }

.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.3); }

.kpi-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kpi-icon svg { width: 18px; height: 18px; }

.kpi-blue   .kpi-icon { background: rgba(47,129,247,0.15);  color: var(--blue); }
.kpi-purple .kpi-icon { background: rgba(163,113,247,0.15); color: var(--purple); }
.kpi-green  .kpi-icon { background: rgba(63,185,80,0.15);   color: var(--green); }
.kpi-orange .kpi-icon { background: rgba(255,166,87,0.15);  color: var(--orange); }
.kpi-pink   .kpi-icon { background: rgba(229,110,203,0.15); color: var(--pink); }
.kpi-yellow .kpi-icon { background: rgba(227,179,65,0.15);  color: var(--yellow); }

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 4px;
  white-space: nowrap;
}

.kpi-value {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.kpi-blue   .kpi-value { color: var(--blue); }
.kpi-purple .kpi-value { color: var(--purple); }
.kpi-green  .kpi-value { color: var(--green); }
.kpi-orange .kpi-value { color: var(--orange); }
.kpi-pink   .kpi-value { color: var(--pink); }
.kpi-yellow .kpi-value { color: var(--yellow); }

/* ===== CHARTS ===== */
.charts-row {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 16px;
  margin-bottom: 22px;
  align-items: start;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.chart-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.chart-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.1px;
}

.chart-body {
  padding: 16px;
  position: relative;
  height: 280px;
}

.chart-body-tall {
  height: auto;
  padding: 16px;
}

/* ===== FUNNEL ===== */
.funnel-section { margin-bottom: 22px; }
.ranking-section { margin-bottom: 22px; }

.funnel-section .chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.funnel-wrap { padding: 20px 24px 24px; }

.funnel-visual {
  position: relative;
}

#funnel-svg {
  width: 100%;
  height: 300px;
  display: block;
  border-radius: 6px;
}

/* Overlay: 3 cards positioned over each SVG band */
.funnel-cards {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

.funnel-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  padding: 0 8%;
}

.fc-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
  white-space: nowrap;
}

.fc-value {
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.5px;
}
.fc-blue   { color: #9ecfff; }
.fc-purple { color: #d4bbff; }
.fc-green  { color: #72e88a; }

.fc-pct {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 100px;
  white-space: nowrap;
}
.fc-pct-blue   { background: rgba(47,129,247,0.25);  color: #9ecfff; }
.fc-pct-purple { background: rgba(163,113,247,0.25); color: #d4bbff; }
.fc-pct-green  { background: rgba(63,185,80,0.25);   color: #72e88a; }

.fc-bottom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.fc-cpl {
  font-size: 12px;
  font-weight: 700;
  color: var(--orange);
  background: rgba(255,166,87,0.18);
  padding: 3px 10px;
  border-radius: 100px;
  white-space: nowrap;
}

/* ===== TABLE ===== */
.table-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

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

.table-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-page {
  width: 30px;
  height: 30px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s;
}
.btn-page:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-page:not(:disabled):hover { border-color: var(--blue); }

.table-wrapper { overflow-x: auto; }

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

thead tr { background: var(--surface-2); }

th {
  padding: 10px 14px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  transition: color 0.15s;
}
th:hover { color: var(--text); }
th.sorted-asc::after  { content: ' ▲'; color: var(--blue); }
th.sorted-desc::after { content: ' ▼'; color: var(--blue); }

td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(48,54,61,0.6);
  font-size: 13px;
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

.right { text-align: right; }
.cell-muted { font-size: 12px; color: var(--muted); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 32px;
}

/* ===== FOOTER ===== */
.footer {
  text-align: center;
  padding: 24px 0 8px;
  color: var(--muted);
  font-size: 12px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .charts-row { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-value { font-size: 17px; }
  .app { padding: 0 12px 32px; }
  .filters-bar { gap: 12px; }
}

@media (max-width: 480px) {
  .header-title { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
