/* ===================== Tokens ===================== */
:root {
  --bg: #0e131f; --panel: #141a28; --panel2: #1a2133; --line: #252e44; --line2: #313b55;
  --text: #e4e8f1; --muted: #8a93a8; --faint: #5d667c;
  --accent: #2bb3c0; --accent-fuerte: #12808f; --accent-t: rgba(43,179,192,.15); --hover: rgba(255,255,255,.04);
  --marca: linear-gradient(135deg, #14b8a6 0%, #2563eb 100%);
  --ok: #3fb68b; --warn: #e3ac35; --bad: #e5554d; --info: #5aa9e6; --off: #5d667c; --oculto: #b07cf5;
  --sombra: 0 8px 30px rgba(0,0,0,.45);
  --r: 6px;
  --mono: ui-monospace, Consolas, 'Cascadia Mono', 'Courier New', monospace;
  color-scheme: dark;
}
:root[data-tema="claro"] {
  --bg: #f3f5f9; --panel: #ffffff; --panel2: #f6f8fb; --line: #e1e6ee; --line2: #cfd6e2;
  --text: #1b2232; --muted: #5f6b80; --faint: #98a2b3;
  --accent: #0f7c8c; --accent-fuerte: #0f7c8c; --accent-t: rgba(15,124,140,.10); --hover: rgba(0,0,0,.035);
  --ok: #1f9d6c; --warn: #c98a06; --bad: #d23f37; --info: #2f86c9; --off: #98a2b3; --oculto: #7c3aed;
  --sombra: 0 8px 30px rgba(20,30,50,.15);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #app { height: 100%; }
body { font: 13px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 5px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }

/* ===================== Controles ===================== */
.btn, .btn-sm { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line2); background: var(--panel2); border-radius: var(--r); cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn { padding: 6px 12px; }
.btn-sm { padding: 3px 9px; font-size: 12px; }
.btn:hover, .btn-sm:hover { border-color: var(--muted); }
.btn:disabled, .btn-sm:disabled { opacity: .3; cursor: not-allowed; filter: grayscale(1); }
.btn-sm.bloq { opacity: .5; }
.btn-pri { background: var(--accent-fuerte); border-color: var(--accent-fuerte); color: #fff; }
.btn-pri:hover { filter: brightness(1.08); border-color: var(--accent-fuerte); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--hover); border-color: transparent; }
.input, select.input { background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r); padding: 6px 10px; outline: none; min-width: 0; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-t); }
kbd { font: 11px var(--mono); padding: 1px 5px; border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 4px; color: var(--muted); }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--off); }
.dot.rojo { background: var(--bad); } .dot.amarillo { background: var(--warn); } .dot.verde { background: var(--ok); }
.dot.info { background: var(--info); } .dot.desconectado, .dot.sin_revisar { background: var(--off); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; cursor: pointer; user-select: none; color: var(--muted); }
.chip b { color: var(--text); font-weight: 600; }
.chip:hover { border-color: var(--line2); }
.chip.on { border-color: var(--accent); background: var(--accent-t); color: var(--text); }

.vacio { margin: auto; color: var(--muted); text-align: center; padding: 30px; }
.cargando { color: var(--muted); padding: 10px 0; }
.cargando::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border: 2px solid var(--line2); border-top-color: var(--accent); border-radius: 50%; animation: gira .7s linear infinite; vertical-align: -1px; }
@keyframes gira { to { transform: rotate(360deg); } }
.error { color: var(--bad); white-space: pre-wrap; padding: 8px 0; }

/* ===================== Login ===================== */
.login { height: 100%; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login form { width: 340px; max-width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 32px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--sombra); position: relative; overflow: hidden; }
.login form::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--marca); }
.login h1 { font-size: 22px; display: flex; align-items: center; gap: 10px; } .login p { color: var(--muted); margin-bottom: 8px; }
.login h1 .marca-ico { width: 34px; height: 34px; }

