:root {
    --bg: #f5f5f5;
    --card-bg: #ffffff;
    --text: #2c2c2c;
    --accent: #3b6cb4;
    --border: #ccc;
    --danger: #c62828;
    --success: #2e7d32;
    --preview-bg: #f0f4f8;
    --disabled: #b0b0b0;
    --warn: #e67e22;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg); color: var(--text);
    padding: 1rem; display: flex; flex-direction: column; align-items: center;
}
.container {
    width: 100%; max-width: 1200px; display: flex; flex-wrap: wrap;
    gap: 1rem; margin: 1rem auto 0;
}
.panel {
    background: var(--card-bg); border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); padding: 1rem;
}
.list-panel {
    flex: 1 1 350px; max-height: 85vh; overflow: hidden;
    display: flex; flex-direction: column;
}
/* La cabecera no se desplaza; solo la lista de tarjetas */
.list-header { flex: 0 0 auto; }
.list-scroll { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.list-footer { flex: 0 0 auto; padding-top: 0.5rem; }
.edit-panel { flex: 2 1 500px; }

h1 { margin-bottom: 0.5rem; }
h2 {
    margin-bottom: 0.8rem; font-size: 1.3rem;
    border-bottom: 2px solid var(--accent); padding-bottom: 0.3rem;
}
button {
    background: var(--accent); color: white; border: none;
    padding: 0.4rem 0.8rem; border-radius: 6px; cursor: pointer;
    font-weight: 600; margin: 0.2rem; transition: 0.2s; font-size: 0.9rem;
}
button:hover:not(:disabled) { opacity: 0.9; }
button:disabled { background: var(--disabled); cursor: not-allowed; opacity: 0.7; }
button.danger { background: var(--danger); }
button.small { padding: 0.2rem 0.5rem; font-size: 0.8rem; }
button.secondary { background: #757575; }
button.active-toggle { background: var(--success); }
button.warn { background: var(--warn); }
input, textarea, select {
    width: 100%; padding: 0.4rem; margin: 0.2rem 0 0.5rem;
    border: 1px solid var(--border); border-radius: 6px;
    font-size: 0.9rem; font-family: inherit;
}
label {
    font-weight: 600; font-size: 0.9rem;
    display: flex; align-items: center; gap: 0.3rem;
}
.preview-toggle {
    background: none; border: none; cursor: pointer;
    font-size: 1.1rem; padding: 0; color: var(--accent);
}
.readonly-row { display: flex; gap: 1rem; margin-bottom: 0.5rem; }
.readonly-row div { flex: 1; }
.readonly-row input, input[readonly] {
    background-color: #f0f0f0; color: #666; margin: 0.2rem 0 0.3rem;
}

/* Formulario de tag: la clave no se toca, el título sí */
.tag-usage { font-size: 0.85rem; color: #666; margin-bottom: 0.8rem; }
.field-hint { font-size: 0.8rem; color: #777; line-height: 1.45; margin: 0 0 0.9rem; }
.field-hint code { background: #f2f4f7; padding: 0.05rem 0.25rem; border-radius: 3px; }
.card-item {
    padding: 0.2rem 0.3rem; border: 1px solid var(--border);
    border-radius: 4px; margin-bottom: 0.1rem; cursor: pointer;
    display: flex; align-items: center; gap: 0.3rem;
    font-size: 0.85rem; height: 2rem;
    border-left: 4px solid transparent;
}
.card-item input[type="checkbox"] {
    width: 1rem; height: 1rem; margin: 0; padding: 0; flex-shrink: 0;
}
.card-item span {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1;
}
.card-item:hover { background: #eef; }
.card-item.active { background: #dde; border-color: var(--accent); }

/* Indicadores de nivel por color de borde izquierdo */
.lv-color-1 { border-left-color: #a5d6a7; }
.lv-color-2 { border-left-color: #90caf9; }
.lv-color-3 { border-left-color: #ffcc80; }
.lv-color-4 { border-left-color: #ce93d8; }
.lv-color-5 { border-left-color: #80cbc4; }
.lv-color-6 { border-left-color: #ef9a9a; }
.lv-color-7 { border-left-color: #81d4fa; }
.lv-color-8 { border-left-color: #c5e1a5; }
.lv-color-9 { border-left-color: #b0bec5; }

.level-header {
    background: #eef; padding: 0.4rem; border-radius: 6px;
    margin-bottom: 0.3rem; display: flex; justify-content: space-between;
    align-items: center; cursor: pointer; font-weight: 600;
    flex-wrap: wrap; gap: 0.3rem;
}
.level-header-main {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex: 1;
    min-width: 0;
}
.level-header-main span {
    cursor: pointer;
    flex: 1;
    min-width: 0;
}
.level-edit-btn {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.1rem 0.3rem;
    margin: 0;
}
.level-edit-btn:hover {
    background: #dde;
    border-radius: 4px;
}
.level-editor {
    width: 100%;
    background: #f8f8f8;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem;
    margin-top: 0.3rem;
}
.level-editor-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.level-editor-row label {
    font-weight: 500;
    font-size: 0.8rem;
    margin: 0;
    white-space: nowrap;
}
.level-editor-row input {
    width: 70px;
    padding: 0.2rem 0.4rem;
    margin: 0;
    font-size: 0.85rem;
    text-align: center;
}
.level-editor-actions {
    display: flex;
    gap: 0.3rem;
    margin-top: 0.4rem;
}
.create-level-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.3rem;
    padding: 0.3rem;
    background: #f0f8f0;
    border-radius: 6px;
    border: 1px dashed #a5d6a7;
}
.create-level-row input {
    width: 70px;
    padding: 0.2rem 0.4rem;
    font-size: 0.85rem;
    text-align: center;
}
.create-level-row label {
    font-weight: 500;
    font-size: 0.8rem;
    margin: 0;
}

.level-actions { display: flex; gap: 0.3rem; align-items: center; }
.level-header-main span { cursor: pointer; user-select: none; }
.live-toggle { display: flex; align-items: center; gap: 0.3rem; font-size: 0.9rem; font-weight: 600; margin: 0.2rem; cursor: pointer; }
.live-toggle input { width: auto; margin: 0; }
.toolbar {
    display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center;
    margin-bottom: 0.8rem;
}
.tag-list { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.2rem 0 0.5rem; }
.tag-item {
    background: #e0e0e0; padding: 0.2rem 0.5rem; border-radius: 4px;
    display: flex; align-items: center; gap: 0.3rem; font-size: 0.85rem;
}
.tag-item button {
    background: none; border: none; color: #555;
    font-weight: bold; cursor: pointer;
}
.add-tag { display: flex; gap: 0.3rem; }
.add-tag input { flex: 1; margin: 0; }
.status { font-size: 0.85rem; color: #555; margin-top: 0.5rem; }
.dirty-indicator { color: var(--warn); font-weight: 600; margin-left: 0.5rem; }
.preview-box {
    background: #fafafa; border: 1px solid var(--border);
    border-radius: 6px; padding: 0.5rem; margin: 0.2rem 0 0.5rem;
    min-height: 2.5rem;
    line-height: 1.5;
}
/* Rótulo para que se vea que es una vista previa y que se puede volver a editar */
.preview-box { cursor: pointer; }

/* Salto de pagina: linea discreta en pantalla */
.preview-box .page-break, .preview-live .page-break {
    border-top: 1px dashed #c8cfd6;
    margin: 1.4em 0;
    height: 0;
}
.math-error {
    background: #fff3f3; border-left: 3px solid #cc0000; color: #8a1f1f;
    font-size: 0.8rem; padding: 0.3rem 0.5rem; margin-bottom: 0.3rem;
    border-radius: 0 4px 4px 0; word-break: break-word;
}
.preview-box::before {
    content: 'Vista previa · Ctrl+clic abre enlaces · clic para editar';
    display: block; font-size: 0.75rem; color: #888;
    margin-bottom: 0.2rem; font-style: italic;
}
.preview-live {
    background: var(--preview-bg); border: 1px dashed var(--accent);
    border-radius: 6px; padding: 0.5rem; margin: 0.2rem 0 0.5rem;
    min-height: 2rem; font-size: 0.9rem;
    line-height: 1.5;
}

/* ========== ESTILOS MARKDOWN UNIFICADOS (editor + app) ========== */

.preview-live p, .preview-box p {
    margin-bottom: 0.8rem;
}

.preview-live h1, .preview-box h1,
.preview-live h2, .preview-box h2,
.preview-live h3, .preview-box h3,
.preview-live h4, .preview-box h4,
.preview-live h5, .preview-box h5,
.preview-live h6, .preview-box h6 {
    margin-top: 1.2rem;
    margin-bottom: 0.6rem;
}

.preview-live ul, .preview-box ul,
.preview-live ol, .preview-box ol {
    padding-left: 1.5rem;
    margin-bottom: 0.8rem;
}

.preview-live li, .preview-box li {
    margin-bottom: 0.3rem;
}

.preview-live ul ul, .preview-box ul ul,
.preview-live ol ol, .preview-box ol ol,
.preview-live ul ol, .preview-box ul ol,
.preview-live ol ul, .preview-box ol ul {
    margin-top: 0.3rem;
    margin-bottom: 0.3rem;
}

.preview-live blockquote, .preview-box blockquote {
    border-left: 3px solid var(--accent);
    padding: 0.4rem 0.8rem;
    margin: 0.8rem 0;
    background: #f0f3f6;
    border-radius: 0 6px 6px 0;
}

.preview-live pre, .preview-box pre {
    background: #f0f3f6;
    padding: 0.8rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.8rem 0;
    font-size: 0.85rem;
}

.preview-live code, .preview-box code {
    background: #f0f3f6;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85rem;
}

.preview-live pre code, .preview-box pre code {
    background: none;
    padding: 0;
}

.preview-live img, .preview-box img {
    display: block;
    margin: 0.8rem auto;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

.preview-live table, .preview-box table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.8rem 0;
}

.preview-live th, .preview-box th,
.preview-live td, .preview-box td {
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
    text-align: left;
}

.preview-live th, .preview-box th {
    font-weight: 500;
    color: #555;
}

/* ========== FIN ESTILOS MARKDOWN ========== */

/* Fuente KaTeX en vistas previas */
.preview-live .katex,
.preview-box .katex {
    font-family: KaTeX_Main, KaTeX_Math, serif;
}

.batch-bar {
    display: flex; gap: 0.3rem; align-items: center;
    margin: 0.5rem 0; flex-wrap: wrap;
}
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4); display: flex; justify-content: center;
    align-items: center; z-index: 1000;
}
.modal-content {
    background: white; padding: 2rem; border-radius: 12px;
    max-width: 700px; text-align: center; max-height: 80vh;
    overflow-y: auto;
}
.hidden { display: none !important; }
.error-list { text-align: left; margin-top: 1rem; font-size: 0.9rem; color: var(--danger); }
.warning-list { text-align: left; margin-top: 1rem; font-size: 0.9rem; color: var(--warn); }
.undo-redo-btn { font-size: 1.2rem; padding: 0.3rem 0.6rem; }
.hash-info {
    margin-top: 0.5rem; font-size: 0.8rem; color: #555;
    word-break: break-all; font-family: monospace;
}
/* Pestañas */
.tabs {
    display: flex; gap: 0; margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
}
.tab {
    padding: 0.6rem 1.2rem; cursor: pointer;
    background: none; border: none; font-weight: 600;
    color: #777; font-size: 1rem;
    border-bottom: 3px solid transparent;
    transition: all 0.2s; margin: 0;
}
.tab:hover { color: var(--accent); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active {
    display: block;
    align-self: stretch;
}
/* Paneles anchos para Tags y Páginas */
.wide-container {
    display: flex; gap: 1rem; width: 100%; max-width: 1200px;
    margin-left: auto; margin-right: auto;
}
.narrow-list {
    width: 250px; flex-shrink: 0; max-height: 85vh; overflow-y: auto;
    background: var(--card-bg); border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); padding: 1rem;
}
.wide-edit {
    flex: 1; min-width: 0;
    background: var(--card-bg); border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); padding: 1rem;
}
/* Banner de error */
.error-banner {
    background: #ffebee; color: #b71c1c; padding: 0.8rem; border-radius: 8px;
    margin-bottom: 1rem; font-size: 0.85rem; white-space: pre-wrap; word-break: break-word;
    display: none;
}
/* Banner de éxito (éxito) */
.success-banner {
    background: #e8f5e9; color: #2e7d32; padding: 0.8rem; border-radius: 8px;
    margin-bottom: 1rem; font-size: 0.85rem; white-space: pre-wrap; word-break: break-word;
    display: none;
}

/* Barra de herramientas Markdown */
.markdown-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin-bottom: 0.3rem;
}
.markdown-toolbar button {
    background: #eef;
    color: #333;
    border: 1px solid #ccc;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    min-width: 2rem;
    text-align: center;
    transition: background 0.15s;
}
.markdown-toolbar button:hover {
    background: #dde;
}
.markdown-toolbar button:active {
    background: #ccd;
}
/* Panel de búsqueda */
.search-panel {
    display: none;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.3rem;
}
.search-panel.active {
    display: flex;
}
.search-panel .search-row {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.search-panel input {
    flex: 1;
    padding: 0.2rem 0.4rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    margin: 0;
}
.search-panel button {
    background: #eef;
    color: #333;
    border: 1px solid #ccc;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    min-width: 1.8rem;
    text-align: center;
}
.search-panel button:hover {
    background: #dde;
}
.search-panel input.error-flash {
    border-color: #c62828 !important;
    transition: border-color 0.15s;
}
.search-panel input.success-flash {
    border-color: #2e7d32 !important;
    transition: border-color 0.15s;
}
.search-counter {
    font-size: 0.8rem;
    color: #555;
    min-width: 2.5rem;
    text-align: center;
}

/* Feedback visual para inputs fuera del panel de búsqueda (tags, sinónimos) */
input.error-flash {
    border-color: #c62828 !important;
    transition: border-color 0.15s;
}
input.success-flash {
    border-color: #2e7d32 !important;
    transition: border-color 0.15s;
}

/* Píldoras de tags en vistas previas del editor */
.tag-pill {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    margin: 0.15rem 0.2rem;
}

/* ========== BUSCADOR GLOBAL INTEGRADO ========== */

.search-panel-global {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 1rem auto;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 1rem;
}

.search-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.8rem;
}
.search-header input {
    flex: 1;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    margin: 0;
}
.search-header button {
    padding: 0.5rem 0.9rem;
    margin: 0;
    white-space: nowrap;
}
.search-close-btn {
    background: none !important;
    color: #999 !important;
    border: none !important;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.3rem 0.5rem !important;
}
.search-close-btn:hover {
    color: #333 !important;
    opacity: 1 !important;
}

.search-results {
    max-height: 50vh;
    overflow-y: auto;
    padding: 0 0.3rem;
}

.search-summary {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.8rem;
}
.search-hint {
    text-align: center;
    color: #999;
    padding: 1rem 0;
}

.search-group {
    margin-bottom: 1rem;
}
.search-group h3 {
    font-size: 0.9rem;
    color: var(--accent);
    margin-bottom: 0.4rem;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid #eee;
}

.search-result-item {
    display: block;
    padding: 0.5rem 0.7rem;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 0.2rem;
    transition: background 0.15s;
    text-decoration: none !important;
    color: inherit;
}
.search-result-item:hover {
    background: #eef;
}

.search-result-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}
.search-result-subtitle {
    font-size: 0.85rem;
    color: #555;
    margin-top: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-result-subtitle strong {
    color: var(--accent);
    background: #e8f0fe;
    padding: 0 0.15rem;
    border-radius: 2px;
}
.search-result-matches {
    font-size: 0.75rem;
    color: #999;
    margin-top: 0.15rem;
}
/* Diagramas (Pele) */
.draw-modal { position: fixed; inset: 0; z-index: 1000; background: #fff; display: flex; flex-direction: column; }
.draw-modal.hidden { display: none; }
.draw-bar { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.7rem; border-bottom: 1px solid #e0e0e0; flex-wrap: wrap; }
.draw-bar #draw-name { width: 10rem; padding: 0.3rem 0.5rem; }
.draw-spacer { flex: 1; }
.draw-bar button { padding: 0.4rem 0.8rem; border: 1px solid #ccc; border-radius: 8px; background: #f7f7f7; color: #333; cursor: pointer; font-size: 0.85rem; }
.draw-bar button:hover { background: #ececec; }
.draw-bar label { font-size: 0.85rem; color: #555; }
.draw-canvas { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; background: #fff; }
.draw-canvas .imageEditorContainer { flex: 1 1 auto; height: auto; min-height: 0; width: 100%; --background-color-1: #fff; --background-color-2: #fff; }
.draw-error { padding: 1rem; color: #8a1f1f; }

.pele { margin: 0.8rem 0; overflow-x: auto; --pele-bg: #ffffff; --pele-fg: #2c2c2c;
        --pele-line: #2c2c2c; --pele-muted: #6f6e69; --pele-surface: #f2f0e5;
        --pele-surface-alt: #e6e4d9; --pele-border: #cecdc3; }
.pele svg { max-width: 100%; height: auto; }
.diagram-error-msg { font-size: 0.8rem; color: #8a1f1f; background: #fff3f3;
                     border-left: 3px solid #c62828; padding: 0.3rem 0.5rem; margin: 0.3rem 0; }

/* === Bloques de maquetación (libs/bloques.js) === */
/* El tono lo pone el tema (tinte-…); sin tema, el acento de la app. */
.bloque { --tono: var(--accent); --fondo: #fbfcfd; margin: 1.1rem 0; }
.bloque-titulo { font-weight: 700; font-size: 0.78rem; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--tono-titulo, var(--accent)); margin-bottom: 0.45rem; }
.bloque-cuerpo > :first-child { margin-top: 0; }
.bloque-cuerpo > :last-child { margin-bottom: 0; }

.bloque-card { border: 1.5px solid var(--border); border-left: 4px solid var(--tono);
    border-radius: var(--radius, 8px); padding: 0.9rem 1.1rem; background: var(--fondo); }

.bloque-cita { margin: 1.2rem 0; padding: 0.8rem 1.1rem; border-left: 4px solid var(--tono);
    background: var(--fondo); border-radius: 0 var(--radius, 8px) var(--radius, 8px) 0; }
.bloque-cita-autor { margin-top: 0.4rem; font-size: 0.85rem; color: #7a8a99; font-style: italic; }
.bloque-cita-autor::before { content: "— "; }

.bloque-pasos { list-style: none; counter-reset: paso; margin: 0; padding: 0; }
.bloque-pasos li { counter-increment: paso; position: relative; padding-left: 2.2rem;
    margin-bottom: 0.7rem; }
.bloque-pasos li:last-child { margin-bottom: 0; }
.bloque-pasos li::before { content: counter(paso); position: absolute; left: 0; top: 0;
    width: 1.55rem; height: 1.55rem; border-radius: 50%; background: var(--tono); color: #fff;
    font-size: 0.8rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.paso-titulo { font-weight: 600; }

.bloque-linea-items { list-style: none; margin: 0; padding: 0; }
.bloque-linea-items .hito { position: relative; padding: 0 0 1rem 1.6rem;
    border-left: 2px solid var(--border); }
.bloque-linea-items .hito:last-child { border-left-color: transparent; padding-bottom: 0; }
.hito::before { content: ""; position: absolute; left: -0.42rem; top: 0.35rem;
    width: 0.62rem; height: 0.62rem; border-radius: 50%; background: var(--tono); }
.hito-cuando { display: inline-block; font-size: 0.78rem; font-weight: 700; color: var(--tono-titulo, var(--accent));
    letter-spacing: 0.03em; }
.hito-titulo { font-weight: 600; }
.hito-texto { font-size: 0.92rem; color: #4a5a68; }

.bloque-cifras { display: flex; flex-wrap: wrap; gap: 0.7rem; }
.cifra { flex: 1 1 7rem; border: 1px solid var(--border); border-radius: var(--radius, 8px);
    padding: 0.7rem 0.9rem; background: var(--fondo); }
.cifra-valor { font-size: 1.5rem; font-weight: 700; color: var(--tono-titulo, var(--accent)); line-height: 1.1; }
.cifra-etiqueta { font-size: 0.8rem; color: #6b7c8a; margin-top: 0.15rem; }

.bloque-columnas { display: grid; gap: 1rem; }
/* El título es un hijo de la rejilla: sin esto se come una columna y el resto
   se descuadra. Ocupa toda la fila, sea cual sea el número de columnas. */
.bloque-columnas > .bloque-titulo { grid-column: 1 / -1; margin-bottom: 0; }
.columnas-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.columnas-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.columnas-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.columnas-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.columnas-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.bloque-columna { min-width: 0; }
@media (max-width: 640px) {
    .bloque-columnas { grid-template-columns: minmax(0, 1fr) !important; }
}

.bloque-datos { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
.bloque-datos th, .bloque-datos td { text-align: left; padding: 0.42rem 0.6rem;
    border-bottom: 1px solid #eef1f4; vertical-align: top; }
.bloque-datos th { font-weight: 600; color: #5a6b79; white-space: nowrap; width: 1%; }
.bloque-datos tr:last-child th, .bloque-datos tr:last-child td { border-bottom: none; }
/* Temas semánticos: tono de acento, fondo suave y un tono más oscuro para el
   texto, que es lo que se lee. */
.tinte-info { --tono: #2563eb; --fondo: #eff6ff; --tono-titulo: #1d4ed8; }
.tinte-tip { --tono: #0d9488; --fondo: #ecfdf5; --tono-titulo: #0f766e; }
.tinte-note { --tono: #4b5563; --fondo: #f3f4f6; --tono-titulo: #374151; }
.tinte-cite { --tono: #7c3aed; --fondo: #f5f3ff; --tono-titulo: #6d28d9; }
.tinte-success { --tono: #16a34a; --fondo: #f0fdf4; --tono-titulo: #15803d; }
.tinte-warning { --tono: #d97706; --fondo: #fffbeb; --tono-titulo: #b45309; }
.tinte-danger { --tono: #ea580c; --fondo: #fff7ed; --tono-titulo: #c2410c; }
.tinte-question { --tono: #0284c7; --fondo: #f0f9ff; --tono-titulo: #0369a1; }
.tinte-example { --tono: #0891b2; --fondo: #ecfeff; --tono-titulo: #0e7490; }
.tinte-error { --tono: #dc2626; --fondo: #fef2f2; --tono-titulo: #b91c1c; }
.tinte-task { --tono: #475569; --fondo: #f8fafc; --tono-titulo: #334155; }
.tinte-practice { --tono: #059669; --fondo: #ecfdf5; --tono-titulo: #047857; }


/* Tintes de color: el tono para los acentos y un fondo muy suave.
   Se generan a partir de los nombres de js/colores.js. */
.tinte-aliceblue { --tono: AliceBlue; --fondo: #fdfeff; }
.tinte-antiquewhite { --tono: AntiqueWhite; --fondo: #fefdfa; }
.tinte-aqua { --tono: Aqua; --fondo: #e0ffff; }
.tinte-aquamarine { --tono: Aquamarine; --fondo: #f0fffa; }
.tinte-azure { --tono: Azure; --fondo: #fdffff; }
.tinte-beige { --tono: Beige; --fondo: #fefefb; }
.tinte-bisque { --tono: Bisque; --fondo: #fffcf8; }
.tinte-black { --tono: Black; --fondo: #e0e0e0; }
.tinte-blanchedalmond { --tono: BlanchedAlmond; --fondo: #fffdf9; }
.tinte-blue { --tono: Blue; --fondo: #e0e0ff; }
.tinte-blueviolet { --tono: BlueViolet; --fondo: #f1e6fc; }
.tinte-brown { --tono: Brown; --fondo: #f4e5e5; }
.tinte-burlywood { --tono: BurlyWood; --fondo: #fbf6f1; }
.tinte-cadetblue { --tono: CadetBlue; --fondo: #ecf3f4; }
.tinte-chartreuse { --tono: Chartreuse; --fondo: #f0ffe0; }
.tinte-chocolate { --tono: Chocolate; --fondo: #faede4; }
.tinte-coral { --tono: Coral; --fondo: #fff0ea; }
.tinte-cornflowerblue { --tono: CornflowerBlue; --fondo: #ecf2fd; }
.tinte-cornsilk { --tono: Cornsilk; --fondo: #fffefb; }
.tinte-crimson { --tono: Crimson; --fondo: #fbe3e8; }
.tinte-cyan { --tono: Cyan; --fondo: #e0ffff; }
.tinte-darkblue { --tono: DarkBlue; --fondo: #e0e0f1; }
.tinte-darkcyan { --tono: DarkCyan; --fondo: #e0f1f1; }
.tinte-darkgoldenrod { --tono: DarkGoldenrod; --fondo: #f6f0e2; }
.tinte-darkgray { --tono: DarkGray; --fondo: #f5f5f5; }
.tinte-darkgreen { --tono: DarkGreen; --fondo: #e0ece0; }
.tinte-darkkhaki { --tono: DarkKhaki; --fondo: #f7f6ed; }
.tinte-darkmagenta { --tono: DarkMagenta; --fondo: #f1e0f1; }
.tinte-darkolivegreen { --tono: DarkOliveGreen; --fondo: #ebede6; }
.tinte-darkorange { --tono: DarkOrange; --fondo: #fff1e0; }
.tinte-darkorchid { --tono: DarkOrchid; --fondo: #f3e6f9; }
.tinte-darkred { --tono: DarkRed; --fondo: #f1e0e0; }
.tinte-darksalmon { --tono: DarkSalmon; --fondo: #fcf2ef; }
.tinte-darkseagreen { --tono: DarkSeaGreen; --fondo: #f2f7f2; }
.tinte-darkslateblue { --tono: DarkSlateBlue; --fondo: #e9e8f1; }
.tinte-darkslategray { --tono: DarkSlateGray; --fondo: #e6eaea; }
.tinte-darkturquoise { --tono: DarkTurquoise; --fondo: #e0f9f9; }
.tinte-darkviolet { --tono: DarkViolet; --fondo: #f2e0fa; }
.tinte-deeppink { --tono: DeepPink; --fondo: #ffe3f2; }
.tinte-deepskyblue { --tono: DeepSkyBlue; --fondo: #e0f7ff; }
.tinte-dimgray { --tono: DimGray; --fondo: #ededed; }
.tinte-dodgerblue { --tono: DodgerBlue; --fondo: #e4f2ff; }
.tinte-firebrick { --tono: FireBrick; --fondo: #f6e4e4; }
.tinte-floralwhite { --tono: FloralWhite; --fondo: #fffefd; }
.tinte-forestgreen { --tono: ForestGreen; --fondo: #e4f1e4; }
.tinte-fuchsia { --tono: Fuchsia; --fondo: #ffe0ff; }
.tinte-gainsboro { --tono: Gainsboro; --fondo: #fbfbfb; }
.tinte-ghostwhite { --tono: GhostWhite; --fondo: #fefeff; }
.tinte-gold { --tono: Gold; --fondo: #fffae0; }
.tinte-goldenrod { --tono: Goldenrod; --fondo: #fbf4e4; }
.tinte-gray { --tono: Gray; --fondo: #f0f0f0; }
.tinte-green { --tono: Green; --fondo: #e0f0e0; }
.tinte-greenyellow { --tono: GreenYellow; --fondo: #f5ffe6; }
.tinte-honeydew { --tono: Honeydew; --fondo: #fdfffd; }
.tinte-hotpink { --tono: HotPink; --fondo: #ffedf6; }
.tinte-indianred { --tono: IndianRed; --fondo: #f9ebeb; }
.tinte-indigo { --tono: Indigo; --fondo: #e9e0f0; }
.tinte-ivory { --tono: Ivory; --fondo: #fffffd; }
.tinte-khaki { --tono: Khaki; --fondo: #fdfcf1; }
.tinte-lavender { --tono: Lavender; --fondo: #fcfcfe; }
.tinte-lavenderblush { --tono: LavenderBlush; --fondo: #fffdfe; }
.tinte-lawngreen { --tono: LawnGreen; --fondo: #efffe0; }
.tinte-lemonchiffon { --tono: LemonChiffon; --fondo: #fffef9; }
.tinte-lightblue { --tono: LightBlue; --fondo: #f5fafc; }
.tinte-lightcoral { --tono: LightCoral; --fondo: #fdf0f0; }
.tinte-lightcyan { --tono: LightCyan; --fondo: #fbffff; }
.tinte-lightgoldenrodyellow { --tono: LightGoldenrodYellow; --fondo: #fefefa; }
.tinte-lightgray { --tono: LightGray; --fondo: #fafafa; }
.tinte-lightgreen { --tono: LightGreen; --fondo: #f2fdf2; }
.tinte-lightpink { --tono: LightPink; --fondo: #fff6f8; }
.tinte-lightsalmon { --tono: LightSalmon; --fondo: #fff4ef; }
.tinte-lightseagreen { --tono: LightSeaGreen; --fondo: #e4f6f5; }
.tinte-lightskyblue { --tono: LightSkyBlue; --fondo: #f1f9fe; }
.tinte-lightslategray { --tono: LightSlateGray; --fondo: #eff1f3; }
.tinte-lightsteelblue { --tono: LightSteelBlue; --fondo: #f6f8fb; }
.tinte-lightyellow { --tono: LightYellow; --fondo: #fffffb; }
.tinte-lime { --tono: Lime; --fondo: #e0ffe0; }
.tinte-limegreen { --tono: LimeGreen; --fondo: #e6f9e6; }
.tinte-linen { --tono: Linen; --fondo: #fefdfc; }
.tinte-magenta { --tono: Magenta; --fondo: #ffe0ff; }
.tinte-maroon { --tono: Maroon; --fondo: #f0e0e0; }
.tinte-mediumaquamarine { --tono: MediumAquamarine; --fondo: #edf9f5; }
.tinte-mediumblue { --tono: MediumBlue; --fondo: #e0e0f9; }
.tinte-mediumorchid { --tono: MediumOrchid; --fondo: #f7ebfa; }
.tinte-mediumpurple { --tono: MediumPurple; --fondo: #f2eefb; }
.tinte-mediumseagreen { --tono: MediumSeaGreen; --fondo: #e8f6ee; }
.tinte-mediumslateblue { --tono: MediumSlateBlue; --fondo: #efedfd; }
.tinte-mediumspringgreen { --tono: MediumSpringGreen; --fondo: #e0fef3; }
.tinte-mediumturquoise { --tono: MediumTurquoise; --fondo: #e9f9f9; }
.tinte-mediumvioletred { --tono: MediumVioletRed; --fondo: #f8e3f0; }
.tinte-midnightblue { --tono: MidnightBlue; --fondo: #e3e3ee; }
.tinte-mintcream { --tono: MintCream; --fondo: #fefffe; }
.tinte-mistyrose { --tono: MistyRose; --fondo: #fffcfb; }
.tinte-moccasin { --tono: Moccasin; --fondo: #fffcf6; }
.tinte-navajowhite { --tono: NavajoWhite; --fondo: #fffbf5; }
.tinte-navy { --tono: Navy; --fondo: #e0e0f0; }
.tinte-oldlace { --tono: OldLace; --fondo: #fffefc; }
.tinte-olive { --tono: Olive; --fondo: #f0f0e0; }
.tinte-olivedrab { --tono: OliveDrab; --fondo: #edf1e5; }
.tinte-orange { --tono: Orange; --fondo: #fff4e0; }
.tinte-orangered { --tono: OrangeRed; --fondo: #ffe9e0; }
.tinte-orchid { --tono: Orchid; --fondo: #fbeefa; }
.tinte-palegoldenrod { --tono: PaleGoldenrod; --fondo: #fdfcf5; }
.tinte-palegreen { --tono: PaleGreen; --fondo: #f3fff3; }
.tinte-paleturquoise { --tono: PaleTurquoise; --fondo: #f5fdfd; }
.tinte-palevioletred { --tono: PaleVioletRed; --fondo: #fbeef2; }
.tinte-papayawhip { --tono: PapayaWhip; --fondo: #fffdfa; }
.tinte-peachpuff { --tono: PeachPuff; --fondo: #fffbf7; }
.tinte-peru { --tono: Peru; --fondo: #f9f0e8; }
.tinte-pink { --tono: Pink; --fondo: #fff7f9; }
.tinte-plum { --tono: Plum; --fondo: #fbf4fb; }
.tinte-powderblue { --tono: PowderBlue; --fondo: #f6fbfc; }
.tinte-purple { --tono: Purple; --fondo: #f0e0f0; }
.tinte-rebeccapurple { --tono: RebeccaPurple; --fondo: #ede7f3; }
.tinte-red { --tono: Red; --fondo: #ffe0e0; }
.tinte-rosybrown { --tono: RosyBrown; --fondo: #f7f2f2; }
.tinte-royalblue { --tono: RoyalBlue; --fondo: #e8edfb; }
.tinte-saddlebrown { --tono: SaddleBrown; --fondo: #f1e9e3; }
.tinte-salmon { --tono: Salmon; --fondo: #fef0ee; }
.tinte-sandybrown { --tono: SandyBrown; --fondo: #fef4ec; }
.tinte-seagreen { --tono: SeaGreen; --fondo: #e6f1eb; }
.tinte-seashell { --tono: Seashell; --fondo: #fffefd; }
.tinte-sienna { --tono: Sienna; --fondo: #f4eae6; }
.tinte-silver { --tono: Silver; --fondo: #f7f7f7; }
.tinte-skyblue { --tono: SkyBlue; --fondo: #f1f9fd; }
.tinte-slateblue { --tono: SlateBlue; --fondo: #edebf9; }
.tinte-slategray { --tono: SlateGray; --fondo: #eef0f2; }
.tinte-snow { --tono: Snow; --fondo: #fffefe; }
.tinte-springgreen { --tono: SpringGreen; --fondo: #e0fff0; }
.tinte-steelblue { --tono: SteelBlue; --fondo: #e9f0f6; }
.tinte-tan { --tono: Tan; --fondo: #faf6f1; }
.tinte-teal { --tono: Teal; --fondo: #e0f0f0; }
.tinte-thistle { --tono: Thistle; --fondo: #faf7fa; }
.tinte-tomato { --tono: Tomato; --fondo: #ffece9; }
.tinte-turquoise { --tono: Turquoise; --fondo: #e8fbf9; }
.tinte-violet { --tono: Violet; --fondo: #fdf0fd; }
.tinte-wheat { --tono: Wheat; --fondo: #fefbf6; }
.tinte-white { --tono: White; --fondo: #ffffff; }
.tinte-whitesmoke { --tono: WhiteSmoke; --fondo: #fefefe; }
.tinte-yellow { --tono: Yellow; --fondo: #ffffe0; }
.tinte-yellowgreen { --tono: YellowGreen; --fondo: #f3f9e6; }
