/*
 * Orliv
 * Autor: jose javier esquivel gloria
 * Desarrollo: goglo agency
 *
 * Capa de aplicacion sobre Minia (Bootstrap 5.3), layout horizontal.
 *
 * Regla de oro: Minia dimensiona todo en rem sobre un root de 16px y se
 * configura por tokens --bs-*. Esta hoja carga despues de app.min.css, asi
 * que cualquier selector de elemento desnudo (input, label, table, a) pisa
 * a Bootstrap. Por eso los selectores de elemento excluyen explicitamente
 * las clases .form-control / .form-label / .table, y el tema se aplica
 * seteando tokens en vez de sobrescribir componentes.
 */

@font-face {
    font-family: "InterVariable";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/InterVariable.woff2") format("woff2");
}

:root {
    --bg: #F7F9FC;
    --surface: #ffffff;
    --surface-2: #EEF2F7;
    --ink: #0F172A;
    --muted: #667085;
    --line: #DDE3EE;
    --navy: #05265F;
    --slate: #667085;
    --coral: #05265F;
    --blue: #1557FF;
    --paper: #F7F9FC;
    --accent: #1557FF;
    --accent-quiet: #EAF0FF;
    --success: #15803D;
    --danger: #D92D20;
    --warning: #D97706;
    --info: #0284C7;
    --orliv-dark: #031A42;
    --orliv-hover: #0B45D9;
    --orliv-active: #0838B8;
    --orliv-ultralight: #F4F7FF;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px rgba(15, 23, 42, .06);
    --radius: .625rem;
    --radius-lg: 1rem;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);

    /* Tema Orliv aplicado sobre los tokens de Bootstrap: sin esto habria que
       pelear cada componente con overrides. */
    --bs-font-sans-serif: "InterVariable", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --bs-body-font-family: var(--bs-font-sans-serif);
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--bg);
    --bs-border-color: var(--line);
    --bs-border-radius: var(--radius);
    --bs-link-color: var(--blue);
    --bs-link-hover-color: var(--orliv-hover);
}

button, input, select, textarea { font-family: inherit; }

/* Los enlaces de navegacion de Minia no se subrayan; solo los de contenido. */
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:where(.btn, .nav-link, .dropdown-item, .logo, .header-item, .action-btn, .copy-link, .footer-powered, .subnav a, .card-actions a, .resource-card a):hover {
    text-decoration: none;
}

/* ==========================================================================
   Formularios
   Convencion propia: <label>Texto <input></label>. Se excluyen las clases de
   Bootstrap para no romper .form-control ni los checkboxes de Minia.
   ========================================================================== */

/* Los labels con checkbox (.check) y las tarjetas de opción (.style-choice)
   se excluyen: el grid genérico rompía su maquetación propia (flex). */
label:not(.form-label):not(.form-check-label):not(.btn):not(.form-check):not(.check):not(.style-choice) {
    display: grid;
    gap: 6px;
    color: #344054;
    font-weight: 600;
    margin-bottom: 14px;
    font-size: .8125rem;
}

input:not([type="checkbox"]):not([type="radio"]):not(.form-control):not(.form-select):not(.form-check-input),
select:not(.form-select):not(.form-control),
textarea:not(.form-control) {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 9px 10px;
    min-height: 38px;
    color: var(--ink);
    background: #fff;
    font-size: .8125rem;
}

textarea:not(.form-control) { min-height: 82px; resize: vertical; }

input:not(.form-control):not(.form-check-input):focus,
select:not(.form-select):not(.form-control):focus,
textarea:not(.form-control):focus {
    outline: 3px solid rgba(21, 87, 255, .14);
    border-color: var(--blue);
}

.password-field { position: relative; display: block; }
.password-field input { padding-right: 42px; }
.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    min-height: 30px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    display: inline-grid;
    place-items: center;
    background: transparent;
    color: var(--slate);
    cursor: pointer;
}
.password-toggle:hover { background: var(--surface-2); }

.check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #344054;
    font-size: .8125rem;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.45;
    cursor: pointer;
}
.check input {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    min-height: auto;
    margin: 2px 0 0;
    accent-color: var(--blue);
    cursor: pointer;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 24px;
    align-items: start;
}
.permission-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 8px 0 16px;
}

.advanced-block {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    margin-top: 14px;
    overflow: hidden;
}
.advanced-block summary {
    cursor: pointer;
    padding: 12px 13px;
    color: #344054;
    font-size: .75rem;
    font-weight: 700;
    list-style-position: inside;
}
.advanced-block[open] summary {
    border-bottom: 1px solid var(--line);
    background: #fbfcfe;
}
.advanced-block > *:not(summary) { margin: 14px; }
.onelink-fields.is-disabled { opacity: .45; }

/* ==========================================================================
   Botones
   Geometria unica: hace que `btn primary` (custom) y `btn btn-primary`
   (Bootstrap) rendericen identico.

   OJO: los --bs-btn-* van declarados sobre .btn, no sobre body. Bootstrap
   5.3 redeclara estos tokens dentro de la propia regla .btn, y esa
   declaracion local gana sobre cualquier valor heredado. Setearlos en body
   no tiene ningun efecto.
   ========================================================================== */

.btn {
    --bs-btn-padding-x: .875rem;
    --bs-btn-padding-y: .5rem;
    --bs-btn-font-size: .8125rem;
    --bs-btn-font-weight: 600;
    --bs-btn-border-radius: var(--radius);

    /* Bootstrap deja .btn como inline-block, asi que icono y texto quedaban
       desalineados por baseline y la altura variaba entre paginas. Flex en
       linea + altura minima uniforme (excepto .btn-sm) los empareja en
       toolbars, formularios y cards de todo el proyecto. */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

.btn:not(.btn-sm) {
    min-height: 38px;
}

/* .primary es la variante propia; .btn-primary es la de Bootstrap. Ambas se
   tematizan juntas: Bootstrap 5.3 hardcodea --bs-btn-bg en .btn-primary y NO
   lo deriva de --bs-primary, asi que sin esto el boton "Crear nuevo" del
   topbar salia con el morado nativo de Minia mientras el resto era azul. */
.btn.primary,
.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--blue);
    --bs-btn-border-color: var(--blue);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--orliv-hover);
    --bs-btn-hover-border-color: var(--orliv-hover);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--orliv-active);
    --bs-btn-active-border-color: var(--orliv-active);
}

.btn.secondary {
    --bs-btn-color: var(--orliv-dark);
    --bs-btn-bg: var(--surface-2);
    --bs-btn-border-color: var(--line);
    --bs-btn-hover-color: var(--orliv-dark);
    --bs-btn-hover-bg: #E4EAF2;
    --bs-btn-hover-border-color: var(--line);
    --bs-btn-active-color: var(--orliv-dark);
    --bs-btn-active-bg: #DBE2EC;
    --bs-btn-active-border-color: var(--line);
}

.full { width: 100%; }
.btn + .btn,
.btn + button,
button + .btn,
.copy-action + .btn,
.btn + .copy-action,
.full + .full {
    margin-top: 10px;
}
.toolbar-panel .btn + .btn,
.toolbar-panel .btn + button,
.toolbar-panel button + .btn,
.card-actions .btn + .btn,
.card-actions button + .btn,
.card-actions .btn + button,
.actions .btn + .btn,
.actions button + .btn,
.actions .btn + button,
.share-row .btn + .btn,
.share-row button + .btn,
.share-row .btn + button,
.download-row .btn + .btn {
    margin-top: 0;
}

/* ==========================================================================
   Superficies: .panel es la tarjeta propia (34 usos), convive con .card de
   Minia. Se alinean visualmente para que no se noten como dos sistemas.
   ========================================================================== */

.auth-card,
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.panel { padding: 22px; margin-bottom: 20px; }
.panel h2 { color: var(--navy); font-size: .9375rem; font-weight: 700; }
.panel h3 { font-size: .8125rem; font-weight: 700; margin: 14px 0 9px; }
.auth-card h1,
.panel h2,
.panel h3 { margin: 0; letter-spacing: 0; }
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: 18px;
}
.panel-head p {
    margin: 4px 0 0;
    color: var(--muted);
    overflow-wrap: anywhere;
}
.compact-panel { padding: 12px; }
.narrow { max-width: 680px; }

.orliv-minia .card {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

/* Login / setup: viven fuera de #layout-wrapper, sin chrome de Minia. */
.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(21, 87, 255, .10), transparent 32%),
        var(--bg);
}
.auth-card {
    width: min(420px, 100%);
    padding: 30px;
    display: grid;
    gap: 14px;
}
.auth-logo {
    display: block;
    width: 118px;
    max-height: 42px;
    object-fit: contain;
    margin-bottom: 4px;
}
.auth-card h1 { font-size: 1.75rem; color: var(--orliv-dark); }
.auth-brand-logo { display:block; width:min(220px,72%); height:auto; margin:0 0 1.2rem; }
.auth-card p {
    color: var(--muted);
    margin: 0;
    line-height: 1.45;
}

.subnav {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    margin: 0 0 18px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 12px;
    width: max-content;
    max-width: 100%;
}
.subnav a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    padding: 7px 10px;
    border-radius: 7px;
    color: var(--slate);
    font-size: .75rem;
    font-weight: 700;
}
.subnav a.active,
.subnav a:hover {
    background: #fff;
    color: var(--navy);
    box-shadow: 0 1px 2px rgba(45, 60, 84, .05);
}

/* ==========================================================================
   Dashboard
   ========================================================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-4);
    margin-bottom: 20px;
}
.stats-grid article {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px;
    box-shadow: var(--shadow);
}
.stats-grid span {
    color: var(--muted);
    font-size: .75rem;
    font-weight: 600;
}
.stats-grid strong {
    display: block;
    font-size: 1.625rem;
    line-height: 1;
    margin-top: 8px;
    font-weight: 700;
}

.muted {
    display: block;
    color: var(--muted);
    font-size: .6875rem;
    margin-top: 2px;
}

/* ==========================================================================
   Listados de recursos (links / QR)
   ========================================================================== */

.toolbar-panel {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    margin-bottom: 18px;
}
.toolbar-left,
.toolbar-right {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.filter-input {
    width: 280px;
    margin: 0;
    position: relative;
}
.filter-input .fa-solid,
.filter-input .fa-regular {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--navy);
}
.filter-input input {
    padding-left: 34px;
    background: #f6f7fb;
    border-color: transparent;
}
.status-select {
    width: auto;
    min-width: 168px;
    background: #fff;
}

/* La separacion entre tarjetas la pone solo este gap. */
.resource-list { display: grid; gap: 12px; }
.resource-card {
    display: grid;
    grid-template-columns: 18px 36px minmax(0, 1fr) auto;
    gap: 18px;
    align-items: start;
    background: #fff;
    border: 1px solid #edf0f6;
    border-radius: var(--radius-lg);
    padding: 22px 24px;
}
.resource-card:hover { border-color: #d8deea; }
.row-check input { min-height: auto; }
.resource-icon {
    width: 32px;
    height: 32px;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: var(--blue);
    background: #f8fafc;
}
.resource-body h2 {
    margin: 0 0 8px;
    font-size: 1rem;
    color: var(--navy);
}
.shortline { color: var(--blue); font-weight: 700; gap: 6px; }
.destination {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 10px 0;
    color: var(--navy);
    font-size: .8125rem;
    overflow-wrap: anywhere;
}
.meta-row {
    display: flex;
    align-items: center;
    gap: 16px 22px;
    flex-wrap: wrap;
    color: var(--navy);
    font-size: .75rem;
}
.meta-row span,
.inline-copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.card-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--navy);
    padding-left: 10px;
}
.card-actions a,
.card-actions button {
    color: var(--navy);
    background: #fff;
    border: 1px solid transparent;
    border-radius: 8px;
    width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    flex: 0 0 34px;
    cursor: pointer;
}
.card-actions a:hover,
.card-actions button:hover {
    background: var(--surface-2);
    border-color: var(--line);
}
.card-actions form { margin: 0; }

