﻿:root {
  --bg: #f4f7f8;
  --surface: #ffffff;
  --ink: #17212b;
  --muted: #63717d;
  --line: #dbe4e7;
  --blue: #1f6fb2;
  --green: #168466;
  --teal: #168fa0;
  --red: #c64a42;
  --amber: #b7791f;
  --violet: #6f5aa8;
  --shadow: 0 14px 34px rgba(21, 37, 49, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(16px, 3vw, 36px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 18px;
}

.brand img {
  width: min(210px, 42vw);
  max-height: 58px;
  object-fit: contain;
}

.brand p,
.panel-head p {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand h1,
.panel-head h2 {
  margin: 0;
  line-height: 1.1;
}

.brand h1 {
  font-size: clamp(1.25rem, 2.2vw, 1.9rem);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

button,
.file-button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}

button:hover,
.file-button:hover {
  border-color: var(--blue);
}

#refreshBtn {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.file-button input {
  display: none;
}

main {
  width: min(1560px, calc(100% - 32px));
  margin: 22px auto 44px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 40px;
  margin-top: 6px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.status-line {
  min-height: 24px;
  margin: 6px 2px 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.kpi,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.kpi {
  min-height: 118px;
  padding: 18px;
}

.kpi p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.kpi strong {
  display: block;
  font-size: clamp(1.65rem, 3vw, 2.4rem);
  line-height: 1;
}

.kpi span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.83rem;
}

.grid {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.two-cols {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
}

.panel {
  padding: 18px;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel-head h2 {
  font-size: clamp(1rem, 1.4vw, 1.25rem);
}

.panel-head select {
  width: auto;
  min-width: 120px;
  margin: 0;
}

.chart {
  position: relative;
  width: 100%;
}

.tall {
  height: 310px;
}

.chart svg {
  width: 100%;
  height: 100%;
  display: block;
}

.axis,
.tick {
  stroke: #d7e1e5;
  stroke-width: 1;
}

.chart-label {
  fill: var(--muted);
  font-size: 11px;
}

.priority-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  height: 100%;
}

.ranking {
  display: grid;
  gap: 10px;
}

.rank-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 70px;
  gap: 12px;
  align-items: center;
}

.rank-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 10px;
  margin-bottom: 6px;
}

.rank-title span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 750;
}

.rank-title span:last-child {
  color: var(--muted);
  font-size: 0.82rem;
}

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

.bar-fill {
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: var(--blue);
}

.rank-pct {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.insights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.insight {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.insight strong {
  display: block;
  margin-bottom: 6px;
}

.insight p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.search {
  width: min(360px, 100%);
  margin: 0;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

th,
td {
  padding: 12px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 0.88rem;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fbfc;
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

td {
  max-width: 320px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #eef4f6;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.priority-urgente,
.priority-alta {
  background: #fdecea;
  color: var(--red);
}

.priority-media {
  background: #fff4dc;
  color: var(--amber);
}

.priority-baixa {
  background: #e7f6ef;
  color: var(--green);
}

.empty {
  display: grid;
  min-height: 180px;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

@media (max-width: 1080px) {
  .filters,
  .kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .two-cols,
  .insights {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .priority-layout {
    grid-template-columns: 1fr;
  }

  .priority-layout svg {
    width: 230px;
    max-width: 100%;
    justify-self: center;
  }

  .topbar {
    position: static;
    flex-direction: column;
    align-items: stretch;
  }

  .brand {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .top-actions,
  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .filters,
  .kpis {
    grid-template-columns: 1fr;
  }

  .tall {
    height: 260px;
  }
}
