/* Tema ICMS-Social — portado do dashboard HTML do Power BI.
   Paleta: fundo #020617 · cards #0f172a→#1e293b · acentos índigo/âmbar/verde/ciano */

:root, [data-theme="light"] {
  --bg: #eef2f0;
  --card-grad: #ffffff;
  --panel: #ffffff;
  --line: #e6ede8;
  --txt: #11332a;
  --muted: #8aa097;
  --faint: #7c948b;
  --indigo: #3f6fd1;
  --indigo-2: #2f7fd1;
  --amber: #e08a0b;
  --amber-2: #b45309;
  --green: #00875a;
  --green-2: #00734a;
  --cyan: #1aa3a3;
  --primary-green: #00875a;
  --nav-active: #00875a;
  --nav-hover: #eef2f0;
}

[data-theme="dark"] {
  --bg: #0b1411;
  --card-grad: #12211b;
  --panel: #12211b;
  --line: #203b30;
  --txt: #eef2f0;
  --muted: #9aaca3;
  --faint: #7c948b;
  --indigo: #5c8ae6;
  --indigo-2: #818cf8;
  --amber: #f59e0b;
  --amber-2: #fbbf24;
  --green: #00b377;
  --green-2: #34d399;
  --cyan: #00b377;
  --primary-green: #064e3b;
  --nav-active: #0b1220;
  --nav-hover: #1e293b;
}

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
}

.shell { min-height: 100vh; display: flex; flex-direction: column; }

/* ---- topo ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  padding: 14px 26px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky; top: 0;
  z-index: 50;
}
.brand { font-weight: 800; letter-spacing: 2px; font-size: 15px; font-family: "IBM Plex Sans", sans-serif; }
.brand-accent { color: var(--cyan); }
.brand-rest { color: var(--muted); }
.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav-link {
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600;
  padding: 7px 14px; border-radius: 20px; transition: color .15s, background-color .15s;
}
.nav-link:hover { color: var(--txt); background: var(--nav-hover); }
.nav-link:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 2px;
}
.nav-link[aria-current="page"] { color: #fff; background: var(--nav-active); }

.theme-toggle {
  background: none; border: none; cursor: pointer;
  font-size: 18px; padding: 4px; border-radius: 50%;
  color: var(--txt);
  transition: background-color 0.2s;
}
.theme-toggle:hover {
  background: var(--line);
}
.seminario-badge {
  background: var(--primary-green);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
}

/* ---- página ---- */
.page {
  padding: 20px 32px;
  max-width: 1920px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 18px;
}
#main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.controls .Select-control, .controls .dash-dropdown { min-width: 190px; }
.control-label { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }

