/* ============================================================================
   BOSIA Corp V1 — Design System (fundação reutilizável do produto)
   Direção: "sala de controle corporativa". Densa, séria, operacional.
   Nada de gradientes decorativos, glow ou cards dentro de cards.
   ========================================================================== */

:root {
  /* Superfícies */
  --bg: #0a0e15;
  --bg-sub: #0d131d;
  --surface: #111a28;
  --surface-2: #16203212;
  --surface-raised: #16202f;
  --surface-inset: #0c121c;
  --border: #202c3f;
  --border-strong: #2c3b53;

  /* Texto */
  --text: #e7edf7;
  --text-muted: #93a1b8;
  --text-faint: #61708a;

  /* Marca / ação */
  --brand: #4d7cfe;
  --brand-strong: #3b6bf0;
  --brand-soft: rgba(77, 124, 254, 0.14);
  --brand-contrast: #ffffff;

  /* Semântica */
  --ok: #2fbf71;
  --ok-soft: rgba(47, 191, 113, 0.14);
  --warn: #e0a53a;
  --warn-soft: rgba(224, 165, 58, 0.15);
  --danger: #e05863;
  --danger-soft: rgba(224, 88, 99, 0.15);
  --info: #35b8c9;
  --info-soft: rgba(53, 184, 201, 0.14);
  --violet: #8b7cf6;
  --violet-soft: rgba(139, 124, 246, 0.15);
  --neutral-soft: rgba(147, 161, 184, 0.13);

  /* Tipografia */
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  /* Forma */
  --radius: 8px;
  --radius-sm: 5px;
  --radius-pill: 999px;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.35), 0 8px 24px -18px rgba(0, 0, 0, 0.9);

  /* Layout */
  --appbar-h: 56px;
  --maxw: 1560px;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }

.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
pre { max-width: 100%; overflow-x: auto; }

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.tiny { font-size: 11px; }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.strong { font-weight: 650; }

/* ------------------------------------------------------------------ App bar */
.appbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--appbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  background: #0c121c;
  border-bottom: 1px solid var(--border);
}
.appbar .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 750; letter-spacing: 0.02em; color: var(--text);
  white-space: nowrap;
}
.appbar .brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 6px;
  background: linear-gradient(180deg, #4d7cfe, #2f56c9);
  display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 800;
}
.brand-sub { font-size: 10.5px; color: var(--text-faint); font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }

