:root {
  --bg: #f4f6f9; --panel: #fff; --ink: #1a1f2b; --muted: #6b7280; --line: #e3e7ee;
  --azul: #2563eb; --verde: #16a34a; --rojo: #dc2626; --amar: #d97706;
  --r: 16px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 10px 30px -14px rgba(16,24,40,.18);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--azul); }

.barra { display: flex; justify-content: space-between; align-items: center; padding: 16px 28px; max-width: 760px; margin: 0 auto; }
.logo { font-weight: 800; font-size: 22px; display: flex; align-items: center; gap: 10px; }
.logo-dot { width: 14px; height: 14px; border-radius: 50%; background: linear-gradient(135deg, #1877f2, #d62976); box-shadow: 0 0 0 5px #e8eefc; }
.engrane { text-decoration: none; color: var(--muted); font-size: 26px; line-height: 1; padding: 6px 10px; border-radius: 10px; }
.engrane:hover { background: #e9edf3; color: var(--ink); }

.pagina { max-width: 760px; margin: 0 auto; padding: 0 28px 80px; }
.pagina[hidden] { display: none; }
h1 { font-size: 30px; margin: 6px 0 18px; }
h2 { font-size: 22px; margin: 0 0 12px; }
h2 small, h1 small { color: var(--muted); font-weight: 400; font-size: 15px; }
h3 { font-size: 16px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 30px 0 10px; }
.volver { display: inline-block; margin: 4px 0 8px; text-decoration: none; font-size: 15px; }

.tarjeta { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 24px; margin-bottom: 18px; }
.aviso { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: var(--r); padding: 14px 18px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.aviso[hidden] { display: none; }

.paso { display: grid; grid-template-columns: 44px 1fr; gap: 16px; padding: 8px 0 22px; }
.paso + .paso { border-top: 1px dashed var(--line); padding-top: 22px; }
.num { width: 40px; height: 40px; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 800; font-size: 19px; display: flex; align-items: center; justify-content: center; }
.paso-cuerpo { min-width: 0; }

.tipo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.tipo-btn { border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 12px 14px; font-weight: 700; font-size: 17px; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 2px; }
.tipo-btn small { font-weight: 400; color: var(--muted); font-size: 13px; }
.tipo-btn.on { border-color: var(--azul); background: #eef3ff; outline: 3px solid rgba(37,99,235,.18); }
.resumen { margin-top: 10px; background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; border-radius: 12px; padding: 10px 14px; font-size: 15px; }
.resumen.aviso { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.formato { font-size: 13px; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; width: 180px; }
.drop { border: 3px dashed #c7cdd8; border-radius: var(--r); min-height: 150px; display: flex; align-items: center; justify-content: center; gap: 20px; text-align: center; cursor: pointer; background: #fafbfd; padding: 18px; transition: .15s; }
.drop:hover, .drop.over { border-color: var(--azul); background: #eef3ff; }
.drop.listo { border-style: solid; border-color: var(--verde); background: #f0fdf4; }
.drop-text { font-size: 20px; font-weight: 600; color: #475569; }
.drop-text small { font-weight: 400; font-size: 15px; color: var(--muted); }
.drop video { height: 170px; border-radius: 10px; background: #000; }

.marcas-btn { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.marca-btn { border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 18px 10px; font-weight: 700; font-size: 17px; cursor: pointer; transition: .12s; border-top: 6px solid var(--c); }
.marca-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.marca-btn.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, #fff); outline: 3px solid color-mix(in srgb, var(--c) 30%, transparent); }
.redes-mini { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; min-height: 34px; }
.red { border: 1px solid var(--line); border-radius: 99px; padding: 5px 12px; font-size: 14px; cursor: pointer; background: #fff; user-select: none; }
.red.on { background: #ecfdf5; border-color: #86efac; }
.red.off { opacity: .45; text-decoration: line-through; }
.red.falta { border-style: dashed; color: var(--muted); cursor: default; }

.campo { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 15px; color: #374151; margin-bottom: 12px; }
.campo small { font-weight: 400; color: var(--muted); }
.campo input, textarea#idea, #rev-titulo-in { width: 100%; border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 17px; font-weight: 400; resize: vertical; background: #fff; }
.drop.mini { min-height: 96px; padding: 12px; margin-bottom: 6px; }
.drop.mini .drop-text { font-size: 16px; }
.drop.mini img { height: 120px; border-radius: 8px; }
.rev-medios { display: flex; flex-direction: column; gap: 10px; }
#rev-thumb { width: 180px; border-radius: 12px; border: 1px solid var(--line); }
.cuando { display: flex; gap: 8px; margin: 14px 0 18px; flex-wrap: wrap; align-items: center; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 8px 14px; cursor: pointer; font-size: 15px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
#otra-hora { border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; }

.grande { width: 100%; border: 0; border-radius: 14px; padding: 18px; font-size: 21px; font-weight: 800; cursor: pointer; background: var(--azul); color: #fff; box-shadow: 0 8px 20px -8px rgba(37,99,235,.6); }
.grande:hover { filter: brightness(1.05); }
.grande.verde { background: var(--verde); box-shadow: 0 8px 20px -8px rgba(22,163,74,.6); }
.grande[disabled], .mediano[disabled] { opacity: .55; cursor: wait; }
.mediano { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 16px; font-size: 16px; font-weight: 600; cursor: pointer; text-decoration: none; color: var(--ink); display: inline-block; }
.mediano.azul { background: var(--azul); color: #fff; border-color: var(--azul); }
.mediano.gris { color: var(--muted); }
.mediano.rojo { color: var(--rojo); }
.link { background: none; border: 0; color: var(--azul); cursor: pointer; padding: 0; text-decoration: underline; font-size: 15px; }
.msg { font-size: 15px; color: var(--muted); margin: 10px 0 0; min-height: 1em; }
.msg.bad { color: var(--rojo); } .msg.ok { color: var(--verde); }
.fila { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.ayuda { color: var(--muted); font-size: 15px; }
code { background: var(--bg); border: 1px solid var(--line); padding: 2px 7px; border-radius: 6px; font-size: 14px; word-break: break-all; }

.revision { border: 2px solid #bbf7d0; }
.rev-grid { display: grid; grid-template-columns: 180px 1fr; gap: 20px; align-items: start; }
#rev-video { width: 180px; border-radius: 12px; background: #000; }
.texto-red { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: #fafbfd; }
.texto-red header { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: 6px; font-size: 15px; }
.texto-red header .est { font-weight: 600; font-size: 14px; }
.texto-red textarea { width: 100%; border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 6px 8px; font-size: 16px; resize: none; overflow: hidden; line-height: 1.4; }
.texto-red textarea:hover { border-color: var(--line); background: #fff; }
.texto-red textarea:focus { outline: 2px solid var(--azul); border-color: transparent; background: #fff; }
.texto-red .err { color: var(--rojo); font-size: 14px; margin-top: 6px; }
.texto-red .ok { color: var(--verde); font-size: 14px; margin-top: 6px; }
.check-prueba { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 15px; color: #374151; background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 10px 12px; }
.check-prueba input { width: 18px; height: 18px; }
.rev-acciones { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; align-items: center; }
.rev-acciones .grande { width: auto; flex: 1 1 240px; }

.lista { display: flex; flex-direction: column; gap: 10px; }
.item { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: center; cursor: pointer; border-left: 6px solid var(--c, var(--line)); }
.item:hover { box-shadow: var(--shadow); }
.item video { width: 52px; height: 78px; border-radius: 8px; background: #000; object-fit: cover; }
.item .t { font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.item .tag { font-size: 13px; color: #fff; background: var(--c); border-radius: 99px; padding: 2px 9px; }
.item .s { color: var(--muted); font-size: 14px; }
.item .redes { display: flex; gap: 10px; margin-top: 6px; font-size: 15px; flex-wrap: wrap; }
.item .estado { font-size: 14px; font-weight: 700; padding: 6px 12px; border-radius: 99px; white-space: nowrap; }
.e-pendiente_aprobacion { background: #fef3c7; color: var(--amar); }
.e-programado { background: #dbeafe; color: #1d4ed8; }
.e-publicando { background: #e0e7ff; color: #4338ca; animation: pulse 1.2s infinite; }
.e-publicado { background: #dcfce7; color: var(--verde); }
.e-error, .e-parcial { background: #fee2e2; color: var(--rojo); }
@keyframes pulse { 50% { opacity: .5; } }

.form label { display: flex; flex-direction: column; gap: 6px; font-size: 15px; color: #374151; margin-bottom: 14px; }
.form input, .form select { border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; background: #fff; width: 100%; font-size: 16px; }
.avanzado { margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 12px; }
.avanzado summary { cursor: pointer; color: var(--muted); margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

.red-sec { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-top: 12px; }
.red-sec .red-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.red-sec h4 { margin: 0; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.red-sec .vacia { color: var(--muted); font-size: 14px; padding: 8px 0 2px; }
.fila-cta { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.fila-cta .n { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fila-cta img { width: 32px; height: 32px; border-radius: 50%; }
.fila-cta .nom { font-weight: 600; }
.fila-cta small { color: var(--muted); display: block; font-size: 12.5px; }
.fila-cta .der { display: flex; align-items: center; gap: 8px; }
.fila-cta select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 14px; background: #fff; }
.fila-cta select.sin { border-color: #fbbf24; background: #fffbeb; }
.fila-cta .quitar { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; }
.mini-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 0 2px; }
.mini-form select { border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.chip-marca { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 99px; padding: 5px 10px; font-size: 14px; }
.chip-marca i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.cm { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-top: 12px; border-left: 6px solid var(--c); }
.cm h4 { margin: 0 0 8px; font-size: 18px; }
.cm .slot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px dashed var(--line); }
.cm .slot:first-of-type { border-top: 0; }
.cm .slot .n { display: flex; align-items: center; gap: 10px; }
.cm .slot img { width: 30px; height: 30px; border-radius: 50%; }
.cm .slot .ok { color: var(--verde); font-weight: 600; }
.cm .slot small { color: var(--muted); }
.mini-sel { border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; font-size: 13px; background: #fff; }
.cm .slot .quitar { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; }
.sin { background: #fff7ed; border: 1px solid #fed7aa; border-radius: 14px; padding: 12px 16px; margin-top: 14px; }
.sin .fila { margin: 6px 0; }

.log { background: #0f172a; color: #e2e8f0; padding: 14px; border-radius: 12px; font: 13px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; max-height: 50vh; overflow: auto; }
.log .error { color: #fca5a5; } .log .warn { color: #fcd34d; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 14px 20px; border-radius: 12px; opacity: 0; transition: .25s; pointer-events: none; font-size: 16px; max-width: 90vw; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--rojo); }

@media (max-width: 640px) {
  .pagina, .barra { padding-left: 16px; padding-right: 16px; }
  .marcas-btn { grid-template-columns: 1fr; }
  .rev-grid { grid-template-columns: 1fr; } #rev-video { width: 100%; max-width: 240px; }
  .grid2 { grid-template-columns: 1fr; }
  .drop { flex-direction: column; }
}


/* ---- Ajustes: checklist, empresas, cabeceras ---- */
.checklist { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.check-item { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.check-item .ic { font-size: 20px; line-height: 1; }
.check-item b { display: block; }
.check-item small { color: var(--muted); }
.check-item.ok { border-color: #bbf7d0; background: #f0fdf4; }
.check-item.falta { border-color: #fde68a; background: #fffbeb; }
.sec-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.sec-head h2 { margin: 0; }
.nueva-empresa { background: #eef3ff; border: 1px solid #c7d2fe; border-radius: 12px; padding: 12px; margin: 10px 0; }
.nueva-empresa input[type="text"], .nueva-empresa input:not([type]) { flex: 1; min-width: 180px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.nueva-empresa input[type="color"] { width: 46px; height: 42px; border: 0; background: none; padding: 0; }
.empresas { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 12px; }
.emp { border: 1px solid var(--line); border-radius: 14px; padding: 14px; border-top: 6px solid var(--c); background: #fff; }
.emp h4 { margin: 0 0 6px; font-size: 17px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.emp .redes-emp { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 10px; }
.emp .r { font-size: 13px; border-radius: 99px; padding: 3px 9px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); }
.emp .r.si { background: #ecfdf5; border-color: #86efac; color: #166534; }
.emp .acc { display: flex; gap: 8px; flex-wrap: wrap; }
.emp .acc button { font-size: 13px; padding: 6px 10px; }
.emp-edit { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.emp-edit input:not([type="color"]) { flex: 1; min-width: 120px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.emp-edit input[type="color"] { width: 38px; height: 34px; border: 0; background: none; padding: 0; }
.marca-btn .mini-redes { display: block; font-weight: 400; font-size: 13px; color: var(--muted); margin-top: 4px; }
.marca-btn .mini-redes.vacio { color: #b45309; }
#det-llaves > summary { cursor: pointer; font-size: 17px; }

/* ---- Responsive: celular ---- */
@media (max-width: 640px) {
  html, body { font-size: 16px; }
  .barra { padding: 12px 14px; }
  .tipo { grid-template-columns: 1fr; }
  .checklist { grid-template-columns: 1fr; }
  .paso { grid-template-columns: 34px 1fr; gap: 10px; }
  .num { width: 32px; height: 32px; font-size: 16px; }
  h2 { font-size: 19px; }
  .grande { font-size: 18px; padding: 16px; }
  .rev-acciones .grande, .rev-acciones .mediano { width: 100%; text-align: center; }
  .fila-cta { flex-direction: column; align-items: stretch; }
  .fila-cta .der { justify-content: space-between; }
  .red-sec .red-head { flex-direction: column; align-items: stretch; }
  .red-sec .red-head .mediano { text-align: center; }
  .sec-head { flex-direction: column; align-items: stretch; }
  .sec-head .mediano { text-align: center; }
  .item { grid-template-columns: 44px 1fr; }
  .item .estado { grid-column: 1 / -1; justify-self: start; }
  .tarjeta { padding: 16px; }
  .drop { min-height: 120px; }
  .cuando { gap: 6px; }
  .chip { font-size: 14px; padding: 7px 11px; }
}

/* ===== Barra: selector de cliente (solo el dueño) y salir ===== */
.barra-der { display: flex; align-items: center; gap: 10px; }
.cliente-sel { position: relative; }
.cliente-btn { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: 14px; cursor: pointer; color: #334155; white-space: nowrap; }
.cliente-btn:hover { border-color: #94a3b8; }
.cliente-btn b { color: #0f172a; }
.cliente-btn .flecha { color: #94a3b8; margin-left: 2px; }
.cliente-fijo { font-size: 14px; color: #475569; }
.cliente-menu { position: absolute; right: 0; top: 42px; min-width: 250px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(15,23,42,.12); padding: 6px; z-index: 40; }
.cliente-menu button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 8px; font-size: 14px; cursor: pointer; color: #334155; }
.cliente-menu button:hover { background: #f1f5f9; }
.cliente-menu button.on { background: #eff6ff; color: #1d4ed8; font-weight: 600; }
.cliente-menu .sep { height: 1px; background: var(--line); margin: 6px 4px; }
.cliente-menu .etiq { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #94a3b8; padding: 6px 12px 2px; }

/* ===== Clientes y licencias ===== */
.sub-titulo { font-size: 15px; margin: 22px 0 8px; color: #334155; }
.lista-lic { display: flex; flex-direction: column; gap: 8px; }
.lic { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.lic code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; background: #f1f5f9; padding: 4px 8px; border-radius: 6px; letter-spacing: .02em; }
.lic .quien { flex: 1; min-width: 140px; color: #475569; font-size: 14px; }
.lic .cifras { color: #94a3b8; font-size: 13px; }
.chip-estado { font-size: 12px; padding: 3px 9px; border-radius: 999px; font-weight: 600; }
.chip-libre { background: #ecfdf5; color: #047857; }
.chip-usada { background: #eff6ff; color: #1d4ed8; }
.chip-suspendida { background: #fef2f2; color: #b91c1c; }
.campo.chico { max-width: 110px; }

/* ===== Alta de clientes a mano y sus usuarios ===== */
.entrega { margin: 14px 0; padding: 14px 16px; border: 1px solid #a7f3d0; background: #f0fdf4; border-radius: 12px; }
.entrega-head { font-size: 15px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.entrega-fila { display: flex; gap: 10px; align-items: center; margin: 5px 0; font-size: 14px; }
.entrega-fila span { min-width: 90px; color: #475569; }
.entrega-fila code { font-family: ui-monospace, Menlo, Consolas, monospace; background: #fff; border: 1px solid #d1fae5; padding: 4px 10px; border-radius: 6px; font-size: 14px; user-select: all; }
.usuarios-caja { margin: -4px 0 10px 18px; padding: 10px 12px; border-left: 3px solid var(--line); background: #f8fafc; border-radius: 0 10px 10px 0; }
.usuario { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 6px 0; font-size: 14px; border-bottom: 1px solid #eef2f7; }
.usuario:last-of-type { border-bottom: 0; }
.mediano.verde { background: #059669; color: #fff; border-color: #059669; }
