/* History shares the case-reading vocabulary; the timeline remains visible. */
html[data-frontend="modular"] body.command-center main > #v-rastreabilidade { max-width:none; }
html[data-frontend="modular"] body.command-center main:has(> #v-rastreabilidade:not([style*="display: none"])) { padding:12px 24px 24px; }
#v-rastreabilidade .g-history { color:#163348; font-family:var(--cc-body); }
#v-rastreabilidade .g-history-toolbar { display:flex; align-items:center; gap:12px; padding:0; min-height:44px; background:transparent; border:0; box-shadow:none; color:inherit; }
#v-rastreabilidade .g-history-toolbar input { width: min(360px,40vw); min-height:44px; }
#v-rastreabilidade .g-history-count { margin:8px 0; font-size:13px; color:#526777; }
#v-rastreabilidade .g-workbench-frame { display:grid; grid-template-columns:232px minmax(0,1.3fr) minmax(280px,.9fr); gap:16px; height:calc(100dvh - 240px); min-height:360px; border:0; background:transparent; overflow:hidden; }
#v-rastreabilidade :is(.g-workbench-queue-panel,.g-workbench-main,.g-workbench-rail) { position:static; height:100%; max-height:none; min-width:0; min-height:0; border:1px solid #d3dde3; border-radius:8px; background:#fbfcfd; overflow:auto; }
#v-rastreabilidade .g-workbench-queue-body { height:100%; display:flex; flex-direction:column; min-height:0; }
#v-rastreabilidade .g-workbench-queue-header { flex-shrink:0; }
#v-rastreabilidade .g-workbench-list { min-height:0; height:100%; max-height:none; overflow:auto; display:grid; align-content:start; grid-auto-rows:max-content; gap:8px; padding:10px; background:#f1f5f7; }
#v-rastreabilidade .g-workbench-item { padding:12px; border-radius:6px; }
#v-rastreabilidade .g-workbench-item-title { white-space:normal; }
#v-rastreabilidade .g-workbench-item[aria-selected="true"] { background:#eaf1f5; border-color:#a8bac7; box-shadow:inset 3px 0 #c59539; }
#v-rastreabilidade .g-workbench-main { padding:18px 20px; display:block; }
#v-rastreabilidade .g-workbench-rail { padding:18px; display:block; }
#v-rastreabilidade .g-history-case-header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:0; background:transparent; color:inherit; border:0; box-shadow:none; }
#v-rastreabilidade .g-history-case-header h2 { margin:0; font-size:20px; }
#v-rastreabilidade .g-history-case-header span { font-size:13px; color:#526777; }
#v-rastreabilidade .g-history-case-meta { margin:6px 0 20px; font-size:13px; color:#526777; }
#v-rastreabilidade .g-history-message h3 { font-size:13px; color:#526777; margin:0 0 8px; }
#v-rastreabilidade .g-history-message > p { font-size:18px; line-height:1.5; white-space:pre-wrap; overflow-wrap:anywhere; max-width:72ch; margin:0 0 20px; }
#v-rastreabilidade .g-media-gallery { margin:0 0 18px; }
#v-rastreabilidade .g-workbench-main .g-media-gallery img { object-fit:contain; max-height:42vh; width:100%; }
#v-rastreabilidade .g-history-facts { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin:20px 0 12px; padding-top:16px; border-top:1px solid #d3dde3; }
#v-rastreabilidade .g-history-facts dt { font-size:12px; color:#526777; }
#v-rastreabilidade .g-history-facts dd { font-size:14px; margin:4px 0 0; overflow-wrap:anywhere; }
#v-rastreabilidade :is(.g-history-no-media,.g-history-source,.g-history-empty-events) { font-size:14px; color:#526777; line-height:1.5; overflow-wrap:anywhere; }
#v-rastreabilidade .g-history-source summary { cursor:pointer; min-height:32px; }
#v-rastreabilidade .g-history-timeline-header { padding:0 0 14px; color:inherit; background:transparent; border:0; box-shadow:none; }
#v-rastreabilidade .g-history-timeline-header h3 { font-size:18px; margin:0 0 4px; }
#v-rastreabilidade .g-history-timeline-header p { margin:0; color:#526777; font-size:12px; }
#v-rastreabilidade .g-history-timeline { list-style:none; padding:0; margin:16px 0 0; }
#v-rastreabilidade .g-history-event { padding:16px 0; border-top:1px solid #d3dde3; overflow-wrap:anywhere; }
#v-rastreabilidade .g-history-event > strong { font-size:15px; }
#v-rastreabilidade .g-history-event p { font-size:14px; line-height:1.5; margin:8px 0 0; white-space:pre-wrap; }
#v-rastreabilidade .g-history-event .g-history-event-meta { font-size:12px; color:#526777; }
#v-rastreabilidade .g-history-change { padding:8px 10px; background:#edf3f6; border-radius:4px; }
#v-rastreabilidade .g-history-legacy { font-size:12px; color:#526777; }
#v-rastreabilidade .g-history-filters { width:min(620px,calc(100vw - 32px)); padding:24px; border:1px solid #d3dde3; border-radius:10px; color:#163348; background:#fbfcfd; max-height:90dvh; overflow:auto; }
#v-rastreabilidade .g-history-filters::backdrop { background:rgb(17 40 56 / 45%); }
#v-rastreabilidade .g-history-filters h2 { margin:0 0 20px; font-size:22px; }
#v-rastreabilidade .g-history-filter-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
#v-rastreabilidade .g-history-field { display:grid; gap:6px; font-size:13px; min-width:0; }
#v-rastreabilidade :is(input,select) { border:1px solid #b7c8d3; border-radius:6px; background:#fbfcfd; color:#163348; padding:10px 12px; min-width:0; min-height:44px; font:inherit; }
#v-rastreabilidade .g-history-filter-actions { display:flex; justify-content:flex-end; flex-wrap:wrap; gap:8px; margin-top:16px; }
#v-rastreabilidade :is(button,input,select,summary):focus-visible { outline:3px solid #c59539; outline-offset:2px; }
@media(max-width:1100px) and (min-width:761px) {
 #v-rastreabilidade .g-workbench-frame { grid-template-columns:190px minmax(0,1fr) 260px; gap:10px; }
 #v-rastreabilidade .g-workbench-main { padding:14px; }
 #v-rastreabilidade .g-workbench-rail { padding:14px; }
}
@media(max-width:760px) {
 html[data-frontend="modular"] body.command-center main:has(> #v-rastreabilidade:not([style*="display: none"])) { padding:12px; }
 #v-rastreabilidade .g-history-toolbar { flex-wrap:wrap; }
 #v-rastreabilidade .g-history-toolbar input { order:2; width:100%; }
 #v-rastreabilidade .g-workbench-frame { display:flex; flex-direction:column; height:auto; min-height:0; overflow:visible; gap:12px; }
 #v-rastreabilidade :is(.g-workbench-queue-panel,.g-workbench-main,.g-workbench-rail) { height:auto; overflow:visible; width:100%; }
 #v-rastreabilidade .g-workbench-queue-body[hidden] { display:none; }
 #v-rastreabilidade .g-workbench-list { max-height:300px; }
 #v-rastreabilidade .g-history-filter-grid { grid-template-columns:1fr; }
}
#v-rastreabilidade .g-workbench-item-top { flex-wrap:wrap; gap:6px; }
#v-rastreabilidade .g-workbench-item-status { max-width:100%; white-space:normal; overflow:visible; text-overflow:clip; }
#v-rastreabilidade .g-workbench-item-eyebrow { white-space:nowrap; }
#v-rastreabilidade .g-workbench-main > .g-media-gallery { grid-template-columns:minmax(0,1fr); }
/* Always-visible filters and a dedicated employee drawer. */
#v-rastreabilidade .g-history-filterbar { display:flex; align-items:end; flex-wrap:wrap; gap:10px; padding:12px; margin-top:12px; border:1px solid #d3dde3; border-radius:8px; background:#f1f5f7; }
#v-rastreabilidade .g-history-filterbar .g-history-field { flex:1 1 145px; }
#v-rastreabilidade .g-history-filterbar :is(input,select,button) { min-height:42px; width:100%; min-width:0; }
#v-rastreabilidade .g-history-filterbar > button { width:auto; }
#v-rastreabilidade .g-history-date-error { flex-basis:100%; color:#9c2a25; margin:0; }
#v-rastreabilidade .g-history-filterbar ~ #g-history-results .g-workbench-frame { height:calc(100dvh - 340px); }
#v-rastreabilidade .g-history-people-drawer { position:fixed; inset:0 0 0 auto; margin:0; width:min(440px,100vw); max-width:100vw; height:100dvh; max-height:100dvh; box-sizing:border-box; padding:24px; border:0; border-left:1px solid #d3dde3; background:#fbfcfd; color:#163348; overflow:auto; }
#v-rastreabilidade .g-history-people-drawer::backdrop { background:rgb(17 40 56 / 45%); }
#v-rastreabilidade .g-history-people-heading { display:flex; align-items:start; justify-content:space-between; gap:12px; background:transparent; border:0; color:inherit; padding:0; box-shadow:none; margin-bottom:20px; }
#v-rastreabilidade .g-history-people-heading h2 { font-size:21px; margin:0 0 6px; }
#v-rastreabilidade .g-history-people-heading p { margin:0; color:#526777; }
#v-rastreabilidade .g-history-people-drawer > input { width:100%; min-height:44px; }
#v-rastreabilidade .g-history-people-summary { color:#526777; font-size:13px; line-height:1.5; }
#v-rastreabilidade .g-history-people-list { display:grid; gap:8px; }
#v-rastreabilidade .g-history-people-list button { min-height:54px; text-align:left; white-space:normal; padding:12px; }
#v-rastreabilidade .g-history-person-option { display:flex; justify-content:space-between; gap:12px; }
#v-rastreabilidade .g-history-person-option strong { overflow-wrap:anywhere; }
#v-rastreabilidade .g-history-person-option span { white-space:nowrap; font-size:13px; color:#526777; }
#v-rastreabilidade .g-history-people-list button[aria-pressed="true"] { background:#eaf1f5; border-color:#8ba2b2; box-shadow:inset 3px 0 #c59539; }
@media(max-width:760px) {
 #v-rastreabilidade .g-history-filterbar { padding:10px; }
 #v-rastreabilidade .g-history-filterbar .g-history-field { flex-basis:calc(50% - 10px); }
 #v-rastreabilidade .g-history-filterbar ~ #g-history-results .g-workbench-frame { height:auto; }
 #v-rastreabilidade .g-history-people-drawer { padding:20px; }
}

/* Hierarquia de leitura: mensagem, contexto e decisões registradas. */
#v-rastreabilidade .g-history-case-header { align-items:flex-start; flex-wrap:wrap; }
#v-rastreabilidade .g-history-case-header h2 { font-size:22px; line-height:1.3; }
#v-rastreabilidade .g-history-case-header .g-history-status { padding:5px 9px; border-radius:5px; background:#e8eef2; color:#345268; font-weight:650; line-height:1.4; }
#v-rastreabilidade .g-history-status[data-status="aberta"] { background:#fbf0d7; color:#755215; }
#v-rastreabilidade .g-history-status:is([data-status="fechada"],[data-status="conforme"]) { background:#e6f2eb; color:#286447; }
#v-rastreabilidade .g-history-status[data-status="descartada"] { background:#f6e9e7; color:#873d37; }
#v-rastreabilidade .g-history-case-meta { display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px; margin:12px 0 20px; line-height:1.5; }
#v-rastreabilidade .g-history-farm { color:#654713; background:#fbf1db; padding:5px 10px; border-radius:5px; font-size:14px; }
#v-rastreabilidade .g-history-message { background:#edf4f8; border-left:3px solid #c49434; border-radius:0 8px 8px 0; padding:14px 16px; margin-bottom:20px; }
#v-rastreabilidade .g-history-message h3 { color:#486679; margin:0 0 8px; font-size:13px; }
#v-rastreabilidade .g-history-message > p { margin:0; color:#12374f; font-size:19px; font-weight:550; line-height:1.55; }
#v-rastreabilidade .g-history-facts > div:first-child { grid-column:1 / -1; }
#v-rastreabilidade .g-history-facts dd { font-weight:600; line-height:1.5; color:#193d55; }
#v-rastreabilidade .g-history-source { margin-top:18px; padding-top:14px; border-top:1px solid #d3dde3; }
#v-rastreabilidade .g-history-source h3 { font-size:13px; margin:0 0 6px; color:#526777; }
#v-rastreabilidade .g-history-source p { margin:0 0 8px; }
#v-rastreabilidade .g-history-timeline { margin-top:22px; padding-left:8px; }
#v-rastreabilidade .g-history-event { position:relative; border:0; border-left:2px solid #d3dfe7; padding:0 0 26px 18px; }
#v-rastreabilidade .g-history-event:last-child { padding-bottom:4px; }
#v-rastreabilidade .g-history-event::before { content:''; position:absolute; top:5px; left:-6px; width:10px; height:10px; border-radius:50%; background:#65889f; border:2px solid #fbfcfd; box-sizing:border-box; }
#v-rastreabilidade .g-history-event:first-child::before { background:#b78528; }
#v-rastreabilidade .g-history-event-heading h4 { font-size:16px; line-height:1.4; margin:0 0 5px; color:#153d59; }
#v-rastreabilidade .g-history-event .g-history-event-meta { display:block; line-height:1.5; font-size:13px; }
#v-rastreabilidade .g-history-event .g-history-event-author { font-size:12px; margin-top:3px; color:#526777; }
#v-rastreabilidade .g-history-event .g-history-event-note { margin-top:12px; color:#203e52; line-height:1.6; }
#v-rastreabilidade .g-history-change { margin-top:12px; padding:12px; background:#eef3f6; border-radius:6px; }
#v-rastreabilidade .g-history-change h5 { margin:0 0 10px; font-size:13px; color:#345268; }
#v-rastreabilidade .g-history-change dl { display:grid; gap:10px; margin:0; }
#v-rastreabilidade .g-history-change dt { color:#526777; font-size:12px; }
#v-rastreabilidade .g-history-change dd { margin:3px 0 0; font-size:14px; line-height:1.5; color:#203e52; }
#v-rastreabilidade .g-history-change dl > div:last-child dd { font-weight:650; }
#v-rastreabilidade .g-history-legacy { display:inline-block; margin-top:8px; padding:3px 6px; background:#eef1f3; border-radius:4px; }
#v-rastreabilidade :is(.g-workbench-list,.g-workbench-main,.g-workbench-rail) { scrollbar-width:thin; scrollbar-color:#93acbb transparent; }

/* A consulta prioriza a NC; a trajetória é aberta sob demanda. */
#v-rastreabilidade .g-workbench-frame { grid-template-columns:232px minmax(0,1fr); }
#v-rastreabilidade .g-workbench-rail { display:none; }
#v-rastreabilidade .g-history-case-actions { display:flex; flex-wrap:wrap; gap:8px; margin:0 0 20px; }
#v-rastreabilidade .g-history-timeline-drawer { width:min(560px,100vw); }
#v-rastreabilidade .g-history-timeline-context { font-size:16px; font-weight:650; color:#153d59; margin:0 0 6px; }
#v-rastreabilidade .g-history-timeline-content > .g-history-event-meta { font-size:13px; color:#526777; margin:0; }
@media(max-width:1100px) and (min-width:761px) {
  #v-rastreabilidade .g-workbench-frame { grid-template-columns:190px minmax(0,1fr); }
}

/* Mesma densidade de leitura de Triagem e NCs. */
#v-rastreabilidade .g-workbench-main { padding:12px 20px; }
#v-rastreabilidade .g-history-case-header { gap:12px; margin:0 0 12px; padding:0 0 12px; border-bottom:1px solid #d3dde3; }
#v-rastreabilidade .g-history-case-header h2 { font-size:20px; margin:0; padding:0; }
#v-rastreabilidade .g-history-case-header h2::after { display:none; }
#v-rastreabilidade .g-history-case-meta { margin:6px 0 0; gap:6px 10px; font-size:13px; }
#v-rastreabilidade .g-history-farm { padding:3px 8px; }
#v-rastreabilidade .g-history-case-controls { display:flex; align-items:center; flex-wrap:wrap; justify-content:flex-end; gap:10px; }
#v-rastreabilidade .g-history-case-actions { margin:0; }
#v-rastreabilidade .g-history-message { padding:10px 14px; margin-bottom:12px; }
#v-rastreabilidade .g-history-message h3 { font-size:12px; margin-bottom:4px; }
#v-rastreabilidade .g-history-message > p { font-size:18px; line-height:1.45; }
#v-rastreabilidade .g-history-facts { margin:12px 0; padding-top:12px; gap:8px 16px; }
#v-rastreabilidade .g-history-source { margin-top:12px; padding-top:10px; }
#v-rastreabilidade .g-workbench-main > .g-media-gallery { margin-bottom:12px; }
html[data-frontend="modular"] #v-rastreabilidade .g-workbench-main .g-media.is-natural-size .g-media-stage :is(img,video) { max-height:clamp(220px,34vh,360px); object-fit:contain; }
html[data-frontend="modular"] #v-rastreabilidade .g-workbench-main .g-media.is-natural-size:is([data-state="indisponivel"],[data-state="corrompida"],[data-state="carregando"]) .g-media-stage { min-height:180px; }
@media(max-width:760px) {
  #v-rastreabilidade .g-workbench-main { padding:12px 14px; }
  #v-rastreabilidade .g-history-case-controls { justify-content:flex-start; }
}
