#iotConsole{--demo-bg:var(--tr-surface);--demo-card:var(--tr-card);--demo-raised:var(--tr-raised);--demo-text:var(--tr-text);--demo-muted:var(--tr-muted);--demo-border:var(--tr-border);color:var(--demo-text)}
#iotConsole .tr-demo-panel,#iotConsole .tr-demo-panel :where(h1,h2,h3,strong,label,dd){color:var(--demo-text)}
#iotConsole .tr-demo-panel :where(p,small,dt,.muted,.bench-channel-sub,.bench-channel-number){color:var(--demo-muted)}
#iotConsole .tr-demo-panel :where(input,select,textarea,button){border-color:var(--demo-border);color:var(--demo-text)}
#iotConsole .tr-demo-panel :where(input,select,textarea){background:var(--demo-raised)}
#iotConsole :where(.tr-demo-tools,.tr-demo-aux-panel,.tr-demo-editor) button:not([data-primary]):not([data-update-firmware]){background-color:var(--demo-raised)}
html[data-iot-theme="industrial"] #iotConsole{--demo-text:#17364b;--demo-muted:#49677c;--demo-card:#fff;--demo-raised:#f3f7fa;--demo-border:#afc5d4}
html[data-iot-theme="mushroom"] #iotConsole{--demo-text:#eef7ff;--demo-muted:#bed1df;--demo-card:#13283b;--demo-raised:#1a3348;--demo-border:#45647d}
.tr-demo-warning{position:sticky;top:66px;z-index:20}
.tr-demo-toolbar{margin:0 0 14px!important}
.tr-demo-toolbar .iot-head-tools{justify-content:flex-end!important}
.tr-demo-toolbar .iot-head-action{display:inline-flex;align-items:center;gap:8px}
.tr-demo-toolbar .iot-head-action span{white-space:nowrap}
.tr-demo-tools button,.tr-demo-editor button,.tr-demo-editor select,.tr-demo-editor input{color:var(--tr-text);border-color:var(--tr-border)}
.techrib-v3 .tr-demo-panel .trv3-components{align-items:start!important}
.techrib-v3 .tr-demo-panel .trv3-group{align-self:start!important}
.techrib-v3 .tr-demo-panel .trv3-group-heading{margin-bottom:12px!important}
.techrib-v3 .tr-demo-panel .trv3-group-heading h2{font-size:16px!important}
.techrib-v3 .tr-demo-panel .trv3-special .trv3-tiles{align-items:start!important}
.techrib-v3 .tr-demo-panel .home-section{margin-top:20px!important}
.techrib-v3 .tr-demo-panel .home-chart-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.techrib-v3 .tr-demo-panel .trd-chip{align-self:flex-start}
.techrib-v3 .tr-demo-panel .tr-universal-heading{margin:10px 0 12px!important}
.techrib-v3 .tr-demo-panel .tr-universal-heading h2{font-size:19px!important}
.techrib-v3 .tr-demo-panel .tr-universal-heading small{font-size:12px!important}
.tr-side-action[data-demo-new-dashboard]{margin:2px 0 4px;border-style:dashed}
.tr-demo-mode-note{display:flex;align-items:center;gap:8px;margin:0 0 14px;padding:10px 13px;border:1px solid var(--tr-border);border-radius:10px;background:var(--tr-raised);color:var(--tr-muted);font-size:12px}
.tr-demo-editor[hidden]{display:none!important}.tr-demo-editor{margin-top:18px;padding:0!important;max-width:none!important}
.tr-demo-editor .vde-head{margin-bottom:14px}.tr-demo-editor .vde-head h1{font-size:24px}
.tr-demo-editor .vde-toolbar{background:var(--tr-card)}
.tr-demo-editor .vde-toolbar button,.tr-demo-editor .vde-arrange button,.tr-demo-editor .vde-add{background:var(--tr-raised);color:var(--tr-text);border:1px solid var(--tr-border);border-radius:9px;cursor:pointer}
.tr-demo-editor .vde-toolbar button[data-primary]{background:var(--tr-accent);color:#fff;border-color:var(--tr-accent)}
.tr-demo-editor .vde-grid>.vde-card{grid-column:span var(--demo-width,1);position:relative;overflow:visible;min-width:0}
.tr-demo-editor .vde-card[draggable=true]:active{cursor:grabbing}.tr-demo-editor .vde-card.is-dragging{opacity:.45}
.tr-demo-editor .vde-card .tr-demo-card-grip{position:absolute;right:8px;bottom:8px;font-size:10px;color:var(--tr-muted)}
.tr-demo-editor .vde-properties .tr-demo-property-actions{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin:12px 0}
.tr-demo-editor .vde-properties button{min-height:38px}
.tr-demo-custom-preview{margin-top:14px}.tr-demo-custom-preview .vde-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.tr-demo-custom-preview .vde-card{grid-column:span var(--demo-width,1);cursor:default;min-width:0;height:auto;overflow:visible}
.tr-demo-custom-preview .vde-card h3,.tr-demo-custom-preview .vde-value{overflow-wrap:anywhere}
.tr-demo-preview-label{display:flex;justify-content:space-between;align-items:center;gap:10px;margin:0 0 12px;color:var(--tr-muted);font-size:11px}
.tr-demo-new-dialog{width:min(520px,calc(100vw - 24px));border:1px solid var(--tr-border);border-radius:16px;background:var(--tr-card);color:var(--tr-text);padding:22px;box-shadow:0 24px 70px #0008}
.tr-demo-new-dialog::backdrop{background:#071625b8}.tr-demo-new-dialog h2{margin:0 0 8px}.tr-demo-new-dialog p{color:var(--tr-muted);font-size:12px;line-height:1.55}
.tr-demo-new-dialog label{display:grid;gap:6px;margin:14px 0;font-size:12px;font-weight:800}.tr-demo-new-dialog input,.tr-demo-new-dialog select{width:100%;padding:10px;border:1px solid var(--tr-border);border-radius:9px;background:var(--tr-raised);color:var(--tr-text)}
.tr-demo-dialog-actions{display:flex;justify-content:flex-end;gap:9px;margin-top:18px}.tr-demo-dialog-actions button{padding:10px 14px;border:1px solid var(--tr-border);border-radius:9px;background:var(--tr-raised);color:var(--tr-text);font-weight:800}.tr-demo-dialog-actions button[type=submit]{background:var(--tr-accent);border-color:var(--tr-accent);color:#fff}
html[data-iot-theme="industrial"] .tr-demo-warning{background:#fff6d7;color:#4b3900;border-color:#b88916}
@media(max-width:980px){.tr-demo-toolbar .iot-head-tools{justify-content:flex-start!important}.techrib-v3 .tr-demo-panel .home-chart-grid{grid-template-columns:1fr}}
@media(max-width:680px){.tr-demo-toolbar .iot-head-action{width:100%;justify-content:center}.tr-demo-toolbar .iot-filters{width:100%}.tr-demo-toolbar .iot-filters label{flex:1 1 100%;min-width:0}.tr-side-action[data-demo-new-dashboard]{margin-top:4px}}

/* DEMO Parte 2: evita corte dos cards com títulos maiores */
.techrib-v3 .tr-demo-panel .trv3-lights .trv3-tiles{align-items:stretch!important}
.techrib-v3 .tr-demo-panel .trv3-lights .tr-universal-card.bench-channel{
  height:auto!important;
  min-height:132px!important;
  max-height:none!important;
  padding-bottom:12px!important;
}
.techrib-v3 .tr-demo-panel .trv3-lights .bench-channel-top{
  align-items:flex-start!important;
}
.techrib-v3 .tr-demo-panel .trv3-lights .bench-channel-name{
  min-height:34px!important;
  white-space:normal!important;
  overflow:visible!important;
  text-overflow:clip!important;
  overflow-wrap:anywhere!important;
  padding-right:12px!important;
}
.techrib-v3 .tr-demo-panel .trv3-lights .bench-channel-sub{
  min-height:12px!important;
}
.techrib-v3 .tr-demo-panel .trv3-lights .bench-channel-foot{
  margin-top:auto!important;
  min-height:32px!important;
  padding-top:10px!important;
}
.techrib-v3 .tr-demo-panel .trv3-lights .bench-toggle{
  align-items:center!important;
}


/* Etapa 3: consistência dos seis ambientes DEMO sem modificar o dashboard real. */
.tr-demo-warning{position:relative!important;top:auto!important;z-index:1!important;margin-bottom:16px}
.techrib-v3 .tr-demo-panel .trv3-special .trv3-tiles{align-items:stretch!important;grid-auto-rows:auto!important}
.techrib-v3 .tr-demo-panel .trv3-special .trv3-tiles>.tr-universal-card{
 height:auto!important;min-height:292px!important;max-height:none!important;
 display:flex!important;flex-direction:column!important;min-width:0!important;
 padding:14px!important;overflow:hidden!important;
}
.techrib-v3 .tr-demo-panel .trv3-special .trv3-rgb .tr-universal-rgb-compact{
 min-height:0!important;gap:10px!important;align-items:flex-start!important;
 margin:12px 0 14px!important;flex:1 1 auto!important;
}
.techrib-v3 .tr-demo-panel .trv3-special .trv3-rgb .tr-universal-rgb-swatches{
 gap:7px!important;justify-content:flex-start!important;margin-top:12px!important;
}
.techrib-v3 .tr-demo-panel .trv3-special .bench-channel-foot{margin-top:auto!important;flex:0 0 auto!important}
.techrib-v3 .tr-demo-panel .trv3-special .trv3-blind-card .trv3-blind-window{flex:0 0 auto;min-height:100px}
.techrib-v3 .tr-demo-panel .trv3-special .trv3-blind-card .trv3-blind-actions{margin-top:10px}
.techrib-v3 .tr-demo-panel .trv3-special .trv3-blind-card .trv3-blind-footer{margin-top:auto;padding-top:12px}
.techrib-v3 .tr-demo-panel .trv3-sensors .trv3-tiles{align-items:stretch!important}
.techrib-v3 .tr-demo-panel .trv3-sensors .tr-universal-card{
 height:auto!important;max-height:none!important;overflow:hidden!important;min-height:156px!important;
}
.techrib-v3 .tr-demo-panel .trv3-sensors .bench-channel-name{white-space:normal!important;overflow-wrap:break-word!important}
.techrib-v3 .tr-demo-panel .home-chart-grid>.home-chart-card{min-width:0;overflow:hidden}
.techrib-v3 .tr-demo-panel .home-chart-canvas{width:100%;overflow:hidden}
.techrib-v3 .tr-demo-panel .home-chart-head{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap}
.techrib-v3 .tr-demo-panel .home-chart-head [data-demo-period-label]{white-space:nowrap;font-size:10px}
/* Os cards continuam escuros no tema Industrial: textos internos precisam permanecer claros. */
html[data-iot-theme="industrial"] #iotConsole .tr-demo-panel .trv3-tiles>.tr-universal-card :where(.bench-channel-name,.bench-channel-number,.tr-universal-reading,.trv3-blind-head,.trv3-blind-footer strong){color:#eff7ff!important}
html[data-iot-theme="industrial"] #iotConsole .tr-demo-panel .trv3-tiles>.tr-universal-card :where(.bench-channel-sub,.tr-universal-rgb-compact-head){color:#bfd1e2!important}
html[data-iot-theme="industrial"] #iotConsole .tr-demo-panel .trv3-tiles>.tr-universal-card .bench-toggle .bench-state{color:inherit!important}
/* Evita o botão Adicionar dashboard ficar quase invisível no menu lateral escuro. */
html[data-iot-theme="mushroom"] .tr-sidebar .tr-side-action[data-demo-new-dashboard],
html[data-iot-theme="industrial"] .tr-sidebar .tr-side-action[data-demo-new-dashboard]{
 color:#e5f3ff!important;background:rgba(55,126,190,.17)!important;
 border:1px dashed #5683ad!important;font-weight:750!important;
}
.tr-sidebar .tr-side-action[data-demo-new-dashboard]:hover{background:rgba(50,124,196,.28)!important}
@media (min-width:981px) and (max-width:1279px){
 .techrib-v3 .tr-demo-panel .trv3-special .trv3-tiles{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}
@media (max-width:980px){
 .techrib-v3 .tr-demo-panel .trv3-special .trv3-tiles>.tr-universal-card{min-height:270px!important}
 .techrib-v3 .tr-demo-panel .trv3-special .trv3-rgb .tr-universal-rgb-compact{flex-wrap:wrap!important}
}
@media (max-width:580px){
 .techrib-v3 .tr-demo-panel .trv3-special .trv3-tiles{grid-template-columns:minmax(0,1fr)!important}
 .techrib-v3 .tr-demo-panel .home-chart-head{align-items:flex-start}
 .techrib-v3 .tr-demo-panel .home-chart-head [data-demo-period-label]{white-space:normal}
}

/* O editor pode ocultar a composição original ao mostrar a prévia temporária. */
#iotConsole .tr-demo-panel .home-section[hidden],
#iotConsole .tr-demo-panel .trv3-components[hidden]{display:none!important}
