/* Escena: Control operativo (tablero en vivo, alerta al celular y reporte del día) */
/* La escena se adapta al ancho de su propio contenedor, no al de la ventana */
#scene-control { min-height: 0; container-type: inline-size; }

#scene-control .sc-co-stage {
  position: relative; z-index: 0; height: 400px;
  display: flex; flex-direction: column; gap: 10px;
  font: 400 .8125rem/1.35 var(--body); color: var(--hueso);
  transition: opacity .6s ease;
}
#scene-control .sc-co-stage.is-out { opacity: 0; }
#scene-control svg { display: block; width: 100%; height: 100%; }

/* Encabezado: paso actual de la historia */
#scene-control .sc-co-head { display: flex; align-items: center; gap: 12px; min-height: 24px; }
#scene-control .sc-co-cap { display: flex; align-items: center; gap: 10px; min-width: 0; }
#scene-control .sc-co-cap.is-swap { animation: sc-co-swap .5s cubic-bezier(.2, .8, .2, 1) both; }
#scene-control .sc-co-num {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--ember); color: var(--noche);
  font: 700 .75rem/22px var(--display); text-align: center;
}
#scene-control .sc-co-captext { font: 600 .9375rem/1.2 var(--display); letter-spacing: -.01em; }
#scene-control .sc-co-tag {
  margin-left: auto; flex: none; font-size: .75rem; line-height: 1; color: var(--ceniza);
  padding: 5px 9px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--linea);
}
#scene-control .sc-co-prog { display: flex; gap: 4px; }
#scene-control .sc-co-prog i { flex: 1; height: 2px; border-radius: 2px; background: var(--linea); overflow: hidden; position: relative; }
#scene-control .sc-co-prog i::before {
  content: ""; position: absolute; inset: 0; background: var(--ember);
  transform: scaleX(0); transform-origin: left; transition: transform .5s ease;
}
#scene-control .sc-co-prog i.is-done::before, #scene-control .sc-co-prog i.is-on::before { transform: scaleX(1); }
#scene-control .sc-co-prog i.is-on::before { animation: sc-co-grow 1s ease both; }

/* Distribución: tablero y celular */
#scene-control .sc-co-main {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) 128px; gap: 14px; align-items: center;
}

/* Tablero */
#scene-control .sc-co-board {
  position: relative; height: 100%; overflow: hidden;
  display: flex; flex-direction: column; gap: 9px;
  padding: 12px 14px; border-radius: 14px;
  background: #17120F; box-shadow: inset 0 0 0 1px var(--linea);
}
#scene-control .sc-co-board > :not(.sc-co-jump):not(.sc-co-report) { transition: opacity .5s ease, filter .5s ease; }
#scene-control .sc-co-board.is-dim > :not(.sc-co-jump):not(.sc-co-report) { opacity: .22; filter: blur(1.5px); }
#scene-control .sc-co-bhead { display: flex; align-items: center; justify-content: space-between; }
#scene-control .sc-co-bhead strong { font: 600 .875rem/1.2 var(--display); }
#scene-control .sc-co-live { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; color: var(--ceniza); }
#scene-control .sc-co-live i {
  width: 7px; height: 7px; border-radius: 50%; background: #3DDC84; box-shadow: 0 0 8px #3DDC84;
  animation: sc-co-blink 1.6s ease-in-out infinite;
}

#scene-control .sc-co-row1 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.9fr); gap: 8px; }
#scene-control .sc-co-kpi, #scene-control .sc-co-chartcard {
  position: relative; background: #1E1814; border-radius: 10px; padding: 9px 10px;
}
#scene-control .sc-co-kpi > span, #scene-control .sc-co-chartcard > span, #scene-control .sc-co-stitle {
  display: block; font-size: .75rem; color: var(--ceniza); white-space: nowrap;
}
#scene-control .sc-co-kpi > span { white-space: normal; line-height: 1.25; }
#scene-control .sc-co-kpi strong {
  display: inline-block; margin-top: 6px; font: 600 1.75rem/1 var(--display); letter-spacing: -.03em;
}
#scene-control .is-tick { animation: sc-co-tick .7s cubic-bezier(.2, .9, .3, 1.3) both; }
#scene-control .sc-co-delta {
  position: absolute; right: 9px; bottom: 10px; font: 600 .75rem/1 var(--body); font-style: normal;
  color: #3DDC84; background: rgba(61, 220, 132, .14); padding: 3px 6px; border-radius: 999px; opacity: 0;
}
#scene-control .sc-co-delta.is-pop { animation: sc-co-delta 2.6s ease both; }
#scene-control .sc-co-cbody { display: flex; align-items: flex-end; gap: 10px; margin-top: 6px; }
#scene-control .sc-co-cbody strong { flex: none; display: inline-block; font: 600 1.125rem/1 var(--display); letter-spacing: -.02em; transform-origin: left bottom; }
#scene-control .sc-co-chart { position: relative; flex: 1; min-width: 0; height: 34px; margin-right: 3px; }
#scene-control .sc-co-chart svg { overflow: hidden; }
#scene-control .sc-co-line { stroke: var(--sol); stroke-width: 1.75; stroke-linejoin: round; }
#scene-control .sc-co-pt {
  position: absolute; right: -3px; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%;
  background: var(--sol); box-shadow: 0 0 0 0 rgba(255, 138, 18, .55);
  animation: sc-co-ring 1.8s ease-out infinite;
}

