:root {
  --color-brand: #ff7a00;
  --color-brand-dark: #e56b00;
  --color-brand-soft: #fff4eb;
  --color-nav: #1e293b;
  --color-nav-hover: #334155;
  --color-surface: #eef0f3;
  --color-surface-elevated: #ffffff;
  --color-border: #e5e7eb;
  --color-text: #111827;
  --color-muted: #6b7280;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
  --radius: 12px;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-surface);
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: min(80rem, 92vw);
  margin-inline: auto;
}

.hidden {
  display: none !important;
}

/* —— Header (estilo Hub / Filtros) —— */
.hub-header {
  box-shadow: var(--shadow-sm);
}

.hub-header-inner {
  background: var(--color-brand);
  color: #fff;
  padding: 1rem 1.25rem;
}

@media (min-width: 640px) {
  .hub-header-inner {
    padding: 1rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }
}

.hub-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-mark {
  display: inline-flex;
  height: 3rem;
  width: 3rem;
  shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  background: var(--color-nav);
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  box-shadow: var(--shadow-md);
  border: 2px solid rgba(255, 255, 255, 0.35);
}

.hub-brand h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

@media (min-width: 640px) {
  .hub-brand h1 {
    font-size: 1.5rem;
  }
}

.hub-subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.875rem;
  color: rgba(255, 237, 213, 0.95);
}

.hub-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.5rem 0;
  background: var(--color-nav);
}

.tab {
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
}

.tab:hover {
  background: var(--color-nav-hover);
  color: #fff;
}

.tab.active {
  background: #fff;
  color: var(--color-nav);
}

.toolbar-hint {
  font-size: 0.8125rem;
  color: var(--color-muted);
}

.hub-toolbar {
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 0;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.controls label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-muted);
}

select {
  font: inherit;
  font-size: 0.875rem;
  padding: 0.45rem 0.65rem;
  border-radius: 0.5rem;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text);
  min-width: 11rem;
}

.btn {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--color-brand);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--color-brand-dark);
}

.btn-secondary {
  background: #fff;
  color: var(--color-brand);
  border: 1px solid var(--color-border);
}

/* —— Main —— */
.main {
  padding: 1.25rem 0 3rem;
}

.hero-panel {
  margin-bottom: 1.25rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fff 0%, #fff8f0 55%, #fff 100%);
  border: 1px solid rgba(255, 122, 0, 0.25);
  box-shadow: var(--shadow-md);
}

.hero-panel-inner {
  padding: 1.15rem 1.25rem;
}

.overview-label {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-brand);
}

