/* Estrutura e identidade visual do painel AMT */

:root {
  --bg: #ffffff;
  --surface: #f3f6f7;
  --line: #dbe3e6;
  --ink: #14232b;
  --ink-2: #3f4f57;
  --ink-3: #5b6a72;
  --brand: #003a52;
  --accent: #0a7f8c;
  --accent-soft: #d6eef1;
  --prev: #93a7b0;
  --up: #b0461a;
  --down: #07707c;
  --band: #003a52;
  --band-ink: #ffffff;
  --band-ink-2: #bfe3e7;
  --font-display: 'Poppins', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  --r: 12px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1a20;
    --surface: #15262e;
    --line: #26404b;
    --ink: #e8f0f2;
    --ink-2: #b9c9cf;
    --ink-3: #8fa3ab;
    --brand: #8fdce4;
    --accent: #3fb3c2;
    --accent-soft: #173f48;
    --prev: #5e7480;
    --up: #ff9e78;
    --down: #6fd0db;
    --band: #0a2c3b;
    --band-ink: #ffffff;
    --band-ink-2: #9fd4db;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0d1a20;
  --surface: #15262e;
  --line: #26404b;
  --ink: #e8f0f2;
  --ink-2: #b9c9cf;
  --ink-3: #8fa3ab;
  --brand: #8fdce4;
  --accent: #3fb3c2;
  --accent-soft: #173f48;
  --prev: #5e7480;
  --up: #ff9e78;
  --down: #6fd0db;
  --band: #0a2c3b;
  --band-ink: #ffffff;
  --band-ink-2: #9fd4db;
  color-scheme: dark;
}

* { box-sizing: border-box }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
}

.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

header.band {
  background: var(--band);
  color: var(--band-ink);
}

header.band .wrap {
  padding-block: 22px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  align-items: flex-end;
  justify-content: space-between;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.brand .org {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .14em;
  color: var(--band-ink-2);
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(24px, 3.4vw, 34px);
  line-height: 1.1;
  text-wrap: balance;
}

.brand .sub {
  color: var(--band-ink-2);
  font-size: 15px;
}

.seg {
  display: inline-flex;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  flex-wrap: wrap;
}

.seg button {
  font: 600 14px var(--font-body);
  color: var(--band-ink);
  background: transparent;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  min-height: 40px;
}

.seg button[aria-pressed="true"] {
  background: var(--band-ink);
  color: #003a52;
}

.seg button:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.semlab {
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--band-ink-2);
  font-weight: 600;
  margin-bottom: 6px;
}

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

.filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--ink-3);
  text-transform: uppercase;
  flex: 1 1 200px;
  min-width: 0;
}

.filters select,
.filters input {
  font: 15px var(--font-body);
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  min-height: 42px;
  width: 100%;
  text-transform: none;
  letter-spacing: 0;
}

.btn {
  font: 600 14px var(--font-body);
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 9px 14px;
  min-height: 42px;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  background: var(--accent-soft);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-block: 6px 4px;
  min-height: 8px;
}

.chip {
  font-size: 13px;
  background: var(--accent-soft);
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 10px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.chip button {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 2px 4px;
  min-height: 24px;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding-block: 10px 18px;
}

.kpi {
  background: var(--surface);
  border-radius: var(--r);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.kpi .v {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(22px, 2.6vw, 30px);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: var(--brand);
}

.kpi .v.up { color: var(--up) }
.kpi .v.down { color: var(--down) }

.kpi .l {
  font-size: 13px;
  color: var(--ink-2);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding-bottom: 16px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.card.wide {
  grid-column: 1 / -1;
}

.card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--brand);
}

.card .note {
  font-size: 13px;
  color: var(--ink-3);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 13px;
  color: var(--ink-2);
}

.legend i {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: -1px;
}

/* Gráficos de colunas */

.cols {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 180px;
  border-bottom: 1px solid var(--line);
  padding-top: 18px;
}

.col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
  min-width: 0;
  position: relative;
  cursor: default;
}

.col .bar {
  width: 100%;
  max-width: 34px;
  border-radius: 4px 4px 0 0;
  background: var(--prev);
}

.col.cur .bar {
  background: var(--accent);
}

.col .val {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  margin-bottom: 3px;
}

.axis {
  display: flex;
  gap: 4px;
  font-size: 12px;
  color: var(--ink-3);
}

.axis span {
  flex: 1;
  text-align: center;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}