/* ===================== Marca ERASCentral ===================== */
.marca-ico { width: 20px; height: 20px; flex: none; }
.marca-txt { font-weight: 700; letter-spacing: .2px; }
.marca-txt span { background: var(--marca); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login .input { padding: 10px 12px; }
.login .btn { justify-content: center; padding: 10px; }
.login .login-txt { color: var(--text); margin: 0; line-height: 1.5; }
.login-link { font-size: 13px; color: var(--muted); text-align: center; }
.login-link:hover { color: var(--text); }

/* ===================== Estructura principal ===================== */
.shell { display: grid; grid-template-columns: 270px 1fr; height: 100%; }
.side { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side-cab { padding: 12px 12px 8px; display: flex; align-items: center; gap: 8px; }
.side-cab .logo { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.side-busca { padding: 0 12px 8px; }
.side-busca .input { width: 100%; }
.side-filtros { display: flex; gap: 6px; padding: 0 12px 8px; flex-wrap: wrap; }
.side-lista { flex: 1; overflow-y: auto; padding: 2px 6px 10px; }
.side-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); padding: 10px 8px 4px; }
.cli { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: var(--r); cursor: pointer; }
.cli:hover { background: var(--hover); }
.cli.on { background: var(--accent-t); }
.cli .n { flex: 1; min-width: 0; }
.cli .n div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cli .n small { color: var(--muted); font-size: 11px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cli.off .n div { color: var(--muted); }
.cli .fav { opacity: 0; color: var(--faint); padding: 0 2px; }
.cli:hover .fav, .cli .fav.si { opacity: 1; }
.cli .fav.si { color: var(--warn); }
/* Clientes en modo oculto (MOD_O = 1): violeta */
.ico-o { display: inline-flex; align-items: center; margin-left: 6px; color: var(--oculto); vertical-align: middle; }
.cli.oculto { box-shadow: inset 3px 0 0 var(--oculto); }
.cli.oculto .n div { color: var(--oculto); }
.gr-f.oculto { box-shadow: inset 3px 0 0 var(--oculto); background: color-mix(in srgb, var(--oculto) 7%, transparent); }
.tab.oculto { box-shadow: inset 0 2px 0 var(--oculto); }
.tab.oculto .t { color: var(--oculto); }
select.modo-o.oculto { color: var(--oculto); border-color: var(--oculto); }
.side-pie { border-top: 1px solid var(--line); padding: 8px 10px; display: flex; align-items: center; gap: 6px; }
.side-pie .u { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tabs-wrap { display: flex; align-items: stretch; background: var(--bg); border-bottom: 1px solid var(--line); flex-shrink: 0; }
.tabs-wrap .tabs { flex: 1; border-bottom: none; }
.tabs { display: flex; align-items: flex-end; gap: 2px; padding: 6px 8px 0; background: var(--bg); border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; flex-shrink: 0; min-height: 40px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs-flecha { flex-shrink: 0; width: 26px; border: none; background: var(--bg); color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 0 2px; }
.tabs-flecha:hover:not(:disabled) { color: var(--text); background: var(--hover); }
.tabs-cerrar { font-size: 13px; border-left: 1px solid var(--line); width: 32px; }
.tabs-cerrar:hover { color: var(--bad) !important; }
.menu-solapa { position: fixed; z-index: 1000; background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r); box-shadow: var(--sombra); padding: 4px; min-width: 190px; }
.menu-solapa div { padding: 6px 10px; border-radius: 4px; cursor: pointer; }
.menu-solapa div:hover { background: var(--hover); }
.tabs-flecha:disabled { color: var(--faint); opacity: .35; cursor: default; }
.tab { display: flex; align-items: center; gap: 7px; padding: 7px 10px 7px 12px; border: 1px solid transparent; border-bottom: none; border-radius: 8px 8px 0 0; cursor: pointer; color: var(--muted); white-space: nowrap; flex: 0 1 210px; min-width: 96px; user-select: none; }
.tab:hover { color: var(--text); background: var(--hover); }
.tab.on { background: var(--panel); border-color: var(--line); color: var(--text); margin-bottom: -1px; padding-bottom: 8px; }
.tab .t { overflow: hidden; text-overflow: ellipsis; }
.tab .x { border-radius: 4px; padding: 0 4px; color: var(--faint); margin-left: auto; flex-shrink: 0; }
.tab .dot { flex-shrink: 0; }
.tab .x:hover { background: var(--hover); color: var(--bad); }
.contenido { flex: 1; min-height: 0; position: relative; background: var(--panel); }
.panel-tab { position: absolute; inset: 0; display: none; flex-direction: column; min-height: 0; }
.panel-tab.on { display: flex; }

/* ===================== Vista de cliente ===================== */
.cab-cli { display: flex; align-items: center; gap: 12px; padding: 12px 18px 0; flex-wrap: wrap; }
.cab-cli h2 { font-size: 17px; font-weight: 600; }
.cab-cli .eq { color: var(--muted); }
.cab-cli .esp { flex: 1; }
.seg { display: flex; gap: 2px; padding: 10px 18px 0; border-bottom: 1px solid var(--line); flex-shrink: 0; overflow-x: auto; }
.seg button { border: none; background: none; padding: 7px 12px; border-bottom: 2px solid transparent; cursor: pointer; color: var(--muted); white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { color: var(--text); border-bottom-color: var(--accent); }
.sub { flex: 1; min-height: 0; display: none; flex-direction: column; }
.sub.on { display: flex; }
.scroll { overflow: auto; flex: 1; min-height: 0; }
.pad { padding: 16px 18px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: var(--panel2); min-width: 0; }
.card h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.kv dt { color: var(--muted); }
.kv dd { min-width: 0; overflow-wrap: anywhere; }
.barra-uso { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 4px 0 2px; }
.barra-uso i { display: block; height: 100%; background: var(--ok); }
.barra-uso i.warn { background: var(--warn); } .barra-uso i.bad { background: var(--bad); }
.prob { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; }
.prob .dot { transform: translateY(1px); }

.herr { display: flex; align-items: center; gap: 8px; padding: 10px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; flex-shrink: 0; }
.herr .esp { flex: 1; }

/* ===================== Grilla ===================== */
.gr { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.gr-barra { display: flex; align-items: center; gap: 8px; padding: 6px 0; flex-shrink: 0; }
.gr-filtro { width: 200px; background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r); padding: 3px 8px; outline: none; }
.gr-filtro:focus { border-color: var(--accent); }
.gr-info { color: var(--muted); font-size: 12px; }
.gr-esp { flex: 1; }
.gr-vista { flex: 1; min-height: 60px; overflow: auto; position: relative; border: 1px solid var(--line); border-radius: var(--r); outline: none; background: var(--panel); }
.gr-cab { display: flex; position: sticky; top: 0; z-index: 2; background: var(--panel2); border-bottom: 1px solid var(--line2); min-width: 100%; }
.gr-cab .gr-c { font-weight: 600; cursor: pointer; color: var(--text); }
.gr-cab .gr-c:hover { background: var(--hover); }
.gr-alto { position: relative; }
.gr-filas { position: absolute; top: 0; left: 0; will-change: transform; }
.gr-f { display: flex; height: 26px; }
.gr-f:nth-child(even) { background: rgba(127,127,127,.04); }
.gr-f:hover { background: var(--hover); }
.gr-f.sel { background: var(--accent-t); }
.gr-c { flex-shrink: 0; padding: 0 8px; line-height: 26px; height: 26px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--line); font-size: 12px; }
.gr-c.nulo { color: var(--faint); font-style: italic; }
.gr-c.sel { outline: 2px solid var(--accent); outline-offset: -2px; }
.gr-c.mod { background: rgba(227,172,53,.22); }
.gr-f.nueva { background: rgba(63,182,139,.12); }
.gr-f.borrada .gr-c { text-decoration: line-through; color: var(--bad); opacity: .7; }
.gr-editor { width: 100%; height: 100%; font: inherit; font-size: 12px; border: none; outline: 2px solid var(--accent); background: var(--panel); color: var(--text); padding: 0 6px; }
.gr-c:has(> textarea.gr-editor) { overflow: visible; position: relative; }
textarea.gr-editor { position: absolute; z-index: 5; width: 360px; height: auto; min-height: 90px; padding: 4px 6px; box-shadow: var(--sombra); }
.gr-c a, .lnk { color: var(--accent); cursor: pointer; text-decoration: none; }
.gr-c a:hover, .lnk:hover { text-decoration: underline; }

/* Tablas chicas (catalogo) */
.tbl { border-collapse: collapse; font-size: 12px; width: 100%; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); padding: 5px 10px; border-bottom: 1px solid var(--line2); position: sticky; top: 0; background: var(--panel); white-space: nowrap; }
.tbl td { padding: 4px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:hover td { background: var(--hover); }
.pre { font: 12px/1.55 var(--mono); white-space: pre; overflow: auto; background: var(--panel2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }

/* ===================== Estructura ===================== */
.est { display: grid; grid-template-columns: 300px 1fr; flex: 1; min-height: 0; }
.est-arbol { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.est-arbol .busca { padding: 10px; border-bottom: 1px solid var(--line); }
.est-arbol .busca .input { width: 100%; }
.arbol { flex: 1; overflow: auto; padding: 4px 0 10px; }
.arbol .cat { display: flex; align-items: center; gap: 6px; padding: 5px 10px; cursor: pointer; user-select: none; font-weight: 500; }
.arbol .cat:hover { background: var(--hover); }
.arbol .cat .fl { width: 10px; color: var(--faint); font-size: 9px; }
.arbol .cat .c { color: var(--faint); font-size: 11px; margin-left: auto; }
.arbol .it { padding: 2px 10px 2px 28px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); font-size: 12px; height: 22px; line-height: 18px; }
.arbol .it:hover { background: var(--hover); }
.arbol .it.on { background: var(--accent-t); color: var(--text); }
.arbol .it.inact { color: var(--faint); text-decoration: line-through; }
.arbol .msg { padding: 4px 10px 4px 28px; color: var(--muted); font-size: 12px; }
.est-det { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.est-det .tit { padding: 12px 18px 0; }
.est-det .tit h3 { font: 600 15px var(--mono); }
.est-det .tit .k { font: 11px system-ui; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-right: 8px; }
.est-det .tit .s { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ===================== SQL ===================== */
.sql { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.sql-ed { flex-shrink: 0; border-bottom: 1px solid var(--line); }
.sql-ed .CodeMirror { height: 190px; font: 13px/1.5 var(--mono); background: var(--panel); color: var(--text); }
.sql-ed .CodeMirror-gutters { background: var(--panel); border-right: 1px solid var(--line); }
.sql-res { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 18px 12px; }
.res-tabs-wrap { display: flex; align-items: stretch; padding-top: 8px; border-bottom: 1px solid var(--line); }
.res-tabs { flex: 1; display: flex; gap: 2px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.res-tabs::-webkit-scrollbar { display: none; }
.res-tabs .rt { flex-shrink: 0; display: flex; align-items: center; gap: 4px; padding: 5px 10px; border: 1px solid transparent; border-bottom: none; border-radius: 6px 6px 0 0; background: none; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; }
.res-tabs .rt:hover { color: var(--text); background: var(--hover); }
.res-tabs .rt.on { background: var(--panel); border-color: var(--line); color: var(--text); }
.res-tabs .rt.err { color: var(--bad); }
.res-tabs .rt small { color: var(--faint); font-size: 11px; }
.res-tabs .rt small.bad { color: var(--bad); }
.sql-lado { position: absolute; right: 0; top: 0; bottom: 0; width: 340px; background: var(--panel); border-left: 1px solid var(--line); box-shadow: var(--sombra); display: none; flex-direction: column; z-index: 5; }
.sql-lado.on { display: flex; }
.sql-lado .it { padding: 8px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.sql-lado .it:hover { background: var(--hover); }
.sql-lado .it code { display: block; font: 12px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sql-lado .it small { color: var(--muted); }

/* ===================== Dialogos, paleta, toast ===================== */
.velo { position: fixed; inset: 0; background: rgba(5,8,15,.55); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; }
.dlg { background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--sombra); width: 560px; max-width: 100%; max-height: 80vh; display: flex; flex-direction: column; }
.dlg-cab { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.dlg-cab h3 { flex: 1; font-size: 15px; }
.dlg-cuerpo { padding: 14px 18px; overflow: auto; min-height: 0; }
.dlg-pie { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.pal { width: 620px; }
.pal input { border: none; border-bottom: 1px solid var(--line); border-radius: 12px 12px 0 0; padding: 14px 18px; font-size: 15px; background: transparent; outline: none; width: 100%; }
.pal .lista { overflow: auto; max-height: 50vh; padding: 6px; }
.pal .op { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r); cursor: pointer; }
.pal .op.on { background: var(--accent-t); }
.pal .op .tp { color: var(--muted); font-size: 11px; margin-left: auto; text-transform: uppercase; letter-spacing: .4px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--panel2); border: 1px solid var(--line2); padding: 9px 16px; border-radius: 8px; box-shadow: var(--sombra); opacity: 0; transition: .2s; pointer-events: none; z-index: 60; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.bad { border-color: var(--bad); }

.solo-cel { display: none !important; }
/* ===================== Celular ===================== */
/* Con el menu abierto, el resto se oscurece y un toque afuera lo cierra */
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 86vw; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--sombra); }
  .shell.menu .side { transform: none; }
  .shell.menu .main::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 30; }
  .solo-cel { display: inline-flex !important; }
  .est { grid-template-columns: 1fr; }
  .est-arbol { max-height: 40vh; border-right: none; border-bottom: 1px solid var(--line); }
}
.sql-ed .sql-error { text-decoration: wavy underline var(--bad); text-underline-offset: 3px; background: rgba(239, 68, 68, .12); }

/* Cliente desconectado: aviso arriba y acciones en pausa */
.aviso-off { display: none; margin: 10px 18px 0; padding: 8px 12px; border-radius: var(--r); background: rgba(234, 179, 8, .12); border: 1px solid rgba(234, 179, 8, .35); color: var(--warn); font-size: 12.5px; }
.offline .aviso-off { display: block; }
.offline [data-bajar], .offline [data-backup], .offline [data-run], .offline [data-acc="backup"], .offline [data-acc="revisar"], .offline [data-multi] { opacity: .4; pointer-events: none; }

/* ===================== Ventana UBI (ERAS-UBI a distancia) ===================== */
.ubi { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.ubi-cab { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ubi-cab .esp { flex: 1; }
.ubi-tit { display: flex; align-items: baseline; gap: 10px; }
.ubi-logo { font-weight: 700; letter-spacing: .3px; color: var(--accent); }
.ubi-cab .chip { cursor: default; }
.ubi-cab .chip.warn { color: var(--warn); border-color: var(--warn); }
.ubi-pest { padding-top: 6px; }
.ubi-cuerpo { flex: 1; min-height: 0; }
.ubi-estado { display: flex; gap: 6px; padding: 6px 12px; border-top: 1px solid var(--line); background: var(--bg); flex-wrap: wrap; }
.ubi-led { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; padding: 2px 10px 2px 8px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); }
.ubi-led::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--off); }
.ubi-led.verde::before { background: var(--ok); } .ubi-led.rojo::before { background: var(--bad); }
.ubi-led.rojo { color: var(--bad); border-color: var(--bad); }
.ubi-grid2 { display: grid; grid-template-columns: minmax(320px, 520px) 1fr; gap: 14px; align-items: start; }
.ubi-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.ubi-form label .input { color: var(--text); font-size: 13px; }
.ubi-form h3 { margin-bottom: 10px; }
.ubi-nota { font-size: 12px; margin: -2px 0 10px; }
.ubi-botones { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.ubi-botones .esp { flex: 1; }
.ubi-bases { display: grid; grid-template-columns: 240px 1fr; gap: 14px; align-items: start; }
.ubi-lista { padding: 10px; }
.ubi-lista-cab { display: flex; align-items: center; margin-bottom: 6px; }
.ubi-lista-cab .esp { flex: 1; }
.ubi-lista .sel-fila { cursor: pointer; }
.ubi-lista .sel-fila:hover td { background: var(--hover); }
.ubi-lista .sel-fila.on td { background: var(--accent-t); }
.ubi-campos { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); column-gap: 12px; }
.ubi-campos .ancho { grid-column: 1 / -1; }
.ubi-aviso { color: var(--warn); font-size: 12.5px; margin: 0 0 8px; }
.ubi-subs { padding: 0; }
.ubi-log-cab { display: flex; gap: 12px; align-items: baseline; margin-bottom: 8px; }
.ubi-log td { vertical-align: top; }
.ubi-log tr.resalt td { background: rgba(250, 252, 150, .07); }
@media (max-width: 760px) { .ubi-grid2, .ubi-bases { grid-template-columns: 1fr; } }
.offline [data-copia], .offline [data-probar], .offline [data-reanudar] { opacity: .4; pointer-events: none; }
.offline [data-cambiar-act] { opacity: .4; pointer-events: none; }
/* UBI: grillas editables y secciones con detalle */
.ubi-filas td { vertical-align: top; }
.ubi-filas .input { padding: 4px 8px; font-size: 12.5px; }
.ubi-filas textarea.input { min-width: 260px; }
.ubi-acc { white-space: nowrap; text-align: right; }
.ubi-acc .btn-sm + .btn-sm { margin-left: 4px; }
.ubi-nueva td { background: var(--bg); border-top: 1px dashed var(--line2); }
.ubi-md { display: grid; grid-template-columns: 210px 1fr; gap: 14px; align-items: start; }
.ubi-md-lista { border-right: 1px solid var(--line); padding-right: 10px; }
.ubi-md-it { padding: 6px 8px; border-radius: var(--r); cursor: pointer; }
.ubi-md-it:hover { background: var(--hover); }
.ubi-md-it.on { background: var(--accent-t); }
.ubi-md-det { min-width: 0; }
.ubi-h4 { margin: 16px 0 6px; font-size: 13px; }
.ubi-form textarea.input { width: 100%; font: 12.5px/1.5 var(--mono); resize: vertical; }
@media (max-width: 760px) { .ubi-md { grid-template-columns: 1fr; } .ubi-md-lista { border-right: none; } }
.offline [data-online], .offline [data-acc] { opacity: .4; pointer-events: none; }

/* Pie de la barra lateral: administracion arriba, usuario abajo */
.side-admin { border-top: 1px solid var(--line); padding: 6px 10px 0; display: flex; gap: 4px; flex-wrap: wrap; }
.side-pie button.u { background: none; border: none; text-align: left; padding: 4px 6px; border-radius: var(--r); cursor: pointer; font: inherit; font-size: 12px; color: var(--muted); }
.side-pie button.u:hover { background: var(--hover); color: var(--text); }

/* ===================== Usuarios ===================== */
.usr { max-width: 1200px; }
/* Formulario de usuario: ocupa toda la ventana (los dialogos .velo quedan arriba) */
.usr-full:empty { display: none; }
.usr-full { position: fixed; inset: 0; z-index: 45; background: var(--bg); overflow: auto; padding: 24px 16px; }
.usr-full .usr-form { max-width: 1000px; margin: 0 auto; }
.usr-full-cab { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.usr-full-cab h3 { flex: 1; }
.usr-full .usr-cat { max-height: 45vh; }
.usr-lista tr { cursor: pointer; }
.usr-lista tr:hover td { background: var(--hover); }
.usr-lista tr.on td { background: var(--accent-t); }
.usr-tipo { font-size: 11px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; }
.usr-tipo.super { color: var(--accent); border-color: var(--accent); }
.usr-tipo.mcp { color: var(--info); border-color: var(--info); }
.usr-form .fila { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.usr-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.usr-form label.chk { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
.usr-form .input { color: var(--text); }
.usr-sec { margin: 6px 0 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.usr-sec h4 { font-size: 12.5px; margin-bottom: 8px; }
.usr-opciones { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.usr-cat-barra { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.usr-cat-barra .input { flex: 1; }
.usr-cat-barra span { white-space: nowrap; font-size: 12px; }
.usr-cat { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); padding: 4px; background: var(--bg); }
.usr-form .usr-cat label { flex-direction: row; align-items: center; justify-content: flex-start; gap: 8px; margin: 0; color: var(--text); font-size: 13px; text-align: left; cursor: pointer; border-radius: 4px; }
.usr-form .usr-cat label:hover { background: var(--hover); }
.usr-cat .usr-cli + .usr-cli { border-top: 1px solid var(--line); }
.usr-cat .cli-nom { padding: 6px 8px; font-weight: 600; }
.usr-cat .cli-nom .nom { white-space: nowrap; }
.usr-cat .cli-nom .emp { font-weight: 400; font-size: 12px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usr-cat .cli-nom .cant { font-weight: 400; font-size: 11px; white-space: nowrap; }
.usr-cat .cli-nom .dot { flex-shrink: 0; }
.usr-form .usr-cat label.base { padding: 4px 8px 4px 34px; font-size: 12.5px; }
.usr-cat .base .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usr-clave { font: 15px var(--mono); padding: 10px; background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r); user-select: all; text-align: center; margin: 10px 0; word-break: break-all; }
@media (max-width: 900px) { .usr { grid-template-columns: 1fr; } }

/* Clientes excluidos */
.side-excl:empty { display: none; }
.side-excl { border-top: 1px solid var(--line); padding: 6px 10px 0; }
.side-excl button { color: var(--muted); }
.cab-cli [data-excluir] { color: var(--muted); }
.cab-cli [data-excluir]:hover { color: var(--bad); }
.tabla-excl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabla-excl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 6px 10px; border-bottom: 1px solid var(--line2); }
.tabla-excl td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tabla-excl td:last-child { text-align: right; }