/* Lista de pedidos */
#scene-control .sc-co-stitle { margin-bottom: 6px; }
#scene-control .sc-co-list { height: 102px; overflow: hidden; }
#scene-control .sc-co-order {
  display: flex; align-items: center; gap: 8px; height: 30px; margin-bottom: 6px; padding: 0 10px;
  border-radius: 8px; background: #1E1814; overflow: hidden; white-space: nowrap;
}
#scene-control .sc-co-order.is-new { animation: sc-co-new 2.4s ease both; }
#scene-control .sc-co-folio { flex: none; font-weight: 600; min-width: 42px; }
#scene-control .sc-co-order strong { flex: none; margin-left: auto; font: 600 .8125rem/1 var(--display); }
#scene-control .sc-co-src {
  flex: none; font-size: .75rem; line-height: 1; padding: 4px 7px; border-radius: 999px; white-space: nowrap;
}
#scene-control .sc-co-src.is-web { color: var(--sol); background: rgba(255, 138, 18, .13); }
#scene-control .sc-co-src.is-wa { color: #3DDC84; background: rgba(61, 220, 132, .13); }

/* Inventario */
#scene-control .sc-co-inv { position: relative; margin-bottom: 8px; }
#scene-control .sc-co-inv:last-child { margin-bottom: 0; }
#scene-control .sc-co-irow { display: flex; justify-content: space-between; gap: 8px; font-size: .75rem; white-space: nowrap; }
#scene-control .sc-co-irow small { font-size: .75rem; color: var(--ceniza); }
#scene-control .sc-co-irow b { font-weight: 600; color: var(--ceniza); transition: color .3s ease; }
#scene-control .sc-co-track { position: relative; height: 6px; margin-top: 5px; border-radius: 3px; background: #2A221D; }
#scene-control .sc-co-fill {
  position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px;
  background: rgba(244, 239, 232, .55); transition: background .35s ease, box-shadow .35s ease;
}
#scene-control .sc-co-min { position: absolute; top: -4px; width: 2px; height: 14px; margin-left: -1px; border-radius: 1px; background: rgba(244, 239, 232, .5); }
#scene-control .sc-co-inv.is-low .sc-co-fill {
  background: linear-gradient(90deg, var(--brasa), var(--llama)); box-shadow: 0 0 10px rgba(252, 74, 3, .7);
}
#scene-control .sc-co-inv.is-low .sc-co-irow b { color: #FF6A47; }
#scene-control .sc-co-chip {
  position: absolute; right: 0; top: 18px; display: inline-flex; align-items: center; gap: 4px;
  font-size: .75rem; line-height: 1; color: #FF6A47; background: #2A1410;
  padding: 4px 8px; border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(230, 27, 2, .55);
  opacity: 0; transform: scale(.8); transition: opacity .3s ease, transform .4s cubic-bezier(.2, .9, .3, 1.4);
}
#scene-control .sc-co-chip svg { width: 12px; height: 12px; }
#scene-control .sc-co-inv.is-chip .sc-co-chip { opacity: 1; transform: none; }
#scene-control .sc-co-inv.is-ping::before {
  content: ""; position: absolute; inset: -5px -7px; border-radius: 8px; pointer-events: none;
  box-shadow: 0 0 0 1px rgba(252, 74, 3, .8); animation: sc-co-ping 1.4s ease-out both;
}