.context-switch { display: flex; align-items: center; gap: 6px; padding-left: 14px; border-left: 1px solid var(--border); }
.seg {
  display: inline-flex; background: var(--surface-inset);
  border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 3px;
}
.seg a, .seg button {
  appearance: none; border: 0; background: transparent; color: var(--text-muted);
  font: inherit; font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: var(--radius-pill);
  cursor: pointer; white-space: nowrap;
}
.seg .on { background: var(--brand); color: #fff; }
.seg a:hover { text-decoration: none; color: var(--text); }
.seg .on:hover { color: #fff; }

.org-select {
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 6px 10px; font: inherit; font-size: 12.5px;
}
.appbar .spacer { flex: 1; }
.appbar-actions { display: flex; align-items: center; gap: 8px; }

/* --------------------------------------------------------------- Scope nav */
.scopenav {
  background: var(--bg-sub);
  border-bottom: 1px solid var(--border);
  padding: 0 18px;
}
.scopenav ul {
  list-style: none; margin: 0 auto; padding: 0; max-width: var(--maxw);
  display: flex; flex-wrap: wrap; gap: 2px; align-items: stretch;
}
.scopenav a {
  display: inline-block; color: var(--text-muted); font-size: 12.5px; font-weight: 550;
  padding: 11px 11px 9px; border-bottom: 2px solid transparent; white-space: nowrap;
}
.scopenav a:hover { color: var(--text); text-decoration: none; }
.scopenav a.on { color: var(--text); border-bottom-color: var(--brand); }
.scopenav .nav-end { margin-left: auto; display: flex; }
.scopenav .nav-end a { color: var(--text-muted); }

/* ------------------------------------------------------------------- Layout */
.page { max-width: var(--maxw); margin: 0 auto; padding: 18px; }

.page-head {
  display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap;
  padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px solid var(--border);
}
.page-head .title { flex: 1; min-width: min(260px, 100%); }
.page-head h1 { font-size: 20px; }
.page-head .kicker { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-faint); font-weight: 700; }
.page-head .sub { color: var(--text-muted); font-size: 12.5px; margin-top: 3px; max-width: 90ch; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.breadcrumb { font-size: 11.5px; color: var(--text-faint); margin-bottom: 8px; }
.breadcrumb a { color: var(--text-muted); }

.section { margin: 22px 0 0; }
.section > header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.section > header h2 { font-size: 14.5px; }
.section > header .hint { color: var(--text-faint); font-size: 11.5px; }

.grid { display: grid; gap: 14px; }
/* Impede que conteúdo largo (canvas de gráfico, strip de KPIs) estoure a
   largura da trilha do grid e provoque rolagem horizontal no mobile. */
.grid > *, .split > *, .split-even > *, .form-grid > * { min-width: 0; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; }
.split-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

/* -------------------------------------------------------------------- Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.card.tight { padding: 0; overflow: hidden; }
.card > h3 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); font-weight: 700; margin-bottom: 10px;
}
.card-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 700; }
.card-head .spacer { flex: 1; }
.card-body { padding: 14px; }

/* KPI */
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 14px; min-width: 0; }
.kpi .k { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); font-weight: 650; }
.kpi .v { display: block; font-size: 22px; font-weight: 720; margin-top: 6px; font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kpi .d { display: block; font-size: 11.5px; color: var(--text-faint); margin-top: 4px; }
.kpi .v.ok { color: var(--ok); } .kpi .v.warn { color: var(--warn); } .kpi .v.danger { color: var(--danger); } .kpi .v.info { color: var(--info); } .kpi .v.muted { color: var(--text-muted); }
.kpi.compact .v { font-size: 18px; }

/* Duplo */
.kpi2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.kpi2 > div { background: var(--surface); padding: 12px 14px; }

/* ---------------------------------------------------------------- Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 3px 8px; border-radius: var(--radius-pill); border: 1px solid transparent;
  white-space: nowrap; line-height: 1.3;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.9; }
.badge.no-dot::before { display: none; }
.b-ok { color: #6fe0a4; background: var(--ok-soft); border-color: rgba(47,191,113,0.35); }
.b-warn { color: #f0c46a; background: var(--warn-soft); border-color: rgba(224,165,58,0.35); }
.b-danger { color: #ff8f98; background: var(--danger-soft); border-color: rgba(224,88,99,0.35); }
.b-info { color: #7fdcea; background: var(--info-soft); border-color: rgba(53,184,201,0.35); }
.b-violet { color: #b4a9ff; background: var(--violet-soft); border-color: rgba(139,124,246,0.35); }
.b-neutral { color: var(--text-muted); background: var(--neutral-soft); border-color: var(--border-strong); }
.b-brand { color: #9bb8ff; background: var(--brand-soft); border-color: rgba(77,124,254,0.4); }
.badge.plain::before { display: none; }

/* ------------------------------------------------------------------ Buttons */
.btn {
  appearance: none; display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 12.5px; font-weight: 600; line-height: 1;
  padding: 8px 13px; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--surface-raised); color: var(--text); border: 1px solid var(--border-strong);
  white-space: nowrap;
}
.btn:hover { border-color: #3a4c6a; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); }
.btn-danger { background: transparent; border-color: rgba(224,88,99,0.5); color: #ff8f98; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--border); }
.btn-sm { padding: 5px 9px; font-size: 11.5px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn-group { display: inline-flex; gap: 0; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ------------------------------------------------------------------- Tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th, table.data td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-raised);
  color: var(--text-muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700;
  border-bottom: 1px solid var(--border-strong);
}
table.data tbody tr:hover { background: rgba(77,124,254,0.06); }
table.data td.num, table.data th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
table.data tfoot td { border-top: 1px solid var(--border-strong); font-weight: 700; background: var(--surface-inset); }
table.data td .sub { display: block; color: var(--text-faint); font-size: 11px; }
table.data.zebra tbody tr:nth-child(even) { background: rgba(255,255,255,0.014); }
.table-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.table-toolbar .spacer { flex: 1; }
.table-foot { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-muted); }
.table-foot .spacer { flex: 1; }

/* ---------------------------------------------------------------- Forms */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 11px; font-weight: 650; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.field .help { font-size: 11px; color: var(--text-faint); }
.field.is-invalid > label { color: var(--danger); }
.field.is-invalid input, .field.is-invalid select, .field.is-invalid textarea,
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: var(--danger); background: rgba(224,88,99,0.06);
}
.field .field-error { font-size: 11px; color: #ff8f98; }
input[type="text"], input[type="number"], input[type="date"], input[type="search"], select, textarea {
  width: 100%; background: var(--surface-inset); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 8px 10px; font: inherit; font-size: 12.5px;
}
textarea { min-height: 74px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(77,124,254,0.45); outline-offset: -1px; border-color: var(--brand); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin: 0; min-width: 0; }
legend { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 700; padding: 0 6px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text); }
.check input { width: auto; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { flex: 1; min-width: 140px; }

/* ---------------------------------------------------------------- Callouts */
.callout { display: flex; gap: 10px; padding: 11px 13px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; }
.callout .ic { font-weight: 800; font-size: 14px; line-height: 1.2; }
.callout .bd { flex: 1; min-width: 0; }
.callout strong { font-weight: 700; }
.callout.c-warn { border-color: rgba(224,165,58,0.4); background: var(--warn-soft); }
.callout.c-warn .ic { color: var(--warn); }
.callout.c-danger { border-color: rgba(224,88,99,0.4); background: var(--danger-soft); }
.callout.c-danger .ic { color: var(--danger); }
.callout.c-info { border-color: rgba(53,184,201,0.35); background: var(--info-soft); }
.callout.c-info .ic { color: var(--info); }
.callout.c-ok { border-color: rgba(47,191,113,0.35); background: var(--ok-soft); }
.callout.c-ok .ic { color: var(--ok); }
.callout.c-neutral { background: var(--surface-inset); }
.callout.c-neutral .ic { color: var(--text-muted); }

/* --------------------------------------------------------------- Charts */
.chart { margin: 0; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 11.5px; color: var(--text-muted); }
.chart .legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart .legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.chart-title { font-size: 12.5px; font-weight: 650; margin-bottom: 2px; }
.chart-sub { font-size: 11px; color: var(--text-faint); margin-bottom: 10px; }
.chart-grid-line { stroke: #1c2637; stroke-width: 1; }
.chart-axis-text { fill: #61708a; font-size: 10px; font-family: var(--font); }
.chart .bar-label { fill: #93a1b8; font-size: 10px; font-family: var(--mono); }

/* Progress */
.progress { height: 7px; background: var(--surface-inset); border-radius: var(--radius-pill); overflow: hidden; border: 1px solid var(--border); }
.progress > i { display: block; height: 100%; background: var(--brand); border-radius: var(--radius-pill); }
.progress.ok > i { background: var(--ok); } .progress.warn > i { background: var(--warn); } .progress.danger > i { background: var(--danger); }
.progress-row { display: grid; grid-template-columns: minmax(120px, 1.3fr) minmax(0, 3fr) auto; gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); }
.progress-row:last-child { border-bottom: 0; }
.progress-row .lbl { font-size: 12px; }
.progress-row .val { font-size: 11.5px; color: var(--text-muted); font-family: var(--mono); white-space: nowrap; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 1px; background: var(--border); }
.timeline li { position: relative; padding: 0 0 13px 26px; }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface-raised); border: 2px solid var(--border-strong); }
.timeline li.t-ok::before { border-color: var(--ok); } .timeline li.t-warn::before { border-color: var(--warn); } .timeline li.t-danger::before { border-color: var(--danger); } .timeline li.t-info::before { border-color: var(--info); } .timeline li.t-brand::before { border-color: var(--brand); }
.timeline .tt { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.timeline .tt .when { font-size: 11px; color: var(--text-faint); font-family: var(--mono); }
.timeline .tt .what { font-size: 12.5px; font-weight: 600; }
.timeline .desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; overflow-wrap: anywhere; word-break: break-word; }
.timeline .meta { font-size: 11px; color: var(--text-faint); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }

/* Alert list */
.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-list li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.alert-list li:last-child { border-bottom: 0; }
.alert-list .sev { width: 4px; align-self: stretch; border-radius: 2px; background: var(--border-strong); flex: none; }
.alert-list .sev.crit { background: var(--danger); } .alert-list .sev.high { background: var(--warn); } .alert-list .sev.med { background: var(--info); } .alert-list .sev.low { background: var(--border-strong); }
.alert-list .body { flex: 1; min-width: 0; }
.alert-list .body .t { font-size: 12.5px; font-weight: 600; }
.alert-list .body .m { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a, .tabs button { appearance: none; background: transparent; border: 0; border-bottom: 2px solid transparent; color: var(--text-muted); font: inherit; font-size: 12.5px; font-weight: 600; padding: 9px 12px; cursor: pointer; }
.tabs .on { color: var(--text); border-bottom-color: var(--brand); }
.tabs a:hover { text-decoration: none; color: var(--text); }

/* Definition grid */
.dl { display: grid; grid-template-columns: minmax(130px, 0.6fr) 1.4fr; gap: 0; font-size: 12.5px; }
.dl dt { color: var(--text-muted); padding: 7px 0; border-bottom: 1px solid var(--border); font-weight: 600; }
.dl dd { margin: 0; padding: 7px 0; border-bottom: 1px solid var(--border); }
.dl dt:last-of-type, .dl dd:last-of-type { border-bottom: 0; }

/* Steps */
.steps { display: flex; flex-wrap: wrap; gap: 0; }
.steps .step { flex: 1; min-width: 120px; padding: 10px 14px 10px 22px; position: relative; background: var(--surface-inset); border: 1px solid var(--border); border-right: 0; font-size: 12px; }
.steps .step:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.steps .step:last-child { border-right: 1px solid var(--border); border-radius: 0 var(--radius) var(--radius) 0; }
.steps .step .n { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); font-weight: 700; }
.steps .step .s { font-weight: 650; margin-top: 2px; }
.steps .step.done { border-top: 2px solid var(--ok); }
.steps .step.current { border-top: 2px solid var(--brand); background: var(--brand-soft); }
.steps .step.pending { opacity: 0.62; }

/* Preflight dimension rows */
.dim-row { display: grid; grid-template-columns: 200px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); }
.dim-row:last-child { border-bottom: 0; }
.dim-row .dim-name { font-size: 12.5px; font-weight: 600; }
.dim-row .dim-note { font-size: 11.5px; color: var(--text-faint); }

/* Kanban / pipeline */
.pipeline { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(190px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.pipe-col { background: var(--surface-inset); border: 1px solid var(--border); border-radius: var(--radius); min-height: 120px; }
.pipe-col > header { padding: 9px 11px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.pipe-col > header .n { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 700; }
.pipe-col > header .c { margin-left: auto; font-size: 11px; color: var(--text-faint); font-family: var(--mono); }
.pipe-card { margin: 8px; padding: 9px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.pipe-card .t { font-size: 12px; font-weight: 600; }
.pipe-card .v { font-size: 11.5px; color: var(--text-muted); font-family: var(--mono); margin-top: 4px; }

/* Tree / dependency graph */
.dep-graph { font-family: var(--mono); font-size: 11.5px; color: var(--text-muted); white-space: pre; line-height: 1.7; overflow-x: auto; }

/* Stat strip */
.stat-strip { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.stat-strip > div { flex: 1; min-width: 120px; padding: 11px 14px; border-right: 1px solid var(--border); background: var(--surface); }
.stat-strip > div:last-child { border-right: 0; }
.stat-strip .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 650; }
.stat-strip .v { font-size: 16px; font-weight: 700; font-family: var(--mono); margin-top: 4px; }

/* Ledger tags */
.tag { display: inline-block; font-size: 10.5px; font-family: var(--mono); padding: 2px 6px; border-radius: 4px; background: var(--surface-inset); border: 1px solid var(--border); color: var(--text-muted); }

/* Preview banner */
.preview-flag {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: #f0c46a; background: var(--warn-soft); border: 1px solid rgba(224,165,58,0.4);
  padding: 4px 9px; border-radius: var(--radius-pill);
}

/* Footer */
.appfoot { border-top: 1px solid var(--border); margin-top: 26px; padding: 14px 18px; color: var(--text-faint); font-size: 11.5px; display: flex; gap: 14px; flex-wrap: wrap; }

/* Snapshot-only navigation index (static, never sticky) */
.snapshot-nav { max-width: var(--maxw); margin: 0 auto; padding: 14px 18px 0; }
.snapshot-nav .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 14px; }
.snapshot-nav a { font-size: 12px; color: var(--text-muted); }
.snapshot-nav details { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.snapshot-nav summary { cursor: pointer; padding: 10px 14px; font-size: 12.5px; font-weight: 650; }
.snapshot-nav .inner { padding: 0 14px 14px; }
.snapshot-section { scroll-margin-top: calc(var(--appbar-h) + 8px); }
.snapshot-sep { height: 0; border-top: 1px dashed var(--border-strong); margin: 30px 0 6px; scroll-margin-top: calc(var(--appbar-h) + 12px); }

/* Responsivo */
@media (max-width: 1100px) {
  .g5, .g6, .g7 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .g2, .g3, .g4, .g5, .g6, .g7 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-even { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .appbar { gap: 10px; padding: 0 12px; overflow-x: auto; }
  .brand-sub { display: none; }
  .org-select { max-width: 130px; }
  .page { padding: 12px; }
  .dl { grid-template-columns: minmax(0, 1fr); }
  .dl dt { border-bottom: 0; padding-bottom: 0; }
}
@media (max-width: 560px) {
  .g2, .g3, .g4, .g5, .g6, .g7 { grid-template-columns: minmax(0, 1fr); }
  .scopenav a { padding: 9px 8px; }
  /* Trilhas com coluna fixa viram uma única coluna: nenhum conteúdo largo
     (nota de dimensão do preflight, rótulo de meta) força overflow a 360px. */
  .dim-row, .progress-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .dim-row > div:last-child, .progress-row .val { justify-self: start; }
}

/* ============================================================================
   Camada de experiência (progressive enhancement) — ECharts, API e interação.
   ========================================================================== */

/* ECharts sobre gráficos SVG server-rendered */
.chart.has-echarts { display: block; }
.chart.has-echarts > svg { display: none; }
.chart.has-echarts .legend { margin-top: 10px; }
.echarts-host { width: 100%; min-height: 120px; overflow: hidden; }
.echarts-host canvas { outline: none; max-width: 100% !important; }

/* Indicador de origem dos dados (API real x preview) */
.api-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-faint); background: var(--surface-inset);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 4px 9px; white-space: nowrap;
}
.api-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); display: inline-block; }
.api-status.live { color: #6fe0a4; border-color: rgba(47,191,113,0.35); background: var(--ok-soft); }
.api-status.live i { background: var(--ok); box-shadow: 0 0 0 3px rgba(47,191,113,0.16); }

/* Botões em execução de ação */
.btn.is-busy { opacity: 0.7; pointer-events: none; position: relative; }
.btn.is-busy::after {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff;
  display: inline-block; margin-left: 6px; animation: bosia-spin 0.7s linear infinite;
}
@keyframes bosia-spin { to { transform: rotate(360deg); } }

/* Filtros / pílulas */
.filter-group, .pill-group { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filter-group [data-filter], .pill-group [data-filter] { cursor: pointer; user-select: none; }
.filter-group [data-filter].on, .pill-group [data-filter].on { background: var(--brand-soft); border-color: rgba(77,124,254,0.45); color: #9bb8ff; }
.badge-action { cursor: pointer; }
.badge-action:hover { border-color: var(--brand); color: var(--text); }

/* Timeline LIVE */
[data-live].is-paused { opacity: 0.72; }
[data-live].is-paused::after {
  content: "PAUSADO"; position: sticky; top: calc(var(--appbar-h) + 44px);
  float: right; font-size: 10px; letter-spacing: 0.1em; color: var(--warn);
}

/* Toasts de ação/erro */
.toast-host { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast {
  display: flex; align-items: center; gap: 9px; padding: 10px 13px;
  background: var(--surface-raised); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow); font-size: 12.5px; color: var(--text);
  animation: bosia-in 0.18s ease-out;
}
.toast .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--info); flex: none; }
.toast.t-ok { border-color: rgba(47,191,113,0.4); } .toast.t-ok .dot { background: var(--ok); }
.toast.t-warn { border-color: rgba(224,165,58,0.4); } .toast.t-warn .dot { background: var(--warn); }
.toast.t-danger { border-color: rgba(224,88,99,0.45); } .toast.t-danger .dot { background: var(--danger); }
.toast.out { opacity: 0; transform: translateY(6px); transition: all 0.3s ease; }
@keyframes bosia-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Faixa de filtros do dashboard */
.dash-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 14px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.dash-toolbar .spacer { flex: 1; }
.dash-toolbar .filter-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-faint); font-weight: 700; }
.dash-toolbar .divider { width: 1px; height: 20px; background: var(--border); }

/* Estado vazio objetivo */
.empty-state { text-align: center; padding: 28px 18px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-inset); }
.empty-state .t { font-weight: 700; }
.empty-state .d { color: var(--text-muted); font-size: 12px; margin-top: 4px; }

