/* ============================================================
   Dashboard Festa de Agosto 2025 — Styles
   ============================================================ */

:root {
  --shell-max: 1280px;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --surface: #ffffff;
  --bg: #f1f5f9;

  --blue-900: #0c1e3a;
  --blue-700: #1d4ed8;
  --green: #059669;
  --amber: #d97706;
  --red: #dc2626;
  --violet: #7c3aed;
  --teal: #0d9488;
  --slate: #475569;
  --sky: #0284c7;

  --radius: 10px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 48px rgba(15, 23, 42, 0.10);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 0.9375rem;
  line-height: 1.55;
}

.skip-link { position:fixed; z-index:1000; top:8px; left:8px; padding:8px 12px; border-radius:8px; background:var(--blue-900); color:#fff; font-weight:800; transform:translateY(-160%); }
.skip-link:focus { transform:translateY(0); }

input,
select,
button,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

h1, h2, h3, h4, p {
  margin: 0;
}

/* ---------- SHELL ---------- */
.shell {
  width: min(var(--shell-max), calc(100% - 40px));
  margin: 0 auto;
  padding: 0 0 48px;
}

.shell--error [data-total-detail],
.shell--error [data-result-count] {
  color: var(--red) !important;
}

/* ---------- HERO ---------- */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 28px;
  min-height: 400px;
  padding: 44px 44px 48px;
  margin-top: 20px;
  overflow: hidden;
  border-radius: var(--radius);
  isolation: isolate;
}

.hero__bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(118deg, rgba(12, 30, 58, 0.94), rgba(13, 50, 70, 0.72)),
    url('https://images.unsplash.com/photo-1533174072545-7a4b6ad7a6c3?auto=format&fit=crop&w=1800&q=80');
  background-position: center 30%;
  background-size: cover;
  z-index: 0;
}

.hero__bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(12, 30, 58, 0.35), transparent 50%);
}

.hero__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.eyebrow {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color 0.18s, border-color 0.18s, transform 0.18s;
}

.eyebrow:hover { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.42); transform: translateY(-1px); }
.eyebrow:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

.hero h1 {
  margin: 16px 0 14px;
  color: #fff;
  font-size: clamp(2.4rem, 5.5vw, 4.8rem);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: -0.02em;
}

.hero p {
  max-width: 640px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 1.05rem;
  line-height: 1.6;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.hero__actions a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 750;
  transition: background 0.2s, transform 0.15s;
  backdrop-filter: blur(6px);
}

.hero__actions a:first-child {
  border-color: #fff;
  background: #fff;
  color: var(--blue-900);
}

.hero__actions a:hover {
  background: rgba(255, 255, 255, 0.24);
  transform: translateY(-1px);
}

.hero__actions a:first-child:hover {
  background: rgba(255, 255, 255, 0.92);
}

.hero-card {
  position: relative;
  z-index: 1;
  align-self: end;
  display: grid;
  gap: 8px;
  padding: 22px 24px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: rgba(10, 20, 36, 0.52);
  backdrop-filter: blur(16px);
}

