/* Royal Bloodline · panel de control
   Tema oscuro con acento carmesí. Sin framework: todo son tokens en :root. */

:root {
  --bg:        #0a0a0c;
  --bg-2:      #101014;
  --surface:   #15151b;
  --surface-2: #1c1c24;
  --border:    #26262f;
  --border-2:  #33333f;

  --text:      #ecedf0;
  --text-dim:  #9a9aa8;
  --text-faint:#66667a;

  --crimson:   #e11d48;
  --crimson-d: #a10b2b;
  --gold:      #d4af37;
  --green:     #22c55e;
  --amber:     #f59e0b;
  --red:       #ef4444;
  --twitch:    #9146ff;
  --kick:      #53fc18;
  --youtube:   #ff0000;
  --tiktok:    #9ca3af;

  --r:    14px;
  --r-sm: 9px;
  --shadow: 0 8px 30px rgba(0,0,0,.45);
  --sidebar: 248px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(225,29,72,.10), transparent 60%),
    radial-gradient(700px 400px at 100% 0%, rgba(212,175,55,.05), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.02em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .9rem; }

/* ── Estructura ─────────────────────────────────────────────────────────── */

.shell { display: flex; min-height: 100vh; position: relative; z-index: 1; }

.sidebar {
  width: var(--sidebar);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px; }
.brand-crown { font-size: 1.5rem; filter: drop-shadow(0 0 10px rgba(212,175,55,.5)); }
.brand-name { font-weight: 700; font-size: 1rem; letter-spacing: -.02em; line-height: 1.15; }
.brand-sub { font-size: .7rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: .09em; }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--text-dim);
  font-size: .9rem; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface); color: var(--text); }
.nav a.on {
  background: linear-gradient(90deg, rgba(225,29,72,.16), rgba(225,29,72,.04));
  color: #fff;
  box-shadow: inset 2px 0 0 var(--crimson);
}
.nav-ico { width: 18px; text-align: center; opacity: .95; }

.me {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--border);
}
.me img, .me .me-ph {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--crimson-d); flex-shrink: 0;
  display: grid; place-items: center; font-weight: 700; font-size: .8rem;
}
.me-info { min-width: 0; flex: 1; }
.me-name { font-size: .84rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-role { font-size: .7rem; color: var(--text-faint); }
.me a { color: var(--text-faint); font-size: 1rem; padding: 4px; }
.me a:hover { color: var(--red); }

.main { flex: 1; min-width: 0; padding: 26px 30px 60px; }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 24px; flex-wrap: wrap; }
.head p { margin: 5px 0 0; color: var(--text-dim); font-size: .88rem; }

/* ── Tarjetas ───────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
}
.card + .card { margin-top: 16px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.card-sub { color: var(--text-dim); font-size: .83rem; margin: 0 0 16px; }

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 17px 19px;
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--crimson); opacity: .8;
}
.stat-k { font-size: .73rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); }
.stat-v { font-size: 1.7rem; font-weight: 700; letter-spacing: -.03em; margin-top: 3px; }
.stat-n { font-size: .78rem; color: var(--text-dim); }
.stat.ok::after    { background: var(--green); }
.stat.warn::after  { background: var(--amber); }
.stat.bad::after   { background: var(--red); }

/* ── Formularios ────────────────────────────────────────────────────────── */

.field { margin-bottom: 17px; }
.field:last-child { margin-bottom: 0; }
label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: 6px; }
.hint { font-size: .77rem; color: var(--text-faint); margin-top: 5px; }

input[type=text], input[type=number], select, textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 9px 11px;
  font-size: .88rem;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--crimson);
  box-shadow: 0 0 0 3px rgba(225,29,72,.14);
}
select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239a9aa8' d='M6 8.8 1.8 4.6 2.9 3.5 6 6.6l3.1-3.1 1.1 1.1z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px;
}

