/* ORCA AgroAI · estilos de la plataforma. Tipografía Inter (OFL, servida localmente), paleta sobria, modo claro y oscuro. */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/vendor/fonts/inter-latin-wght.woff2") format("woff2");
}
:root {
  --bg: #f5f7fa; --card: #ffffff; --text: #101828; --text-2: #344054; --muted: #667085; --faint: #98a2b3;
  --line: #e4e7ec; --line-2: #f2f4f7; --soft: #f8fafc; --hover: #f5f8ff;
  --brand: #175cd3; --brand-2: #1849a9; --brand-soft: #eff4ff;
  --ok: #067647; --ok-soft: #ecfdf3; --warn: #b54708; --warn-soft: #fffaeb; --bad: #b42318; --bad-soft: #fef3f2;
  --live: #1570ef; --done: #12a05c; --cut: #98a2b3;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05); --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --radius: 12px; --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
/* tema: el del equipo, salvo que la persona elija otro con el botón sol/luna (data-theme en <html>) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1018; --card: #121926; --text: #f2f4f7; --text-2: #d0d5dd; --muted: #98a2b3; --faint: #667085;
    --line: #232c3b; --line-2: #1a2230; --soft: #182131; --hover: #17233a;
    --brand: #4e8cff; --brand-2: #78a6ff; --brand-soft: rgba(78, 140, 255, .12);
    --ok: #47cd89; --ok-soft: rgba(71, 205, 137, .12); --warn: #fdb022; --warn-soft: rgba(253, 176, 34, .12);
    --bad: #f97066; --bad-soft: rgba(249, 112, 102, .12); --live: #53b1fd; --done: #32b76e; --cut: #667085;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 16px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1018; --card: #121926; --text: #f2f4f7; --text-2: #d0d5dd; --muted: #98a2b3; --faint: #667085;
  --line: #232c3b; --line-2: #1a2230; --soft: #182131; --hover: #17233a;
  --brand: #4e8cff; --brand-2: #78a6ff; --brand-soft: rgba(78, 140, 255, .12);
  --ok: #47cd89; --ok-soft: rgba(71, 205, 137, .12); --warn: #fdb022; --warn-soft: rgba(253, 176, 34, .12);
  --bad: #f97066; --bad-soft: rgba(249, 112, 102, .12); --live: #53b1fd; --done: #32b76e; --cut: #667085;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 16px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base ---- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body { margin: 0; font: 400 14px/1.5 var(--font); background: var(--bg); color: var(--text);
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body.noscroll { overflow: hidden; }
h1, h2, h3 { margin: 0; color: var(--text); letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 650; line-height: 1.25; letter-spacing: -.02em; }
h2 { font-size: 15px; font-weight: 600; line-height: 1.4; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0; }
a { color: var(--brand); }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; font-weight: 400; }
.error { color: var(--bad); min-height: 1.2em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.link { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; text-decoration: none; font: inherit; }
code { font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* formularios */
button { font: inherit; cursor: pointer; }
button:not([class]) { background: var(--brand); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; font-weight: 500; }
input, select, textarea { font: inherit; font-size: 14px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--text); box-shadow: var(--shadow); min-height: 38px; }
input:not([type=checkbox]):not([type=file]), select { height: 38px; }
input[type=file] { min-height: 0; padding: 6px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input:disabled, select:disabled, textarea:disabled { background: var(--soft); color: var(--muted); box-shadow: none; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
label.check input { min-height: 0; width: 16px; height: 16px; accent-color: var(--brand); box-shadow: none; }

/* botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 14px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text-2); font-size: 14px; font-weight: 550;
  text-decoration: none; box-shadow: var(--shadow); white-space: nowrap; transition: background .12s, border-color .12s, color .12s; }
.btn:hover { background: var(--soft); color: var(--text); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn svg { flex: none; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--muted); padding: 0; }
.icon-btn:hover { background: var(--soft); color: var(--text); border-color: var(--line); }
.icon-btn.sm { width: 32px; height: 32px; }

/* etiquetas de estado */
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 550; line-height: 20px; padding: 0 9px;
  border-radius: 999px; background: var(--line-2); color: var(--text-2); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.live { background: var(--brand-soft); color: var(--live); }
.badge { font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: var(--line-2); color: var(--text-2); }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.info { background: var(--brand-soft); color: var(--brand); }

/* ------------------------------------------------------- barra superior ---- */
.topbar { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: saturate(180%) blur(8px); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1440px; margin: 0 auto; height: 60px; padding: 0 28px; display: flex; align-items: center; gap: 28px; }
.app-brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; flex: none; }
.app-brand .logo { font-size: 17px; font-weight: 300; letter-spacing: .01em; }
.app-brand .logo b { font-weight: 800; }
.app-sep { width: 1px; height: 20px; background: var(--line); }
.app-prod { font-size: 13px; font-weight: 500; color: var(--muted); }
.topbar nav { display: flex; gap: 4px; flex: 1; height: 100%; }
.topbar nav a { display: flex; align-items: center; padding: 0 12px; color: var(--muted); text-decoration: none; font-weight: 500;
  font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.topbar nav a:hover { color: var(--text); }
.topbar nav a.active { color: var(--text); border-bottom-color: var(--brand); font-weight: 600; }
.user { display: flex; align-items: center; gap: 10px; flex: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft);
  color: var(--brand); font-size: 13px; font-weight: 650; }
.user-t { display: grid; line-height: 1.25; }
.user-t b { font-size: 13px; font-weight: 600; } .user-t small { font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------- páginas ---- */
main { max-width: 1440px; margin: 0 auto; padding: 28px 28px 56px; }
.view { display: grid; gap: 20px; align-content: start; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-sub { margin-top: 4px; color: var(--muted); font-size: 14px; max-width: 820px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.date-ctl { display: flex; gap: 8px; }
.kicker { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--brand); margin-bottom: 4px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 13px; }
.back:hover { color: var(--text); }
.sec-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 18px 0 8px; }

/* tarjetas */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head.wrap { flex-wrap: wrap; }
.card-head.pad { padding: 20px 20px 0; }
.card-sub { margin-top: 2px; font-size: 13px; color: var(--muted); }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.grid-detail { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.empty { display: grid; justify-items: center; gap: 4px; padding: 28px 12px; text-align: center; color: var(--muted); }
.empty svg { color: var(--ok); margin-bottom: 4px; } .empty b { color: var(--text-2); font-weight: 600; } .empty span { font-size: 13px; }

/* indicadores */
.kpi-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.kpi-row.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
  display: grid; gap: 6px; min-width: 0; }
.kpi-l { font-size: 13px; font-weight: 500; color: var(--muted); }
.kpi-v { font-size: 28px; font-weight: 650; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-s { font-size: 13px; color: var(--muted); }
.kpi-s.up { color: var(--ok); } .kpi-s.down { color: var(--bad); }

/* segmentado */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--line-2); border: 1px solid var(--line); flex: none; }
.seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 550; padding: 5px 11px; border-radius: 7px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }

