/*
 * Soul Editor · estilos. © Soul Labs — Soul Enterprise.
 * .se-content sirve también para mostrar el HTML guardado en tu web: <div class="se-content">…</div>
 */
.se, .se-content {
    --se-bg: #ffffff;
    --se-chrome: #f6f8fc;
    --se-text: #1b2a47;
    --se-heading: #0f2a5c;
    --se-muted: #5b6b8c;
    --se-border: #d5deee;
    --se-hover: rgba(15, 42, 92, 0.07);
    --se-active: rgba(15, 42, 92, 0.13);
    --se-accent: #ffc93d;
    --se-primary: #0f2a5c;
    --se-on-primary: #ffffff;
    --se-link: #1f4fa8;
    --se-code-bg: rgba(15, 42, 92, 0.07);
    --se-pre-bg: #0f2a5c;
    --se-pre-text: #eef3fb;
    --se-quote: #ffc93d;
    --se-mark: #fff3a3;
    --se-focus: #4da3ff;
    --se-shadow: 0 10px 30px rgba(15, 42, 92, 0.18);
    --se-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --se-font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
    --se-font-mono: ui-monospace, 'Cascadia Code', 'SFMono-Regular', Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    .se:not([data-theme="light"]), .se-content:not([data-theme="light"]) {
        --se-bg: #0f2a5c;
        --se-chrome: #0c2350;
        --se-text: #dbe4f3;
        --se-heading: #ffffff;
        --se-muted: #93a4c4;
        --se-border: #1f3d75;
        --se-hover: rgba(238, 243, 251, 0.08);
        --se-active: rgba(238, 243, 251, 0.16);
        --se-primary: #ffc93d;
        --se-on-primary: #0f2a5c;
        --se-link: #8ec2ff;
        --se-code-bg: rgba(238, 243, 251, 0.1);
        --se-pre-bg: #081a3d;
        --se-mark: #6b5a12;
        --se-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    }
}
.se[data-theme="dark"], .se-content[data-theme="dark"] {
    --se-bg: #0f2a5c; --se-chrome: #0c2350; --se-text: #dbe4f3; --se-heading: #ffffff; --se-muted: #93a4c4;
    --se-border: #1f3d75; --se-hover: rgba(238, 243, 251, 0.08); --se-active: rgba(238, 243, 251, 0.16);
    --se-primary: #ffc93d; --se-on-primary: #0f2a5c; --se-link: #8ec2ff; --se-code-bg: rgba(238, 243, 251, 0.1);
    --se-pre-bg: #081a3d; --se-mark: #6b5a12; --se-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* ---------- Marco ---------- */
.se {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--se-bg);
    color: var(--se-text);
    border: 1px solid var(--se-border);
    font-family: var(--se-font);
    text-align: left;
    min-width: 0;
}
.se.se-focused { border-color: var(--se-focus); box-shadow: 0 0 0 3px rgba(77, 163, 255, 0.18); }
.se *, .se *::before, .se *::after { box-sizing: border-box; }
.se [hidden] { display: none !important; }

.se-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 0;
    padding: 4px;
    background: var(--se-chrome);
    border-bottom: 1px solid var(--se-border);
    position: sticky;
    top: 0;
    z-index: 3;
}
.se-group { display: flex; align-items: center; gap: 1px; padding: 0 4px; border-right: 1px solid var(--se-border); }
.se-group:last-child { border-right: 0; }

