/* Eliris — tela de Analíticos */
.an-layout { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.an-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.an-camera { width: auto; min-width: 230px; font-weight: 600; }
.an-toolbar .seg small { font-weight: 400; opacity: .8; }
.an-toolbar .spacer { flex: 1; }
.an-switch { display: inline-flex; align-items: center; gap: 8px; color: var(--on-navy); font-weight: 600; font-size: 13px; cursor: pointer; }
.an-switch input { width: 16px; height: 16px; accent-color: var(--stripe); }

.an-stage-wrap { padding: 0; }
.an-stage { position: relative; background: #000; line-height: 0; min-height: 320px; }
.an-stage img { width: 100%; height: auto; display: block; }
.an-stage img:not([src]) { visibility: hidden; }
.an-stage canvas { position: absolute; left: 0; top: 0; }
.an-stage.drawing canvas { cursor: crosshair; }
.an-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #9fb0d6;
  font-size: 14px; line-height: 1.4; }
.an-hint { padding: 10px 14px; font-size: 13px; color: var(--muted); line-height: 1.5; border-top: 1px solid var(--line); }

.an-counters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.an-card { background: var(--panel); border-radius: var(--radius); padding: 10px 14px; border-top: 4px solid var(--stripe);
  box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.an-card span { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.an-card strong { font-size: 28px; font-weight: 800; }
.an-card small { display: block; color: var(--muted); font-size: 12px; }
.an-status { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; color: var(--on-navy-muted); font-size: 13px; }
.an-status .dot { background: #8c959f; }
.an-status.on .dot { background: #22c55e; animation: pulse 1.4s infinite; }
.an-status.warn .dot { background: #f59e0b; }

.an-panel { padding: 16px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; max-height: calc(100vh - 110px); overflow: auto; }
.an-panel-head { display: flex; align-items: center; justify-content: space-between; }
.an-panel h3 { margin: 0; font-size: 19px; color: var(--navy-deep); }
.an-panel h4 { margin: 8px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted);
  border-top: 1px solid var(--line); padding-top: 12px; }
.an-form { display: flex; flex-direction: column; gap: 10px; }
.an-form > label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 700; color: var(--muted); }
.an-classes { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0; }
.an-classes legend { font-size: 12px; font-weight: 700; color: var(--muted); padding: 0 4px; }
.an-classes label, .an-inline { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; flex-direction: row !important; }
.an-classes input, .an-inline input { width: 16px; height: 16px; accent-color: var(--stripe); }
.an-form-actions { display: flex; gap: 8px; }

.an-rules, .an-events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.an-rules li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; }
.an-rules li.sel { border-color: var(--stripe); background: var(--panel-2); }
.an-rules .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.an-rname { flex: 1; font-weight: 600; font-size: 13px; min-width: 0; }
.an-rname small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }

.an-events li { display: flex; gap: 10px; align-items: center; padding: 6px; border-radius: 8px; border-left: 4px solid #8c959f;
  background: var(--panel-2); cursor: pointer; font-size: 13px; }
.an-events li.ev-na_faixa { border-left-color: #22c55e; }
.an-events li.ev-fora_da_faixa { border-left-color: #ef4444; }
.an-events li.ev-na_area { border-left-color: #f59e0b; }
.an-events img, .an-events .noimg { width: 76px; height: 46px; object-fit: cover; border-radius: 5px; background: #0b1328; flex: none; }
.an-events small { display: block; color: var(--muted); font-size: 11.5px; }
#an-photo-dialog .live-body img { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }

[data-theme="dark"] .an-panel h3 { color: #fff; }

/* fluxo por hora (contagem) */
.an-flow { margin-top: 14px; padding: 12px 16px 14px; }
.an-flow h3 { margin: 0 0 8px; font-size: 16px; color: var(--navy-deep); }
.an-flow-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.an-flow .chart { height: 200px; }
.an-flow-tag { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 5px; color: #fff; }
.an-flow-tag.in { background: #0891b2; } .an-flow-tag.out { background: #9333ea; }
[data-theme="dark"] .an-flow h3 { color: #fff; }

/* ocorrências */
.an-occ { margin-top: 14px; padding: 14px 16px 16px; }
.an-occ-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.an-occ-head h3 { margin: 0; font-size: 17px; color: var(--navy-deep); }
.an-occ-head input[type=date] { width: auto; }
.an-occ-head .spacer { flex: 1; }
.an-occ-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.occ { margin: 0; border-radius: 8px; overflow: hidden; background: #0b1328; cursor: pointer; border: 2px solid transparent;
  border-top: 4px solid #8c959f; }
.occ:hover { border-color: var(--stripe); }
.occ.ev-na_faixa { border-top-color: #22c55e; }
.occ.ev-fora_da_faixa { border-top-color: #ef4444; }
.occ.ev-na_area { border-top-color: #f59e0b; }
.occ.ev-entrada { border-top-color: #06b6d4; }
.occ.ev-saida { border-top-color: #a855f7; }
.occ-img { position: relative; aspect-ratio: 4/3; background: #111; }
.occ-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.occ-badge { position: absolute; left: 6px; top: 6px; padding: 2px 8px; border-radius: 5px; font-size: 11.5px; font-weight: 700; color: #fff; }
.ev-na_faixa .occ-badge { background: #16a34a; } .ev-entrada .occ-badge { background: #0891b2; } .ev-saida .occ-badge { background: #9333ea; } .ev-fora_da_faixa .occ-badge { background: #dc2626; } .ev-na_area .occ-badge { background: #d97706; }
.occ-clip { position: absolute; right: 6px; top: 6px; background: rgba(0,0,0,.65); color: #fff; font-size: 11.5px; padding: 2px 7px; border-radius: 5px; }
.occ-clip.wait { opacity: .7; }
.occ figcaption { padding: 6px 9px; color: #e9eef8; font-size: 12.5px; display: flex; justify-content: space-between; gap: 6px; }
.occ figcaption small { color: #9fb0d6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-occ-foot { display: flex; justify-content: center; margin-top: 10px; }
.an-clips label[hidden] { display: none; }
#an-photo-dialog .live-body video { width: 100%; height: 100%; background: #000; display: block; }
#an-photo-dialog a.btn { text-decoration: none; display: inline-flex; align-items: center; }
[data-theme="dark"] .an-occ-head h3 { color: #fff; }

/* aba Ocorrências */
.oc-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 12px 14px; }
.oc-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.oc-filters .dt { display: flex; gap: 6px; }
.oc-filters input[type=date], .oc-filters input[type=time], .oc-filters select { width: auto; }
.oc-quick { display: flex; gap: 6px; padding-bottom: 6px; }
.oc-filters .oc-only { flex-direction: row; align-items: center; gap: 7px; padding-bottom: 9px; cursor: pointer; }
.oc-only input { width: 16px; height: 16px; accent-color: var(--stripe); }
.oc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 12px 0 0; }
.occ .occ-cam { color: #fff; font-weight: 700; }
@media (max-width: 1200px) {
  .oc-stats { grid-template-columns: repeat(2, 1fr); }
  .an-layout { grid-template-columns: 1fr; }
  .an-panel { position: static; max-height: none; }
  .an-counters { grid-template-columns: repeat(2, 1fr); }
}

/* ---- leitura de placas (LPR) ---- */
.occ-plate { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); background: #fff; color: #111;
  font: 800 15px/1 ui-monospace, "SFMono-Regular", Consolas, monospace; letter-spacing: 1.5px; padding: 5px 9px;
  border-radius: 5px; border: 2px solid #111; border-top: 6px solid #1d4ed8; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.ev-placa_alerta .occ-plate { border-color: #dc2626; border-top-color: #dc2626; }
.ev-placa .occ-badge { background: #ca8a04; }
.ev-placa_alerta .occ-badge { background: #dc2626; }
.lpr-recent { grid-column: span 2; }
.lpr-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.lpr-chip { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer;
  background: #fff; color: #111; border: 2px solid #111; border-top: 5px solid #1d4ed8; border-radius: 5px;
  padding: 3px 8px; font: 800 14px/1.1 ui-monospace, Consolas, monospace; letter-spacing: 1px; }
.lpr-chip small { font: 500 10px/1 system-ui, sans-serif; color: #555; letter-spacing: 0; }
.lpr-chip.alert { border-color: #dc2626; border-top-color: #dc2626; background: #fff1f1; animation: lprPulse 1.2s 3; }
@keyframes lprPulse { 50% { box-shadow: 0 0 0 4px rgba(220,38,38,.35); } }
.lpr-watch { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.lpr-watch h4 { margin: 0 0 4px; }
.lpr-watch-form { display: grid; grid-template-columns: 110px 1fr auto; gap: 6px; margin: 8px 0; }
.lpr-watch-form input[name="plate"] { text-transform: uppercase; font-family: ui-monospace, Consolas, monospace; font-weight: 700; }
.lpr-watch-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lpr-watch-list li { display: flex; align-items: center; gap: 8px; }
.lpr-plate { background: #fff; color: #111; border: 2px solid #111; border-top: 5px solid #1d4ed8; border-radius: 4px;
  padding: 2px 6px; font: 800 13px/1.1 ui-monospace, Consolas, monospace; letter-spacing: 1px; white-space: nowrap; }
.lpr-plate.off { opacity: .45; }
.lpr-desc { flex: 1; min-width: 0; font-size: 13px; display: grid; }
.lpr-desc small { color: var(--muted); font-size: 11px; }
.btn.small { padding: 3px 8px; font-size: 12px; }
.oc-plate-in { text-transform: uppercase; width: 110px; font-family: ui-monospace, Consolas, monospace; }

/* ---- velocidade ---- */
.an-speed { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px 10px; display: grid; gap: 8px; }
.an-speed legend { font-weight: 700; font-size: 13px; padding: 0 4px; }
.an-speed.hidden { display: none; }
.occ-speed { position: absolute; right: 8px; bottom: 8px; background: rgba(8,20,48,.88); color: #fff;
  font: 800 16px/1 system-ui, sans-serif; padding: 6px 9px; border-radius: 8px; border: 2px solid #1ea0eb; }
.ev-excesso_velocidade .occ-speed { border-color: #ef4444; background: #b91c1c; }
.ev-velocidade .occ-badge { background: #1ea0eb; }
.ev-excesso_velocidade .occ-badge { background: #dc2626; }
.spd-chip { display: inline-flex; flex-direction: column; align-items: center; min-width: 58px; padding: 4px 8px;
  border-radius: 8px; border: 2px solid #1ea0eb; font: 800 18px/1.05 system-ui, sans-serif; color: var(--navy-deep, #0b1f4d); }
.spd-chip small { font: 500 10px/1.2 system-ui, sans-serif; color: var(--muted); }
.spd-chip.over { border-color: #dc2626; color: #dc2626; background: rgba(220,38,38,.08); }

/* ---- reconhecimento facial ---- */
.occ-person { position: absolute; left: 8px; bottom: 8px; background: #16a34a; color: #fff; font: 700 12px/1 system-ui, sans-serif;
  padding: 5px 8px; border-radius: 999px; box-shadow: 0 2px 6px rgba(0,0,0,.35); max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-rosto_alerta .occ-person { background: #dc2626; }
.ev-rosto_reconhecido .occ-badge { background: #16a34a; }
.ev-rosto_alerta .occ-badge { background: #dc2626; }
.ev-rosto .occ-badge { background: #8b5cf6; }
.face-chip { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; background: var(--panel-2); border: 2px solid #16a34a;
  border-radius: 999px; padding: 2px 10px 2px 2px; font: 700 12px/1.1 system-ui, sans-serif; color: var(--text); }
.face-chip img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.face-chip span { display: grid; text-align: left; }
.face-chip small { font-weight: 500; font-size: 10px; color: var(--muted); }
.face-chip.alert { border-color: #dc2626; background: #fff1f1; color: #b91c1c; }
.person-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.person-list li { display: flex; align-items: center; gap: 10px; }
.person-list li.off { opacity: .5; }
.person-list img, .person-list .ph { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex: none; display: grid; place-items: center;
  background: var(--panel-2); border: 2px solid var(--line); }
.pdesc { flex: 1; min-width: 0; display: grid; font-size: 13px; }
.pdesc small { color: var(--muted); font-size: 11px; }
.pcat { justify-self: start; font-size: 10px; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.pcat.cat-procurado, .pcat.cat-alerta { background: #fee2e2; color: #b91c1c; }
.pcat.cat-autorizado, .pcat.cat-funcionario { background: #dcfce7; color: #15803d; }
.pcat.cat-vip { background: #fef3c7; color: #b45309; }
.person-photos { display: grid; gap: 8px; }
.pthumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.pthumb { position: relative; }
.pthumb img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: 2px solid var(--line); }
.pthumb button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: #dc2626; color: #fff; cursor: pointer; font-size: 11px; }
#person-form textarea { font: inherit; width: 100%; resize: vertical; }
.face-chip span { text-transform: none; letter-spacing: 0; }

/* v0.3.34 — avaliação das ocorrências (Correto / Falso alarme) e qualidade */
.fb-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line, #333);
  background: var(--panel, #111); }
.fb-bar .fb-q { font-weight: 600; font-size: 13px; margin-right: 4px; }
.fb-bar kbd { font: 600 10px/1 ui-monospace, monospace; opacity: .6; border: 1px solid currentColor; border-radius: 3px; padding: 1px 3px; margin-left: 4px; }
.fb-bar .btn.on.fb-ok { background: #16a34a; color: #fff; border-color: #16a34a; }
.fb-bar .btn.on.fb-bad { background: #dc2626; color: #fff; border-color: #dc2626; }
.fb-bar select.on { border-color: #f59e0b; box-shadow: 0 0 0 2px rgba(245,158,11,.35); }
.fb-bar .fb-state { font-size: 12px; color: var(--muted, #999); }
.fb-bar .fb-next { font-size: 12px; display: flex; gap: 4px; align-items: center; }
.occ-fb { position: absolute; right: 6px; bottom: 6px; font-size: 13px; line-height: 1; background: rgba(0,0,0,.65); border-radius: 6px; padding: 4px 5px; }
.q-head { display: flex; align-items: center; gap: 8px; }
.q-head h3 { margin: 0; }
.q-table-wrap { overflow-x: auto; margin-top: 10px; }
.q-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.q-table th, .q-table td { padding: 7px 9px; border-bottom: 1px solid var(--line, #333); text-align: left; white-space: nowrap; }
.q-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted, #999); }
.q-prec { font-weight: 700; }
.q-prec.good { color: #16a34a; } .q-prec.mid { color: #d97706; } .q-prec.bad { color: #dc2626; }
.q-learn { font-weight: 600; color: var(--accent, #2563eb); }
dialog.dlg-wide { width: min(1000px, 96vw); padding: 18px 22px; }

/* v0.3.35 — galeria de rostos */
.fg-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; }
.fg-filters label { display: grid; gap: 4px; font-size: 12px; }
.fg-note { margin-left: auto; }
.fg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; }
.fg-card { margin: 0; border-radius: 12px; overflow: hidden; background: var(--panel, #111); border: 1px solid var(--line, #333); cursor: pointer;
  transition: transform .15s, border-color .15s; }
.fg-card:hover { transform: translateY(-2px); border-color: var(--stripe, #e11d2e); }
.fg-card .fg-img { position: relative; aspect-ratio: 3 / 4; background: #0b0b0d; }
.fg-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fg-card .fg-count { position: absolute; right: 6px; top: 6px; font: 700 11px/1 ui-monospace, monospace; background: rgba(0,0,0,.7);
  color: #fff; padding: 4px 6px; border-radius: 5px; }
.fg-card .fg-name { position: absolute; left: 6px; bottom: 6px; right: 6px; font-size: 12px; font-weight: 600; background: rgba(22,163,74,.9);
  color: #fff; padding: 3px 6px; border-radius: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fg-card figcaption { padding: 8px 10px; display: grid; gap: 2px; font-size: 12px; }
.fg-card figcaption b { font-variant-numeric: tabular-nums; }
.fg-card figcaption small { color: var(--muted, #999); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fg-dlg { width: min(760px, 96vw); padding: 0; }
.fg-dlg-body { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; padding: 20px; }
.fg-dlg-body img { width: 100%; border-radius: 10px; background: #0b0b0d; }
.fg-dlg-info h3 { margin: 0 0 10px; }
.fg-dlg-info dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 16px; font-size: 14px; }
.fg-dlg-info dt { color: var(--muted, #999); }
.fg-dlg-info dd { margin: 0; font-variant-numeric: tabular-nums; }
.fg-dlg-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
@media (max-width: 640px) { .fg-dlg-body { grid-template-columns: minmax(0, 1fr); } }
.fg-empty { grid-column: 1 / -1; max-width: 60ch; font-size: 14px; line-height: 1.6; padding: 24px 4px; }

/* ---------- analíticos novos (v0.3.39) ---------- */
.an-card strong { overflow-wrap: anywhere; }
.heat-periods .seg { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.heat-periods .seg button { padding: 4px 10px; font-size: 12px; }
.heat-bar { height: 12px; border-radius: 6px; margin: 12px 0 6px;
  background: linear-gradient(90deg, #3b82f6, #22c55e 35%, #facc15 65%, #ef4444); }
.an-form optgroup { font-style: normal; font-weight: 700; }
.an-card em.an-txt { display: block; font-style: normal; font-size: 20px; line-height: 1.25; padding: 4px 0 2px; }

/* ---------- seletor visual de analíticos (v0.3.40) ---------- */
.atp-field { display: grid; gap: 6px; }
.atp-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.atp-btn { --tc: #22c55e; position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  width: 100%; padding: 10px 12px; text-align: left; cursor: pointer; font: inherit; color: var(--text);
  background: linear-gradient(135deg, color-mix(in srgb, var(--tc) 14%, var(--panel)), var(--panel-2));
  border: 1px solid color-mix(in srgb, var(--tc) 45%, var(--line)); border-radius: 12px; overflow: hidden;
  transition: border-color .2s, box-shadow .2s, transform .15s; }
.atp-btn::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 3px, color-mix(in srgb, var(--tc) 6%, transparent) 3px 4px); }
.atp-btn:hover:not(:disabled) { border-color: var(--tc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc) 18%, transparent),
  0 8px 24px color-mix(in srgb, var(--tc) 22%, transparent); transform: translateY(-1px); }
.atp-btn:disabled { cursor: default; opacity: .85; }
.atp-tile { --s: 42px; position: relative; width: var(--s); height: var(--s); flex: none; display: grid; place-items: center;
  border-radius: 11px; color: var(--tc); background: color-mix(in srgb, var(--tc) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--tc) 55%, transparent);
  box-shadow: inset 0 0 14px color-mix(in srgb, var(--tc) 28%, transparent), 0 0 18px color-mix(in srgb, var(--tc) 25%, transparent); }
.atp-tile svg { width: 62%; height: 62%; filter: drop-shadow(0 0 4px color-mix(in srgb, var(--tc) 70%, transparent)); }
.atp-txt { min-width: 0; display: grid; gap: 1px; }
.atp-txt small { font-size: 9.5px; letter-spacing: 1.4px; font-weight: 700; color: var(--tc); font-family: ui-monospace, Consolas, monospace; }
.atp-txt b { font-size: 14px; line-height: 1.25; }
.atp-txt em { font-style: normal; font-size: 11.5px; line-height: 1.35; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.atp-swap { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--tc);
  background: color-mix(in srgb, var(--tc) 12%, transparent); border: 1px solid color-mix(in srgb, var(--tc) 35%, transparent); }
.atp-swap svg { width: 16px; height: 16px; }

dialog.atp-dialog { width: min(1080px, 96vw); max-height: 90vh; padding: 0; overflow: hidden; display: none; flex-direction: column;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 15%, transparent), 0 30px 80px rgba(0,0,0,.55); }
dialog.atp-dialog[open] { display: flex; animation: atpIn .22s ease-out; }
@keyframes atpIn { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.atp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 12px;
  background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%); }
.atp-title { display: flex; align-items: center; gap: 12px; }
.atp-title small { font-family: ui-monospace, Consolas, monospace; font-size: 10px; letter-spacing: 1.6px; color: var(--accent); font-weight: 700; }
.atp-title h3 { margin: 2px 0 0; font-size: 20px; }
.atp-pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); animation: atpPulse 1.8s infinite; }
@keyframes atpPulse { 70% { box-shadow: 0 0 0 10px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.atp-x { background: none; border: 1px solid var(--line); color: var(--muted); width: 34px; height: 34px; border-radius: 9px; cursor: pointer; font-size: 15px; }
.atp-x:hover { color: var(--text); border-color: var(--muted); }
.atp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 0 22px 14px; border-bottom: 1px solid var(--line); }
.atp-search { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 38px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.atp-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.atp-search svg { width: 16px; height: 16px; flex: none; }
.atp-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: inherit; padding: 0; }
.atp-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.atp-cats button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); }
.atp-cats button span { font-size: 10.5px; padding: 1px 6px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 18%, transparent); }
.atp-cats button.active { color: #fff; background: var(--accent); border-color: var(--accent);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 40%, transparent); }
.atp-cats button.active span { background: rgba(255,255,255,.22); }
.atp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; padding: 16px 22px 18px; overflow-y: auto; }
.atp-card { --tc: #22c55e; position: relative; display: grid; align-content: start; gap: 6px; padding: 16px 16px 14px; min-height: 172px;
  text-align: left; cursor: pointer; font: inherit; color: var(--text); border-radius: 14px; overflow: hidden;
  background: linear-gradient(160deg, color-mix(in srgb, var(--tc) 9%, var(--panel-2)) 0%, var(--panel) 70%);
  border: 1px solid color-mix(in srgb, var(--tc) 28%, var(--line));
  animation: atpCard .35s both ease-out; animation-delay: var(--d);
  transition: transform .18s, border-color .18s, box-shadow .18s; }
@keyframes atpCard { from { opacity: 0; transform: translateY(8px); } }
.atp-card:hover, .atp-card:focus-visible { outline: 0; transform: translateY(-3px); border-color: var(--tc);
  box-shadow: 0 0 0 1px var(--tc), 0 14px 34px color-mix(in srgb, var(--tc) 28%, transparent); }
.atp-card .atp-tile { --s: 48px; margin-bottom: 6px; }
.atp-card b { font-size: 15px; }
.atp-card em { font-style: normal; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.atp-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.atp-tags i { font-style: normal; font-family: ui-monospace, Consolas, monospace; font-size: 9.5px; font-weight: 700; letter-spacing: .8px;
  padding: 2px 7px; border-radius: 5px; color: var(--tc); background: color-mix(in srgb, var(--tc) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--tc) 35%, transparent); }
.atp-tags i.new { color: #fff; background: linear-gradient(90deg, #f43f5e, #f97316); border-color: transparent; }
.atp-tags i.lgpd { color: #a855f7; background: rgba(168,85,247,.12); border-color: rgba(168,85,247,.4); }
.atp-tags i.noai { color: #22c55e; background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.4); }
/* cantos de mira (HUD) e linha de varredura */
.atp-corners, .atp-corners::before, .atp-corners::after { position: absolute; pointer-events: none; }
.atp-corners { inset: 7px; opacity: .55; transition: opacity .2s, inset .2s;
  background: linear-gradient(var(--tc), var(--tc)) left top / 12px 2px, linear-gradient(var(--tc), var(--tc)) left top / 2px 12px,
    linear-gradient(var(--tc), var(--tc)) right top / 12px 2px, linear-gradient(var(--tc), var(--tc)) right top / 2px 12px,
    linear-gradient(var(--tc), var(--tc)) left bottom / 12px 2px, linear-gradient(var(--tc), var(--tc)) left bottom / 2px 12px,
    linear-gradient(var(--tc), var(--tc)) right bottom / 12px 2px, linear-gradient(var(--tc), var(--tc)) right bottom / 2px 12px;
  background-repeat: no-repeat; }
.atp-card:hover .atp-corners, .atp-card.sel .atp-corners { opacity: 1; inset: 4px; }
.atp-scan { position: absolute; left: 0; right: 0; top: -40%; height: 40%; pointer-events: none; opacity: 0;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--tc) 22%, transparent), transparent); }
.atp-card:hover .atp-scan { opacity: 1; animation: atpScan 1.4s linear infinite; }
@keyframes atpScan { to { top: 110%; } }
.atp-card.sel { border-color: var(--tc); box-shadow: 0 0 0 2px var(--tc), 0 12px 30px color-mix(in srgb, var(--tc) 30%, transparent); }
.atp-check { position: absolute; top: 12px; right: 12px; font-size: 10px; font-weight: 800; letter-spacing: .8px; color: #fff;
  background: var(--tc); padding: 3px 8px; border-radius: 6px; box-shadow: 0 0 14px color-mix(in srgb, var(--tc) 60%, transparent); }
.atp-empty { grid-column: 1 / -1; text-align: center; padding: 30px 0; }
.atp-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 22px; font-size: 12px; color: var(--muted);
  border-top: 1px solid var(--line); background: var(--panel-2); font-family: ui-monospace, Consolas, monospace; }
.atp-foot .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; margin-right: 7px;
  box-shadow: 0 0 8px #22c55e; vertical-align: middle; }
@media (max-width: 640px) { .atp-grid { grid-template-columns: 1fr 1fr; padding: 12px; } .atp-card { min-height: 0; } .atp-head, .atp-bar { padding-left: 14px; padding-right: 14px; } }
@media (prefers-reduced-motion: reduce) { .atp-card, dialog.atp-dialog[open], .atp-card:hover .atp-scan, .atp-pulse { animation: none; } }
.atp-swap[hidden] { display: none; }

/* cores das ocorrências dos analíticos novos (v0.4.12) */
.occ.ev-permanencia { border-top-color: #f97316; } .ev-permanencia .occ-badge { background: #ea580c; }
.occ.ev-estacionado { border-top-color: #3b82f6; } .ev-estacionado .occ-badge { background: #2563eb; }
.occ.ev-lotacao { border-top-color: #ec4899; } .ev-lotacao .occ-badge { background: #db2777; }
.occ.ev-contramao { border-top-color: #ef4444; } .ev-contramao .occ-badge { background: #dc2626; }
.occ.ev-cruzou_linha { border-top-color: #eab308; } .ev-cruzou_linha .occ-badge { background: #ca8a04; }
.occ.ev-camera_tapada, .occ.ev-camera_desfocada, .occ.ev-camera_movida { border-top-color: #111827; }
.ev-camera_tapada .occ-badge, .ev-camera_desfocada .occ-badge, .ev-camera_movida .occ-badge { background: #111827; }
.occ.ev-rosto { border-top-color: #8b5cf6; }
.an-events li.ev-permanencia { border-left-color: #f97316; } .an-events li.ev-estacionado { border-left-color: #3b82f6; }
.an-events li.ev-lotacao { border-left-color: #ec4899; } .an-events li.ev-contramao { border-left-color: #ef4444; }
.an-events li.ev-cruzou_linha { border-left-color: #eab308; }
.an-events li.ev-camera_tapada, .an-events li.ev-camera_desfocada, .an-events li.ev-camera_movida { border-left-color: #111827; }
.oc-pick { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.oc-pick:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.15); }
#an-occ-filter { flex-wrap: wrap; }

/* ---------- v0.4.13: indicadores (vagas, fila, contagem por tipo) ---------- */
.an-ind { margin-top: 14px; padding: 12px 16px 16px; }
.an-ind-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.an-ind-head h3 { margin: 0; font-size: 16px; color: var(--navy-deep); }
[data-theme="dark"] .an-ind-head h3 { color: #fff; }
.an-ind-head .seg button { font-size: 12px; padding: 4px 10px; }
.an-ind-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.an-ind .chart { min-height: 210px; }
.an-ind-tag { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px; }
.an-ind-side { max-height: 330px; overflow: auto; padding-right: 2px; }
@media (max-width: 1100px) { .an-ind-grid { grid-template-columns: 1fr; } }

/* mapa das vagas */
.vg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.vg-tile { position: relative; border-radius: 10px; padding: 8px 8px 7px; border: 1px solid var(--line);
  background: color-mix(in srgb, #22c55e 10%, var(--panel)); border-left: 4px solid #22c55e; overflow: hidden; }
.vg-tile b { display: block; font-size: 14px; font-weight: 800; letter-spacing: .3px; }
.vg-tile small { display: block; font-size: 11px; color: var(--muted); line-height: 1.25; }
.vg-tile em { font-style: normal; font-size: 10.5px; font-weight: 800; letter-spacing: .4px; color: #16a34a; }
.vg-tile.occ { background: color-mix(in srgb, #ef4444 12%, var(--panel)); border-left-color: #ef4444; }
.vg-tile.occ em { color: #dc2626; }
.vg-tile.late { border-left-color: #f97316; box-shadow: inset 0 0 0 1px #f9731655; }
.vg-tile.late em { color: #ea580c; }
.vg-tile .vg-bar { position: absolute; left: 0; bottom: 0; height: 3px; background: currentColor; opacity: .35; }
.vg-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin: 10px 0 0; flex-wrap: wrap; }
.vg-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* barras horizontais (por tipo / por vaga) */
.hb-list { display: flex; flex-direction: column; gap: 8px; }
.hb-row { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.hb-row > span:first-child { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-track { height: 10px; border-radius: 6px; background: var(--line); overflow: hidden; }
.hb-track i { display: block; height: 100%; border-radius: 6px; background: var(--c, var(--stripe)); transition: width .4s ease; }
.hb-row b { font-variant-numeric: tabular-nums; min-width: 58px; text-align: right; }
.hb-row b small { color: var(--muted); font-weight: 600; margin-left: 4px; }

/* passagens recentes (contagem por tipo) */
.ct-recent { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.ct-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 3px 9px;
  border-radius: 999px; background: color-mix(in srgb, var(--c, #64748b) 16%, var(--panel)); border: 1px solid color-mix(in srgb, var(--c, #64748b) 45%, transparent); }
.ct-chip small { color: var(--muted); font-weight: 600; }
.ct-alert { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; margin: 4px 0 6px; font-size: 13px; }
.ct-alert label { display: flex; align-items: center; gap: 6px; }

/* fila: régua de espera */
.fl-gauge { margin: 4px 0 12px; }
.fl-gauge .hb-track { height: 14px; }
.fl-gauge small { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.an-card .an-big-sub { font-size: 15px; font-weight: 800; }
/* gráfico dos indicadores: legenda embaixo, gráfico na largura toda */
.an-ind .chart { display: block; }
.an-ind .chart .chart-svg { display: block; width: 100%; height: auto; max-height: 260px; }
.an-ind .chart .legend.legend-row { flex-direction: row; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.an-ind .chart .legend.legend-row .sw { width: 10px; height: 10px; border-radius: 3px; }

/* ======================= Machine Learning (v0.5.0) ======================= */
.ml-head { flex-wrap: wrap; gap: 10px; }
.ml-head #ml-model { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.ml-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted); }
.ml-chip.ok { color: #22c55e; border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.08); }
.ml-steps { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); flex-wrap: wrap; }
.ml-steps button { display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; color: var(--muted);
  padding: 7px 12px; border-radius: 9px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.ml-steps button b { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px;
  background: var(--line); color: var(--text); }
.ml-steps button em { font-style: normal; font-size: 10px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase;
  padding: 1px 6px; border-radius: 6px; background: var(--line); color: var(--muted); }
.ml-steps button.active { background: var(--stripe); color: #fff; }
.ml-steps button.active b { background: rgba(255,255,255,.25); color: #fff; }
.ml-steps button:not(.active):hover { color: var(--text); }

.ml-page { display: grid; grid-template-columns: 290px minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
.ml-page.hidden { display: none; }
@media (max-width: 1300px) { .ml-page { grid-template-columns: 270px minmax(0, 1fr); } .ml-result { grid-column: 1 / -1; } }
@media (max-width: 860px) { .ml-page { grid-template-columns: 1fr; } }
.ml-side, .ml-result { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.ml-side h4, .ml-result h4 { margin: 10px 0 2px; font-size: 11.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted);
  display: flex; justify-content: space-between; }
.ml-side h4:first-child, .ml-result h4:first-child { margin-top: 0; }
.ml-side h4 b { color: var(--text); letter-spacing: 0; }
.ml-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 22px 12px; cursor: pointer;
  border: 2px dashed color-mix(in srgb, var(--stripe) 45%, var(--line)); border-radius: 14px; transition: .15s;
  background: color-mix(in srgb, var(--stripe) 5%, transparent); }
.ml-drop svg { width: 34px; height: 34px; color: var(--stripe); margin-bottom: 4px; }
.ml-drop b { font-size: 14px; }
.ml-drop small { font-size: 11.5px; color: var(--muted); }
.ml-drop:hover, .ml-drop.over { border-color: var(--stripe); background: color-mix(in srgb, var(--stripe) 12%, transparent); transform: translateY(-1px); }
.ml-or { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.ml-or::before, .ml-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.ml-field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
.ml-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.ml-check input { width: 16px; height: 16px; accent-color: var(--stripe); }
.ml-check small { color: var(--muted); font-size: 11px; }
.ml-seg { display: flex; }
.ml-seg button { flex: 1; font-size: 12.5px; }
#ml-conf { width: 100%; accent-color: var(--stripe); }

.ml-stage-wrap { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ml-stage { position: relative; height: min(66vh, 640px); min-height: 340px; border-radius: 12px; overflow: hidden;
  background: radial-gradient(ellipse at center, #10141d 0%, #06080c 100%); }
.ml-stage img, .ml-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.ml-stage canvas { position: absolute; inset: 0; pointer-events: none; }
.ml-stage video { pointer-events: auto; }
.ml-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  text-align: center; padding: 30px; color: #cbd5e1; }
.ml-empty p { max-width: 460px; color: #94a3b8; font-size: 14px; line-height: 1.5; margin: 0; }
.ml-empty > b { font-size: 18px; color: #fff; }
.ml-empty-art { position: relative; width: 150px; height: 96px; margin-bottom: 12px; border-radius: 10px;
  background: repeating-linear-gradient(0deg, transparent 0 11px, rgba(255,255,255,.04) 11px 12px),
              repeating-linear-gradient(90deg, transparent 0 11px, rgba(255,255,255,.04) 11px 12px); }
.ml-empty-art span { position: absolute; border: 2px solid; border-radius: 3px; animation: ml-pulse 2.4s ease-in-out infinite; }
.ml-empty-art span:nth-child(1) { left: 10px; top: 22px; width: 34px; height: 62px; color: #22c55e; }
.ml-empty-art span:nth-child(2) { left: 58px; top: 44px; width: 68px; height: 38px; color: #3b82f6; animation-delay: .4s; }
.ml-empty-art span:nth-child(3) { left: 108px; top: 10px; width: 26px; height: 26px; color: #ec4899; animation-delay: .8s; }
@keyframes ml-pulse { 0%, 100% { opacity: .35; transform: scale(.96); } 50% { opacity: 1; transform: scale(1); } }
.ml-busy { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: rgba(4,6,10,.72); backdrop-filter: blur(2px); color: #fff; font-weight: 700; z-index: 3; }
.ml-busy i { width: 46px; height: 46px; border-radius: 50%; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--stripe);
  animation: ml-spin .8s linear infinite; }
@keyframes ml-spin { to { transform: rotate(360deg); } }
.ml-busy[hidden] { display: none; }
.ml-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 0 4px; }
.ml-toolbar .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }

.ml-timeline { padding: 6px 4px 0; }
.ml-timeline.hidden { display: none; }
.ml-tl-bars { display: flex; align-items: flex-end; gap: 2px; height: 46px; cursor: pointer; }
.ml-tl-bars i { flex: 1; min-width: 2px; border-radius: 2px 2px 0 0; background: color-mix(in srgb, var(--stripe) 55%, transparent); transition: background .1s; }
.ml-tl-bars i:hover { background: var(--stripe); }
.ml-tl-bars i.on { background: #facc15; }
.ml-tl-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 3px; }

.ml-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ml-kpis div { padding: 9px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.ml-kpis b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; }
.ml-kpis small { font-size: 11px; color: var(--muted); }
.ml-summary { display: flex; flex-direction: column; gap: 8px; }
.ml-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.ml-cls { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; cursor: pointer; font: inherit;
  font-size: 12.5px; font-weight: 700; color: var(--text); border: 1px solid color-mix(in srgb, var(--c) 50%, transparent);
  background: color-mix(in srgb, var(--c) 14%, transparent); }
.ml-cls i { width: 9px; height: 9px; border-radius: 3px; background: var(--c); }
.ml-cls b { font-variant-numeric: tabular-nums; }
.ml-cls.off { opacity: .4; text-decoration: line-through; }
.ml-tip { margin: 4px 0 0; font-size: 13px; line-height: 1.45; padding: 10px 12px; border-radius: 10px; background: var(--panel-2);
  border-left: 3px solid #f59e0b; }
.ml-list { display: flex; flex-direction: column; gap: 4px; max-height: 46vh; overflow: auto; }
.ml-item { display: grid; grid-template-columns: 10px minmax(0, 1fr) 70px 38px; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: 8px; font-size: 13px; cursor: default; }
.ml-item:hover { background: var(--panel-2); }
.ml-item > i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.ml-item span b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-item span small { display: block; font-size: 11px; color: var(--muted); }
.ml-confbar { height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; }
.ml-confbar em { display: block; height: 100%; background: var(--c); }
.ml-pct { text-align: right; font-variant-numeric: tabular-nums; }
.ml-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 6px; }
.ml-table th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 700; padding: 4px 4px; border-bottom: 1px solid var(--line); }
.ml-table td { padding: 5px 4px; border-bottom: 1px solid var(--line); }
.ml-pbar { display: inline-block; width: 46px; height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; margin-right: 6px; vertical-align: middle; }
.ml-pbar i { display: block; height: 100%; background: var(--stripe); }

.ml-roadmap { grid-column: 1 / -1; max-width: 760px; margin: 10px auto; padding: 34px 38px; text-align: left; }
.ml-rm-icon { font-size: 40px; }
.ml-rm-tag { display: inline-block; margin-top: 8px; font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  color: var(--stripe); }
.ml-roadmap h3 { margin: 4px 0 6px; font-size: 24px; }
.ml-roadmap ul { margin: 16px 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; line-height: 1.5; }
.ml-page[data-page="roadmap"] { display: block; }
.ml-page[data-page="roadmap"].hidden { display: none; }
/* aba Machine Learning: nome curto quando o topo fica apertado */
.tab .tab-short { display: none; }
@media (max-width: 1840px) { .tab .tab-long { display: none; } .tab .tab-short { display: inline; } }
.ml-stage-wrap:has(.ml-timeline:not(.hidden)) .ml-stage { height: min(58vh, 560px); }
/* Machine Learning: o seletor de câmera cabe na coluna (antes vazava e cortava a tela pela esquerda) */
#view-ml { overflow-x: hidden; }
.ml-page > * { min-width: 0; }
.ml-side .ncp { display: block; min-width: 0; width: 100%; }
.ml-side .ncp .ncp-count { display: none; }
.ml-side .ncp-pop { min-width: 0; width: max(100%, 300px); }
.ml-side select { max-width: 100%; }
.ml-side { overflow-x: clip; overflow-y: visible; }
.ml-side .ncp-pop { width: 100%; }
/* topo: abas mais justas em telas até 1750 px (todas cabem, inclusive Eventos e Gestão) */
@media (max-width: 1750px) { nav .tab { padding: 8px 9px; } nav { gap: 2px; } }
@media (max-width: 1640px) { nav .tab svg { display: none; } }

/* ======================= Machine Learning — fases 2 e 3 (v0.6.0) ======================= */
.ml-run-dot { width: 8px; height: 8px; border-radius: 50%; background: #3b82f6; box-shadow: 0 0 0 0 #3b82f6; animation: ml-ping 1.6s infinite; }
@keyframes ml-ping { 0% { box-shadow: 0 0 0 0 rgba(59,130,246,.6); } 70% { box-shadow: 0 0 0 7px rgba(59,130,246,0); } 100% { box-shadow: 0 0 0 0 rgba(59,130,246,0); } }
.ml-model-sel, .ml-side select, .ml-train-form select, .ml-train-form input:not([type=radio]), .ml-dlg select, .ml-dlg input:not([type=checkbox]):not([type=color]), .ml-ed-actions select {
  width: 100%; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 13.5px; }
#ml-scope.disabled { opacity: .4; pointer-events: none; }
.ml-mini-bar { display: block; height: 5px; border-radius: 4px; background: var(--line); overflow: hidden; }
.ml-mini-bar.big { height: 8px; }
.ml-mini-bar i { display: block; height: 100%; border-radius: 4px; background: var(--c, var(--stripe)); transition: width .4s; }
.ml-spin { display: inline-block; width: 13px; height: 13px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); border-top-color: currentColor;
  animation: ml-spin .7s linear infinite; vertical-align: -2px; }
.ml-tip { font-size: 13px; line-height: 1.45; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border-left: 3px solid #f59e0b; margin: 0; }
kbd { display: inline-block; min-width: 16px; padding: 0 4px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel-2);
  font: 700 10.5px/16px ui-monospace, monospace; text-align: center; color: var(--muted); }

/* --- conjuntos --- */
.ml-page-data { grid-template-columns: 270px minmax(0, 1fr); }
.ml-ds-list { padding: 14px; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 10px; max-height: calc(100vh - 160px); overflow: auto; }
.ml-ds-list-head { display: flex; align-items: center; justify-content: space-between; }
.ml-ds-list-head h4 { margin: 0; font-size: 11.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.ml-ds-items { display: flex; flex-direction: column; gap: 8px; }
.ml-ds-item { display: flex; flex-direction: column; gap: 5px; text-align: left; padding: 11px 12px; border-radius: 11px; cursor: pointer; font: inherit;
  color: var(--text); background: var(--panel-2); border: 1px solid var(--line); transition: .12s; }
.ml-ds-item:hover { border-color: color-mix(in srgb, var(--stripe) 50%, var(--line)); }
.ml-ds-item.active { border-color: var(--stripe); box-shadow: inset 3px 0 0 var(--stripe); }
.ml-ds-item b { font-size: 14px; }
.ml-ds-item small { color: var(--muted); font-size: 11.5px; }
.ml-ds-cls { display: flex; flex-wrap: wrap; gap: 4px; }
.ml-ds-cls i, .ml-ds-cls em { font-style: normal; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
  background: color-mix(in srgb, var(--c, #64748b) 18%, transparent); color: var(--text); border: 1px solid color-mix(in srgb, var(--c, #64748b) 45%, transparent); }
.ml-ds-job { color: var(--c) !important; font-weight: 700; }
.ml-ds-main { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.ml-ds-empty { padding: 34px 38px; max-width: 760px; }
.ml-ds-empty h3 { margin: 6px 0; font-size: 22px; }
.ml-howto { line-height: 1.7; margin: 14px 0 20px; padding-left: 20px; }
.ml-ds-detail { display: flex; flex-direction: column; gap: 12px; }
.ml-ds-detail.hidden, .ml-ds-empty.hidden { display: none; }
.ml-ds-head { padding: 14px 18px; display: flex; flex-direction: column; gap: 12px; }
.ml-ds-title { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.ml-ds-title h3 { margin: 0; font-size: 20px; }
.ml-ds-stats { display: grid; grid-template-columns: repeat(4, minmax(80px, auto)) minmax(200px, 1fr); gap: 10px; align-items: center; }
.ml-ds-stats > div:not(.ml-ds-stbar) { padding: 8px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.ml-ds-stats b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.ml-ds-stats small { font-size: 11.5px; color: var(--muted); }
.ml-ds-stbar { display: flex; flex-direction: column; gap: 6px; }
.ml-ds-classes { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.ml-cls-card { position: relative; padding: 9px 12px 9px 40px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--c) 45%, var(--line));
  background: color-mix(in srgb, var(--c) 8%, var(--panel)); display: flex; flex-direction: column; gap: 5px; }
.ml-cls-card b { font-size: 14px; }
.ml-cls-card small { font-size: 11.5px; color: var(--muted); }
.ml-cls-card .ml-mini-bar i { background: var(--c); }
.ml-cls-key { position: absolute; left: 10px; top: 10px; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center;
  background: var(--c); color: #0b0f17; font-weight: 900; font-size: 12px; }
.ml-ds-add { padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ml-ds-gallery { padding: 12px 14px; display: flex; flex-direction: column; gap: 12px; }
.ml-ds-gal-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ml-ds-gal-head .seg small { opacity: .7; margin-left: 3px; }
.ml-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ml-grid-empty { grid-column: 1 / -1; padding: 30px; text-align: center; }
.ml-thumb { position: relative; aspect-ratio: 16 / 10; padding: 0; border-radius: 9px; overflow: hidden; cursor: pointer; background: #0b0f17;
  border: 2px solid transparent; transition: transform .1s, border-color .1s; }
.ml-thumb:hover { transform: translateY(-2px); border-color: var(--stripe); }
.ml-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ml-thumb.st-descartado img { opacity: .35; filter: grayscale(1); }
.ml-th-st { position: absolute; right: 6px; bottom: 6px; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 800; color: #fff;
  background: rgba(0,0,0,.65); }
.ml-thumb.st-marcado .ml-th-st { background: #16a34a; }
.ml-thumb.st-novo .ml-th-st { background: #f59e0b; color: #1a1205; }
.ml-th-src { position: absolute; left: 6px; top: 5px; font-size: 13px; filter: drop-shadow(0 1px 2px #000); }
.ml-th-val { position: absolute; right: 6px; top: 6px; padding: 0 5px; border-radius: 5px; font-size: 10px; font-weight: 800; background: #3b82f6; color: #fff; }
.ml-more { align-self: center; }

/* --- diálogo --- */
dialog.ml-dlg { width: min(560px, 94vw); padding: 0; border-radius: 16px; border: 1px solid var(--line); }
dialog.ml-dlg.wide { width: min(760px, 96vw); }
dialog.ml-dlg::backdrop { background: rgba(4,6,10,.62); backdrop-filter: blur(3px); }
.ml-dlg form { padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; }
.ml-dlg h3 { margin: 0 0 2px; font-size: 18px; }
.ml-dlg p { margin: 0; }
.ml-dlg .ml-field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
.ml-dlg-actions { display: flex; gap: 8px; margin-top: 8px; }
.ml-dlg-busy { font-size: 12.5px; color: var(--muted); }
.ml-cls-rows { display: flex; flex-direction: column; gap: 6px; }
.ml-cls-row { display: grid; grid-template-columns: 38px 1fr auto; gap: 6px; align-items: center; }
.ml-cls-row input[type=color] { width: 38px; height: 34px; padding: 2px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; }
.ml-upbar { height: 8px; border-radius: 6px; background: var(--line); overflow: hidden; }
.ml-upbar i { display: block; height: 100%; width: 0; background: var(--stripe); transition: width .2s; }
.ml-tr-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }

/* --- editor de marcação (tela cheia) --- */
body.ml-editing { overflow: hidden; }
.ml-editor { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; background: #07090d; color: #e5e7eb; }
.ml-editor[hidden] { display: none; }
.ml-ed-top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid #1f2633; background: #0c1018; }
.ml-ed-pos { font-weight: 800; font-variant-numeric: tabular-nums; padding: 2px 9px; border-radius: 7px; background: #1a2130; }
.ml-ed-ref { max-width: 40vw; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ml-ed-saved { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 7px; background: #1a2130; }
.ml-ed-saved.st-marcado { color: #22c55e; } .ml-ed-saved.st-novo { color: #f59e0b; } .ml-ed-saved.st-descartado { color: #94a3b8; }
.ml-ed-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 230px minmax(0, 1fr) 270px; }
.ml-ed-side { padding: 14px; display: flex; flex-direction: column; gap: 8px; overflow: auto; background: #0c1018; border-right: 1px solid #1f2633; }
.ml-ed-actions { border-right: 0; border-left: 1px solid #1f2633; }
.ml-ed-side h4 { margin: 8px 0 2px; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: #94a3b8; }
.ml-ed-side h4:first-child { margin-top: 0; }
.ml-ed-side h4 small { text-transform: none; letter-spacing: 0; }
.ml-ed-side .btn { justify-content: flex-start; text-align: left; display: flex; align-items: center; gap: 8px; }
.ml-ed-side .btn kbd { margin-left: auto; }
.ml-ed-classes { display: flex; flex-direction: column; gap: 5px; }
.ml-ed-cls { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px; border: 1px solid #1f2633; background: #111722;
  color: #e5e7eb; font: inherit; font-weight: 700; cursor: pointer; text-align: left; }
.ml-ed-cls i { width: 12px; height: 12px; border-radius: 4px; background: var(--c); }
.ml-ed-cls.active { border-color: var(--c); background: color-mix(in srgb, var(--c) 18%, #111722); box-shadow: 0 0 0 1px var(--c) inset; }
.ml-ed-boxes { display: flex; flex-direction: column; gap: 4px; }
.ml-ed-box { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 7px; font-size: 13px; cursor: pointer; }
.ml-ed-box:hover, .ml-ed-box.sel { background: #161d2b; }
.ml-ed-box i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.ml-ed-box button { margin-left: auto; border: 0; background: none; color: #94a3b8; cursor: pointer; }
.ml-ed-box button:hover { color: #ef4444; }
.ml-ed-stage { position: relative; min-width: 0; min-height: 0; background: radial-gradient(ellipse at center, #121722 0%, #05070a 100%); }
.ml-ed-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; user-select: none; pointer-events: none; }
.ml-ed-stage canvas { position: absolute; inset: 0; cursor: crosshair; }
.ml-ed-sug { display: flex; flex-direction: column; gap: 6px; }
.ml-ed-help { margin-top: auto; display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: #94a3b8; line-height: 1.4;
  padding: 10px 12px; border-radius: 10px; background: #111722; }
.ml-ed-help b { color: #e5e7eb; }

/* --- treinar --- */
.ml-page-train { grid-template-columns: 380px minmax(0, 1fr); }
.ml-train-left { display: flex; flex-direction: column; gap: 12px; }
.ml-trainer-st { padding: 12px 14px; display: flex; flex-direction: column; gap: 5px; border-left: 4px solid #64748b; }
.ml-trainer-st b { font-size: 14px; }
.ml-trainer-st small { font-size: 12px; color: var(--muted); line-height: 1.45; }
.ml-trainer-st.on { border-left-color: #22c55e; } .ml-trainer-st.on > b { color: #22c55e; }
.ml-trainer-st.warn { border-left-color: #f59e0b; } .ml-trainer-st.warn > b { color: #f59e0b; }
.ml-trainer-st.off { border-left-color: #ef4444; } .ml-trainer-st.off > b { color: #ef4444; }
.ml-trainer-st code { display: block; font-size: 11.5px; padding: 8px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line);
  word-break: break-all; user-select: all; }
.ml-train-form { padding: 14px 16px; display: flex; flex-direction: column; gap: 9px; }
.ml-train-form h4 { margin: 0; font-size: 11.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.ml-train-form .ml-field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
.ml-tr-go { padding: 11px; font-size: 15px; font-weight: 800; margin-top: 4px; }
.ml-bases { display: flex; flex-direction: column; gap: 6px; }
.ml-base { display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; }
.ml-base:has(input:checked) { border-color: var(--stripe); background: color-mix(in srgb, var(--stripe) 9%, transparent); }
.ml-base input { margin-top: 3px; accent-color: var(--stripe); }
.ml-base b { display: block; font-size: 13.5px; }
.ml-base small { font-size: 11.5px; color: var(--muted); }
.ml-ready-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.ml-ready-list > div { display: grid; grid-template-columns: 110px 1fr 40px; gap: 8px; align-items: center; font-size: 13px; }
.ml-ready-list span i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; background: var(--c); margin-right: 6px; }
.ml-ready-list .ml-mini-bar i { background: var(--c); }
.ml-ready-list b { text-align: right; font-variant-numeric: tabular-nums; }
.ml-ready-list b.low { color: #f59e0b; } .ml-ready-list b.ok { color: #22c55e; }
.ml-jobs { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.ml-jobs h4 { margin: 0; font-size: 11.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.ml-jobs-empty { text-align: center; padding: 40px 20px; }
.ml-job { border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; display: flex; flex-direction: column; gap: 7px; background: var(--panel-2); }
.ml-job.open { border-color: color-mix(in srgb, var(--stripe) 50%, var(--line)); }
.ml-job-head { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.ml-job-head b { font-size: 14.5px; }
.ml-job-st { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 800; color: var(--c); padding: 2px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--c) 14%, transparent); white-space: nowrap; }
.ml-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--c); animation: ml-ping 1.4s infinite; }
.ml-job-score { font-size: 18px; font-weight: 900; color: #22c55e; font-variant-numeric: tabular-nums; }
.ml-job-chev { color: var(--muted); transition: transform .15s; }
.ml-job.open .ml-job-chev { transform: rotate(180deg); }
.ml-job-prog { display: flex; flex-direction: column; gap: 5px; }
.ml-job-prog small { font-size: 12px; color: var(--muted); }
.ml-job-err { margin: 0; font-size: 13px; color: #fca5a5; background: rgba(239,68,68,.1); border-left: 3px solid #ef4444; padding: 8px 10px; border-radius: 8px; }
.ml-job-detail:empty { display: none; }
.ml-job-detail { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; border-top: 1px solid var(--line); }
.ml-job-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ml-job-kpis div { padding: 9px 11px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.ml-job-kpis b { display: block; font-size: 20px; }
.ml-job-kpis small { font-size: 11px; color: var(--muted); line-height: 1.3; display: block; }
.ml-cls-table td, .ml-cls-table th { padding: 6px 6px; }
.ml-verdict { font-size: 12px; font-weight: 800; color: var(--c); }
.ml-an-tag { font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.ml-job-chart { min-height: 190px; }
.ml-job-chart .chart-svg { width: 100%; height: auto; max-height: 240px; }
.ml-job-chart .legend.legend-row { flex-direction: row; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.ml-job .chart { display: block; }
.ml-job-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.ml-log { width: 100%; }
.ml-log summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.ml-log pre { max-height: 260px; overflow: auto; font-size: 11px; line-height: 1.45; padding: 10px; border-radius: 8px; background: #05070a; color: #cbd5e1;
  white-space: pre-wrap; word-break: break-all; }
@media (max-width: 1100px) { .ml-page-train, .ml-page-data { grid-template-columns: 1fr; } .ml-ds-list { position: static; max-height: none; }
  .ml-ed-body { grid-template-columns: 190px minmax(0, 1fr) 220px; } .ml-ds-stats { grid-template-columns: repeat(2, 1fr); } }
/* modelo base: rádio à esquerda, texto alinhado (o estilo geral de <label> é em coluna) */
.ml-train-form label.ml-base { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; text-align: left; font-size: 13px; color: var(--text); }
.ml-train-form label.ml-base input[type=radio] { width: 16px; height: 16px; flex: none; margin: 2px 0 0; padding: 0; }
.ml-train-form label.ml-base span { flex: 1; min-width: 0; }
.ml-dlg .ml-field small { display: inline; }

/* ======================= Studio IA — marcar, treinar e testar numa tela só (v0.7.0) ======================= */
#view-ml { display: flex; flex-direction: column; gap: 12px; }
.st-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 16px; border-radius: 14px; background: var(--panel);
  border: 1px solid var(--line); }
.st-proj small { display: block; font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.st-proj-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.st-ds-sel { min-width: 240px; max-width: 360px; font-size: 15px; font-weight: 700; padding: 7px 10px; border-radius: 9px; }
.st-journey { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.st-journey button { display: flex; align-items: center; gap: 9px; padding: 6px 12px 6px 6px; border-radius: 12px; cursor: pointer; font: inherit;
  text-align: left; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); transition: .12s; min-width: 150px; }
.st-journey button:hover { border-color: var(--stripe); }
.st-journey button.cur { border-color: var(--stripe); box-shadow: inset 0 0 0 1px var(--stripe); }
.st-journey b { display: block; font-size: 13px; }
.st-journey small { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.st-j-n { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 900; font-size: 13px;
  background: var(--line); color: var(--muted); }
.st-journey .ok .st-j-n { background: #16a34a; color: #fff; }
.st-journey .run .st-j-n { background: color-mix(in srgb, #3b82f6 18%, transparent); --c: #3b82f6; }
.st-journey .run small { color: #2563eb; font-weight: 700; }

.st-next { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--panel);
  border: 1px solid color-mix(in srgb, var(--stripe) 35%, var(--line)); border-left: 4px solid var(--stripe); }
.st-next[hidden] { display: none; }
.st-next p { margin: 0; flex: 1; font-size: 13.5px; line-height: 1.45; }
.st-next-ic { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 900;
  background: color-mix(in srgb, var(--stripe) 14%, transparent); color: var(--stripe); --c: #3b82f6; }
.st-next.run { border-left-color: #3b82f6; }
.st-next .btn { flex: none; }

.st-welcome { max-width: 780px; margin: 20px auto; padding: 34px 40px; text-align: center; }
.st-welcome h3 { margin: 10px 0 6px; font-size: 23px; }
.st-welcome .ml-howto { text-align: left; max-width: 520px; margin: 16px auto 22px; }
.st-welcome-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.st-welcome-art { position: relative; width: 150px; height: 96px; margin: 0 auto; border-radius: 12px; background: #0b1220; }
.st-welcome-art span { position: absolute; border: 2px solid; border-radius: 3px; animation: ml-pulse 2.4s ease-in-out infinite; }
.st-welcome-art span:nth-child(1) { left: 14px; top: 22px; width: 34px; height: 60px; color: #22c55e; }
.st-welcome-art span:nth-child(2) { left: 60px; top: 44px; width: 66px; height: 38px; color: #3b82f6; animation-delay: .4s; }
.st-welcome-art span:nth-child(3) { left: 110px; top: 12px; width: 26px; height: 26px; color: #ec4899; animation-delay: .8s; }

/* grade de 3 colunas */
.st-grid { display: grid; grid-template-columns: 270px minmax(0, 1fr) 310px; gap: 12px; align-items: start; }
.st-grid > * { min-width: 0; }
.st-grid.st-focus { grid-template-columns: minmax(0, 1fr); }
.st-grid.st-focus .st-left, .st-grid.st-focus .st-right { display: none; }
.st-grid.st-nods { grid-template-columns: minmax(0, 1fr) 310px; }
.st-grid.st-nods .st-left { display: none; }
/* responde à largura da própria aba (a barra "Visão lógica" pode estar aberta ou recolhida) */
#view-ml { container-type: inline-size; container-name: studio; }
@container studio (max-width: 1240px) { .st-grid { grid-template-columns: 236px minmax(0, 1fr) 270px; } .st-grid.st-nods { grid-template-columns: minmax(0, 1fr) 270px; } }
@container studio (max-width: 1040px) {
  .st-grid, .st-grid.st-nods { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .st-center { grid-column: 1 / -1; order: -1; }
  .st-journey button { min-width: 0; }
}
@container studio (max-width: 640px) { .st-grid, .st-grid.st-nods { grid-template-columns: minmax(0, 1fr); } }
.st-left, .st-right { display: flex; flex-direction: column; gap: 12px; }
.st-card { padding: 12px 14px; display: flex; flex-direction: column; gap: 9px; }
.st-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.st-card-head h4 { margin: 0; font-size: 11.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.st-card-head h4 b { color: var(--text); letter-spacing: 0; margin-left: 4px; }
.st-link { border: 0; background: none; color: var(--stripe); font: inherit; font-size: 12.5px; font-weight: 800; cursor: pointer; padding: 2px 4px; }
.st-link:hover { text-decoration: underline; }
.st-sub { font-size: 11px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.st-flash { animation: st-flash 1.1s ease; }
@keyframes st-flash { 0%, 100% { box-shadow: none; } 30% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--stripe) 55%, transparent); } }

/* classes = paleta */
.st-classes { display: flex; flex-direction: column; gap: 6px; }
.st-cls { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; font: inherit; text-align: left;
  color: var(--text); border: 1px solid color-mix(in srgb, var(--c) 35%, var(--line)); background: color-mix(in srgb, var(--c) 6%, var(--panel)); }
.st-cls:hover { border-color: var(--c); }
.st-cls.active { border-color: var(--c); background: color-mix(in srgb, var(--c) 16%, var(--panel)); box-shadow: inset 0 0 0 1px var(--c); }
.st-cls-key { flex: none; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; background: var(--c); color: #0b0f17;
  font-weight: 900; font-size: 12.5px; }
.st-cls-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.st-cls-txt b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-cls-txt small { font-size: 11.5px; color: var(--muted); }
.st-cls .ml-mini-bar i { background: var(--c); }

/* imagens */
.st-images { position: relative; overflow: visible; }
.st-images.over { outline: 2px dashed var(--stripe); outline-offset: -4px; background: color-mix(in srgb, var(--stripe) 6%, var(--panel)); }
.st-add { position: static; }
.st-images > .st-card-head { position: relative; }
.st-add-menu { position: absolute; left: -6px; right: -6px; top: calc(100% + 6px); z-index: 30; padding: 6px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 14px 40px rgba(0,16,48,.28); display: flex; flex-direction: column; gap: 2px; }
.st-add-menu[hidden] { display: none; }
.st-add-menu button { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border-radius: 8px; border: 0; background: none; cursor: pointer;
  font: inherit; text-align: left; color: var(--text); }
.st-add-menu button:hover { background: var(--panel-2); }
.st-add-menu b { font-size: 13.5px; }
.st-add-menu small { font-size: 11.5px; color: var(--muted); }
.st-filter { display: flex; width: 100%; }
.st-filter button { flex: 1; justify-content: center; font-size: 12px; padding: 5px 6px; }
.st-filter small { opacity: .75; }
.st-thumbs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; max-height: calc(100vh - 520px); min-height: 160px; overflow: auto;
  align-content: start; padding: 2px; }
.st-th { position: relative; aspect-ratio: 16 / 10; padding: 0; border-radius: 8px; overflow: hidden; cursor: pointer; background: #0b0f17;
  border: 2px solid transparent; transition: border-color .1s; }
.st-th:hover { border-color: color-mix(in srgb, var(--stripe) 60%, transparent); }
.st-th.cur { border-color: var(--stripe); box-shadow: 0 0 0 2px color-mix(in srgb, var(--stripe) 35%, transparent); }
.st-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.st-th.st-descartado img { opacity: .35; filter: grayscale(1); }
.st-th-st { position: absolute; right: 4px; bottom: 4px; padding: 0 6px; border-radius: 5px; font-size: 10.5px; font-weight: 800; color: #fff;
  background: rgba(0,0,0,.65); }
.st-th.st-marcado .st-th-st { background: #16a34a; }
.st-th.st-novo .st-th-st { background: #f59e0b; color: #1a1205; }
.st-th-src { position: absolute; left: 4px; top: 3px; font-size: 12px; filter: drop-shadow(0 1px 2px #000); }
.st-th-val { position: absolute; right: 4px; top: 4px; padding: 0 4px; border-radius: 4px; font-size: 9.5px; font-weight: 800; background: #3b82f6; color: #fff; }
.st-th-empty { grid-column: 1 / -1; text-align: center; padding: 26px 8px; line-height: 1.5; }
.st-more { align-self: center; }
.st-drop-hint { text-align: center; font-size: 11.5px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 8px; }

/* centro */
.st-center { padding: 10px; display: flex; flex-direction: column; gap: 8px; position: relative; }
.st-center-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-right: 38px; }
.st-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.st-sep { width: 1px; height: 22px; background: var(--line); margin: 0 2px; }
.st-sug-model { max-width: 160px; padding: 5px 6px; font-size: 12.5px; border-radius: 7px; }
.st-filter button { white-space: nowrap; padding: 5px 4px; gap: 4px; }
.st-mode button { min-width: 78px; justify-content: center; font-weight: 800; }
.st-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; padding: 6px 8px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line); }
.st-tools.hidden { display: none; }
.st-tools .btn kbd { margin-left: 4px; }
.st-tools .btn.primary kbd { background: rgba(255,255,255,.18); color: #fff; border-color: rgba(255,255,255,.35); }
.st-sug-wrap { display: inline-flex; align-items: center; gap: 4px; }
.st-sug-wrap select { max-width: 170px; padding: 5px 6px; font-size: 12.5px; border-radius: 7px; }
.st-pos { font-variant-numeric: tabular-nums; font-size: 13px; padding: 0 4px; white-space: nowrap; }
.st-focus-btn { position: absolute; right: 10px; top: 10px; }
.st-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.st-inline select { padding: 5px 6px; font-size: 12.5px; border-radius: 7px; max-width: 260px; }
#st-tools-test #ml-conf { width: 90px; }
#st-tools-test .ml-seg { flex: none; }
#st-tools-test .ml-seg button { flex: none; font-size: 12px; padding: 5px 8px; }
.st-file-btn { cursor: pointer; }
.st-cam { display: inline-flex; align-items: center; gap: 4px; }
.st-cam select { max-width: 190px; padding: 5px 6px; font-size: 12.5px; border-radius: 7px; }
.st-cam .ncp { min-width: 0; width: 190px; }
.st-cam .ncp .ncp-count { display: none; }

.st-mark, .st-test { display: flex; flex-direction: column; gap: 8px; }
.st-mark .ml-ed-stage, .st-test .ml-stage { height: max(360px, calc(100vh - 440px)); min-height: 360px; border-radius: 12px; overflow: hidden; }
.st-grid.st-focus .ml-ed-stage, .st-grid.st-focus .ml-stage { height: max(420px, calc(100vh - 330px)); }
.st-test:has(.ml-timeline:not(.hidden)) .ml-stage { height: max(340px, calc(100vh - 450px)); }
.st-img-ref { position: absolute; left: 10px; bottom: 10px; z-index: 2; max-width: 70%; padding: 3px 9px; border-radius: 7px; font-size: 12px;
  background: rgba(0,0,0,.6); color: #e5e7eb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.st-img-ref:empty { display: none; }
.st-mark .ml-ed-saved { position: absolute; right: 10px; top: 10px; z-index: 2; background: rgba(0,0,0,.6); pointer-events: none; }
.st-mark .ml-ed-saved:empty { display: none; }
.st-stage-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-align: center; padding: 30px; color: #cbd5e1; z-index: 1; }
.st-stage-empty[hidden] { display: none; }
.st-stage-empty > b { font-size: 17px; color: #fff; }
.st-stage-empty p b { color: #e5e7eb; }
.st-stage-empty p { margin: 0; max-width: 420px; color: #94a3b8; font-size: 13.5px; line-height: 1.5; }
.st-sugbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 10px; border-radius: 10px;
  background: color-mix(in srgb, #a855f7 8%, var(--panel-2)); border: 1px solid color-mix(in srgb, #a855f7 30%, var(--line)); }
.st-sugbar[hidden] { display: none; }
.st-boxes { display: flex; flex-wrap: wrap; gap: 5px; min-height: 26px; max-height: 62px; overflow: auto; align-items: center; align-content: flex-start; }
.st-boxes .ml-ed-box { padding: 1px 4px 1px 8px; gap: 6px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--c) 50%, var(--line));
  background: color-mix(in srgb, var(--c) 10%, var(--panel)); font-weight: 700; font-size: 12px; }
.st-boxes .ml-ed-box:hover, .st-boxes .ml-ed-box.sel { background: color-mix(in srgb, var(--c) 24%, var(--panel)); box-shadow: inset 0 0 0 1px var(--c); }
.st-boxes .ml-ed-box button { margin-left: 2px; color: var(--muted); }
.st-help { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.st-help b { color: var(--text); }
.st-test-foot { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.st-summary { flex: 1; min-width: 260px; }
.st-summary .ml-kpis { grid-template-columns: repeat(3, minmax(90px, 140px)); }
.st-test-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#st-correct:not(:disabled) { box-shadow: 0 0 0 3px color-mix(in srgb, var(--stripe) 22%, transparent); }
.st-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-test-list summary { cursor: pointer; font-size: 12.5px; color: var(--muted); font-weight: 700; }
.st-test-list .ml-list { max-height: 260px; margin-top: 6px; }

/* direita: treinar */
.st-chip { font-size: 11.5px; font-weight: 800; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.st-chip.ok { color: #15803d; background: color-mix(in srgb, #22c55e 16%, transparent); }
.st-chip.warn { color: #b45309; background: color-mix(in srgb, #f59e0b 18%, transparent); }
.st-chip.off { color: #b91c1c; background: color-mix(in srgb, #ef4444 14%, transparent); }
.st-off { display: flex; flex-direction: column; gap: 5px; padding: 8px 10px; border-radius: 9px; background: color-mix(in srgb, #ef4444 6%, var(--panel-2));
  border-left: 3px solid #ef4444; }
.st-off small { font-size: 12px; line-height: 1.4; color: var(--muted); }
.st-off code, .st-code { display: block; font-size: 11px; padding: 6px 8px; border-radius: 7px; background: var(--panel); border: 1px solid var(--line);
  word-break: break-all; user-select: all; }
.st-ready { display: flex; flex-direction: column; gap: 6px; }
.st-ready > div { display: grid; grid-template-columns: minmax(0, 1fr) 70px 36px; gap: 8px; align-items: center; font-size: 13px; }
.st-ready span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-ready span i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; background: var(--c); margin-right: 6px; }
.st-ready .ml-mini-bar i { background: var(--c); }
.st-ready b { text-align: right; font-variant-numeric: tabular-nums; }
.st-ready b.low { color: #d97706; } .st-ready b.ok { color: #16a34a; }
.st-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.st-presets button { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 4px; border-radius: 9px; cursor: pointer; font: inherit;
  color: var(--text); background: var(--panel-2); border: 1px solid var(--line); }
.st-presets button b { font-size: 13px; }
.st-presets button small { font-size: 10.5px; color: var(--muted); text-align: center; line-height: 1.3; }
.st-presets button.active { border-color: var(--stripe); background: color-mix(in srgb, var(--stripe) 10%, var(--panel)); box-shadow: inset 0 0 0 1px var(--stripe); }
.st-go { padding: 10px; font-size: 15px; font-weight: 800; }
.st-go-sub { font-size: 12px; line-height: 1.45; }
.st-adv summary { cursor: pointer; font-size: 12.5px; color: var(--muted); font-weight: 700; }
.st-adv[open] { display: flex; flex-direction: column; gap: 8px; }
.st-adv[open] summary { margin-bottom: 2px; }
.st-adv select, .st-adv input { width: 100%; padding: 6px 8px; border-radius: 8px; font-size: 13px; }
.st-adv .ml-tr-row { grid-template-columns: repeat(3, 1fr); gap: 6px; }
.st-score { display: flex; align-items: baseline; gap: 10px; }
.st-score b { font-size: 34px; font-weight: 900; color: #16a34a; font-variant-numeric: tabular-nums; line-height: 1; }
.st-score small { font-size: 12px; color: var(--muted); }
.st-mini-chart { min-height: 90px; }
.st-mini-chart .chart-svg { width: 100%; height: auto; max-height: 110px; }
.st-mini-chart ul.legend { display: none !important; }
.st-train .st-mini-chart { display: block; }
.st-train .btn.danger { align-self: flex-start; }

/* versões */
.st-vers { display: flex; flex-direction: column; gap: 5px; max-height: 260px; overflow: auto; }
.st-ver { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; font: inherit; text-align: left;
  color: var(--text); background: var(--panel-2); border: 1px solid var(--line); }
.st-ver:hover { border-color: var(--stripe); }
.st-ver.testing { border-color: #a855f7; box-shadow: inset 3px 0 0 #a855f7; }
.st-ver > span:first-child { flex: 1; min-width: 0; }
.st-ver b { font-size: 13.5px; }
.st-ver em { font-style: normal; font-size: 10.5px; font-weight: 800; margin-left: 6px; padding: 1px 6px; border-radius: 999px; color: #15803d;
  background: color-mix(in srgb, #22c55e 15%, transparent); }
.st-ver small { display: block; font-size: 11.5px; color: var(--muted); }
.st-ver-score { font-size: 17px; font-weight: 900; color: #16a34a; font-variant-numeric: tabular-nums; --c: #3b82f6; }
.st-v-erro .st-ver-score, .st-v-cancelado .st-ver-score { color: var(--muted); }
.st-v-erro small { color: #dc2626; }
.st-percls { display: flex; flex-direction: column; gap: 4px; }
.st-percls > div { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; font-size: 13px; }
.st-percls span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.st-percls small { color: var(--muted); font-size: 11.5px; }
.st-ver-test { align-self: stretch; }
.st-testdrop { display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; padding: 16px 12px; cursor: pointer;
  border: 2px dashed color-mix(in srgb, var(--stripe) 40%, var(--line)); border-radius: 14px; transition: .15s; }
.st-testdrop svg { width: 28px; height: 28px; color: var(--stripe); }
.st-testdrop b { font-size: 13.5px; }
.st-testdrop small { font-size: 11.5px; color: var(--muted); }
.st-testdrop:hover, .st-testdrop.over { border-color: var(--stripe); background: color-mix(in srgb, var(--stripe) 7%, var(--panel)); }

/* aba com bolinha enquanto treina */
.tab[data-view="ml"].st-busy { position: relative; }
.tab[data-view="ml"].st-busy::after { content: ""; position: absolute; right: 4px; top: 5px; width: 7px; height: 7px; border-radius: 50%;
  background: #3b82f6; animation: ml-ping 1.6s infinite; }
.st-upl { display: flex; flex-direction: column; gap: 5px; padding: 8px 10px; border-radius: 9px; font-size: 12.5px;
  background: color-mix(in srgb, var(--stripe) 7%, var(--panel-2)); border: 1px solid color-mix(in srgb, var(--stripe) 30%, var(--line)); }
.st-upl[hidden] { display: none; }
.st-upl .ml-mini-bar i { background: var(--stripe); transition: width .2s; }

/* ======================= Studio IA — etapas uma embaixo da outra (v0.8.2) ======================= */
.st-flow { display: flex; flex-direction: column; gap: 10px; }
.st-flow.st-nods .st-step:not([data-step="5"]) { display: none; }
.st-step { padding: 0; overflow: visible; border-left: 4px solid var(--line); transition: border-color .15s; }
.st-step.open { border-left-color: var(--stripe); }
.st-step.done:not(.open) { border-left-color: #16a34a; }
.st-step-head { width: 100%; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto 22px; align-items: center; gap: 14px;
  padding: 12px 16px; border: 0; background: none; cursor: pointer; font: inherit; color: var(--text); text-align: left; }
.st-step-head:hover { background: color-mix(in srgb, var(--stripe) 5%, transparent); }
.st-step-n { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 900; font-size: 16px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.st-step.open .st-step-n { background: var(--stripe); border-color: var(--stripe); color: #fff; }
.st-step.done .st-step-n { background: #16a34a; border-color: #16a34a; color: #fff; }
.st-step-t b { display: block; font-size: 15.5px; }
.st-step-t small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.st-step-st { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); text-align: right; flex-wrap: wrap; justify-content: flex-end; }
.st-step-st b { color: var(--text); }
.st-step.done .st-step-st > span { color: #16a34a; font-weight: 700; }
.st-step-st .ml-pulse { --c: #3b82f6; margin-right: 4px; }
.st-dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; background: var(--c); margin: 0 4px 0 8px; }
.st-now { font-style: normal; font-size: 11px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; padding: 3px 9px; border-radius: 999px;
  color: #fff; background: var(--stripe); animation: st-now 1.8s ease-in-out infinite; }
@keyframes st-now { 50% { opacity: .55; } }
.st-step.rec { border-left-color: color-mix(in srgb, var(--stripe) 55%, var(--line)); }
.st-step-chev { color: var(--muted); transition: transform .15s; text-align: center; }
.st-step.open .st-step-chev { transform: rotate(180deg); }
.st-step-body { display: none; padding: 4px 16px 16px 68px; flex-direction: column; gap: 12px; }
.st-step.open .st-step-body { display: flex; }
.st-step-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.st-step-foot { display: flex; justify-content: flex-end; border-top: 1px dashed var(--line); padding-top: 12px; }
@media (max-width: 900px) { .st-step-body { padding-left: 16px; } .st-step-head { grid-template-columns: 34px minmax(0, 1fr) 20px; }
  .st-step-st { grid-column: 2 / 3; justify-content: flex-start; text-align: left; } }

/* 1 · classes em linha */
.st-classes-row { flex-direction: row; flex-wrap: wrap; }
.st-classes-row .st-cls { width: 250px; }

/* 2 · fontes de imagem sempre visíveis */
.st-sources { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.st-sources button { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 12px 14px; border-radius: 12px; cursor: pointer;
  font: inherit; text-align: left; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); transition: .12s; }
.st-sources button:hover:not(:disabled) { border-color: var(--stripe); background: color-mix(in srgb, var(--stripe) 7%, var(--panel-2)); transform: translateY(-1px); }
.st-sources button:disabled { opacity: .5; cursor: wait; }
.st-sources span { font-size: 22px; line-height: 1; }
.st-sources b { font-size: 14px; }
.st-sources small { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.st-sources button[data-add="gravacao"] { border-color: color-mix(in srgb, var(--stripe) 45%, var(--line)); }
.st-dropzone { text-align: center; padding: 14px; border: 2px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 13px; }
#st-images.over .st-dropzone { border-color: var(--stripe); color: var(--text); background: color-mix(in srgb, var(--stripe) 7%, transparent); }
#st-images.over { outline: 0; background: none; }
.st-recent { display: flex; gap: 4px; }
.st-recent img { width: 64px; height: 40px; object-fit: cover; border-radius: 5px; background: #0b0f17; }

/* 3 · marcar: lista de imagens + editor */
.st-mark-grid { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 14px; align-items: start; }
.st-mark-grid.st-focus { grid-template-columns: minmax(0, 1fr); }
.st-mark-grid.st-focus .st-thumbcol { display: none; }
.st-thumbcol { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.st-thumbcol .st-thumbs { max-height: max(300px, calc(100vh - 420px)); }
.st-mark { min-width: 0; }
.st-step .st-mark .ml-ed-stage, .st-step .st-test .ml-stage { height: max(360px, calc(100vh - 470px)); }
.st-palette { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.st-palette > small { font-size: 12px; color: var(--muted); }
.st-pal { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 5px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px;
  font-weight: 700; color: var(--text); border: 1px solid color-mix(in srgb, var(--c) 45%, var(--line)); background: color-mix(in srgb, var(--c) 8%, var(--panel)); }
.st-pal kbd { background: var(--c); color: #0b0f17; border: 0; min-width: 20px; text-align: center; border-radius: 6px; font-weight: 900; }
.st-pal small { color: var(--muted); font-weight: 600; }
.st-pal.active { border-color: var(--c); background: color-mix(in srgb, var(--c) 20%, var(--panel)); box-shadow: inset 0 0 0 1px var(--c); }
@media (max-width: 1000px) { .st-mark-grid { grid-template-columns: minmax(0, 1fr); } }

/* 4 · treinar + versões lado a lado */
.st-train-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.st-train-grid > .st-card { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
@media (max-width: 1000px) { .st-train-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- v0.11.0: horário da regra e fotos da porta fechada ---------- */
.an-hours { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.an-hours .atp-label { width: 100%; }
.an-hours input[type="time"] { width: auto; flex: 1; min-width: 92px; }
.pa-refs { display: grid; gap: 6px; }
.pa-thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.pa-thumbs img { height: 54px; border-radius: 6px; border: 1px solid var(--line); background: #000; image-rendering: auto; }
.pa-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.cl-ref { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; font-size: 12.5px; }
.cl-ref .pa-thumbs img { height: 40px; }

/* v0.14.0 — arma detectada: situação do modelo de terceiros */
.ar-model { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); font-size: 12.5px; margin-bottom: 6px; }
.ar-model.ok { border-color: color-mix(in srgb, var(--ok) 60%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.ar-model.off { border-color: color-mix(in srgb, var(--warn) 70%, transparent); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.ar-model span { color: var(--muted); line-height: 1.4; }
.ar-model code { font-size: 12px; padding: 1px 5px; border-radius: 4px; background: var(--panel-2); }

/* v0.17.0 — lista de placas autorizadas e veículos no pátio */
.an-form textarea[name="pz_placas"] { width: 100%; resize: vertical; font: 500 13px/1.5 "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: 1px; text-transform: uppercase; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card, transparent); color: inherit; }
.tp-list { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.tp-list .lpr-chips { max-height: 160px; overflow: auto; }

/* v0.17.1 — seletor de analíticos: o cartão cresce com o texto (descrição de 3 linhas cortava os selos) */
#atp-grid { grid-auto-rows: max-content; align-content: start; align-items: stretch; }
#atp-grid .atp-card { display: flex; flex-direction: column; gap: 6px; height: auto; min-height: 178px; }
#atp-grid .atp-card em { flex: 0 0 auto; }
#atp-grid .atp-card .atp-tags { margin-top: auto; padding-top: 6px; }

/* v0.18.0 — cores do alerta por descrição e correção de vagas */
.ds-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; }
.ds-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; cursor: pointer; font-size: 12.5px;
  border: 1px solid var(--line); background: var(--panel-2); }
.ds-chip input { position: absolute; opacity: 0; pointer-events: none; }
.ds-chip i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(127,127,127,.5); }
.ds-chip:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); font-weight: 600; }
.vc-fix { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.vc-fix .atp-label { flex: 1 1 100%; }
.vc-fix input { width: 110px; }
.an-form textarea[name="pp_padroes"] { width: 100%; resize: vertical; font: 500 13px/1.5 "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: 1px; text-transform: uppercase; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--card, transparent); color: inherit; }

/* v0.23.3 — "Meus analíticos" (publicados pelo Studio IA) no seletor */
.atp-card .atp-author { font-size: 11.5px; color: var(--muted); }
.atp-card .atp-author .atp-an { color: var(--text); font-weight: 600; }
.atp-tags i.mine { color: #fff; background: var(--tc); border-color: transparent; }
.atp-tags i.off { color: #f97316; background: rgba(249,115,22,.1); border-color: rgba(249,115,22,.4); }
.atp-card[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.atp-card.atp-pub::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--tc); }

/* v0.25.0 — vídeo com marcações */
.an-clips .an-marked { flex-basis: 100%; margin-top: 4px; padding-top: 6px; border-top: 1px dashed var(--line); font-size: 12.5px; }
#an-photo-mode button[disabled] { opacity: .45; cursor: not-allowed; }
