/* Panel en vidrio. Tres aspectos: Referencia claro, Referencia oscuro y Ámbar oscuro (data-paleta + data-theme).
   Tokens de tema (vidrio, tinta, estados) + tokens de paleta (fondo, acento, esfera). Los bloques oscuros redefinen todo. */
:root {
  /* tema claro */
  --ink: #1b2350; --muted: #666c8a; --line: rgba(27, 35, 80, .10); --line-2: rgba(27, 35, 80, .06);
  --panel: rgba(255, 255, 255, .58); --panel-2: rgba(255, 255, 255, .5); --campo: rgba(255, 255, 255, .78); --activo: rgba(255, 255, 255, .92);
  --vidrio-borde: rgba(255, 255, 255, .92); --vidrio-luz: rgba(255, 255, 255, .95); --th: rgba(252, 252, 255, .9); --cajon: rgba(250, 250, 255, .8);
  --solido: #1b2350; --solido-tinta: #ffffff; --velo: rgba(40, 40, 80, .22);
  --ok: #15803d; --ok-bg: rgba(220, 252, 231, .8); --warn: #b45309; --warn-bg: rgba(254, 243, 199, .8); --bad: #c8312b; --bad-bg: rgba(254, 226, 226, .8); --bad-solido: #c8312b; --info: #4f5fd0; --info-bg: rgba(231, 235, 255, .85);
  --sombra: 0 1px 2px rgba(27, 35, 80, .04), 0 12px 32px rgba(130, 130, 200, .14); --sombra-chica: 0 1px 2px rgba(27, 35, 80, .06), 0 4px 12px rgba(130, 130, 200, .12);
  --desenfoque: blur(20px) saturate(150%);
  /* paleta referencia, claro */
  --bg: #eef0fb;
  --fondo: linear-gradient(118deg, #cdeff6 0%, #e4f4fa 28%, #f4f1fb 55%, #f9e6f2 80%, #f5d9ec 100%);
  --bola1: radial-gradient(circle at 35% 30%, #ffffff, #d9f4f7 48%, #b9e3ee 100%);
  --bola2: radial-gradient(circle at 35% 30%, #fdeaf5, #ecc9f0 50%, #c9b9f3 100%);
  --acento: #7a68ee; --acento-2: #8f80f4; --acento-tinta: #ffffff; --acento-texto: #5a47d4; --acento-bg: rgba(122, 104, 238, .12);
  --acento-g: linear-gradient(135deg, #8fa6fa, #7a68ee 55%, #b98ae6);
  --o-base: radial-gradient(circle at 50% 32%, #ffffff 0%, #fbfaff 40%, #eeeafd 74%, #ddd8f8 100%);
  --o-sombra: inset 0 -5px 9px rgba(186, 176, 245, .5), inset 0 4px 8px #ffffff, 0 4px 12px rgba(150, 140, 230, .3);
  --remolino: linear-gradient(98deg, rgba(143, 176, 251, 0) 2%, #86a2f7 18%, #6d78ee 40%, #8a68ec 62%, rgba(226, 150, 226, .8) 82%, rgba(240, 170, 220, 0) 98%);
  --o-mezcla: normal;
  --radio: 20px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #eef0f5; --muted: #9a9eab; --line: rgba(255, 255, 255, .09); --line-2: rgba(255, 255, 255, .055);
    --panel: rgba(255, 255, 255, .05); --panel-2: rgba(255, 255, 255, .04); --campo: rgba(255, 255, 255, .06); --activo: rgba(255, 255, 255, .10);
    --vidrio-borde: rgba(255, 255, 255, .10); --vidrio-luz: rgba(255, 255, 255, .08); --th: rgba(24, 25, 30, .94); --cajon: rgba(18, 19, 23, .86);
    --solido: #eef0f5; --solido-tinta: #121318; --velo: rgba(0, 0, 0, .5);
    --ok: #4ade80; --ok-bg: rgba(20, 83, 45, .35); --warn: #fbbf24; --warn-bg: rgba(120, 83, 9, .3); --bad: #f87171; --bad-bg: rgba(127, 29, 29, .38); --bad-solido: #b91c1c; --info: #a5b4fc; --info-bg: rgba(55, 65, 140, .3);
    --sombra: 0 1px 2px rgba(0, 0, 0, .3), 0 14px 34px rgba(0, 0, 0, .35); --sombra-chica: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 12px rgba(0, 0, 0, .3);
    --bg: #0c0d10;
    --fondo: radial-gradient(circle at 14% 30%, rgba(150, 175, 200, .14), transparent 42%), radial-gradient(circle at 86% 78%, rgba(190, 150, 200, .12), transparent 42%), linear-gradient(160deg, #0a0b0d, #17181c 55%, #0d0e11);
    --bola1: radial-gradient(circle at 35% 30%, #5a6068, #26282d 55%, #111215 100%);
    --bola2: radial-gradient(circle at 35% 30%, #65596c, #2b2630 55%, #131115 100%);
    --acento: #a99cf8; --acento-2: #bcb2fb; --acento-tinta: #15131f; --acento-texto: #c4baff; --acento-bg: rgba(169, 156, 248, .14);
    --acento-g: linear-gradient(135deg, #93b1fb, #a99cf8 55%, #e0a3e4);
    --o-base: radial-gradient(circle at 50% 30%, #4a4d55 0%, #2a2c32 45%, #141518 100%);
    --o-sombra: inset 0 -5px 9px rgba(150, 136, 246, .3), inset 0 3px 6px rgba(255, 255, 255, .1), 0 0 14px rgba(140, 126, 240, .35);
    --remolino: linear-gradient(98deg, rgba(143, 176, 251, 0) 2%, #86a2f7 18%, #6d78ee 40%, #8a68ec 62%, rgba(226, 150, 226, .8) 82%, rgba(240, 170, 220, 0) 98%);
    --o-mezcla: screen; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #eef0f5; --muted: #9a9eab; --line: rgba(255, 255, 255, .09); --line-2: rgba(255, 255, 255, .055);
  --panel: rgba(255, 255, 255, .05); --panel-2: rgba(255, 255, 255, .04); --campo: rgba(255, 255, 255, .06); --activo: rgba(255, 255, 255, .10);
  --vidrio-borde: rgba(255, 255, 255, .10); --vidrio-luz: rgba(255, 255, 255, .08); --th: rgba(24, 25, 30, .94); --cajon: rgba(18, 19, 23, .86);
  --solido: #eef0f5; --solido-tinta: #121318; --velo: rgba(0, 0, 0, .5);
  --ok: #4ade80; --ok-bg: rgba(20, 83, 45, .35); --warn: #fbbf24; --warn-bg: rgba(120, 83, 9, .3); --bad: #f87171; --bad-bg: rgba(127, 29, 29, .38); --bad-solido: #b91c1c; --info: #a5b4fc; --info-bg: rgba(55, 65, 140, .3);
  --sombra: 0 1px 2px rgba(0, 0, 0, .3), 0 14px 34px rgba(0, 0, 0, .35); --sombra-chica: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 12px rgba(0, 0, 0, .3);
  --bg: #0c0d10;
  --fondo: radial-gradient(circle at 14% 30%, rgba(150, 175, 200, .14), transparent 42%), radial-gradient(circle at 86% 78%, rgba(190, 150, 200, .12), transparent 42%), linear-gradient(160deg, #0a0b0d, #17181c 55%, #0d0e11);
  --bola1: radial-gradient(circle at 35% 30%, #5a6068, #26282d 55%, #111215 100%);
  --bola2: radial-gradient(circle at 35% 30%, #65596c, #2b2630 55%, #131115 100%);
  --acento: #a99cf8; --acento-2: #bcb2fb; --acento-tinta: #15131f; --acento-texto: #c4baff; --acento-bg: rgba(169, 156, 248, .14);
  --acento-g: linear-gradient(135deg, #93b1fb, #a99cf8 55%, #e0a3e4);
  --o-base: radial-gradient(circle at 50% 30%, #4a4d55 0%, #2a2c32 45%, #141518 100%);
  --o-sombra: inset 0 -5px 9px rgba(150, 136, 246, .3), inset 0 3px 6px rgba(255, 255, 255, .1), 0 0 14px rgba(140, 126, 240, .35);
  --remolino: linear-gradient(98deg, rgba(143, 176, 251, 0) 2%, #86a2f7 18%, #6d78ee 40%, #8a68ec 62%, rgba(226, 150, 226, .8) 82%, rgba(240, 170, 220, 0) 98%);
  --o-mezcla: screen; color-scheme: dark;
}
:root[data-theme="dark"][data-paleta="ambar"] {
  --bg: #0e0d0a;
  --fondo: radial-gradient(circle at 14% 28%, rgba(245, 158, 11, .15), transparent 42%), radial-gradient(circle at 86% 78%, rgba(234, 88, 12, .10), transparent 42%), linear-gradient(160deg, #0b0a08, #181611 55%, #0e0d0a);
  --bola1: radial-gradient(circle at 35% 30%, #6e5d3a, #2e2717 55%, #13100a 100%);
  --bola2: radial-gradient(circle at 35% 30%, #6e4a33, #302019 55%, #140e0b 100%);
  --acento: #fbbf24; --acento-2: #fcd34d; --acento-tinta: #1b1300; --acento-texto: #fcd34d; --acento-bg: rgba(251, 191, 36, .13);
  --acento-g: linear-gradient(135deg, #fde68a, #fbbf24 60%, #f97316);
  --o-base: radial-gradient(circle at 50% 30%, #514a3b 0%, #2c281f 45%, #15130e 100%);
  --o-sombra: inset 0 -5px 9px rgba(251, 191, 36, .3), inset 0 3px 6px rgba(255, 255, 255, .1), 0 0 14px rgba(245, 158, 11, .35);
  --remolino: linear-gradient(98deg, rgba(252, 211, 77, 0) 2%, #fcc93a 18%, #f59e0b 40%, #ec7c14 62%, rgba(239, 100, 80, .65) 82%, rgba(239, 100, 80, 0) 98%);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background-color: var(--bg); background-image: var(--fondo); background-attachment: fixed; color: var(--ink); font: 14px/1.5 "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
/* Esferas difusas del fondo, como en la referencia */
body::before, body::after { content: ""; position: fixed; border-radius: 50%; z-index: -1; pointer-events: none; }
body::before { width: 300px; height: 300px; left: -110px; top: 44%; background: var(--bola1); filter: blur(6px); opacity: .75; }
body::after { width: 420px; height: 420px; right: -150px; bottom: -60px; background: var(--bola2); filter: blur(10px); opacity: .7; }
a { color: var(--acento-texto); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; letter-spacing: -.015em; }
button, input, select, textarea { font: inherit; color: inherit; }
code, .mono { font-family: "Cascadia Code", Consolas, ui-monospace, monospace; font-size: 12.5px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }

/* Vidrio: tarjetas, lateral, tablas, cajón */
.vidrio, .tarjeta, .lateral, .tabla-caja { background: var(--panel); border: 1px solid var(--vidrio-borde); -webkit-backdrop-filter: var(--desenfoque); backdrop-filter: var(--desenfoque); box-shadow: var(--sombra), inset 0 1px 0 var(--vidrio-luz); }

/* Esfera de la marca (sigue la paleta) */
.orbe-mini { width: 34px; height: 34px; border-radius: 50%; background: var(--o-base); box-shadow: var(--o-sombra); position: relative; overflow: hidden; flex: none; display: inline-block; isolation: isolate; }
.orbe-mini::after { content: ""; position: absolute; left: -14%; right: -14%; top: 28%; height: 42%; background: var(--remolino); filter: blur(2.5px); border-radius: 50%; transform: rotate(-14deg); mix-blend-mode: var(--o-mezcla); animation: ola 7s ease-in-out infinite; }
.orbe-mini.chica { width: 15px; height: 15px; }
.orbe-mini.chica::after { filter: blur(1.2px); }
@keyframes ola { 0%, 100% { transform: rotate(-14deg) translateX(-4%); } 50% { transform: rotate(-8deg) translateX(5%); } }

/* ── Estructura ── */
.marco { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.lateral { color: var(--ink); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 14px; margin: 14px 0 14px 14px; height: calc(100vh - 28px); border-radius: 26px; }
.marca { display: flex; align-items: center; gap: 11px; padding: 4px 10px 18px; color: var(--ink); }
.marca b { font-size: 19px; letter-spacing: -.01em; }
.marca small { display: block; font-size: 11px; color: var(--muted); letter-spacing: .6px; text-transform: uppercase; }
.nav { display: grid; gap: 3px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 14px; color: var(--muted); font-weight: 550; transition: background .18s, color .18s, transform .18s, box-shadow .18s; }
.nav a:hover { background: var(--panel-2); color: var(--ink); text-decoration: none; transform: translateX(2px); }
.nav a.activo { background: var(--activo); color: var(--ink); box-shadow: var(--sombra-chica); }
.nav a.activo svg { color: var(--acento-texto); }
.nav a svg { width: 19px; height: 19px; flex: none; }
.lateral .pie { margin-top: auto; font-size: 12px; color: var(--muted); padding: 12px 10px 4px; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.lateral .pie .fila { gap: 2px; }
.principal { min-width: 0; display: flex; flex-direction: column; }
.barra { display: flex; align-items: center; gap: 12px; padding: 24px 28px 14px; position: sticky; top: 0; z-index: 5; -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.barra h1 { font-size: 24px; font-weight: 750; }
.barra .sub { color: var(--muted); font-size: 13px; }
.barra .der { margin-left: auto; display: flex; gap: 8px; align-items: center; }
#vista { padding: 12px 28px 60px; display: grid; gap: 18px; animation: entra .35s ease both; }
@keyframes entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Piezas ── */
.tarjeta { border-radius: var(--radio); padding: 18px 20px; min-width: 0; }
.tarjeta > h2 { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.tarjeta > h2 .der { margin-left: auto; display: flex; gap: 8px; font-weight: 400; }
.rejilla { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.rejilla.dos { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.cifra { display: grid; gap: 2px; position: relative; overflow: hidden; }
.cifra b { font-size: 30px; font-weight: 750; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.cifra span { color: var(--muted); font-size: 12.5px; }
.tarjeta.cifra::after { content: ""; position: absolute; right: -26px; top: -26px; width: 96px; height: 96px; border-radius: 50%; background: var(--acento-g); filter: blur(18px); opacity: .28; }
.etq { font-size: 11px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.fila { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.fila.fin { justify-content: flex-end; }
.pila { display: grid; gap: 12px; align-content: start; }
.rejilla.ancha { grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); align-items: start; }
.sep { height: 1px; background: var(--line); margin: 4px 0; }

.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--vidrio-borde); background: var(--campo); padding: 7px 14px; border-radius: 12px; cursor: pointer; font-weight: 600; font-size: 13px; box-shadow: var(--sombra-chica); transition: transform .12s, background .15s, border-color .15s, box-shadow .15s; white-space: nowrap; }
.btn:hover { border-color: var(--acento); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.prim { background: var(--acento-g); border-color: transparent; color: var(--acento-tinta); box-shadow: 0 6px 18px color-mix(in srgb, var(--acento) 35%, transparent); }
.btn.prim:hover { filter: brightness(1.05); }
.btn.navy { background: var(--solido); border-color: var(--solido); color: var(--solido-tinta); }
.btn.peligro { color: var(--bad); }
.btn.peligro:hover { border-color: var(--bad); background: var(--bad-bg); }
.btn.chico { padding: 4px 10px; font-size: 12px; border-radius: 10px; }
.btn.fantasma { border-color: transparent; background: transparent; box-shadow: none; }
.btn.fantasma:hover { background: var(--panel-2); }
.btn svg { width: 15px; height: 15px; }

.pastilla { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line-2); color: var(--muted); white-space: nowrap; }
.pastilla.ok { background: var(--ok-bg); color: var(--ok); }
.pastilla.warn { background: var(--warn-bg); color: var(--warn); }
.pastilla.bad { background: var(--bad-bg); color: var(--bad); }
.pastilla.info { background: var(--info-bg); color: var(--info); }
.pastilla.amb { background: var(--acento-bg); color: var(--acento-texto); }
.punto { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }
.punto.vivo { animation: late 1.6s ease-in-out infinite; }
@keyframes late { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 50%, transparent); } 50% { box-shadow: 0 0 0 5px transparent; } }

/* Campos */
.campo { display: grid; gap: 5px; min-width: 0; align-content: start; }
.campo > label, .campo > .etq { font-size: 12px; font-weight: 600; color: var(--muted); }
.entrada, select.entrada, textarea.entrada { width: 100%; border: 1px solid var(--line); background: var(--campo); border-radius: 12px; padding: 8px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
.entrada:focus { border-color: var(--acento); box-shadow: 0 0 0 3px var(--acento-bg); }
textarea.entrada { resize: vertical; min-height: 120px; line-height: 1.5; }
.ayuda { font-size: 12px; color: var(--muted); }
.campos { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.campos.dos { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.cajon .cuerpo > *, .entrada { min-width: 0; }

/* Edición en el renglón: parece texto hasta que lo tocas */
.linea { border: 1px solid transparent; background: transparent; border-radius: 9px; padding: 4px 7px; margin: -4px -7px; width: calc(100% + 14px); min-width: 60px; outline: none; transition: background .15s, border-color .15s, box-shadow .2s; }
.linea:hover { background: var(--campo); border-color: var(--line); }
.linea:focus { background: var(--campo); border-color: var(--acento); box-shadow: 0 0 0 3px var(--acento-bg); }
.linea::placeholder { color: var(--muted); opacity: .7; font-style: italic; }
select.linea { cursor: pointer; appearance: none; padding-right: 18px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 9px) 50%, calc(100% - 5px) 50%; background-size: 4px 4px; background-repeat: no-repeat; }
select option { background: var(--bg); color: var(--ink); }
.guardado { animation: guardado 1.1s ease; }
@keyframes guardado { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); background: var(--ok-bg); } 100% { box-shadow: 0 0 0 8px transparent; } }
.titulo-linea { font-size: 17px; font-weight: 700; }

/* Interruptor */
.interruptor { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; user-select: none; }
.interruptor input { display: none; }
.interruptor .riel { flex: none; width: 40px; height: 22px; border-radius: 99px; background: var(--line); position: relative; transition: background .2s; margin-top: 1px; }
.interruptor .riel::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .22s cubic-bezier(.3, 1.4, .6, 1); }
.interruptor input:checked + .riel { background: var(--acento-g); }
.interruptor input:checked + .riel::after { transform: translateX(18px); }
.interruptor b { display: block; font-size: 13.5px; }
.interruptor small { color: var(--muted); font-size: 12px; display: block; }
.interruptor.destacado { padding: 12px 14px; border-radius: 14px; border: 1px dashed var(--acento); background: var(--acento-bg); }

/* Chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--campo); border-radius: 999px; padding: 3px 11px; font-size: 12.5px; cursor: pointer; transition: all .15s; }
.chip:hover { border-color: var(--acento); }
.chip.si { background: var(--solido); border-color: var(--solido); color: var(--solido-tinta); }

/* Tablas */
.tabla-caja { overflow-x: auto; border-radius: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; padding: 10px 14px; background: var(--th); border-bottom: 1px solid var(--line); position: sticky; top: 0; white-space: nowrap; }
td { padding: 9px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: var(--panel-2); }
tbody tr.aparece { animation: entra .3s ease both; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.vacio { padding: 40px 20px; text-align: center; color: var(--muted); }

/* Barra de avance */
.avance { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; display: flex; }
.avance i { display: block; height: 100%; transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.avance .a-ok { background: var(--ok); }
.avance .a-amb { background: var(--acento); }
.avance .a-info { background: var(--info); }
.avance .a-bad { background: var(--bad); }

/* Cuentas */
.cuenta { display: grid; gap: 12px; }
.cuenta .cab { display: flex; gap: 12px; align-items: center; }
.avatar { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: var(--acento-g); color: var(--acento-tinta); font-weight: 700; flex: none; }

/* Eventos */
.eventos { display: grid; gap: 2px; }
.evento { display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; padding: 9px 4px; border-bottom: 1px solid var(--line-2); align-items: start; animation: entra .3s ease both; }
.evento:last-child { border-bottom: 0; }
.evento .punto { margin-top: 6px; color: var(--muted); }
.evento.alerta .punto { color: var(--bad); }
.evento.aviso .punto { color: var(--warn); }
.evento.info .punto { color: var(--ok); }
.evento small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.evento .tipo { font-size: 11.5px; color: var(--muted); }

/* Cajón lateral */
.velo { position: fixed; inset: 0; background: var(--velo); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); z-index: 20; animation: aparece .2s ease both; }
@keyframes aparece { from { opacity: 0; } }
.cajon { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); background: var(--cajon); -webkit-backdrop-filter: blur(28px) saturate(150%); backdrop-filter: blur(28px) saturate(150%); border-left: 1px solid var(--vidrio-borde); border-radius: 26px 0 0 26px; z-index: 21; box-shadow: -20px 0 60px rgba(0, 0, 0, .2); display: flex; flex-direction: column; animation: desliza .32s cubic-bezier(.2, .8, .2, 1) both; overflow: hidden; }
@keyframes desliza { from { transform: translateX(40px); opacity: 0; } }
.cajon header { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.cajon header h2 { font-size: 17px; }
.cajon .cuerpo { padding: 20px 22px; overflow-y: auto; display: grid; gap: 18px; align-content: start; flex: 1; }
.cajon footer { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
.segmento { display: inline-flex; padding: 3px; border-radius: 14px; background: var(--line-2); gap: 3px; }
.segmento button { border: 0; background: transparent; padding: 7px 14px; border-radius: 11px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); transition: all .18s; }
.segmento button.si { background: var(--activo); color: var(--ink); box-shadow: var(--sombra-chica); }
details.mas { border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); }
details.mas summary { padding: 11px 14px; cursor: pointer; font-weight: 600; font-size: 13px; list-style: none; display: flex; align-items: center; gap: 8px; }
details.mas summary::before { content: "›"; transition: transform .2s; display: inline-block; font-size: 16px; color: var(--muted); }
details.mas[open] summary::before { transform: rotate(90deg); }
details.mas > div { padding: 4px 14px 14px; }

/* Imagen */
.suelta { border: 2px dashed var(--line); border-radius: 14px; padding: 16px; display: flex; gap: 14px; align-items: center; cursor: pointer; transition: border-color .15s, background .15s; background: var(--panel-2); }
.suelta:hover, .suelta.encima { border-color: var(--acento); background: var(--acento-bg); }
.suelta img { width: 74px; height: 74px; object-fit: cover; border-radius: 12px; }
.galeria { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.galeria img { width: 58px; height: 58px; object-fit: cover; border-radius: 11px; cursor: pointer; border: 2px solid transparent; opacity: .8; transition: all .15s; }
.galeria img:hover { opacity: 1; }
.galeria img.si { border-color: var(--acento); opacity: 1; }

/* Llave visible una vez */
.unica { border: 1px solid var(--acento); background: var(--acento-bg); border-radius: 14px; padding: 12px 14px; display: grid; gap: 8px; animation: entra .3s ease both; }
.unica code { word-break: break-all; background: var(--campo); padding: 8px 10px; border-radius: 9px; display: block; }

/* Proyectos */
.proyecto { box-shadow: var(--sombra), inset 0 4px 0 var(--color, var(--acento)); display: grid; gap: 16px; }
.cat { display: grid; grid-template-columns: minmax(140px, 220px) 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.cat:last-child { border-bottom: 0; }

/* Avisos flotantes */
#avisos { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 40; }
.aviso-f { background: var(--solido); color: var(--solido-tinta); padding: 11px 16px; border-radius: 16px; box-shadow: 0 12px 34px rgba(0, 0, 0, .22); font-size: 13.5px; max-width: 380px; animation: sube .3s cubic-bezier(.2, .8, .2, 1) both; display: flex; gap: 10px; align-items: center; }
.aviso-f.bad { background: var(--bad-solido); color: #fff; }
.aviso-f.sale { animation: baja .25s ease both; }
@keyframes sube { from { transform: translateY(12px); opacity: 0; } }
@keyframes baja { to { transform: translateY(12px); opacity: 0; } }

/* Confirmación en la propia página */
.confirma { display: inline-flex; gap: 6px; align-items: center; animation: aparece .2s ease both; font-size: 12.5px; }

/* Entrar */
.entrar { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.entrar .tarjeta { width: min(400px, 100%); padding: 30px; display: grid; gap: 16px; border-radius: 28px; animation: entra .4s ease both; }
.entrar .marca { padding: 0; }
.entrar .marca .orbe-mini { width: 44px; height: 44px; }

.esqueleto { background: linear-gradient(90deg, var(--line-2), var(--panel-2), var(--line-2)); background-size: 200% 100%; animation: brillo 1.2s linear infinite; border-radius: 8px; height: 14px; }
@keyframes brillo { to { background-position: -200% 0; } }

@media (max-width: 860px) {
  .marco { grid-template-columns: 1fr; }
  .lateral { position: sticky; top: 8px; z-index: 6; height: auto; margin: 8px 8px 0; border-radius: 20px; flex-direction: row; align-items: center; padding: 8px 10px; overflow-x: auto; gap: 4px; }
  .lateral .marca { padding: 0 8px 0 0; }
  .lateral .marca b, .lateral .marca small, .lateral .pie { display: none; }
  .nav { display: flex; gap: 4px; }
  .nav a span { display: none; }
  .barra { padding: 16px 16px 8px; position: static; }
  #vista { padding: 8px 16px 50px; }
  .cat { grid-template-columns: 1fr; }
}

/* País del grupo en la tabla */
select.linea.pais-MX { color: var(--ok); font-weight: 600; }
select.linea.pais-sin { color: var(--warn); font-weight: 600; }
select.linea.pais-EXCLUIDO, select.linea.pais-OTRO { color: var(--bad); font-weight: 600; }

/* Inteligencia artificial */
.tarjeta.ia { grid-column: 1 / -1; }
.niveles-ia { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.nivel-ia { display: grid; gap: 8px; align-content: start; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel-2); min-width: 0; animation: entra .35s ease both; }
.nivel-ia:nth-child(2) { animation-delay: .05s; } .nivel-ia:nth-child(3) { animation-delay: .1s; }
.nivel-ia .modelo { font-size: 17px; letter-spacing: -.2px; }
.nivel-ia .precio { font-size: 12.5px; color: var(--muted); }
.nivel-ia .precio span { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.nivel-ia .precio small { display: block; font-size: 11px; }
.senal { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.senal i { width: 4px; border-radius: 2px; background: var(--line); }
.senal i:nth-child(1) { height: 6px; } .senal i:nth-child(2) { height: 10px; } .senal i:nth-child(3) { height: 14px; }
.senal i.si { background: var(--acento); }
.gasto-ia { display: grid; gap: 8px; padding: 12px 14px; border-radius: 14px; background: var(--line-2); }
.gasto-ia b { font-size: 18px; font-variant-numeric: tabular-nums; }
.gasto-ia .avance { background: var(--campo); }
.gasto-ia .avance i { min-width: 4px; }
.campo.sangria { margin-left: 52px; }
details.ia-texto summary { cursor: pointer; font-size: 12px; color: var(--acento-texto); }
details.ia-texto > div { white-space: pre-wrap; font-size: 12px; line-height: 1.45; color: var(--ink); margin-top: 6px; padding: 8px 10px; max-width: 340px; max-height: 180px; overflow: auto; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ── Empresa y agentes ── */
.empresa-sel { display: flex; align-items: center; gap: 8px; margin: -6px 4px 14px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--campo); font-size: 13px; color: var(--ink); min-width: 0; }
.empresa-sel b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empresa-sel .punto { flex: none; width: 9px; height: 9px; }
.empresa-sel select { flex: 1; min-width: 0; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 600; cursor: pointer; outline: none; }
.color-emp { width: 36px; height: 36px; border: 0; padding: 0; background: none; cursor: pointer; flex: none; }
.rejilla-agentes { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.agente { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel-2); transition: border-color .2s, box-shadow .2s; }
.agente.si { border-color: var(--acento); box-shadow: var(--sombra-chica); }
.agente .interruptor { margin: 0; }
.video-icono { flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--acento-bg); color: var(--acento-texto); }
.video-icono svg { width: 20px; height: 20px; }
.titulo-video { display: block; font-size: 15.5px; overflow-wrap: anywhere; }
.tarjeta.video .ayuda { overflow-wrap: anywhere; }
.tarjeta.video .btn svg { width: 15px; height: 15px; }
.chip b { font-weight: 700; }
span.chip { cursor: default; }
@media (max-width: 860px) {
  .lateral .empresa-sel { margin: 0 6px 0 0; padding: 5px 8px; max-width: 46vw; flex: none; }
  .linea { margin-inline: 0; width: 100%; }
}