.se-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--se-text);
    font: 600 13px/1 var(--se-font);
    cursor: pointer;
}
.se-btn:hover:not([disabled]) { background: var(--se-hover); }
.se-btn[aria-pressed="true"] { background: var(--se-active); color: var(--se-heading); box-shadow: inset 0 -2px 0 var(--se-accent); }
.se-btn[disabled] { opacity: 0.35; cursor: default; }
.se-btn:focus-visible, .se-b:focus-visible, .se-menu-item:focus-visible { outline: 2px solid var(--se-focus); outline-offset: -2px; }
.se-icon { width: 18px; height: 18px; flex: none; }
.se-btn-drop .se-icon + .se-icon, .se-blocks .se-icon { width: 12px; height: 12px; opacity: 0.6; }
.se-blocks { min-width: 118px; justify-content: space-between; padding: 0 8px; }
.se-btn-label { font-family: var(--se-font-display); font-weight: 700; white-space: nowrap; }
.se-btn-text { padding: 0 8px; }
.se-swatch { stroke: #d1242f; }
[data-cmd="highlight"] .se-swatch { stroke: #ffd43b; }

.se-body { position: relative; overflow: auto; flex: 1 1 auto; }
.se-body > .se-content {
    padding: 20px 24px 28px;
    outline: none;
    min-height: 220px;
}
.se-readonly .se-toolbar { opacity: 0.6; pointer-events: none; }

.se-source {
    display: block;
    width: 100%;
    min-height: 320px;
    height: 100%;
    border: 0;
    padding: 16px;
    resize: vertical;
    background: var(--se-pre-bg);
    color: var(--se-pre-text);
    font: 13px/1.6 var(--se-font-mono);
    tab-size: 2;
    outline: none;
}

.se-status {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 10px;
    border-top: 1px solid var(--se-border);
    background: var(--se-chrome);
    color: var(--se-muted);
    font-size: 12px;
    min-height: 26px;
}
.se-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--se-font-mono); }
.se-count { white-space: nowrap; }

.se-fullscreen { position: fixed; inset: 0; z-index: 9999; border: 0; }
.se-fullscreen .se-body { max-height: none !important; height: auto !important; }
.se-fullscreen .se-body > .se-content { max-width: 860px; margin: 0 auto; min-height: 100%; }
html.se-noscroll { overflow: hidden; }

/* ---------- Placeholder ---------- */
.se-body > .se-content.se-empty::before {
    content: attr(data-placeholder);
    position: absolute;
    color: var(--se-muted);
    opacity: 0.8;
    pointer-events: none;
}

/* ---------- Capas flotantes ---------- */
.se-layer { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 10000; }
.se-popover, .se-menu, .se-ctxbar {
    position: fixed;
    background: var(--se-bg);
    color: var(--se-text);
    border: 1px solid var(--se-border);
    box-shadow: var(--se-shadow);
    font-family: var(--se-font);
    font-size: 14px;
}
.se-popover { padding: 14px; width: min(340px, calc(100vw - 16px)); }
.se-menu { padding: 4px; min-width: 200px; max-height: 340px; overflow: auto; }
.se-menu-title { padding: 6px 10px 4px; font: 600 11px/1 var(--se-font-display); text-transform: uppercase; letter-spacing: 0.08em; color: var(--se-muted); }
.se-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 10px;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.se-menu-item.is-focus { background: var(--se-hover); }
.se-menu-item.is-active { box-shadow: inset 3px 0 0 var(--se-accent); }
.se-menu-item small { margin-left: auto; color: var(--se-muted); font-family: var(--se-font-mono); }
.se-menu-badge { display: inline-flex; width: 18px; justify-content: center; font: 700 12px/1 var(--se-font-display); }
.se-menu-empty { padding: 10px; color: var(--se-muted); }
.se-menu-sample { font-family: var(--se-font-display); font-weight: 600; }
.se-sample-h1 { font-size: 20px; } .se-sample-h2 { font-size: 18px; } .se-sample-h3 { font-size: 16px; } .se-sample-h4 { font-size: 15px; }
.se-sample-pre { font-family: var(--se-font-mono); font-weight: 400; }
.se-sample-p { font-family: var(--se-font); font-weight: 400; }

.se-ctxbar { padding: 2px; z-index: 2; max-width: calc(100vw - 16px); }
.se-ctx-inner { display: flex; flex-wrap: wrap; }
.se-ctxbar .se-group { padding: 0 2px; }
.se-ctx-link { display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; height: 32px; color: var(--se-link); text-decoration: none; font-size: 13px; max-width: 280px; overflow: hidden; white-space: nowrap; }
.se-ctx-link .se-icon { width: 14px; height: 14px; }
.se-fig-outline { position: fixed; outline: 3px solid var(--se-focus); outline-offset: 2px; pointer-events: none; }

