#app { display: grid; grid-template-columns: minmax(0, 1fr) 440px; grid-template-rows: minmax(0, 1fr) 260px; gap: 12px; padding: 12px; height: calc(100vh - 53px); }
.mapwrap { display: flex; flex-direction: column; min-height: 0; }
.mapwrap svg { flex: 1; width: 100%; min-height: 0; display: block; }
.side { grid-row: 1 / span 2; grid-column: 2; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.bottom { display: flex; flex-direction: column; min-height: 0; }
.legend { font-size: 11.5px; color: var(--muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: -5px; }
.s-moving { background: var(--amber); } .s-docked { background: var(--info); } .s-idle { background: var(--idle); }
.s-warn { background: #e58a2b; } .s-bad { background: var(--bad); } .s-off { background: transparent; border: 1px dashed var(--muted); }

/* mapa */
#map .zone { fill: #1b2025; stroke: #2c333a; stroke-width: .08; }
#map .zone.PRODUCCION { fill: #1d2228; } #map .zone.ALMACEN { fill: #1a2126; } #map .zone.EXPEDICIONES { fill: #1f2124; } #map .zone.MANTENIMIENTO { fill: #1c1f22; }
#map .corr { fill: #14181b; }
#map .zname { fill: #4a5560; font-size: 1.15px; font-weight: 700; letter-spacing: .12px; text-transform: uppercase; }
#map .dest { fill: #0d1013; stroke: #56616b; stroke-width: .1; cursor: pointer; }
#map .dest.dock { stroke: var(--info); }
#map .dest:hover, #map .dest.pick { stroke: var(--amber); stroke-width: .18; }
#map .dlabel { fill: #7d8893; font-size: .75px; font-family: var(--mono); pointer-events: none; }
#map .grid line { stroke: #1a1f24; stroke-width: .04; }
#map .rb { transition: transform 1s linear; cursor: pointer; }
#map .rb .body { stroke: #0d1013; stroke-width: .12; }
#map .rb.sel .ring { stroke: var(--text); stroke-width: .12; fill: none; }
#map .rb.stale { opacity: .6; }
#map .rb.offline .body { fill: transparent !important; stroke: var(--muted); stroke-dasharray: .3 .2; }
#map .rlabel { transition: transform 1s linear; pointer-events: none; }
#map .rlabel text { font-size: .95px; font-family: var(--mono); fill: var(--text); paint-order: stroke; stroke: #0d1013; stroke-width: .25; }
#map .rlabel text.warn { fill: var(--bad); }
#map .route { stroke: var(--amber); stroke-width: .1; stroke-dasharray: .4 .3; fill: none; opacity: .7; }

/* robots */
.robots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.rcard { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; cursor: pointer; display: grid; gap: 5px; text-align: left; }
.rcard:hover { border-color: var(--line-2); }
.rcard.sel { border-color: var(--amber); box-shadow: inset 0 0 0 1px var(--amber); }
.rcard .t { display: flex; align-items: center; gap: 6px; font-weight: 600; flex-wrap: wrap; row-gap: 4px; }
.rcard .t .id { font-family: var(--mono); font-size: 12px; color: var(--muted); font-weight: 400; }
.rcard .st { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.rcard .bar { height: 4px; }

/* detalle */
.detail { flex: 1; overflow: auto; min-height: 0; }
.detail section { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.detail section:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 3px 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12.5px; }
.alert { font-size: 12.5px; padding: 6px 8px; border-radius: 5px; border-left: 3px solid var(--info); background: #12171b; margin-top: 6px; }
.alert.warning { border-left-color: var(--warn); } .alert.critical { border-left-color: var(--bad); }
.alert code { font-size: 11px; }
.mission { background: #12171b; border: 1px solid var(--line); border-radius: 6px; padding: 10px; display: grid; gap: 6px; }
.hist { font-size: 12px; display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.hist li { display: grid; grid-template-columns: 64px 92px 1fr; gap: 6px; }
.hist time { color: var(--dim); font-family: var(--mono); }
.cfg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cfg label.field.full { grid-column: 1 / -1; }
.cfg .hint { font-size: 11px; color: var(--dim); text-transform: none; letter-spacing: 0; }
.mlist { width: 100%; font-size: 12px; }
.mlist td { padding: 4px 6px; }

/* pestañas inferiores */
.tabs { gap: 4px !important; padding: 6px 10px !important; }
.tab { background: transparent; border-color: transparent; color: var(--muted); }
.tab.on { color: var(--text); border-color: var(--line-2); background: var(--panel-2); }
.tabbody { overflow: auto; flex: 1; min-height: 0; font-size: 12.5px; }
.ev { display: grid; grid-template-columns: 78px 210px 1fr; gap: 10px; padding: 4px 12px; border-bottom: 1px solid #1d2227; }
.ev time { font-family: var(--mono); color: var(--dim); }
.ev .ty { font-family: var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev.mission\.status_changed .ty { color: var(--amber); }
.ev.robot\.connection_lost .ty, .ev.robot\.emergency_stop .ty, .ev.robot\.battery_depleted .ty { color: var(--bad); }
.ev.robot\.connection_restored .ty { color: var(--ok); }
.req { border-bottom: 1px solid #1d2227; }
.req summary { display: grid; grid-template-columns: 78px 54px 1fr 50px 60px; gap: 10px; padding: 4px 12px; cursor: pointer; list-style: none; font-family: var(--mono); }
.req summary::-webkit-details-marker { display: none; }
.req .s2 { color: var(--ok); } .req .s4 { color: var(--warn); } .req .s5 { color: var(--bad); }
.req pre { margin: 4px 12px 10px; max-height: 260px; font-size: 11.5px; }
.small { font-size: 12px; }

@media (max-width: 1100px) {
  #app { grid-template-columns: 1fr; grid-template-rows: auto auto 300px; height: auto; }
  .side { grid-row: auto; grid-column: auto; }
  .mapwrap svg { height: 52vh; }
}

#map g[data-dest] rect + .dlabel { font-size: .55px; }
