:root {
  --bg: #050a17;
  --bg2: #0a1328;
  --panel: rgba(10, 19, 40, 0.92);
  --line: rgba(120, 160, 220, 0.16);
  --text: #e6edf7;
  --muted: #8a9bb8;
  --emerald: #22d3a6;
  --cyan: #38bdf8;
  --gold: #e9c46a;
  --danger: #f43f5e;
  --radius: 12px;
  --font: "DM Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --display: "Space Grotesk", "DM Sans", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; }
body { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------- login ---------- */
.auth-wrap { height: 100%; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at 50% 30%, #0f2a3a 0%, var(--bg) 60%); }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 32px 28px; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.brand-mark { width: 38px; height: 38px; }
.brand-name { font-size: 26px; font-weight: 800; letter-spacing: .32em;
  background: linear-gradient(90deg, var(--emerald), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-sub { color: var(--muted); margin: 0 0 22px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.field input, .field select, .field textarea { background: #071024; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; outline: none; transition: border-color .15s; width: 100%; }
.field textarea { min-height: 110px; resize: vertical; font-family: var(--font); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--emerald); }
.field .help { font-size: 12px; color: var(--muted); }
.btn { border: 1px solid var(--line); background: #0d1a35; border-radius: 10px; padding: 9px 14px; cursor: pointer;
  transition: background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { background: #13244a; border-color: rgba(120,160,220,.35); }
.btn.primary { background: linear-gradient(90deg, #13a983, #1d8fc4); border-color: transparent; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { color: #fecdd3; border-color: rgba(244,63,94,.4); }
.btn.danger:hover { background: rgba(244,63,94,.15); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.block { width: 100%; }
.error { color: #fda4af; min-height: 18px; font-size: 13px; margin: 4px 0 10px; }

/* ---------- layout principal ---------- */
.topbar { position: fixed; top: 0; left: 0; right: 0; height: 56px; display: flex; align-items: center; gap: 14px;
  padding: 0 16px; background: linear-gradient(180deg, rgba(5,10,23,.95), rgba(5,10,23,.6)); border-bottom: 1px solid var(--line); z-index: 20; }
.topbar .brand-name { font-size: 18px; }
.topbar .brand-mark { width: 28px; height: 28px; }
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); min-width: 0; }
.crumbs a { color: var(--text); cursor: pointer; text-decoration: none; }
.crumbs a:hover { color: var(--emerald); }
.crumbs .cur { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spacer { flex: 1; }
.stats { display: flex; gap: 16px; color: var(--muted); font-size: 12px; }
.stats b { color: var(--text); font-size: 14px; margin-right: 4px; }
.user-chip { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line); }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px;
  background: linear-gradient(135deg, var(--emerald), var(--cyan)); color: #04101d; }
.menu { position: fixed; top: 52px; right: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 6px; min-width: 210px; z-index: 40; box-shadow: 0 20px 50px rgba(0,0,0,.5); }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 8px; cursor: pointer; }
.menu button:hover { background: #13244a; }

#stage { position: fixed; inset: 0; display: block; cursor: grab; }
#stage.dragging { cursor: grabbing; }
#stage.pointer { cursor: pointer; }

.tooltip { position: fixed; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; z-index: 30; font-size: 13px; max-width: 260px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.tooltip .t-title { font-weight: 700; }
.tooltip .t-sub { color: var(--muted); font-size: 12px; }

.fab-row { position: fixed; left: 16px; bottom: 16px; display: flex; gap: 8px; z-index: 20; flex-wrap: wrap; }
.legend { position: fixed; left: 16px; top: 72px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; z-index: 15; font-size: 12px; color: var(--muted); max-width: 240px; }
.legend h4 { margin: 0 0 6px; color: var(--text); font-size: 13px; }

/* ---------- panel lateral ---------- */
.side { position: fixed; top: 56px; right: 0; bottom: 0; width: 420px; max-width: 100%; background: var(--panel);
  border-left: 1px solid var(--line); z-index: 18; display: flex; flex-direction: column; backdrop-filter: blur(8px); }
.side-head { padding: 16px 18px 0; }
.side-head h2 { margin: 0 0 2px; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.side-head .sub { color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 4px; padding: 12px 18px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { background: none; border: 0; padding: 8px 10px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.tab.on { color: var(--text); border-bottom-color: var(--emerald); }
.side-body { flex: 1; overflow-y: auto; padding: 16px 18px 24px; }
.side-close { position: absolute; top: 12px; right: 12px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; background: rgba(7,16,36,.6); }
.card.click { cursor: pointer; }
.card.click:hover { border-color: rgba(34,211,166,.5); }
.card-row { display: flex; align-items: center; gap: 10px; }
.card-title { font-weight: 600; }
.card-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.pill.ok { color: #6ee7b7; border-color: rgba(34,211,166,.4); }
.pill.warn { color: #fcd34d; border-color: rgba(233,196,106,.4); }
.pill.off { color: #fda4af; border-color: rgba(244,63,94,.35); }
.row-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 18px 0 8px; }
.empty { color: var(--muted); text-align: center; padding: 22px 8px; border: 1px dashed var(--line); border-radius: var(--radius); }
.lock-note { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px;
  border-radius: 10px; background: rgba(34,211,166,.06); border: 1px solid rgba(34,211,166,.2); margin-bottom: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.audit-row { font-size: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.audit-row .a-act { color: var(--cyan); font-family: var(--mono); }
.audit-row .a-meta { color: var(--muted); }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(2,6,15,.7); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal { width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 16px; padding: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.modal h3 { margin: 0 0 4px; font-size: 18px; }
.modal .m-sub { color: var(--muted); margin: 0 0 16px; font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.reveal-box { font-family: var(--mono); background: #071024; border: 1px solid var(--gold); color: var(--gold); padding: 12px;
  border-radius: 10px; word-break: break-all; margin: 10px 0; user-select: all; }
.color-row { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.swatch.on { border-color: #fff; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 10px; z-index: 60; }
.toast.err { border-color: rgba(244,63,94,.5); color: #fecdd3; }

@media (max-width: 760px) {
  .stats, .legend { display: none; }
  .side { width: 100%; top: 40%; border-left: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; }
  .crumbs .hide-sm { display: none; }
}

/* ---------- logo ---------- */
.auth-logo { display: block; width: 220px; height: 220px; margin: -12px auto 0; object-fit: contain; }
.auth-sub.center { text-align: center; }
.brand-mark { border-radius: 8px; object-fit: cover; }

/* ---------- etiquetas 3D ---------- */
.label-layer { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.lbl { position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 12px; font-weight: 600; will-change: transform; }
.lbl-co, .lbl-office { background: rgba(5,10,23,.82); border: 1px solid var(--c, var(--line)); border-radius: 99px; padding: 5px 12px;
  box-shadow: 0 0 18px color-mix(in srgb, var(--c, #22d3a6) 35%, transparent); backdrop-filter: blur(4px); }
.lbl-co::before, .lbl-office::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 7px; vertical-align: 0; }
.lbl-co[data-sub]::after, .lbl-office[data-sub]::after { content: attr(data-sub); display: block; font-size: 10px; font-weight: 500; color: #fcd34d; text-align: center; }
.lbl-co.paused { opacity: .6; }
.lbl-co.paused::after { content: "En pausa"; display: block; font-size: 10px; color: #fda4af; text-align: center; }
.lbl-office.hot { border-width: 2px; }
.lbl-private { color: #8a9bb8; font-size: 11px; background: rgba(5,10,23,.6); padding: 3px 9px; border-radius: 99px; }
.lbl-eden { font-size: 15px; font-weight: 800; letter-spacing: .35em; color: #9ff7e0; text-shadow: 0 0 14px rgba(56,189,248,.8); }
.lbl-lot, .lbl-add { color: #6ee7b7; background: rgba(5,10,23,.75); border: 1px dashed rgba(34,211,166,.6); padding: 4px 10px; border-radius: 8px; font-size: 12px; }
.lbl-add.big { font-size: 13px; color: #64748b; border-color: rgba(100,116,139,.5); }
.lbl-add.big.hot { color: #6ee7b7; border-color: rgba(34,211,166,.8); }
.lbl-agent { background: rgba(5,10,23,.85); border: 1px solid var(--line); padding: 3px 8px; border-radius: 6px; font-size: 11px; }
.lbl-typing { display: flex; gap: 3px; background: rgba(255,255,255,.92); padding: 5px 7px; border-radius: 10px 10px 10px 2px; }
.lbl-typing i { width: 4px; height: 4px; border-radius: 50%; background: #0f766e; animation: typing 1.2s infinite; }
.lbl-typing i:nth-child(2) { animation-delay: .2s; } .lbl-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes typing { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
.hint { position: fixed; right: 16px; bottom: 16px; z-index: 15; font-size: 11px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }

/* ---------- cuentas y panel admin ---------- */
.link-btn { background: none; border: 0; color: var(--cyan); cursor: pointer; padding: 6px 0; font-size: 13px; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.link-btn.center { display: block; width: 100%; text-align: center; margin-top: 12px; }
.code-input { font-family: var(--mono); font-size: 22px !important; letter-spacing: .4em; text-align: center; }
.auth-msg { color: var(--text); line-height: 1.6; text-align: center; margin: 0 0 18px; }
.badge { display: inline-block; min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; margin-left: 8px; border-radius: 99px;
  background: var(--gold); color: #1a1405; font-size: 11px; font-weight: 800; text-align: center; }
.quote { display: flex; gap: 10px; margin-top: 10px; }
.quote > div { flex: 1; background: #071024; border: 1px solid rgba(233,196,106,.35); border-radius: 10px; padding: 8px 10px; }
.quote span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.quote b { color: var(--gold); font-size: 15px; }
.search { width: 100%; background: #071024; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; margin-bottom: 10px; outline: none; }
.search:focus { border-color: var(--emerald); }
.lock-note.warn { background: rgba(233,196,106,.07); border-color: rgba(233,196,106,.35); }
.side-head { position: relative; }
.side-head .side-close { top: 14px; right: 16px; }

/* ---------- login espacial ---------- */
.auth2 { position: fixed; inset: 0; display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; overflow-y: auto; background: #02050d; }
.auth2 canvas.space { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
.auth2-brand { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; }
.auth2-logo { width: min(460px, 34vw); height: auto; display: block; filter: drop-shadow(0 0 50px rgba(18,114,255,.3)); }
.tagline { font-family: var(--display); letter-spacing: .42em; font-size: 15px; color: #dbe7ff; margin-top: -18px; text-align: center; }
.tagline.small { font-size: 11px; letter-spacing: .38em; color: #b9c8e3; margin: 6px 0 0; text-align: left; min-height: 12px; }
.auth2-card { position: relative; z-index: 1; display: flex; justify-content: center; padding: 40px 6vw 40px 20px; }
.auth2-card > * { width: 100%; max-width: 470px; background: linear-gradient(160deg, rgba(14,24,44,.82), rgba(6,12,26,.88)); border: 1px solid rgba(80,130,220,.35);
  border-radius: 26px; padding: 52px 48px 40px; backdrop-filter: blur(14px); box-shadow: 0 40px 120px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.06); }
.welcome { font-family: var(--display); font-size: 28px; font-weight: 400; letter-spacing: .08em; color: #e6edf7; }
.wordmark { font-family: var(--display); font-weight: 700; font-size: 58px; letter-spacing: .3em; line-height: 1.1; margin-top: 6px;
  background: linear-gradient(180deg, #ffffff 30%, #b6c9e8); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth2-form .fields { display: flex; flex-direction: column; gap: 16px; margin-top: 44px; }
.ibox { display: flex; align-items: center; gap: 12px; background: rgba(4,10,22,.75); border: 1px solid rgba(90,120,170,.35); border-radius: 12px; padding: 0 16px; transition: border-color .15s, box-shadow .15s; }
.ibox:focus-within { border-color: #10d9ee; box-shadow: 0 0 0 3px rgba(16,217,238,.12); }
.ibox input { flex: 1; background: none; border: 0; outline: none; padding: 17px 0; color: #fff; font-size: 15px; min-width: 0; }
.ibox input::placeholder { color: #8a9bb8; }
.ico { width: 20px; height: 20px; flex: none; color: #b7c5dc; }
.eye { background: none; border: 0; padding: 4px; cursor: pointer; display: grid; place-items: center; color: #b7c5dc; }
.eye:hover .ico { color: #fff; }
.code-label { font-size: 13px; color: #b9c8e3; margin: 2px 0 8px; }
.code-field .code-input { font-size: 20px !important; letter-spacing: .5em; text-align: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 20px 0 6px; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: #dbe5f5; user-select: none; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box { width: 22px; height: 22px; border-radius: 6px; border: 1px solid #4a5f82; background: #071024; display: grid; place-items: center; transition: .15s; }
.check input:checked + .box { background: linear-gradient(135deg, #10a8ee, #2d7dff); border-color: transparent; }
.check input:checked + .box::after { content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.check input:focus-visible + .box { box-shadow: 0 0 0 3px rgba(16,217,238,.3); }
.auth2 .link-btn { color: #22d3ee; font-size: 14px; }
.btn-go { width: 100%; height: 62px; border: 0; border-radius: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 12px; position: relative;
  background: linear-gradient(100deg, #12e1f5 0%, #3aa6ff 52%, #b56cff 100%); color: #06121f; font-family: var(--display); font-weight: 700; font-size: 19px;
  box-shadow: 0 14px 40px rgba(40,140,255,.28); transition: transform .15s, box-shadow .15s, filter .15s; margin-top: 8px; }
.btn-go .ico { position: absolute; right: 26px; color: #fff; width: 22px; height: 22px; }
.btn-go:hover { transform: translateY(-1px); box-shadow: 0 18px 50px rgba(40,140,255,.38); filter: brightness(1.05); }
.btn-go:disabled { opacity: .7; cursor: wait; }
.divider { display: flex; align-items: center; gap: 14px; color: #8a9bb8; font-size: 13px; margin: 30px 0 14px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: rgba(120,150,200,.25); }
.secure-row { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12px; color: #93a3bf; text-align: center; }
.secure-row .ico { width: 15px; height: 15px; color: #4ee0b8; }
.signup { text-align: center; margin-top: 26px; color: #dbe5f5; font-size: 14px; }
.signup a { color: #22d3ee; text-decoration: underline; text-underline-offset: 3px; }
.auth2 .field label { color: #b9c8e3; }
.auth2 .field input { background: rgba(4,10,22,.75); padding: 14px; border-radius: 12px; }
.auth2 .auth-msg { margin-top: 24px; }
.auth2 .btn.primary { background: linear-gradient(100deg, #12e1f5, #3aa6ff 52%, #b56cff); color: #06121f; padding: 14px; border-radius: 12px; font-weight: 700; }
.auth2 form:not(.auth2-form) { margin-top: 28px; }
.auth2 .error { margin-top: 10px; }
@media (max-width: 980px) {
  .auth2 { grid-template-columns: 1fr; align-content: start; }
  .auth2-brand { padding: 28px 20px 0; }
  .auth2-logo { width: 190px; }
  .auth2-brand .tagline { font-size: 11px; }
  .auth2-card { padding: 18px 16px 40px; }
  .auth2-card > * { padding: 34px 24px 28px; }
  .welcome { font-size: 22px; }
  .wordmark { font-size: 42px; }
}
/* marca en la barra superior */
.topbar .brand-name { font-family: var(--display); }

.wordmark-img { display: block; width: 300px; max-width: 100%; height: auto; margin: 14px 0 4px -6px; }
@media (max-width: 980px) { .wordmark-img { width: 230px; } }

a.btn { color: var(--text); text-decoration: none; display: inline-flex; align-items: center; }
