/* Tela de inspeção e mapa documental compartilham a paleta do supervisório.
   O tema atua na interface; a cena e os sinais de movimento usam o renderizador G11. */
@media screen {
  :root {
    color-scheme: dark;
    --fundo: #050f1a;
    --paper: #0a1c2b;
    --elevado: #102b3d;
    --controle: #0c2233;
    --selecionado: #103d50;
    --line: #294d63;
    --ink: #e9f7ff;
    --sub: #acc4d3;
    --pine: #41e4ff;
    --blue: #56b7ff;
    --orange: #ff9a54;
    --alerta: #ffd080;
    scrollbar-color: #416679 var(--fundo);
    background: var(--fundo);
    color: var(--ink);
  }
  body {
    background: var(--fundo);
    color: var(--ink);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
  }
  a, .presentation-files a, .cadProfile a, .footer a,
  .navegacao-modelo-2d a { color: var(--pine); }
  a:hover { color: #a2f4ff; }
  button, select, .searchbox, .toolbar input, .toolbar select,
  .toolbar > button, .toolbar summary, .action, .exampleTools button, dialog input,
  .v5-search-grid button, .drawer .close, #clear, .toolbar .secondary {
    color: var(--ink);
    background: var(--controle);
    border-color: var(--line);
  }
  input::placeholder { color: #a6becd; opacity: 1; }
  input[type="checkbox"], .toolbar input[type="checkbox"] { accent-color: var(--pine); }
  button:enabled:hover, .action:hover, .exampleTools button:hover, .ref:hover,
  .toolbar button:enabled:hover, .toolbar summary:hover, .zoomTools button:hover,
  #walkPad button:hover, .v5-search-grid button:hover {
    background: var(--elevado);
    color: white;
    border-color: #54829a;
  }
  .toolbar button[aria-pressed="true"], .toolbar button[aria-pressed="true"]:hover,
  .action[aria-pressed="true"], .flow-toolbar button[aria-pressed="true"],
  #all-links[aria-pressed="true"], #visual-mode, .primary, .toolbar details[open] > summary {
    color: #aaf6ff;
    border-color: #398399;
    background: var(--selecionado);
  }
  :is(button, input, select, a, summary, canvas, [tabindex]):focus-visible {
    outline: 2px solid var(--pine);
    outline-offset: 2px;
  }
  .searchbox:focus-within { border-color: var(--pine); }
  .searchbox input:focus-visible { outline-offset: 0; }
  .skip:focus { background: var(--elevado); color: var(--pine); }
  dialog { color: var(--ink); border-color: var(--line); background: var(--paper); }
  dialog::backdrop { background: rgb(0 7 15 / 77%); }
  .apphead, .product-header {
    background: #061624;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
  }
  .brand small, .apphead nav > * { color: var(--sub); }
  .brandicon { color: var(--pine); border-color: #398399; }
  .apphead nav [aria-current] { border-bottom-color: var(--pine); color: white; }
  .help { color: var(--ink); border-color: #385d72; }
  body > main:has(.inspector) {
    border-color: var(--line);
    box-shadow: 0 14px 38px #02081055;
  }
  .stagehead, .inspectorHead, .product-header {
    background: linear-gradient(110deg, #102a3c, var(--paper) 76%);
  }
  .eyebrow, .searchbox span, .item .chev, .evidence summary, .back { color: var(--pine); }
  #viewport { background: #182b38; border-color: var(--line); }
  .stageinfo, .zoomTools, #walkPad, #load {
    color: var(--ink);
    background: rgb(6 23 36 / 96%);
    border: 1px solid #426477;
    box-shadow: 0 3px 12px #03101b40;
  }
  .stageinfo .lamp { background: var(--pine); }
  .zoomTools button, #walkPad button { color: var(--ink); }
  .zoomTools button + button { border-color: var(--line); }
  .inspector, .toolbar, .legend, .flow-toolbar { background: var(--paper); border-color: var(--line); }
  .revision, .legend, .footer, #details p, .ref span, .item small { color: var(--sub); }
  .profile, .toolbar fieldset, .toolbar fieldset legend { background: var(--elevado); color: var(--ink); }
  .item { background: transparent; border-bottom-color: #213d4d; }
  .item:hover, .item:focus-visible { background: var(--selecionado); }
  .back { border: 0; background: transparent; }
  .ref { background: var(--controle); border-color: var(--line); }
  .ref.in, .connection-card { border-left-color: var(--blue); }
  .ref.out, .connection-card.out { border-left-color: var(--orange); }
  .legend i { background: var(--blue); }
  .legend .out { background: var(--orange); }
  .profile polyline { stroke: var(--pine); }
  .profile circle { fill: var(--pine); }
  .profile .floor { stroke: var(--sub); }
  .drawingDialog button, #examplePlay, #exampleFlowLabel {
    background: var(--controle);
    border-color: var(--line);
    color: var(--ink);
  }
  .footer b { color: #90aebb; }
  #details .note, .pending, .visual-disclaimer, .device-button {
    background: #302719;
    color: var(--alerta);
    border-color: #856536;
  }
  #exampleView { background: radial-gradient(ellipse at 50% 42%, #294253, #0a1a29); }
  /* O recorte técnico tem seu próprio papel e tinta impressos. */
  #receptionDrawing { color-scheme: light; }
  .ag-incorporado .apphead {
    height: 40px;
    padding-inline: clamp(12px, 2vw, 24px);
    gap: 16px;
  }
  .ag-incorporado .apphead .brand { display: none; }
  .ag-incorporado body > main:has(.inspector) { margin: 0; border-radius: 0; border-width: 0 0 1px; }
  .ag-incorporado .footer { padding: 8px 16px; }
  .ag-incorporado .product-header { display: none; }

  /* Mapa 2D. Os seletores de cor atuam apenas nas superfícies, no texto
     e na seleção do mapa. As setas e imagens dos equipamentos mantêm o desenho. */
  .navegacao-modelo-2d {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 18px;
    padding: 8px 16px;
    background: #061624;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    font-weight: 650;
  }
  .product-header .revision, .notice, .status, .flow-summary, .family-card,
  .v5-search-results, .v5-extra, .map-guide, .v5-scene-tools, .drawer, th {
    background: var(--paper);
    border-color: var(--line);
    color: var(--ink);
  }
  .notice, .v5-search-results { background: var(--elevado); }
  .flow-toolbar small, .product-header small, .map-guide, .product-header ~ .v5-help,
  .map-guide strong, .muted, .view-note, dt, .drawer dt, .drawer .muted, .drawer .view-note,
  .drawer .connection-pair, .drawer .flow-summary small, .drawer .reference-row small,
  .drawer .direction-word, .drawer .eyebrow, .product-header ~ .toolbar .muted { color: var(--sub); }
  .flow-toolbar button, .connection-card button, .v5-extra button { color: var(--ink); }
  .connection-card, .connection-card.out { background: var(--controle); }
  .in-key { color: var(--blue); }
  .out-key, .family-card .limit { color: var(--orange); }
  .drawer .facts, #drawer, .edge-list li, th, td { border-color: var(--line); }
  .viewport { background: var(--fundo); }
  #canvas svg > rect[fill="#ffffff"], #canvas svg .inventory-asset rect,
  #canvas svg .component > rect:first-child { fill: #102739; stroke: #345569; }
  #canvas svg > rect[fill="#f8fbfd"], #canvas svg > rect[fill="#edf2f6"] { fill: #0a1926; }
  #canvas svg > rect[fill="#fffaf0"], #canvas svg .device rect { fill: #32291b; }
  #canvas svg text[fill="#283f50"] { fill: var(--ink); }
  #canvas svg :is(text,tspan)[fill="#668093"] { fill: var(--sub); }
  #canvas svg :is(text,tspan)[fill="#865b25"] { fill: var(--alerta); }
  #canvas svg .asset > rect[fill="#eef3f6"] { fill: #163447; stroke: #56778a; }
  #canvas svg .asset.selected .focus-outline, #canvas svg .inventory-asset.selected rect {
    fill: #17435a;
    stroke: var(--pine);
  }
  #canvas svg .asset.related .focus-outline { fill: #19344a; stroke: #93b5cb; }
  #canvas svg .asset.selected text:first-of-type { fill: #89efff; }
  #canvas svg .device:hover rect, #canvas svg .device.selected rect,
  #canvas svg .catalog-family:hover rect { fill: #604423; stroke: var(--alerta); }
  #canvas svg .edge-underlay polyline { stroke: #091826; }
  #canvas svg .edge:focus-visible .edge-ink polyline { stroke: var(--pine); }
}