/* tablas */
.table-wrap { overflow-x: auto; position: relative; }   /* relative: lo oculto (.sr) no escapa y ensancha la página en el celular */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { font-size: 12px; font-weight: 550; color: var(--muted); text-align: left; background: var(--soft); padding: 10px 14px;
  border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); white-space: nowrap; }
.card.flush .table thead tr:first-child th { border-top: 0; }
.card-head.pad + .table-wrap .table th { border-top: 1px solid var(--line); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); white-space: nowrap; color: var(--text-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table td b, .table td.strong { color: var(--text); font-weight: 600; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--hover); }
.table tr.sel td { background: var(--brand-soft); }
.table tr.warnrow td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.table td.act, .table th.act { width: 40px; text-align: right; color: var(--faint); }
.table td.ell { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.tnum { font-variant-numeric: tabular-nums; }
#detail { display: grid; gap: 20px; }
.table-foot { padding: 12px 16px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line-2); }
.toolbar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.toolbar .grow { flex: 1; }
.toolbar select { min-width: 200px; }

/* ---------------------------------------------------- panel: torres en vivo ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.tiles.single { grid-template-columns: minmax(0, 520px); }
.tile { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.tile.has-alarm { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.media { position: relative; aspect-ratio: 4 / 3; background: #0d1320; overflow: hidden; }
.media.big { border-radius: 10px; }
.media-video, .media-over { position: absolute; inset: 0; }
.media-video img { width: 100%; height: 100%; object-fit: contain; display: block; }
.media-over { pointer-events: none; }
/* modelo 3D dentro de la tarjeta del carro (en espera, o con el botón «3D» durante el carguío) */
.media-3d { position: absolute; inset: 0; display: none; }
.media-3d.on { display: grid; place-items: center; background: radial-gradient(ellipse at 50% 40%, #1a2636 0%, #0d1320 75%); }
.media-3d .m3d-view { position: absolute; inset: 0; height: auto; border-radius: 0; background: none; }
.media-tr { position: absolute; top: 12px; right: 12px; display: flex; align-items: center; gap: 8px; }
.media-3d canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; cursor: grab; }
.media-3d canvas:active { cursor: grabbing; }
.media-3d .pig3d-tag { background: rgba(13, 19, 32, .82); color: #e8eef6; border: 1px solid #3a4a5a; font-size: 11px; }
.media-3d .pig3d-tag i { color: #8d99ab; }
.m3d-wait { color: #8d99ab; font-size: 13px; }
.m3d-cap { position: absolute; left: 12px; bottom: 12px; display: grid; gap: 1px; padding: 6px 10px; border-radius: 10px;
  background: rgba(8, 14, 24, .72); backdrop-filter: blur(6px); color: #e8eef6; max-width: calc(100% - 24px); }
.m3d-cap b { font-size: 12px; font-weight: 600; } .m3d-cap span { font-size: 11px; color: #a9b4c4; }
.m3d-tog { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px;
  background: rgba(8, 14, 24, .72); backdrop-filter: blur(6px); pointer-events: auto; }
.m3d-tog button { border: 0; background: none; color: #cfd6e0; font: inherit; font-size: 12px; font-weight: 600; padding: 4px 12px;
  border-radius: 999px; cursor: pointer; box-shadow: none; }
.m3d-tog button.on { background: #1e88e5; color: #fff; }
.m3d-tog button:focus-visible { outline: 2px solid #90caf9; outline-offset: 1px; }
.media-ph { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 6px; padding: 20px; color: #cfd6e0;
  background: radial-gradient(ellipse at center, #182235 0%, #0d1320 75%); }
.media-ph b { font-weight: 600; font-size: 15px; } .media-ph span { font-size: 13px; color: #8d99ab; max-width: 280px; }
.media-ph.off b { color: #fda29b; }
.media-badge { position: absolute; top: 12px; left: 12px; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; background: rgba(13, 19, 32, .72); color: #fff; backdrop-filter: blur(4px); }
.media-badge i { width: 7px; height: 7px; border-radius: 50%; background: #98a2b3; }
.media-badge.s-load { background: #d92d20; } .media-badge.s-load i { background: #fff; animation: blink 1.4s ease-in-out infinite; }
.media-badge.s-wait i { background: #47cd89; } .media-badge.s-off i { background: #f97066; }
.media-alarm { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: #fdb022; color: #3d2600; }
@keyframes blink { 50% { opacity: .35; } }
.tile-body { padding: 14px 16px 16px; display: grid; gap: 12px; }
.tile-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.tile-head h3 { font-size: 15px; } .tile-head p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.stats3, .stats2, .stats4 { display: grid; gap: 8px; }
.stats3 { grid-template-columns: repeat(3, 1fr); } .stats2 { grid-template-columns: repeat(2, 1fr); } .stats4 { grid-template-columns: repeat(4, 1fr); }
.stats3 > div, .stats2 > div, .stats4 > div { background: var(--soft); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; display: grid; gap: 2px; min-width: 0; }
.stats3 b, .stats2 b, .stats4 b { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats2 b, .stats4 b { font-size: 20px; }
.stats3 span, .stats2 span, .stats4 span { font-size: 12px; color: var(--muted); }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tab { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text-2);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 500; }
.tab i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.tab.s-load i { background: #d92d20; } .tab.s-wait i { background: var(--done); } .tab.s-off i { background: var(--cut); }
.tab.on { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.one { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(220px, 1fr); gap: 20px; align-items: start; }
.one-side { display: grid; gap: 16px; align-content: start; }
.one-side h3 { font-size: 18px; }
.one-recent { display: grid; gap: 4px; }
.one-rl { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; column-gap: 10px; row-gap: 2px; align-items: baseline; text-align: left;
  background: none; border: 0; border-top: 1px solid var(--line); padding: 8px 4px; font: inherit; color: var(--text-2); cursor: pointer; border-radius: 6px; }
.one-rl:hover { background: rgba(127,127,127,.08); }
.one-rl b { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.one-rl .strong { color: var(--text); font-weight: 600; }
.one-rl .muted { grid-column: 2 / 4; font-size: 12px; text-align: left; }
.mini-title { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 48px; }
.spark span { flex: 1; background: var(--live); border-radius: 2px 2px 0 0; min-height: 3px; }
.spark span.z { background: var(--line); }

/* ------------------------------------------------------------- alarmas ---- */
.alarms { display: grid; gap: 8px; max-height: 520px; overflow: auto; }
.alarm { display: grid; grid-template-columns: 4px minmax(0, 1fr); gap: 4px 12px; padding: 12px 12px 12px 0; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card); overflow: hidden; }
.alarm > i { grid-row: span 2; align-self: stretch; background: var(--warn); }
.alarm.hi { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); background: var(--bad-soft); } .alarm.hi > i { background: var(--bad); }
.alarm.info > i { background: var(--brand); }
.alarm.seen { background: var(--card); } .alarm.seen > i { background: var(--line); } .alarm.seen .alarm-k { color: var(--muted); }
.alarm-k { font-weight: 600; font-size: 14px; } .alarm-d, .alarm-s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.alarm-b { display: flex; gap: 6px; grid-column: 2; }
.now { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .03em; color: #fff; background: var(--bad); padding: 1px 6px; border-radius: 4px; vertical-align: 1px; }

/* -------------------------------------------- actividad del día (camiones) ---- */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; }
.legend i.done { background: var(--done); } .legend i.live { background: var(--live); } .legend i.cut { background: var(--cut); }
.legend i.off { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--bad) 40%, transparent) 0 3px, transparent 3px 6px); border: 1px solid color-mix(in srgb, var(--bad) 55%, transparent); }
.p-timeline { overflow-x: auto; }
.p-tl-inner { min-width: 820px; display: grid; gap: 8px; }
.p-axis { display: grid; grid-template-columns: 140px 1fr; }
.p-axis > div { position: relative; height: 20px; }
.p-axis > div > span { position: absolute; top: 2px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.p-lane-row { display: grid; grid-template-columns: 140px 1fr; align-items: center; }
.p-lane-name { font-weight: 600; font-size: 13px; line-height: 1.25; padding-right: 12px; overflow: hidden; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.p-lane { position: relative; height: 88px; background: var(--soft); border: 1px solid var(--line-2); border-radius: 10px; }
.p-gl { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); opacity: .7; }
.p-road { position: absolute; left: 0; right: 0; bottom: 14px; border-top: 2px dashed var(--line); }
.p-off { position: absolute; top: 4px; bottom: 4px; border-radius: 8px; display: grid; place-items: center; overflow: hidden;
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--bad) 14%, transparent) 0 6px, transparent 6px 12px);
  border: 1px dashed color-mix(in srgb, var(--bad) 50%, transparent); }
.p-off span { font-size: 12px; font-weight: 600; color: var(--bad); white-space: nowrap; }
.p-nowline { position: absolute; top: -4px; bottom: -4px; width: 2px; background: #d92d20; z-index: 3; }
.p-nowtag { position: absolute; top: 0; transform: translateX(-50%); font-size: 11px !important; font-weight: 650; color: #fff !important; background: #d92d20; padding: 0 6px; border-radius: 4px; }
.p-truck { position: absolute; top: 2px; bottom: 6px; min-width: 64px; padding: 0; background: none; border: 0; color: inherit; cursor: pointer; z-index: 2; }
.p-truck:hover .p-tr-box, .p-truck:focus-visible .p-tr-box { filter: brightness(1.08); box-shadow: 0 0 0 2px var(--brand); }
.p-tr-time { position: absolute; top: 0; left: 0; font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.p-tr-box { position: absolute; left: 0; right: 18px; top: 17px; bottom: 12px; border-radius: 6px 3px 3px 6px; display: grid; place-content: center;
  text-align: center; color: #fff; line-height: 1.05; background: var(--done); }
.p-tr-box b { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; } .p-tr-box small { font-size: 10px; opacity: .92; }
.p-tr-cab { position: absolute; right: 0; width: 16px; top: 31px; bottom: 12px; border-radius: 3px 7px 3px 2px; background: var(--done); filter: brightness(.82); }
.p-tr-cab::after { content: ""; position: absolute; top: 4px; left: 3px; right: 3px; height: 7px; border-radius: 2px 4px 1px 1px; background: rgba(255,255,255,.65); }
.p-wh { position: absolute; bottom: 5px; width: 12px; height: 12px; border-radius: 50%; background: #263238; border: 3px solid #98a2b3; }
.p-wh.w1 { left: 8%; } .p-wh.w2 { left: calc(92% - 40px); } .p-wh.w3 { right: 2px; }
.p-truck.live .p-tr-box, .p-truck.live .p-tr-cab { background: var(--live); }
.p-truck.live .p-tr-box { animation: p-pulse 1.6s ease-in-out infinite; }
.p-truck.cut .p-tr-box, .p-truck.cut .p-tr-cab { background: var(--cut); }
.p-truck.sm .p-tr-box { top: 0; bottom: 9px; right: 13px; display: flex; align-items: center; justify-content: center; gap: 5px; border-radius: 4px 2px 2px 4px; }
.p-truck.sm .p-tr-box b { font-size: 13px; } .p-truck.sm .p-tr-box small { font-size: 9px; }
.p-truck.sm .p-tr-cab { width: 12px; top: 9px; bottom: 9px; border-radius: 2px 5px 2px 1px; }
.p-truck.sm .p-tr-cab::after { top: 3px; left: 2px; right: 2px; height: 5px; }
.p-truck.sm .p-wh { width: 9px; height: 9px; bottom: 0; border-width: 2px; }
.p-truck.sm .p-wh.w2 { left: calc(92% - 30px); }
@keyframes p-pulse { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--live) 25%, transparent); } }
@media (prefers-reduced-motion: reduce) { .p-truck.live .p-tr-box, .media-badge.s-load i { animation: none; } }

/* ------------------------------------------------------ cerdos por día ---- */
.trend { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 28px; align-items: end; }
.bars-chart { display: flex; align-items: flex-end; height: 180px; border-bottom: 1px solid var(--line); }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; min-width: 0; height: 100%; }
.bar { width: 100%; max-width: 56px; background: color-mix(in srgb, var(--brand) 30%, transparent); border-radius: 4px 4px 0 0; }
.bar.today { background: var(--brand); }
.bar-v { font-size: 12px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.bars-axis { display: flex; margin-top: 6px; }
.bars-axis span { flex: 1; text-align: center; font-size: 12px; color: var(--muted); white-space: nowrap; min-width: 0; }
.trend-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.trend-stats > div { background: var(--soft); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; display: grid; gap: 2px; }
.trend-stats b { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; } .trend-stats span { font-size: 12px; color: var(--muted); }

/* -------------------------------------------------- detalle lateral ---- */
.drawer { position: fixed; inset: 0; z-index: 20; background: rgba(9, 14, 23, .45); display: flex; justify-content: flex-end; animation: fade .15s ease-out; }
.drawer-panel { position: relative; width: min(820px, 100%); height: 100%; overflow: auto; background: var(--bg); padding: 28px 28px 40px;
  box-shadow: var(--shadow-lg); animation: slide .2s ease-out; }
@keyframes fade { from { opacity: 0; } } @keyframes slide { from { transform: translateX(24px); opacity: .6; } }
.drawer-close { position: absolute; top: 18px; right: 18px; background: var(--card); border-color: var(--line); }
.dr-title { font-size: 24px; font-weight: 650; letter-spacing: -.02em; }
.dr-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.p-dr-body .stats4 { margin-bottom: 4px; }
.p-dr-body .stats4 > div { background: var(--card); border-color: var(--line); }
.drawer .pig3d-card { margin-top: 20px; }
.drawer .pig3d-body { grid-template-columns: 1fr; } .drawer .pig3d { height: 360px; }
.verdict { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-radius: 10px; padding: 14px 16px;
  border: 1px solid var(--line); background: var(--card); margin: 12px 0; }
.verdict b { font-size: 15px; font-weight: 650; } .verdict span { font-size: 13px; color: var(--muted); }
.verdict.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); } .verdict.ok b { color: var(--ok); }
.verdict.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, transparent); } .verdict.bad b { color: var(--bad); }
.verdict.live { background: var(--brand-soft); } .verdict.live b { color: var(--live); }
.guia-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.guia-form input { width: 180px; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; color: var(--text-2); }
.plain-list li:last-child { border-bottom: 0; }
.plain-list .t { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 10px; }
.plain-list.scroll { max-height: 360px; overflow: auto; }

/* ---------------------------------------------------- ficha del carguío ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span2 { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; gap: 12px; }
.grid-detail .card .btn { margin: 0 6px 6px 0; }
.tech summary { cursor: pointer; font-weight: 600; color: var(--text-2); }
.tech[open] summary { margin-bottom: 12px; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 90px; }
.bars div { background: var(--brand); flex: 1; min-width: 3px; border-radius: 2px 2px 0 0; }
.files { font-size: 13px; word-break: break-all; color: var(--muted); }

/* ------------------------------------------------------- administración ---- */
.form-card { display: grid; gap: 14px; }
.form-row3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.keybox { background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); padding: 14px; border-radius: 10px; white-space: pre-wrap; word-break: break-all; font-size: 13px; }
#dev-config { max-width: 640px; }
#cfg-form, #mdl-form, #prog-form { display: grid; gap: 12px; }
#model-form progress { width: 160px; }

/* -------------------------------------------------------------- adaptable ---- */
@media (max-width: 1240px) { .kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid-main { grid-template-columns: 1fr; } }
@media (max-width: 960px) {
  .topbar-in { padding: 0 16px; gap: 14px; } .app-sep, .app-prod, .user-t { display: none; }
  main { padding: 20px 16px 40px; } .grid-detail, .one, .trend { grid-template-columns: 1fr; }
  .kpi-row.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .topbar-in { height: auto; flex-wrap: wrap; padding: 10px 16px 0; } .topbar nav { order: 3; flex-basis: 100%; overflow-x: auto; height: 42px; }
  /* indicadores en una franja que se desliza de lado: los carros en vivo quedan arriba, a la vista */
  .kpi-row, .kpi-row.four { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; }
  .kpi-row::-webkit-scrollbar { display: none; }
  .kpi-row > .kpi { flex: 0 0 44%; scroll-snap-align: start; padding: 12px 14px; }
  .stats4 { grid-template-columns: repeat(2, 1fr); }
  .p-lane-row { grid-template-columns: 92px 1fr; }
  .form-grid { grid-template-columns: 1fr; } .drawer-panel { padding: 20px 16px 32px; }
  h1, .dr-title { font-size: 21px; } .kpi-v { font-size: 24px; }
}

/* ---------------------------------------------------------- ORCA AgroAI: página de inicio ---- */
.landing { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr); }
.brand-panel { position: relative; overflow: hidden; color: #e8f1f8; padding: 40px 56px; display: flex; flex-direction: column;
  background-color: #08141f;
  /* imagen real del sistema (siluetas pintadas por cerdo) bajo una capa oscura semitransparente: el texto se lee y se ve el conteo */
  background-image: url("/static/img/conteo_segmentacion.jpg");
  background-size: cover; background-position: center; }
.brand-logo { display: flex; gap: 14px; align-items: center; }
.brand-name { font-size: 24px; letter-spacing: .01em; font-weight: 300; }
.brand-name b { font-weight: 800; color: #7df0bf; }
.brand-sub { font-size: 13px; color: #9fb6c8; }
.brand-hero { margin: auto 0; max-width: 620px; position: relative; z-index: 1; padding: 32px 0; text-shadow: 0 2px 12px rgba(0, 0, 0, .55); }
.brand-hero h1 { font-size: clamp(32px, 4.2vw, 54px); line-height: 1.05; margin: 0 0 14px; letter-spacing: -.02em; font-weight: 800; color: #fff; }  /* el panel de marca es siempre oscuro (video), en ambos modos */
.brand-es { font-size: 18px; color: #bcd3e3; margin: 0 0 14px; }
.brand-desc { color: #b4c8d6; margin: 0; max-width: 540px; }
.brand-foot { font-size: 12px; color: #8aa3b6; position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.login-panel { position: relative; display: grid; place-items: center; padding: 32px 24px; overflow: hidden;
  background: radial-gradient(700px 420px at 85% 0%, rgba(30, 136, 229, .10), transparent 70%),
              radial-gradient(600px 400px at 10% 100%, rgba(61, 220, 151, .10), transparent 70%), var(--bg); }
.login-panel::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 40px 40px; mask-image: radial-gradient(ellipse at center, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 0%, transparent 70%); }
.login-wrap { position: relative; width: 100%; max-width: 420px; display: grid; gap: 18px; }
.login-card { display: grid; gap: 10px; padding: 36px 34px 28px; border-radius: 18px; background: var(--card);
  border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(15, 30, 45, .04), 0 24px 60px rgba(15, 30, 45, .10); }
.login-head { text-align: center; margin-bottom: 14px; }
.login-kicker { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: #1e88e5; background: rgba(30, 136, 229, .10); padding: 4px 10px; border-radius: 999px; margin-bottom: 12px; }
.login-head h2 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.01em; }
.login-head p { margin: 0; color: var(--muted); font-size: 14px; }
.google-btn { position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 14px;
  border-radius: 12px; background: var(--card); color: var(--text); border: 1px solid var(--line); font-weight: 600; font-size: 15px;
  text-decoration: none; box-shadow: 0 1px 2px rgba(15, 30, 45, .05);
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease; }
.google-btn:hover { transform: translateY(-1px); border-color: rgba(30, 136, 229, .45); background: rgba(30, 136, 229, .04);
  box-shadow: 0 8px 22px rgba(15, 30, 45, .10); }
.google-btn:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(15, 30, 45, .08); }
.google-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(30, 136, 229, .25); border-color: #1e88e5; }
.g-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 1px rgba(15, 30, 45, .08); }
.g-logo { width: 17px; height: 17px; }
.login-or { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 12px; text-transform: uppercase;
  letter-spacing: .12em; margin: 4px 0; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--line)); }
.login-or::after { background: linear-gradient(90deg, var(--line), transparent); }
.login-card > label[for] { font-size: 13px; color: var(--muted); margin-top: 6px; display: block; }
.login-card input[type=text], .login-card input:not([type]), .login-card input[type=password] { width: 100%; padding: 12px 14px; font-size: 15px; border-radius: 10px; }
.login-card input:focus { outline: none; border-color: #1e88e5; box-shadow: 0 0 0 3px rgba(30, 136, 229, .18); }
.pw-field { position: relative; }
.pw-field input { padding-right: 46px !important; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; padding: 6px;
  color: var(--muted); cursor: pointer; border-radius: 8px; line-height: 0; }
.pw-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.pw-toggle.on, .pw-toggle:hover { color: #1e88e5; }
.remember { display: flex !important; align-items: center; gap: 8px; font-size: 13px; color: var(--text) !important; margin: 8px 0 4px; cursor: pointer; }
.remember input { width: 16px; height: 16px; accent-color: #1e88e5; }
.remember .muted { font-size: 12px; }
#login-btn { padding: 13px; font-size: 15px; font-weight: 600; border-radius: 10px; margin-top: 4px;
  background: linear-gradient(135deg, #1565c0, #1e88e5); box-shadow: 0 8px 20px rgba(21, 101, 192, .25); }
#login-btn:disabled { opacity: .7; cursor: wait; }
.login-card .error:empty { display: none; }
.login-card .error { text-align: center; margin: 2px 0 0; min-height: 1.2em; font-size: 13px; }
.login-foot { text-align: center; font-size: 12px; color: var(--muted); margin: 0; line-height: 1.6; }
@media (max-width: 900px) {
  .landing { grid-template-columns: 1fr; }
  .brand-panel { background-position: center; }
  .brand-foot .credit { display: none; }
  .brand-panel { padding: 28px 20px 8px; }
  .brand-hero { padding: 28px 0 24px; }
  .brand-desc { display: none; }
}
@media (max-width: 420px) { .brand-hero h1 { font-size: 28px; } }

/* video de fondo del panel de marca: bajo la misma capa semitransparente que la foto (la foto queda de respaldo) */
.brand-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.brand-panel::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(95deg, rgba(6, 16, 26, .84) 0%, rgba(6, 16, 26, .70) 50%, rgba(6, 16, 26, .50) 100%); }
.brand-panel > :not(.brand-video) { position: relative; z-index: 2; }
@media (max-width: 900px) { .brand-panel::before { background: linear-gradient(rgba(6, 16, 26, .82), rgba(6, 16, 26, .90)); } }
@media (prefers-reduced-motion: reduce) { .brand-video { display: none; } }
@media (max-width: 420px) { .remember { flex-wrap: wrap; } .remember .muted { flex-basis: 100%; padding-left: 24px; } }

/* ------------------------------------------------------------------ cerdo 3D ---- */
.pig3d-card { margin-top: 14px; }
.pig3d-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pig3d-head h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.pig3d-head select { max-width: 100%; }
.pig3d-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; margin-top: 12px; }
.pig3d { position: relative; height: 420px; border-radius: 12px; overflow: hidden; display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 35%, var(--card), var(--soft)); border: 1px solid var(--line); }
.pig3d canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; cursor: grab; }
.pig3d canvas:active { cursor: grabbing; }
.pig3d-labels { position: absolute; inset: 0; pointer-events: none; }
.pig3d-tag { position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 12px; padding: 3px 8px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(0,0,0,.12); color: var(--text); }
.pig3d-tag i { font-style: normal; color: var(--muted); font-size: 11px; }
.pig3d-tag.t-len { border-color: #1e88e5; } .pig3d-tag.t-wid { border-color: #2e7d32; } .pig3d-tag.t-hei { opacity: .9; }
.pig3d-side { display: grid; gap: 8px; align-content: start; }
@media (max-width: 900px) { .pig3d-body { grid-template-columns: 1fr; } .pig3d { height: 320px; }
  .pig3d-side { grid-template-columns: repeat(3, 1fr); } .pig3d-side p { grid-column: 1 / -1; } }

.pig3d-side #pig3d-info { display: grid; gap: 8px; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cmp-table th, .cmp-table td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
.cmp-table th:first-child, .cmp-table td:first-child { text-align: left; color: var(--muted); }
.cmp-table th { font-weight: 600; font-size: 12px; }
.pig3d-tag.t-small { border-color: #8e99a4; } .pig3d-tag.t-big { border-color: #1e88e5; }
.pig3d-tag.t-diff { border-color: #ef6c00; color: #ef6c00; }
.cmp-table td:last-child { white-space: nowrap; }
.cmp-table td:last-child .muted { display: block; font-size: 11px; }

/* 3D dentro de la plataforma: indicadores del lado */
.pig3d-head h2 { margin: 0; }
.pig3d-card { margin-top: 0; }
.pig3d-side .kpi { padding: 12px 14px; gap: 2px; text-align: left; }
.pig3d-side .kpi b { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.pig3d-side .kpi span { font-size: 12px; color: var(--muted); }
.pig3d-side p.small { margin-top: 10px; font-size: 13px; color: var(--text-2); }
.pig3d-head select { min-width: 280px; }

/* Reproductor de video del carguío */
.vplayer { display: grid; gap: 10px; margin: 4px 0 8px; }
.vplayer video { width: 100%; max-height: 420px; border-radius: 10px; background: #0b0f17; aspect-ratio: 16 / 9; object-fit: contain; }
.vplayer-clips { flex-wrap: wrap; max-width: 100%; }
#p-dr-player:not(:empty) { margin: 4px 0 12px; }

/* Ficha técnica: registro de eventos */
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.sec-head .sec-title { margin: 0; }
.ev-wrap { max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; margin-top: 8px; }
.ev-table { margin: 0; }
.ev-table thead th { position: sticky; top: 0; background: var(--card); z-index: 1; }
.ev-table td, .ev-table th { padding: 7px 12px; font-size: 13.5px; }
.ev-table td.num, .ev-table th.num { text-align: right; }
.ev-table tr.okrow td:last-child .pill { white-space: nowrap; }
.ev-table tr.badrow td { background: var(--bad-soft); }
.ev-table .pill { white-space: nowrap; }
.ev-table tr.alarmrow td { background: var(--bad-soft); }
.ev-table .pill { font-size: 11px; padding: 1px 7px; }

/* Ficha técnica: archivos de video */
.file-list { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; }
.file-list li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line-2); }
.file-list li:last-child { border-bottom: 0; }
.file-ico { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; background: var(--line-2); color: var(--brand); font-size: 11px; flex: none; }
.file-name { flex: 1; min-width: 0; font-size: 14px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Ventana del video */
.video-dlg { width: min(960px, 94vw); padding: 0; border: 0; border-radius: 14px; background: var(--card); color: var(--text); box-shadow: 0 24px 64px rgba(0, 0, 0, .35); }
.video-dlg::backdrop { background: rgba(10, 14, 22, .6); }
.vd-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.vd-title { margin: 0; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vd-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.video-dlg video { display: block; width: 100%; max-height: 75vh; background: #0b0f17; aspect-ratio: 4 / 3; object-fit: contain; }
.video-dlg .vplayer-err { padding: 10px 16px; margin: 0; }
.ev-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 4px 0 10px; font-size: 13px; color: var(--text-2); }
.ev-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.ev-legend-t { flex-basis: 100%; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }

/* Guías de despacho */
.upper { text-transform: uppercase; }
.ok-text { color: var(--ok); } .bad-text { color: var(--bad); }
.plate { display: inline-block; font-weight: 600; font-size: 13px; letter-spacing: .06em; padding: 1px 8px; border: 1.5px solid var(--text-2);
  border-radius: 5px; background: var(--card); color: var(--text); font-variant-numeric: tabular-nums; }
.hitch-list { list-style: none; margin: 0 0 14px; padding: 0; }
.hitch-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.hitch-list li:last-child { border-bottom: 0; }
.h-carro { font-weight: 600; min-width: 140px; }
.gb-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.gb-row label { flex: 1 1 160px; }
.gb-row .gb-select { flex: 1 1 260px; min-width: 0; }
.g-table tr.voided td { color: var(--muted); text-decoration: line-through; }
.g-table tr.voided td.act { text-decoration: none; }
.g-table td.act { white-space: nowrap; }
.btn.danger { color: var(--bad); }
.guia-box { display: grid; gap: 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); margin: 12px 0; }
.gb-k { display: block; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.gb-cur { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.gb-cur b { font-size: 16px; margin-right: 8px; }
.gb-acts { display: flex; gap: 6px; }
.gb-new summary { cursor: pointer; font-size: 13px; color: var(--brand); }
.gb-new[open] summary { margin-bottom: 10px; }
.gb-msg:empty { display: none; }
.g-strip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft, var(--line-2)); font-size: 14px; }
.g-strip.warn { border-color: var(--warn); background: var(--warn-soft); }
.g-strip .gb-k { display: inline; margin-right: 6px; }
.g-strip-a { margin-left: auto; font-size: 13px; font-weight: 600; }
.g-left { margin-left: auto; }
[hidden] { display: none !important; }
.upper::placeholder { text-transform: none; }
.g-table td .sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.g-table td.act { white-space: nowrap; text-align: right; }
.g-table th, .g-table td { padding-left: 12px; padding-right: 12px; }
.toolbar .seg { max-width: 100%; overflow-x: auto; }

/* Solicitudes de acceso */
.login-info { margin: 8px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--ok-soft); color: var(--ok); font-size: 14px; }
.nav-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; }
.req-list { list-style: none; margin: 0; padding: 0; }
.req-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.req-list li:last-child { border-bottom: 0; }
.req-who { display: grid; gap: 2px; }
.req-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.req-acts select { height: 32px; }

/* botón sol/luna */
.theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: block; } :root[data-theme="dark"] .theme-btn .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-sun { display: block; } :root:not([data-theme="light"]) .theme-btn .i-moon { display: none; }
}
.login-theme { position: absolute; top: 18px; right: 18px; z-index: 3; }

/* ------------------------------------------------------------------ alarmas ---- */
.al-toolbar { align-items: center; }
.al-toolbar #al-ack-all { margin-left: auto; }
.al-list { display: grid; }
.al-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) minmax(120px, 200px) 84px auto; align-items: center; gap: 14px;
  padding: 14px 20px; border-bottom: 1px solid var(--line-2); box-shadow: inset 3px 0 0 var(--warn); }
.al-row:last-child { border-bottom: 0; }
.al-row.hi { box-shadow: inset 3px 0 0 var(--bad); background: color-mix(in srgb, var(--bad-soft) 55%, transparent); }
.al-row.info { box-shadow: inset 3px 0 0 var(--brand); }
.al-row.seen { box-shadow: inset 3px 0 0 var(--line); }
.al-ic, .toast-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--warn-soft); color: var(--warn); }
.al-row.hi .al-ic, .toast.hi .toast-ic, .toast.more .toast-ic { background: var(--bad-soft); color: var(--bad); }
.al-row.info .al-ic, .toast.info .toast-ic { background: var(--brand-soft); color: var(--brand); }
.al-row.seen .al-ic { background: var(--line-2); color: var(--faint); }
.al-main { min-width: 0; }
.al-k { font-weight: 600; font-size: 14px; } .al-row.seen .al-k { color: var(--muted); font-weight: 550; }
.al-d, .al-s { font-size: 13px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.al-s { color: var(--ok); }
.al-tower { font-size: 13px; color: var(--text-2); font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.al-time { font-size: 14px; color: var(--text-2); text-align: right; }
.al-b { display: flex; gap: 6px; justify-content: flex-end; }
@media (max-width: 760px) {
  .al-row { grid-template-columns: 36px minmax(0, 1fr) auto; padding: 12px 16px; }
  .al-tower { grid-column: 2; grid-row: 2; } .al-time { grid-column: 3; grid-row: 1; }
  .al-b { grid-column: 2 / -1; justify-content: flex-start; }
  .al-toolbar #al-ack-all { margin-left: 0; }
}

/* avisos emergentes (abajo a la derecha) */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px));
  pointer-events: none; }
.toast { position: relative; pointer-events: auto; display: grid; grid-template-columns: 36px minmax(0, 1fr) 24px; gap: 12px; align-items: start;
  padding: 14px 12px 16px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--shadow-lg); overflow: hidden; animation: toast-in .24s cubic-bezier(.2, .8, .2, 1); }
.toast.hi, .toast.more { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.toast.out { animation: toast-out .2s ease-in forwards; }
.toast-k { font-weight: 650; font-size: 14px; color: var(--text); }
.toast-d { font-size: 13px; color: var(--muted); margin-top: 2px; }
.toast-b { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.toast-x { width: 24px; height: 24px; display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--faint); cursor: pointer; }
.toast-x:hover { background: var(--soft); color: var(--text); }
.toast-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--bad); transform-origin: left;
  animation: toast-life linear forwards; opacity: .7; }
.toast.info .toast-bar { background: var(--brand); }
.toast:hover .toast-bar, .toast:focus-within .toast-bar { animation-play-state: paused; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }
@keyframes toast-life { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .toast, .toast.out { animation: none; } .toast-bar { animation-name: toast-life; } }
@media (max-width: 640px) { .toasts { right: 16px; bottom: 16px; } }

/* --------------------------------------------------- estado del equipo ---- */
.hw { display: grid; gap: 8px; }
.hw-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12px; color: var(--muted); }
.hw-sum { font-weight: 600; } .hw-sum.ok { color: var(--ok); } .hw-sum.warn { color: var(--warn); } .hw-sum.bad { color: var(--bad); }
.hw-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.hw-i { display: grid; grid-template-columns: 15px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 7px; align-items: center;
  padding: 6px 8px; border-radius: 8px; background: var(--soft); border: 1px solid var(--line-2); min-width: 0; cursor: default; }
.hw-i svg { grid-row: span 2; color: var(--faint); }
.hw-i b { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.hw-i small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hw-i.ok svg { color: var(--ok); }
.hw-i.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); } .hw-i.warn svg, .hw-i.warn b { color: var(--warn); }
.hw-i.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); } .hw-i.bad svg, .hw-i.bad b { color: var(--bad); }
.hw-i.na b { color: var(--muted); }
.hw.stale .hw-grid { opacity: .6; }
.hw-note { font-size: 12px; color: var(--muted); }
.hw-card { display: grid; gap: 4px; justify-items: start; }
.hw-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; width: 100%; }
.hw-list li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; align-items: start; font-size: 13px; color: var(--text-2); }
.hw-list li svg { margin-top: 1px; color: var(--faint); }
.hw-list li.ok svg { color: var(--ok); } .hw-list li.warn svg, .hw-list li.warn span { color: var(--warn); }
.hw-list li.bad svg, .hw-list li.bad span { color: var(--bad); }
.hw-extra { font-size: 12px; color: var(--muted); margin: 6px 0 4px; line-height: 1.6; }
.hw-card .btn svg { margin-right: 2px; }