@media (max-width: 820px) {
  .api-status { display: none; }
  .toast-host { left: 12px; right: 12px; max-width: none; }
}

/* Formulário de criação em acordeão (details/summary) */
.add-target summary { list-style: none; cursor: pointer; user-select: none; display: inline-flex; align-items: center; gap: 6px; }
.add-target summary::-webkit-details-marker { display: none; }
.add-target[open] summary { margin-bottom: 4px; }
input[readonly] { opacity: 0.75; cursor: not-allowed; }

/* Faixa LIVE (Workspace / dashboards ao vivo) */
.live-strip { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }

/* ============================================================================
   Preflight e Ativação Explícita (O-15 / O-01) — camada de experiência.
   ========================================================================== */
.preflight-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pf-steps { margin-bottom: 16px; }
.pf-grid { display: grid; gap: 14px; }

/* Selo de gate (habilitado/bloqueado) */
.pf-gate { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.pf-gate.allowed { color: var(--ok); }
.pf-gate.blocked { color: var(--danger); }

/* Painel de ativação */
.pf-activation { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.pf-activation .bd { min-width: 0; }
.pf-activation .bd .t { font-size: 13.5px; font-weight: 650; }
.pf-activation .bd .d { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.pf-activation .act { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
@media (max-width: 820px) { .pf-activation { grid-template-columns: minmax(0, 1fr); } .pf-activation .act { align-items: flex-start; } }

/* Dimensão: estado visual mais evidente */
.dim-row .dim-name { display: flex; align-items: center; gap: 8px; }
.dim-row .dim-idx { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; background: var(--surface-inset); border: 1px solid var(--border); color: var(--text-faint); font-size: 10px; font-family: var(--mono); }
.dim-row.is-pendente { background: rgba(224,165,58,0.04); }
.dim-row.is-falha { background: rgba(224,88,99,0.05); }

/* Filtro por parecer das dimensões (D-12) */
.pf-dim-filter { margin-bottom: 10px; }
.pf-dim-filter button { min-width: 58px; text-align: center; }

/* Pendências */
.pf-pending { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pf-pending li { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.pf-pending .sev { width: 4px; align-self: stretch; border-radius: 2px; background: var(--border-strong); }
.pf-pending .sev.crit { background: var(--danger); } .pf-pending .sev.high { background: var(--warn); } .pf-pending .sev.med { background: var(--info); } .pf-pending .sev.low { background: var(--border-strong); }
.pf-pending .t { font-size: 12.5px; font-weight: 600; }
.pf-pending .m { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; }
.pf-pending .fix { font-size: 11.5px; color: var(--text-muted); margin-top: 5px; }
.pf-pending .dim { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; color: var(--text-muted); }

/* Resultado da ativação */
.pf-success { margin-bottom: 16px; }
.pf-event { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 11.5px; color: var(--text-muted); }
.pf-executando { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }

/* Modal de confirmação explícita */
.modal-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(4,7,12,0.66); display: grid; place-items: center; padding: 18px; }
.modal-overlay[hidden] { display: none; }
.modal { width: min(520px, 100%); background: var(--surface-raised); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; animation: bosia-in 0.16s ease-out; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 14px; flex: 1; }
.modal-x { appearance: none; background: transparent; border: 0; color: var(--text-faint); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 4px; }
.modal-x:hover { color: var(--text); }
.modal-body { padding: 15px; font-size: 12.5px; color: var(--text-muted); max-height: 60vh; overflow-y: auto; }
.modal-body .dl { margin-top: 4px; }
.modal-body .dl dt { color: var(--text-faint); }
.modal-body .dl dd { color: var(--text); }
.modal-lead { color: var(--text-muted); margin-bottom: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 15px; border-top: 1px solid var(--border); }
body.modal-open { overflow: hidden; }

/* ============================================================================
   Ciclo Estratégico do CEO e Gestão de Missões (O-01 / O-05 / O-06).
   ========================================================================== */
.ceo-cycle-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.budget-mini { display: grid; gap: 8px; }
.budget-mini .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.budget-mini .row span { color: var(--text-muted); }
.budget-mini .row strong { font-family: var(--mono); }
.budget-mini .row strong.danger { color: var(--danger); }
.plan-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.plan-table { margin: 0; }
.plan-table td { vertical-align: top; }
.plan-table input, .plan-table select { width: 100%; }
.plan-table input[type="number"] { max-width: 140px; }
.plan-row .mono { font-size: 11.5px; }

/* ============================================================================
   Sprint 5 — Contrato Missão → Tasks e Validação de Enfileiramento (O-06/O-07).
   Checklist de validação do Runtime, resultado do plano e detalhe da Task.
   ========================================================================== */
.enqueue-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.check-row { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; align-items: start; padding: 10px 12px; background: var(--surface); }
.check-row .ci { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 11px; font-weight: 800; border: 1px solid var(--border-strong); color: var(--text-faint); background: var(--surface-inset); }
.check-row .ct { min-width: 0; display: grid; gap: 2px; }
.check-row .cl { font-size: 12.5px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.check-row .cst { font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); font-weight: 700; }
.check-row .cd { font-size: 11.5px; color: var(--text-muted); }
.check-row.is-ok .ci { color: var(--ok); border-color: rgba(47,191,113,0.45); background: var(--ok-soft); }
.check-row.is-ok .cst { color: #6fe0a4; }
.check-row.is-fail { background: rgba(224,88,99,0.05); }
.check-row.is-fail .ci { color: var(--danger); border-color: rgba(224,88,99,0.5); background: var(--danger-soft); }
.check-row.is-fail .cst { color: #ff8f98; }
.check-row.is-pending .ci { color: var(--warn); border-color: rgba(224,165,58,0.45); background: var(--warn-soft); }
.check-row.is-pending .cst { color: #f0c46a; }

/* Resultado do plano (POST /missions/{id}/plan) */
.plan-result { margin-top: 12px; display: grid; gap: 8px; }
.plan-result-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.plan-result-row .pr-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.plan-result-row .pr-state { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.plan-result-row .pr-reason { grid-column: 1 / -1; }
.plan-validation { white-space: nowrap; }
.plan-validation .sub { display: block; }

/* Detalhe da Task (O-07) */
.task-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ============================================================================
   Sprint 6 — Execução de Tasks: claim, lease, heartbeat e checkpoints
   (O-07 / O-08 / O-13 / C-10). Camada de experiência.
   ========================================================================== */
.state-flow { margin-bottom: 0; }
.checkpoint-list { display: grid; gap: 8px; }
.checkpoint-row { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 10px 12px; }
.checkpoint-row.is-safe { border-color: rgba(47, 191, 113, 0.45); background: var(--ok-soft); }
.ck-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ck-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 14px; margin-top: 8px; }
.ck-grid .k { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); font-weight: 700; }
.ck-grid .v { display: block; font-size: 12.5px; font-family: var(--mono); margin-top: 2px; overflow-wrap: anywhere; }

.heartbeat { display: flex; align-items: center; gap: 12px; }
.heartbeat .k { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); font-weight: 700; }
.heartbeat .v { margin-top: 2px; }
.heartbeat .pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--ok); flex: none; box-shadow: 0 0 0 0 rgba(47, 191, 113, 0.5); }
.heartbeat.is-live .pulse { animation: bosia-pulse 1.6s infinite; }
.heartbeat:not(.is-live) .pulse { background: var(--danger); box-shadow: none; }
@keyframes bosia-pulse {
  0% { box-shadow: 0 0 0 0 rgba(47, 191, 113, 0.45); }
  70% { box-shadow: 0 0 0 9px rgba(47, 191, 113, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 191, 113, 0); }
}
@media (max-width: 720px) {
  .ck-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ============================================================================
   Sprint 17 — Observabilidade, Navegação, Dashboards e Relatórios.
   Faixa de filtros dos dashboards, drill-down e retorno do Workspace.
   ========================================================================== */
.dash-filters {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 14px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  max-width: 100%; overflow-x: hidden;
}
.dash-filters .spacer { flex: 1; }
.dash-filters .seg { flex-wrap: wrap; max-width: 100%; }
.chart[data-drill], .chart.hbar[data-drill], [data-drill] { cursor: pointer; }
.chart[data-drill]:hover, [data-drill]:hover { opacity: 0.94; }
.drill-link { font-size: 11px; color: var(--brand); text-decoration: none; margin-right: 8px; white-space: nowrap; }
.drill-link:hover { text-decoration: underline; }
.ws-links { display: inline-flex; gap: 6px; margin-left: 6px; }
.ws-links .tag { color: var(--brand); border-color: rgba(77,124,254,0.4); }
.breadcrumb.ws-return a { font-weight: 600; }
.timeline.is-paused { opacity: 0.55; filter: grayscale(0.2); }
@media (max-width: 720px) {
  .dash-filters { gap: 8px; }
  .dash-filters select { max-width: 140px; }
}