/* Salto de tiempo */
#scene-control .sc-co-jump {
  position: absolute; left: 50%; top: 50%; z-index: 2;
  display: inline-flex; align-items: center; gap: 10px; white-space: nowrap;
  padding: 12px 18px; border-radius: 999px; background: #0E0B09;
  box-shadow: inset 0 0 0 1px rgba(255, 138, 18, .55), 0 0 40px rgba(252, 74, 3, .25);
  font: 600 1rem/1 var(--display); letter-spacing: -.01em;
  opacity: 0; transform: translate(-50%, -50%) scale(.85); pointer-events: none;
}
#scene-control .sc-co-jicon { width: 20px; height: 20px; color: var(--sol); }
#scene-control .sc-co-jump.is-on { animation: sc-co-jin .55s cubic-bezier(.2, .9, .3, 1.2) both; }
#scene-control .sc-co-jump.is-on .sc-co-jicon svg path { transform-origin: 12px 12px; animation: sc-co-spin 1.2s ease-in-out both; }
#scene-control .sc-co-jump.is-off { animation: sc-co-jout .45s ease both; }

/* Reporte del día */
#scene-control .sc-co-report {
  position: absolute; inset: 0; z-index: 3; padding: 12px;
  display: flex; align-items: center; justify-content: center;
  transform: translateY(104%); transition: transform .7s cubic-bezier(.2, .8, .2, 1);
}
#scene-control .sc-co-report.is-on { transform: none; }
#scene-control .sc-co-doc {
  width: 100%; max-width: 330px; padding: 14px 16px; border-radius: 12px; background: #1E1814;
  box-shadow: inset 0 0 0 1px var(--linea), 0 20px 40px rgba(0, 0, 0, .45);
  position: relative; overflow: hidden;
}
#scene-control .sc-co-doc::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--ember); }
#scene-control .sc-co-dhead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
#scene-control .sc-co-dhead strong { display: block; font: 600 .9375rem/1.2 var(--display); }
#scene-control .sc-co-dhead span { display: block; font-size: .75rem; color: var(--ceniza); }
#scene-control .sc-co-dicon {
  flex: none; width: 32px; height: 32px; padding: 6px; border-radius: 8px; color: var(--sol);
  background: rgba(255, 138, 18, .12);
}
#scene-control .sc-co-lines { list-style: none; margin: 0; padding: 0; }
#scene-control .sc-co-lines li {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  height: 30px; border-top: 1px solid var(--linea); white-space: nowrap;
}
#scene-control .sc-co-lines li span { color: var(--ceniza); transition: color .4s ease; }
#scene-control .sc-co-lines li b {
  font: 600 .875rem/1 var(--display); opacity: 0; transform: translateX(6px);
  transition: opacity .35s ease .15s, transform .35s ease .15s;
}
#scene-control .sc-co-lines li i {
  position: absolute; right: 0; top: 50%; width: 64px; height: 8px; margin-top: -4px; border-radius: 4px;
  background: linear-gradient(90deg, #2A221D 0%, #3A2F28 50%, #2A221D 100%) 0 0 / 200% 100%;
  animation: sc-co-shimmer 1.2s linear infinite; transition: opacity .25s ease;
}
#scene-control .sc-co-lines li.is-on span { color: var(--hueso); }
#scene-control .sc-co-lines li.is-on b { opacity: 1; transform: none; }
#scene-control .sc-co-lines li.is-on i { opacity: 0; }
#scene-control .sc-co-lines li::after {
  content: ""; position: absolute; left: 0; bottom: -1px; height: 1px; width: 100%;
  background: var(--ember); transform: scaleX(0); transform-origin: left; opacity: 0;
}
#scene-control .sc-co-lines li.is-on::after { animation: sc-co-sweep .7s ease both; }
#scene-control .sc-co-dfoot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding-top: 10px; border-top: 1px solid var(--linea);
}
#scene-control .sc-co-to { font-size: .75rem; color: var(--ceniza); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#scene-control .sc-co-send {
  position: relative; flex: none; display: inline-grid; place-items: center;
  padding: 7px 12px; border-radius: 999px; background: var(--ember); color: var(--noche);
  font: 600 .75rem/1 var(--body); white-space: nowrap; transition: background .3s ease, color .3s ease;
}
#scene-control .sc-co-send > span { grid-area: 1 / 1; display: inline-flex; align-items: center; gap: 5px; transition: opacity .25s ease; }
#scene-control .sc-co-send svg { width: 12px; height: 12px; }
#scene-control .sc-co-senttxt { opacity: 0; }
#scene-control .sc-co-send.is-press { animation: sc-co-press .35s ease both; }
#scene-control .sc-co-send.is-sent { background: rgba(61, 220, 132, .14); color: #3DDC84; }
#scene-control .sc-co-send.is-sent .sc-co-sendtxt { opacity: 0; }
#scene-control .sc-co-send.is-sent .sc-co-senttxt { opacity: 1; }

