:root {
  color: #172033;
  background: #f4f7fb;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body { margin: 0; background: #f4f7fb; }

.app-shell { max-width: 1720px; margin: 0 auto; padding: 30px; }

header { margin: 0 0 24px; }
header h1 { margin: 0; font-size: 30px; letter-spacing: -0.7px; }
header p { margin: 7px 0 0; color: #64748b; }

.filters, .panel, .metric-card {
  background: #fff;
  border: 1px solid #e3e9f2;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.filters { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 10px 22px; padding: 18px 20px; align-items: end; }
.filter-field { display: flex; flex-direction: column; gap: 5px; }
.filters label { font-size: 12px; font-weight: 700; color: #536276; }
.status { color: #536276; font-size: 13px; margin: 12px 2px; min-height: 18px; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.metric-card { padding: 14px 16px; }
.metric-label { color: #64748b; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.metric-value { font-size: 24px; font-weight: 750; margin-top: 5px; color: #172033; }

.two-columns { display: grid; grid-template-columns: minmax(0, 3fr) minmax(320px, .85fr); gap: 16px; }
.panel { padding: 18px; margin-bottom: 16px; }
.panel h2 { margin: 0 0 12px; font-size: 16px; }
.network-panel { min-width: 0; }
.side-panel { max-height: 780px; overflow-y: auto; }
.term-detail { min-height: 80px; border-left: 3px solid #dc2626; background: #fff8f7; padding: 9px 12px; font-size: 13px; }
.term-detail h3 { margin: 0 0 6px; font-size: 18px; }
.term-detail p { margin: 4px 0; color: #475569; }
.evidence { padding-left: 18px; font-size: 13px; line-height: 1.45; color: #475569; }
.evidence li { margin: 0 0 10px; }
footer { color: #718096; font-size: 12px; padding: 5px 0 10px; }

.main-tabs { margin-bottom: 18px; }
.main-tabs .tab { padding: 10px 4px; font-weight: 600; color: #64748b; }
.main-tabs .tab--selected { color: #172033; border-top: 3px solid #10b981; }

.coverage-lede { color: #536276; font-size: 13.5px; line-height: 1.55; max-width: 78ch; margin: 4px 2px 16px; }

.obia-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #536276;
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 0;
}
.obia-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #dbe2ee;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: obia-spin 0.7s linear infinite;
}
@keyframes obia-spin { to { transform: rotate(360deg); } }

/* Aba "Cobertura de dados" - visão por empresa (kind: done/retry/manual/dup/nodata/gone) */
:root {
  --audit-done: #10b981; --audit-done-bg: #d1fae5; --audit-done-ink: #065f46;
  --audit-retry: #f59e0b; --audit-retry-bg: #fef3c7; --audit-retry-ink: #92400e;
  --audit-manual: #dc2626; --audit-manual-bg: #fee2e2; --audit-manual-ink: #991b1b;
  --audit-neutral: #64748b; --audit-neutral-bg: #e2e8f0; --audit-neutral-ink: #334155;
}

.audit-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; font-size: 12.5px; color: #536276; margin: 0 2px 14px; }
.audit-legend-item { display: inline-flex; align-items: center; }
.audit-legend .audit-dot { width: 9px; height: 9px; margin-right: 6px; }
.audit-dot-done { background: var(--audit-done); }
.audit-dot-retry { background: var(--audit-retry); }
.audit-dot-manual { background: var(--audit-manual); }
.audit-dot-dup { background: var(--audit-neutral); }

.audit-controls { display: flex; gap: 10px; margin: 0 2px 16px; flex-wrap: wrap; align-items: center; }
.audit-search { flex: 1; min-width: 220px; padding: 9px 12px; border: 1px solid #dbe2ee; border-radius: 8px; font-size: 13.5px; font-family: inherit; }
.audit-search:focus { outline: 2px solid #3b82f6; outline-offset: 1px; }
.audit-toggle { display: flex; border: 1px solid #dbe2ee; border-radius: 8px; overflow: hidden; }
.audit-toggle-btn { border: 0; background: #fff; color: #536276; padding: 9px 14px; font-family: inherit; font-size: 13px; cursor: pointer; font-weight: 500; }
.audit-toggle-btn-active { background: #3b82f6; color: #fff; }
.audit-count-note { font-size: 12.5px; color: #536276; white-space: nowrap; }

.audit-tablewrap { overflow: auto; }
.audit-table { width: 100%; border-collapse: collapse; min-width: 920px; }
.audit-table thead th { position: sticky; top: 0; background: #f4f7fb; text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #536276; font-weight: 700; padding: 11px 14px; border-bottom: 1px solid #e3e9f2; white-space: nowrap; }
.audit-table tbody td { padding: 11px 14px; border-bottom: 1px solid #eef1f5; vertical-align: top; }
.audit-table tbody tr:last-child td { border-bottom: none; }
.audit-table tbody tr:hover { background: #f9fafc; }
.audit-ticker { font-family: monospace; font-weight: 600; }
.audit-company { color: #536276; font-size: 12.5px; max-width: 220px; }
.audit-finbadge { display: inline-flex; align-items: center; gap: 5px; background: var(--audit-done-bg); color: var(--audit-done-ink); border-radius: 6px; padding: 3px 8px; font-family: monospace; font-size: 12px; font-weight: 600; white-space: nowrap; }
.audit-tcell { display: flex; flex-direction: column; gap: 5px; min-width: 120px; }
.audit-tfrac { font-family: monospace; font-weight: 600; font-size: 13px; }
.audit-bar { height: 5px; border-radius: 3px; background: #e2e8f0; overflow: hidden; }
.audit-bar-fill { display: block; height: 100%; border-radius: 3px; }
.audit-bar-done { background: var(--audit-done); }
.audit-bar-retry { background: var(--audit-retry); }
.audit-bar-manual { background: var(--audit-manual); }
.audit-bar-dup, .audit-bar-nodata, .audit-bar-gone { background: var(--audit-neutral); }
.audit-pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 99px; padding: 3px 9px; font-size: 11.5px; font-weight: 600; width: fit-content; }
.audit-pill .audit-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.audit-pill-done { background: var(--audit-done-bg); color: var(--audit-done-ink); } .audit-pill-done .audit-dot { background: var(--audit-done); }
.audit-pill-retry { background: var(--audit-retry-bg); color: var(--audit-retry-ink); } .audit-pill-retry .audit-dot { background: var(--audit-retry); }
.audit-pill-manual { background: var(--audit-manual-bg); color: var(--audit-manual-ink); } .audit-pill-manual .audit-dot { background: var(--audit-manual); }
.audit-pill-dup, .audit-pill-nodata, .audit-pill-gone { background: var(--audit-neutral-bg); color: var(--audit-neutral-ink); }
.audit-pill-dup .audit-dot, .audit-pill-nodata .audit-dot, .audit-pill-gone .audit-dot { background: var(--audit-neutral); }
.audit-missing-chips { display: flex; flex-wrap: wrap; gap: 4px; max-width: 200px; }
.audit-chip { font-family: monospace; font-size: 10.5px; background: #e2e8f0; color: #334155; border-radius: 4px; padding: 1px 5px; }
.audit-chip-more { background: transparent; color: #94a3b8; font-style: italic; }
.audit-dash { color: #94a3b8; }
.audit-action { max-width: 300px; color: #536276; font-size: 12.5px; line-height: 1.5; }
.audit-empty { padding: 40px; text-align: center; color: #94a3b8; font-size: 13px; }

/* Aba "Empresa" - página por ticker */
.filters-single { grid-template-columns: 1fr; }
.company-header { margin: 4px 2px 10px; }
.company-header h2 { margin: 0 0 8px; font-size: 22px; letter-spacing: -.3px; }
.company-badges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.company-badge { background: #eef2f8; color: #334155; border-radius: 6px; padding: 3px 10px; font-size: 12px; font-weight: 600; }
.company-badge-sector { background: #dbeafe; color: #1e40af; }
.company-fin-table { margin-bottom: 10px; }
.company-fin-table th, .company-fin-table td { text-align: right; }
.company-fin-table th:first-child, .company-fin-table td:first-child { text-align: left; }
.company-coverage-grid { gap: 6px; max-width: none; }
.company-chip-ok { background: var(--audit-done-bg); color: var(--audit-done-ink); }
.company-chip-missing { background: var(--audit-manual-bg); color: var(--audit-manual-ink); }

.drill-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin: 0 2px 16px; }
.drill-breadcrumb { font-size: 13.5px; font-weight: 600; color: #172033; }
.drill-button {
  border: 1px solid #dbe2ee; background: #fff; color: #334155; border-radius: 8px;
  padding: 6px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.drill-button:hover:not(:disabled) { background: #f4f7fb; border-color: #b7c2d6; }
.drill-button:disabled { color: #b6bfcc; cursor: default; }

@media (max-width: 850px) {
  .app-shell { padding: 16px; }
  .filters, .metrics, .two-columns { grid-template-columns: 1fr; }
  .side-panel { max-height: none; }
}