.hero-card span {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.8rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.hero-card strong {
  display: block;
  color: #fff;
  font-size: clamp(2rem, 3.4vw, 2.8rem);
  font-weight: 900;
  line-height: 1.0;
}

.hero-card small {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.86rem;
}

/* ---------- CARDS DESTAQUE ---------- */
.cards-destaque {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: -28px 0 20px;
  position: relative;
  z-index: 2;
}

.destaque-card {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
  padding: clamp(12px, 2vw, 20px);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  border-top: 4px solid var(--line);
  transition: transform 0.18s, box-shadow 0.18s;
}

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

.destaque-card--total {
  border-top-color: var(--green);
}

.destaque-card--estrutura {
  border-top-color: var(--sky);
}

.destaque-card--bandas {
  border-top-color: var(--violet);
}

.destaque-card span {
  color: var(--muted);
  display: -webkit-box;
  overflow: hidden;
  font-size: clamp(0.62rem, 1.3vw, 0.78rem);
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.destaque-card strong {
  color: var(--ink);
  font-size: clamp(1.05rem, 2.8vw, 2.15rem);
  font-weight: 900;
  line-height: 1.0;
}

.destaque-card small {
  color: var(--muted);
  font-size: clamp(0.64rem, 1.35vw, 0.82rem);
  font-weight: 650;
}

/* ---------- SECTION ---------- */
.section {
  margin-top: 22px;
  padding: 26px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.section-head {
  margin-bottom: 20px;
}

.section-label {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.section-head h2 {
  margin-top: 4px;
  color: var(--ink);
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  font-weight: 850;
  line-height: 1.15;
}

/* ---------- GRÁFICO DE BARRAS HORIZONTAIS COMPACTAS ---------- */
.compact-bars { display:grid; gap:8px; }
.compact-bar { display:grid; gap:4px; padding-bottom:7px; border-bottom:1px solid var(--line); }
.compact-bar:last-child { padding-bottom:0; border-bottom:0; }
.compact-bar-head, .compact-bar-line { display:flex; align-items:center; gap:10px; }
.compact-bar-head span { flex:1; overflow:hidden; font-size:.78rem; font-weight:800; text-overflow:ellipsis; white-space:nowrap; }
.compact-bar-head strong { color:var(--muted); font-size:.72rem; }
.compact-bar-track { flex:1; height:10px; overflow:hidden; border-radius:999px; background:#e8eef5; }
.compact-bar-track i { display:block; height:100%; border-radius:inherit; }
.compact-bar-line small { width:72px; color:var(--ink); font-size:.7rem; font-weight:850; text-align:right; white-space:nowrap; }

.bar-item {
  display: grid;
  gap: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

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

.bar-head {
  display: flex;
  gap: 8px;
  align-items: center;
}

.bar-icon {
  font-size: 1.2rem;
  line-height: 1;
}

.bar-label {
  flex: 1;
  font-weight: 750;
  font-size: 0.95rem;
}

.bar-pct {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.bar-track {
  height: 20px;
  border-radius: 999px;
  background: #eef2f6;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  min-width: 8px;
}

.bar-value {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.bar-value strong {
  font-size: 1.05rem;
  font-weight: 850;
}

.bar-value span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

/* ---------- TABELA ---------- */
.section--table {
  padding-bottom: 4px;
}

.table-toolbar {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filters {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-search,
.filter-select {
  display: grid;
  gap: 6px;
}

.filter-search span,
.filter-select span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filter-search input {
  width: min(380px, 100%);
  min-width: 200px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafcff;
  color: var(--ink);
  transition: border-color 0.18s, box-shadow 0.18s;
}

.filter-search input:focus {
  outline: none;
  border-color: var(--blue-700);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.10);
}

.filter-search input::placeholder {
  color: #94a3b8;
}

.filter-select select {
  min-height: 44px;
  padding: 0 32px 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafcff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center;
  color: var(--ink);
  appearance: none;
  cursor: pointer;
  transition: border-color 0.18s;
}

.filter-select select:focus {
  outline: none;
  border-color: var(--blue-700);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.10);
}

.result-line {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

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

table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

thead th {
  padding: 14px 14px;
  border-bottom: 2px solid var(--line);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  white-space: nowrap;
}

tbody td {
  padding: 14px 14px;
  border-bottom: 1px solid var(--line);
  color: #334155;
  font-size: 0.9rem;
  vertical-align: top;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #f8fafc;
}

.cell-empenho strong {
  display: block;
  font-weight: 850;
  color: var(--ink);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.cell-empenho span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.cell-fornecedor strong {
  display: block;
  font-weight: 750;
  color: var(--ink);
  font-size: 0.92rem;
}

.cell-fornecedor span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
  max-width: 480px;
}

.cat-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(71, 85, 105, 0.12);
  background: color-mix(in srgb, var(--cat-color, var(--slate)) 12%, transparent);
  color: var(--cat-color, var(--slate));
  font-size: 0.82rem;
  font-weight: 750;
  white-space: nowrap;
}

.cell-valor {
  font-weight: 850;
  color: var(--ink) !important;
  white-space: nowrap;
  text-align: right;
}

.empty {
  padding: 32px 14px !important;
  color: var(--muted);
  text-align: center;
  font-style: italic;
}

/* ---------- METODOLOGIA ---------- */
.methodology h2 {
  margin-top: 4px;
  margin-bottom: 14px;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
}

.method-text {
  color: #334155;
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 700px;
}

.method-box {
  margin-top: 16px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  font-size: 0.9rem;
  color: #334155;
}

.method-box strong {
  font-weight: 800;
  color: var(--ink);
}

.method-box--secondary {
  margin-top: 10px;
  background: #fff;
}

/* ---------- RESPONSIVO ---------- */
@media (max-width: 1040px) {
  .hero {
    grid-template-columns: 1fr;
    padding: 32px 28px;
  }

  .hero-card {
    align-self: auto;
  }
}

@media (max-width: 780px) {
  .shell {
    width: min(100% - 24px, var(--shell-max));
  }

  .cards-destaque {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: -24px;
    gap: 8px;
  }

  .hero {
    padding: 24px 20px;
    min-height: auto;
  }

  .hero h1 {
    font-size: 2.2rem;
  }

  .hero p {
    font-size: 0.95rem;
  }

  .hero-card strong {
    font-size: 1.8rem;
  }

  .section {
    padding: 14px 12px;
  }

  .section-head { margin-bottom: 12px; }
  .section-label { font-size: .62rem; }
  .section-head h2 { font-size: 1rem; }

  .compact-bars { gap:6px; }
  .compact-bar { gap:3px; padding-bottom:5px; }
  .compact-bar-head span, .compact-bar-head strong { font-size:.62rem; }
  .compact-bar-track { height:7px; }
  .compact-bar-line small { width:58px; font-size:.6rem; }

  .table-toolbar {
    flex-direction: column;
    gap: 12px;
  }

  .filters {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(120px, .55fr);
    gap: 6px;
  }

  .filter-search {
    width: 100%;
    grid-column: 1 / -1;
  }

  .filter-search input {
    width: 100%;
    min-width: 0;
  }

  .filter-select select {
    width: 100%;
  }

  .filter-search span,
  .filter-select span { font-size:.6rem; }
  .filter-search input,
  .filter-select select { min-height:34px; padding-top:0; padding-bottom:0; font-size:.72rem; }
  .filter-search input { padding-inline:10px; }
  .result-line { margin:8px 0; font-size:.68rem; }

  .section--table { padding-bottom:12px; }
  .table-wrap { overflow:visible; }
  table { min-width:0; display:block; }
  thead { display:none; }
  tbody { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
  tbody tr { display:grid; grid-template-columns:minmax(0,1fr) auto; align-content:start; gap:5px; min-width:0; padding:8px; border:1px solid var(--line); border-radius:8px; background:#fff; }
  tbody td { display:block; min-width:0; padding:0; border:0; font-size:.66rem; }
  .cell-fornecedor { grid-column:1 / -1; grid-row:1; }
  .cell-fornecedor strong { display:-webkit-box; overflow:hidden; font-size:.68rem; line-height:1.15; -webkit-box-orient:vertical; -webkit-line-clamp:2; }
  .cell-fornecedor span { display:-webkit-box; overflow:hidden; margin-top:3px; font-size:.6rem; line-height:1.25; -webkit-box-orient:vertical; -webkit-line-clamp:2; }
  .cell-categoria { grid-column:1; grid-row:2; }
  .cat-tag { max-width:100%; overflow:hidden; padding:2px 5px; font-size:.58rem; text-overflow:ellipsis; }
  .cell-valor { grid-column:2; grid-row:2; align-self:center; font-size:.68rem; }
  .cell-empenho { grid-column:1 / -1; grid-row:3; display:flex; justify-content:space-between; gap:4px; padding-top:4px; border-top:1px solid var(--line); }
  .cell-empenho strong, .cell-empenho span { display:inline; margin:0; font-size:.56rem; }

  .bar-value {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
}

@media (max-width: 480px) {
  .hero__actions a {
    flex: 1;
    justify-content: center;
  }

  .destaque-card {
    min-height: 106px;
    padding: 10px 8px;
    gap: 5px;
  }
  .destaque-card strong {
    font-size: clamp(0.7rem, 3.15vw, 0.9rem);
    letter-spacing: -0.035em;
    white-space: nowrap;
  }
  .destaque-card span {
    font-size: clamp(0.52rem, 2.15vw, 0.62rem);
  }
  .destaque-card small {
    font-size: clamp(0.52rem, 2vw, 0.62rem);
    line-height: 1.25;
  }

  .cards-destaque {
    gap: 6px;
    margin-top: -20px;
  }

  .compact-bar-head span, .compact-bar-head strong { font-size:.56rem; }
  .table-toolbar { margin-bottom:8px; }
  tbody tr { padding:6px; }

  table {
    min-width: 0;
  }
}
