:root {
  --bg: #f8f7fc; --panel: #fff; --side: #fdfcff; --ink: #16152a; --muted: #6b6880; --line: #e2e0ee;
  --p: #5b47f0; --p-ink: #fff; --p-soft: #f3f1ff; --accent: #22d3ee; --ok: #1f9d63; --err: #d23c3c; --warn: #b7791f;
  --r: 12px; --shadow: 0 1px 2px rgba(20, 22, 40, .05), 0 6px 20px rgba(20, 22, 40, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0a14; --panel: #16152a; --side: #111020; --ink: #f8f7fc; --muted: #9d9ab0; --line: #25233a;
    --p: #8b7cff; --p-ink: #0b0a14; --p-soft: #1e1850; --ok: #3ccf8e; --err: #ff6b6b; --warn: #f0b75a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 Inter, system-ui, -apple-system, 'Segoe UI', sans-serif; }
[hidden] { display: none !important; }
a { color: var(--p); }
code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--p-soft); padding: 1px 5px; border-radius: 5px; }
h1, h2 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 19px; }
h2 { font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--err); min-height: 1.2em; margin: 0; }
.sp { flex: 1; }

/* botones */
.btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 8px 14px; border-radius: 9px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover:not(:disabled) { border-color: var(--p); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.p { background: var(--p); border-color: var(--p); color: var(--p-ink); }
.btn.ghost { background: none; border-color: transparent; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.link { font: inherit; background: none; border: 0; color: var(--p); cursor: pointer; padding: 0; text-decoration: underline; }
:focus-visible { outline: 2px solid var(--p); outline-offset: 2px; }

/* login */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 9px; font-size: 16px; }
.brand small { color: var(--muted); font-size: 12px; }
.logo { width: 30px; height: 30px; flex: none; display: block; }
.logo .lb { fill: var(--p); }
.logo .lf { fill: var(--p-ink); }
.brand b { font-family: 'Bricolage Grotesque', Inter, system-ui, sans-serif; font-weight: 800; letter-spacing: -.02em; }

/* estructura */
.app { display: grid; grid-template-columns: 236px 1fr; height: 100%; }
.side { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 12px; gap: 16px; overflow-y: auto; }
.side .brand { padding: 2px 8px 8px; }
#nav { display: grid; gap: 2px; }
#nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--ink); text-decoration: none; font-weight: 500; }
#nav a:hover { background: var(--p-soft); }
#nav a[aria-current='page'] { background: var(--p-soft); color: var(--p); font-weight: 650; }
.ico { width: 22px; text-align: center; font-size: 13px; opacity: .8; }
.side-foot { margin-top: auto; display: grid; gap: 8px; padding: 0 8px; font-size: 13px; }
/* selector del idioma del panel (pie de la barra lateral y login) */
.lang-pick { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.lang-pick select { font-size: 13px; padding: 5px 8px; }
.main { display: flex; flex-direction: column; min-width: 0; height: 100%; }
.top { display: flex; align-items: center; gap: 10px; padding: 12px 22px; border-bottom: 1px solid var(--line); background: var(--panel); }
.dirty { color: var(--warn); font-size: 13px; font-weight: 600; }
.menu-btn { display: none; }
.content { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) auto; overflow: hidden; min-height: 0; }
.view { overflow-y: auto; padding: 22px; display: grid; gap: 18px; align-content: start; }
.view > * { max-width: 980px; }

/* tarjetas y campos */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.card-h p { margin: 3px 0 0; font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px 18px; }
.f { display: grid; gap: 5px; align-content: start; }
.f > span { font-weight: 600; font-size: 13px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.f small, .check small { color: var(--muted); font-size: 12px; }
.wide { grid-column: 1 / -1; }
input[type=text], input[type=url], input[type=email], input[type=number], input[type=password], select, textarea {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--p); outline: none; box-shadow: 0 0 0 3px var(--p-soft); }
textarea { resize: vertical; }
textarea.code { font: 12.5px/1.5 ui-monospace, Menlo, monospace; }
.color { display: flex; align-items: center; gap: 10px; }
.color input { width: 44px; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--bg); }
.range { display: flex; align-items: center; gap: 10px; }
.range input { flex: 1; accent-color: var(--p); }
.range output { min-width: 34px; font-variant-numeric: tabular-nums; font-size: 13px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--p); width: 16px; height: 16px; }
.check span { display: grid; }
.src { font-style: normal; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; padding: 1px 6px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.src.bo { color: var(--p); border-color: var(--p); }
.src.ok { color: var(--ok); border-color: var(--ok); }
.src.warn { color: var(--warn); border-color: var(--warn); }
.note { margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--p-soft); font-size: 13px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-inline { display: flex; gap: 10px; }
.row-inline input { flex: 1; }
.sticky-save { position: sticky; bottom: 0; display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 -4px 20px rgba(0, 0, 0, .06); }

/* resumen */
.hero { grid-template-columns: 120px 1fr; align-items: center; gap: 20px; }
.hero-av { width: 120px; height: 130px; display: grid; place-items: center; }
.hero-av img { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; }
.hero-av svg { width: 100%; height: 100%; }
.hero h2 { font-size: 22px; }
.hero .chips { margin-top: 10px; }
.status { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.status li { display: grid; grid-template-columns: 12px minmax(160px, 240px) 1fr; gap: 10px; align-items: center; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); opacity: .5; }
.dot.ok { background: var(--ok); opacity: 1; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }

/* instalar */
.copy { position: relative; }
.copy pre { margin: 0; padding: 14px; padding-right: 90px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
.copy pre code { background: none; padding: 0; white-space: pre; }
.copy .btn { position: absolute; top: 8px; right: 8px; }

/* editor de avatar */
#editor { min-height: 480px; }
#editor ots-avatar-editor { display: block; }

/* vista previa */
.preview { width: 400px; border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; padding: 12px; gap: 8px; }
.preview-head { display: flex; align-items: center; gap: 8px; }
.preview iframe { flex: 1; width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); min-height: 0; }
.preview p { margin: 0; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .2s; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 500; max-width: calc(100vw - 32px); z-index: 10; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: var(--ok); color: #fff; }
.toast.err { background: var(--err); color: #fff; }

@media (max-width: 1180px) {
  .content { grid-template-columns: 1fr; overflow-y: auto; }
  .view { overflow: visible; }
  .preview { width: auto; border-left: 0; border-top: 1px solid var(--line); height: 620px; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 5; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .nav-open .side { transform: none; }
  .menu-btn { display: inline-flex; }
  .top { padding: 10px 16px; flex-wrap: wrap; }
  .view { padding: 16px; }
  .hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .hero .chips { justify-content: center; }
  .status li { grid-template-columns: 12px 1fr; }
  .status li .muted { grid-column: 2; }
  .row-inline { flex-direction: column; }
}
