/* ═══════════════════════════════════════════════════════════════
   Sylphy Web · diseño 4.0
   Panel oscuro con acentos de color, etiquetas en monoespaciada y
   tarjetas de borde punteado. Tema claro y oscuro con variables.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 18px;
  --radius-lg: 24px;

  --bg: #08080c;
  --surface: #101017;
  --surface-2: #161621;
  --hover: #1d1d2b;
  --selected: #262639;
  --line: #22222f;
  --line-strong: #30304a;
  --text: #eceef6;
  --muted: #8f93aa;
  --faint: #5f6379;

  --accent: #8b7bff;
  --accent-2: #38bdf8;
  --accent-ink: #ffffff;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --info: #60a5fa;
  --orange: #fb923c;
  --pink: #f472b6;
  --cyan: #22d3ee;

  --glow-a: rgba(139, 123, 255, .16);
  --glow-b: rgba(56, 189, 248, .09);
  --shadow: 0 18px 50px rgba(0, 0, 0, .5);
  --shadow-soft: 0 8px 26px rgba(0, 0, 0, .28);
  --topbar-h: 62px;

  --cm-bg: #0d0d14;
  --cm-text: #e6e8f2;
  --cm-keyword: #f08fb4;
  --cm-string: #8fdcae;
  --cm-number: #f0c36a;
  --cm-comment: #6f7390;
  --cm-def: #7cc4f5;
  --cm-prop: #b9a6ff;
  --cm-sel: #2a2a40;
  --cm-line: #14141d;
  --cm-gutter: #5c607a;
}

:root[data-theme="light"] {
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #f0f1f9;
  --hover: #e8eaf6;
  --selected: #dfe2f4;
  --line: #e0e2ef;
  --line-strong: #cdd1e6;
  --text: #14151f;
  --muted: #5f6380;
  --faint: #9296ae;

  --accent: #6d5af0;
  --accent-2: #0ea5e9;
  --ok: #059669;
  --warn: #b7791f;
  --err: #dc4a4a;
  --info: #2f6fd6;
  --orange: #e8721c;
  --pink: #d9468f;
  --cyan: #0891b2;

  --glow-a: rgba(109, 90, 240, .11);
  --glow-b: rgba(14, 165, 233, .08);
  --shadow: 0 18px 50px rgba(40, 44, 90, .16);
  --shadow-soft: 0 8px 26px rgba(40, 44, 90, .09);

  --cm-bg: #fbfbfe;
  --cm-text: #22243a;
  --cm-keyword: #c2386f;
  --cm-string: #2f8a57;
  --cm-number: #a8680c;
  --cm-comment: #9a9db4;
  --cm-def: #1f6fb0;
  --cm-prop: #6a4fd0;
  --cm-sel: #e1e4f6;
  --cm-line: #f1f2fa;
  --cm-gutter: #aab0c8;
}

/* ── Base ── */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 15px/1.55 var(--sans); min-height: 100dvh; overflow-x: hidden;
  -webkit-font-smoothing: antialiased; position: relative;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 50% at 88% -8%, var(--glow-a), transparent 70%),
    radial-gradient(50% 45% at -6% 105%, var(--glow-b), transparent 70%);
}
h1, h2, h3, h4 { font-family: var(--sans); font-weight: 650; letter-spacing: -.025em; line-height: 1.15; margin: 0; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { max-width: 100%; }
::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 10px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ═════════ Estructura: barra superior + menú lateral ═════════ */
.topbar {
  position: sticky; top: 0; z-index: 50; height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.topbar-in { height: var(--topbar-h); padding: 0 clamp(14px, 3vw, 26px); display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; margin-right: auto; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 12px; object-fit: cover; flex: none; background: var(--surface-2);
  border: 1px solid var(--line-strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent), 0 6px 18px rgba(0, 0, 0, .25);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.brand-name { font-weight: 650; font-size: 16.5px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font: 500 10.5px/1.2 var(--mono); color: var(--muted); letter-spacing: .04em; margin-top: 3px; white-space: nowrap; }
.theme-btn {
  width: 42px; height: 42px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--accent); display: grid; place-items: center; cursor: pointer; flex: none; overflow: hidden;
  transition: background .15s, transform .15s, border-color .15s;
}
.theme-btn:hover { background: var(--hover); border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong)); }
.theme-btn:active { transform: scale(.94); }
.theme-btn .icon { width: 20px; height: 20px; animation: theme-spin .45s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes theme-spin { from { transform: rotate(-90deg) scale(.5); opacity: 0; } }

.shell { display: block; }
.rail { display: none; }
.view { min-width: 0; }

@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); align-items: start; }
  .rail {
    display: flex; flex-direction: column; gap: 4px; position: sticky; top: calc(var(--topbar-h) + env(safe-area-inset-top));
    height: calc(100dvh - var(--topbar-h) - env(safe-area-inset-top)); padding: 22px 14px 18px; border-right: 1px solid var(--line); overflow-y: auto;
  }
  .rail-label { font: 600 10.5px/1 var(--mono); letter-spacing: .14em; color: var(--faint); text-transform: uppercase; padding: 16px 12px 8px; }
  .rail-label:first-child { padding-top: 0; }
  .rail-link {
    position: relative; display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: 12px;
    color: var(--muted); font-weight: 500; transition: background .15s, color .15s;
  }
  .rail-link .icon { width: 19px; height: 19px; transition: color .15s; }
  .rail-link:hover { background: var(--hover); color: var(--text); }
  .rail-link.active { background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--text); }
  .rail-link.active .icon { color: var(--accent); }
  .rail-link.active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 4px 4px 0; background: var(--accent); }
  .rail-link .ext { margin-left: auto; width: 15px; height: 15px; opacity: .6; }
  .rail-grow { flex: 1; }
  .rail-foot { margin: 0 2px; padding: 14px; border-radius: 16px; border: 1px dashed color-mix(in srgb, var(--accent) 38%, var(--line)); background: color-mix(in srgb, var(--accent) 7%, transparent); }
  .rail-foot b { display: flex; align-items: center; gap: 8px; font: 600 10.5px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
  .rail-foot p { font-size: 12.5px; color: var(--muted); margin-top: 8px; line-height: 1.45; }
  .rail-foot .mono { font-size: 11px; color: var(--faint); margin-top: 8px; }
  .dock, .sheet, .sheet-back { display: none !important; }
}

