/* Mismo aspecto que la app de la tablet y los paneles de Home Assistant. */
@font-face { font-family: 'Rajdhani'; font-weight: 600; src: url('/fonts/Rajdhani-SemiBold.ttf'); }
@font-face { font-family: 'Rajdhani'; font-weight: 700; src: url('/fonts/Rajdhani-Bold.ttf'); }

:root {
  --bg: #0b0f15; --panel: #121924; --panel2: #18212e; --line: #233043; --line2: #2c3b52;
  --tx: #e8eef7; --tx2: #9aa8bb; --tx3: #5f6e83;
  --on: #4ade80; --acc: #3db4ff; --warn: #ffc23d; --bad: #ff5c6c;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--tx);
  font: 600 16px/1.25 'Rajdhani', system-ui, sans-serif; overflow: hidden; }
[hidden] { display: none !important; }

.tarjeta { background: rgba(18,25,36,.95); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.etiqueta { font-weight: 700; font-size: 11px; letter-spacing: .14em; color: var(--tx3); text-transform: uppercase; margin-bottom: 6px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
.nota { color: var(--tx2); font-size: 13px; margin-top: 8px; min-height: 16px; }
.fila { display: flex; gap: 6px; align-items: center; }
.espacio { flex: 1; }

/* Botones */
.boton { font: 700 14px 'Rajdhani', sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--tx);
  background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; padding: 9px 14px; cursor: pointer; min-height: 38px; }
.boton:hover { border-color: var(--acc); }
.boton:active { background: #28405a; }
.boton:disabled { opacity: .4; cursor: default; }
.boton.primario { background: #1f5f3a; border-color: var(--on); color: var(--on); }
.boton.peligro { background: #5a1f28; border-color: var(--bad); color: var(--bad); }
.boton.icono { width: 42px; padding: 0; display: grid; place-items: center; font-size: 18px; }
.boton.icono svg { width: 20px; height: 20px; fill: var(--tx); }
svg.trazo { fill: none !important; stroke: var(--tx); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.boton.desplegable { flex: 1; text-align: left; display: flex; justify-content: space-between; align-items: center; }
.boton.desplegable svg { width: 20px; height: 20px; fill: none; stroke: var(--tx2); stroke-width: 2.4; stroke-linecap: round; transition: transform .15s; }
.boton.desplegable.abierto svg { transform: rotate(180deg); }
.grupo { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
input[type=text], input[type=password] { width: 100%; font: 600 15px 'Rajdhani', sans-serif; color: var(--tx);
  background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; padding: 9px 12px; min-height: 38px; }
input:focus { outline: none; border-color: var(--acc); }

/* Estructura */
#app { height: 100%; display: flex; flex-direction: column; }
#barra { margin: 10px 12px 0; display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 16px; z-index: 1200; position: relative; }
main { position: relative; flex: 1; min-height: 0; }
#mapa { position: absolute; inset: 0; background: #0b0f15; }
.logo { font: 700 22px 'Rajdhani', sans-serif; letter-spacing: .1em; white-space: nowrap; }
.logo span { color: var(--tx); } .logo b { color: var(--acc); font-weight: 700; } .logo i { color: var(--tx3); font-style: normal; font-size: 12px; margin-left: 8px; }
.chip { display: flex; align-items: center; gap: 8px; background: var(--panel2); border-radius: 10px; padding: 5px 12px; }
.chip u { width: 8px; height: 8px; border-radius: 50%; background: var(--tx3); }
.chip em { font-style: normal; font-size: 11px; letter-spacing: .12em; color: var(--tx3); font-weight: 700; }
.chip strong { font-weight: 700; }
#pestanas { display: flex; gap: 4px; }
#pestanas button { font: 700 15px 'Rajdhani', sans-serif; letter-spacing: .1em; color: var(--tx2); background: none; border: 1px solid transparent; border-radius: 10px; padding: 8px 18px; cursor: pointer; }
#pestanas button.activa { color: var(--acc); background: rgba(61,180,255,.16); border-color: var(--acc); }

/* Panel del plan */
#panelPlan { position: absolute; top: 10px; left: 12px; bottom: 10px; width: 330px; overflow-y: auto; z-index: 1000; display: flex; flex-direction: column; gap: 10px; scrollbar-width: none; }
#panelPlan::-webkit-scrollbar { display: none; }
.param { display: flex; align-items: center; padding: 3px 0; }
.param span { flex: 1; color: var(--tx2); font-size: 15px; }
.param .boton { width: 44px; min-height: 34px; padding: 0; font-size: 18px; }
.param b { width: 80px; text-align: center; color: var(--on); font-size: 18px; }
.cifras { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 6px; }
.cifra b { display: block; font-size: 20px; line-height: 1.1; }
.cifra i { font-style: normal; font-size: 10px; letter-spacing: .12em; color: var(--tx3); text-transform: uppercase; font-weight: 700; }
.aviso-plan { color: var(--warn); font-size: 13px; margin-top: 4px; min-height: 16px; }

/* Controles del mapa */
#controlesMapa { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.redondo { width: 48px; height: 48px; border-radius: 50%; background: rgba(18,25,36,.95); border: 1px solid var(--line2); cursor: pointer; display: grid; place-items: center; }
.redondo svg { width: 22px; height: 22px; }
.redondo:hover { border-color: var(--acc); }
#selectorMapa { position: absolute; right: 58px; top: 0; width: 220px; display: flex; flex-direction: column; gap: 6px; }
#selectorMapa .boton.activo { background: #1f5f3a; border-color: var(--on); color: var(--on); }

/* Marcadores de edicion */
.vtx { width: 26px; height: 26px; border-radius: 50%; background: var(--acc); border: 2px solid #fff; color: #0b0f15;
  font: 700 12px 'Rajdhani', sans-serif; display: flex; align-items: center; justify-content: center; cursor: grab; box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
.vtx.sel { border-color: var(--warn); box-shadow: 0 0 0 3px rgba(255,194,61,.45); }
.mid { width: 18px; height: 18px; border-radius: 50%; background: #0b0f15; border: 2px solid var(--acc); color: var(--acc);
  font: 700 14px/1 'Rajdhani', sans-serif; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.asa { width: 32px; height: 32px; border-radius: 50%; background: #0b0f15; border: 2px solid var(--acc); cursor: grab; display: grid; place-items: center; }
.asa svg { width: 16px; height: 16px; fill: none; stroke: var(--acc); stroke-width: 2.2; stroke-linecap: round; }
.asa-et { position: absolute; top: 34px; left: -10px; width: 52px; text-align: center; font: 700 10px 'Rajdhani', sans-serif; letter-spacing: .12em; color: #fff; text-shadow: 0 0 3px #000; pointer-events: none; }
.tiles-oscuro { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9); }
.leaflet-container { font-family: 'Rajdhani', sans-serif; background: #0b0f15; }
.leaflet-control-attribution { background: rgba(11,15,21,.7) !important; color: var(--tx2) !important; }
.leaflet-control-attribution a { color: var(--tx2) !important; }

/* Vistas a pantalla completa: vuelos y misiones */
.vista { position: absolute; inset: 0; background: var(--bg); z-index: 1100; overflow-y: auto; padding: 14px 12px; }
.cabecera-vista { display: flex; align-items: center; margin-bottom: 12px; gap: 12px; }
.resumen-vista { flex: 1; color: var(--tx2); font-size: 15px; font-weight: 700; }
.item { display: flex; align-items: center; gap: 16px; margin-bottom: 10px; }
.item .cab { width: 230px; }
.item .cab b { font-size: 19px; display: block; }
.item .cab small { color: var(--tx2); font-size: 14px; }
.item .datos { flex: 1; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.item .etq { display: inline-block; margin-top: 6px; padding: 3px 10px; border-radius: 8px; border: 1px solid; font: 700 12px 'Rajdhani', sans-serif; letter-spacing: .1em; }
.item .motivo { color: var(--tx3); font-size: 13px; }

/* Avisos */
#aviso { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 3000; display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 2px solid var(--acc); border-radius: 14px; padding: 12px 20px; font-weight: 700; font-size: 15px; max-width: 560px; }
#aviso u { width: 10px; height: 10px; border-radius: 50%; background: var(--acc); flex: none; }
#aviso.ok { border-color: var(--on); } #aviso.ok u { background: var(--on); }
#aviso.aviso { border-color: var(--warn); } #aviso.aviso u { background: var(--warn); }
#aviso.error { border-color: var(--bad); } #aviso.error u { background: var(--bad); }

/* Entrada */
.velo { position: fixed; inset: 0; background: var(--bg); z-index: 4000; display: grid; place-items: center; }
.login { width: 340px; display: flex; flex-direction: column; gap: 10px; padding: 24px; }
.login .logo { font-size: 28px; margin-bottom: 8px; }
.error { color: var(--bad); min-height: 18px; font-size: 14px; }

@media (max-width: 900px) {
  #panelPlan { width: 280px; }
  .item { flex-wrap: wrap; } .item .datos { grid-template-columns: repeat(3, 1fr); width: 100%; order: 3; }
}
