:root {
  --fondo: #0b1118;
  --panel: #111a24;
  --panel2: #16212d;
  --borde: #22303f;
  --texto: #e6edf3;
  --suave: #8b9bab;
  --acento: #3ddc84;
  --acento-osc: #1f9d57;
  --peligro: #ff6b6b;
  --aviso: #f5b942;
  --radio: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--fondo); color: var(--texto);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--acento); }

.app { display: grid; grid-template-columns: 340px 1fr; height: 100vh; }
.lateral { background: var(--panel); border-right: 1px solid var(--borde); display: flex; flex-direction: column;
  gap: 14px; padding: 16px; overflow: hidden; min-height: 0; }
.marca { display: flex; gap: 10px; align-items: center; }
.marca h1 { font-size: 17px; margin: 0; letter-spacing: .2px; }
.marca p { margin: 0; color: var(--suave); font-size: 12px; }

.fila { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tarjeta { background: var(--panel2); border: 1px solid var(--borde); border-radius: var(--radio); padding: 12px; }
.ayuda { color: var(--suave); font-size: 12.5px; margin: 8px 0 0; white-space: pre-line; }
.ayuda:empty { display: none; }

.pildora { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; padding: 4px 10px; border-radius: 99px;
  background: #0d151e; border: 1px solid var(--borde); }
.pildora i { width: 8px; height: 8px; border-radius: 50%; background: var(--suave); }
.pildora.encendido i { background: var(--acento); box-shadow: 0 0 8px var(--acento); }
.pildora.arrancando i, .pildora.apagando i { background: var(--aviso); animation: latir 1s infinite; }
.pildora.error i { background: var(--peligro); }
@keyframes latir { 50% { opacity: .3; } }

.btn { border: 1px solid var(--borde); background: var(--panel2); padding: 7px 12px; border-radius: 9px; cursor: pointer;
  transition: background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { border-color: #33475b; background: #1b2836; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primario { background: var(--acento); color: #06210f; border-color: var(--acento); font-weight: 600; }
.btn.primario:hover { background: #5ae69b; }
.btn.peligro { color: var(--peligro); }
.btn.fantasma { background: transparent; border-color: transparent; color: var(--suave); text-align: left; padding: 6px 8px; }
.btn.fantasma:hover { color: var(--texto); background: var(--panel2); }
.btn.icono { padding: 4px 9px; }

.zona { border: 1.5px dashed #2d4152; border-radius: var(--radio); padding: 18px 12px; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--suave); transition: .15s; }
.zona strong { color: var(--texto); }
.zona span { font-size: 12.5px; }
.zona:hover, .zona.encima, .zona:focus-visible { border-color: var(--acento); background: rgba(61, 220, 132, .06); outline: none; }
.zona.ocupada { pointer-events: none; opacity: .85; }
.progreso { width: 100%; height: 6px; background: #0d151e; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progreso div { height: 100%; width: 0; background: var(--acento); transition: width .2s; }
.progreso.indeterminado div { width: 35%; animation: barrer 1.2s infinite ease-in-out; }
@keyframes barrer { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.progresoTxt { margin: 4px 0 0; font-size: 12px; min-height: 0; }
.progresoTxt:empty { display: none; }

.apps { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.titulo h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--suave); margin: 0; }
.lista { list-style: none; margin: 8px 0 0; padding: 0; overflow-y: auto; flex: 1; }
.lista li { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.lista li:hover { background: var(--panel2); }
.lista li.vacio { color: var(--suave); font-size: 13px; }
.lista img, .lista .sin-icono { width: 36px; height: 36px; border-radius: 9px; flex: none; background: #1d2a37; object-fit: cover; }
.lista .sin-icono { display: grid; place-items: center; font-weight: 700; color: var(--acento); }
.lista .info { flex: 1; min-width: 0; cursor: pointer; }
.lista .nombre { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.lista .paquete { color: var(--suave); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lista .acciones { display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.lista li:hover .acciones, .lista li:focus-within .acciones { opacity: 1; }
.lista .acciones button { padding: 3px 8px; font-size: 12px; }

.pie { display: flex; justify-content: space-between; border-top: 1px solid var(--borde); padding-top: 8px; }

.escenario { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 18px; min-width: 0; min-height: 0; }
.telefono { position: relative; height: calc(100vh - 130px); aspect-ratio: 9 / 16; max-width: 100%;
  background: #000; border-radius: 26px; border: 10px solid #1a232d; box-shadow: 0 20px 60px rgba(0,0,0,.5); overflow: hidden; }
.telefono.horizontal { height: auto; width: min(100%, calc((100vh - 130px) * var(--ratio, 1.6))); border-radius: 20px; }

.segmento { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 10px; background: #0d151e;
  border: 1px solid var(--borde); border-radius: 10px; padding: 3px; }
.segmento button { border: 0; background: transparent; padding: 6px; border-radius: 7px; cursor: pointer; color: var(--suave); }
.segmento button:hover { color: var(--texto); }
.segmento button[aria-checked="true"] { background: var(--panel2); color: var(--texto); box-shadow: inset 0 0 0 1px #2d4152; font-weight: 600; }
.segmento button:disabled { cursor: default; opacity: .6; }
.segmento.motor-sel { margin: 0 0 10px; }
.segmento[hidden] { display: none; }
#pantalla { width: 100%; height: 100%; display: block; object-fit: contain; touch-action: none; cursor: default; outline: none; }
#pantalla:focus { box-shadow: inset 0 0 0 2px rgba(61,220,132,.35); }
.velo { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, #13202c, #070b10);
  text-align: center; padding: 24px; }
.velo[hidden] { display: none; }
.velo-contenido { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--suave); }
.velo p { margin: 0; white-space: pre-line; max-width: 320px; }
.giro { width: 34px; height: 34px; border: 3px solid #24384a; border-top-color: var(--acento); border-radius: 50%; animation: girar 0.9s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

.controles { display: flex; gap: 6px; background: var(--panel); border: 1px solid var(--borde); padding: 6px; border-radius: 14px; flex-wrap: wrap; justify-content: center; }
.controles button { width: 40px; height: 36px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; font-size: 17px; color: var(--texto); }
.controles button:hover { background: var(--panel2); }
.controles button:active { background: #223243; }
.controles .sep { width: 1px; background: var(--borde); margin: 4px 2px; }
.consejo { margin: 0; color: var(--suave); font-size: 12px; }

.dialogo { background: var(--panel); color: var(--texto); border: 1px solid var(--borde); border-radius: 16px; padding: 18px 20px; width: min(460px, 94vw); }
.dialogo::backdrop { background: rgba(0,0,0,.55); }
.dialogo .cabecera { display: flex; justify-content: space-between; align-items: center; margin: 0; }
.dialogo h2 { margin: 0; font-size: 18px; }
.dialogo h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--suave); margin: 20px 0 8px; }
.campo { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; font-size: 13px; }
.campo input { flex: 1; }
input[type=password], input[type=text], select { background: #0d151e; border: 1px solid var(--borde); border-radius: 9px; padding: 8px 10px; width: 100%; }
input:focus, select:focus { outline: 2px solid rgba(61,220,132,.4); border-color: var(--acento); }
.interruptor { display: flex; align-items: center; gap: 10px; margin: 10px 0; cursor: pointer; }
.interruptor input { display: none; }
.interruptor span { width: 36px; height: 20px; border-radius: 99px; background: #2a3a4a; position: relative; flex: none; transition: .15s; }
.interruptor span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #c7d2dc; transition: .15s; }
.interruptor input:checked + span { background: var(--acento-osc); }
.interruptor input:checked + span::after { left: 19px; background: #fff; }
.interruptor em { font-style: normal; color: var(--suave); font-size: 12px; margin-left: auto; }
.aviso { background: rgba(245,185,66,.1); border: 1px solid rgba(245,185,66,.35); color: #f5d38a; padding: 10px 12px; border-radius: 10px; margin-top: 12px; font-size: 13px; }

.avisos { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 10; }
.avisos div { background: var(--panel2); border: 1px solid var(--borde); border-left: 3px solid var(--acento); padding: 10px 14px; border-radius: 10px;
  max-width: 380px; box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: entrar .2s ease-out; white-space: pre-line; }
.avisos div.mal { border-left-color: var(--peligro); }
@keyframes entrar { from { transform: translateY(8px); opacity: 0; } }

/* login */
.login { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login form { background: var(--panel); border: 1px solid var(--borde); border-radius: 16px; padding: 28px; width: min(360px, 100%);
  display: flex; flex-direction: column; gap: 14px; text-align: center; }
.login h1 { margin: 0; font-size: 20px; }
.login p { margin: 0; color: var(--suave); }
.login .error { color: var(--peligro); font-size: 13px; min-height: 18px; }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: auto; min-height: 100vh; }
  .lateral { border-right: 0; border-bottom: 1px solid var(--borde); max-height: none; }
  .apps { max-height: 260px; }
  .telefono { height: 70vh; }
  .lista .acciones { opacity: 1; }
}