.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.switch:last-child { border-bottom: none; }
.switch-t { font-size: .88rem; font-weight: 600; }
.switch-d { font-size: .78rem; color: var(--text-faint); margin-top: 2px; }
.toggle { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle span {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--border-2); border-radius: 99px; transition: background .2s;
}
.toggle span::before {
  content: ''; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform .2s;
}
.toggle input:checked + span { background: var(--crimson); }
.toggle input:checked + span::before { transform: translateX(18px); }

/* ── Botones ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--r-sm);
  font-size: .86rem; font-weight: 600; font-family: inherit;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover { background: var(--border); border-color: var(--border-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--crimson), var(--crimson-d));
  border-color: transparent; color: #fff;
}
.btn-primary:hover { filter: brightness(1.12); background: linear-gradient(135deg, var(--crimson), var(--crimson-d)); }
.btn-danger { color: #ff9aa8; border-color: rgba(239,68,68,.35); }
.btn-danger:hover { background: rgba(239,68,68,.14); }
.btn-sm { padding: 6px 11px; font-size: .79rem; }
.btn-ico { padding: 7px 9px; }

/* ── Etiquetas y estados ────────────────────────────────────────────────── */

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 99px;
  font-size: .73rem; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text-dim);
}
.tag.twitch  { color: #c4a2ff; border-color: rgba(145,70,255,.4);  background: rgba(145,70,255,.12); }
.tag.kick    { color: #a6fd8a; border-color: rgba(83,252,24,.35);  background: rgba(83,252,24,.10); }
.tag.youtube { color: #ff9b9b; border-color: rgba(255,0,0,.35);    background: rgba(255,0,0,.10); }
.tag.tiktok  { color: #d1d5db; }
.tag.live    { color: #ffb3c1; border-color: rgba(225,29,72,.5);   background: rgba(225,29,72,.16); }
.tag.off     { color: var(--text-faint); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); flex-shrink: 0; }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
.dot.bad { background: var(--red); box-shadow: 0 0 0 3px rgba(239,68,68,.18); }
.dot.live { background: var(--crimson); box-shadow: 0 0 0 3px rgba(225,29,72,.22); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* ── Lista de streamers ─────────────────────────────────────────────────── */

.streamer {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r);
  transition: border-color .15s, background .15s;
}
.streamer:hover { border-color: var(--border-2); background: var(--surface-2); }
.streamer.off { opacity: .55; }
.streamer + .streamer { margin-top: 10px; }
.av { width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
      background: linear-gradient(135deg, var(--crimson-d), #4a0d1a);
      display: grid; place-items: center; font-weight: 700; font-size: .95rem; }
.av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.streamer-b { flex: 1; min-width: 0; }
.streamer-n { font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.streamer-m { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.streamer-a { display: flex; gap: 7px; flex-shrink: 0; }

/* ── Tabla ──────────────────────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th {
  text-align: left; padding: 9px 12px;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-faint); border-bottom: 1px solid var(--border); font-weight: 600;
}
td { padding: 11px 12px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

/* ── Modal ──────────────────────────────────────────────────────────────── */

.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(5,5,8,.72); backdrop-filter: blur(5px);
  display: none; align-items: flex-start; justify-content: center;
  padding: 5vh 16px; overflow-y: auto;
}
.overlay.on { display: flex; }
.modal {
  width: 100%; max-width: 560px;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--r); box-shadow: var(--shadow);
  animation: rise .18s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.modal-h { display: flex; align-items: center; justify-content: space-between;
           padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-b { padding: 20px; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end;
           padding: 16px 20px; border-top: 1px solid var(--border); }
.x { background: none; border: none; color: var(--text-faint); font-size: 1.35rem;
     cursor: pointer; line-height: 1; padding: 0 4px; }
.x:hover { color: var(--text); }

.acct-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.acct-row select { width: 130px; flex-shrink: 0; }

/* ── Avisos ─────────────────────────────────────────────────────────────── */

.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 90;
          display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-left: 3px solid var(--green);
  border-radius: var(--r-sm); padding: 12px 16px; font-size: .86rem;
  box-shadow: var(--shadow); animation: slide .2s ease-out; max-width: 380px;
}
.toast.bad { border-left-color: var(--red); }
@keyframes slide { from { opacity: 0; transform: translateX(22px); } }

.banner {
  display: flex; gap: 11px; align-items: flex-start;
  background: rgba(245,158,11,.10); border: 1px solid rgba(245,158,11,.32);
  border-radius: var(--r); padding: 14px 16px; margin-bottom: 18px; font-size: .86rem;
}
.banner.bad { background: rgba(239,68,68,.10); border-color: rgba(239,68,68,.32); }
.banner code { background: rgba(0,0,0,.35); padding: 1px 6px; border-radius: 4px; font-size: .85em; }

.empty { text-align: center; padding: 44px 20px; color: var(--text-faint); }
.empty-ico { font-size: 2.2rem; opacity: .45; margin-bottom: 10px; }
.skel { color: var(--text-faint); padding: 26px; text-align: center; font-size: .86rem; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: .82em; color: var(--text-dim); }

/* ── Login ──────────────────────────────────────────────────────────────── */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 22px; position: relative; z-index: 1; }
.login {
  width: 100%; max-width: 400px; text-align: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 42px 34px; box-shadow: var(--shadow);
}
.login .brand-crown { font-size: 3rem; display: block; margin-bottom: 14px; }
.login h1 { font-size: 1.4rem; }
.login p { color: var(--text-dim); font-size: .88rem; margin: 9px 0 26px; }
.btn-discord {
  width: 100%; justify-content: center;
  background: #5865f2; border-color: transparent; color: #fff;
  padding: 12px; font-size: .92rem;
}
.btn-discord:hover { background: #4752c4; }
.login-foot { margin-top: 22px; font-size: .76rem; color: var(--text-faint); }

/* ── Móvil ──────────────────────────────────────────────────────────────── */

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static;
    flex-direction: row; align-items: center; gap: 14px;
    padding: 12px 16px; overflow-x: auto;
    border-right: none; border-bottom: 1px solid var(--border);
  }
  .brand-sub, .me-info { display: none; }
  .nav { flex-direction: row; flex: 1; }
  .nav a span:not(.nav-ico) { display: none; }
  .nav a { padding: 9px 12px; }
  .main { padding: 18px 16px 50px; }
  .head h1 { font-size: 1.3rem; }
  .streamer { flex-wrap: wrap; }
  .toasts { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: none; }
}

/* ── Multi-selección (menciones) ────────────────────────────────────────── */

.ms { position: relative; }
.ms-box {
  width: 100%; min-height: 40px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  background: var(--bg-2); border: 1px solid var(--border-2);
  border-radius: var(--r-sm); padding: 7px 32px 7px 10px;
  cursor: pointer; text-align: left; color: var(--text);
  font-family: inherit; font-size: .88rem;
  transition: border-color .15s, box-shadow .15s;
}
.ms.open .ms-box { border-color: var(--crimson); box-shadow: 0 0 0 3px rgba(225,29,72,.14); }
.ms-caret { position: absolute; right: 12px; top: 19px; color: var(--text-dim); pointer-events: none; font-size: .75rem; }
.ms-ph { color: var(--text-faint); }
.ms-menu {
  display: none; position: absolute; z-index: 20;
  top: calc(100% + 5px); left: 0; right: 0;
  max-height: 264px; overflow-y: auto;
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--r-sm); box-shadow: var(--shadow); padding: 6px;
}
.ms.open .ms-menu { display: block; }
.ms-opt {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: .87rem;
}
.ms-opt:hover { background: var(--border); }
.ms-opt input { width: 15px; height: 15px; accent-color: var(--crimson); cursor: pointer; flex-shrink: 0; }
.ms-sep { height: 1px; background: var(--border); margin: 6px 3px; }
.ms-lbl { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
          color: var(--text-faint); padding: 6px 10px 3px; font-weight: 600; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 99px;
  font-size: .76rem; font-weight: 600;
  background: rgba(225,29,72,.16); border: 1px solid rgba(225,29,72,.35); color: #ffb3c1;
}
.chip.esp { background: rgba(212,175,55,.14); border-color: rgba(212,175,55,.4); color: #e9d08a; }

/* ── Vista previa estilo Discord ────────────────────────────────────────── */

.editor { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 18px; align-items: start; }
.previo { position: sticky; top: 22px; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 8px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--border-2); background: var(--surface-2);
  color: var(--text-dim); font-size: .84rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.tab:hover { color: var(--text); }
.tab.on {
  background: linear-gradient(135deg, var(--crimson), var(--crimson-d));
  border-color: transparent; color: #fff;
}

.vars { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.var {
  font-family: ui-monospace, Menlo, monospace; font-size: .74rem;
  padding: 3px 8px; border-radius: 6px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text-dim);
}
.var:hover { border-color: var(--crimson); color: var(--text); }

.color-row { display: flex; gap: 9px; align-items: center; }
.color-row input[type=color] {
  width: 44px; height: 38px; padding: 2px; border-radius: var(--r-sm);
  border: 1px solid var(--border-2); background: var(--bg-2); cursor: pointer;
}

textarea { resize: vertical; min-height: 82px; line-height: 1.5; }

/* El chat de Discord, replicado lo justo para que la previa sea fiel */
.dc {
  background: #313338; border-radius: 10px; padding: 18px 16px;
  font-family: 'Inter', sans-serif;
}
.dc-msg { display: flex; gap: 14px; }
.dc-av { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
         background: #5865f2; display: grid; place-items: center;
         color: #fff; font-weight: 700; font-size: .95rem; overflow: hidden; }
.dc-av img { width: 100%; height: 100%; object-fit: cover; }
.dc-body { flex: 1; min-width: 0; }
.dc-top { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.dc-name { color: #f2f3f5; font-weight: 600; font-size: .95rem; }
.dc-badge { background: #5865f2; color: #fff; font-size: .6rem; padding: 1px 4px;
            border-radius: 3px; font-weight: 600; letter-spacing: .02em; }
.dc-time { color: #949ba4; font-size: .72rem; }
.dc-content { color: #dbdee1; font-size: .94rem; margin: 1px 0 7px;
              white-space: pre-wrap; word-break: break-word; }
.dc-embed { display: flex; max-width: 100%; background: #2b2d31;
            border-radius: 4px; overflow: hidden; }
.dc-bar { width: 4px; flex-shrink: 0; }
.dc-inner { padding: 13px 16px 16px; min-width: 0; flex: 1; }
.dc-author { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.dc-author .dc-aimg { width: 24px; height: 24px; border-radius: 50%; overflow: hidden;
                      background: #5865f2; display: grid; place-items: center;
                      font-size: .65rem; color: #fff; font-weight: 700; flex-shrink: 0; }
.dc-author .dc-aimg img { width: 100%; height: 100%; object-fit: cover; }
.dc-author span { color: #f2f3f5; font-size: .87rem; font-weight: 600; }
.dc-title { color: #00a8fc; font-weight: 600; font-size: 1rem; margin-bottom: 8px;
            word-break: break-word; }
.dc-desc { color: #dbdee1; font-size: .875rem; white-space: pre-wrap; word-break: break-word; }
.dc-fields { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 9px; }
.dc-field-n { color: #f2f3f5; font-size: .79rem; font-weight: 600; }
.dc-field-v { color: #dbdee1; font-size: .85rem; }
.dc-img { margin-top: 16px; border-radius: 4px; max-width: 100%; display: block; }
.dc-foot { display: flex; align-items: center; gap: 7px; margin-top: 9px;
           color: #949ba4; font-size: .735rem; }
.dc-mention { background: rgba(88,101,242,.3); color: #c9cdfb;
              padding: 0 2px; border-radius: 3px; font-weight: 500; }
.dc code { background: #1e1f22; padding: 1px 4px; border-radius: 3px;
           font-family: ui-monospace, Menlo, monospace; font-size: .85em; }

@media (max-width: 1100px) {
  .editor { grid-template-columns: 1fr; }
  .previo { position: static; }
}

/* ── Catálogo de variables ──────────────────────────────────────────────── */

.vgrupo + .vgrupo { margin-top: 12px; }
.vgrupo-t { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
            color: var(--text-faint); font-weight: 600; margin-bottom: 5px; }
.vrow {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 10px; margin-bottom: 4px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); cursor: pointer;
  font-family: inherit; font-size: .83rem; color: var(--text); text-align: left;
  transition: border-color .15s, background .15s;
}
.vrow:hover { border-color: var(--crimson); background: var(--surface-2); }
.vrow-l { font-weight: 600; flex-shrink: 0; }
.vrow-e { color: var(--text-faint); flex: 1; min-width: 0; font-size: .79rem;
          white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vrow-v { font-family: ui-monospace, Menlo, monospace; font-size: .74rem;
          color: var(--crimson); background: rgba(225,29,72,.10);
          padding: 2px 6px; border-radius: 5px; flex-shrink: 0; }

/* ── Paneles flotantes (emojis, autocompletar) ──────────────────────────── */

.flotante {
  display: none; position: absolute; z-index: 60;
  width: 330px; max-height: 340px;
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden;
}
.flotante.on { display: block; }
.flotante.chico { width: 290px; max-height: 260px; overflow-y: auto; padding: 6px; }
.flotante-h { display: flex; gap: 8px; align-items: center;
              padding: 10px; border-bottom: 1px solid var(--border); }
.flotante-h input { flex: 1; }
#rejilla-emojis { max-height: 274px; overflow-y: auto; padding: 8px; }
.egrupo-t { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
            color: var(--text-faint); font-weight: 600; padding: 6px 4px 4px; }
.erejilla { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.ebtn {
  background: none; border: none; cursor: pointer;
  font-size: 1.18rem; line-height: 1; padding: 6px 0; border-radius: 6px;
  display: grid; place-items: center;
}
.ebtn:hover { background: var(--border); }
.ebtn img { width: 22px; height: 22px; }
.evacio { color: var(--text-faint); font-size: .83rem; padding: 18px; text-align: center; }

.acrow {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 9px; border-radius: 7px; cursor: pointer; border: none;
  background: none; color: var(--text); font-family: inherit;
  font-size: .84rem; text-align: left;
}
.acrow:hover, .acrow.sel { background: var(--border); }
.acrow code { font-family: ui-monospace, Menlo, monospace; font-size: .74rem;
              color: var(--crimson); margin-left: auto; flex-shrink: 0; }

/* ── Tarjeta de ayuda ───────────────────────────────────────────────────── */

.ayuda summary { cursor: pointer; list-style: none; margin-bottom: 4px; }
.ayuda summary::-webkit-details-marker { display: none; }
.ayuda summary::after { content: '  ▾'; color: var(--text-faint); font-size: .8rem; }
.ayuda[open] summary::after { content: '  ▴'; }
.ayuda p { color: var(--text-dim); font-size: .85rem; margin: 10px 0; }
.ayuda ul { color: var(--text-dim); font-size: .85rem; margin: 10px 0 0; padding-left: 20px; }
.ayuda li { margin-bottom: 6px; }
.ayuda code {
  font-family: ui-monospace, Menlo, monospace; font-size: .8em;
  background: var(--bg-2); border: 1px solid var(--border);
  padding: 1px 5px; border-radius: 5px; color: #ffb3c1;
}
.ayuda-pie { font-size: .8rem !important; color: var(--text-faint) !important;
             margin-bottom: 0 !important; }

.ejemplo { background: var(--bg-2); border: 1px solid var(--border);
           border-radius: var(--r-sm); padding: 12px; margin: 12px 0; }
.ejemplo-fila { display: flex; gap: 11px; align-items: baseline; }
.ejemplo-fila + .ejemplo-fila { margin-top: 8px; padding-top: 8px;
                                border-top: 1px solid var(--border); }
.ejemplo-et { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
              color: var(--text-faint); font-weight: 600; width: 58px; flex-shrink: 0; }
.ejemplo-fila code { background: none; border: none; padding: 0; color: var(--text-dim); }
.ejemplo-sal { font-size: .86rem; color: var(--text); }

/* ── Diseños listos ─────────────────────────────────────────────────────── */

.presets { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 9px; }
.preset {
  text-align: left; padding: 12px 13px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); cursor: pointer;
  font-family: inherit; color: var(--text);
  transition: border-color .15s, background .15s, transform .08s;
}
.preset:hover { border-color: var(--crimson); background: var(--surface-2); }
.preset:active { transform: translateY(1px); }
.preset.on { border-color: var(--crimson); box-shadow: 0 0 0 3px rgba(225,29,72,.14); }
.preset-n { font-weight: 650; font-size: .88rem; margin-bottom: 3px; }
.preset-d { font-size: .765rem; color: var(--text-faint); line-height: 1.42; }

/* Resaltar en la vista previa la parte que se está editando */
.dc [data-parte] { border-radius: 4px; transition: box-shadow .18s, background .18s; }
.dc [data-parte].resaltada {
  box-shadow: 0 0 0 2px var(--crimson), 0 0 0 6px rgba(225,29,72,.18);
  background: rgba(225,29,72,.07);
}
.dc-bar.resaltada { box-shadow: 0 0 0 2px var(--crimson); }
.vacio-hint { color: #6f737b; font-style: italic; font-size: .84rem; }

/* ── Buscador de canales ────────────────────────────────────────────────── */

.acct-busca { position: relative; flex: 1; min-width: 0; }
.acct-busca input { width: 100%; }
.acct-menu {
  display: none; position: absolute; z-index: 30;
  top: calc(100% + 4px); left: 0; right: 0;
  max-height: 232px; overflow-y: auto;
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--r-sm); box-shadow: var(--shadow); padding: 5px;
}
.acct-menu.on { display: block; }
.acct-opt {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px; border-radius: 8px; cursor: pointer;
  border: none; background: none; color: var(--text);
  font-family: inherit; font-size: .86rem; text-align: left;
}
.acct-opt:hover { background: var(--border); }
.acct-opt + .acct-opt { margin-top: 2px; }

/* El logo grande es lo que permite distinguir de un vistazo entre varios
   canales con nombres casi iguales. */
.acct-logo {
  position: relative; width: 38px; height: 38px; flex-shrink: 0;
}
.acct-logo img, .acct-logo .acct-ph {
  width: 38px; height: 38px; border-radius: 50%;
  object-fit: cover; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--crimson-d), #4a0d1a);
  font-size: .92rem; font-weight: 700; color: #fff;
}
.acct-logo .acct-vivo {
  position: absolute; right: -2px; bottom: -2px;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--crimson); border: 2px solid var(--surface-2);
  animation: pulse 2s infinite;
}
.acct-info { min-width: 0; flex: 1; }
.acct-n { font-weight: 650; white-space: nowrap; overflow: hidden;
          text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.acct-m { font-size: .755rem; color: var(--text-faint); white-space: nowrap;
          overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.acct-estado { font-size: .78rem; padding: 9px; line-height: 1.45; }
.acct-estado.malo { color: #ff9aa8; }

/* Confirmación dentro del propio campo: el logo de quien quedó elegido */
.acct-marca {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; gap: 5px;
  font-size: .85rem; pointer-events: none; color: var(--text-faint);
}
.acct-marca img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.acct-marca .ok { color: var(--green); }
.acct-marca .malo { color: var(--amber); }
.acct-busca input { padding-right: 62px; }

/* El logo del canal, como miniatura cuadrada del embed */
.dc-embed { position: relative; }
.dc-thumb {
  width: 80px; height: 80px; border-radius: 4px; object-fit: cover;
  margin: 13px 16px 0 0; flex-shrink: 0; order: 3;
}