/* Celular de la gerente */
#scene-control .sc-co-phonecol { display: flex; flex-direction: column; align-items: center; gap: 12px; }
#scene-control .sc-co-phone {
  width: 128px; height: 262px; padding: 5px; border-radius: 26px; background: #0B0807;
  box-shadow: inset 0 0 0 1.5px #3A302A, 0 18px 40px rgba(0, 0, 0, .55);
}
#scene-control .sc-co-phone.is-buzz { animation: sc-co-buzz .55s linear both; }
#scene-control .sc-co-screen {
  position: relative; height: 100%; border-radius: 21px; overflow: hidden; text-align: center;
  background: radial-gradient(120% 70% at 50% 110%, rgba(252, 74, 3, .35), transparent 60%), radial-gradient(80% 50% at 0% 0%, rgba(255, 138, 18, .12), transparent 70%), #120D0A;
}
#scene-control .sc-co-island { position: absolute; left: 50%; top: 7px; width: 38px; height: 10px; margin-left: -19px; border-radius: 6px; background: #000; }
#scene-control .sc-co-clock { padding-top: 30px; font: 600 1.875rem/1 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
#scene-control .sc-co-date { margin-top: 4px; font-size: .75rem; color: var(--ceniza); }
#scene-control .sc-co-notifs { position: absolute; left: 6px; right: 6px; top: 96px; }
#scene-control .sc-co-notif {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2; text-align: left;
  padding: 7px 8px 8px; border-radius: 12px; background: rgba(42, 34, 29, .96);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), 0 8px 18px rgba(0, 0, 0, .4);
  animation: sc-co-notif .55s cubic-bezier(.2, .9, .3, 1.15) both;
  transition: transform .45s ease, opacity .45s ease;
}
#scene-control .sc-co-notif.is-back { z-index: 1; transform-origin: 50% 0; transform: translateY(var(--dy, 12px)) scale(.92); opacity: .7; animation: none; }
#scene-control .sc-co-notif.is-back ~ .sc-co-notif.is-back { opacity: 0; }
#scene-control .sc-co-nhead { display: flex; align-items: center; gap: 5px; font-size: .75rem; line-height: 1; color: var(--ceniza); margin-bottom: 4px; }
#scene-control .sc-co-nhead em { margin-left: auto; font-style: normal; }
#scene-control .sc-co-app { flex: none; width: 14px; height: 14px; border-radius: 4px; background: var(--ember); position: relative; }
#scene-control .sc-co-app::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--noche); }
#scene-control .is-mail .sc-co-app { background: var(--hueso); color: var(--noche); padding: 2px; }
#scene-control .is-mail .sc-co-app::after { display: none; }
#scene-control .sc-co-notif strong { display: block; font: 600 .75rem/1.25 var(--body); }
#scene-control .sc-co-notif p { margin: 1px 0 0; font-size: .75rem; line-height: 1.3; color: #CFC8C0; }
#scene-control .sc-co-notif.is-alert strong { color: #FF8466; }
#scene-control .sc-co-plabel { margin: 0; text-align: center; font-size: .75rem; line-height: 1.35; }
#scene-control .sc-co-plabel strong { display: block; font-weight: 600; }
#scene-control .sc-co-plabel span { color: var(--ceniza); }