.qr-card-row { grid-template-columns: 130px minmax(0, 1fr) auto; }
.qr-thumb {
    width: 116px;
    height: 116px;
    display: grid;
    place-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.qr-thumb svg,
.qr-thumb canvas {
    width: 100%;
    height: 100%;
    display: block;
}
.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--navy);
    font-size: .6875rem;
    font-weight: 700;
    margin-bottom: 8px;
}

/* ==========================================================================
   Avisos y badges
   .badge existe en Bootstrap; las variantes propias solo ajustan color y se
   apoyan en la geometria de Minia.
   ========================================================================== */

.notice {
    padding: 10px 12px;
    border-radius: 7px;
    margin-bottom: 18px;
    font-size: .75rem;
    font-weight: 600;
}
.notice.success { background: #ECFDF3; color: var(--success); }
.notice.error { background: #FEF3F2; color: var(--danger); }
.notice.info { background: #EAF0FF; color: var(--info); }

.badge.active { background: #ecfdf3; color: var(--success); }
.badge.paused { background: #fffaeb; color: var(--warning); }

/* ==========================================================================
   Tablas
   Minia trae .table; las tablas propias (sin clase) llevan su propio estilo.
   El min-width solo aplica a las propias: forzarlo sobre .table provocaba
   scroll horizontal aun en tablas angostas.
   ========================================================================== */

.table-wrap { overflow-x: auto; }
table:not(.table) {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}
table:not(.table) th,
table:not(.table) td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
table:not(.table) th {
    color: var(--muted);
    font-size: .625rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 700;
}
table:not(.table) td { font-size: .75rem; }
table:not(.table) td strong { font-size: .8125rem; }
td small {
    display: block;
    color: var(--muted);
    margin-top: 4px;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.icon-actions { gap: 8px; }
.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 8px 11px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--slate);
    font-size: .6875rem;
    font-weight: 700;
    cursor: pointer;
}
.action-btn:hover { background: var(--surface-2); }
.action-btn.danger { color: var(--danger); }
.actions form { margin: 0; }

.copy-link {
    background: transparent;
    border: 0;
    color: var(--blue);
    padding: 0;
    min-height: auto;
    overflow-wrap: anywhere;
    text-align: left;
    cursor: pointer;
}
.btn.copy-action,
.copy-action.btn { display: inline-flex; }
button.copy-action:not(.btn) {
    min-height: 36px;
    padding: 8px 12px;
    border: 0;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: var(--surface-2);
    color: var(--navy);
    font-size: .75rem;
    font-weight: 700;
    cursor: pointer;
}

/* ==========================================================================
   QR y compartir
   ========================================================================== */

.chart { width: 100%; max-height: 250px; }

.qr-preview {
    display: grid;
    place-items: center;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
    margin: 16px 0 12px;
    min-height: 260px;
    aspect-ratio: 1;
}
.qr-preview canvas,
.qr-preview svg {
    width: 100%;
    max-width: 220px;
    height: auto;
    border-radius: 6px;
    display: block;
}
.share-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 12px 0;
}
.download-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 12px 0;
}
.download-row .btn { width: 100%; margin-top: 0; }
.download-row .qr-download-all { grid-column: 1 / -1; min-height: 44px; white-space: nowrap; }
.share-row a,
.share-row button {
    background: var(--surface-2);
    color: var(--navy);
    border: 0;
    min-height: 40px;
    border-radius: 7px;
    padding: 9px;
    text-align: center;
    justify-content: center;
    display: inline-flex;
    align-items: center;
    font-size: .75rem;
    font-weight: 700;
    cursor: pointer;
}
.share-row a:hover,
.share-row button:hover { background: #e8edf5; }

/* ==========================================================================
   Analitica
   ========================================================================== */

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
}
.analytics-grid .panel { margin-bottom: 0; }
.metric-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border-top: 1px solid var(--line);
    padding: 11px 0;
    font-size: .75rem;
}
.metric-row:first-of-type { margin-top: 9px; }
.metric-row span {
    color: var(--muted);
    overflow-wrap: anywhere;
    min-width: 0;
}
.metric-row strong { white-space: nowrap; }

.period-filter {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) repeat(2, minmax(130px, .8fr)) auto minmax(130px, .9fr);
    align-items: end;
    gap: 14px;
}
.period-filter label { margin-bottom: 0; }
.period-filter .muted { align-self: center; margin-top: 0; }

/* ==========================================================================
   Configuracion
   ========================================================================== */

.settings-layout {
    display: grid;
    gap: 18px;
    max-width: 980px;
}
.settings-layout .panel { margin-bottom: 0; }
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.color-control {
    grid-template-columns: minmax(0, 1fr) 44px 94px;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
}
.color-control span { min-width: 0; }
.color-control strong {
    display: block;
    color: var(--navy);
    font-size: .75rem;
}
.color-control small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: .6875rem;
    line-height: 1.3;
}
.color-control input[type="color"] {
    width: 44px;
    min-height: 34px;
    height: 34px;
    padding: 3px;
    border-radius: 8px;
    background: #fff;
}
.color-code {
    min-height: 34px;
    padding: 7px 8px;
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
    background: #fff;
}
.settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ==========================================================================
   Pie
   ========================================================================== */

.footer-powered {
    display: inline-flex;
    align-items: center;
    color: var(--muted);
    font-size: .6875rem;
    opacity: .75;
    transition: opacity .15s ease;
}
.footer-powered:hover { opacity: 1; }
.footer-powered img {
    display: block;
    width: 92px;
    max-height: 22px;
    background: none;
    border: 0;
    padding: 0;
}
.auth-powered {
    margin-top: 4px;
    padding-top: 13px;
    border-top: 1px solid var(--line);
    color: var(--muted);
}
.auth-powered img {
    width: 98px;
    max-height: 28px;
    background: none;
}

.toolbar-copy { margin: 0; color: var(--slate); font-size: .875rem; }
.one-page-list { margin-top: 18px; }
.one-page-card { grid-template-columns: 42px minmax(0, 1fr) auto; }
.empty-state { padding: 42px 24px; text-align: center; color: var(--slate); }
.empty-state > i { color: var(--blue); font-size: 28px; }
.empty-state h2 { margin: 12px 0 5px; color: var(--navy); font-size: 18px; }
.empty-state p { margin: 0; }
.panel-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; margin-bottom:16px; }
.panel-heading h2 { margin-bottom:4px; }
.panel-heading .muted { margin:0; }
.one-link-items { display:grid; gap:10px; }
.one-link-item-row { display:grid; grid-template-columns:150px minmax(0,1fr) minmax(0,1.45fr) auto; gap:8px; align-items:center; padding:10px; border:1px solid var(--line); border-radius:8px; background:var(--bg); }
.one-link-item-row select,
.one-link-item-row input { min-width:0; width:100%; margin:0; }
.icon-only { display:inline-grid; place-items:center; width:38px; height:38px; padding:0; border:1px solid var(--line); border-radius:6px; background:#fff; cursor:pointer; }
.icon-only.danger { color:#d92d20; }
.public-url-row { display:flex; align-items:center; justify-content:space-between; gap:10px; margin:18px 0; padding-top:15px; border-top:1px solid var(--line); color:var(--slate); font-size:12px; }
.public-url-row .copy-link { max-width:75%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.page-color-grid input[type="color"] { width:100%; height:42px; padding:4px; }

/* ==========================================================================
   Suscripciones (/suscribirme): pagina publica de planes + checkout simulado.
   Vive fuera del layout de Minia (como login), asi que trae su propio marco.
   ========================================================================== */

.sub-page {
    min-height: 100vh;
    padding: 0 24px 40px;
    background:
        radial-gradient(circle at top right, rgba(21, 87, 255, .08), transparent 38%),
        var(--bg);
}

.sub-page > * {
    width: min(1080px, 100%);
    margin-left: auto;
    margin-right: auto;
}

.sub-page-narrow > * { width: min(920px, 100%); }

.sub-preview-banner {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    max-width: none;
    margin: 0 -24px;
    padding: 10px 24px;
    background: var(--navy);
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
}

.sub-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 26px 0 8px;
}

.sub-brand img { display: block; width: 118px; height: auto; }

.sub-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--slate);
    font-size: .75rem;
    font-weight: 700;
}
.sub-back:hover { color: var(--blue); text-decoration: none; }

.sub-notice { margin-top: 14px; }

.sub-hero {
    padding: 34px 0 8px;
    text-align: center;
}
.sub-kicker {
    display: block;
    color: var(--blue);
    font-size: .6875rem;
    font-weight: 800;
    letter-spacing: .14em;
}
.sub-hero h1 {
    margin: 12px auto 10px;
    max-width: 620px;
    color: var(--orliv-dark);
    font-size: clamp(1.625rem, 4vw, 2.375rem);
    font-weight: 800;
    letter-spacing: -.01em;
}
.sub-hero p {
    margin: 0 auto;
    max-width: 540px;
    color: var(--muted);
    font-size: .9375rem;
    line-height: 1.55;
}

.sub-plans {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px;
    padding-top: 30px;
    /* Cada card mide lo que su contenido: sin estirarse a la altura de la
       mas alta, que dejaba bloques vacios bajo los planes con menos lineas. */
    align-items: start;
}