/* ---- cards ---- */
.card {
  background: var(--card-grad);
  border-radius: 16px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.card-hero-green {
  background: linear-gradient(135deg, #00734a, #004d30);
  color: #eafff6;
  border-radius: 16px;
  padding: 20px 24px;
  border: none;
  box-shadow: 0 8px 24px rgba(0, 79, 48, 0.22);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.card-hero-green::before {
  content: "";
  position: absolute;
  right: -30px;
  top: -30px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  pointer-events: none;
}
.hero-total-val { font-size: 52px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; margin-top: 8px; white-space: nowrap; }
.hero-total-unit { font-size: 28px; font-weight: 600; opacity: 0.85; margin-left: 6px; }
.hero-title-lbl { font-size: 11px; letter-spacing: 0.14em; font-weight: 600; opacity: 0.8; }
.hero-sub { font-size: 13px; opacity: 0.78; margin-top: 8px; }
.card-title {
  font-size: 12px; letter-spacing: 2px; font-weight: 600;
  text-transform: uppercase; margin-bottom: 2px;
}
.card-sub { font-size: 11px; color: var(--faint); margin-bottom: 12px; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 12px; align-items: start; }
.grid-3 { 
  display: grid; 
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1.12fr); 
  gap: 18px; 
  align-items: stretch; 
  flex: 1;
  min-height: 0;
}
.hero-grid-4 { display: grid; grid-template-columns: 1.18fr 1fr 1fr 1fr; gap: 18px; align-items: stretch; }
.sticky-col {
  position: sticky; top: 76px;
  max-height: calc(100vh - 86px);
  overflow-y: auto;
  padding-right: 4px; /* espaço para o scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.sticky-col::-webkit-scrollbar { width: 6px; }
.sticky-col::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.grid-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }

.kpi { 
  background: var(--card-grad); 
  border-radius: 16px; 
  padding: 18px 20px; 
  border: 1px solid var(--line);
  border-top-width: 3px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.kpi-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; }
.kpi-value-container { margin-top: 6px; line-height: 1; }
.kpi-value { font-size: 34px; font-weight: 700; color: var(--txt); font-family: "IBM Plex Sans", sans-serif; letter-spacing: -0.02em; }
.kpi-unit { font-size: 18px; font-weight: 600; color: var(--muted); margin-left: 4px; font-family: "IBM Plex Sans", sans-serif; }
.kpi-note { font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.kpi-bar { height: 6px; background: #eef2f0; border-radius: 4px; overflow: hidden; }
.kpi-bar > div { height: 100%; border-radius: 4px; }

.hero-total { font-size: 40px; font-weight: 800; }
.hero-sub { font-size: 13px; color: var(--muted); }

.t-indigo { border-top-color: var(--indigo); }
.t-amber  { border-top-color: var(--amber); }
.t-green  { border-top-color: var(--green); }
.c-indigo { color: var(--indigo-2); }
.c-amber  { color: var(--amber-2); }
.c-green  { color: var(--green-2); }
.c-cyan   { color: var(--cyan); }

/* dropdowns dark (dash/react-select) */
.dash-dropdown .Select-control, .dash-dropdown .Select-menu-outer {
  background: var(--panel); border-color: var(--line); color: var(--txt);
}
.dash-dropdown .Select-value-label, .dash-dropdown .Select-placeholder { color: var(--txt) !important; }
.dash-dropdown .VirtualizedSelectOption { background: var(--panel); color: var(--txt); }
.dash-dropdown .VirtualizedSelectFocusedOption { background: #16233c; }

.footer {
  padding: 14px 26px; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--faint);
}

/* ---- timeline ---- */
.timeline-container {
  display: flex;
  align-items: flex-start;
  background: var(--card-grad);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 24px;
  margin-top: 4px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}
.timeline-brand {
  width: 220px;
  flex-shrink: 0;
  padding-right: 20px;
  border-right: 1px solid var(--line);
  margin-right: 20px;
}
.timeline-title-main { font-size: 13px; font-weight: 800; color: var(--primary-green); text-transform: uppercase; letter-spacing: 1px; }
.timeline-sub-main { font-size: 11px; color: var(--muted); margin-top: 4px; }

.timeline-track {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  position: relative;
}
.timeline-line {
  position: absolute;
  top: 15px; /* Matches node-dot center */
  left: 5%; right: 5%;
  height: 1px;
  background: var(--primary-green); opacity: 0.5;
  z-index: 1;
}
.timeline-node {
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  position: relative; z-index: 2;
  width: 160px;
  transition: transform 0.15s;
}
.timeline-node:hover { transform: scale(1.05); }

.node-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--muted);
  margin-bottom: 12px;
  margin-top: 8px; /* space from top to align with line */
  box-shadow: 0 0 0 4px var(--bg); /* creates a gap around the line */
}
.node-dot.blue { border-color: var(--indigo); }
.node-dot.amber { border-color: var(--amber); }
.node-dot.green { border-color: var(--primary-green); }
.node-dot.empty { border-color: var(--cyan); border-width: 2px; border-style: dashed; }

.node-dot.active.blue { background: var(--indigo); box-shadow: 0 0 0 4px var(--bg), 0 0 0 7px rgba(99, 102, 241, 0.2); }
.node-dot.active.amber { background: var(--amber); box-shadow: 0 0 0 4px var(--bg), 0 0 0 7px rgba(245, 158, 11, 0.2); }
.node-dot.active.green { background: var(--primary-green); box-shadow: 0 0 0 4px var(--bg), 0 0 0 7px rgba(6, 78, 59, 0.2); }

.node-title { font-size: 13px; font-weight: 800; color: var(--txt); }
.node-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---- skip link (acessibilidade) ---- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 8px 16px;
  background: var(--indigo);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  transition: top .15s;
}
.skip-link:focus { top: 0; }

/* ---- focus-visible global ---- */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (max-width: 850px) {
  .page { padding: 14px; }
  .hero-total { font-size: 30px; }
  
  /* Grids to vertical stack */
  .grid-2, .grid-3, .hero-grid-4, .grid-kpi {
    display: flex;
    flex-direction: column;
    height: auto;
  }
  .card, .kpi, .card-hero-green {
    min-height: auto !important;
  }
  
  /* Topbar & Hamburger */
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 16px;
  }
  .brand-container {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .hamburger {
    display: block !important;
    font-size: 24px;
    cursor: pointer;
    user-select: none;
    color: var(--txt);
  }
  .nav {
    display: none;
    flex-direction: column;
    width: 100%;
    margin-top: 12px;
  }
  #menu-toggle:checked ~ .nav {
    display: flex;
  }
  #menu-toggle:checked ~ .controls {
    display: flex;
  }
  .controls {
    display: none; /* Hide controls by default on mobile, show on hamburger click */
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    margin: 16px 0 0 0 !important;
  }
  .controls .Select-control, .controls .dash-dropdown {
    min-width: 100%;
  }
  .theme-toggle {
    position: absolute;
    top: 14px;
    right: 50px;
  }

  /* Timeline */
  .timeline-container {
    flex-direction: column;
    padding: 16px;
  }
  .timeline-brand {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
    margin-bottom: 12px;
    margin-right: 0;
  }
  .timeline-track {
    overflow-x: auto;
    width: 100%;
    justify-content: flex-start;
    padding-bottom: 16px;
    gap: 24px;
    -webkit-overflow-scrolling: touch;
  }
  .timeline-line {
    width: 600px;
  }
  .timeline-node {
    flex-shrink: 0;
  }
}

/* ---- prefers-reduced-motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}