.overview-title {
  margin: 0.35rem 0 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

.overview-hint {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  color: var(--color-muted);
}

.status-banner {
  border-radius: 0.5rem;
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.status-banner.info {
  border: 1px solid #a7f3d0;
  background: #ecfdf5;
  color: #064e3b;
}

.status-banner.error {
  border: 1px solid #fca5a5;
  background: #fef2f2;
  color: #7f1d1d;
}

.status-banner.empty {
  border: 1px solid #fcd34d;
  background: #fffbeb;
  color: #78350f;
}

.arquivo-meses {
  margin-bottom: 1rem;
}

.arquivo-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin: 0 0 0.5rem;
}

.mes-chips {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.35rem 0.65rem;
  border-radius: 0.5rem;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.chip:hover {
  border-color: var(--color-brand);
  color: var(--color-brand);
}

.chip-n {
  color: var(--color-muted);
  font-size: 0.75rem;
  margin-left: 0.25rem;
}

.grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

.grid-single {
  max-width: 42rem;
  margin-inline: auto;
  width: 100%;
}

.grid-mes {
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .grid-mes {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1280px) {
  .grid-mes {
    grid-template-columns: repeat(3, 1fr);
  }
}

.gestora-avatar {
  --brand: #64748b;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.65rem;
  background: color-mix(in srgb, var(--brand) 18%, #fff);
  border: 2px solid color-mix(in srgb, var(--brand) 40%, #fff);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.gestora-avatar-lg {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 1rem;
}

.gestora-avatar-img {
  width: 70%;
  height: 70%;
  object-fit: contain;
}

.gestora-avatar-fallback {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -0.02em;
}

.gestora-avatar-lg .gestora-avatar-fallback {
  font-size: 1rem;
}

.card-mes-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(180deg, #fafafa 0%, #fff 100%);
}

.card-mes-titles {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-mes-titles h2 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
}

.card-body-compact {
  padding: 0.85rem 1rem 1rem;
  gap: 0.65rem;
}

.resumo-compact {
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--color-muted);
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-pos-preview {
  margin: 0;
  font-size: 0.75rem;
  color: var(--color-brand-dark);
  font-weight: 500;
}

.card-details {
  font-size: 0.8125rem;
}

.card-details summary {
  cursor: pointer;
  color: var(--color-brand);
  font-weight: 600;
}

.gestora-hero {
  margin-bottom: 1rem;
  padding: 1.25rem;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.gestora-hero-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.gestora-hero-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.gestora-hero-meta {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  color: var(--color-muted);
}

.gestora-hero-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-brand);
  text-decoration: none;
}

.historico-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.historico-item {
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-border);
}

.historico-item.ok {
  border-left-color: var(--color-brand);
}

.historico-item.erro {
  border-left-color: #f87171;
}

.historico-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.historico-item-head time {
  font-weight: 600;
  text-transform: capitalize;
}

.historico-excerpt {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--color-muted);
}

.matrix-wrap {
  margin-top: 0.5rem;
}

.matrix-scroll {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.matrix-table th,
.matrix-table td {
  padding: 0.5rem 0.45rem;
  text-align: center;
  border-bottom: 1px solid var(--color-border);
}

.matrix-table thead th {
  background: var(--color-nav);
  color: #fff;
  font-weight: 600;
  position: sticky;
  top: 0;
}

.matrix-mes {
  text-align: left !important;
  font-weight: 600;
  background: #f8fafc;
  white-space: nowrap;
}

.matrix-mes-btn {
  font: inherit;
  font-weight: 600;
  border: none;
  background: none;
  color: var(--color-brand);
  cursor: pointer;
  text-transform: capitalize;
  padding: 0;
}

.matrix-mes-btn:hover {
  text-decoration: underline;
}

.matrix-abbr {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.35rem;
  font-size: 0.65rem;
  font-weight: 800;
  background: color-mix(in srgb, var(--brand) 25%, #fff);
  color: var(--brand);
}

.matrix-ok {
  color: #059669;
  font-weight: 700;
}

.matrix-erro {
  color: #dc2626;
  font-weight: 700;
}

.matrix-empty {
  color: #cbd5e1;
}

.muted {
  color: var(--color-muted);
  font-size: 0.8125rem;
}

/* —— Tabela de posições (por mês) —— */
.posicoes-mes {
  margin-bottom: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: #fff;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.posicoes-head {
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

.posicoes-kicker {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-brand);
}

.posicoes-title {
  margin: 0.35rem 0 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.posicoes-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.65rem;
  margin: 0.65rem 0 0;
}

.pos-legend-note {
  font-size: 0.75rem;
  color: var(--color-muted);
}

.posicoes-scroll {
  overflow-x: auto;
}

.posicoes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.posicoes-table th,
.posicoes-table td {
  border-bottom: 1px solid var(--color-border);
  padding: 0.55rem 0.5rem;
  vertical-align: top;
}

.posicoes-table thead th {
  background: var(--color-nav);
  color: #fff;
  font-weight: 600;
  text-align: center;
  position: sticky;
  top: 0;
}

.pos-corner,
.pos-row-label {
  text-align: left;
  font-weight: 600;
  background: #f1f5f9;
  white-space: nowrap;
}

.pos-col-abbr {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.15rem 0.35rem;
  border-radius: 0.35rem;
  font-size: 0.65rem;
  font-weight: 800;
  background: color-mix(in srgb, var(--brand) 30%, #fff);
  color: #fff;
}

.pos-cell {
  min-width: 8.5rem;
  max-width: 14rem;
}

.pos-snippet {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--color-muted);
}

.pos-empty {
  text-align: center;
  color: #cbd5e1;
}

.pos-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
}

.pos-long {
  background: #dcfce7;
  color: #166534;
}

.pos-short {
  background: #fee2e2;
  color: #991b1b;
}

.pos-neutral {
  background: #f1f5f9;
  color: #475569;
}

.pos-mixed {
  background: #fef3c7;
  color: #92400e;
}

.pos-text {
  background: var(--color-brand-soft);
  color: var(--color-brand-dark);
}

.card {
  display: flex;
  flex-direction: column;
  overflow: visible;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 1rem;
}

.card-accent {
  width: 4px;
  min-height: 2.5rem;
  border-radius: 999px;
  background: var(--color-brand);
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.card-title-row {
  display: flex;
  flex: 1;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
}

.card h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.card-mes {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  color: var(--color-muted);
  text-transform: capitalize;
}

.pill {
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 0.375rem;
  text-transform: uppercase;
}

.pill.ok {
  background: var(--color-brand);
  color: #fff;
}

.pill.erro {
  background: #fee2e2;
  color: #b91c1c;
}

.card-body {
  padding: 1rem 1.15rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

.card-section {
  margin: 0;
}

.card-section-title {
  margin: 0 0 0.5rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
}

.card-section-pos {
  padding: 0.85rem 1rem;
  border-radius: 0.625rem;
  background: var(--color-brand-soft);
  border: 1px solid rgba(255, 122, 0, 0.22);
}

.card-section-pos .card-section-title {
  color: var(--color-brand);
  margin-bottom: 0.65rem;
}

.resumo {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--color-text);
}

.resumo.erro-text {
  color: #b91c1c;
  font-size: 0.875rem;
}

.pos-list {
  margin: 0;
  padding: 0 0 0 1.15rem;
  list-style: disc;
}

.pos-list li {
  margin: 0 0 0.65rem;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--color-text);
}

.pos-list li:last-child {
  margin-bottom: 0;
}

.card-link {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-brand);
  text-decoration: none;
  align-self: flex-start;
}

.card-link:hover {
  text-decoration: underline;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2.5rem 1rem;
  border-radius: var(--radius);
  border: 1px dashed var(--color-border);
  background: #fff;
  color: var(--color-muted);
  font-size: 0.875rem;
}

.timeline {
  padding-bottom: 1rem;
}

.month-block {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem 0.75rem;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.month-block summary {
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.35rem 0;
  list-style: none;
  color: var(--color-text);
}

.month-block summary::-webkit-details-marker {
  display: none;
}

.month-block .count {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-muted);
  margin-left: 0.35rem;
}

.footer {
  padding: 1.5rem 0 2rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.8125rem;
  color: var(--color-muted);
}

.footer-links {
  margin: 0;
  font-weight: 500;
  color: var(--color-text);
}

.footer .dot {
  margin: 0 0.35rem;
  color: var(--color-border);
}

.footer-hint {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
}

.footer code {
  font-size: 0.75rem;
  background: #fff;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--color-border);
}