/* Capa de vuelo: pedido, alerta y correo en tránsito */
#scene-control .sc-co-fly { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
#scene-control .sc-co-fly > * { position: absolute; left: 0; top: 0; will-change: transform, opacity; }
#scene-control .sc-co-ocard {
  width: 212px; padding: 10px 12px; border-radius: 12px; background: #241C17; opacity: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 138, 18, .5), 0 14px 34px rgba(0, 0, 0, .55), 0 0 28px rgba(252, 74, 3, .25);
}
#scene-control .sc-co-ohead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
#scene-control .sc-co-ohead em { font-style: normal; font-size: .75rem; color: var(--ceniza); }
#scene-control .sc-co-oitems { margin: 0 0 4px; font: 600 .875rem/1.25 var(--body); }
#scene-control .sc-co-obody { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
#scene-control .sc-co-obody span { font-size: .75rem; color: var(--ceniza); }
#scene-control .sc-co-obody strong { font: 600 .9375rem/1 var(--display); }
#scene-control .sc-co-dot {
  width: 12px; height: 12px; border-radius: 50%; opacity: 0;
  background: #FF6A47; box-shadow: 0 0 12px 3px rgba(252, 74, 3, .75), 0 0 0 3px rgba(230, 27, 2, .3);
}
#scene-control .sc-co-dot.is-trail { width: 8px; height: 8px; box-shadow: 0 0 8px rgba(252, 74, 3, .6); }
#scene-control .sc-co-dot.is-sol { background: var(--sol); box-shadow: 0 0 8px rgba(255, 138, 18, .6); }
#scene-control .sc-co-env {
  width: 34px; height: 26px; padding: 4px 7px; border-radius: 7px; background: var(--ember); color: var(--noche);
  box-shadow: 0 0 22px rgba(252, 74, 3, .6);
}

/* Fotogramas clave */
@keyframes sc-co-swap { from { opacity: 0; transform: translateY(6px); } }
@keyframes sc-co-grow { from { transform: scaleX(0); } }
@keyframes sc-co-blink { 50% { opacity: .35; } }
@keyframes sc-co-tick { 0% { transform: scale(1); } 35% { transform: scale(1.18); color: var(--sol); } 100% { transform: scale(1); } }
@keyframes sc-co-delta { 0% { opacity: 0; transform: translateY(6px); } 12%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes sc-co-ring { 0% { box-shadow: 0 0 0 0 rgba(255, 138, 18, .55); } 100% { box-shadow: 0 0 0 9px rgba(255, 138, 18, 0); } }
@keyframes sc-co-new {
  0% { background: rgba(255, 138, 18, .26); box-shadow: inset 0 0 0 1px rgba(255, 138, 18, .7); }
  100% { background: #1E1814; box-shadow: inset 0 0 0 1px rgba(255, 138, 18, 0); }
}
@keyframes sc-co-ping { 0% { opacity: 0; transform: scale(.96); } 25% { opacity: 1; } 100% { opacity: 0; transform: scale(1.04); } }
@keyframes sc-co-jin { from { opacity: 0; transform: translate(-50%, -50%) scale(.85); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes sc-co-jout { from { opacity: 1; transform: translate(-50%, -50%) scale(1); } to { opacity: 0; transform: translate(-50%, -60%) scale(.95); } }
@keyframes sc-co-spin { from { transform: rotate(-300deg); } }
@keyframes sc-co-shimmer { to { background-position: -200% 0; } }
@keyframes sc-co-sweep { 0% { opacity: 1; transform: scaleX(0); } 70% { opacity: 1; transform: scaleX(1); } 100% { opacity: 0; transform: scaleX(1); } }
@keyframes sc-co-press { 50% { transform: scale(.9); } }
@keyframes sc-co-buzz {
  0%, 100% { transform: none; }
  10%, 50%, 90% { transform: translateX(-2px) rotate(-1.5deg); }
  30%, 70% { transform: translateX(2px) rotate(1.5deg); }
}
@keyframes sc-co-notif { from { opacity: 0; transform: translateY(-14px) scale(.96); } }

/* Pantallas angostas: celular abajo, asomándose desde el borde */
@container (max-width: 380px) {
  #scene-control .sc-co-stage { height: 640px; margin-bottom: calc(-1 * clamp(20px, 3vw, 36px)); }
  #scene-control .sc-co-captext { font-size: .8125rem; }
  #scene-control .sc-co-clock { font-size: 2.125rem; }
  #scene-control .sc-co-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 14px; align-items: stretch; }
  #scene-control .sc-co-board { height: 352px; padding: 11px 12px; }
  #scene-control .sc-co-kpi strong { font-size: 1.625rem; }
  #scene-control .sc-co-phonecol { flex-direction: row; align-items: flex-start; justify-content: center; gap: 14px; overflow: hidden; }
  #scene-control .sc-co-phone { width: 172px; height: 300px; flex: none; }
  #scene-control .sc-co-notifs { left: 7px; right: 7px; }
  #scene-control .sc-co-plabel { text-align: left; padding-top: 34px; max-width: 120px; }
}

@media (prefers-reduced-motion: reduce) {
  #scene-control .sc-co-pt, #scene-control .sc-co-live i, #scene-control .sc-co-lines li i { animation: none; }
}