@media screen and (min-width: 781px) and (min-height: 590px) {
  .ag-incorporado #viewport { height: clamp(300px, calc(100dvh - 240px), 1150px); min-height: 300px; }
  .ag-incorporado .inspector { max-height: calc(100dvh - 62px); }
}

@media screen and (max-width: 780px) {
  .apphead, .ag-incorporado .apphead { gap: 9px; padding-inline: 10px; }
  .apphead nav { gap: 8px; }
  .stagehead { flex-wrap: wrap; gap: 8px; }
  .stagehead .viewbox { margin-left: auto; }
  .ag-incorporado .apphead { padding-left: 123px; }
  .ag-incorporado .skip:not(:focus), .ag-incorporado .skip:focus {
    position: absolute;
    z-index: 5;
    left: 6px;
    top: 5px;
    width: auto;
    height: auto;
    margin: 0;
    padding: 6px;
    clip-path: none;
    border-radius: 4px;
    background: var(--controle);
    color: var(--pine);
    font-size: 12px;
    font-weight: 650;
  }
  .ag-incorporado #viewport { min-height: 234px; height: clamp(234px, 43dvh, 470px); }
  .toolbar label, .toolbar select, .searchbox, .navegacao-modelo-2d a { max-width: 100%; }
  .revision { letter-spacing: .02em; }
  .zoomTools button, #walkPad button { min-height: 38px; min-width: 38px; }
}
/* Densidade de consulta do AgroSense. A escala do desenho 2D é independente. */
@media screen {
  [data-mode="3d"] body {
    font-size: 13px;
    line-height: 1.4;
  }
  .stagehead, .inspectorHead {
    padding: 12px 16px 9px;
  }
  .eyebrow {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .12em;
    margin-bottom: 3px;
  }
  .stagehead h1, .inspectorHead h2, [data-mode="3d"] #details h3, .drawer h2 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -.025em;
    line-height: 1.2;
  }
  .stagehead h1 { font-size: 21px; }
  .presentation-files { margin-top: 4px; gap: 2px 13px; }
  .presentation-files a { font-size: 12px; font-weight: 500; }
  .viewbox { gap: 6px; font-size: 12px; }
  .viewbox select, .viewbox .help, .selectors > select, .searchbox {
    min-height: 32px;
    padding: 4px 8px;
    font-size: 12px;
  }
  .viewbox .help { white-space: nowrap; }
  .selectors { gap: 5px; padding: 0 12px 8px; }
  .selectors > select { font-weight: 500; }
  .searchbox input { font-size: 12px; }
  #listing { padding: 0 10px 8px; }
  #count { margin: 6px 0 2px; font-size: 11px; }
  #items .item {
    grid-template-columns: minmax(0,1fr) auto;
    gap: 1px 8px;
    min-height: 39px;
    padding: 4px 7px;
    line-height: 1.3;
  }
  #items .item strong {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    overflow-wrap: anywhere;
  }
  #items .item small { font-size: 12px; line-height: 1.25; }
  #items .item .chev { font-size: 16px; font-weight: 500; }
  #items .item:focus-visible { outline-offset: -2px; }
  [data-mode="3d"] #details { padding: 9px 14px 15px; }
  [data-mode="3d"] #details h4 { font-size: 13px; margin: 12px 0 4px; }
  .workspace .toolbar, .workspace .legend { padding: 6px 12px; gap: 4px 8px; }
  .workspace .toolbar > button, .workspace .toolbar summary {
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 500;
    min-height: 30px;
  }
  .workspace .legend, .ag-incorporado .footer { font-size: 11px; }
  .ag-incorporado .footer { padding: 5px 12px; }
  [data-mode="2d"] .toolbar { padding: 6px 12px; gap: 5px 8px; }
  [data-mode="2d"] .toolbar label { font-size: 12px; }
  [data-mode="2d"] .toolbar :is(button,select,input) { min-height: 30px; padding: 4px 7px; }
  [data-mode="2d"] .flow-toolbar { padding: 6px 12px; }
  [data-mode="2d"] .flow-toolbar strong { font-size: 13px; font-weight: 600; }
  [data-mode="2d"] .drawer { padding: 15px; }
}
@media screen and (min-width: 781px) {
  .presentation-files a[href="#search"]:not(:focus) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  [data-mode="3d"] main {
    grid-template-columns: minmax(0,1fr) clamp(260px,23.5vw,350px);
  }
}
@media screen and (min-width: 781px) and (min-height: 560px) {
  .ag-incorporado[data-mode="3d"] body { display: flex; flex-direction: column; height: 100dvh; }
  .ag-incorporado[data-mode="3d"] body > main { flex: 1; min-height: 0; }
  .ag-incorporado[data-mode="3d"] :is(.workspace, .inspector) { min-height: 0; max-height: none; }
  .ag-incorporado[data-mode="3d"] #viewport { flex: 1; min-height: 220px; height: auto; }
}
@media screen and (max-width: 780px) {
  .stagehead, .inspectorHead { padding: 9px 10px 6px; }
  .stagehead h1 { font-size: 20px; }
  .stagehead { gap: 4px 8px; }
  .stagehead > div:first-child { min-width: 0; }
  .workspace .toolbar > button, .workspace .toolbar summary, .viewbox select, .viewbox .help,
  .selectors > select, .searchbox, #items .item, [data-mode="2d"] .toolbar :is(button,select,input) { min-height: 44px; }
  .selectors { padding-inline: 10px; }
  .presentation-files a { display: inline-flex; align-items: center; min-height: 27px; }
  .presentation-files { column-gap: 10px; }
  [data-mode="3d"] #details { padding-inline: 10px; }
}
@media screen and (max-width: 480px) {
  .selectors { grid-template-columns: 1fr; }
  [data-mode="2d"] .direction-controls { flex-wrap: wrap; }
  [data-mode="2d"] .toolbar label { flex-wrap: wrap; max-width: 100%; }
  [data-mode="2d"] .toolbar select, [data-mode="2d"] .toolbar input { min-width: 0; max-width: 100%; }
}