/* ═════════ Menú flotante (móvil) ═════════ */
.dock { position: fixed; z-index: 60; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); }
.dock-btn {
  display: inline-flex; align-items: center; gap: 10px; height: 54px; padding: 0 22px 0 18px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .22);
  color: #fff; font-weight: 600; cursor: pointer; background: linear-gradient(135deg, #9d8cff, #5b4bd8);
  box-shadow: 0 10px 34px rgba(100, 80, 230, .5), inset 0 1px 0 rgba(255, 255, 255, .28); transition: transform .15s, box-shadow .15s;
}
.dock-btn:active { transform: scale(.95); }
.dock-btn .icon { width: 22px; height: 22px; }
.dock-btn .cur { max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.sheet-open .dock { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(12px); transition: opacity .15s, transform .2s; }

.sheet-back { position: fixed; inset: 0; z-index: 70; background: rgba(4, 4, 10, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity .25s; }
.sheet {
  position: fixed; z-index: 71; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom)); width: min(460px, calc(100vw - 20px)); max-height: calc(100dvh - 90px); overflow-y: auto;
  padding: 10px 16px 16px; border-radius: 30px; background: color-mix(in srgb, var(--surface) 94%, var(--accent)); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--accent) 10%, transparent);
  transform: translate(-50%, 36px) scale(.97); opacity: 0; visibility: hidden;
  transition: transform .34s cubic-bezier(.2, .9, .25, 1.08), opacity .22s, visibility 0s linear .34s;
}
.sheet::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 120px; border-radius: 30px 30px 0 0; pointer-events: none; background: radial-gradient(70% 100% at 50% 0, color-mix(in srgb, var(--accent) 22%, transparent), transparent 80%); }
body.sheet-open .sheet-back { opacity: 1; pointer-events: auto; }
body.sheet-open .sheet { transform: translate(-50%, 0) scale(1); opacity: 1; visibility: visible; transition-delay: 0s; }
.sheet-handle { width: 38px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 0 auto 12px; position: relative; }
.sheet-head { position: relative; display: flex; align-items: center; gap: 12px; padding: 4px 2px 14px; }
.sheet-head .brand-logo { width: 44px; height: 44px; border-radius: 14px; }
.sheet-head h2 { font-size: 19px; }
.sheet-head small { display: block; font: 500 10.5px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: 5px; }
.sheet-head .grow { flex: 1; min-width: 0; }
.sheet-close { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.sheet-grid { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet-tile {
  position: relative; display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 20px; text-align: left; cursor: pointer;
  border: 1px dashed color-mix(in srgb, var(--tone) 36%, var(--line)); background: linear-gradient(160deg, color-mix(in srgb, var(--tone) 10%, var(--surface-2)), var(--surface-2));
  transition: transform .12s, border-color .15s; animation: tile-in .4s cubic-bezier(.2, .9, .3, 1.1) both; animation-delay: calc(var(--i, 0) * 45ms + 90ms);
}
.sheet-tile:active { transform: scale(.97); }
.sheet-tile.wide { grid-column: 1 / -1; flex-direction: row; align-items: center; }
.sheet-tile.active { border-style: solid; border-color: color-mix(in srgb, var(--tone) 70%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 14%, transparent); }
.sheet-tile .tile-ico { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: color-mix(in srgb, var(--tone) 18%, transparent); color: var(--tone); flex: none; }
.sheet-tile .tile-ico .icon { width: 21px; height: 21px; }
.sheet-tile b { display: block; font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.sheet-tile span.d { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.sheet-tile .tick { display: none; position: absolute; top: 12px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 10px var(--tone); }
.sheet-tile.active .tick { display: block; }
.sheet-tile .ext { position: absolute; top: 12px; right: 12px; width: 15px; height: 15px; color: var(--muted); }
.sheet-tile.wide .ext { top: 50%; transform: translateY(-50%); right: 16px; }
.sheet-foot { position: relative; display: flex; align-items: center; justify-content: space-between; margin-top: 14px; padding: 0 4px; font: 500 11px/1 var(--mono); color: var(--faint); letter-spacing: .04em; }
@keyframes tile-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }

/* ═════════ Contenido ═════════ */
.page { max-width: 1140px; margin: 0 auto; padding: clamp(22px, 4vw, 40px) clamp(14px, 3vw, 30px) calc(110px + env(safe-area-inset-bottom)); animation: rise .38s ease both; }
.page.narrow { max-width: 760px; }
@media (min-width: 960px) { .page { padding-bottom: 60px; } }
.section { margin-top: clamp(30px, 5vw, 50px); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(20px, 3.2vw, 25px); }
.section-head .sub { color: var(--muted); margin-top: 5px; font-size: 14px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.eyebrow, .tag {
  display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; border-radius: 999px; font: 600 10.5px/1 var(--mono); letter-spacing: .13em; text-transform: uppercase;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
}
.eyebrow .icon, .tag .icon { width: 14px; height: 14px; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); animation: live 2s ease-out infinite; flex: none; }
@keyframes live { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.page-head { margin-bottom: clamp(20px, 4vw, 30px); }
.page-head h1 { font-size: clamp(30px, 6vw, 42px); margin: 16px 0 10px; letter-spacing: -.035em; }
.page-head p { color: var(--muted); max-width: 580px; font-size: clamp(15px, 2.2vw, 16.5px); }

/* ── Botones ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 20px; border-radius: 14px; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--text); font-weight: 550; cursor: pointer; transition: background .15s, transform .1s, opacity .15s, border-color .15s; white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.primary { background: linear-gradient(135deg, #9d8cff, #6a58e6); color: #fff; border-color: transparent; box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 32%, transparent), inset 0 1px 0 rgba(255, 255, 255, .22); }
.btn.primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, #9d8cff, #6a58e6); }
.btn.accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.accent:hover { background: var(--accent); filter: brightness(1.1); }
.btn.danger { color: var(--err); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn.icon-only { width: 40px; height: 40px; padding: 0; }
.btn.block { width: 100%; }
.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Formularios ── */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label, .label { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field .hint { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.input, .select, .textarea {
  width: 100%; height: 50px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); font: inherit;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
:root[data-theme="light"] .input, :root[data-theme="light"] .select, :root[data-theme="light"] .textarea { background: #fff; }
.textarea { height: auto; min-height: 110px; padding: 12px 16px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .6; }
.counter { font: 500 11px/1 var(--mono); color: var(--faint); }
.seg { display: inline-flex; padding: 4px; gap: 4px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 14px; }
:root[data-theme="light"] .seg { background: var(--surface-2); }
.seg button { border: 0; background: transparent; height: 36px; padding: 0 16px; border-radius: 10px; cursor: pointer; color: var(--muted); font-weight: 550; transition: background .15s, color .15s; }
.seg button.on { background: color-mix(in srgb, var(--accent) 18%, var(--surface-2)); color: var(--text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 38%, transparent); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 999px; background: var(--selected); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); }

/* ── Tarjetas ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card.pad { padding: clamp(18px, 3vw, 26px); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(18px, 3.5vw, 30px); box-shadow: var(--shadow-soft); position: relative; overflow: hidden; }
.panel::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 1px; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 60%, transparent), transparent); }

.stats, .stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; margin-top: 18px; }
.stat { padding: 18px 20px; }
.stat .num { font-family: var(--mono); font-size: 32px; line-height: 1; letter-spacing: -.03em; font-weight: 600; }
.stat .lbl { color: var(--muted); margin-top: 8px; display: flex; align-items: center; gap: 6px; font-size: 13.5px; }

.stat-card {
  --tone: var(--accent); position: relative; overflow: hidden; padding: 16px 18px 18px; border-radius: 20px; min-width: 0;
  border: 1px dashed color-mix(in srgb, var(--tone) 42%, var(--line)); background: linear-gradient(165deg, color-mix(in srgb, var(--tone) 10%, var(--surface)), var(--surface) 70%);
  transition: transform .2s, border-color .2s; animation: rise .45s ease both; animation-delay: calc(var(--i, 0) * 60ms);
}
.stat-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--tone) 70%, transparent); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-label { font: 600 10.5px/1 var(--mono); letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.stat-top .icon { width: 18px; height: 18px; color: var(--tone); }
.stat-value { font-family: var(--mono); font-size: clamp(27px, 4.4vw, 34px); font-weight: 600; letter-spacing: -.04em; line-height: 1; margin-top: 16px; display: flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.stat-value small { font-size: .5em; color: var(--tone); font-weight: 600; letter-spacing: 0; }
.stat-note { font: 400 11.5px/1.2 var(--mono); color: var(--faint); margin-top: 12px; }
.stat-bar { height: 3px; border-radius: 3px; margin-top: 14px; background: color-mix(in srgb, var(--tone) 16%, transparent); overflow: hidden; }
.stat-bar i { display: block; height: 100%; width: var(--w, 40%); border-radius: inherit; background: linear-gradient(90deg, var(--tone), color-mix(in srgb, var(--tone) 40%, #fff)); transition: width .8s cubic-bezier(.2, .8, .2, 1); }

.chip { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 11px; border-radius: 999px; font-size: 12.5px; font-weight: 550; background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted); white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.connected { color: var(--ok); background: color-mix(in srgb, var(--ok) 15%, transparent); }
.chip.connecting { color: var(--warn); background: color-mix(in srgb, var(--warn) 15%, transparent); }
.chip.connecting::before { animation: pulse 1.2s ease-in-out infinite; }
.chip.error, .chip.logged_out { color: var(--err); background: color-mix(in srgb, var(--err) 15%, transparent); }
.chip.plain::before { display: none; }
.chip.mono-chip { font-family: var(--mono); font-size: 12px; height: 28px; border-radius: 9px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.chip.mono-chip::before { display: none; }
.chip.mono-chip.ghosted { background: var(--surface-2); color: var(--muted); }
@keyframes pulse { 50% { opacity: .25; } }

/* ── Carrusel ── */
.carousel { position: relative; }
.track { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 2px 2px 6px; overscroll-behavior-x: contain; }
.track::-webkit-scrollbar { display: none; }
.track > * { scroll-snap-align: start; flex: none; }
.car-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer; z-index: 3; box-shadow: var(--shadow-soft); transition: opacity .15s, background .15s; }
.car-btn:hover { background: var(--hover); }
.car-btn.prev { left: -12px; }
.car-btn.next { right: -12px; }
.car-btn[disabled] { opacity: 0; pointer-events: none; }
.dots { display: flex; justify-content: center; gap: 7px; margin-top: 12px; }
.dot { width: 7px; height: 7px; border-radius: 99px; background: var(--selected); border: 0; padding: 0; cursor: pointer; transition: width .2s, background .2s; }
.dot.on { width: 22px; background: var(--accent); }
@media (hover: none) { .car-btn { display: none; } }

/* ── Avisos ── */
.notice { --tone: var(--info); width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; padding: clamp(18px, 3vw, 26px) clamp(18px, 3vw, 26px) clamp(18px, 3vw, 26px) clamp(22px, 3.4vw, 30px); min-height: 170px; position: relative; overflow: hidden; border-style: dashed; border-color: color-mix(in srgb, var(--tone) 42%, var(--line)); background: linear-gradient(120deg, color-mix(in srgb, var(--tone) 10%, var(--surface)), var(--surface) 65%); }
.notice::before { content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 4px; border-radius: 0 4px 4px 0; background: var(--tone); box-shadow: 0 0 18px var(--tone); }
.notice.no-img { grid-template-columns: 1fr; }
.notice h3 { font-size: clamp(20px, 3.2vw, 26px); margin: 12px 0 8px; }
.notice p { color: var(--muted); white-space: pre-line; max-width: 62ch; }
.notice .btn { margin-top: 16px; }
.notice-img { width: clamp(96px, 22vw, 190px); aspect-ratio: 1; border-radius: 18px; object-fit: cover; background: var(--surface-2); border: 1px solid var(--line-strong); }
.notice-type { display: inline-flex; align-items: center; gap: 7px; font: 600 10.5px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; height: 26px; padding: 0 11px; border-radius: 999px; background: color-mix(in srgb, var(--tone) 16%, transparent); color: var(--tone); --tone: var(--info); }
.notice-type .icon { width: 14px; height: 14px; }
.notice-type.aviso, .notice.aviso { --tone: var(--warn); }
.notice-type.emergencia, .notice.emergencia { --tone: var(--err); }
.notice-type.novedad, .notice.novedad { --tone: var(--accent); }
.notice-type.mantenimiento, .notice.mantenimiento { --tone: var(--muted); }
.notice.info { --tone: var(--info); }
@media (max-width: 560px) { .notice { grid-template-columns: 1fr; } .notice-img { width: 100%; aspect-ratio: 16/9; order: -1; } }

/* ── Tarjeta de bot ── */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 14px; }
.bot { position: relative; overflow: hidden; border-radius: 22px; border: 1px solid var(--line-strong); background: #15151d; color: #f3f4fa; min-height: 214px; display: flex; flex-direction: column; justify-content: flex-end; isolation: isolate; contain: layout paint; transition: transform .2s, border-color .2s; }
.bot:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line-strong)); }
.carousel .bot { width: min(82vw, 300px); }
.bot-bg { position: absolute; inset: -14px; width: calc(100% + 28px); height: calc(100% + 28px); max-width: none; object-fit: cover; filter: blur(12px) brightness(.55) saturate(1.1); z-index: -2; transform: translateZ(0); }
.bot::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, rgba(8, 8, 14, .88) 8%, rgba(8, 8, 14, .25) 72%); }
.bot-top { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; justify-content: space-between; align-items: flex-start; }
.bot-top .chip { background: rgba(10, 10, 16, .6); }
.bot-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.bot-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bot-avatar { width: 52px; height: 52px; border-radius: 16px; object-fit: cover; border: 2px solid rgba(255, 255, 255, .22); background: #333; flex: none; }
.bot-name { font-weight: 650; font-size: 18px; letter-spacing: -.02em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-meta { display: flex; gap: 14px; font: 500 12px/1.3 var(--mono); color: rgba(243, 244, 250, .78); flex-wrap: wrap; }
.bot-meta span { display: inline-flex; align-items: center; gap: 5px; }
.bot-meta .icon { width: 14px; height: 14px; }
.bot-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bot .btn { background: rgba(255, 255, 255, .13); border-color: rgba(255, 255, 255, .16); color: #f3f4fa; }
.bot .btn:hover { background: rgba(255, 255, 255, .24); }
.bot .btn.primary { background: #f3f4fa; color: #14151f; border-color: transparent; box-shadow: none; }
.bot .btn.danger { color: #ff9d94; }
.bot .chip { color: #f3f4fa; }
.bot .chip.connected { color: #7be3b6; }
.bot .chip.connecting { color: #f6cf6a; }
.bot .chip.error, .bot .chip.logged_out { color: #ff9d94; }
.bot .grow { flex: 1; }

.empty { text-align: center; padding: 38px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.empty .icon { width: 34px; height: 34px; }
.skeleton { border-radius: 18px; background: linear-gradient(100deg, var(--surface) 30%, var(--hover) 50%, var(--surface) 70%); background-size: 300% 100%; animation: shimmer 1.4s infinite linear; min-height: 120px; }
@keyframes shimmer { to { background-position: -100% 0; } }

/* ═════════ Inicio ═════════ */
.hero-card {
  position: relative; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: clamp(20px, 4vw, 44px); align-items: center; overflow: hidden;
  padding: clamp(22px, 4.5vw, 46px); border-radius: 28px; border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line));
  background: radial-gradient(80% 120% at 0 0, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%), linear-gradient(160deg, var(--surface), color-mix(in srgb, var(--surface) 92%, var(--accent)));
}
.hero-card::after { content: ""; position: absolute; width: 340px; height: 340px; right: -90px; top: -120px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent-2) 22%, transparent), transparent 70%); pointer-events: none; }
.hero-copy { position: relative; z-index: 1; min-width: 0; }
.hero-copy h1 { font-size: clamp(32px, 6.4vw, 56px); letter-spacing: -.045em; line-height: 1.04; margin: 18px 0 16px; }
.hero-copy h1 em { font-style: normal; background: linear-gradient(120deg, #b6a9ff, #5ec8f7); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-copy p { color: var(--muted); font-size: clamp(15px, 2.2vw, 17.5px); max-width: 520px; }
.hero-copy .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 26px; }
.hero-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; }
.hero-pills span { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 10px; font: 500 11.5px/1 var(--mono); color: var(--muted); background: color-mix(in srgb, var(--text) 5%, transparent); border: 1px solid var(--line); }
.hero-pills .icon { width: 14px; height: 14px; color: var(--accent); }

.chat-mock { position: relative; z-index: 1; border-radius: 24px; border: 1px solid var(--line-strong); background: color-mix(in srgb, var(--bg) 70%, var(--surface)); box-shadow: var(--shadow); overflow: hidden; transform: rotate(1.6deg); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.chat-head img { width: 36px; height: 36px; border-radius: 12px; object-fit: cover; background: var(--surface-2); }
.chat-head b { display: block; font-size: 14px; line-height: 1.2; }
.chat-head small { display: flex; align-items: center; gap: 6px; font: 500 10.5px/1 var(--mono); color: var(--ok); margin-top: 4px; }
.chat-body { padding: 16px 14px 18px; display: flex; flex-direction: column; gap: 10px; min-height: 210px; }
.bubble { max-width: 86%; padding: 9px 13px; border-radius: 16px; font-size: 13.5px; line-height: 1.45; animation: bubble .5s cubic-bezier(.2, .9, .3, 1.15) both; animation-delay: var(--d, 0s); }
.bubble.from-me { align-self: flex-end; border-bottom-right-radius: 5px; background: linear-gradient(135deg, #8b7bff, #5f4fe0); color: #fff; font-family: var(--mono); font-size: 13px; }
.bubble.from-bot { align-self: flex-start; border-bottom-left-radius: 5px; background: var(--surface-2); border: 1px solid var(--line); }
.bubble.from-bot .cmds { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bubble.from-bot .cmds i { font: 500 11px/1 var(--mono); font-style: normal; padding: 5px 8px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
@keyframes bubble { from { opacity: 0; transform: translateY(10px) scale(.94); } }
@media (max-width: 860px) { .hero-card { grid-template-columns: 1fr; } .chat-mock { transform: none; max-width: 420px; } }
@media (max-width: 560px) { .chat-mock { display: none; } }

.flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; counter-reset: flow; }
.flow-step { --tone: var(--accent); position: relative; padding: 20px; border-radius: 20px; border: 1px dashed color-mix(in srgb, var(--tone) 40%, var(--line)); background: linear-gradient(165deg, color-mix(in srgb, var(--tone) 8%, var(--surface)), var(--surface) 70%); }
.flow-step .n { position: absolute; top: 16px; right: 18px; font: 600 11px/1 var(--mono); letter-spacing: .1em; color: var(--faint); }
.flow-step .ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--tone) 16%, transparent); color: var(--tone); margin-bottom: 16px; }
.flow-step b { display: block; font-weight: 650; font-size: 16px; letter-spacing: -.015em; margin-bottom: 6px; }
.flow-step span.d { color: var(--muted); font-size: 14px; line-height: 1.5; display: block; }
@media (max-width: 760px) { .flow { grid-template-columns: 1fr; } .flow-step { display: grid; grid-template-columns: auto 1fr; gap: 0 14px; align-items: start; } .flow-step .ico { margin: 0; grid-row: span 2; } .flow-step b { margin-top: 2px; } }

/* ═════════ Vincular ═════════ */
.stepper { display: flex; align-items: center; margin-bottom: 20px; }
.stepper .st { display: flex; align-items: center; gap: 10px; color: var(--faint); font: 600 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; transition: color .25s; }
.stepper .st b { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font: 600 13px/1 var(--mono); background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--muted); transition: all .25s; flex: none; }
.stepper .st.on { color: var(--text); }
.stepper .st.on b { background: linear-gradient(135deg, #9d8cff, #6a58e6); border-color: transparent; color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent); }
.stepper .st.done b { background: color-mix(in srgb, var(--ok) 18%, transparent); border-color: color-mix(in srgb, var(--ok) 40%, transparent); color: var(--ok); }
.stepper .st.done { color: var(--muted); }
.stepper .st-bar { flex: 1; height: 2px; margin: 0 12px; border-radius: 2px; background: var(--line-strong); position: relative; overflow: hidden; min-width: 14px; }
.stepper .st-bar::after { content: ""; position: absolute; inset: 0; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .4s cubic-bezier(.2, .8, .2, 1); }
.stepper .st-bar.on::after { transform: scaleX(1); }
@media (max-width: 520px) { .stepper .st span { display: none; } .stepper .st.on span { display: inline; } .stepper .st-bar { margin: 0 8px; } }

.step-title { font-size: clamp(22px, 4vw, 26px); margin-bottom: 6px; }
.step-sub { color: var(--muted); margin-bottom: 20px; }
.steps { display: none; }

.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 12px; }
.choice { --tone: var(--accent); position: relative; text-align: left; padding: 20px; border-radius: 20px; border: 1px dashed color-mix(in srgb, var(--tone) 42%, var(--line)); background: linear-gradient(165deg, color-mix(in srgb, var(--tone) 9%, var(--surface-2)), var(--surface-2) 75%); cursor: pointer; display: flex; flex-direction: column; gap: 10px; transition: border-color .15s, transform .12s, box-shadow .2s; }
.choice:hover { border-color: color-mix(in srgb, var(--tone) 75%, transparent); box-shadow: 0 10px 30px color-mix(in srgb, var(--tone) 12%, transparent); transform: translateY(-2px); }
.choice:active { transform: scale(.985); }
.choice .ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--tone) 17%, transparent); color: var(--tone); }
.choice .ico .icon { width: 23px; height: 23px; }
.choice b { font-weight: 650; font-size: 17px; letter-spacing: -.015em; }
.choice span { color: var(--muted); font-size: 14px; line-height: 1.5; }
.choice .go { position: absolute; top: 20px; right: 20px; width: 18px; height: 18px; color: var(--faint); transition: transform .15s, color .15s; }
.choice:hover .go { transform: translateX(3px); color: var(--tone); }
.choice .badge { align-self: flex-start; font: 600 10px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; padding: 6px 9px; border-radius: 8px; background: color-mix(in srgb, var(--tone) 14%, transparent); color: var(--tone); }

.form { display: flex; flex-direction: column; gap: 22px; }
.profile-top { display: flex; align-items: center; gap: 16px; padding: 14px; border-radius: 18px; background: var(--surface-2); border: 1px dashed var(--line-strong); }
.avatar-prev { width: 72px; height: 72px; border-radius: 22px; object-fit: cover; background: var(--surface); border: 1px solid var(--line-strong); flex: none; box-shadow: 0 8px 22px rgba(0, 0, 0, .25); }
.avatar-letter { width: 72px; height: 72px; border-radius: 22px; flex: none; display: grid; place-items: center; font-size: 30px; font-weight: 650; color: #fff; background: linear-gradient(135deg, #9d8cff, #5b8cf0); box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 30%, transparent); }
.profile-top b { display: block; font-size: 17px; letter-spacing: -.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-top .meta { min-width: 0; }
.profile-top small { display: block; color: var(--muted); font: 500 12px/1.4 var(--mono); margin-top: 5px; }
.avatar-pick { display: flex; flex-direction: column; gap: 10px; }
.avatar-pick .seg { align-self: flex-start; }
.avatar-prev-box { display: none; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; min-height: 28px; align-items: center; }
.divider { height: 1px; background: var(--line); margin: 2px 0; }
.form-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 6px; flex-wrap: wrap; }
.form-foot.stack .btn { flex: 1 1 200px; }
@media (max-width: 520px) { .form-foot.stack { flex-direction: column-reverse; align-items: stretch; } .form-foot.stack .btn { flex: none; width: 100%; } }

.qr-box { background: #fff; border-radius: 24px; padding: 16px; width: min(100%, 300px); aspect-ratio: 1; display: grid; place-items: center; margin: 0 auto; box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 12%, transparent), var(--shadow-soft); }
.qr-box img { width: 100%; height: 100%; image-rendering: pixelated; }
.code { display: flex; justify-content: center; align-items: center; gap: clamp(4px, 1.4vw, 8px); padding: 22px 8px; border-radius: 20px; background: var(--surface-2); border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line)); user-select: all; flex-wrap: nowrap; }
.code span { width: clamp(30px, 9vw, 44px); height: clamp(42px, 12vw, 58px); display: grid; place-items: center; border-radius: 12px; background: var(--bg); border: 1px solid var(--line-strong); font: 600 clamp(22px, 6.4vw, 30px)/1 var(--mono); }
:root[data-theme="light"] .code span { background: #fff; }
.code i { width: 10px; height: 2px; background: var(--faint); border-radius: 2px; margin: 0 2px; }
.how { margin: 22px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; counter-reset: n; }
.how li { display: flex; gap: 12px; color: var(--muted); counter-increment: n; }
.how li::before { content: counter(n); flex: none; width: 24px; height: 24px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); display: grid; place-items: center; font: 600 12px/1 var(--mono); }
.center { text-align: center; }
.big-spin { width: 34px; height: 34px; }
.link-success { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; padding: 10px 0; }
.link-success h2 { font-size: clamp(24px, 5vw, 30px); }
.link-success .ok-mark { width: 72px; height: 72px; border-radius: 24px; background: color-mix(in srgb, var(--ok) 16%, transparent); border: 1px dashed color-mix(in srgb, var(--ok) 55%, transparent); color: var(--ok); display: grid; place-items: center; animation: pop .5s cubic-bezier(.2, 1.4, .4, 1) both; }
.link-success .ok-mark .icon { width: 34px; height: 34px; stroke-width: 2.2; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* ═════════ Avisos flotantes (estilo ctrpanel.gg) ═════════ */
.toasts { position: fixed; z-index: 130; top: calc(12px + env(safe-area-inset-top)); right: 12px; width: min(340px, calc(100vw - 24px)); display: flex; flex-direction: column; pointer-events: none; }
.toast-slot { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .3s cubic-bezier(.4, 0, .2, 1), opacity .25s ease; }
.toast-slot.out { grid-template-rows: 0fr; opacity: 0; }
.toast-clip { overflow: hidden; min-height: 0; padding: 0 10px 12px; margin: 0 -10px; }
.toast-slot.out .toast-clip { padding-bottom: 0; }
.toast {
  --tone: var(--info); pointer-events: auto; position: relative; overflow: hidden; display: flex; gap: 11px; align-items: flex-start; padding: 11px 34px 14px 12px; border-radius: 13px; cursor: pointer;
  background: color-mix(in srgb, var(--surface) 96%, var(--tone)); border: 1px solid var(--line-strong); border-left: 3px solid var(--tone);
  box-shadow: 0 8px 18px -6px rgba(0, 0, 0, .4); animation: toast-in .38s cubic-bezier(.2, .9, .3, 1.15) both;
}
.toast-slot.out .toast { animation: toast-out .26s cubic-bezier(.4, 0, 1, 1) both; }
.toast .t-ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none; color: var(--tone); background: color-mix(in srgb, var(--tone) 17%, transparent); margin-top: 1px; }
.toast .t-ico .icon { width: 15px; height: 15px; stroke-width: 2.1; }
.toast .t-txt { min-width: 0; }
.toast b { display: block; font-weight: 650; font-size: 13.5px; line-height: 1.3; letter-spacing: -.01em; }
.toast span.m { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.4; margin-top: 2px; }
.toast .t-x { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; color: var(--faint); border: 0; background: transparent; cursor: pointer; }
.toast .t-x:hover { background: var(--hover); color: var(--text); }
.toast .t-x .icon { width: 13px; height: 13px; }
.toast .t-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: color-mix(in srgb, var(--tone) 18%, transparent); }
.toast .t-bar i { display: block; height: 100%; background: var(--tone); transform-origin: left; animation: toast-bar var(--dur, 4s) linear forwards; }
.toast.paused .t-bar i { animation-play-state: paused; }
.toast.success { --tone: var(--ok); } .toast.error { --tone: var(--err); } .toast.warn { --tone: var(--warn); } .toast.info { --tone: var(--info); }
@keyframes toast-in { from { opacity: 0; transform: translateX(28px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(32px) scale(.96); } }
@keyframes toast-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (max-width: 520px) {
  .toasts { width: min(318px, calc(100vw - 24px)); }
  @keyframes toast-in { from { opacity: 0; transform: translateY(-16px) scale(.97); } }
  @keyframes toast-out { to { opacity: 0; transform: translateY(-14px) scale(.97); } }
}

/* ── Token de vinculación / tipo de bot ── */
.plan-chip { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; height: 24px; padding: 0 10px; border-radius: 8px; font: 600 10.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted); white-space: nowrap; }
.plan-chip .icon { width: 12px; height: 12px; }
.plan-chip.premium { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.plan-chip.owner { background: color-mix(in srgb, var(--pink) 18%, transparent); color: var(--pink); }
.bot .plan-chip { background: rgba(10, 10, 16, .6); }
.bot .plan-chip.premium { color: #f6cf6a; }
.bot .plan-chip.owner { color: #f9a8d4; }

.tier-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
.tier-chip { padding: 11px 12px; border-radius: 14px; border: 1px dashed var(--line-strong); background: var(--surface-2); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tier-chip b { font-size: 13.5px; letter-spacing: -.01em; }
.tier-chip span { font: 500 11px/1.25 var(--mono); color: var(--muted); }
.tier-chip.premium b { color: var(--warn); }
.tier-chip.owner b { color: var(--pink); }
.tier-chip.on { border-style: solid; border-color: color-mix(in srgb, var(--accent) 60%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent); }

.tk-card { --tone: var(--warn); border-radius: 20px; border: 1px dashed color-mix(in srgb, var(--tone) 50%, var(--line)); background: linear-gradient(165deg, color-mix(in srgb, var(--tone) 9%, var(--surface-2)), var(--surface-2) 70%); padding: 6px 18px 8px; }
.tk-card.owner { --tone: var(--pink); }
.tk-head { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.tk-ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--tone) 18%, transparent); color: var(--tone); flex: none; }
.tk-head b { display: block; font-size: 17px; letter-spacing: -.015em; }
.tk-head small { display: block; font: 500 12px/1.3 var(--mono); color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.tk-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.tk-row:last-child { border-bottom: 0; }
.tk-row > span:first-child { color: var(--muted); flex: none; }
.tk-row b { font-weight: 600; text-align: right; }
.ok-text { color: var(--ok); }

/* ── Editor de bot ── */
.em-head { display: flex; align-items: center; gap: 12px; }
.em-plan { display: flex; flex-direction: column; gap: 12px; }
.em-plan-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.em-plan-head b { display: block; font-size: 15px; }
.em-plan-head small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; }

/* ── Modales ── */
.backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(4, 4, 10, .6); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); display: flex; padding: 16px; animation: fade .18s ease both; overflow-y: auto; }
.modal { margin: auto; width: min(100%, 460px); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 26px; padding: 24px; box-shadow: var(--shadow); animation: pop-in .26s cubic-bezier(.2, .9, .3, 1.15) both; }
.modal.wide { width: min(100%, 560px); }
.modal .m-ico { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; margin-bottom: 14px; background: color-mix(in srgb, var(--tone, var(--accent)) 16%, transparent); color: var(--tone, var(--accent)); }
.modal .m-ico .icon { width: 24px; height: 24px; }
.modal.danger { --tone: var(--err); } .modal.warn { --tone: var(--warn); }
.modal h3 { font-size: 22px; margin-bottom: 8px; }
.modal p { color: var(--muted); white-space: pre-line; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }

/* ── Admin ── */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 26px; align-items: center; }
.tabs .spacer { flex: 1; }
.admin-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 18px; }
.admin-head h1 { font-size: clamp(30px, 5vw, 40px); }
.list { display: flex; flex-direction: column; gap: 10px; }
.item { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.item img.thumb { width: 48px; height: 48px; border-radius: 14px; object-fit: cover; background: var(--surface-2); }
.item .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .s { color: var(--muted); font-size: 13.5px; display: flex; gap: 12px; flex-wrap: wrap; margin-top: 3px; }
.item .s span { display: inline-flex; gap: 5px; align-items: center; }
.item .acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) { .item { grid-template-columns: auto 1fr; } .item .acts { grid-column: 1 / -1; justify-content: flex-start; } }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 14px; }
.kv .card h4 { font-family: var(--sans); font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 12px; font-weight: 600; }
.kv dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 9px 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; word-break: break-all; }
.console { font-family: var(--mono); font-size: 12.5px; line-height: 1.6; background: var(--cm-bg); border: 1px solid var(--line); border-radius: 16px; padding: 14px; max-height: 340px; overflow: auto; }
.console div { white-space: pre-wrap; word-break: break-word; }
.console .lv { display: inline-block; min-width: 62px; font-weight: 600; }
.lv.info { color: var(--info); } .lv.success { color: var(--ok); } .lv.warn { color: var(--warn); } .lv.error { color: var(--err); } .lv.system { color: var(--cm-prop); }
.gl { max-height: 340px; overflow: auto; display: flex; flex-direction: column; }
.gl div { display: flex; justify-content: space-between; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.gl div:last-child { border: 0; }

/* ── Editor de plugins ── */
.editor { display: grid; grid-template-columns: 290px 1fr; gap: 14px; height: calc(100dvh - 250px); min-height: 520px; }
.side { display: flex; flex-direction: column; overflow: hidden; }
.side-head { padding: 12px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.tree { overflow: auto; padding: 8px; flex: 1; }
.cat { margin-bottom: 4px; }
.cat-name { width: 100%; display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 8px 10px; border-radius: 10px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; text-align: left; }
.cat-name:hover { background: var(--hover); }
.cat-name .icon { width: 16px; height: 16px; }
.cat-name .chev { margin-left: auto; transition: transform .15s; }
.cat.closed .chev { transform: rotate(-90deg); }
.cat.closed .files { display: none; }
.file { width: 100%; display: flex; align-items: center; gap: 9px; border: 0; background: transparent; padding: 8px 10px 8px 26px; border-radius: 10px; cursor: pointer; text-align: left; color: var(--text); font-size: 14px; }
.file:hover { background: var(--hover); }
.file.on { background: var(--selected); }
.file .icon { width: 16px; height: 16px; color: var(--muted); }
.file small { color: var(--muted); margin-left: auto; font-size: 12px; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.bar .path { font-family: var(--mono); font-size: 13.5px; flex: 1; min-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.bar .dirty { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.cm-host { flex: 1; min-height: 0; position: relative; }
.cm-host .CodeMirror { height: 100%; font-family: var(--mono); font-size: 13.5px; line-height: 1.6; background: var(--cm-bg); color: var(--cm-text); }
.cm-host textarea.plain { width: 100%; height: 100%; border: 0; resize: none; background: var(--cm-bg); color: var(--cm-text); font: 13.5px/1.6 var(--mono); padding: 14px; tab-size: 4; }
.cm-host textarea.plain:focus { outline: none; }
.cm-s-sylphy.CodeMirror { background: var(--cm-bg); color: var(--cm-text); }
.cm-s-sylphy .CodeMirror-gutters { background: var(--cm-bg); border-right: 1px solid var(--line); }
.cm-s-sylphy .CodeMirror-linenumber { color: var(--cm-gutter); }
.cm-s-sylphy .CodeMirror-cursor { border-left: 2px solid var(--accent); }
.cm-s-sylphy .CodeMirror-selected, .cm-s-sylphy.CodeMirror-focused .CodeMirror-selected { background: var(--cm-sel); }
.cm-s-sylphy .CodeMirror-activeline-background { background: var(--cm-line); }
.cm-s-sylphy .CodeMirror-matchingbracket { color: var(--accent) !important; outline: 1px solid var(--accent); border-radius: 3px; }
.cm-s-sylphy .cm-keyword { color: var(--cm-keyword); }
.cm-s-sylphy .cm-atom, .cm-s-sylphy .cm-number, .cm-s-sylphy .cm-builtin { color: var(--cm-number); }
.cm-s-sylphy .cm-string, .cm-s-sylphy .cm-string-2 { color: var(--cm-string); }
.cm-s-sylphy .cm-comment { color: var(--cm-comment); font-style: italic; }
.cm-s-sylphy .cm-def, .cm-s-sylphy .cm-variable-2 { color: var(--cm-def); }
.cm-s-sylphy .cm-property, .cm-s-sylphy .cm-qualifier { color: var(--cm-prop); }
.cm-s-sylphy .cm-operator { color: var(--muted); }
.cm-s-sylphy .cm-variable, .cm-s-sylphy .cm-variable-3 { color: var(--cm-text); }
.cm-s-sylphy .cm-error { color: var(--err); }
.cm-s-sylphy .CodeMirror-vscrollbar, .cm-s-sylphy .CodeMirror-hscrollbar { scrollbar-width: thin; }
.err-line { background: color-mix(in srgb, var(--err) 20%, transparent); }
.CodeMirror-dialog { background: var(--surface-2); color: var(--text); border-bottom: 1px solid var(--line); padding: 6px 12px; }
.CodeMirror-dialog input { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; font-family: var(--mono); }
.cm-searching { background: color-mix(in srgb, var(--warn) 35%, transparent); }
.side-toggle { display: none; }
@media (max-width: 860px) {
  .editor { grid-template-columns: 1fr; height: calc(100dvh - 210px); min-height: 480px; position: relative; overflow: hidden; border-radius: var(--radius); }
  .side { position: absolute; z-index: 5; inset: 0 22% 0 0; transform: translateX(-104%); visibility: hidden; transition: transform .22s, visibility .22s; }
  .editor.side-open .side { transform: none; visibility: visible; box-shadow: var(--shadow); }
  .side-toggle { display: inline-grid; }
}
.preview-img { width: 100%; max-height: 160px; object-fit: cover; border-radius: 14px; margin-top: 10px; }



/* ── Pestañas del panel admin ── */
.nav-link { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 12px; color: var(--muted); font-weight: 550; transition: background .15s, color .15s; }
.nav-link .icon { width: 19px; height: 19px; }
.nav-link:hover { background: var(--hover); color: var(--text); }
.nav-link.active { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }

/* ═════════ Estado del servidor ═════════ */
.status-page { max-width: 1240px; }
.status-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; padding: 6px 0 26px; }
.status-hero h1 { font-size: clamp(30px, 5.6vw, 44px); margin: 14px 0 10px; letter-spacing: -.04em; }
.status-hero p { max-width: 600px; }
.status-hero-copy .eyebrow { gap: 9px; }
.stream-state { display: flex; align-items: center; gap: 9px; padding: 10px 14px; border: 1px dashed color-mix(in srgb, var(--ok) 45%, var(--line)); border-radius: 12px; background: color-mix(in srgb, var(--ok) 7%, var(--surface)); font: 500 11.5px/1 var(--mono); color: var(--muted); white-space: nowrap; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card, .card.chart-card, .status-panel { border: 1px dashed color-mix(in srgb, var(--accent) 30%, var(--line)); background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 6%, var(--surface)), var(--surface) 70%); }
.metric-card { min-width: 0; border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.metric-card:nth-child(4n+2) { border-color: color-mix(in srgb, var(--cyan) 38%, var(--line)); }
.metric-card:nth-child(4n+3) { border-color: color-mix(in srgb, var(--ok) 38%, var(--line)); }
.metric-card:nth-child(4n+4) { border-color: color-mix(in srgb, var(--orange) 38%, var(--line)); }
.metric-top { display: flex; align-items: center; gap: 10px; }
.metric-icon { width: 36px; height: 36px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); display: grid; place-items: center; }
.metric-label { color: var(--muted); font: 600 10.5px/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.metric-value { font-family: var(--mono); font-size: clamp(24px, 3vw, 32px); font-weight: 600; letter-spacing: -.04em; line-height: 1.15; overflow-wrap: anywhere; }
.metric-detail { font: 400 11.5px/1.3 var(--mono); }
.status-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.chart-card, .status-panel { padding: 20px; border-radius: 22px; min-width: 0; }
.chart-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.chart-heading h2, .status-panel h2 { font-size: 16px; font-weight: 650; letter-spacing: -.02em; }
.chart-heading p, .status-panel .sub { font-size: 12px; margin-top: 4px; }
.chart-live { color: var(--ok); font: 700 10px/1 var(--mono); letter-spacing: .12em; }
.chart-card canvas { display: block; width: 100%; margin-top: 14px; }
.chart-axis { display: flex; justify-content: space-between; color: var(--muted); font: 400 11px/1 var(--mono); }
.status-panel { margin-top: 16px; }
.status-panel .section-head { margin-bottom: 20px; }
.status-meter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.status-meter { min-width: 0; }
.meter-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 9px; }
.meter-track { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.meter-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .35s ease; }
.status-meter small { display: block; font: 400 11px/1.3 var(--mono); margin-top: 8px; }
.status-details { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 24px; }
.detail-row, .process-stat { display: flex; flex-direction: column; gap: 5px; min-width: 0; padding: 12px; border-radius: 13px; background: var(--surface-2); font-size: 12px; overflow-wrap: anywhere; }
.detail-row strong, .process-stat strong { font: 600 13px/1.3 var(--mono); }
.process-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.metric-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric-grid.compact .metric-card { padding: 14px; }
.metric-grid.compact .metric-value { font-size: 25px; }
@media (max-width: 780px) {
  .status-hero { align-items: flex-start; flex-direction: column; padding-top: 4px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric-card { padding: 14px; border-radius: 17px; }
  .metric-value { font-size: 26px; }
  .status-charts { grid-template-columns: 1fr; gap: 12px; }
  .chart-card, .status-panel { padding: 16px; border-radius: 18px; }
  .status-meter-grid { grid-template-columns: 1fr; gap: 18px; }
  .status-details { grid-template-columns: 1fr; gap: 8px; margin-top: 16px; }
  .process-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-grid.compact { grid-template-columns: 1fr; }
  .metric-grid.compact .metric-card { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 7px 10px; }
  .metric-grid.compact .metric-top { grid-row: span 2; }
  .metric-grid.compact .metric-value { font-size: 23px; }
}
@media (max-width: 380px) { .process-grid { grid-template-columns: 1fr; } .stream-state { font-size: 10.5px; } }

/* Colores de apoyo para tarjetas, iconos y chips */
.t-accent { --tone: var(--accent); }
.t-cyan { --tone: var(--cyan); }
.t-ok { --tone: var(--ok); }
.t-orange { --tone: var(--orange); }
.t-pink { --tone: var(--pink); }
.t-warn { --tone: var(--warn); }
.t-err { --tone: var(--err); }
.t-info { --tone: var(--info); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
