:root {
  --bg: #f6f7fc;
  --panel: #ffffff;
  --ink: #141a33;
  --muted: #5d6481;
  --line: #e4e7f2;
  --accent: #3d5afe;
  --accent-ink: #ffffff;
  --accent-soft: #eaeeff;
  --danger: #d93a4a;
  --danger-soft: #fdecee;
  --ok: #18865b;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20, 26, 51, .04), 0 8px 24px rgba(20, 26, 51, .06);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(28px, 5vw, 40px); }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 22px; letter-spacing: -.02em; text-decoration: none; color: var(--ink); }
.brand-mark { width: 34px; height: 31px; object-fit: contain; display: block; }
.brand-logo { height: 34px; width: auto; max-width: 190px; object-fit: contain; display: block; }
.side-mini .brand-logo { max-width: 34px; object-fit: cover; object-position: left; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid var(--line); background: var(--panel); }
.wrap { max-width: 960px; margin: 0 auto; padding: 32px 16px 64px; }

.btn { appearance: none; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 12px; padding: 11px 18px; font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.stack > * + * { margin-top: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.input { width: 100%; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 12px; padding: 11px 14px; font: inherit; }
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row .field { flex: 1 1 200px; }

.hero { text-align: center; padding: 40px 0 24px; }
.avatar { width: 112px; height: 112px; border-radius: 50%; margin: 0 auto 20px; background: radial-gradient(circle at 35% 30%, var(--accent-soft), transparent 70%), var(--accent-soft); display: grid; place-items: center; font-size: 44px; font-weight: 700; color: var(--accent); }
.avatar-sm { width: 44px; height: 44px; font-size: 18px; margin: 0; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.tab { padding: 10px 14px; border: 0; background: none; font: inherit; color: var(--muted); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.pill-off { background: var(--line); color: var(--muted); }
.level { font-size: 12px; color: var(--muted); }

.notice { padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--ink); font-size: 14px; }
.notice-err { background: var(--danger-soft); color: var(--danger); }
.hidden { display: none !important; }

.consent { max-width: 440px; margin: 0 auto; }
.consent ul { padding-left: 20px; }
.consent li { margin: 6px 0; }

@media (max-width: 560px) {
  .topbar { padding: 12px 16px; }
  .card { padding: 18px; }
}

/* ---------- Editor de avatar ---------- */
.av-editor { display: grid; grid-template-columns: minmax(240px, 300px) 1fr; gap: 32px; align-items: start; }
.av-editor > * { min-width: 0; }
.av-stage { position: sticky; top: 16px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.av-mount { width: 100%; max-width: 280px; aspect-ratio: 1; border-radius: 50% 50% 28px 28px / 46% 46% 28px 28px; background: radial-gradient(circle at 50% 42%, var(--panel) 0 32%, var(--accent-soft) 72%); cursor: pointer; }
.av-mount > svg { display: block; width: 100%; height: 100%; }
.av-mount .hv-burbuja { top: -6px !important; }
.av-expr { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.av-ayuda { margin: 0; text-align: center; }
.av-foto { padding: 16px; border-radius: 14px; background: var(--accent-soft); margin-bottom: 20px; }
.av-foto p { margin: 8px 0 0; }
.av-encuadre { margin-bottom: 20px; }
.av-lienzo { position: relative; width: 100%; max-width: 320px; aspect-ratio: 1; margin: 8px 0 12px; border-radius: 16px; overflow: hidden; background: #000; touch-action: none; cursor: grab; }
.av-lienzo canvas { width: 100%; height: 100%; display: block; }
.av-ovalo { position: absolute; inset: 9% 22% 11%; border-radius: 50%; box-shadow: 0 0 0 999px rgba(10, 12, 24, .55); border: 2px dashed rgba(255, 255, 255, .85); pointer-events: none; }
.av-secciones { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.av-secciones .chip { padding: 8px 14px; font-size: 14px; }
.av-grupo h3 { font-size: 13px; color: var(--muted); font-weight: 600; margin: 0 0 8px; }
.av-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.av-fila { padding: 3px; }
.av-fila > * { flex: none; }
.av-mas { appearance: none; border: 0; background: none; color: var(--accent); font: inherit; font-size: 13px; font-weight: 600; padding: 6px 2px; margin-top: 4px; cursor: pointer; }
.av-mas:hover { text-decoration: underline; }
.av-desc { margin: 8px 0 0; }
.chip { appearance: none; border: 1.5px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 12px; font: inherit; font-size: 13px; padding: 6px 10px; cursor: pointer; display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.chip[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); color: var(--accent); font-weight: 600; }
.chip-thumb { padding: 4px 4px 6px; }
.chip-thumb svg { width: 64px; height: 64px; display: block; }
.chip-thumb span { font-size: 12px; max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swatch { appearance: none; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2.5px var(--accent); }
.swatch-custom { position: relative; overflow: hidden; background: conic-gradient(#f44, #fd4, #4d6, #4cf, #64f, #f4c, #f44); }
.swatch-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.av-mov-btn { display: none; }
.av-herramientas { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.av-guardar { position: sticky; bottom: 0; padding: 14px 0 4px; background: linear-gradient(transparent, var(--panel) 30%); margin-top: 8px; }
.av-creditos { margin-top: 18px; font-size: 12px; color: var(--muted); }
.av-creditos summary { cursor: pointer; }
.av-creditos ul { padding-left: 18px; margin: 6px 0 0; }
.chip:focus-visible, .swatch:focus-visible, .btn:focus-visible, .tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.avatar-sm svg { width: 100%; height: 100%; display: block; }
.avatar-sm.con-avatar { background: var(--accent-soft); overflow: hidden; }
@media (max-width: 720px) {
  .av-editor { grid-template-columns: 1fr; gap: 16px; }
  .av-stage { position: sticky; top: 0; z-index: 2; width: 100%; background: var(--panel); padding: 8px 0; gap: 8px; }
  .av-mount { max-width: 150px; }
  .av-mount .hv-burbuja { font-size: 11px !important; max-width: 140px !important; padding: 5px 8px !important; }
  #av-acciones { display: none; flex-wrap: wrap; justify-content: center; max-width: 100%; }
  .av-stage.movs #av-acciones { display: flex; }
  .av-stage.movs { position: static; }
  .av-mov-btn { display: inline-flex; }
  .av-ayuda { display: none; }
  .chip-thumb svg { width: 56px; height: 56px; }
}

/* =========================================================
 * Portal con sesión: menú lateral + conversación
 * ========================================================= */
.ic { flex: none; display: block; }
.app { display: grid; grid-template-columns: 296px 1fr; min-height: 100vh; min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--line); padding: 18px 14px; overflow: hidden; z-index: 20; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 18px; }
.side-top .brand { font-size: 26px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.nav-item { appearance: none; border: 0; background: none; color: var(--ink); font: inherit; font-size: 15.5px; display: flex; align-items: center; gap: 14px; padding: 11px 14px; border-radius: 12px; cursor: pointer; text-align: left; width: 100%; }
.nav-item .ic { color: var(--muted); }
.nav-item:hover { background: var(--bg); }
.nav-item.activo { background: var(--accent-soft); color: var(--accent); }
.nav-item.activo .ic, #nueva .ic { color: var(--accent); }
#nueva { color: var(--accent); font-weight: 600; }
.nav-sm { font-size: 14px; color: var(--muted); padding: 8px 14px; }
.side-convs { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-top: 14px; }
.side-convs-head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 6px 14px; color: var(--muted); font-weight: 500; }
.side-convs .input-sm { margin: 0 6px 8px; width: auto; padding: 8px 12px; font-size: 14px; }
.convs { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; }
.convs li { position: relative; }
.conv { appearance: none; border: 0; background: none; font: inherit; width: 100%; text-align: left; padding: 9px 36px 9px 14px; border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; color: var(--ink); }
.conv:hover, .convs li.activo .conv { background: var(--bg); }
.conv-titulo { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-fecha { font-size: 12px; color: var(--muted); }
.conv-borrar { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); appearance: none; border: 0; background: none; color: var(--muted); font-size: 18px; width: 28px; height: 28px; border-radius: 8px; cursor: pointer; opacity: 0; }
.convs li:hover .conv-borrar, .conv-borrar:focus-visible { opacity: 1; }
.conv-borrar:hover { background: var(--danger-soft); color: var(--danger); }
.convs-vacio { font-size: 13px; color: var(--muted); padding: 6px 14px; }
.icon-btn { appearance: none; border: 0; background: none; color: var(--muted); width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.icon-sm { width: 32px; height: 32px; }
.icon-sm .ic { width: 19px; height: 19px; }

/* Menú contraído */
.app.side-mini { grid-template-columns: 76px 1fr; }
.side-mini .side { padding: 18px 10px; }
.side-mini .side-top { flex-direction: column; gap: 10px; padding: 0 0 14px; }
.side-mini .brand { font-size: 0; gap: 0; }
.side-mini .nav-item { justify-content: center; padding: 11px 0; }
.side-mini .nav-item span, .side-mini .side-convs { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.main-top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; padding: 12px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); }
.menu-btn { display: none; }
.punto { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--bg); }
.user-chip { appearance: none; border: 0; background: none; font: inherit; color: var(--ink); display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 999px; cursor: pointer; font-weight: 500; }
.user-chip:hover { background: var(--panel); }
.user-chip .avatar-sm { width: 40px; height: 40px; font-size: 16px; }
.user-chip .ic { color: var(--muted); width: 18px; }
.dd { position: relative; }
.dd-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(20, 26, 51, .14); padding: 6px; z-index: 30; }
.dd-menu > button { appearance: none; border: 0; background: none; font: inherit; color: var(--ink); width: 100%; text-align: left; padding: 9px 12px; border-radius: 9px; cursor: pointer; }
.dd-menu > button:hover { background: var(--bg); }
#avisos { width: 320px; }
.dd-titulo { font-weight: 700; padding: 8px 12px 4px; }
.dd-vacio { padding: 8px 12px; color: var(--muted); font-size: 14px; }
.aviso { padding: 8px 12px; border-radius: 9px; display: flex; flex-direction: column; font-size: 14px; }
.aviso span { font-size: 12px; color: var(--muted); }
.aviso.nuevo { background: var(--accent-soft); }
#avisos > button { color: var(--accent); font-weight: 600; font-size: 14px; }
.avisos-flotantes { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; width: min(560px, calc(100vw - 32px)); display: grid; gap: 8px; pointer-events: none; }
.avisos-flotantes .notice { margin: 0; box-shadow: 0 8px 24px rgba(20, 26, 51, .16); pointer-events: auto; }
.avisos-flotantes .notice:not(.notice-err) { background: var(--ink); color: var(--panel); }

.view { padding: 8px 28px 64px; max-width: 1060px; width: 100%; margin: 0 auto; }
.view-title { font-size: 26px; margin-bottom: 4px; }
.view-sub { margin-bottom: 20px; }

/* Vista de conversación */
.chat-view { max-width: 1140px; flex: 1; display: flex; flex-direction: column; padding-bottom: 0; }
.chat-col { flex: 1; display: flex; flex-direction: column; align-items: center; }
.hero-av { width: min(330px, 70vw); aspect-ratio: 1; margin-top: -4px; border-radius: 50%; background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--accent) 16%, transparent) 0, transparent 66%); cursor: pointer; -webkit-mask-image: linear-gradient(#000 78%, transparent 99%); mask-image: linear-gradient(#000 78%, transparent 99%); }
.chat-hero { text-align: center; width: 100%; }
.chat-hero h1 { font-size: clamp(30px, 4.4vw, 46px); letter-spacing: -.03em; margin: 0 0 6px; }
.hero-sub { font-size: clamp(17px, 2vw, 22px); color: var(--muted); margin: 0 0 8px; }
.hero-txt { max-width: 600px; margin: 0 auto 26px; font-size: 17px; }
.sug-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; width: 100%; margin-bottom: 26px; }
.sug { appearance: none; text-align: left; font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr; gap: 14px 8px; cursor: pointer; box-shadow: var(--shadow); font-size: 16px; line-height: 1.35; min-height: 138px; transition: transform .15s, border-color .15s; }
.sug:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.sug-ic { grid-column: 1 / -1; width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.sug-rojo { background: var(--danger-soft); color: var(--danger); }
.sug > .ic { align-self: end; color: var(--ink); }
.composer-wrap { position: sticky; bottom: 0; width: 100%; max-width: 1040px; padding: 10px 0 18px; background: linear-gradient(transparent, var(--bg) 26%); margin-top: auto; }
.composer { position: relative; display: flex; align-items: flex-end; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 10px 10px 10px 20px; box-shadow: 0 6px 24px rgba(20, 26, 51, .08); }
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.composer textarea { flex: 1; min-width: 0; border: 0; outline: 0; resize: none; background: none; color: var(--ink); font: inherit; font-size: 17px; line-height: 1.45; padding: 10px 0; max-height: 180px; }
.send { appearance: none; border: 0; width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; cursor: pointer; flex: none; }
.send:hover { filter: brightness(1.08); }
.modo-tag { position: absolute; top: -13px; left: 18px; box-shadow: 0 2px 8px rgba(20, 26, 51, .12); display: inline-flex; align-items: center; gap: 6px; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 4px 6px 4px 10px; font-size: 13px; font-weight: 600; }
.modo-tag .ic { width: 16px; }
.modo-tag button { appearance: none; border: 0; background: none; color: inherit; font-size: 16px; cursor: pointer; padding: 0 4px; }
.modos { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px; }
.modo { appearance: none; font: inherit; font-size: 14px; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.modo .ic { width: 18px; }
.modo:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.modo[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }

.conversando .hero-av { position: fixed !important; right: 28px; bottom: 132px; width: 132px; margin: 0; z-index: 6; background: none; }
.conversando .composer-wrap .modos { display: none; }
.chat-log { width: 100%; max-width: 820px; display: flex; flex-direction: column; gap: 18px; padding: 8px 0 24px; }
.msg p { margin: 0; white-space: pre-wrap; }
.msg-yo { align-self: flex-end; max-width: 78%; background: var(--accent); color: var(--accent-ink); padding: 12px 16px; border-radius: 18px 18px 4px 18px; font-size: 16px; }
.msg-modo { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; opacity: .8; margin-bottom: 2px; }
.msg-hv { display: flex; gap: 12px; align-items: flex-start; max-width: 100%; }
.msg-av { width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--accent-soft); overflow: hidden; }
.msg-av svg { width: 100%; height: 100%; display: block; }
.msg-cuerpo { min-width: 0; flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: 4px 18px 18px 18px; padding: 14px 16px; font-size: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); }
.msg-fuente { font-size: 12px; color: var(--muted); }
.msg-sug { display: flex; flex-wrap: wrap; gap: 8px; }
.msg-sug .modo { font-size: 13px; padding: 6px 12px; }
.puntos { flex-direction: row; gap: 6px; width: auto; flex: none; padding: 16px 18px; }
.puntos i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: punto 1s infinite ease-in-out; }
.puntos i:nth-child(2) { animation-delay: .15s; }
.puntos i:nth-child(3) { animation-delay: .3s; }
@keyframes punto { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }
.bl-lista { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.bl-lista li { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line); }
.bl-lista li:first-child { border-top: 0; }
.bl-lista li > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bl-lista strong { font-weight: 600; }
.bl-lista span { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.bl-lista em { font-style: normal; font-size: 12px; color: var(--muted); white-space: nowrap; }
.bl-pasos { counter-reset: paso; }
.bl-pasos li::before { counter-increment: paso; content: counter(paso); width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; display: grid; place-items: center; }
.bl-acciones { display: flex; flex-wrap: wrap; gap: 8px; }
.bl-stats, .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.bl-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { background: var(--bg); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; }
.stats .stat { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }
.stat strong { font-size: 26px; letter-spacing: -.02em; }
.stat span { font-size: 13px; color: var(--muted); }

/* Otras vistas */
.permisos-lista { list-style: none; padding: 0; margin: 8px 0 0; font-size: 14px; display: grid; gap: 4px; }
.permisos-lista li::before { display: inline-block; width: 20px; font-weight: 700; }
.perm-si::before { content: "✓"; color: var(--ok); }
.perm-no { color: var(--muted); }
.perm-no::before { content: "✕"; color: var(--danger); }
.barras { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; height: 160px; align-items: end; }
.barra { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; }
.barra span { width: 100%; max-width: 36px; background: var(--accent); border-radius: 8px 8px 3px 3px; }
.barra span.cero { background: var(--line); }
.barra em, .barra small { font-style: normal; font-size: 12px; color: var(--muted); }
/* Foto de perfil */
.foto-card { margin-top: 16px; display: grid; gap: 14px; }
.foto-cab { display: flex; gap: 16px; align-items: center; }
.foto-cab h3 { margin: 0 0 4px; }
.foto-actual { width: 72px; height: 72px; flex: none; border-radius: 50%; overflow: hidden; background: var(--accent-soft); display: grid; place-items: center; font-size: 11px; color: var(--muted); }
.foto-actual img { width: 100%; height: 100%; object-fit: cover; }
.foto-editor { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
#foto-lienzo { width: 280px; max-width: 100%; aspect-ratio: 1; border-radius: 16px; background: #000; touch-action: none; cursor: grab; }
.chip:disabled { opacity: .45; cursor: not-allowed; }

/* Botones y logos para desarrolladores */
.bt-opciones { display: grid; gap: 12px; }
.bt-opciones > div { display: grid; gap: 6px; }
.bt-vista { display: flex; align-items: center; justify-content: center; min-height: 110px; border-radius: 14px; background: var(--bg); border: 1px dashed var(--line); padding: 20px; }
.logos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.logo-item { display: grid; gap: 8px; }
.logo-prev { height: 110px; border-radius: 12px; border: 1px solid var(--line); display: grid; place-items: center; background: #fff; }
.logo-prev.oscuro { background: #11152b; border-color: #11152b; }
.logo-prev.gris { background: #eef0f6; }
.logo-prev img { max-width: 64px; max-height: 64px; }
.logo-desc { display: flex; flex-wrap: wrap; gap: 6px; }

/* Marca */
.marca-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.marca-item { display: flex; flex-direction: column; gap: 6px; }
.marca-prev { height: 96px; border: 1px dashed var(--line); border-radius: 12px; display: grid; place-items: center; padding: 14px; background: var(--bg); }
.marca-prev img { max-height: 64px; max-width: 100%; object-fit: contain; }
.marca-prev-cuadro img { width: 56px; height: 56px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Usuarios (administración) */
.barras-30 { grid-template-columns: repeat(30, 1fr); gap: 3px; height: 130px; }
.barras-30 .barra span { border-radius: 4px 4px 2px 2px; }
.us-filtros { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.us-filtros .input { flex: 1 1 220px; width: auto; }
.us-filtros select.input { flex: 0 1 180px; }
.us-tabla-wrap { margin: 0 -4px; }
.us-tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.us-tabla th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.us-tabla td { padding: 10px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.us-tabla td:nth-child(6), .us-tabla td:nth-child(7) { white-space: nowrap; font-size: 13px; color: var(--muted); }
.us-tag { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.us-tag.ok { background: #e6f5ee; color: var(--ok); }
.us-tag.pend { background: #fff5e0; color: #9a6400; }
.us-tag.mal { background: var(--danger-soft); color: var(--danger); }
td > .us-tag:first-child { margin-left: 0; }
.us-acciones { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }
@media (max-width: 900px) {
  .us-tabla thead { display: none; }
  .us-tabla, .us-tabla tbody, .us-tabla tr, .us-tabla td { display: block; width: 100%; }
  .us-tabla tr { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
  .us-tabla td { border: 0; padding: 3px 0; white-space: normal !important; }
  .us-tabla td[data-k]::before { content: attr(data-k) ": "; color: var(--muted); font-size: 12px; }
  .us-tabla td:first-child { display: none; }
  .us-tabla td:nth-child(2) { font-weight: 600; font-size: 15px; }
  .us-acciones { justify-content: flex-start; flex-wrap: wrap; padding-top: 8px; }
}
.us-pie { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; gap: 8px; }
.us-pag { display: flex; gap: 6px; }
.code { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 14px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; margin: 0; }
.velo { position: fixed; inset: 0; background: rgba(10, 12, 24, .4); z-index: 19; }

@media (max-width: 1300px) {
  .conversando .hero-av { width: 96px; right: 16px; }
}
@media (max-width: 1100px) {
  .sug-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app, .app.side-mini { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; width: 296px; max-width: 86vw; transform: translateX(-102%); transition: transform .25s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .2); }
  .side-abierto .side { transform: none; }
  .menu-btn { display: grid; }
  .main-top, .view { padding-left: 16px; padding-right: 16px; }
  .side-mini .nav-item span, .side-mini .side-convs { display: revert; }
}
@media (max-width: 560px) {
  .sug-grid { gap: 10px; }
  .sug { min-height: 0; padding: 14px; font-size: 14.5px; gap: 10px 6px; }
  .sug-ic { width: 36px; height: 36px; }
  .hero-av { width: min(230px, 62vw); }
  .hero-txt { font-size: 15px; }
  .composer { padding-left: 14px; border-radius: 18px; }
  .send { width: 44px; height: 44px; }
  .modos { gap: 6px; }
  .modo { padding: 6px 12px; font-size: 13px; }
  .msg-yo { max-width: 88%; }
  .msg-av { width: 34px; height: 34px; }
  #avisos { width: min(320px, 90vw); }
  .user-chip #yo-nombre { display: none; }
  .conversando .hero-av { display: none; }
}
.app .av-stage { top: 76px; }
@media (max-width: 720px) { .app .av-stage { top: 64px; } }
.conversando .hero-av { -webkit-mask-image: none; mask-image: none; }
.conversando .hero-av .hv-burbuja { display: none; }
.dev-cab { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dev-cab h3 { margin: 0; }
.dev-apps { display: grid; gap: 14px; }
.dev-app { display: flex; flex-direction: column; gap: 10px; }
.dev-app-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dev-meta { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.dev-meta dt { color: var(--muted); }
.dev-meta dd { margin: 0; overflow-wrap: anywhere; }
.dev-caps { border: 0; padding: 0; margin: 0; }
.dev-caps legend { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; font-size: 14px; }
.check input { margin-top: 3px; }
#dev-form { margin-bottom: 16px; }
.secreto { margin-bottom: 16px; display: grid; gap: 10px; }
.secreto pre { margin: 0; }
.zona-peligro { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.zona-peligro h3 { color: var(--danger); }
.enlace { appearance: none; border: 0; background: none; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.center { text-align: center; }
.pill-ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.pill-warn { background: color-mix(in srgb, #f59e0b 18%, transparent); color: #b45309; }
.field label .pill { margin-left: 8px; vertical-align: 1px; }
.dato + .dato { margin-top: 16px; }
.codigo-paso { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); }
.codigo-paso p { margin: 0 0 8px; }
.codigo-input { max-width: 170px; font-variant-numeric: tabular-nums; letter-spacing: .12em; }
.codigos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 10px 0; }
.codigos code { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 14px; text-align: center; letter-spacing: .05em; }
.codigo-grande { font-size: 40px; font-weight: 800; letter-spacing: .12em; text-align: center; margin: 4px 0; font-variant-numeric: tabular-nums; }
.enlace-inv { display: block; word-break: break-all; margin: 6px 0 10px; font-size: 13px; }
#solicitudes li, #abiertas li { flex-wrap: wrap; }
.id-fotos { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.id-foto { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 120px; border: 1.5px dashed var(--line); border-radius: 14px; padding: 10px; cursor: pointer; text-align: center; font-size: 13px; color: var(--muted); overflow: hidden; }
.id-foto.lista { border-style: solid; border-color: var(--ok); color: var(--ok); }
.id-foto input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.id-foto img { max-width: 100%; max-height: 90px; border-radius: 8px; }
.id-revision { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.id-revision figure { margin: 0; }
.id-revision img { width: 100%; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); min-height: 120px; object-fit: contain; }
.pass-wrap { position: relative; }
.pass-wrap .input { padding-right: 76px; }
.pass-ver { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); appearance: none; border: 0; background: none; color: var(--accent); font: inherit; font-size: 13px; font-weight: 600; padding: 6px 8px; cursor: pointer; }
.hv-dialogo { border: 1px solid var(--line); border-radius: 18px; padding: 24px; width: min(420px, calc(100vw - 32px)); background: var(--panel); color: var(--ink); box-shadow: 0 20px 60px rgba(10, 12, 24, .3); }
.hv-dialogo::backdrop { background: rgba(10, 12, 24, .45); }
.avatar-marca { background: #fff; box-shadow: var(--shadow); }
.avatar-marca img { width: 54%; height: 54%; object-fit: contain; }

/* Página pública para desarrolladores */
body.dx { background: var(--bg); }
.dx-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.dx-top-tag { font-size: 13px; font-weight: 600; color: var(--muted); padding-left: 12px; border-left: 1px solid var(--line); }
.dx-top-nav { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.dx-top-nav > a:not(.btn) { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; }
.dx-hero { max-width: 860px; margin: 0 auto; padding: 64px 24px 40px; text-align: center; }
.dx-hero h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.12; letter-spacing: -.03em; margin: 0 0 18px; }
.dx-hero p { font-size: 17px; color: var(--muted); margin: 0 auto 26px; max-width: 680px; }
.dx-hero-acc { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.dx-cuerpo { max-width: 1180px; margin: 0 auto; padding: 0 24px 40px; display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 40px; }
.dx-indice { position: sticky; top: 84px; align-self: start; display: grid; gap: 2px; }
.dx-indice a { color: var(--muted); text-decoration: none; font-size: 14px; padding: 7px 12px; border-radius: 10px; }
.dx-indice a:hover { color: var(--ink); background: var(--panel); }
.dx-indice a.activo { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.dx-main { min-width: 0; }
.dx-main section { padding-top: 12px; margin-bottom: 44px; scroll-margin-top: 80px; }
.dx-main h2 { font-size: 26px; letter-spacing: -.02em; margin: 0 0 10px; }
.dx-main h3 { font-size: 17px; margin: 26px 0 8px; display: flex; align-items: center; gap: 10px; }
.dx-main p { line-height: 1.6; }
.dx-num { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-grid; place-items: center; font-size: 14px; flex: none; }
.dx-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.dx-lista { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; font-size: 15px; }
.dx-lista li { padding-left: 24px; position: relative; }
.dx-lista li::before { position: absolute; left: 0; font-weight: 700; }
.dx-si li::before { content: "✓"; color: var(--ok); }
.dx-no li::before { content: "✕"; color: var(--danger); }
.dx-code { position: relative; margin: 10px 0; }
.dx-code .code { padding-right: 84px; }
.dx-copiar { position: absolute; top: 8px; right: 8px; appearance: none; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; font: 600 12px/1 inherit; font-family: inherit; padding: 7px 10px; cursor: pointer; color: var(--ink); }
.dx-copiar:hover { border-color: var(--accent); color: var(--accent); }
.dx-tabla { width: 100%; border-collapse: collapse; font-size: 14px; margin: 12px 0; background: var(--panel); border-radius: 12px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
.dx-tabla th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfe; }
.dx-tabla td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; line-height: 1.5; }
.dx-tabla tr:last-child td { border-bottom: 0; }
.dx-tabla code, .dx-main p code, .dx-lista code, .dx-pasos code { overflow-wrap: anywhere; }
.dx-pasos { padding-left: 20px; display: grid; gap: 6px; line-height: 1.55; }
.dx-cta { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 26px; }
.dx-cta h2 { margin: 0 0 4px; }
.dx-cta p { margin: 0; }
.dx-pie { text-align: center; padding: 26px; border-top: 1px solid var(--line); }
.dx-pie a { color: inherit; }
@media (max-width: 900px) {
  .dx-cuerpo { grid-template-columns: 1fr; gap: 0; }
  .dx-indice { position: static; display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 24px; }
  .dx-indice a { background: var(--panel); box-shadow: 0 0 0 1px var(--line); font-size: 13px; padding: 6px 10px; }
  .dx-top { padding: 12px 16px; }
  .dx-top-tag { display: none; }
  .dx-hero { padding: 40px 16px 28px; }
  .dx-cuerpo { padding: 0 16px 32px; }
  .dx-tabla, .dx-tabla tbody, .dx-tabla tr, .dx-tabla td { display: block; width: 100%; }
  .dx-tabla tr:first-child { display: none; }
  .dx-tabla tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .dx-tabla td { border: 0; padding: 4px 12px; }
  .dx-tabla td:first-child { font-weight: 600; }
}
a.btn { text-decoration: none; }
.dx-main .card h3 { margin-top: 0; }
.dx-tabla td:first-child { white-space: nowrap; }
.dx-tabla td:first-child code { overflow-wrap: normal; }
@media (max-width: 900px) { .dx-tabla td:first-child { white-space: normal; } }
.landing-dev { text-align: center; margin: 28px 0 8px; }
.dx-aviso { margin-bottom: 18px; }
.dx-ia { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; padding: 26px; background: linear-gradient(135deg, #eef3ff, #f6f0ff); border: 0; }
.dx-ia h2 { margin: 0 0 8px; }
.dx-ia .code { background: #fff; white-space: pre-wrap; }
@media (max-width: 900px) { .dx-ia { grid-template-columns: 1fr; padding: 20px; } }
