
    /* Three.js ocupa somente o miolo dos cards; textos e cliques continuam no DOM. */
    .mb-card.aq-three-ready .mb-tanks {
      position: relative;
      isolation: isolate;
      overflow: hidden;
      border-radius: 12px;
    }
    .aq-three-canvas {
      position: absolute;
      z-index: 1;
      inset: 19px 0 17px;
      width: 100%;
      height: calc(100% - 36px);
      min-width: 0;
      max-width: none;
      box-sizing: border-box;
      contain: layout paint size;
      pointer-events: none;
      display: block;
      filter: saturate(1.08) contrast(1.03);
    }
    .mb-card.aq-three-ready .mb-tank {
      position: relative;
      z-index: 2;
    }
    .mb-card.aq-three-ready .mb-tank-visual {
      background: transparent !important;
      border-color: transparent !important;
      box-shadow: none !important;
      overflow: visible;
    }
    .mb-card.aq-three-ready .mb-tank-visual::before,
    .mb-card.aq-three-ready .mb-tank-visual::after,
    .mb-card.aq-three-ready .mb-tank-fill {
      opacity: 0 !important;
      visibility: hidden !important;
    }
    .mb-card.aq-three-ready .mb-tank-pct {
      z-index: 5;
      align-items: center;
      padding-top: 16px;
    }
    .mb-card.aq-three-ready .mb-tank-cap,
    .mb-card.aq-three-ready .mb-tank-sub {
      position: relative;
      z-index: 5;
    }
    .mb-card.aq-three-ready .mb-chips {
      position: relative;
      z-index: 7;
    }
    /* Alinha os textos aos centros ópticos dos tanques renderizados. */
    .mb-card.aq-three-ready .mb-tanks {
      display: grid;
      grid-template-columns: minmax(0, 34%) minmax(0, 34%);
      justify-content: center;
      column-gap: 0;
    }
    .mb-card.aq-three-ready .mb-tank-cap {
      width: fit-content;
      min-width: 108px;
      margin: 0 auto 7px;
      padding: 5px 11px;
      border: 1px solid rgba(48, 190, 246, .30);
      border-radius: 999px;
      background: linear-gradient(180deg, rgba(15, 49, 76, .90), rgba(7, 27, 47, .88));
      color: #eef9ff;
      font-size: 13px;
      font-weight: 750;
      letter-spacing: .1px;
      text-align: center;
      line-height: 1;
      white-space: nowrap;
      text-shadow: 0 0 10px rgba(104, 214, 255, .24);
      box-shadow: 0 0 14px rgba(32, 189, 246, .10), inset 0 1px 0 rgba(255, 255, 255, .06);
    }
    .mb-card.aq-three-ready .mb-tank-sub {
      width: fit-content;
      min-width: 70px;
      margin: 8px auto 0;
      padding: 4px 9px;
      border: 1px solid rgba(98, 169, 224, .20);
      border-radius: 7px;
      background: rgba(6, 24, 42, .84);
      color: #c5d9ec;
      font: 600 11px 'DM Mono', monospace;
      text-align: center;
      line-height: 1.25;
      white-space: nowrap;
    }
    @media (min-width: 901px) {
      #mb-grid.aq-list-mode .mb-card.aq-three-ready .mb-tanks {
        display: block;
        position: relative;
        height: 216px;
      }
      #mb-grid.aq-list-mode .mb-card.aq-three-ready .mb-tank {
        position: absolute;
        top: 0;
        width: 30%;
        height: 100%;
      }
      #mb-grid.aq-list-mode .mb-card.aq-three-ready .mb-tank:first-of-type { left: 21%; }
      #mb-grid.aq-list-mode .mb-card.aq-three-ready .mb-tank:last-of-type { left: 49%; }
      #mb-grid.aq-list-mode .mb-card.aq-three-ready .mb-tank-visual {
        width: 100%;
        height: 150px !important;
      }
      #mb-grid.aq-list-mode .mb-name {
        color: #f1f8ff;
        font-size: 18px;
        font-weight: 700;
        text-shadow: 0 0 14px rgba(82, 207, 255, .20);
      }
      #mb-grid.aq-list-mode .mb-tank-sub { display: none !important; }
      #mb-grid.aq-list-mode .mb-tank-pct {
        inset: auto auto -38px 50%;
        transform: translateX(-50%);
        display: block;
        width: max-content;
        height: auto;
        padding: 6px 13px !important;
        border: 1px solid rgba(68, 184, 239, .30);
        border-radius: 9px;
        background: rgba(5, 22, 39, .92);
        color: #f5fbff;
        font-size: 24px;
        line-height: 1;
        text-shadow: 0 2px 10px #000;
        box-shadow: 0 6px 16px rgba(0, 0, 0, .30), 0 0 14px rgba(32, 189, 246, .10);
      }
      #mb-grid.aq-list-mode .mb-tank-pct::before { display: none; }
    }
    /* Em todas as visualizações 3D, o percentual ocupa a faixa inferior. */
    #mb-grid .mb-card.aq-three-ready .mb-tank-pct { display: none !important; }
    #mb-grid .mb-card.aq-three-ready .mb-tank-sub {
      display: block !important;
      min-width: 78px;
      padding: 6px 12px;
      border-color: rgba(68, 184, 239, .32);
      background: linear-gradient(180deg, rgba(11, 42, 67, .94), rgba(5, 23, 40, .94));
      color: transparent;
      font-size: 0;
      box-shadow: 0 6px 16px rgba(0, 0, 0, .28), 0 0 14px rgba(32, 189, 246, .10);
    }
    #mb-grid .mb-card.aq-three-ready .mb-tank-sub::after {
      content: attr(data-pct) '%';
      color: #f5fbff;
      font: 800 26px/1 'DM Sans', sans-serif;
      letter-spacing: -.4px;
      text-shadow: 0 2px 9px #000;
    }
    @media (min-width: 901px) {
      #mb-grid.aq-three-count-1 .mb-tank-visual { height: 286px !important; }
      #mb-grid.aq-three-count-2:not(.aq-list-mode) .mb-tank-visual { height: 270px !important; }
    }
    #mb-grid.aq-three-count-3 .mb-tank-visual,
    #mb-grid.aq-three-count-4 .mb-tank-visual {
      height: 172px !important;
    }
    #mb-grid.aq-list-mode .aq-three-canvas { inset-block: 13px; }
    #mb-grid.aq-list-mode .mb-tank-visual { height: 118px !important; }
    @media (min-width: 901px) {
      #mb-grid.aq-list-mode .aq-three-canvas { inset: 8px 0; }
      #mb-grid.aq-list-mode .mb-card.aq-three-ready .mb-tank-visual { height: 150px !important; }
    }
    @media (max-width: 1240px) and (min-width: 901px) {
      #mb-grid .mb-tank-visual { height: 190px !important; }
    }
    @media (max-width: 900px) {
      .aq-three-canvas { inset: 18px -4px 17px; width: calc(100% + 8px); }
      #mb-grid .mb-tank-visual { height: 148px !important; }
      .mb-card.aq-three-ready .mb-tank-pct { padding-top: 9px; }
    }
    @media (max-width: 480px) {
      #mb-grid .mb-tank-visual { height: 132px !important; }
    }
    /* Visualização detalhada: a cena Three.js substitui apenas os medidores planos. */
    #tank-card.aq-three-detail-ready { overflow: hidden; }
    /* fix: esconde as fontes 2D (barras de nível) SOMENTE quando a cena 3D (.aq-three-detail-stage)
       está montada no card. Antes a visibilidade dependia só da classe marcadora, que podia
       dessincronizar da cena 3D numa corrida de contexto WebGL (trocar placa offline->online) e
       deixar os DOIS visíveis. Agora é invariante de CSS: 2D escondido <=> 3D presente. */
    #tank-card:has(.aq-three-detail-stage) .aq-three-detail-source { display: none !important; }
    .aq-three-detail-stage {
      position: relative;
      height: auto;
      min-height: 260px;
      max-height: 390px;
      aspect-ratio: 3 / 2;
      margin: 2px -4px -4px;
      border-radius: 16px;
      overflow: hidden;
      background:
        radial-gradient(circle at 50% 42%, rgba(22, 141, 204, .10), transparent 48%),
        linear-gradient(180deg, rgba(5, 18, 31, .15), rgba(1, 8, 14, .52));
    }
    .aq-three-detail-canvas {
      position: absolute;
      inset: 42px 0 16px;
      width: 100%;
      height: calc(100% - 58px);
      min-width: 0;
      max-width: none;
      box-sizing: border-box;
      contain: layout paint size;
      display: block;
      pointer-events: none;
    }
    .aq-three-detail-label {
      position: absolute;
      z-index: 3;
      top: 7px;
      display: grid;
      grid-template-columns: auto auto;
      justify-content: center;
      justify-items: center;
      align-items: baseline;
      gap: 4px 12px;
      width: min(168px, calc(42% - 6px));
      min-width: 0;
      padding: 9px 12px 10px;
      overflow: hidden;
      border: 1px solid rgba(66, 181, 235, .28);
      border-radius: 12px;
      background: linear-gradient(145deg, rgba(11, 38, 62, .94), rgba(4, 20, 36, .92));
      color: var(--text-2);
      box-shadow: 0 10px 24px rgba(0, 0, 0, .26), 0 0 18px rgba(32, 189, 246, .10), inset 0 1px 0 rgba(255, 255, 255, .06);
      pointer-events: none;
    }
    .aq-three-detail-label span { grid-column: 1 / -1; color: #e0f5ff; font-size: 12.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .65px; text-shadow: 0 0 11px rgba(86, 204, 255, .24); }
    .aq-three-detail-label strong { color: var(--level-color, var(--text-1)); font-size: 40px; font-weight: 800; line-height: .92; text-shadow: 0 2px 9px #000, 0 0 16px rgba(255, 255, 255, .12); }
    .aq-three-detail-label small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #afc3d6; font: 600 11px 'DM Mono', monospace; }
    .aq-three-detail-label.is-critical strong,
    .aq-three-detail-label.is-critical small { color: var(--red); }
    .aq-detail-left { left: 8%; text-align: center; }
    .aq-detail-right { right: 8%; text-align: center; }
    @media (max-width: 900px) {
      .aq-three-detail-stage { height: 310px; }
      .aq-three-detail-canvas {
        top: 64px;
        right: 0;
        bottom: auto;
        left: 0;
        height: calc(100% - 78px);
      }
      .aq-three-detail-label {
        display: flex;
        flex-direction: column;
        justify-content: center;
        width: 44%;
        max-width: 44%;
        min-width: 0;
        box-sizing: border-box;
        align-items: center;
        gap: 1px;
        padding: 7px 8px 8px;
      }
      .aq-three-detail-label span,
      .aq-three-detail-label strong,
      .aq-three-detail-label small {
        grid-column: 1;
        width: 100%;
        min-width: 0;
        text-align: center;
      }
      .aq-three-detail-label span { font-size: 10.5px; line-height: 1.1; }
      .aq-three-detail-label strong { font-size: 30px; line-height: .9; }
      .aq-three-detail-label small {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: clip;
        white-space: nowrap;
        font-size: 10px;
        line-height: 1.1;
      }
      .aq-detail-left { left: 3%; }
      .aq-detail-right { right: 3%; }
    }
    @media (max-width: 340px) {
      .aq-three-detail-label span {
        font-size: 9.5px;
        letter-spacing: .3px;
      }
    }
    /* Telefone real: replica o quadro medido no modo de múltiplos tanques.
       A classe é aplicada pelo módulo 3D somente em telefones; desktop mantém
       integralmente o tamanho e o enquadramento anteriores. */
    .aq-three-detail-stage.aq-phone-multi-size {
      height: 252px;
      min-height: 252px;
      max-height: 252px;
      aspect-ratio: auto;
      margin: 2px -16px -4px;
    }
    .aq-three-detail-stage.aq-phone-multi-size .aq-three-detail-canvas {
      top: 18px;
      right: -4px;
      bottom: auto;
      left: -4px;
      width: calc(100% + 8px);
      height: 216px;
    }
    /* No telefone, replica também a tipografia e a posição dos rótulos do
       modo múltiplo: título no topo e percentual na faixa inferior. */
    .aq-three-detail-stage.aq-phone-multi-size .aq-three-detail-label {
      top: 0;
      right: auto;
      bottom: 0;
      width: 0;
      max-width: none;
      height: 100%;
      padding: 0;
      display: block;
      overflow: visible;
      border: 0;
      border-radius: 0;
      background: none;
      box-shadow: none;
    }
    .aq-three-detail-stage.aq-phone-multi-size .aq-detail-left {
      left: var(--aq-left-tank-x, 24.5%);
    }
    .aq-three-detail-stage.aq-phone-multi-size .aq-detail-right {
      left: var(--aq-right-tank-x, 75.5%);
    }
    .aq-three-detail-stage.aq-phone-multi-size .aq-three-detail-label span {
      position: absolute;
      top: 0;
      left: 50%;
      width: auto;
      min-width: 108px;
      padding: 5px 11px;
      box-sizing: border-box;
      transform: translateX(-50%);
      border: 1px solid rgba(48, 190, 246, .30);
      border-radius: 999px;
      background: linear-gradient(180deg, rgba(15, 49, 76, .90), rgba(7, 27, 47, .88));
      color: #eef9ff;
      font-size: 13px;
      font-weight: 750;
      line-height: 1;
      letter-spacing: .1px;
      white-space: nowrap;
      text-shadow: 0 0 10px rgba(104, 214, 255, .24);
      box-shadow: 0 0 14px rgba(32, 189, 246, .10), inset 0 1px 0 rgba(255, 255, 255, .06);
    }
    .aq-three-detail-stage.aq-phone-multi-size .aq-three-detail-label strong {
      position: absolute;
      bottom: 0;
      left: 50%;
      display: block;
      width: max-content;
      min-width: 78px;
      padding: 6px 12px;
      box-sizing: border-box;
      transform: translateX(-50%);
      border: 1px solid rgba(68, 184, 239, .32);
      border-radius: 9px;
      background: linear-gradient(180deg, rgba(11, 42, 67, .94), rgba(5, 23, 40, .94));
      color: var(--level-color, #f5fbff);
      font: 800 26px/1 'DM Sans', sans-serif;
      letter-spacing: -.4px;
      white-space: nowrap;
      text-shadow: 0 2px 9px #000;
      box-shadow: 0 6px 16px rgba(0, 0, 0, .28), 0 0 14px rgba(32, 189, 246, .10);
    }
    .aq-three-detail-stage.aq-phone-multi-size .aq-three-detail-label small {
      display: none;
    }
    @media (max-width: 1500px) and (min-width: 901px) {
      .aq-three-detail-label { width: min(154px, calc(47% - 6px)); min-width: 0; padding: 8px 9px 9px; }
      .aq-three-detail-label span { font-size: 10.5px; }
      .aq-three-detail-label strong { font-size: 32px; }
      .aq-three-detail-label small { font-size: 10px; }
      .aq-detail-left { left: 3%; }
      .aq-detail-right { right: 3%; }
    }
    /* Foco em PC: move somente os banners para o centro real de cada tanque. */
    .aq-three-detail-stage:not(.aq-phone-multi-size) .aq-detail-left {
      right: auto;
      left: var(--aq-left-tank-x, 31%);
      transform: translateX(-50%);
    }
    .aq-three-detail-stage:not(.aq-phone-multi-size) .aq-detail-right {
      right: auto;
      left: var(--aq-right-tank-x, 69%);
      transform: translateX(-50%);
    }
    @media (max-width: 1320px) and (min-width: 901px) {
      .main-inner { grid-template-columns: minmax(0, 1fr); }
      .col-full { grid-column: 1; }
    }
    .aq-three-detail-canvas,
    .aq-three-canvas { background: transparent !important; }

    /* Moldura geral próxima ao modelo aprovado. */
    @media (min-width: 901px) {
      #app-shell {
        gap: 10px;
        padding: 10px 12px 12px;
        background: rgba(0, 7, 14, .76);
      }
      #sidebar-left,
      #sidebar-right,
      #main-area {
        height: 100%;
        border: 1px solid rgba(103, 156, 205, .20);
        border-radius: 5px;
        overflow: hidden;
        box-shadow: inset 0 1px 0 rgba(255,255,255,.018);
      }
      #sidebar-left,
      #sidebar-right { overflow-y: auto; }
      #sidebar-right { border-left: 1px solid rgba(103, 156, 205, .20); }
      #main-area { overflow-y: auto; }
    }

    /* Seções secundárias recolhidas por padrão, sem remover conteúdo ou controles. */
    .aq-collapse-toggle {
      width: 100%;
      margin: 0;
      padding: 0 0 6px;
      border: 0;
      background: transparent;
      color: var(--blue);
      display: flex;
      align-items: center;
      justify-content: space-between;
      text-align: left;
      font-family: inherit;
      cursor: pointer;
    }
    .aq-collapse-toggle::after {
      content: '';
      width: 7px;
      height: 7px;
      margin-right: 3px;
      border-right: 1.5px solid currentColor;
      border-bottom: 1.5px solid currentColor;
      transform: rotate(45deg);
      transition: transform .18s ease;
    }
    .aq-collapse-toggle.is-open::after { transform: rotate(225deg); }
    .aq-collapse-toggle:focus-visible {
      outline: 1px solid rgba(32, 189, 246, .7);
      outline-offset: 4px;
      border-radius: 4px;
    }
    .aq-collapse-body[hidden] { display: none !important; }

    /* Previsão preservada, mas compactada horizontalmente como um componente lateral. */
    #weather-section .weekly-header { display: none; }
    #weather-weekly {
      display: flex;
      gap: 6px;
      overflow-x: auto;
      padding: 1px 1px 7px;
      scrollbar-width: thin;
    }
    #weather-weekly .weekly-row {
      min-width: 52px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 2px;
      padding: 7px 5px;
      border: 1px solid rgba(99, 151, 200, .12);
      background: rgba(8, 25, 43, .58);
    }
    #weather-weekly .weekly-row > span:nth-child(3) { display: none; }
    #weather-weekly .weekly-day,
    #weather-weekly .weekly-rain,
    #weather-weekly .weekly-max,
    #weather-weekly .weekly-min { width: auto; text-align: center; }
    #weather-weekly .weekly-min { display: none; }

    /* Histórico mantém todos os dados, com altura mais próxima da composição de referência. */
    #chart-card { padding: 16px 18px; }
    #chart-card .chart-header { margin-bottom: 9px; }
    #chart-card .chart-canvas-wrap { height: 148px; }
    #chart-card .chart-legend { margin-top: 9px; padding-top: 9px; gap: 8px; }
    #chart-card .legend-item { padding: 7px 10px; }
    #chart-card .legend-item-val { font-size: 17px; }

    /* Logs em blocos de evento, em vez de um terminal contínuo. */
    #inline-log-content.log-area {
      padding: 0 12px 10px;
      margin: 0;
      background: transparent;
      white-space: normal;
    }
    .aq-log-event {
      position: relative;
      padding: 12px 7px 12px 20px;
      border-bottom: 1px solid rgba(95, 146, 194, .15);
      color: #8fa5bd;
      font-family: 'DM Mono', monospace;
      line-height: 1.52;
    }
    .aq-log-event-head {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      overflow-wrap: anywhere;
    }
    .aq-log-event-dot {
      width: 8px;
      height: 8px;
      margin-top: 4px;
      margin-left: -15px;
      flex: 0 0 8px;
      border-radius: 50%;
      background: currentColor;
      box-shadow: 0 0 10px currentColor;
    }
    .aq-log-event-detail {
      margin-top: 6px;
      padding-left: 3px;
      color: #71869e;
      white-space: pre-wrap;
      overflow-wrap: anywhere;
    }
    .aq-log-event.is-ok { color: #39dfa5; }
    .aq-log-event.is-info { color: #4bc4f2; }
    .aq-log-event.is-warn { color: #ffc447; }
    .aq-log-event.is-error { color: #ff6973; }
    .aq-log-event.is-ok .aq-log-event-detail,
    .aq-log-event.is-info .aq-log-event-detail,
    .aq-log-event.is-warn .aq-log-event-detail,
    .aq-log-event.is-error .aq-log-event-detail { color: #8296ad; }
  