:root{
  --tg-safe-top:env(safe-area-inset-top,0px);--tg-safe-right:env(safe-area-inset-right,0px);
  --tg-safe-bottom:env(safe-area-inset-bottom,0px);--tg-safe-left:env(safe-area-inset-left,0px);
  --tg-content-top:0px;--tg-content-bottom:0px;
}
.mobile-nav{display:none}
.state-healthy{color:var(--green)!important}
.state-processing,.state-warning{color:var(--orange)!important}
.state-error{color:var(--red)!important}
.state-unknown{color:#ffd166!important}
.event.unknown{border-color:rgba(255,209,102,.72);box-shadow:0 0 18px rgba(255,209,102,.13)}
.event.unknown:after{background:#ffd166;opacity:1}
@media(max-width:850px){
  body{padding-bottom:calc(72px + var(--tg-safe-bottom) + var(--tg-content-bottom))}
  .app{padding:max(8px,var(--tg-safe-top)) max(8px,var(--tg-safe-right)) 8px max(8px,var(--tg-safe-left))}
  .header{position:relative}.stage-shell{display:flex;flex-direction:column;gap:9px}
  .left-rail{display:none}.center-column,.bottom-console{display:contents}
  .scene{order:1;min-height:48vh;height:48vh;border-radius:18px}
  #activeTaskPod{order:2;min-height:150px}
  #queuePod{order:3;min-height:150px}
  .right-panel{order:4;min-height:0;padding:10px}
  .overview{grid-template-columns:repeat(2,1fr);gap:9px}
  .overview .cell{min-height:84px;touch-action:manipulation}
  #systemPod{order:5;min-height:150px}
  #agentsPod{order:6;min-height:140px}
  .events{max-height:none;overflow:visible;display:flex;flex-direction:column}
  .event{min-height:68px}.right-controls{display:none}
  .mobile-nav{display:grid;position:fixed;z-index:99;left:max(8px,var(--tg-safe-left));right:max(8px,var(--tg-safe-right));
    bottom:max(8px,var(--tg-safe-bottom));grid-template-columns:repeat(4,1fr);gap:6px;padding:7px;
    border:1px solid rgba(255,255,255,.10);border-radius:18px;background:rgba(6,4,13,.94);
    backdrop-filter:blur(18px);box-shadow:0 16px 50px rgba(0,0,0,.45)}
  .mobile-nav button{border:1px solid rgba(255,255,255,.08);background:rgba(255,255,255,.025);
    color:#d8d1e4;border-radius:12px;min-height:48px;font:10px ui-monospace,monospace}
}
@media(max-width:950px) and (orientation:landscape) and (max-height:600px){
  body{padding-bottom:0}.app{padding:6px max(8px,var(--tg-safe-right)) 6px max(8px,var(--tg-safe-left))}
  .header,.bindnote,.mobile-nav{display:none}
  .stage-shell{display:grid;grid-template-columns:minmax(180px,.75fr) minmax(390px,1.8fr) minmax(210px,.85fr);
    grid-template-rows:auto auto 1fr;gap:7px;height:100vh}
  .center-column,.bottom-console,.right-panel{display:contents}
  .scene{grid-column:2;grid-row:1/4;min-height:0;height:calc(100vh - 12px);order:initial}
  #activeTaskPod{grid-column:1;grid-row:1;min-height:0;order:initial}
  #queuePod{grid-column:1;grid-row:2;min-height:0;order:initial}
  #systemPod{grid-column:1;grid-row:3;min-height:0;order:initial}
  #agentsPod{display:none}
  .right-head{grid-column:3;grid-row:1}.overview{grid-column:3;grid-row:2;grid-template-columns:repeat(2,1fr)}
  .feed-title{display:none}.events{grid-column:3;grid-row:3;overflow:auto;max-height:none}
  .right-controls{display:none}
}