html[data-mode="3d"] .legend .zeus-pin{width:6px;height:6px;border-radius:50%;background:#abebff;box-shadow:0 0 4px 1px #289be3}
html[data-mode="3d"] .legend .proposed-pipe{background:#789da7}
html[data-mode="3d"] .legend [hidden]{display:none}
.th-mode .inspector > :not(#thermal-inspector),.th-mode .stageinfo,.th-mode .stagehead .viewbox,
.th-mode .workspace .toolbar,.th-mode .workspace .legend,.th-mode .workspace .exampleHint {display:none!important}
#thermal-inspector[hidden]{display:none}
#thermal-inspector{padding:14px 16px 20px;overflow:auto;min-height:0;display:grid;align-content:start;gap:12px;color:var(--ink)}
#thermal-inspector header .eyebrow{margin:0 0 3px}
#thermal-inspector h2{margin:0;font-size:21px}
#thermal-inspector label{display:grid;gap:4px;font-size:12px;color:var(--sub);min-width:0}
#thermal-inspector select,#thermal-inspector button,.th-open{font:inherit;border:1px solid var(--line);border-radius:5px;padding:7px 9px;background:var(--controle);color:var(--ink);min-width:0;max-width:100%}
#thermal-inspector select{width:100%;font-size:14px}
#thermal-inspector button,.th-open{cursor:pointer;color:var(--pine)}
.th-pair{display:grid;grid-template-columns:.7fr 1fr;gap:8px}
.th-probe{display:grid;gap:3px;padding:12px 0;border-block:1px solid var(--line)}
.th-probe strong{font-size:26px;color:var(--pine)}.th-probe small,#thermal-inspector p[data-th]{color:var(--sub);font-size:12px;line-height:1.45;margin:0}
.th-mode .inspector{display:flex;flex-direction:column}
@media(max-width:780px){
 #thermal-inspector{padding:10px;gap:7px}
 #thermal-inspector select,#thermal-inspector button,.th-open{min-height:42px}
}