/* ------------------------------------------------- avance del carguío ---- */
.prog { display: grid; gap: 6px; }
.prog-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; }
.prog-h b { font-weight: 650; font-variant-numeric: tabular-nums; } .prog-h span { color: var(--muted); font-size: 12px; }
.prog-bar { height: 8px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.prog-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), var(--live)); transition: width .6s ease; }
.prog.stop .prog-h span { color: var(--warn); font-weight: 600; } .prog.stop .prog-bar i { background: var(--warn); }

/* ------------------------------------------------------------- mosaico ---- */
.mz { display: grid; gap: 12px; }
.mz-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mz-info { font-size: 12px; color: var(--muted); flex: 1; min-width: 200px; }
.mz-pg { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.mz-grid { --mz: 2; display: grid; grid-template-columns: repeat(var(--mz), minmax(0, 1fr)); gap: 8px; }
.mz-cell { aspect-ratio: 16 / 10; border-radius: 10px; }
.mz-cell.off { opacity: .85; }
.mz-over { position: absolute; inset: 0; pointer-events: none; }
.mz-top { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mz-top .media-badge { position: static; max-width: calc(100% - 40px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mz-zoom { pointer-events: auto; width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px; cursor: pointer;
  background: rgba(13, 19, 32, .65); color: #fff; backdrop-filter: blur(4px); opacity: 0; transition: opacity .15s; }
.mz-cell:hover .mz-zoom, .mz-zoom:focus-visible, .mz-grid[style*="--mz: 1"] .mz-zoom { opacity: 1; }
@media (hover: none) { .mz-zoom { opacity: 1; } }
.mz-cap { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 22px 12px 10px;
  font-size: 12px; color: #cfd6e0; background: linear-gradient(transparent, rgba(8, 14, 24, .85)); }
.mz-cap b { color: #fff; font-weight: 600; font-size: 13px; }
.mz-tag { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; background: #1e88e5; color: #fff; }
.mz-live { margin-left: auto; color: #fff; } .mz-live b { font-size: 14px; }
.mz-grid[style*="--mz: 3"] .mz-cap, .mz-grid[style*="--mz: 4"] .mz-cap { padding: 16px 8px 6px; }
.mz-grid[style*="--mz: 4"] .mz-cap span:not(.mz-tag), .mz-grid[style*="--mz: 4"] .media-ph span { display: none; }
@media (max-width: 760px) { .mz-grid { grid-template-columns: repeat(min(var(--mz), 2), minmax(0, 1fr)); } }
.mz-wait { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; text-align: center; padding: 16px;
  color: #cfd6e0; background: radial-gradient(ellipse at center, #182235 0%, #0d1320 75%); }
.mz-wait b { font-size: 13px; font-weight: 600; } .mz-wait span:not(.mz-spin) { font-size: 12px; color: #8d99ab; }
.mz-spin { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .15); border-top-color: #53b1fd; animation: mzspin 1s linear infinite; }
@keyframes mzspin { to { transform: rotate(360deg); } }
.mz-empty { aspect-ratio: 16 / 10; border-radius: 10px; border: 1.5px dashed var(--line); display: grid; place-items: center; color: var(--faint); font-size: 12px; }
.mz-grid[style*="--mz: 4"] .mz-wait span:not(.mz-spin) { display: none; }
@media (max-width: 640px) { .mz-grid { grid-template-columns: 1fr; } .mz-empty { display: none; } }
@media (prefers-reduced-motion: reduce) { .mz-spin { animation: none; } }

/* Carros → estado de cada equipo */
.dev-health { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.dev-health:empty { display: none; }
.dh-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: grid; gap: 12px; align-content: start; }
.dh-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.dh-state { padding: 3px 10px; font-size: 12px; pointer-events: none; }
.dh-t h3 { font-size: 15px; } .dh-t p { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dh-head .hw-sum { font-size: 12px; text-align: right; } .dh-head .hw-sum:not(.ok):not(.warn):not(.bad) { color: var(--muted); }
.dh-card details summary { cursor: pointer; font-size: 13px; font-weight: 550; color: var(--brand); padding: 2px 0; }
.dh-card details[open] summary { margin-bottom: 10px; }
.dh-cams-t { margin: 12px 0 6px; }
.dh-cams { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; color: var(--text-2); }
/* Panel: aviso del equipo solo cuando algo anda mal */
.hw-alert { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 8px 10px; border-radius: 8px; }
.hw-alert span { flex: 1; min-width: 0; } .hw-alert a { font-weight: 600; color: inherit; }
.hw-alert.warn { background: var(--warn-soft); color: var(--warn); } .hw-alert.bad { background: var(--bad-soft); color: var(--bad); }

/* ---------------------------------------------- carros en vivo en otra pestaña (#vivo) ---- */
.live-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.live-actions .btn { height: 36px; }
.tile-acts { display: flex; gap: 6px; }
body.live-only .topbar, body.live-only #view-panel > .page-head, body.live-only #p-kpis,
body.live-only #view-panel > .card:not(#p-live-card), body.live-only #p-live-pop { display: none; }
body.live-only main { max-width: none; padding: 12px; }
body.live-only #p-live-card { min-height: calc(100vh - 24px); margin: 0; }
body.live-only .one { grid-template-columns: minmax(0, 3fr) minmax(260px, 1fr); }
body.live-only .one .media.big { aspect-ratio: auto; height: calc(100vh - 140px); min-height: 320px; }
body.live-only .tiles { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
body.live-only .tiles.single { grid-template-columns: minmax(0, 900px); }
@media (max-width: 960px) { body.live-only .one .media.big { height: auto; aspect-ratio: 4 / 3; } }
body.live-only .mz-cell, body.live-only .mz-empty { aspect-ratio: auto; height: calc((100vh - 180px - (var(--mz) - 1) * 8px) / var(--mz)); min-height: 120px; }

/* ---------------------------------------------------------- video de una alarma ---- */
.plain-list li .li-act { margin-left: auto; }
.plain-list li:has(.li-act) { display: flex; align-items: center; gap: 8px; }
[data-alvideo] svg { margin-right: 4px; vertical-align: -2px; }
.video-dlg .vd-note { margin: 0; padding: 8px 16px; font-size: 13px; border-bottom: 1px solid var(--line); }