.se-form { display: grid; gap: 10px; }
.se-field { display: grid; gap: 4px; }
.se-field label { font-size: 12px; font-weight: 600; color: var(--se-muted); }
.se-popover input[type="text"], .se-popover input[type="search"], .se-findbar input[type="text"], .se-findbar input[type="search"] {
    width: 100%;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--se-border);
    border-radius: 0;
    background: var(--se-chrome);
    color: var(--se-text);
    font: 14px var(--se-font);
}
.se-popover input:focus, .se-findbar input:focus { outline: 2px solid var(--se-focus); outline-offset: -1px; }
.se-check { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.se-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.se-actions-split { justify-content: space-between; align-items: center; margin-top: 10px; }
.se-b {
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--se-border);
    background: var(--se-bg);
    color: var(--se-text);
    font: 600 13px var(--se-font-display);
    cursor: pointer;
}
.se-b:hover { background: var(--se-hover); }
.se-b-primary { background: var(--se-primary); border-color: var(--se-primary); color: var(--se-on-primary); }
.se-b-primary:hover { background: var(--se-primary); filter: brightness(1.12); }
.se-error { color: #d1242f; font-size: 13px; }

.se-tabs { display: flex; border-bottom: 1px solid var(--se-border); }
.se-tabs button { flex: 1; height: 34px; border: 0; background: none; color: var(--se-muted); font: 600 13px var(--se-font-display); cursor: pointer; }
.se-tabs button.is-on { color: var(--se-heading); box-shadow: inset 0 -3px 0 var(--se-accent); }
.se-drop {
    width: 100%;
    min-height: 110px;
    padding: 16px;
    border: 2px dashed var(--se-border);
    background: var(--se-chrome);
    color: var(--se-muted);
    font: 14px var(--se-font);
    cursor: pointer;
}
.se-drop:hover, .se-drop.is-over { border-color: var(--se-focus); color: var(--se-text); }

.se-colors { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.se-swatch-btn { aspect-ratio: 1; border: 1px solid var(--se-border); cursor: pointer; padding: 0; }
.se-swatch-btn:hover { outline: 2px solid var(--se-focus); outline-offset: 1px; }
.se-custom { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.se-custom input { width: 28px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer; }

.se-grid { display: grid; grid-template-columns: repeat(10, 18px); gap: 3px; }
.se-grid-cell { width: 18px; height: 18px; border: 1px solid var(--se-border); background: var(--se-chrome); padding: 0; cursor: pointer; }
.se-grid-cell.is-on { background: var(--se-accent); border-color: #d9a41a; }
.se-grid-label { margin-top: 8px; text-align: center; font: 600 13px var(--se-font-display); }

.se-findbar { display: grid; gap: 6px; padding: 8px; background: var(--se-chrome); border-bottom: 1px solid var(--se-border); }
.se-find-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.se-find-row input { flex: 1 1 160px; }
.se-find-count { font-size: 12px; color: var(--se-muted); min-width: 64px; }
::highlight(se-find) { background-color: rgba(255, 201, 61, 0.45); }
::highlight(se-find-current) { background-color: #ff6a3d; color: #fff; }

.se-toast {
    position: absolute;
    left: 50%;
    bottom: 40px;
    transform: translateX(-50%);
    padding: 10px 16px;
    background: var(--se-primary);
    color: var(--se-on-primary);
    font-size: 13px;
    box-shadow: var(--se-shadow);
    transition: opacity 0.3s;
    z-index: 5;
}
.se-toast.is-out { opacity: 0; }

/* ---------- Contenido (editor y publicación) ---------- */
.se-content {
    color: var(--se-text);
    font: 16px/1.7 var(--se-font);
    overflow-wrap: break-word;
    word-wrap: break-word;
    caret-color: var(--se-heading);
}
.se-content > :first-child { margin-top: 0; }
.se-content > :last-child { margin-bottom: 0; }
.se-content p { margin: 0 0 0.9em; }
.se-content h1, .se-content h2, .se-content h3, .se-content h4 {
    font-family: var(--se-font-display);
    color: var(--se-heading);
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin: 1.4em 0 0.5em;
}
.se-content h1 { font-size: 2.1em; }
.se-content h2 { font-size: 1.6em; }
.se-content h3 { font-size: 1.3em; }
.se-content h4 { font-size: 1.1em; }
.se-content a { color: var(--se-link); text-decoration: underline; text-underline-offset: 2px; }
.se-content code { font-family: var(--se-font-mono); font-size: 0.88em; background: var(--se-code-bg); padding: 0.12em 0.35em; }
.se-content mark { background: var(--se-mark); color: inherit; padding: 0 0.1em; }
.se-content pre {
    margin: 0 0 1em;
    padding: 14px 16px;
    background: var(--se-pre-bg);
    color: var(--se-pre-text);
    font: 14px/1.6 var(--se-font-mono);
    white-space: pre-wrap;
    tab-size: 2;
    overflow-x: auto;
    border-left: 4px solid var(--se-accent);
}
.se-content blockquote {
    margin: 0 0 1em;
    padding: 0.4em 0 0.4em 1.1em;
    border-left: 4px solid var(--se-quote);
    color: var(--se-muted);
}
.se-content blockquote > :last-child { margin-bottom: 0; }
.se-content ul, .se-content ol { margin: 0 0 1em; padding-left: 1.6em; }
.se-content li { margin: 0.2em 0; }
.se-content li > ul, .se-content li > ol { margin: 0.2em 0 0; }
.se-content ul[data-type="checklist"] { list-style: none; padding-left: 0.2em; }
.se-content ul[data-type="checklist"] ul[data-type="checklist"] { padding-left: 1.4em; }
.se-content li[data-checked] { position: relative; padding-left: 1.8em; }
.se-content li[data-checked]::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.3em;
    width: 1.1em;
    height: 1.1em;
    border: 2px solid var(--se-heading);
    background: var(--se-bg);
    cursor: pointer;
}
.se-content li[data-checked="true"]::before {
    background: var(--se-heading) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffc93d' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / 80% no-repeat;
}
.se-content li[data-checked="true"] { color: var(--se-muted); text-decoration: line-through; text-decoration-color: rgba(91, 107, 140, 0.6); }
.se-content li[data-checked="true"] li[data-checked="false"] { text-decoration: none; color: var(--se-text); }
.se-content hr { border: 0; border-top: 2px solid var(--se-border); margin: 1.6em 0; }
.se-content hr::after { content: ''; }
.se-content figure { margin: 1em 0 1.2em; }
.se-content figure img { max-width: 100%; height: auto; display: inline-block; vertical-align: top; }
.se-content img { max-width: 100%; height: auto; }
.se-content figcaption { margin-top: 0.4em; font-size: 0.88em; color: var(--se-muted); text-align: inherit; }
.se-content figure[data-type="embed"] iframe { width: 100%; max-width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; display: block; }
.se-content table { width: 100%; border-collapse: collapse; margin: 0 0 1.2em; table-layout: auto; display: table; }
.se-content th, .se-content td { border: 1px solid var(--se-border); padding: 6px 10px; vertical-align: top; min-width: 3em; }
.se-content th { background: var(--se-code-bg); font-weight: 600; text-align: left; color: var(--se-heading); }
.se-content sub, .se-content sup { font-size: 0.75em; }

/* solo en edición */
.se-body > .se-content figure { cursor: default; }
.se-body > .se-content figure::selection, .se-body > .se-content figure > img::selection { background: transparent; }
.se-body > .se-content figure[data-type="embed"] iframe { pointer-events: none; }
.se-body > .se-content figure img[data-se-pending] { opacity: 0.5; filter: grayscale(1); }
.se-body > .se-content figcaption { outline: none; min-height: 1.4em; border-bottom: 1px dashed transparent; }
.se-body > .se-content figcaption:focus { border-bottom-color: var(--se-border); }
.se-body > .se-content table { table-layout: fixed; }

/* contenido publicado: tablas con desplazamiento en móvil */
@media (max-width: 640px) {
    .se-toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
    .se-group { flex: none; }
    .se-body > .se-content { padding: 16px; }
    div.se-content table { display: block; overflow-x: auto; }
}

@media print {
    .se-toolbar, .se-status, .se-findbar, .se-layer { display: none !important; }
    .se { border: 0; }
}
