.expanded-text-editor {
    position: fixed;
    inset: 0;
    z-index: 30000;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: #fff;
    color: var(--text, #062747);
    font-family: "Segoe UI", Arial, sans-serif;
}

.expanded-text-toolbar {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: minmax(11rem, 1fr) auto;
    align-items: center;
    gap: .75rem 1rem;
    padding: 14px 20px;
    border-bottom: 1px solid #aacfe4;
    background: #d8edf8;
    color: var(--navy, #003b78);
}

.expanded-text-editor > .expanded-text-toolbar {
    background: #d8edf8;
    color: var(--navy, #003b78);
}

.expanded-text-title {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.expanded-text-title span {
    color: #075ca8;
    font-size: .74rem;
    font-weight: 700;
    text-transform: uppercase;
}

.expanded-text-title strong {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.expanded-text-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.expanded-text-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: .5rem;
}

.expanded-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-sizing: border-box;
    height: 40px;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid;
    border-radius: 5px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
}

.expanded-action:disabled {
    cursor: default;
    opacity: .5;
}

.expanded-action svg { flex: 0 0 18px; width: 18px; height: 18px; }
.expanded-action:hover:not(:disabled) { filter: brightness(.97); }
.expanded-action:focus-visible { outline: 2px solid #075ca8; outline-offset: 2px; }
.expanded-text-controls > .boton-ayuda-app {
    position: static;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    min-height: 40px;
    margin: 0;
    padding: 3px;
    border: 1px solid #adc5db;
    border-radius: 5px;
    background: #e8f6ff;
}
.expanded-action.is-listening {
    outline: 2px solid #d5b600;
    outline-offset: 2px;
}

.expanded-clear-confirmation {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: .6rem;
    padding: 10px 12px;
    border: 1px solid #e4b365;
    border-radius: 6px;
    background: #fff1d6;
    color: #8d580d;
    font-size: 14px;
}

.expanded-clear-confirmation strong {
    margin-right: auto;
}

.expanded-language-picker {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto minmax(12rem, 1fr) auto auto;
    align-items: center;
    gap: .55rem;
    padding: 12px;
    border: 1px solid #bfd8e8;
    border-radius: 6px;
    background: #f5faff;
    font-size: 14px;
}

.expanded-language-picker label {
    margin: 0;
    font-weight: 600;
}

.expanded-language-picker .form-control {
    min-width: 0;
    height: 40px;
    padding: 8px 10px;
    border: 1px solid #adc5db;
    border-radius: 5px;
    background: #fff;
    color: var(--text, #062747);
    font: inherit;
}

.expanded-text-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    gap: .6rem;
    padding: 16px 20px 20px;
}

.expanded-text-area {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 0;
    padding: 1rem;
    border: 1px solid #adc5db;
    border-radius: 6px;
    background: #fff;
    color: var(--text, #062747);
    font: inherit;
    font-size: 16px;
    line-height: 1.55;
    resize: none;
}

.expanded-text-area:focus {
    border-color: #2674a9;
    outline: 2px solid rgba(23, 120, 200, .16);
    outline-offset: 1px;
}

.expanded-text-message {
    flex: 0 0 auto;
    padding: 10px 12px;
    border: 1px solid #bdd8e9;
    border-radius: 5px;
    background: #edf7fd;
    color: #164b70;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.expanded-text-message.is-error {
    border-color: #e8b8bf;
    background: #fde7e9;
    color: #8d1722;
}

body:has(.expanded-text-editor) {
    overflow: hidden;
}

@media (max-width: 1000px) {
    .expanded-text-toolbar {
        grid-template-columns: minmax(0, 1fr) 40px;
        gap: 12px;
    }

    .expanded-text-controls { display: contents; }
    .expanded-text-controls > .boton-ayuda-app { grid-column: 2; grid-row: 1; }
    .expanded-text-actions {
        grid-column: 1 / -1;
        grid-row: 2;
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .expanded-action {
        width: 100%;
        padding-inline: .35rem;
    }

    .expanded-language-picker {
        grid-column: 1 / -1;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .expanded-language-picker label,
    .expanded-language-picker select {
        grid-column: 1 / -1;
    }

}

.expanded-text-backdrop{position:fixed;inset:0;z-index:30000;display:flex;align-items:center;justify-content:center;background:#12344f66;padding:20px}
.expanded-text-backdrop .expanded-text-editor{position:relative;inset:auto;z-index:auto;width:min(1200px,100%);height:min(820px,calc(100dvh - 40px));border:1px solid #aac9dd;border-radius:10px;overflow:hidden;box-shadow:0 16px 45px #13334b40}
@media(max-width:640px){
    .expanded-text-backdrop{padding:8px}
    .expanded-text-backdrop .expanded-text-editor{height:calc(100dvh - 16px);max-height:900px}
    .expanded-text-toolbar{padding:12px;gap:10px}
    .expanded-text-actions{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
    .expanded-text-body{padding:12px}
    .expanded-text-area{padding:12px}
    .expanded-clear-confirmation{justify-content:stretch}
    .expanded-clear-confirmation strong{flex-basis:100%}
}
@media(max-height:500px){
    .expanded-text-backdrop .expanded-text-editor{overflow:auto}
    .expanded-text-body{min-height:180px;flex-shrink:0}
}
