/* ── Reset ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

@media (max-width: 600px) {
  html,
  body {
    overflow-x: hidden;
    max-width: 100%;
  }
}

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;

  min-height: 100vh;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-surface);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #484f58;
}

/* ── HEADER ── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #1e2544;
  border-bottom: 3px solid #e8601c;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.app-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brasao {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brasao img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.titulo h1 {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.15rem;
  color: #fff;
  letter-spacing: 0.5px;
  text-transform: none;
}
.titulo .sub {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--accent2);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 2px;
}

@media (max-width: 599px) {
  .titulo h1 {
    font-size: 1rem;
  }
  .status-badge,
  #fileNameDisplay {
    display: none;
  }
}
.header-status {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-badge {
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 500;
  border: 1px solid currentColor;
  display: none;
}
.status-badge.idle {
  color: var(--text-muted);
  border-color: var(--text-muted);
}
.status-badge.ready {
  color: var(--success);
  border-color: var(--success);
}
.status-badge.loading {
  color: var(--accent2);
  border-color: var(--accent2);
}
.header-refresh-btn {
  background: #2d3561;
  color: #fff;
  border: none;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: var(--radius);
  padding: 9px 16px;
  min-height: 38px;
  cursor: pointer;
  transition: background 0.18s;
  white-space: nowrap;
}
.header-refresh-btn:hover {
  background: #3a4478;
}
.header-refresh-btn:active {
  transform: scale(0.97);
}

/* ── PAGE LAYOUT ── */
.app-body {
  display: flex;
  min-height: calc(100vh - 56px);
}

.sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-soft);
  padding: 20px 16px;
  overflow-y: auto;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.main-content {
  flex: 1;
  padding: 24px;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── SIDEBAR FILTER SECTION ── */
.filter-header {
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.filter-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-family: var(--font-title);
}
.filter-input,
.filter-select {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.2s;
  appearance: none;
  -webkit-appearance: none;
}
.filter-input:focus,
.filter-select:focus {
  border-color: var(--border);
  box-shadow: 0 0 0 3px var(--border-soft);
}
.filter-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}
.select-wrapper {
  position: relative;
}
.select-wrapper::after {
  content: "▾";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
  font-size: 12px;
}

.multi-select-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 140px;
  overflow-y: auto;
}
.multi-select-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 12px;
}
.multi-select-item:hover {
  background: rgba(245, 158, 11, 0.08);
}
.multi-select-item input[type="checkbox"] {
  accent-color: var(--accent2);
  cursor: pointer;
}

.btn-clear {
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font-title);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-clear:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-apply {
  width: 100%;
  padding: 9px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #000;
  font-size: 12px;
  font-family: var(--font-title);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-apply:hover {
  background: #fbbf24;
  box-shadow: 0 2px 12px rgba(245, 158, 11, 0.4);
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .app-body {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    min-width: 0;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
  }
  .charts-grid {
    grid-template-columns: 1fr;
  }
  .chart-card.full-width {
    grid-column: auto;
  }
}

/* ── MISC ── */
.filter-spacer {
  flex-shrink: 0;
  height: 1px;
  background: var(--border-soft);
}
