/* Safety console: one screen. Map as canvas, tabbed panel on the right; only the panel scrolls. */
html:has(body.console) { background: #f6f8fb }
body.console { --paper: #f6f8fb; --ink: #141c3b; --muted: #5a6172; --rule: #e2e8f0;
  height: 100dvh; overflow: hidden; display: grid; grid-template-rows: 56px minmax(0, 1fr); background: var(--paper); color: var(--ink) }
.console :focus-visible { outline-color: var(--blue) }
.console input, .console select { background: #fff; border-color: var(--rule); color: var(--ink) }

/* top bar */
.bar { background: var(--asphalt); color: var(--line); display: flex; align-items: center; gap: 14px; padding: 0 16px 0 20px }
.bar .logo { height: 22px }
.divider { width: 1px; height: 22px; background: rgb(255 255 255 / .16) }
.product { font-size: 15px; letter-spacing: 3px; font-weight: 700 }
.views { display: inline-flex; background: rgb(255 255 255 / .07); border-radius: 10px; padding: 3px }
.views a { color: var(--fog); text-decoration: none; font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 8px }
.views a:hover { color: #fff }
.views a[aria-current] { background: rgb(255 255 255 / .12); color: #fff }
.chip { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 999px; background: rgb(255 255 255 / .07); margin-left: 8px }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--fog); flex: none }
.chip.on i { background: var(--ok); animation: beacon 1.8s infinite }
.chip.paused i { background: var(--amber) }
@keyframes beacon { 0% { box-shadow: 0 0 0 0 rgb(47 191 125 / .6) } 70%, 100% { box-shadow: 0 0 0 8px rgb(47 191 125 / 0) } }
.bar-end { margin-left: auto; display: flex; align-items: center; gap: 12px; position: relative }
.pop { position: absolute; top: calc(100% + 12px); right: 0; z-index: 20; width: 290px; background: #fff; color: var(--ink); border-radius: 14px; padding: 14px 16px; box-shadow: 0 12px 40px rgb(20 28 59 / .22); border: 1px solid var(--rule) }
.pop b { font-size: 15px } .pop p { margin: 4px 0 12px; font-size: 13px; color: var(--muted); line-height: 1.45 }
.pop-actions { display: flex; gap: 8px } .pop-actions .btn { flex: 1; min-height: 40px }
.btn.danger-solid { background: var(--red); color: #fff } .btn.danger-solid:hover:not(:disabled) { background: #e81f1f }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30; background: var(--asphalt); color: #fff; font-weight: 600; font-size: 14px; padding: 10px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgb(0 0 0 / .25) }
.iconbtn { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--fog) }
.iconbtn:hover { background: rgb(255 255 255 / .08); color: #fff }

/* layout */
.ops { display: grid; grid-template-columns: minmax(0, 1fr) 400px; min-height: 0 }
.canvas { position: relative; min-height: 0; background: #e9ecf2 }
.canvas #map { position: absolute; inset: 0 }
.canvas .nomap { color: var(--muted) } .canvas .nomap b { color: var(--ink) }
.follow { position: absolute; left: 16px; bottom: 16px; background: #fff; color: var(--ink); font-weight: 700; font-size: 14px; padding: 10px 16px; border-radius: 12px; box-shadow: 0 4px 16px rgb(20 28 59 / .16) }
.follow.on { background: var(--blue); color: #fff }

.panel { background: #fff; border-left: 1px solid var(--rule); display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0 }
.tabs { display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--rule) }
.tabs button { padding: 10px 12px 12px; font-weight: 700; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 6px; align-items: center }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--blue) }
.badge { background: var(--red); color: #fff; font-size: 11px; font-weight: 800; border-radius: 999px; padding: 1px 7px }
.tab { overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; scrollbar-width: thin }
.section { margin: 6px 0 -4px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 700 }
.empty { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0; padding: 8px 0 }

/* en vivo */
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--rule); border-radius: 14px; flex: none }
.mini-stats div { padding: 10px 12px; border-left: 1px solid var(--rule) } .mini-stats div:first-child { border-left: 0 }
.mini-stats b { display: block; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums }
.mini-stats small { color: var(--muted); font-size: 12px }
.mini-stats .hot b { color: var(--red) }

.unit { background: var(--asphalt); color: var(--line); border-radius: 16px; padding: 16px; display: grid; gap: 14px }
.unit-head { display: flex; align-items: center; gap: 10px }
.unit-head .shield { min-width: 46px; height: 32px; font-size: 13px }
.unit-head b { display: block; font-size: 15px } .unit-head small { color: var(--fog); font-size: 12px }
.unit-head .state { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--ok) } .unit-head .state.paused { color: var(--amber) }
.unit-speed { display: flex; align-items: center; gap: 14px }
.unit-speed b { font-size: 40px; font-weight: 700; letter-spacing: -1px; line-height: 1; font-variant-numeric: tabular-nums }
.unit-speed b small { font-size: 13px; color: var(--fog); font-weight: 500; letter-spacing: 0; margin-left: 4px }
.unit-speed.over b { color: var(--red) }
.unit-speed .note { font-size: 12px; color: var(--fog) }
.unit-speed.over .note { color: #ff7070; font-weight: 700 }
.unit .roundel { width: 48px; height: 48px; border-width: 5px; box-shadow: none; flex: none } .unit .roundel span { font-size: 17px }
.unit-next { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center; background: rgb(255 255 255 / .06); border-radius: 12px; padding: 10px; text-align: left; color: inherit; width: 100% }
.unit-next .pin { width: 26px; height: 26px; margin: 7px; box-shadow: none }
.unit-next small { color: var(--fog); font-size: 12px } .unit-next b { display: block; font-size: 14px; line-height: 1.3 }
.unit-next em { font-style: normal; color: var(--amber); font-weight: 700 }
.progress { height: 6px; background: rgb(255 255 255 / .1); border-radius: 3px; overflow: hidden } .progress i { display: block; height: 100%; background: var(--blue-2); border-radius: 3px; transition: width .6s }
.unit-foot { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12px; color: var(--fog) }
.idle-card { border: 1px dashed #cdd3df; border-radius: 16px; padding: 18px; display: grid; gap: 6px }
.idle-card b { font-size: 15px }
.idle-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45 }
.idle-card a { color: var(--blue); font-weight: 700; text-decoration: none; font-size: 14px }

.timeline { list-style: none; margin: 0; padding: 0; display: grid }
.timeline li { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--rule); font-size: 14px; line-height: 1.35 }
.timeline li:last-child { border-bottom: 0 }
.timeline .ic { width: 13px; height: 13px; margin: 4px 0 0 6px; transform: rotate(45deg); border-radius: 3px; border: 1.5px solid #111; background: var(--c, #fff) }
.timeline .ic.round { transform: none; border-radius: 50% }
.timeline .ic.dash { border-style: dashed }
.timeline small { display: block; color: var(--muted); font-size: 12px }
.timeline time { font-family: var(--mono); font-size: 11px; color: var(--muted); padding-top: 2px }

/* reportes */
.seg-light { display: inline-flex; align-self: flex-start; background: var(--paper); border-radius: 10px; padding: 3px; flex-wrap: wrap; flex: none }
.seg-light button { padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--muted) }
.seg-light button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgb(20 28 59 / .12) }
.rows { display: grid; gap: 2px; align-content: start }
.row { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; text-align: left; padding: 10px 8px; border-radius: 12px; width: 100% }
.row > span { min-width: 0 }
.row:hover { background: var(--paper) } .row.on { background: #eef0f8 }
.row .mini { width: 18px; height: 18px; margin: 6px; transform: rotate(45deg); border-radius: 4px; border: 1.5px solid #111; background: #fff }
.row .mini.pendiente { border-style: dashed } .row .mini.aprobado { background: var(--amber) } .row .mini.rechazado { background: #d5d9e3 }
.row b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.row small { color: var(--muted); font-size: 12px }
.row time { font-family: var(--mono); font-size: 11px; color: var(--muted) }
.detail { border: 1px solid var(--rule); border-radius: 14px; padding: 14px; flex: none }
.detail-head { display: flex; justify-content: space-between; gap: 8px; align-items: start }
.detail h3 { margin: 0 0 4px; font-size: 16px; line-height: 1.3 }
.detail .by { color: var(--muted); font-size: 12px }
.status { font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px; text-transform: capitalize; white-space: nowrap }
.status.pendiente { background: #fef4d6; color: #946a00 } .status.aprobado { background: #e6f4ec; color: #15734a } .status.rechazado { background: #eef0f4; color: var(--muted) }
.review { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px }
.review label { font-size: 12px; font-weight: 700; color: var(--muted); display: grid; gap: 4px }
.review .wide { grid-column: 1 / -1 }
.review input, .review select { min-height: 40px; padding: 6px 10px; font-size: 14px }
.review textarea { font: inherit; font-size: 14px; line-height: 1.4; color: var(--ink); background: #fff; border: 1px solid var(--rule); border-radius: 10px; padding: 8px 10px; resize: vertical; width: 100% }
.ghost-field { position: relative; display: block }
.ghost-field textarea { padding-right: 52px }
.ghost-field textarea::placeholder { color: #9aa2b8; font-style: italic }
.kbd { position: absolute; right: 8px; bottom: 10px; font: 600 11px/1 var(--mono); color: var(--blue); background: #fff; border: 1px solid #c9d1f5; border-bottom-width: 2px; border-radius: 6px; padding: 4px 7px }
.kbd:hover { background: var(--brand-tint, #e9ecfb) }
.suggest kbd { font: 600 11px/1 var(--mono); border: 1px solid #c9d1f5; border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; background: #fff; color: var(--blue) }
.form-error { margin: 0; color: #c81e1e; font-size: 13px }
.suggest { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--brand-tint, #e9ecfb); color: #2a3470; font-size: 13px; line-height: 1.4 }
.suggest .spark { color: var(--blue); font-size: 14px; line-height: 1.3 }
.suggest b { color: var(--blue) }
.suggest.loading span:last-child { background: linear-gradient(90deg, #2a3470 30%, #8f9ce8 50%, #2a3470 70%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.4s linear infinite }
@keyframes shimmer { to { background-position: -200% 0 } }
.review .btn { min-height: 42px }
.detail .fine { color: var(--muted); margin-top: 10px }

/* rutograma */
.risks { display: grid; gap: 8px }
.risk { display: grid; grid-template-columns: 34px 1fr; gap: 10px; text-align: left; padding: 12px; border: 1px solid var(--rule); border-radius: 14px; width: 100% }
.risk:hover { border-color: #c9d0de; background: #fafbfd }
.risk .pin { width: 22px; height: 22px; margin: 5px; box-shadow: none; outline-width: 1.5px } .risk .pin svg { width: 13px; height: 13px }
.risk b { display: block; font-size: 14px; line-height: 1.3 }
.risk p { margin: 4px 0 6px; font-size: 13px; color: #434a5e; line-height: 1.4 }
.risk .facts { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted) }
.risk .facts span { white-space: nowrap }
.risk .facts i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px }
.risk .today { color: var(--red); font-weight: 700; font-size: 12px; margin-top: 4px }
.risk .origin { color: var(--blue); font-size: 12px; font-weight: 600; margin-top: 4px }
.risk.restricted { background: #f6f7fa }

/* narrow: panel becomes a bottom sheet under the map */
@media (max-width: 900px) {
  .bar { gap: 10px; padding: 0 12px } .bar .logo { height: 18px } .divider, .tag { display: none }
  .chip { margin-left: 0; font-size: 12px; padding: 4px 10px; max-width: 46vw; overflow: hidden; white-space: nowrap; text-overflow: ellipsis }
  .ops { grid-template-columns: minmax(0, 1fr); grid-template-rows: 42% minmax(0, 1fr) }
  .product, .views a:not([aria-current]) { display: none }
  .bar-end { gap: 4px }
  .panel { border-left: 0; border-radius: 20px 20px 0 0; margin-top: -16px; position: relative; z-index: 2; box-shadow: 0 -8px 24px rgb(20 28 59 / .12) }
}

.facts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 10px 0 0 }
.facts-grid div { background: var(--paper); border-radius: 10px; padding: 7px 10px }
.facts-grid dt { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .6px }
.facts-grid dd { margin: 2px 0 0; font-size: 13px; font-weight: 600; text-transform: capitalize }
.said { margin-top: 10px; font-size: 13px } .said summary { cursor: pointer; color: var(--blue); font-weight: 600 } .said p { margin: 6px 0 0; color: #434a5e; line-height: 1.45 }