.sub-plan {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 22px 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.sub-plan.is-featured {
    border-color: var(--blue);
    box-shadow: 0 18px 44px rgba(21, 87, 255, .16);
}

.sub-plan-badge {
    position: absolute;
    top: -11px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--blue);
    color: #fff;
    font-size: .625rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.sub-plan h2 { margin: 0; color: var(--navy); font-size: 1.0625rem; font-weight: 800; }
.sub-plan-description {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: .75rem;
    line-height: 1.5;
}

.sub-plan-price {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin: 12px 0 0;
    padding: 12px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.sub-plan-price strong { color: var(--orliv-dark); font-size: 1.625rem; font-weight: 800; }
.sub-plan-price span { color: var(--muted); font-size: .75rem; font-weight: 700; }

/* La lista crece para empatar la altura de las cards y anclar el boton al
   fondo, pero las filas se anclan arriba (align-content) para que los
   bullets no se repartan dejando huecos en las cards con menos lineas. */
.sub-plan-features {
    flex: 1 1 auto;
    margin: 12px 0 16px;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 8px;
    align-content: start;
}
.sub-plan-features li {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    color: var(--ink);
    font-size: .75rem;
    line-height: 1.4;
}
.sub-plan-features li i { margin-top: 1px; font-size: 14px; }
.sub-plan-features li.is-included i { color: var(--success); }
.sub-plan-features li.is-excluded { color: #98a2b3; }
.sub-plan-features li.is-excluded i { color: #cbd5e1; }

.sub-plan-buy { justify-content: center; text-align: center; }

/* Checkout */
.sub-checkout {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr);
    gap: 20px;
    align-items: start;
    padding-top: 20px;
}

.sub-panel {
    padding: 22px;
    margin-bottom: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.sub-panel h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
    color: var(--navy);
    font-size: .9375rem;
    font-weight: 800;
}
.sub-step {
    width: 24px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    font-size: .6875rem;
    font-weight: 800;
}

.sub-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 14px;
}
.sub-col-span { grid-column: 1 / -1; }

.sub-pay-methods {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.sub-pay-method {
    position: relative;
    display: block !important;
    margin: 0 !important;
    cursor: pointer;
}
.sub-pay-method input {
    position: absolute;
    width: 1px;
    height: 1px;
    min-height: auto;
    opacity: 0;
    pointer-events: none;
}
.sub-pay-method .sub-pay-method-card {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 22px;
    align-items: center;
    gap: 12px;
    min-height: 82px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--navy);
    text-align: left;
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.sub-pay-method:hover .sub-pay-method-card { border-color: #b9c9e6; transform: translateY(-1px); }
.sub-pay-method input:focus-visible + .sub-pay-method-card { outline: 3px solid rgba(21, 87, 255, .24); outline-offset: 2px; }
.sub-pay-method input:checked + .sub-pay-method-card {
    border-color: var(--blue);
    background: var(--orliv-ultralight);
    box-shadow: 0 0 0 .16rem rgba(21, 87, 255, .1);
}
.sub-pay-method-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: var(--accent-quiet);
    color: var(--blue);
    font-size: 17px;
}
.sub-pay-method-copy { display: block; min-width: 0; }
.sub-pay-method-copy strong { display: block; color: var(--navy); font-size: .875rem; font-weight: 800; }
.sub-pay-method-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: .6875rem; font-weight: 400; line-height: 1.45; }
.sub-pay-method-choice {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border: 1px solid #c9d3e3;
    border-radius: 50%;
    color: transparent;
    font-size: 10px;
}
.sub-pay-method input:checked + .sub-pay-method-card .sub-pay-method-choice { border-color: var(--blue); background: var(--blue); color: #fff; }

.sub-pay-panel {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: start;
    gap: 11px;
    padding: 13px 14px;
    border: 1px solid #dbe7ff;
    border-radius: 11px;
    background: #f7f9ff;
}
.sub-pay-security-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: #e8efff; color: var(--blue); font-size: 14px; }
.sub-pay-panel p { margin: 0; color: var(--muted); font-size: .75rem; line-height: 1.55; }
.sub-pay-panel p strong { display: block; margin-bottom: 2px; color: var(--navy); font-size: .75rem; }
.sub-pay-panel p span { display: block; }
.sub-demo-note {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-bottom: 14px;
    padding: 10px 12px;
    border-left: 3px solid var(--warning);
    border-radius: 0 7px 7px 0;
    background: #FFFAEB;
    color: #92400E;
    font-size: .6875rem;
    font-weight: 600;
    line-height: 1.45;
}
.sub-demo-note i { margin-top: 1px; }

.sub-terms { margin-bottom: 16px; }
.sub-submit { justify-content: center; gap: 9px; }
.sub-legal {
    margin: 12px 0 0;
    color: var(--muted);
    font-size: .6875rem;
    text-align: center;
}

.sub-summary {
    position: sticky;
    top: 24px;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.sub-summary h2 { margin: 0 0 14px; color: var(--navy); font-size: .9375rem; font-weight: 800; }
.sub-summary-plan {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 10px;
}
.sub-summary-plan span { color: var(--muted); font-size: .75rem; font-weight: 700; }
.sub-summary-plan strong { color: var(--orliv-dark); font-size: .9375rem; }
.sub-summary-description {
    margin: 0 0 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: .6875rem;
    line-height: 1.5;
}
.sub-summary-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 0;
    color: var(--ink);
    font-size: .75rem;
}
.sub-summary-total {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    font-size: .8125rem;
    font-weight: 800;
    color: var(--orliv-dark);
}
.sub-summary-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 14px 0 0;
    color: var(--muted);
    font-size: .6875rem;
    line-height: 1.45;
}

/* Confirmacion */
.sub-thanks {
    padding: 40px 0;
    text-align: center;
}
.sub-thanks-icon {
    display: inline-grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #ECFDF3;
    color: var(--success);
    font-size: 30px;
}
.sub-thanks-icon.result-pendiente { background: #fff8e6; color: #b7791f; }
.sub-thanks-icon.result-rechazado,
.sub-thanks-icon.result-cancelado { background: #fff0f0; color: #d14343; }
.sub-thanks h1 { margin: 18px 0 8px; color: var(--orliv-dark); font-size: 1.75rem; font-weight: 800; }
.sub-thanks > p { margin: 0 auto 24px; max-width: 480px; color: var(--muted); font-size: .875rem; line-height: 1.55; }
.sub-order-card {
    width: min(440px, 100%);
    margin: 0 auto 26px;
    padding: 20px 22px;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.sub-order-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
    font-size: .75rem;
}
.sub-order-row:last-child { border-bottom: 0; }
.sub-order-row span { color: var(--muted); font-weight: 600; }
.sub-order-row strong { color: var(--ink); text-align: right; overflow-wrap: anywhere; }

.sub-footer {
    padding-top: 30px;
    color: var(--muted);
    font-size: .6875rem;
    text-align: center;
}
.sub-footer p { margin: 0; }

@media (max-width: 900px) {
    .sub-checkout { grid-template-columns: 1fr; }
    .sub-summary { position: static; order: -1; }
}

@media (max-width: 575.98px) {
    .sub-page { padding: 0 14px 30px; }
    .sub-preview-banner { margin: 0 -14px; padding: 10px 14px; }
    .sub-field-grid { grid-template-columns: 1fr; }
    .sub-pay-methods { grid-template-columns: 1fr; }
    .sub-pay-method .sub-pay-method-card { grid-template-columns: 38px minmax(0, 1fr) 20px; min-height: 76px; padding: 12px; }
    .sub-pay-method-icon { width: 38px; height: 38px; }
    .sub-hero { padding-top: 22px; }
    .sub-plan-description { min-height: 0; }
}

/* ==========================================================================
   Responsive
   Minia colapsa el topnav por su cuenta en <992px; aqui solo se adapta el
   contenido propio.
   ========================================================================== */

@media (max-width: 991.98px) {
    .form-grid,
    .analytics-grid { grid-template-columns: 1fr; }
    .stats-grid,
    .period-filter,
    .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .footer-powered { justify-content: flex-start; }
}

@media (max-width: 767.98px) {
    .panel-head { align-items: stretch; flex-direction: column; }
    .grid-2,
    .grid-3,
    .stats-grid,
    .analytics-grid,
    .period-filter,
    .permission-grid,
    .settings-grid { grid-template-columns: 1fr; }
    .color-control { grid-template-columns: minmax(0, 1fr) 44px; }
    .color-code { grid-column: 1 / -1; }
    .settings-actions { flex-direction: column-reverse; }
    .share-row { grid-template-columns: 1fr; }
    .download-row { grid-template-columns: repeat(2, 1fr); }
    .toolbar-panel { align-items: stretch; flex-direction: column; }
    .toolbar-left,
    .toolbar-right {
        align-items: stretch;
        flex-direction: column;
    }
    .toolbar-left .btn,
    .toolbar-right .btn,
    .status-select { width: 100%; }
    .filter-input { width: 100%; }
    .resource-card,
    .qr-card-row { grid-template-columns: 1fr; }
    .card-actions { justify-content: flex-start; }
    .one-link-item-row { grid-template-columns:1fr; }
    .one-link-item-row select,
    .one-link-item-row input { grid-column:1; }
    .one-link-item-row .one-link-item-actions { grid-column:1 / -1; justify-content:flex-end; }
    .panel-heading { align-items:stretch; flex-direction:column; }
    .panel-heading .btn { width:100%; }
    .public-url-row { align-items:flex-start; flex-direction:column; }
    .public-url-row .copy-link { max-width:100%; }
}

/* ==========================================================================
   Atajos de copiado, panel QR opcional y primitivas de bloque compartidas
   ========================================================================== */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* Etiqueta de bloque reutilizable: da un encabezado consistente a cualquier
   agrupación dentro de un panel, sin recurrir a un <h3> por cada caso. */
.field-block { margin-bottom: 16px; }

.field-block-label,
.copy-shortcuts > .field-block-label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.panel-tag {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: .625rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    vertical-align: middle;
}

/* --- Atajos de copiado --------------------------------------------------- */
.copy-shortcuts {
    margin-bottom: 20px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #FBFCFE;
}

.copy-shortcut-list {
    display: grid;
    gap: 8px;
}

.copy-shortcut {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

.copy-shortcut-label {
    color: var(--muted);
    font-size: .75rem;
    font-weight: 600;
}

/* Campo de sólo lectura: se ve como valor, no como campo editable, pero
   sigue siendo seleccionable para copiar a mano. */
.copy-shortcut-value {
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: .75rem;
    text-overflow: ellipsis;
}

.copy-shortcut .btn { white-space: nowrap; }

.copy-action kbd,
.copy-link kbd {
    padding: 1px 5px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--surface-2);
    color: var(--muted);
    font-family: inherit;
    font-size: .625rem;
    font-weight: 700;
}

/* Confirmación por clase, no reescribiendo el contenido del botón: así se
   conservan el icono y el <kbd> del atajo, que el método anterior borraba.
   El texto visible se sustituye con un ::after sobre el <span> de la etiqueta;
   los botones sin <span> (listados) sólo cambian de color, y en ambos casos
   el resultado se anuncia por la región aria-live. */
.copy-action > span,
.copy-link > span { position: relative; }

.copy-action.is-copied,
.copy-link.is-copied {
    border-color: var(--success);
    color: var(--success);
}

.copy-action.is-copied > span,
.copy-link.is-copied > span { visibility: hidden; }

.copy-action.is-copied > span::after,
.copy-link.is-copied > span::after {
    content: "Copiado";
    position: absolute;
    left: 0;
    visibility: visible;
}

.copy-action.is-copy-error,
.copy-link.is-copy-error {
    border-color: var(--danger);
    color: var(--danger);
}

/* --- Panel QR opcional --------------------------------------------------- */
.qr-options[hidden] { display: none; }

.qr-options {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

/* Deja claro que el bloque QR no está activo sin ocultar la casilla. */
[data-qr-panel]:has([data-qr-enable]:not(:checked)) .panel-tag {
    background: var(--accent-quiet);
    color: var(--blue);
}

@media (max-width: 767.98px) {
    .copy-shortcut {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .copy-shortcut-label { grid-column: 1 / -1; margin-bottom: -4px; }
}

/* ==========================================================================
   Sistema de bloques estandarizado (secciones de usuario y configuración)
   --------------------------------------------------------------------------
   Estas vistas habían crecido con tres contenedores distintos (.panel,
   .card.orliv-form-card > .card-body y la rejilla de Bootstrap), dos
   encabezados (.panel-head y .panel-heading), dos filas de acciones
   (.form-actions y .settings-actions) y dos patrones de tabla. Aquí se define
   un único juego de primitivas y se mantienen las clases antiguas como alias
   para no romper las vistas que aún no se hayan migrado.
   ========================================================================== */

/* --- Ritmo vertical de la página ---------------------------------------- */
.page-stack {
    display: grid;
    gap: 18px;
    align-content: start;
}

.page-stack > .panel { margin-bottom: 0; }

/* Los items de un grid tienen min-width:auto, así que un panel con tabla
   ancha se estiraba hasta el min-content de la tabla (800px) y desbordaba la
   página en móvil en vez de dejar que .table-wrap hiciera el scroll. */
.page-stack > * { min-width: 0; }

/* --- Columnas ------------------------------------------------------------ */
/* Contenido principal + columna de apoyo. .form-grid es el nombre histórico
   del mismo patrón y se conserva como alias. */
.layout-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 24px;
    align-items: start;
}

/* Variante con la columna de apoyo a la izquierda (formulario corto que
   alimenta un listado largo, como la lista de slugs prohibidos). */
.layout-split-start {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.layout-split > .page-stack,
.layout-split-start > .page-stack { min-width: 0; }

/* Rejilla de datos que se adapta sola: evita tener que elegir a mano entre
   2 y 3 columnas en cada página. */
.field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
}

/* --- Encabezado de panel ------------------------------------------------- */
.panel-head,
.panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.panel-head > div:first-child,
.panel-heading > div:first-child { min-width: 0; }

.panel-head h2,
.panel-heading h2 {
    margin: 0 0 4px;
    font-size: 1rem;
}

.panel-head p,
.panel-heading p {
    max-width: 68ch;
    margin: 0;
    color: var(--muted);
    font-size: .8125rem;
    overflow-wrap: anywhere;
}

/* Encabezado de segundo nivel dentro de un panel ya titulado. */
.block-head {
    margin: 22px 0 12px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.block-head:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.block-head h3 {
    margin: 0 0 3px;
    font-size: .875rem;
    font-weight: 800;
}

.block-head p {
    margin: 0;
    color: var(--muted);
    font-size: .8125rem;
}

/* --- Fila de acciones ---------------------------------------------------- */
/* Un único patrón: acciones a la derecha, con hueco a la izquierda para
   acciones secundarias o destructivas. */
.panel-actions,
.form-actions,
.settings-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.panel-actions > .spacer,
.form-actions > .spacer { margin-right: auto; }

/* Las acciones que cierran un formulario largo permanecen a la vista. */
.panel-actions.is-sticky {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin-top: 0;
    padding-bottom: 18px;
    background: linear-gradient(to top, #fff 70%, rgba(255, 255, 255, 0));
}

/* La barra de acciones que vive sola en su propio panel, o suelta al final de
   un formulario, no repite el borde: ya lo aporta el panel. */
.compact-panel > .panel-actions,
.compact-panel.settings-actions,
.settings-actions.plan-matrix-actions,
form > .panel-actions:last-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

@media (max-width: 991.98px) {
    .layout-split,
    .layout-split-start { grid-template-columns: 1fr; }
}

@media (max-width: 767.98px) {
    .panel-head,
    .panel-heading { align-items: stretch; flex-direction: column; }

    .panel-actions,
    .form-actions,
    .settings-actions { flex-direction: column-reverse; align-items: stretch; }

    .panel-actions > .btn,
    .form-actions > .btn,
    .settings-actions > .btn,
    .panel-actions > form,
    .form-actions > form { width: 100%; }

    .panel-actions > form .btn,
    .form-actions > form .btn { width: 100%; }

    .panel-actions > .spacer { margin-right: 0; }
}

/* --- Piezas de las secciones estandarizadas ------------------------------ */

/* Formulario en columna simple dentro de un panel de apoyo. */
.form-stack { display: grid; }
.form-stack > label { margin-bottom: 14px; }

/* Pares dato/valor: reemplaza los <div><small>+<strong class="d-block">
   sueltos por una lista de descripción, que es lo que realmente son. */
.summary-grid { margin: 0; }

.summary-grid dt {
    margin-bottom: 3px;
    color: var(--muted);
    font-size: .75rem;
    font-weight: 600;
}

.summary-grid dd {
    margin: 0;
    color: var(--ink);
    font-size: .9375rem;
    font-weight: 700;
}

/* Permisos por usuario: etiquetas legibles en vez de la clave "CE-". */
.permission-cell { min-width: 210px; }

.permission-group {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.permission-group + .permission-group { margin-top: 5px; }

.permission-group > b {
    min-width: 38px;
    color: var(--muted);
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
}

.permission-tag {
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--accent-quiet);
    color: var(--orliv-active);
    font-size: .6875rem;
    font-weight: 600;
}

.permission-none {
    color: var(--muted);
    font-size: .6875rem;
    font-style: italic;
}

.slug-chip-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.empty-state .btn { margin-top: 16px; }

/* ==========================================================================
   Piezas estandarizadas: barra de acciones del editor, índice de
   configuración y bloques del módulo de sistema.
   ========================================================================== */

/* --- Botón destructivo --------------------------------------------------- */
.btn.danger {
    border-color: #fecaca;
    background: #fff;
    color: var(--danger);
}
.btn.danger:hover { background: #fef3f2; }

/* --- Cabecera de un registro en edición ---------------------------------- */
/* Repite en el editor las mismas acciones que ofrece la tarjeta del listado,
   para no obligar a volver atrás por copiar, previsualizar o eliminar. */
.record-toolbar {
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.record-summary {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.record-summary > div { min-width: 0; }

.record-summary h2 {
    margin: 0 0 4px;
    color: var(--navy);
    font-size: 1rem;
    overflow-wrap: anywhere;
}

.record-summary .meta-row { margin: 0; }

/* --- Índice de secciones (configuración) --------------------------------- */
.settings-index { display: grid; gap: 8px; }

.settings-index a {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
    text-decoration: none;
}

.settings-index a:hover { border-color: var(--blue); background: var(--accent-quiet); }
.settings-index a > i { color: var(--blue); font-size: 14px; }
.settings-index strong { display: block; color: var(--navy); font-size: .8125rem; }
.settings-index small { display: block; margin-top: 2px; color: var(--muted); font-size: .6875rem; line-height: 1.4; }

.settings-subnav { margin-bottom: 18px; }
.settings-shell { align-items: start; }

/* Las tablas de respaldos y deploys deben poder caber en la columna de
   contenido en escritorio. El min-width global de las tablas hacía que la
   columna de acciones quedara fuera de la tarjeta y los botones aparecieran
   cortados. */
.settings-shell .table-wrap { min-width: 0; }
.settings-shell .table-wrap table:not(.table) {
    min-width: 0;
    table-layout: fixed;
}
.settings-shell .table-wrap th,
.settings-shell .table-wrap td { overflow-wrap: anywhere; }
.settings-shell .table-wrap td:first-child strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.settings-shell .table-wrap th:last-child,
.settings-shell .table-wrap td:last-child { width: 112px; }
.settings-shell .table-wrap .action-btn { white-space: nowrap; }
.settings-shell .table-wrap .icon-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}
.settings-shell .table-wrap .icon-actions .action-btn { justify-content: center; width: 100%; }

/* --- Módulo de sistema, respaldos y deploys ------------------------------ */
.system-check {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
}

.system-check strong { display: block; color: var(--navy); font-size: .75rem; }
.system-check small { display: block; color: var(--muted); font-size: .6875rem; }
.system-check.is-ok > i { color: var(--success, #15803d); }
.system-check.is-warn > i { color: var(--warning, #d97706); }

.migration-panel { scroll-margin-top: 96px; }
.migration-summary {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    background: #fff7ed;
    color: #9a3412;
}
.migration-summary.is-current { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.migration-summary > i { margin-top: 2px; }
.migration-summary p { margin: 0; color: inherit; font-size: .8125rem; line-height: 1.5; }
.migration-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.migration-list li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
}
.migration-list strong,
.migration-list small { display: block; overflow-wrap: anywhere; }
.migration-list strong { color: var(--navy); font-size: .8125rem; }
.migration-list small,
.migration-date { color: var(--muted); font-size: .6875rem; }
.migration-apply-form { display: grid; gap: 12px; margin-top: 16px; }
.migration-confirm { display: flex; align-items: flex-start; gap: 10px; margin: 0; color: var(--slate); font-size: .8125rem; line-height: 1.45; cursor: pointer; }
.migration-confirm input { flex: 0 0 auto; margin-top: 3px; }
.migration-apply-form .btn { min-height: 44px; justify-self: start; }
.migration-history { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.migration-history summary { color: var(--navy); font-size: .8125rem; font-weight: 700; cursor: pointer; }
.migration-history[open] summary { margin-bottom: 12px; }

.system-inline-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.system-inline-form label { margin: 0; flex: 1 1 200px; }

.panel-danger { border-color: #fecaca; }
.panel-danger .panel-head h2 { color: var(--danger); }

/* --- Vista previa de la paleta ------------------------------------------- */
.theme-preview-card {
    display: grid;
    gap: 8px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
}

.theme-preview-title { color: var(--navy); font-size: .9375rem; font-weight: 700; }
.theme-preview-text { color: var(--slate); font-size: .8125rem; }
.theme-preview-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.theme-preview-btn {
    padding: 7px 14px;
    border-radius: 6px;
    background: var(--blue);
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
}

.theme-preview-chip {
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--accent-quiet);
    color: var(--coral);
    font-size: .75rem;
    font-weight: 700;
}

@media (max-width: 767.98px) {
    .record-toolbar { align-items: stretch; flex-direction: column; }
    .record-toolbar .card-actions { justify-content: flex-start; flex-wrap: wrap; }
    .system-inline-form { align-items: stretch; flex-direction: column; }
    .system-inline-form .btn { width: 100%; }
    .migration-apply-form .btn { width: 100%; }
    .migration-list li { align-items: start; }
    .migration-date { text-align: right; }

    /* En Sistema, las tablas conservan sus columnas para poder leerlas con
       desplazamiento interno, sin ensanchar el documento completo. */
    html,
    body { overflow-x: hidden; }

    .settings-shell { gap: 14px; }
    .settings-shell .panel { padding: 16px; }
    .settings-shell .panel-head form,
    .settings-shell .panel-head form .btn { width: 100%; }
    .settings-shell .table-wrap {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
    }
    .settings-shell .table-wrap table { min-width: 680px; }
    .settings-shell .icon-actions .action-btn {
        width: 36px;
        min-width: 36px;
        justify-content: center;
        padding-inline: 0;
        font-size: 0;
    }
    .settings-shell .icon-actions .action-btn i { margin: 0; font-size: .8rem; }
}

/* --- Área de administración -------------------------------------------- */
.admin-shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    align-items: start;
    gap: 24px;
}

.admin-content { min-width: 0; }

.admin-nav {
    position: sticky;
    top: 152px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 8px 28px rgba(15, 23, 42, .06);
    overflow: hidden;
}

.admin-nav-toggle { display: none; }

.admin-nav-list { padding: 10px; }

.admin-nav-home,
.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 9px 11px;
    border-radius: 8px;
    color: var(--slate);
    font-size: .8125rem;
    font-weight: 600;
    transition: color .15s ease, background .15s ease;
}

.admin-nav-home {
    margin-bottom: 9px;
    color: var(--navy);
    font-weight: 750;
}

.admin-nav-home i,
.admin-nav-link i { flex: 0 0 18px; font-size: 1.1rem; }

.admin-nav-home:hover,
.admin-nav-link:hover { color: var(--blue); background: var(--accent-quiet); }

.admin-nav-home.active,
.admin-nav-link.active {
    color: #fff;
    background: var(--blue);
}

.admin-nav-group {
    padding: 10px 0 5px;
    border-top: 1px solid var(--line);
}

.admin-nav-title {
    display: block;
    padding: 0 11px 6px;
    color: var(--slate);
    font-size: .625rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.admin-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
    padding: 26px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--orliv-dark), var(--blue));
    color: #fff;
    box-shadow: 0 14px 32px rgba(21, 87, 255, .18);
}

.admin-hero h2 { margin: 4px 0 7px; color: #fff; font-size: 1.55rem; }
.admin-hero p { margin: 0; color: rgba(255, 255, 255, .78); }
.admin-hero .btn { flex: 0 0 auto; background: #fff; color: var(--blue); border-color: #fff; }
.admin-eyebrow { font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

.admin-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 20px;
}

.admin-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.admin-card {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 20px;
    align-items: center;
    gap: 12px;
    min-height: 82px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--navy);
    background: var(--surface);
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.admin-card:hover {
    border-color: var(--blue);
    color: var(--navy);
    box-shadow: 0 8px 22px rgba(15, 23, 42, .08);
    transform: translateY(-1px);
}

.admin-card > i:first-child {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 9px;
    color: var(--blue);
    background: var(--accent-quiet);
    font-size: 1.25rem;
}

.admin-card strong,
.admin-card small { display: block; }
.admin-card small { margin-top: 3px; color: var(--slate); font-size: .72rem; line-height: 1.35; }
.admin-card-go { color: var(--slate); font-size: 1.15rem; }

.admin-gateway-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.admin-gateway-list > div {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.admin-gateway-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 9px;
    color: #fff;
    background: #635bff;
    font-size: 1.35rem;
}

.admin-gateway-icon.mercadopago { background: #009ee3; }

.subscription-module-nav {
    position: sticky;
    top: 70px;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 6px;
    margin: 0 0 18px;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .08);
    backdrop-filter: blur(10px);
}

.subscription-module-nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--slate);
    font-size: .75rem;
    font-weight: 750;
    text-decoration: none;
    transition: background .16s ease, color .16s ease;
}

.subscription-module-nav a:hover,
.subscription-module-nav a:focus-visible,
.subscription-module-nav a.active {
    color: var(--blue);
    background: var(--accent-quiet);
}

.subscription-module { scroll-margin-top: 140px; }

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.table-toolbar .form-hint { margin: 0; }
.btn.compact { padding: 6px 9px; font-size: .72rem; }
.order-row-actions { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.force-local-check { margin: 0 0 14px; padding: 12px; border: 1px solid #f3c7c7; border-radius: 10px; background: #fff7f7; }
.force-local-check span { display: grid; gap: 2px; }
.force-local-check small { color: var(--muted); font-weight: 500; }

.security-key-panel .notice { margin-bottom: 12px; }

@media (max-width: 767.98px) {
    .table-toolbar { align-items: stretch; flex-direction: column; }
    .table-toolbar .btn { width: 100%; }
}

.module-heading {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.module-heading > span,
.module-number {
    display: inline-grid;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    place-items: center;
    border-radius: 8px;
    color: var(--blue);
    background: var(--accent-quiet);
    font-size: .7rem;
    font-weight: 800;
}

.module-heading p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: .8rem;
}

.panel-head .module-number {
    display: inline-grid;
    margin-right: 8px;
    vertical-align: middle;
}

.panel-head .module-number + h2 {
    display: inline-block;
    vertical-align: middle;
}

.payment-environment-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 16px 0;
}

.payment-environment-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fbfcfe;
}

.payment-environment-card.selected {
    border-color: rgba(21, 87, 255, .38);
    box-shadow: 0 0 0 3px rgba(21, 87, 255, .08);
}

.payment-environment-card.production.selected {
    border-color: rgba(15, 157, 88, .42);
    box-shadow: 0 0 0 3px rgba(15, 157, 88, .08);
}

.payment-environment-card header {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.environment-icon {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 9px;
    color: #fff;
    background: #596579;
}

.payment-environment-card.test .environment-icon { background: #635bff; }
.payment-environment-card.production .environment-icon { background: #0f9d58; }

.payment-environment-card header small,
.payment-environment-card header h3 {
    display: block;
    margin: 0;
}

.payment-environment-card header small {
    color: var(--muted);
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.payment-environment-card header h3 {
    margin-top: 2px;
    color: var(--navy);
    font-size: .88rem;
}

.payment-environment-card ol {
    margin: 14px 0;
    padding-left: 20px;
    color: var(--slate);
    font-size: .78rem;
    line-height: 1.5;
}

.payment-environment-card li + li { margin-top: 7px; }

.environment-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.environment-actions .btn {
    min-height: 36px;
    padding: 7px 10px;
    font-size: .72rem;
}

.environment-actions > a {
    color: var(--blue);
    font-size: .75rem;
    font-weight: 750;
    text-decoration: none;
}

.oauth-connection {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 14px 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fbfcfe;
}

.oauth-connection strong,
.oauth-connection small { display: block; }
.oauth-connection small { margin-top: 3px; color: var(--muted); }

.oauth-guide {
    margin: 12px 0 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
}

.oauth-guide summary {
    padding: 12px 14px;
    color: var(--navy);
    font-size: .8125rem;
    font-weight: 750;
    cursor: pointer;
}

.oauth-guide[open] summary { border-bottom: 1px solid var(--line); }
.oauth-guide ol {
    margin: 0;
    padding: 14px 18px 14px 34px;
    color: var(--slate);
    font-size: .8125rem;
    line-height: 1.55;
}
.oauth-guide li + li { margin-top: 7px; }
.oauth-guide a { color: var(--blue); font-weight: 700; }

@media (max-width: 767.98px) {
    .subscription-module-nav {
        top: 8px;
        display: flex;
        justify-content: flex-start;
        overflow-x: auto;
        scrollbar-width: thin;
    }
    .subscription-module-nav a { flex: 0 0 auto; }
    .payment-environment-grid { grid-template-columns: 1fr; }
    .environment-actions { align-items: stretch; flex-direction: column; }
    .environment-actions .btn { width: 100%; }
    .oauth-connection { align-items: stretch; flex-direction: column; }
    .oauth-connection .btn { width: 100%; }
}

@media (max-width: 991.98px) {
    .admin-shell { display: block; }
    .admin-nav { position: static; margin-bottom: 18px; }
    .admin-nav-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        min-height: 48px;
        padding: 11px 14px;
        border: 0;
        color: var(--navy);
        background: var(--surface);
        font-weight: 700;
    }
    .admin-nav-toggle span { flex: 1; padding: 0 10px; text-align: left; }
    .admin-nav-list { display: none; border-top: 1px solid var(--line); }
    .admin-nav.is-open .admin-nav-list { display: block; }
    .admin-card-grid { grid-template-columns: 1fr; }
}

@media (max-width: 575.98px) {
    .admin-hero { align-items: flex-start; flex-direction: column; padding: 20px; }
    .admin-hero .btn { width: 100%; }
    .admin-stats,
    .admin-gateway-list { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Editor de la página de inicio
   Formulario generado desde home_content_schema(): rejilla de campos y
   grupos repetibles con reordenamiento.
   ========================================================================== */

.editor-jump { display: flex; flex-wrap: wrap; gap: 8px; }
.editor-jump a {
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--navy);
    font-size: .82rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.editor-jump a:hover { border-color: var(--blue); color: var(--blue); background: var(--accent-quiet); }

.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; }
.editor-grid > .editor-field { grid-column: span 1; }
.editor-grid > .editor-field--half { grid-column: span 1; }
.editor-grid > .editor-field--full { grid-column: span 2; }

.editor-lines { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; line-height: 1.6; }

.editor-repeat { margin-top: 22px; padding-top: 20px; border-top: 1px dashed var(--line); }
.editor-repeat-title {
    margin: 0 0 14px;
    color: var(--slate);
    font-size: .74rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.editor-row {
    padding: 16px 18px;
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--bg);
}
.editor-row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.editor-row-index { color: var(--slate); font-size: .76rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.editor-row-actions { display: flex; gap: 6px; }
.editor-row .editor-grid > label { margin-top: 8px; }

.editor-repeat > [data-repeat-add]:disabled { opacity: .5; cursor: not-allowed; }

.editor-savebar {
    position: sticky;
    bottom: 12px;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    box-shadow: 0 -4px 24px rgba(15, 23, 42, .08);
}
.editor-savebar strong { display: block; color: var(--navy); }
.editor-savebar .form-hint { margin: 2px 0 0; }

@media (max-width: 767.98px) {
    .editor-grid { grid-template-columns: 1fr; }
    .editor-grid > .editor-field,
    .editor-grid > .editor-field--half,
    .editor-grid > .editor-field--full { grid-column: span 1; }
    .editor-savebar { flex-direction: column; align-items: stretch; }
    .editor-savebar .btn { width: 100%; }
}


/* ==========================================================================
   Editor visual
   Constructor de tres columnas —paleta de módulos, lienzo y apariencia—
   con el mismo modelo de trabajo que el editor de plantillas de Orliv Mail.
   ========================================================================== */

.orliv-builder { margin-top: 6px; }

.builder-toolbar {
    position: sticky;
    top: 6px;
    z-index: 12;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 4px 16px rgba(15, 23, 42, .05);
    backdrop-filter: blur(8px);
}
.toolbar-format { display: flex; align-items: center; flex-wrap: wrap; gap: 3px; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }
.toolbar-separator { width: 1px; height: 22px; margin: 0 4px; background: var(--line); }
.builder-status { color: var(--slate); font-size: .72rem; white-space: nowrap; }

.wysiwyg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 9px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--navy);
    font-size: .78rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background-color .14s ease, border-color .14s ease, color .14s ease;
}
.wysiwyg-btn:hover { border-color: var(--line); background: var(--bg); }
.wysiwyg-btn.is-active { border-color: var(--blue); background: var(--accent-quiet); color: var(--blue); }

.builder-grid {
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr) 244px;
    gap: 14px;
    align-items: start;
}

.module-palette,
.block-settings {
    position: sticky;
    top: 60px;
    height: clamp(460px, calc(100vh - 190px), 740px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    scrollbar-width: thin;
    scrollbar-color: #C5CFDD transparent;
}
.module-palette { background: var(--bg); }
.block-settings { background: var(--surface); }
.module-palette::-webkit-scrollbar, .block-settings::-webkit-scrollbar { width: 6px; }
.module-palette::-webkit-scrollbar-thumb, .block-settings::-webkit-scrollbar-thumb { border-radius: 8px; background: #C5CFDD; }

.module-palette-title { color: var(--navy); font-size: .82rem; font-weight: 800; }
.module-palette > p { margin: 4px 0 12px; color: var(--slate); font-size: .74rem; line-height: 1.45; }

.module-search {
    display: flex; align-items: center; gap: 7px; margin: 10px 0;
    padding: 0 9px; border: 1px solid var(--line); border-radius: 8px;
    background: var(--surface); color: var(--slate);
}
.module-search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(21, 87, 255, .1); }
.module-search input { width: 100%; min-width: 0; min-height: 0; padding: 9px 0; border: 0; outline: 0; background: transparent; font-size: .76rem; }

.builder-shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 10px; padding: 3px; border-radius: 8px; background: #E7ECF4; }
.builder-shortcuts button { padding: 7px 4px; border: 0; border-radius: 6px; background: transparent; color: var(--slate); font-size: .69rem; font-weight: 700; cursor: pointer; }
.builder-shortcuts button.active { background: var(--surface); color: var(--blue); box-shadow: 0 1px 4px rgba(15, 23, 42, .08); }

.module-group { margin-top: 7px; border-top: 1px solid var(--line); }
.module-group > summary { display: flex; align-items: center; justify-content: space-between; padding: 10px 2px 7px; list-style: none; color: var(--navy); font-size: .72rem; font-weight: 750; cursor: pointer; }
.module-group > summary::-webkit-details-marker { display: none; }
.module-group > summary::before { content: "\203A"; margin-right: 6px; color: var(--slate); transition: transform .15s ease; }
.module-group[open] > summary::before { transform: rotate(90deg); }
.module-group > summary span { flex: 1; }
.module-group > summary small { display: grid; width: 18px; height: 18px; place-items: center; border-radius: 10px; background: #E7ECF4; color: var(--slate); font-size: .6rem; }

.module-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.module-grid button {
    display: flex; min-height: 66px; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
    padding: 8px 4px; border: 1px solid var(--line); border-radius: 8px;
    background: var(--surface); color: var(--navy); font: inherit; font-size: .68rem; text-align: center; cursor: grab;
}
.module-grid button span { color: var(--blue); font-size: 1.15rem; font-weight: 700; }
.module-grid button:hover { border-color: var(--blue); box-shadow: 0 4px 12px rgba(21, 87, 255, .1); }
.module-grid button[hidden], .module-group[hidden] { display: none; }

.layer-panel > p { margin: 6px 0 10px; color: var(--slate); font-size: .7rem; }
.layer-item { display: flex; width: 100%; align-items: center; gap: 7px; margin-bottom: 5px; padding: 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--navy); cursor: pointer; text-align: left; }
.layer-item span { color: var(--slate); }
.layer-item b { overflow: hidden; font-size: .7rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.layer-item:hover, .layer-item.active { border-color: var(--blue); background: var(--orliv-ultralight); color: var(--blue); }

.editor-stage { min-width: 0; padding: 14px 18px 18px; border: 1px solid #DCE3EE; border-radius: 10px; background: #E9EEF6; }
.editor-stage-label { margin-bottom: 8px; color: var(--slate); font-size: .72rem; text-align: center; }
.editor-stage .wysiwyg {
    width: min(100%, 760px);
    min-height: 460px;
    max-height: clamp(400px, calc(100vh - 250px), 700px);
    margin: 0 auto;
    padding: 32px 34px;
    overflow-y: auto;
    border-radius: 6px;
    background: var(--surface);
    box-shadow: 0 5px 18px rgba(15, 23, 42, .08);
    outline: none;
}
.editor-stage .wysiwyg.drag-active { outline: 2px dashed var(--blue); outline-offset: -8px; }

.orliv-block { position: relative; min-height: 10px; border: 1px solid transparent; border-radius: 4px; }
.orliv-block:hover { border-color: #B8C8EC; }
.orliv-block.is-selected { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(21, 87, 255, .12); }
.block-handle {
    position: absolute; z-index: 3; top: 3px; left: -11px; display: none;
    padding: 3px 5px; border-radius: 5px; background: var(--blue); color: #fff;
    font-size: 11px; line-height: 1; cursor: grab; user-select: none;
}
.orliv-block:hover > .block-handle, .orliv-block.is-selected > .block-handle { display: block; }

.builder-dropzone { position: relative; min-height: 58px; outline: 1px dashed transparent; outline-offset: -4px; transition: background-color .15s ease, outline-color .15s ease; }
.builder-dropzone:empty::before {
    content: "Suelta modulos aqui \00B7 " attr(data-zone-label);
    display: flex; min-height: 54px; align-items: center; justify-content: center;
    padding: 8px; color: #8290A5; font-size: 11px; text-align: center;
}
.builder-dropzone:hover { outline-color: #B8C8EC; background-color: rgba(244, 247, 255, .5); }
.builder-dropzone.drop-target { outline: 2px dashed var(--blue); background: var(--orliv-ultralight); }
.builder-dropzone > .orliv-block { margin: 4px 0; }
.builder-dropzone > .orliv-block > .block-handle { top: 2px; left: 2px; }

.block-settings > .settings-empty { display: flex; min-height: 210px; flex-direction: column; align-items: center; justify-content: center; padding: 22px 10px; color: var(--slate); text-align: center; }
.settings-empty > span { display: grid; width: 42px; height: 42px; place-items: center; margin-bottom: 11px; border-radius: 12px; background: var(--accent-quiet); color: var(--blue); font-size: 1.3rem; }
.settings-empty strong { color: var(--navy); font-size: .8rem; }
.settings-empty p { margin: 7px 0 0; font-size: .7rem; line-height: 1.55; }

.settings-group { margin-top: 9px; border-top: 1px solid var(--line); }
.settings-group > summary { display: flex; align-items: center; padding: 11px 1px 5px; list-style: none; color: var(--navy); font-size: .72rem; font-weight: 750; cursor: pointer; }
.settings-group > summary::-webkit-details-marker { display: none; }
.settings-group > summary::before { content: "\203A"; margin-right: 7px; color: var(--slate); font-size: 1rem; transition: transform .15s ease; }
.settings-group[open] > summary::before { transform: rotate(90deg); }

.block-settings label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 0; color: var(--slate); font-size: .74rem; font-weight: 600; }
.block-settings input[type="color"] { width: 44px; height: 30px; min-height: 0; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.block-settings select { max-width: 108px; min-height: 0; padding: 6px 8px; font-size: .72rem; }

.palette-label { margin-top: 13px; color: var(--slate); font-size: .68rem; font-weight: 650; }
.color-presets { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 7px; }
.color-presets button { width: 27px; height: 27px; padding: 0; border: 3px solid #fff; border-radius: 50%; outline: 1px solid var(--line); background: var(--swatch); cursor: pointer; transition: transform .14s ease; }
.color-presets button:hover { outline: 2px solid var(--blue); transform: scale(1.08); }

.block-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 18px; }
.block-actions .btn { padding: 8px 5px; font-size: .69rem; }
.block-actions .danger { color: #B42318; border-color: #FECDCA; }

.wysiwyg-source {
    display: block;
    width: min(100%, 760px);
    min-height: 420px;
    margin: 0 auto;
    padding: 18px 20px;
    border: 0;
    border-radius: 6px;
    background: var(--orliv-dark);
    color: #DCE7FF;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .82rem;
    line-height: 1.6;
    resize: vertical;
}
.wysiwyg-source:focus { outline: none; }

/* Tipografia del lienzo: refleja el articulo publicado. */
.prose-editor {
    color: var(--navy);
    font-size: 1rem;
    font-weight: 400;
    font-style: normal;
    line-height: 1.75;
    text-align: left;
    letter-spacing: normal;
}
.prose-editor > * + * { margin-top: 1.1em; }
.prose-editor h2 { margin-top: 1.5em; font-size: 1.45rem; letter-spacing: -.02em; }
.prose-editor h3 { margin-top: 1.3em; font-size: 1.16rem; }
.prose-editor strong, .prose-editor b { font-weight: 700; }
.prose-editor a { color: var(--blue); text-decoration: underline; }
.prose-editor ul, .prose-editor ol { padding-left: 1.4em; }
.prose-editor li + li { margin-top: .4em; }
.prose-editor blockquote { margin: 1.2em 0; padding: 14px 20px; border-left: 4px solid var(--blue); border-radius: 0 10px 10px 0; background: var(--accent-quiet); color: var(--orliv-navy); font-style: italic; }
.prose-editor pre { padding: 16px 18px; border-radius: 10px; background: var(--orliv-dark); color: #DCE7FF; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .86rem; overflow-x: auto; }
.prose-editor code { padding: 2px 6px; border-radius: 5px; background: var(--accent-quiet); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.prose-editor pre code { padding: 0; background: none; color: inherit; }
.prose-editor img { max-width: 100%; height: auto; border-radius: 10px; }
.prose-editor figure { margin: 1.4em 0; }
.prose-editor figcaption { margin-top: 8px; color: var(--slate); font-size: .85rem; text-align: center; }
.prose-editor hr { height: 1px; margin: 1.6em 0; border: 0; background: var(--line); }
.prose-editor table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.prose-editor th, .prose-editor td { padding: 9px 12px; border: 1px solid var(--line); text-align: left; }
.prose-editor th { background: var(--bg); font-weight: 700; }

/* Editor en linea (titulares del home) */
.wysiwyg--inline { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.wysiwyg--inline:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(21, 87, 255, .14); }
.wysiwyg--inline .wysiwyg-toolbar { display: flex; gap: 2px; padding: 5px 6px; border-bottom: 1px solid var(--line); background: var(--bg); }
.wysiwyg--inline .wysiwyg-surface {
    padding: 11px 14px; outline: none;
    color: var(--navy); font-size: 1.05rem; font-weight: 400; font-style: normal; line-height: 1.4;
}
.wysiwyg--inline .wysiwyg-surface .title-gradient {
    background: linear-gradient(100deg, #1557FF 0%, #4C86FF 45%, #0EA5E9 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

@media (max-width: 1399.98px) {
    .builder-grid { grid-template-columns: 210px minmax(0, 1fr) 220px; }
}
@media (max-width: 1199.98px) {
    .builder-grid { grid-template-columns: 1fr; }
    .module-palette, .block-settings { position: static; height: auto; max-height: 320px; }
    .editor-stage .wysiwyg { max-height: none; }
}
@media (max-width: 575.98px) {
    .builder-toolbar { gap: 6px; padding: 6px; }
    .wysiwyg-btn { min-width: 30px; height: 30px; padding: 0 7px; }
    .editor-stage { padding: 10px; }
    .editor-stage .wysiwyg { padding: 20px 18px; }
}

/* Perfiles de autor en el panel */
.author-row { display: flex; align-items: center; gap: 11px; }
.author-row img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.author-row-initials {
    display: grid; width: 36px; height: 36px; place-items: center;
    border-radius: 50%; background: var(--accent-quiet); color: var(--blue);
    font-size: .78rem; font-weight: 800;
}
.author-row strong { display: block; }
.author-row small { display: block; color: var(--slate); font-size: .74rem; }

/* ==========================================================================
   Inicio de sesion
   Formulario a la izquierda y franja de marca a la derecha.
   ========================================================================== */

.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, .85fr);
    min-height: 100vh;
    background: var(--surface);
}

.login-main { display: flex; align-items: center; justify-content: center; padding: clamp(28px, 5vw, 56px) 20px; }
.login-card { width: min(430px, 100%); }

.login-brand { display: inline-block; margin-bottom: clamp(26px, 5vw, 42px); }
.login-brand img { width: 118px; height: auto; }

.login-card h1 { margin: 0; color: var(--navy); font-size: clamp(1.7rem, 1.4rem + 1.1vw, 2.05rem); font-weight: 800; letter-spacing: -.03em; }
.login-lead { margin: 10px 0 0; color: var(--slate); font-size: .95rem; line-height: 1.6; }

.login-alert { margin-top: 22px; padding: 13px 16px; border-radius: 10px; font-size: .88rem; font-weight: 600; }
.login-alert.is-error { border: 1px solid #FECACA; background: #FEF2F2; color: #B91C1C; }
.login-alert.is-success { border: 1px solid #BBF7D0; background: #DCFCE7; color: #15803D; }

.login-form { margin-top: 26px; }
.login-field { display: block; margin-bottom: 18px; }
.login-field > span { display: block; margin-bottom: 7px; color: var(--navy); font-size: .84rem; font-weight: 700; }
.login-field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.login-forgot { color: var(--blue); font-size: .8rem; font-weight: 600; text-decoration: none; }
.login-forgot:hover { text-decoration: underline; }

.login-field input {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--navy);
    font: inherit;
    font-size: .95rem;
    transition: border-color .16s ease, box-shadow .16s ease;
}
.login-field input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(21, 87, 255, .15); }

.login-password { position: relative; display: block; }
.login-password input { padding-right: 48px; }
.login-eye {
    position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
    display: grid; place-items: center; width: 38px; height: 38px; padding: 0;
    border: 0; border-radius: 8px; background: transparent; color: var(--slate); cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}
.login-eye:hover { background: var(--orliv-ultralight); color: var(--blue); }
.login-eye svg { display: block; }
.login-eye svg[hidden] { display: none; }

.login-submit {
    width: 100%;
    min-height: 50px;
    margin-top: 6px;
    border: 0;
    border-radius: 10px;
    background: var(--blue);
    color: #fff;
    font-size: .98rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(21, 87, 255, .24);
    transition: background-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.login-submit:hover { background: var(--orliv-hover); box-shadow: 0 14px 30px rgba(21, 87, 255, .3); }
.login-submit:active { transform: translateY(1px); }

.login-alt { margin: 20px 0 0; color: var(--slate); font-size: .9rem; text-align: center; }
.login-alt a { color: var(--blue); font-weight: 700; text-decoration: none; }
.login-alt a:hover { text-decoration: underline; }

.login-foot {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px;
    margin-top: clamp(30px, 6vw, 48px); padding-top: 20px;
    border-top: 1px solid var(--line);
}
.login-foot > a:first-child { color: var(--slate); font-size: .84rem; text-decoration: none; }
.login-foot > a:first-child:hover { color: var(--blue); }
.login-powered { display: inline-flex; align-items: center; gap: 8px; color: var(--slate); font-size: .72rem; text-decoration: none; opacity: .8; }
.login-powered img { height: 15px; width: auto; }
.login-powered:hover { opacity: 1; }

.login-aside {
    position: relative;
    display: flex; align-items: center;
    padding: clamp(32px, 5vw, 64px);
    overflow: hidden;
    background:
        radial-gradient(720px 380px at 80% 10%, rgba(21, 87, 255, .38), transparent 60%),
        linear-gradient(150deg, var(--orliv-navy) 0%, var(--orliv-dark) 100%);
    color: #fff;
}
.login-aside::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(circle at 70% 30%, #000, transparent 70%);
    -webkit-mask-image: radial-gradient(circle at 70% 30%, #000, transparent 70%);
}
.login-aside-inner { position: relative; z-index: 1; max-width: 400px; }

.login-kicker {
    display: inline-block; padding: 6px 14px; margin-bottom: 20px;
    border-radius: 999px; background: rgba(255, 255, 255, .12);
    color: #9DBBFF; font-size: .68rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
}
.login-claim { margin: 0 0 32px; color: #fff; font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem); font-weight: 800; line-height: 1.2; letter-spacing: -.03em; }

.login-highlights { display: grid; gap: 18px; margin: 0; padding: 0; list-style: none; }
.login-highlights li { display: grid; grid-template-columns: 42px 1fr; align-items: start; gap: 14px; }
.login-highlight-icon {
    display: grid; width: 42px; height: 42px; place-items: center;
    border-radius: 12px; background: rgba(255, 255, 255, .12); font-size: 1.05rem;
}
.login-highlights strong { display: block; color: #fff; font-size: .92rem; font-weight: 700; }
.login-highlights small { color: #A9BEE8; font-size: .82rem; line-height: 1.5; }

@media (max-width: 991.98px) {
    .login-shell { grid-template-columns: 1fr; }
    .login-aside { display: none; }
}

/* Textos de la pasarela de pago */
.sub-pay-intro { margin: 0 0 12px; color: var(--slate); font-size: .85rem; }
.sub-summary-facts { display: grid; gap: 10px; margin: 18px 0 0; padding: 16px 0 0; border-top: 1px solid var(--line); list-style: none; }
.sub-summary-facts li { display: grid; grid-template-columns: 18px 1fr; gap: 10px; color: var(--slate); font-size: .82rem; line-height: 1.5; }
.sub-summary-facts i { color: var(--blue); font-size: .8rem; margin-top: 3px; }
.sub-terms { align-items: flex-start; gap: 10px; line-height: 1.55; }
.sub-legal { margin-top: 12px; color: var(--slate); font-size: .8rem; line-height: 1.6; }

/* Configuración de correos */
.mail-notify-list { display: grid; gap: 10px; margin-top: 6px; }
.mail-notify {
    display: grid; grid-template-columns: 20px 1fr; align-items: start; gap: 12px;
    margin: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
}
.mail-notify input { width: 18px; height: 18px; min-height: 0; margin-top: 2px; accent-color: var(--blue); }
.mail-notify strong { display: block; color: var(--navy); font-size: .88rem; }
.mail-notify small { display: block; margin-top: 3px; color: var(--slate); font-size: .78rem; line-height: 1.5; font-weight: 400; }
.mail-notify .badge { font-style: normal; font-size: .62rem; }

.mail-log { display: grid; gap: 8px; }
.mail-log-item { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.mail-log-status { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 8px; font-size: .8rem; font-weight: 800; }
.mail-log-item.is-ok .mail-log-status { background: #DCFCE7; color: #15803D; }
.mail-log-item.is-fail .mail-log-status { background: #FEF2F2; color: #B91C1C; }
.mail-log-item strong { display: block; font-size: .82rem; }
.mail-log-item small { display: block; color: var(--slate); font-size: .74rem; }
.mail-log-error { color: #B91C1C !important; margin-top: 3px; }

/* ==========================================================================
   Navegacion de administracion en dos niveles
   ========================================================================== */

.admin-nav-group { margin-bottom: 4px; border: 0; }
.admin-nav-group > summary.admin-nav-title {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    border-radius: 9px;
    color: var(--slate);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
    list-style: none;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}
.admin-nav-group > summary::-webkit-details-marker { display: none; }
.admin-nav-group > summary:hover { background: var(--bg); color: var(--navy); }
.admin-nav-group > summary > span { flex: 1; }
.admin-nav-caret { font-size: 1rem; transition: transform .18s ease; }
.admin-nav-group[open] > summary .admin-nav-caret { transform: rotate(180deg); }
.admin-nav-group[open] > summary { color: var(--navy); }

.admin-nav-children {
    display: grid;
    gap: 2px;
    margin: 2px 0 6px 22px;
    padding-left: 10px;
    border-left: 2px solid var(--accent-quiet);
}
.admin-nav-child {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--slate);
    font-size: .78rem;
    font-weight: 600;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}
.admin-nav-child:hover { background: var(--bg); color: var(--blue); }
.admin-nav-child.active { background: var(--accent-quiet); color: var(--blue); }
.admin-nav-child i { font-size: .95rem; }

.admin-group-head { display: flex; align-items: center; gap: 14px; }
.admin-group-icon {
    display: grid;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    place-items: center;
    border-radius: 12px;
    background: var(--accent-quiet);
    color: var(--blue);
    font-size: 1.2rem;
}
.admin-card-children {
    display: block;
    margin-top: 6px;
    color: var(--blue) !important;
    font-size: .72rem !important;
    font-weight: 600;
}

.orliv-admin-menu { max-height: min(74vh, 640px); overflow-y: auto; min-width: 268px; }
.orliv-admin-menu .dropdown-divider:first-of-type { margin-top: 6px; }

/* ==========================================================================
   Editor visual del home
   Tres columnas: secciones, lienzo y ajustes. Ocupa el alto disponible y
   puede pasar a pantalla completa sobre el panel.
   ========================================================================== */

.home-editor {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 210px);
    min-height: 560px;
    margin: -6px 0 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    overflow: hidden;
}
.home-editor.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 1200;
    height: 100vh;
    margin: 0;
    border: 0;
    border-radius: 0;
}
body.home-editor-open { overflow: hidden; }

.home-editor-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
}
.home-editor-bar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.home-editor-bar-left strong { display: block; color: var(--navy); font-size: .9rem; }
.home-editor-bar-left small { display: block; color: var(--slate); font-size: .76rem; }
.home-editor-exit {
    display: grid;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    color: var(--navy);
    font-size: 1.1rem;
    text-decoration: none;
}
.home-editor-exit:hover { border-color: var(--blue); color: var(--blue); }

.home-editor-tools { display: flex; align-items: center; gap: 3px; }
.home-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 9px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--navy);
    font-size: .84rem;
    cursor: pointer;
    transition: background-color .14s ease, border-color .14s ease, color .14s ease;
}
.home-tool:hover { border-color: var(--line); background: var(--surface); }
.home-tool[aria-pressed="true"] { border-color: var(--blue); background: var(--accent-quiet); color: var(--blue); }
.home-tool-sep { width: 1px; height: 22px; margin: 0 5px; background: var(--line); }

.home-editor-bar-right { display: flex; align-items: center; gap: 10px; }
.home-editor-status { color: var(--slate); font-size: .76rem; white-space: nowrap; }
.home-editor-status.is-ok { color: var(--success); }
.home-editor-status.is-dirty { color: #B45309; font-weight: 700; }

.home-editor-body {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr) 268px;
    flex: 1;
    min-height: 0;
}

.home-editor-sections,
.home-editor-settings {
    padding: 14px;
    overflow-y: auto;
    background: var(--bg);
    scrollbar-width: thin;
}
.home-editor-sections { border-right: 1px solid var(--line); }
.home-editor-settings { border-left: 1px solid var(--line); background: var(--surface); }

.home-editor-panel-title {
    margin: 0 0 12px;
    color: var(--slate);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.home-section-list { display: grid; gap: 4px; }
.home-section-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 10px;
    border: 1px solid transparent;
    border-radius: 9px;
    transition: background-color .14s ease, border-color .14s ease;
}
.home-section-item:hover { background: var(--surface); border-color: var(--line); }
.home-section-item.is-active { background: var(--accent-quiet); border-color: var(--blue); }
.home-section-item.is-off .home-section-go { opacity: .45; text-decoration: line-through; }
.home-section-go {
    flex: 1;
    padding: 8px 0;
    border: 0;
    background: none;
    color: var(--navy);
    font-size: .82rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}
.home-section-item.is-active .home-section-go { color: var(--blue); }
.home-section-fixed { color: var(--slate); font-size: .64rem; text-transform: uppercase; letter-spacing: .06em; }

.home-section-switch { position: relative; display: inline-flex; margin: 0; cursor: pointer; }
.home-section-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.home-section-switch > span[aria-hidden] {
    display: block;
    width: 34px;
    height: 19px;
    border-radius: 999px;
    background: #CBD5E1;
    transition: background-color .16s ease;
}
.home-section-switch > span[aria-hidden]::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .3);
    transition: transform .16s ease;
}
.home-section-switch input:checked + span[aria-hidden] { background: var(--blue); }
.home-section-switch input:checked + span[aria-hidden]::after { transform: translateX(15px); }
.home-section-switch input:focus-visible + span[aria-hidden] { box-shadow: 0 0 0 3px rgba(21, 87, 255, .3); }

.home-editor-hint { margin-top: 16px; color: var(--slate); font-size: .74rem; line-height: 1.6; }

.home-editor-stage {
    display: flex;
    justify-content: center;
    padding: 16px;
    background: #E9EEF6;
    overflow: hidden;
}
.home-editor-frame-wrap {
    flex: 0 1 100%;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 6px 24px rgba(15, 23, 42, .12);
    overflow: hidden;
    transition: width .22s ease;
}
.home-editor-stage[data-device="tablet"] .home-editor-frame-wrap { max-width: 820px; }
.home-editor-stage[data-device="mobile"] .home-editor-frame-wrap { max-width: 390px; }
.home-editor-frame { display: block; width: 100%; height: 100%; border: 0; }

.home-editor-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 190px;
    padding: 20px 10px;
    color: var(--slate);
    text-align: center;
}
.home-editor-empty > span {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    margin-bottom: 10px;
    border-radius: 12px;
    background: var(--accent-quiet);
    color: var(--blue);
    font-size: 1.25rem;
}
.home-editor-empty strong { color: var(--navy); font-size: .82rem; }
.home-editor-empty p { margin: 6px 0 0; font-size: .72rem; line-height: 1.55; }

.home-settings-group h3 {
    margin: 0 0 10px;
    color: var(--navy);
    font-size: .84rem;
    font-weight: 800;
}
.home-settings-field { display: block; margin-bottom: 12px; }
.home-settings-field > span {
    display: block;
    margin-bottom: 5px;
    color: var(--slate);
    font-size: .74rem;
    font-weight: 600;
}
.home-settings-field input,
.home-settings-field select,
.home-settings-field textarea {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    font: inherit;
    font-size: .8rem;
}
.home-settings-field textarea { min-height: 90px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .74rem; line-height: 1.55; }
.home-settings-field input:focus,
.home-settings-field select:focus,
.home-settings-field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(21, 87, 255, .14); }
.home-settings-check {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-bottom: 12px;
    color: var(--navy);
    font-size: .78rem;
    line-height: 1.5;
}
.home-settings-check input { width: 17px; height: 17px; min-height: 0; margin-top: 2px; accent-color: var(--blue); }

@media (max-width: 1199.98px) {
    .home-editor-body { grid-template-columns: 200px minmax(0, 1fr); }
    .home-editor-settings { display: none; }
    .home-editor.is-fullscreen .home-editor-settings { display: block; }
}
@media (max-width: 767.98px) {
    .home-editor { height: auto; min-height: 0; }
    .home-editor-body { grid-template-columns: 1fr; }
    .home-editor-sections { border-right: 0; border-bottom: 1px solid var(--line); }
    .home-editor-stage { height: 70vh; }
    .home-editor-tools { order: 3; width: 100%; overflow-x: auto; }
}

/* ==========================================================================
   Versionado automatico de deploys
   ========================================================================== */

.version-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--accent-quiet);
    color: var(--blue);
    font-size: .82rem;
    font-weight: 800;
    letter-spacing: -.01em;
    white-space: nowrap;
}

.deploy-form > .form-hint { margin: 0 0 14px; }

.deploy-levels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
}
.deploy-level {
    display: block;
    margin: 0;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.deploy-level:hover { border-color: var(--blue); background: var(--orliv-ultralight); }
.deploy-level input { position: absolute; opacity: 0; width: 0; height: 0; }
.deploy-level strong {
    display: block;
    color: var(--navy);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -.02em;
}
.deploy-level small {
    display: block;
    margin-top: 4px;
    color: var(--slate);
    font-size: .76rem;
    line-height: 1.45;
}
.deploy-level:has(input:checked) {
    border-color: var(--blue);
    background: var(--accent-quiet);
    box-shadow: 0 0 0 3px rgba(21, 87, 255, .12);
}
.deploy-level:has(input:checked) strong { color: var(--blue); }
.deploy-level:focus-within { box-shadow: 0 0 0 3px rgba(21, 87, 255, .2); }

.deploy-manual { margin-top: 16px; }
.deploy-manual > summary {
    color: var(--slate);
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}
.deploy-manual > summary::-webkit-details-marker { display: none; }
.deploy-manual > summary::before { content: "\203A"; margin-right: 7px; transition: transform .15s ease; display: inline-block; }
.deploy-manual[open] > summary::before { transform: rotate(90deg); }
.deploy-manual[open] > summary { color: var(--navy); }
.deploy-manual label { max-width: 320px; margin-top: 10px; }

/* Editor QR: selector de tipo integrado y controles de estilo. */
.qr-editor-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: visible;
}
.qr-type-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 250px;
    padding: 4px 8px 4px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--blue);
}
.qr-type-menu > i { font-size: 1rem; }
.qr-type-menu label {
    display: grid;
    flex: 1;
    gap: 1px;
    margin: 0;
}
.qr-type-menu label > span {
    color: var(--slate);
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.qr-type-menu select {
    width: 100%;
    min-height: 26px;
    padding: 0 26px 0 0;
    border: 0;
    background-color: transparent;
    color: var(--navy);
    font-size: .78rem;
    font-weight: 800;
    box-shadow: none;
}
.qr-type-menu select:focus { outline: 0; box-shadow: none; }
.qr-tabs-divider { width: 1px; height: 30px; margin: 0 4px; background: var(--line); }
.qr-content-fields > [data-qr-content-type][hidden] { display: none; }
.qr-inline-check { display: flex; align-items: center; gap: 9px; min-height: 42px; }
.qr-inline-check input { width: 18px; min-height: 18px; margin: 0; }
.qr-style-section { margin-bottom: 22px; }
.qr-style-section h3 { margin: 0 0 10px; font-size: .82rem; }
.qr-style-options { display: flex; flex-wrap: wrap; gap: 10px; }
.qr-style-choice,
.qr-corner-choice {
    position: relative;
    display: grid;
    gap: 6px;
    margin: 0;
    cursor: pointer;
}
.qr-style-choice input,
.qr-corner-choice input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}
.qr-style-choice > span,
.qr-corner-choice > span {
    display: grid;
    place-items: center;
    width: 68px;
    height: 68px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.qr-corner-choice > span { width: 52px; height: 52px; }
.qr-style-choice input:checked + span,
.qr-corner-choice input:checked + span {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(21, 87, 255, .13);
    transform: translateY(-1px);
}
.qr-style-choice small,
.qr-corner-choice small { color: var(--slate); font-size: .68rem; text-align: center; }
.qr-style-sample {
    grid-template-columns: repeat(3, 9px);
    grid-template-rows: repeat(3, 9px);
    gap: 3px;
}
.qr-style-sample i { width: 9px; height: 9px; background: var(--navy); }
.qr-style-sample--rounded i { border-radius: 3px; }
.qr-style-sample--dots i { border-radius: 50%; }
.qr-corner-sample i {
    width: 27px;
    height: 27px;
    border: 6px solid var(--navy);
    box-shadow: inset 0 0 0 4px var(--surface);
    background: var(--navy);
}
.qr-corner-sample--rounded i { border-radius: 8px; }
@media (max-width: 767.98px) {
    .qr-editor-tabs { align-items: stretch; flex-wrap: wrap; }
    .qr-type-menu { width: 100%; min-width: 0; }
    .qr-tabs-divider { display: none; }
}

/* ========================================================================== 
   Analítica global de superadministración
   ========================================================================== */
.admin-analytics-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}
.admin-analytics-head h2 { margin: 5px 0 6px; font-size: 1.45rem; }
.admin-analytics-head p { max-width: 760px; margin: 0; color: var(--muted); }
.global-analytics-toolbar { display: block; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.global-analytics-filter {
    display: grid;
    grid-template-columns: minmax(250px, 1.6fr) repeat(5, minmax(132px, .7fr)) auto;
    gap: 12px;
    align-items: end;
}
.global-analytics-filter label { min-width: 0; margin: 0; }
.global-analytics-filter .global-search { width: auto; }
.global-analytics-filter .compact-filter { display: grid; gap: 6px; }
.global-analytics-filter .compact-filter > span { color: var(--muted); font-size: .67rem; font-weight: 700; }
.global-analytics-filter input,
.global-analytics-filter select { width: 100%; min-height: 44px; }
.global-analytics-filter .resource-filter-actions { display: flex; gap: 8px; }
.global-analytics-filter .btn { min-height: 44px; white-space: nowrap; }
.global-filter-summary { display: flex; align-items: center; gap: 7px; margin: -4px 0 16px; color: var(--muted); font-size: .73rem; }
.global-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 18px 0 10px; }
.global-section-heading h2 { margin: 0; font-size: 1rem; }
.global-section-heading p { margin: 3px 0 0; color: var(--muted); font-size: .72rem; }
.global-inventory-stats { margin-bottom: 22px; }
.global-inventory-stats small { display: block; margin-top: 7px; color: var(--muted); font-size: .67rem; }
.global-analytics-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.global-analytics-stats article { position: relative; overflow: hidden; }
.global-analytics-stats article::before { position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--blue); content: ""; }
.global-analytics-stats small { display: block; margin-top: 7px; color: var(--muted); font-size: .67rem; }
.global-analytics-chart-panel { margin-bottom: 20px; }
.global-chart-shell { height: clamp(240px, 30vw, 340px); }
.global-analytics-two-column { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); gap: 20px; align-items: start; }
.global-analytics-two-column > .panel { min-width: 0; }
.global-ranking-list { display: grid; }
.global-ranking-list article { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.global-ranking-list article:last-child { border-bottom: 0; }
.global-ranking-list article small { display: block; margin-top: 3px; color: var(--muted); font-size: .68rem; }
.global-rank-number { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-quiet); color: var(--blue); font-size: .7rem; font-weight: 800; }
.global-rank-value { text-align: right; }
.global-rank-value strong { font-size: 1rem; }
.global-breakdown-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.global-breakdown-card { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); }
.global-breakdown-card h3 { margin: 0 0 8px; font-size: .76rem; }
.global-breakdown-card > div { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(148, 163, 184, .2); font-size: .69rem; }
.global-breakdown-card > div:last-child { border-bottom: 0; }
.global-breakdown-card span { min-width: 0; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.global-breakdown-card strong { flex: 0 0 auto; }
.global-breakdown-card p { margin: 0; color: var(--muted); font-size: .7rem; }
.global-analytics-table table { min-width: 1120px; }
.global-event-table table { min-width: 1140px; }
.global-analytics-pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 18px; }
.global-analytics-pagination a,
.global-analytics-pagination span { display: inline-grid; place-items: center; min-width: 42px; min-height: 42px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--slate); font-size: .72rem; font-weight: 700; }
.global-analytics-pagination span[aria-current="page"] { border-color: var(--blue); background: var(--blue); color: #fff; }
.empty-state.compact { min-height: 180px; padding: 28px 18px; }
.empty-state.compact i { font-size: 1.8rem; }
.empty-state.compact h3 { margin: 8px 0 4px; font-size: 1rem; }
.empty-state.compact p { margin: 0; }

@media (max-width: 1399.98px) {
    .global-analytics-filter { grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(140px, 1fr)); }
    .global-analytics-filter .resource-filter-actions { grid-column: span 2; }
}
@media (max-width: 991.98px) {
    .global-analytics-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .global-analytics-filter .global-search { grid-column: 1 / -1; }
    .global-analytics-filter .resource-filter-actions { grid-column: 1 / -1; }
    .global-analytics-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .global-analytics-two-column { grid-template-columns: 1fr; }
}
@media (max-width: 575.98px) {
    .admin-analytics-head { flex-direction: column; }
    .admin-analytics-head .btn { width: 100%; min-height: 44px; }
    .global-analytics-filter { grid-template-columns: 1fr; }
    .global-analytics-filter .global-search,
    .global-analytics-filter .resource-filter-actions { grid-column: auto; }
    .global-analytics-filter .resource-filter-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .global-analytics-filter .btn { width: 100%; padding-inline: 10px; }
    .global-analytics-stats { grid-template-columns: 1fr; }
    .global-breakdown-grid { grid-template-columns: 1fr; }
    .global-ranking-list article { grid-template-columns: 28px minmax(0, 1fr); }
    .global-rank-value { grid-column: 2; text-align: left; }
}
