/* Cores da marca Lavrita (amostradas do logo): verde #0f663f e azul #0773ba. */
:root, :root[data-theme="light"] {
  --bg: #f4f7f5; --panel: #ffffff; --ink: #1b2a24; --soft: #5b6b64; --line: #dde5e1;
  --brand: #0f663f; --brand-ink: #ffffff; --blue: #0773ba; --warn: #a15c00; --warn-bg: #fff4e0; --bad: #b3261e;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0d1512; --panel: #14201b; --ink: #e8f1ec; --soft: #9db0a7; --line: #26362f;
  --brand: #3fbf7f; --brand-ink: #062015; --blue: #3d9fe0; --warn: #f0b45a; --warn-bg: #2a2114; --bad: #ff8a80;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif; }
#app { min-height: 100vh; }
.boot { padding: 16px; color: var(--soft); }
.shell { max-width: 1280px; margin: 0 auto; padding: 12px 16px 24px; }

.top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding-bottom: 12px; border-bottom: 3px solid var(--brand); }
.brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.logo { height: 30px; width: auto; }
.logo-text { font-weight: 800; letter-spacing: .08em; color: var(--brand); font-size: 22px; }
.titles h1 { margin: 0; font-size: 18px; }
.muted { color: var(--soft); margin: 0; }
.tools { display: flex; gap: 8px; }

button { font: inherit; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
button:hover { border-color: var(--brand); }
button:disabled { opacity: .6; cursor: progress; }
button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; }
button.quiet { background: transparent; }

.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 12px 0; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--soft); min-width: 160px; }
.field.grow { flex: 1 1 260px; }
input[type="text"], select { font: inherit; padding: 7px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); min-width: 0; }
input[type="text"]:focus, select:focus { outline: 2px solid var(--blue); outline-offset: 0; }
.check { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--soft); padding-bottom: 8px; }

.picker { background: var(--panel); border: 1px solid var(--blue); border-radius: 8px; padding: 10px; margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.picker p { width: 100%; margin: 0 0 4px; }
.picker small { color: var(--soft); margin-left: 6px; }
.progress { height: 26px; display: flex; align-items: center; color: var(--blue); font-size: 13px; }
.alert { background: var(--warn-bg); color: var(--warn); border: 1px solid currentColor; border-radius: 6px; padding: 8px 12px; margin: 0 0 12px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; color: var(--soft); padding: 8px 14px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--blue); font-weight: 600; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi span { font-size: 12px; color: var(--soft); text-transform: uppercase; letter-spacing: .04em; }
.kpi strong { font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.accent { border-left: 4px solid var(--brand); }
.kpi.accent strong { color: var(--brand); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card h2 { margin: 0; font-size: 15px; }
.chart { height: 380px; width: 100%; }
.empty { color: var(--soft); padding: 40px 0; text-align: center; margin: 0; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.segmented button { border: 0; border-radius: 0; padding: 5px 12px; }
.segmented button[aria-pressed="true"] { background: var(--blue); color: #fff; }

.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; }
.split .card { margin-bottom: 0; }
.table-wrap { overflow-x: auto; max-height: 420px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { position: sticky; top: 0; background: var(--panel); color: var(--soft); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { border-top: 2px solid var(--brand); border-bottom: 0; font-weight: 600; }
.pill { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 1px 9px; font-size: 12px; font-weight: 600; }
.missing { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; }
.missing li { display: flex; flex-direction: column; padding: 6px 0; border-bottom: 1px solid var(--line); }
.missing small { color: var(--soft); }

.diag-key { font-weight: 600; color: var(--blue); }
pre { max-height: 480px; overflow: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px; font-size: 12px; white-space: pre-wrap; word-break: break-word; }

.titles { min-width: 0; }
.titles p { overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi strong { font-size: 18px; }
  .logo { height: 24px; }
  .split .card { margin-bottom: 12px; }
  .chart { height: 300px; }
  .titles h1 { font-size: 16px; }
}
