:root {
  --bg: #1a1a2e;
  --bg2: #16213e;
  --bg3: #0f3460;
  --accent: #e94560;
  --accent2: #f5a623;
  --text: #eaeaea;
  --text2: #a0a0b0;
  --success: #27ae60;
  --danger: #e74c3c;
  --border: #2a2a4a;
  --radius: 10px;
  --touch: 48px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  overflow: hidden;
}

/* ── Pantallas ── */
.screen { display: none; flex-direction: column; height: 100dvh; width: 100%; position: absolute; top: 0; left: 0; }
.screen.activa { display: flex; }

/* ── Header ── */
.header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--touch);
  flex-shrink: 0;
}
.header h1 { font-size: 1rem; font-weight: 600; letter-spacing: 0.5px; }
.header .empresa { font-size: 0.75rem; color: var(--text2); }

/* ── Contenido scrollable ── */
.contenido { flex: 1; overflow-y: auto; padding: 16px; }
.contenido-noscroll { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

/* ── Formularios ── */
.form-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  max-width: 400px;
  margin: 0 auto;
}
.form-card h2 { font-size: 1.2rem; margin-bottom: 20px; text-align: center; }
.form-card .subtitulo { font-size: 0.8rem; color: var(--text2); text-align: center; margin-bottom: 20px; }

.campo { margin-bottom: 14px; }
.campo label { display: block; font-size: 0.78rem; color: var(--text2); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.5px; }
.campo input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  padding: 12px 14px;
  min-height: var(--touch);
  outline: none;
  transition: border-color 0.2s;
}
.campo input:focus { border-color: var(--accent); }

/* ── Botones ── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch);
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0 20px;
  transition: opacity 0.15s, transform 0.1s;
  width: 100%;
}
.btn:active { transform: scale(0.97); opacity: 0.85; }
.btn-primario { background: var(--accent); color: #fff; }
.btn-secundario { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-exito { background: var(--success); color: #fff; }
.btn-peligro { background: var(--danger); color: #fff; }
.btn:disabled { opacity: 0.4; pointer-events: none; }

/* ── Lista de terminales ── */
.lista-items { display: flex; flex-direction: column; gap: 10px; }
.item-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--touch);
  transition: border-color 0.2s;
}
.item-card:active { border-color: var(--accent); }
.item-card .nombre { font-weight: 600; }
.item-card .detalle { font-size: 0.78rem; color: var(--text2); margin-top: 2px; }
.badge {
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 600;
}
.badge-abierta { background: #1a4a2e; color: #2ecc71; }
.badge-cerrada { background: #2a1a1a; color: var(--text2); }

/* ── Footer de pantalla ── */
.footer-acciones {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* ── Alerta / Toast ── */
#toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 0.85rem;
  z-index: 9999;
  display: none;
  white-space: nowrap;
  max-width: 90vw;
  text-align: center;
}
#toast.error { background: var(--danger); }
#toast.exito { background: var(--success); }

/* ── Loading overlay ── */
#loading {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 8888;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
}
#loading.visible { display: flex; }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Logo / marca ── */
.logo-wrap { text-align: center; margin-bottom: 28px; }
.logo-wrap .logo-texto { font-size: 2rem; font-weight: 700; color: var(--accent); letter-spacing: 2px; }
.logo-wrap .logo-sub { font-size: 0.75rem; color: var(--text2); }

/* ── Pantalla full centrada (login) ── */
.screen-centrada { justify-content: center; padding: 20px; overflow-y: auto; }
