/* Tribuno 1.1.79
 * Ajustes de compatibilidad cargados después de 1.1.78.
 * No reemplaza app.css, tribuno.css ni los estilos que ya funcionan.
 */

/* --------------------------------------------------------------------------
   1) Submenús: interacción real y áreas clickeables
   -------------------------------------------------------------------------- */
.sidebar .sidebar-nav,
.sidebar .nav-group,
.sidebar .nav-group-toggle,
.sidebar .nav-submenu,
.sidebar .nav-submenu .nav-subitem {
    pointer-events: auto !important;
}

.sidebar .nav-group {
    position: relative;
    isolation: isolate;
}

.sidebar .nav-group-toggle {
    position: relative;
    z-index: 3;
}

.sidebar .nav-submenu {
    position: relative;
    z-index: 2;
}

.sidebar .nav-group.open > .nav-submenu {
    overflow: visible;
}

.sidebar .nav-submenu::before {
    z-index: 0;
}

.sidebar .nav-submenu .nav-subitem {
    position: relative;
    z-index: 2;
    cursor: pointer !important;
    user-select: none;
}

.sidebar .nav-submenu .nav-subitem-label {
    pointer-events: none;
}

/* El logo queda limpio, sin el subtítulo eliminado en 1.1.79. */
.sidebar .sidebar-brand {
    padding-bottom: 1rem;
}

/* --------------------------------------------------------------------------
   2) Dropzones: cada línea del texto ocupa su propia fila
   -------------------------------------------------------------------------- */
.file-dropzone > strong,
.file-dropzone > small,
.file-dropzone > .file-dropzone-name,
.friendly-file-upload > .friendly-file-upload-title,
.friendly-file-upload > .friendly-file-upload-hint,
.friendly-file-upload > .friendly-file-upload-name {
    display: block !important;
    width: 100% !important;
    flex: 0 0 auto !important;
    text-align: center !important;
}

.file-dropzone > small,
.friendly-file-upload > .friendly-file-upload-hint {
    margin-top: .05rem;
}

/* --------------------------------------------------------------------------
   3) Configuración PDF: vista previa, carga y colores HTML
   -------------------------------------------------------------------------- */
.pdf-asset-group {
    min-width: 0;
}

.pdf-asset-row {
    display: grid;
    grid-template-columns: minmax(145px, .7fr) minmax(240px, 1.3fr);
    gap: .9rem;
    align-items: stretch;
}

.pdf-asset-preview {
    position: relative;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .85rem;
    overflow: hidden;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    background: #fff;
    color: #94a3b8;
}

.pdf-watermark-preview {
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #f1f5f9 25%, transparent 25%),
        linear-gradient(-45deg, #f1f5f9 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f1f5f9 75%),
        linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
    background-size: 18px 18px;
    background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}

.pdf-asset-preview img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 128px;
    object-fit: contain;
}

.pdf-watermark-preview img {
    opacity: .78;
}

.pdf-asset-preview > .material-symbols-rounded {
    font-size: 42px;
}

.pdf-asset-dropzone {
    min-height: 150px;
    margin: 0;
}

.html-color-field {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: .65rem;
    align-items: center;
}

.html-color-picker {
    display: block;
    width: 54px;
    height: 42px;
    min-width: 54px;
    padding: 3px;
    border: 1px solid #d7e0ea;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

.html-color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.html-color-picker::-webkit-color-swatch {
    border: 0;
    border-radius: 5px;
}

.html-color-picker::-moz-color-swatch {
    border: 0;
    border-radius: 5px;
}

.html-color-value {
    min-width: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 650;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.acteco-readonly {
    background: #f8fafc !important;
    color: #334155;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 650;
}

/* --------------------------------------------------------------------------
   4) Catálogo de actividades económicas SII
   -------------------------------------------------------------------------- */
.economic-activity-shell {
    position: relative;
    z-index: 20;
}

.economic-activity-results {
    position: absolute;
    top: calc(100% - 1.05rem);
    left: 0;
    right: 0;
    z-index: 1200;
    max-height: 330px;
    overflow-y: auto;
    padding: .35rem;
    border: 1px solid #cfd9e5;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 16px 34px rgba(15, 23, 42, .16);
}

.economic-activity-results[hidden] {
    display: none !important;
}

.economic-activity-option {
    width: 100%;
    display: grid;
    gap: .18rem;
    padding: .65rem .7rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #1e293b;
    text-align: left;
    cursor: pointer;
}

.economic-activity-option:hover,
.economic-activity-option.is-active {
    background: #edf9fb;
}

.economic-activity-option-main {
    display: flex;
    gap: .55rem;
    align-items: flex-start;
    min-width: 0;
}

.economic-activity-option-main strong {
    flex: 0 0 auto;
    color: var(--fp-teal-dark, #0d7f8d);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: .79rem;
}

.economic-activity-option-main span {
    min-width: 0;
    color: #1e293b;
    font-size: .83rem;
    font-weight: 600;
    line-height: 1.35;
}

.economic-activity-option small {
    padding-left: 4.75rem;
    color: #64748b;
    font-size: .72rem;
    line-height: 1.3;
}

.economic-activity-empty {
    padding: .8rem;
    color: #64748b;
    font-size: .82rem;
    text-align: center;
}

.economic-activity-empty.is-error {
    color: #b42318;
}

@media (max-width: 760px) {
    .pdf-asset-row {
        grid-template-columns: 1fr;
    }

    .pdf-asset-preview,
    .pdf-asset-dropzone {
        min-height: 128px;
    }

    .economic-activity-results {
        position: fixed;
        top: auto;
        right: 1rem;
        bottom: 1rem;
        left: 1rem;
        max-height: min(55vh, 390px);
    }

    .economic-activity-option small {
        padding-left: 0;
    }
}
