.tlj-ai-page {
    width: 100%;
    min-height: calc(100vh - 80px);
    padding: 0;
    background: var(--tlj-color-page);
    color: var(--tlj-color-text);
    font-family: inherit;
}

.tlj-ai-page,
.tlj-ai-page *,
.tlj-ai-page *::before,
.tlj-ai-page *::after {
    box-sizing: border-box;
}

.tlj-ai-page :is(button:not(.tlj-modal-action), textarea, input) {
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
}

.tlj-ai-page :is(button:not(.tlj-modal-action), a, textarea, input):focus {
    outline: none;
}
.tlj-ai-shell {
    width: min(100%, 1460px);
    margin: 0 auto;
    padding: 64px 30px 110px;
}

.tlj-ai-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 38px;
    align-items: end;
    margin-bottom: 24px;
    padding: 0 2px;
}

.tlj-ai-chat-head h2,
.tlj-ai-side-title h2,
.tlj-ai-welcome h3,
.tlj-ai-gate-card h1 {
    margin: 0 !important;
    color: var(--tlj-color-text) !important;
    font-family: inherit;
}

.tlj-ai-context {
    --tlj-custom-select-max-height: none;
    --tlj-custom-select-overflow: visible;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(240px, .92fr);
    gap: 12px;
    margin-bottom: 16px;
    padding: 14px;
    border: 1px solid rgba(var(--tlj-color-accent-rgb), .28);
    border-radius: 14px;
    background: rgba(var(--tlj-color-page-rgb), .82);
    box-shadow: 0 14px 34px rgba(var(--tlj-color-shadow-rgb), .12);
}

.tlj-ai-context label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.tlj-ai-context label > span {
    color: var(--tlj-color-accent);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 1.15px;
    text-transform: uppercase;
}

.tlj-ai-context-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    height: 44px;
    min-height: 44px;
    align-self: end;
    padding: 0 14px;
    border: 1px solid rgba(var(--tlj-color-accent-rgb), .30);
    border-radius: 8px;
    background: rgba(var(--tlj-color-accent-rgb), .07);
    color: var(--tlj-color-text-secondary);
    font-size: 13.5px;
    font-weight: 400;
    line-height: 1.2;
    text-align: center;
}

.tlj-ai-context-status > span {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: var(--tlj-color-accent);
    box-shadow: 0 0 0 4px rgba(var(--tlj-color-accent-rgb), .09);
    animation: tljPageHeaderPulse 3s ease-in-out infinite;
}

.tlj-ai-context-status strong {
    font-size: 13.5px;
    font-weight: 850;
    line-height: 1.2;
}

.tlj-ai-layout {
    display: grid;
    grid-template-columns: 295px minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
}

.tlj-ai-sidebar,
.tlj-ai-chat {
    border: 1px solid var(--tlj-color-border-strong);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(var(--tlj-color-contrast-rgb), .015), transparent 18%), var(--tlj-color-surface);
    box-shadow: 0 18px 42px rgba(var(--tlj-color-shadow-rgb), .14);
}

.tlj-ai-sidebar {
    display: flex;
    min-height: 0;
    flex-direction: column;
    gap: 20px;
    padding: 14px;
}

.tlj-ai-new {
    display: flex;
    width: 100%;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--tlj-color-accent);
    border-radius: 8px;
    background: transparent;
    color: var(--tlj-color-accent);
    font-size: 11.5px;
    font-weight: 850;
    line-height: 1;
    cursor: pointer;
    transition: border-color .25s ease, background-color .25s ease, color .25s ease, transform .25s ease;
}

.tlj-ai-new:hover,
.tlj-ai-new:focus,
.tlj-ai-new:focus-visible {
    border-color: var(--tlj-color-accent);
    background: rgba(var(--tlj-color-accent-rgb), .09);
    color: var(--tlj-color-accent);
    transform: translateY(-1px);
}

.tlj-ai-new > span {
    color: var(--tlj-color-accent);
    font-size: 18px;
}

.tlj-ai-side-title small {
    display: block;
    margin-bottom: 6px;
    color: var(--tlj-color-accent);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 1.15px;
    text-transform: uppercase;
}

.tlj-ai-side-title h2 {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -.35px;
}

.tlj-ai-usage {
    padding: 4px 0 16px;
    border-bottom: 1px solid var(--tlj-color-divider);
}

.tlj-ai-usage-row > div:first-child:not(.tlj-ai-usage-summary) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.tlj-ai-usage-row span {
    color: var(--tlj-color-text-muted);
    font-size: 11.5px;
    font-weight: 700;
}

.tlj-ai-usage-row strong {
    color: var(--tlj-color-text-secondary);
    font-size: 11.5px;
}

.tlj-ai-usage-bar {
    height: 6px;
    margin-top: 9px;
    overflow: hidden;
    border: 1px solid rgba(var(--tlj-color-accent-rgb), .08);
    border-radius: 999px;
    background: var(--tlj-color-surface-3);
}

.tlj-ai-usage-bar i {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(var(--tlj-color-accent-rgb), .72), var(--tlj-color-accent));
    transition: width .3s ease;
}

.tlj-ai-history {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
}

.tlj-ai-history-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
}

.tlj-ai-history-clear {
    display: inline-flex;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--tlj-color-text-muted-2);
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}

.tlj-ai-history-clear:hover:not(:disabled),
.tlj-ai-history-clear:focus-visible:not(:disabled) {
    border-color: var(--tlj-color-negative-hover-border);
    background: var(--tlj-color-negative-hover-bg);
    color: var(--tlj-color-negative-text);
}

.tlj-ai-history-clear:disabled {
    opacity: .32;
    cursor: default;
}

.tlj-ai-history-clear svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tlj-ai-history-tools {
    margin-top: 10px;
}

.tlj-ai-history-search {
    position: relative;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    gap: 7px;
    align-items: center;
    min-height: 36px;
    padding: 0 8px;
    border: 1px solid var(--tlj-color-border);
    border-radius: 8px;
    background: var(--tlj-color-input-bg);
    color: var(--tlj-color-text-muted-2);
    transition: border-color .2s ease, background-color .2s ease;
}

.tlj-ai-history-search:focus-within {
    border-color: rgba(var(--tlj-color-accent-rgb), .6);
    background: var(--tlj-color-surface);
}

.tlj-ai-history-search svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

.tlj-ai-history-search input {
    width: 100%;
    min-width: 0;
    height: 34px;
    padding: 0;
    border: 0 !important;
    background: transparent !important;
    color: var(--tlj-color-text-secondary);
    font-size: 10.5px;
    font-weight: 650;
    outline: 0 !important;
}

.tlj-ai-history-search input::placeholder {
    color: var(--tlj-color-text-muted-2);
}

.tlj-ai-history-count {
    min-width: 18px;
    color: var(--tlj-color-text-muted-2);
    font-size: 10.5px;
    font-weight: 900;
    text-align: right;
}

.tlj-ai-history-list {
    min-height: 0;
    max-height: 458px;
    margin-top: 10px;
    overflow-y: auto;
    overflow-x: hidden;
}

.tlj-ai-history-item {
    display: block;
    width: 100%;
    margin: 0 0 6px;
    padding: 10px 11px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--tlj-color-text-muted);
    cursor: pointer;
    text-align: left;
    transition: border-color .25s ease, background-color .25s ease, color .25s ease, transform .25s ease;
}

.tlj-ai-history-item:hover,
.tlj-ai-history-item.is-active {
    border-color: rgba(var(--tlj-color-accent-rgb), .28);
    background: rgba(var(--tlj-color-accent-rgb), .065);
    color: var(--tlj-color-text);
    transform: translateY(-1px);
}

.tlj-ai-history-item strong {
    display: block;
    overflow: hidden;
    font-size: 12px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tlj-ai-history-item span {
    display: block;
    margin-top: 4px;
    color: var(--tlj-color-text-muted-2);
    font-size: 10px;
}

.tlj-ai-history-empty {
    padding: 12px 4px;
    color: var(--tlj-color-text-muted-2);
    font-size: 11px;
    line-height: 1.6;
}

/* Columna flexible: si el historial alarga la fila, crece la zona de mensajes y no la cabecera. */
.tlj-ai-chat {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
}

.tlj-ai-chat-head {
    display: flex;
    min-height: 72px;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 14px 18px;
    border-bottom: 0;
    background:
        linear-gradient(
            90deg,
            transparent 0%,
            rgba(var(--tlj-color-accent-rgb), .35) 15%,
            var(--tlj-color-accent) 50%,
            rgba(var(--tlj-color-accent-rgb), .35) 85%,
            transparent 100%
        ) bottom 0 left 34px / calc(100% - 68px) 1px no-repeat,
        color-mix(in srgb, var(--tlj-color-surface-2) 88%, var(--tlj-color-accent) 12%);
}

.tlj-ai-chat-head h2 {
    font-size: 30px;
    font-weight: 900;
    letter-spacing: -.65px;
}

.tlj-ai-active-context {
    display: flex;
    min-height: 48px;
    align-items: center;
    gap: 12px;
    padding: 9px 18px;
    border-bottom: 1px solid var(--tlj-color-divider);
    background: rgba(var(--tlj-color-accent-rgb), .035);
}

.tlj-ai-active-context__label {
    flex: 0 0 auto;
    color: var(--tlj-color-accent);
    font-size: 9.5px;
    font-weight: 900;
    letter-spacing: 1.1px;
    text-transform: uppercase;
}

.tlj-ai-active-context__items {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.tlj-ai-active-context__items span {
    display: inline-flex;
    min-height: 26px;
    align-items: center;
    padding: 0 9px;
    border: 1px solid rgba(var(--tlj-color-accent-rgb), .22);
    border-radius: 999px;
    background: var(--tlj-color-surface);
    color: var(--tlj-color-text-secondary);
    font-size: 10px;
    font-weight: 800;
    line-height: 1.2;
}

.tlj-ai-message-bubble .tlj-ai-message-line {
    display: block;
    margin: 4px 0;
    line-height: 1.62;
}

.tlj-ai-message-bubble .tlj-ai-message-line strong {
    color: inherit;
    font-weight: 800;
}

.tlj-ai-message-bubble .tlj-ai-message-bullet {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr);
    align-items: start;
    gap: 7px;
}

.tlj-ai-message-bubble .tlj-ai-message-bullet-marker {
    display: block;
    color: var(--tlj-color-accent);
    font-weight: 900;
    line-height: 1.62;
}

.tlj-ai-message-bubble .tlj-ai-message-section-title {
    display: block;
    margin: 16px 0 7px;
    color: var(--tlj-color-accent);
    font-size: 1.02em;
    font-weight: 900;
    line-height: 1.35;
}

.tlj-ai-message-bubble .tlj-ai-message-section-title:first-child {
    margin-top: 0;
}

.tlj-ai-message--assistant.tlj-ai-message--visual .tlj-ai-message-bubble {
    width: min(100%, 1260px);
    max-width: min(100%, 1260px);
}

.tlj-ai-visualization {
    display: grid;
    gap: 12px;
    margin-top: 18px;
    padding-top: 15px;
    border-top: 1px solid var(--tlj-color-divider);
    white-space: normal;
}

.tlj-ai-visualization-end {
    display: block;
    width: 100%;
    height: 0;
    overflow: hidden;
    line-height: 0;
}

.tlj-ai-visualization-title {
    color: var(--tlj-color-accent);
    font-size: 11px;
    font-weight: 950;
    letter-spacing: .02em;
    line-height: 1.35;
}

.tlj-ai-visualization-note {
    margin: -5px 0 0;
    color: var(--tlj-color-text-muted);
    font-size: 10.5px;
    font-weight: 650;
    line-height: 1.45;
}

.tlj-ai-viz-table-scroll {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--tlj-color-border);
    border-radius: 9px;
    background: var(--tlj-color-surface);
}

.tlj-ai-viz-table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    table-layout: auto;
    color: var(--tlj-color-text-secondary);
    font-size: 9.8px;
    line-height: 1.35;
    white-space: normal;
}

.tlj-ai-viz-table caption {
    padding: 9px 11px;
    border-bottom: 1px solid var(--tlj-color-divider);
    color: var(--tlj-color-text);
    font-size: 10.5px;
    font-weight: 900;
    text-align: left;
}

.tlj-ai-viz-table th,
.tlj-ai-viz-table td {
    padding: 5px 5px;
    border-bottom: 1px solid var(--tlj-color-divider);
    text-align: left;
    vertical-align: top;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
}

.tlj-ai-viz-table td:first-child {
    min-width: 0;
    max-width: 230px;
    overflow-wrap: break-word;
}

.tlj-ai-viz-table--compact {
    width: 100%;
    min-width: 0;
}

.tlj-ai-viz-table--wide {
    width: 100%;
    min-width: 720px;
}

.tlj-ai-viz-table--compact th,
.tlj-ai-viz-table--compact td {
    padding-right: 4px;
    padding-left: 4px;
}

.tlj-ai-viz-table th {
    background: rgba(var(--tlj-color-accent-rgb), .07);
    color: var(--tlj-color-accent);
    font-size: 9.5px;
    font-weight: 900;
    white-space: normal;
    overflow-wrap: break-word;
}

.tlj-ai-viz-table tbody tr:last-child td {
    border-bottom: 0;
}

.tlj-ai-viz-table tbody tr:hover td {
    background: rgba(var(--tlj-color-accent-rgb), .045);
}

.tlj-ai-viz-table .tlj-ai-viz-number {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.tlj-ai-viz-chart {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 11px;
    border: 1px solid var(--tlj-color-border);
    border-radius: 9px;
    background: var(--tlj-color-surface);
}

.tlj-ai-viz-chart figcaption {
    color: var(--tlj-color-text);
    font-size: 10.5px;
    font-weight: 900;
    line-height: 1.35;
}

.tlj-ai-viz-chart-list {
    display: grid;
    gap: 7px;
}

.tlj-ai-viz-chart-row {
    display: grid;
    grid-template-columns: minmax(92px, 1.25fr) minmax(150px, 3fr) minmax(92px, auto);
    gap: 9px;
    align-items: center;
    min-height: 24px;
}

.tlj-ai-viz-chart-label {
    min-width: 0;
    overflow: hidden;
    color: var(--tlj-color-text-secondary);
    font-size: 9.5px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tlj-ai-viz-chart-value {
    color: var(--tlj-color-text-secondary);
    font-size: 9.5px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.tlj-ai-viz-chart-track {
    position: relative;
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--tlj-color-surface-3);
}

.tlj-ai-viz-chart-zero {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--tlj-color-border-strong);
    pointer-events: none;
}

.tlj-ai-viz-chart-bar {
    position: absolute;
    top: 1px;
    bottom: 1px;
    border-radius: 999px;
    background: var(--tlj-color-accent);
    min-width: 2px;
}

.tlj-ai-viz-chart-row.is-negative .tlj-ai-viz-chart-bar {
    background: var(--tlj-color-negative-text);
}

.tlj-ai-viz-chart--mixed .tlj-ai-viz-chart-zero {
    left: 50%;
}

.tlj-ai-viz-chart--mixed .tlj-ai-viz-chart-row.is-positive .tlj-ai-viz-chart-bar {
    left: 50%;
    width: calc(var(--tlj-ai-viz-ratio) * 50%);
}

.tlj-ai-viz-chart--mixed .tlj-ai-viz-chart-row.is-negative .tlj-ai-viz-chart-bar {
    right: 50%;
    width: calc(var(--tlj-ai-viz-ratio) * 50%);
}

.tlj-ai-viz-chart--positive .tlj-ai-viz-chart-zero {
    left: 0;
}

.tlj-ai-viz-chart--positive .tlj-ai-viz-chart-bar {
    left: 0;
    width: calc(var(--tlj-ai-viz-ratio) * 100%);
}

.tlj-ai-viz-chart--negative .tlj-ai-viz-chart-zero {
    right: 0;
}

.tlj-ai-viz-chart--negative .tlj-ai-viz-chart-bar {
    right: 0;
    width: calc(var(--tlj-ai-viz-ratio) * 100%);
}

.tlj-ai-delete {
    display: inline-flex;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--tlj-color-negative-hover-border);
    border-radius: 8px;
    background: transparent;
    color: var(--tlj-color-negative-text);
    cursor: pointer;
    transition: background-color .25s ease, border-color .25s ease, color .25s ease;
}

.tlj-ai-delete:hover {
    border-color: var(--tlj-color-negative-hover-border-strong);
    background: var(--tlj-color-negative-hover-bg);
    color: var(--tlj-color-negative-hover-text);
}

.tlj-ai-delete:focus,
.tlj-ai-delete:focus-visible {
    border-color: var(--tlj-color-negative-hover-border);
    background: transparent;
    color: var(--tlj-color-negative-text);
}

.tlj-ai-delete svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tlj-ai-config-warning {
    margin: 14px 16px 0;
    padding: 12px 14px;
    border: 1px solid var(--tlj-color-warning-hover-border);
    border-radius: 8px;
    background: var(--tlj-color-warning-bg);
    color: var(--tlj-color-warning-text);
    font-size: 10px;
    line-height: 1.55;
}

.tlj-ai-config-warning strong {
    display: block;
    margin-bottom: 2px;
}

.tlj-ai-config-warning a {
    margin-left: 6px;
    color: inherit;
    font-weight: 900;
}

.tlj-ai-messages {
    flex: 1 1 auto;
    min-height: 0;
    padding: 22px 22px 10px;
    overflow: auto;
}

.tlj-ai-welcome {
    display: flex;
    min-height: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 26px 5%;
    text-align: center;
}

.tlj-ai-orb {
    display: grid;
    width: 60px;
    height: 60px;
    margin-bottom: 16px;
    place-items: center;
    border: 1px solid rgba(var(--tlj-color-accent-rgb), .3);
    border-radius: 50%;
    background: rgba(var(--tlj-color-accent-rgb), .085);
    color: var(--tlj-color-accent);
    font-size: 16px;
    font-weight: 950;
    box-shadow: 0 0 0 8px rgba(var(--tlj-color-accent-rgb), .05);
}

.tlj-ai-welcome h3 {
    font-size: clamp(24px, 2.6vw, 34px);
    font-weight: 900;
    letter-spacing: -.9px;
}

.tlj-ai-welcome > p {
    max-width: 690px;
    margin: 11px auto 20px;
    color: var(--tlj-color-text-muted);
    font-size: 13px;
    line-height: 1.72;
}

.tlj-ai-prompts {
    display: grid;
    width: min(100%, 780px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.tlj-ai-prompts button:not(.tlj-modal-action) {
    display: flex;
    min-height: 60px;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 13px;
    border: 1px solid var(--tlj-color-border-strong);
    border-radius: 8px;
    background: var(--tlj-color-surface-2);
    color: var(--tlj-color-text-secondary);
    font: 700 10px/1.48 inherit;
    cursor: pointer;
    text-align: left;
    transition: border-color .25s ease, background-color .25s ease, transform .25s ease;
}

.tlj-ai-prompts button:not(.tlj-modal-action):hover,
.tlj-ai-prompts button:not(.tlj-modal-action):focus,
.tlj-ai-prompts button:not(.tlj-modal-action):focus-visible {
    border-color: var(--tlj-color-accent);
    background: rgba(var(--tlj-color-accent-rgb), .09);
    color: var(--tlj-color-text);
    transform: translateY(-1px);
}

.tlj-ai-prompts button:not(.tlj-modal-action) span {
    flex: 0 0 auto;
    color: var(--tlj-color-accent);
    font-size: 8px;
    font-weight: 950;
}

.tlj-ai-message {
    display: flex;
    position: relative;
    width: 100%;
    margin: 0 0 15px;
}

.tlj-ai-message--user {
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
}

.tlj-ai-message--assistant {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
}

.tlj-ai-message-actions {
    display: flex;
    position: relative;
    align-items: center;
    gap: 4px;
    margin: 4px 0 0 3px;
    opacity: 0;
    transform: translateY(-2px);
    transition: opacity .16s ease, transform .16s ease;
}

.tlj-ai-page .tlj-ai-message-action,
.tlj-ai-page .tlj-ai-message-action:focus {
    display: inline-flex;
    min-height: 26px;
    align-items: center;
    gap: 5px;
    padding: 3px 7px;
    border: 1px solid transparent;
    border-radius: 7px;
    appearance: none;
    outline: 0;
    background: transparent;
    color: var(--tlj-color-text-muted-2);
    box-shadow: none;
    font-family: inherit;
    font-size: 11px;
    font-weight: 750;
    cursor: pointer;
    transition: color .16s ease, background-color .16s ease, border-color .16s ease;
}

.tlj-ai-page .tlj-ai-message-action:hover,
.tlj-ai-page .tlj-ai-message-action:focus-visible,
.tlj-ai-page .tlj-ai-message-action:active {
    border-color: rgba(var(--tlj-color-accent-rgb), .22);
    background: rgba(var(--tlj-color-accent-rgb), .055);
    color: var(--tlj-color-accent);
    box-shadow: none;
}

.tlj-ai-page .tlj-ai-message-action.is-success {
    color: var(--tlj-color-accent);
}

.tlj-ai-page .tlj-ai-message-action svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tlj-ai-message-bubble {
    max-width: min(84%, 820px);
    padding: 13px 15px;
    border: 1px solid var(--tlj-color-border);
    border-radius: 12px;
    color: var(--tlj-color-text-secondary);
    font-size: 11.5px;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.tlj-ai-message--user .tlj-ai-message-bubble {
    border-color: rgba(var(--tlj-color-accent-rgb), .36);
    background: rgba(var(--tlj-color-accent-rgb), .085);
    color: var(--tlj-color-text);
    border-bottom-right-radius: 5px;
}

.tlj-ai-message--assistant .tlj-ai-message-bubble {
    background: var(--tlj-color-surface-2);
    border-bottom-left-radius: 5px;
}

.tlj-ai-thinking .tlj-ai-message-bubble {
    color: var(--tlj-color-text-muted);
}

.tlj-ai-thinking-dots {
    display: inline-flex;
    gap: 4px;
    vertical-align: middle;
}

.tlj-ai-thinking-dots i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--tlj-color-accent);
    animation: tljAiDot 1s infinite ease-in-out;
}

.tlj-ai-thinking-dots i:nth-child(2) {
    animation-delay: .14s;
}

.tlj-ai-thinking-dots i:nth-child(3) {
    animation-delay: .28s;
}

@keyframes tljAiDot{
    0%, 100% {
        opacity: .28;
        transform: translateY(0);
    }
    50% {
        opacity: 1;
        transform: translateY(-2px);
    }
}

.tlj-ai-jump-bottom[hidden] { display: none !important; }

.tlj-ai-jump-bottom {
    position: absolute;
    right: 22px;
    bottom: 91px;
    z-index: 6;
    display: inline-flex;
    min-height: 34px;
    align-items: center;
    gap: 7px;
    padding: 0 11px;
    border: 1px solid rgba(var(--tlj-color-accent-rgb), .35);
    border-radius: 999px;
    background: var(--tlj-color-surface);
    color: var(--tlj-color-accent);
    box-shadow: 0 8px 24px rgba(var(--tlj-color-shadow-rgb), .18);
    font-size: 9.5px;
    font-weight: 850;
    cursor: pointer;
}

.tlj-ai-jump-bottom:hover,
.tlj-ai-jump-bottom:focus-visible {
    background: rgba(var(--tlj-color-accent-rgb), .08);
}

.tlj-ai-composer-field {
    min-width: 0;
}

.tlj-ai-input-help {
    display: block;
    margin: 5px 2px 0;
    color: var(--tlj-color-text-muted-2);
    font-size: 9px;
    font-weight: 600;
    line-height: 1.25;
}

.tlj-ai-composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 9px;
    align-items: start;
    padding: 12px 14px;
    border-top: 1px solid var(--tlj-color-divider);
    background: transparent;
}

.tlj-ai-composer textarea {
    width: 100%;
    height: 44px;
    min-height: 44px;
    max-height: 150px;
    resize: none;
    overflow-y: hidden;
    padding: 10px 13px;
    border: 1px solid var(--tlj-color-border-strong);
    border-radius: 8px;
    background: var(--tlj-color-input-bg);
    color: var(--tlj-color-input-text);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 22px;
    outline: none;
    transition: border-color .25s ease, background-color .25s ease;
}

.tlj-ai-composer textarea::placeholder {
    color: var(--tlj-color-input-placeholder);
    opacity: 1;
}

.tlj-ai-composer textarea:hover,
.tlj-ai-composer textarea:focus {
    border-color: var(--tlj-color-accent);
    background: var(--tlj-color-surface);
}

.tlj-ai-composer button:not(.tlj-modal-action){
    display: inline-flex;
    min-width: 128px;
    height: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    border: 1px solid var(--tlj-color-border-strong);
    border-radius: 8px;
    background: transparent;
    color: var(--tlj-color-accent) !important;
    font-size: 10.5px;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none !important;
    cursor: pointer;
    transition: border-color .25s ease, background-color .25s ease, color .25s ease, transform .25s ease;
}

.tlj-ai-composer button:not(.tlj-modal-action):hover,
.tlj-ai-composer button:not(.tlj-modal-action):focus{
    border-color: var(--tlj-color-accent);
    background: rgba(var(--tlj-color-accent-rgb), .09);
    color: var(--tlj-color-accent) !important;
    transform: translateY(-1px);
}

.tlj-ai-composer button:not(.tlj-modal-action):disabled {
    opacity: .55;
    cursor: wait;
    transform: none;
}

.tlj-ai-composer button:not(.tlj-modal-action) svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tlj-ai-footnote {
    margin: 0;
    padding: 0 14px 13px;
    background: transparent;
    color: var(--tlj-color-text-muted-2);
    font-size: 11px;
    line-height: 1.6;
    text-align: center;
}

.tlj-ai-gate {
    display: grid;
    place-items: center;
}

.tlj-ai-gate-card {
    width: min(100%, 700px);
    padding: 42px;
    border: 1px solid rgba(var(--tlj-color-accent-rgb), .22);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(var(--tlj-color-accent-rgb), .035), transparent 24%), var(--tlj-color-surface);
    box-shadow: 0 24px 58px rgba(var(--tlj-color-shadow-rgb), .16);
    text-align: center;
}

.tlj-ai-gate-icon {
    display: grid;
    width: 62px;
    height: 62px;
    margin: 0 auto 17px;
    place-items: center;
    border: 1px solid rgba(var(--tlj-color-accent-rgb), .3);
    border-radius: 50%;
    background: rgba(var(--tlj-color-accent-rgb), .085);
    color: var(--tlj-color-accent);
    font-size: 17px;
    font-weight: 950;
}

.tlj-ai-gate-card small {
    color: var(--tlj-color-text-muted-2);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 1px;
}

.tlj-ai-gate-card h1 {
    margin-top: 7px !important;
    font-size: 32px;
    font-weight: 900;
    letter-spacing: -1.5px;
}

.tlj-ai-gate-card p {
    max-width: 540px;
    margin: 11px auto 22px;
    color: var(--tlj-color-text-muted);
    font-size: 12px;
    line-height: 1.7;
}

.tlj-calendar-dialog {
    width: min(100%, 620px);
    overflow: hidden;
}.tlj-calendar-dialog__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;

}.tlj-calendar-dialog__kicker {
    display: inline-block;

}

.tlj-calendar-dialog__body {
    padding: 20px;
}

.tlj-calendar-dialog__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 20px 20px;
}

.tlj-calendar-dialog__foot strong {
    color: var(--tlj-color-text-muted);
    font-size: 12px;
    line-height: 1.55;
}

.tlj-ai-date-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
}

.tlj-ai-date-grid label {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.tlj-ai-date-grid label > span {
    color: var(--tlj-color-accent);
    font-size: 10.5px;
    font-weight: 900;
    letter-spacing: 1.15px;
    text-transform: uppercase;
}

.tlj-ai-date-grid input,
.tlj-ai-date-grid .form-control.input {
    width: 100%;
    height: 44px;
    padding: 0 13px;
    border: 1px solid var(--tlj-color-input-border);
    border-radius: 8px;
    background: var(--tlj-color-input-bg);
    color: var(--tlj-color-input-text);
    font-size: 12.5px;
    font-weight: 600;
    box-shadow: none;
}

.tlj-ai-date-grid input:hover,
.tlj-ai-date-grid input:focus,
.tlj-ai-date-grid .form-control.input:hover,
.tlj-ai-date-grid .form-control.input:focus {
    border-color: var(--tlj-color-input-focus-border);
    background: var(--tlj-color-hover);
    outline: none;
}

.tlj-ai-date-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tlj-ai-delete-copy {
    margin: 0;
    color: var(--tlj-color-text-secondary);
    font-size: 12.5px;
    line-height: 1.7;
}

@media (max-width: 1180px){
    .tlj-ai-context {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .tlj-ai-context-status {
        grid-column: 1 / -1;
    }

    .tlj-ai-layout {
        grid-template-columns: 250px minmax(0, 1fr);
    }
}

@media (max-width: 860px){
    .tlj-ai-history-tools { max-width: 520px; }
    .tlj-ai-shell {
        padding-top: 42px;
        padding-right: 18px;
        padding-left: 18px;
    }

    .tlj-ai-hero {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .tlj-ai-layout {
        position: relative;
        grid-template-columns: 1fr;
    }

    .tlj-ai-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 100020;
        width: min(340px, 90vw);
        min-height: 0;
        height: 100dvh;
        overflow: auto;
        border-radius: 0 14px 14px 0;
        transform: translateX(-104%);
        transition: transform .22s ease;
        box-shadow: 20px 0 50px rgba(var(--tlj-color-shadow-rgb), .32);
    }

    .tlj-ai-sidebar.is-mobile-open { transform: translateX(0); }

    .tlj-ai-sidebar.is-mobile-open .tlj-ai-sidebar-close {
        display: inline-flex;
        position: absolute;
        top: 10px;
        right: 10px;
        z-index: 1;
    }

    .tlj-ai-page .tlj-ai-head-action.tlj-ai-mobile-panel-toggle:not(.tlj-modal-close) { display: inline-flex; }
    
    .tlj-ai-sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 100010;
        border: 0 !important;
        background: rgba(var(--tlj-color-shadow-rgb), .45) !important;
        cursor: pointer;
    }
    .tlj-ai-sidebar-backdrop:not([hidden]) { display: block; }

    .tlj-ai-chat {
        min-height: 0;
    }
}

@media (max-width: 620px){
    .tlj-ai-shell {
        padding-right: 12px;
        padding-left: 12px;
    }

    .tlj-calendar-dialog__foot,
    .tlj-ai-date-actions,
    .tlj-ai-date-grid {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }

    .tlj-calendar-dialog__foot {
        display: flex;
    }

    .tlj-ai-context {
        grid-template-columns: 1fr;
    }

    .tlj-ai-context-status {
        grid-column: auto;
    }

    .tlj-ai-prompts {
        grid-template-columns: 1fr;
    }

    .tlj-ai-message-bubble {
        max-width: 93%;
    }

    .tlj-ai-composer {
        grid-template-columns: 1fr;
    }

    .tlj-ai-composer button:not(.tlj-modal-action) {
        width: 100%;
    }

    .tlj-ai-message--assistant.tlj-ai-message--visual .tlj-ai-message-bubble {
        width: 98%;
        max-width: 98%;
    }

    .tlj-ai-viz-chart-row {
        grid-template-columns: minmax(78px, 1fr) minmax(110px, 2fr);
    }

    .tlj-ai-viz-chart-value {
        grid-column: 2;
        margin-top: -4px;
        text-align: left;
    }

    .tlj-ai-active-context {
        align-items: flex-start;
        flex-direction: column;
        gap: 7px;
    }

    .tlj-ai-gate-card {
        padding: 30px 20px;
    }
}

.tlj-ai-followups {
    align-self: center;
    width: min(860px, 92%);
    margin: 8px auto 2px;
    text-align: center;
}

.tlj-ai-followups__label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 700;
    opacity: .72;
}

.tlj-ai-followups__list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
}

.tlj-ai-followup {
    appearance: none;
    border: 1px solid var(--tlj-border, rgba(45, 212, 191, .45));
    background: transparent;
    border-radius: 999px;
    padding: 7px 11px;
    font: inherit;
    font-size: 12px;
    line-height: 1.25;
    cursor: pointer;
    color: inherit;
    transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.tlj-ai-followup:hover,
.tlj-ai-followup:focus-visible {
    border-color: currentColor;
    background: color-mix(in srgb, currentColor 7%, transparent);
}

@media (max-width: 720px){
    .tlj-ai-followups {
        width: 93%;
        margin: 8px auto 2px;
        text-align: center;
    }
    .tlj-ai-followups__list {
        flex-direction: column;
        align-items: stretch;
    }
    .tlj-ai-followup {
        text-align: center;
        border-radius: 12px;
    }
}

@media (max-width: 620px){
    .tlj-ai-viz-table--wide { min-width: 660px; }
    .tlj-ai-viz-table { font-size: 9.4px; }
    .tlj-ai-viz-table th, .tlj-ai-viz-table td { padding: 5px 4px; }
    .tlj-ai-jump-bottom { right: 14px; bottom: 128px; }
    .tlj-ai-input-help { text-align: center; }
    .tlj-ai-message-actions { margin-left: 0; }
}

/* 1.0.85 · Aislamiento de estilos nativos del tema/WordPress.
 * Los controles del asistente deben conservar su diseño en hover/focus/active
 * aunque la web global aplique reglas genéricas sobre button/input/a. */
.tlj-ai-page button:not(.tlj-modal-action),
.tlj-ai-page input,
.tlj-ai-page textarea,
.tlj-ai-page select {
    -webkit-appearance: none !important;
    appearance: none !important;
    background-image: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    filter: none !important;
    text-transform: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

.tlj-ai-page button:not(.tlj-modal-action)::-moz-focus-inner {
    padding: 0;
    border: 0;
}

/* Preguntas de bienvenida: impedir que el tema las convierta en botón blanco. */
.tlj-ai-page .tlj-ai-prompts button:not(.tlj-modal-action),
.tlj-ai-page .tlj-ai-prompts button:not(.tlj-modal-action):visited {
    border-color: var(--tlj-color-border-strong) !important;
    background: var(--tlj-color-surface-2) !important;
    color: var(--tlj-color-text-secondary) !important;
    box-shadow: none !important;
    text-decoration: none !important;
}
.tlj-ai-page .tlj-ai-prompts button:not(.tlj-modal-action):hover,
.tlj-ai-page .tlj-ai-prompts button:not(.tlj-modal-action):focus,
.tlj-ai-page .tlj-ai-prompts button:not(.tlj-modal-action):focus-visible,
.tlj-ai-page .tlj-ai-prompts button:not(.tlj-modal-action):active {
    border-color: var(--tlj-color-accent) !important;
    background: rgba(var(--tlj-color-accent-rgb), .09) !important;
    color: var(--tlj-color-text) !important;
    box-shadow: none !important;
}
.tlj-ai-page .tlj-ai-prompts button:not(.tlj-modal-action) span,
.tlj-ai-page .tlj-ai-prompts button:not(.tlj-modal-action):hover span,
.tlj-ai-page .tlj-ai-prompts button:not(.tlj-modal-action):focus span,
.tlj-ai-page .tlj-ai-prompts button:not(.tlj-modal-action):active span {
    color: var(--tlj-color-accent) !important;
}

/* Seguimientos sugeridos: color explícito en TODOS los estados. */
.tlj-ai-page .tlj-ai-followup,
.tlj-ai-page .tlj-ai-followup:visited {
    border-color: rgba(var(--tlj-color-accent-rgb), .42) !important;
    background: transparent !important;
    color: var(--tlj-color-text-secondary) !important;
    box-shadow: none !important;
    text-decoration: none !important;
}
.tlj-ai-page .tlj-ai-followup:hover,
.tlj-ai-page .tlj-ai-followup:focus,
.tlj-ai-page .tlj-ai-followup:focus-visible,
.tlj-ai-page .tlj-ai-followup:active {
    border-color: var(--tlj-color-accent) !important;
    background: rgba(var(--tlj-color-accent-rgb), .075) !important;
    color: var(--tlj-color-text) !important;
    box-shadow: none !important;
}

/* Copiar respuesta: nunca heredar el azul de :focus/:active del tema. */
.tlj-ai-page .tlj-ai-message-action,
.tlj-ai-page .tlj-ai-message-action:visited,
.tlj-ai-page .tlj-ai-message-action:focus {
    border-color: transparent !important;
    background: transparent !important;
    color: var(--tlj-color-text-muted-2) !important;
    box-shadow: none !important;
    text-decoration: none !important;
}
.tlj-ai-page .tlj-ai-message-action:hover,
.tlj-ai-page .tlj-ai-message-action:focus-visible,
.tlj-ai-page .tlj-ai-message-action:active {
    border-color: rgba(var(--tlj-color-accent-rgb), .22) !important;
    background: rgba(var(--tlj-color-accent-rgb), .055) !important;
    color: var(--tlj-color-accent) !important;
    box-shadow: none !important;
}
.tlj-ai-page .tlj-ai-message-action.is-success,
.tlj-ai-page .tlj-ai-message-action.is-success:hover,
.tlj-ai-page .tlj-ai-message-action.is-success:focus,
.tlj-ai-page .tlj-ai-message-action.is-success:active {
    border-color: rgba(var(--tlj-color-accent-rgb), .18) !important;
    background: rgba(var(--tlj-color-accent-rgb), .04) !important;
    color: var(--tlj-color-accent) !important;
}

/* El resto de botones propios conserva estados TLJ, nunca estilos genéricos. */

/* Evita resaltados/autofill ajenos a TLJ en buscador y compositor. */
.tlj-ai-page :is(.tlj-ai-history-search input,.tlj-ai-composer textarea):-webkit-autofill,
.tlj-ai-page :is(.tlj-ai-history-search input,.tlj-ai-composer textarea):-webkit-autofill:hover,
.tlj-ai-page :is(.tlj-ai-history-search input,.tlj-ai-composer textarea):-webkit-autofill:focus {
    -webkit-text-fill-color: var(--tlj-color-text) !important;
    box-shadow: 0 0 0 1000px var(--tlj-color-surface-2) inset !important;
    caret-color: var(--tlj-color-text) !important;
}

/* 1.0.85 · Estados interactivos completamente aislados del tema.
 * Incluye color de texto WebKit y descendientes para evitar hovers blancos,
 * fondos azules de focus/active y reglas globales tipo button:hover * {}. */

.tlj-ai-page :is(button:not(.tlj-modal-action),.tlj-ai-followup,.tlj-ai-message-action) *,
.tlj-ai-page :is(button:not(.tlj-modal-action),.tlj-ai-followup,.tlj-ai-message-action):hover *,
.tlj-ai-page :is(button:not(.tlj-modal-action),.tlj-ai-followup,.tlj-ai-message-action):focus *,
.tlj-ai-page :is(button:not(.tlj-modal-action),.tlj-ai-followup,.tlj-ai-message-action):active * {
    -webkit-text-fill-color: currentColor !important;
}
.tlj-ai-page .tlj-ai-followup > *,
.tlj-ai-page .tlj-ai-followup:hover > *,
.tlj-ai-page .tlj-ai-followup:focus > *,
.tlj-ai-page .tlj-ai-followup:active > * {
    color: inherit !important;
}
.tlj-ai-page .tlj-ai-message-action svg,
.tlj-ai-page .tlj-ai-message-action:hover svg,
.tlj-ai-page .tlj-ai-message-action:focus svg,
.tlj-ai-page .tlj-ai-message-action:active svg {
    stroke: currentColor !important;
    fill: none !important;
}
.tlj-ai-page .tlj-ai-message-action span,
.tlj-ai-page .tlj-ai-message-action:hover span,
.tlj-ai-page .tlj-ai-message-action:focus span,
.tlj-ai-page .tlj-ai-message-action:active span {
    color: inherit !important;
}

/* Focus accesible, pero controlado por TLJ en vez del outline/fondo del tema. */
.tlj-ai-page button:not(.tlj-modal-action):focus { outline: none !important; }
/* Neutraliza estados nativos de enlaces/controles internos sin afectar el resto de la web. */
.tlj-ai-page :is(.tlj-ai-followup,.tlj-ai-message-action,.tlj-ai-prompts button:not(.tlj-modal-action)):disabled,
.tlj-ai-page :is(.tlj-ai-followup,.tlj-ai-message-action,.tlj-ai-prompts button:not(.tlj-modal-action))[aria-disabled="true"] {
    opacity: .55 !important;
    cursor: not-allowed !important;
    filter: none !important;
}

/* 1.0.88 · contexto efectivo por turno. */
.tlj-ai-message-scope {
    max-width: min(84%, 820px);
    margin: 4px 3px 0 0;
    color: var(--tlj-color-text-muted-2);
    font-size: 8.5px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: .01em;
    text-align: right;
    white-space: nowrap;
}

@media (max-width: 720px){
    .tlj-ai-message-scope {
        max-width: 92%;
        white-space: normal;
    }
}

/* 1.0.88 · los dos extremos solicitados quedan visibles también en la tabla. */
.tlj-ai-viz-table tbody tr.is-emphasis-primary td,
.tlj-ai-viz-table tbody tr.is-emphasis-secondary td {
    background: rgba(var(--tlj-color-accent-rgb), .055);
}

.tlj-ai-viz-table tbody tr.is-emphasis-primary td:first-child,
.tlj-ai-viz-table tbody tr.is-emphasis-secondary td:first-child {
    box-shadow: inset 2px 0 0 rgba(var(--tlj-color-accent-rgb), .72);
    color: var(--tlj-color-text);
    font-weight: 850;
}

/* 1.0.89 · Productividad del chat e historial. */
.tlj-ai-chat-head-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tlj-ai-conversation-searchbar {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto 34px 34px 34px;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-top: 1px solid var(--tlj-color-border);
    border-bottom: 1px solid var(--tlj-color-border);
    background: var(--tlj-color-surface);
}

.tlj-ai-conversation-searchbar[hidden] { display: none; }

.tlj-ai-conversation-searchbar label {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    padding: 0 9px;
    border: 1px solid var(--tlj-color-border-strong);
    border-radius: 8px;
    background: var(--tlj-color-surface-2);
}

.tlj-ai-conversation-searchbar label:focus-within {
    border-color: var(--tlj-color-accent);
    box-shadow: none;
}

.tlj-ai-conversation-searchbar label svg {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    fill: none;
    stroke: var(--tlj-color-text-muted-2);
    stroke-width: 1.7;
}

.tlj-ai-page .tlj-ai-conversation-searchbar input,
.tlj-ai-page .tlj-ai-conversation-searchbar input:focus {
    width: 100%;
    min-width: 0;
    height: 34px;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--tlj-color-text);
    box-shadow: none;
    font: inherit;
    font-size: 11.5px;
}

.tlj-ai-conversation-searchbar > span {
    min-width: 38px;
    color: var(--tlj-color-text-muted);
    font-size: 10px;
    font-weight: 800;
    text-align: center;
}

.tlj-ai-pinned-panel {
    margin: 8px 14px 0;
    border: 1px solid var(--tlj-color-border-strong);
    border-radius: 10px;
    background: var(--tlj-color-surface-2);
    overflow: hidden;
}

.tlj-ai-pinned-panel[hidden] { display: none; }

.tlj-ai-pinned-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 42px;
    padding: 5px 8px 5px 12px;
    border-bottom: 1px solid var(--tlj-color-border);
    color: var(--tlj-color-text);
    font-size: 11px;
}

.tlj-ai-pinned-panel__list {
    display: grid;
    gap: 5px;
    max-height: 220px;
    padding: 7px;
    overflow: auto;
}

.tlj-ai-page .tlj-ai-pinned-item {
    display: grid;
    gap: 2px;
    width: 100%;
    padding: 8px 9px;
    border-radius: 8px;
    color: var(--tlj-color-text-secondary);
    font: inherit;
    text-align: left;
}

.tlj-ai-page .tlj-ai-pinned-item:hover,
.tlj-ai-page .tlj-ai-pinned-item:focus-visible,
.tlj-ai-page .tlj-ai-pinned-item:active {
    border-color: rgba(var(--tlj-color-accent-rgb), .25);
    background: rgba(var(--tlj-color-accent-rgb), .065);
    color: var(--tlj-color-text);
    box-shadow: none;
}

.tlj-ai-pinned-item strong { color: var(--tlj-color-accent); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.tlj-ai-pinned-item span { color: inherit; font-size: 10.5px; line-height: 1.45; }
.tlj-ai-pinned-empty { margin: 3px 5px; color: var(--tlj-color-text-muted); font-size: 10.5px; }

.tlj-ai-page .tlj-ai-head-action:not(.tlj-modal-close),
.tlj-ai-page .tlj-ai-head-action:not(.tlj-modal-close):focus,
.tlj-ai-page .tlj-ai-history-pin,
.tlj-ai-page .tlj-ai-history-pin:focus {
    display: inline-flex;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    appearance: none;
    outline: 0;
    background: transparent;
    color: var(--tlj-color-text-muted-2);
    box-shadow: none;
    font: inherit;
    cursor: pointer;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.tlj-ai-page .tlj-ai-head-action:not(.tlj-modal-close):hover:not(:disabled),
.tlj-ai-page .tlj-ai-head-action:not(.tlj-modal-close):focus-visible:not(:disabled),
.tlj-ai-page .tlj-ai-head-action:not(.tlj-modal-close):active:not(:disabled),
.tlj-ai-page .tlj-ai-history-pin:hover:not(:disabled),
.tlj-ai-page .tlj-ai-history-pin:focus-visible:not(:disabled),
.tlj-ai-page .tlj-ai-history-pin:active:not(:disabled) {
    border-color: rgba(var(--tlj-color-accent-rgb), .26);
    background: rgba(var(--tlj-color-accent-rgb), .07);
    color: var(--tlj-color-accent);
    transform: translateY(-1px);
}

.tlj-ai-page .tlj-ai-head-action:not(.tlj-modal-close):disabled,
.tlj-ai-page .tlj-ai-history-pin:disabled {
    opacity: .32;
    cursor: default;
}

.tlj-ai-page .tlj-ai-head-action:not(.tlj-modal-close) svg,
.tlj-ai-page .tlj-ai-history-pin svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tlj-ai-history-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 30px 30px;
    gap: 3px;
    align-items: stretch;
    margin-bottom: 6px;
}

.tlj-ai-history-row .tlj-ai-history-item {
    margin: 0;
}

.tlj-ai-history-pin {
    width: 30px;
    height: auto;
    min-height: 42px;
    flex-basis: 30px;
}

.tlj-ai-history-pin.is-pinned {
    border-color: rgba(var(--tlj-color-accent-rgb), .24);
    background: rgba(var(--tlj-color-accent-rgb), .065);
    color: var(--tlj-color-accent);
}

.tlj-ai-history-pin.is-pinned svg path:first-child {
    fill: rgba(var(--tlj-color-accent-rgb), .16);
}

.tlj-ai-rename-field {
    display: grid;
    gap: 7px;
}

.tlj-ai-rename-field > span {
    color: var(--tlj-color-text-secondary);
    font-size: 11px;
    font-weight: 800;
}

.tlj-ai-rename-field input {
    width: 100%;
    min-height: 44px;
    padding: 9px 11px;
    border: 1px solid var(--tlj-color-border-strong);
    border-radius: 8px;
    background: var(--tlj-color-input-bg);
    color: var(--tlj-color-input-text);
    font: inherit;
    font-size: 12px;
}

.tlj-ai-rename-field input:hover,
.tlj-ai-rename-field input:focus {
    border-color: var(--tlj-color-accent);
    background: var(--tlj-color-surface);
}

.tlj-ai-composer .tlj-ai-stop {
    min-width: 92px;
    border-color: var(--tlj-color-negative-hover-border);
    background: var(--tlj-color-negative-hover-bg);
    color: var(--tlj-color-negative-text) !important;
}

.tlj-ai-composer .tlj-ai-stop:hover,
.tlj-ai-composer .tlj-ai-stop:focus-visible {
    border-color: var(--tlj-color-negative-text);
    background: var(--tlj-color-negative-hover-bg);
    color: var(--tlj-color-negative-text) !important;
}

.tlj-ai-viz-table-block {
    display: grid;
    min-width: 0;
    gap: 6px;
}

.tlj-ai-viz-table-tools,
.tlj-ai-viz-view-switcher {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
}

.tlj-ai-viz-view-switcher {
    margin-top: -3px;
}

.tlj-ai-viz-tool,
.tlj-ai-viz-view,
.tlj-ai-viz-sort {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--tlj-color-text-muted-2);
    font-family: inherit;
    font-size: 9px;
    font-weight: 850;
    line-height: 1;
    cursor: pointer;
}

.tlj-ai-viz-tool,
.tlj-ai-viz-view {
    min-height: 25px;
    padding: 4px 7px;
}

.tlj-ai-viz-tool:hover,
.tlj-ai-viz-tool:focus-visible,
.tlj-ai-viz-view:hover,
.tlj-ai-viz-view:focus-visible,
.tlj-ai-viz-view.is-active {
    border-color: rgba(var(--tlj-color-accent-rgb), .22);
    background: rgba(var(--tlj-color-accent-rgb), .055);
    color: var(--tlj-color-accent);
}

.tlj-ai-viz-tool.is-success {
    color: var(--tlj-color-accent);
}

.tlj-ai-viz-sort {
    display: inline-flex;
    width: 100%;
    min-height: 24px;
    align-items: center;
    justify-content: flex-start;
    padding: 0;
    color: inherit;
    text-align: left;
}

.tlj-ai-viz-sort::after {
    margin-left: 4px;
    color: var(--tlj-color-text-muted-2);
    content: "↕";
    font-size: 8px;
    opacity: .45;
}

.tlj-ai-viz-sort[data-sort="asc"]::after {
    content: "↑";
    opacity: 1;
}

.tlj-ai-viz-sort[data-sort="desc"]::after {
    content: "↓";
    opacity: 1;
}

.tlj-ai-viz-sort:hover,
.tlj-ai-viz-sort:focus-visible {
    color: var(--tlj-color-accent);
}

.tlj-ai-viz-chart[hidden],
.tlj-ai-viz-table-block[hidden] {
    display: none !important;
}

/* Aislamiento frente a estilos globales del tema para los nuevos controles. */
.tlj-ai-page :is(.tlj-ai-head-action:not(.tlj-modal-close),.tlj-ai-history-pin,.tlj-ai-viz-tool,.tlj-ai-viz-view,.tlj-ai-viz-sort,.tlj-ai-stop),
.tlj-ai-page :is(.tlj-ai-head-action:not(.tlj-modal-close),.tlj-ai-history-pin,.tlj-ai-viz-tool,.tlj-ai-viz-view,.tlj-ai-viz-sort,.tlj-ai-stop):hover,
.tlj-ai-page :is(.tlj-ai-head-action:not(.tlj-modal-close),.tlj-ai-history-pin,.tlj-ai-viz-tool,.tlj-ai-viz-view,.tlj-ai-viz-sort,.tlj-ai-stop):focus,
.tlj-ai-page :is(.tlj-ai-head-action:not(.tlj-modal-close),.tlj-ai-history-pin,.tlj-ai-viz-tool,.tlj-ai-viz-view,.tlj-ai-viz-sort,.tlj-ai-stop):active {
    text-shadow: none !important;
    box-shadow: none;
    filter: none;
    text-transform: none;
}

@media (max-width: 720px){
    .tlj-ai-chat-head {
        align-items: flex-start;
    }
    .tlj-ai-chat-head-actions {
        gap: 3px;
    }
    .tlj-ai-head-action:not(.tlj-modal-close) {
        width: 30px;
        height: 30px;
        flex-basis: 30px;
    }
    .tlj-ai-viz-table-tools,
    .tlj-ai-viz-view-switcher {
        justify-content: flex-start;
    }
}

/* 1.0.90 · aislamiento visual total de controles TLJ IA.
 * El tema/WordPress no puede imponer azules, sombras, degradados ni text-fill
 * sobre botones, herramientas de tabla o inputs propios del asistente. */
.tlj-ai-page :is(button:not(.tlj-modal-action),input,textarea,select) {
    -webkit-appearance: none !important;
    appearance: none !important;
    background-image: none !important;
    text-shadow: none !important;
    filter: none !important;
}

.tlj-ai-page button:not(.tlj-modal-action),
.tlj-ai-page button:not(.tlj-modal-action):hover,
.tlj-ai-page button:not(.tlj-modal-action):focus,
.tlj-ai-page button:not(.tlj-modal-close):not(.tlj-modal-action):focus-visible,
.tlj-ai-page button:not(.tlj-modal-action):active {
    box-shadow: none !important;
    text-decoration: none !important;
}

/* Cabecera: editar/renombrar, exportar y borrar. */
.tlj-ai-page .tlj-ai-head-action:not(.tlj-modal-close),
.tlj-ai-page .tlj-ai-head-action:not(.tlj-modal-close):focus,
.tlj-ai-page .tlj-ai-head-action:not(.tlj-modal-close):active {
    border-color: transparent !important;
    background: transparent !important;
    color: var(--tlj-color-text-muted-2) !important;
}
.tlj-ai-page .tlj-ai-head-action:not(.tlj-modal-close):hover,
.tlj-ai-page .tlj-ai-head-action:not(.tlj-modal-close):focus-visible {
    border-color: rgba(var(--tlj-color-accent-rgb), .26) !important;
    background: rgba(var(--tlj-color-accent-rgb), .07) !important;
    color: var(--tlj-color-accent) !important;
}

/* Herramientas de visualización: Copiar tabla, CSV, Ver todas, selector y sort. */
.tlj-ai-page :is(.tlj-ai-viz-tool,.tlj-ai-viz-view,.tlj-ai-viz-sort),
.tlj-ai-page :is(.tlj-ai-viz-tool,.tlj-ai-viz-view,.tlj-ai-viz-sort):focus,
.tlj-ai-page :is(.tlj-ai-viz-tool,.tlj-ai-viz-view,.tlj-ai-viz-sort):active {
    border-color: transparent !important;
    background: transparent !important;
    color: var(--tlj-color-text-muted-2) !important;
    -webkit-text-fill-color: currentColor !important;
}
.tlj-ai-page :is(.tlj-ai-viz-tool,.tlj-ai-viz-view,.tlj-ai-viz-sort):hover,
.tlj-ai-page :is(.tlj-ai-viz-tool,.tlj-ai-viz-view,.tlj-ai-viz-sort):focus-visible,
.tlj-ai-page .tlj-ai-viz-view.is-active {
    border-color: rgba(var(--tlj-color-accent-rgb), .24) !important;
    background: rgba(var(--tlj-color-accent-rgb), .06) !important;
    color: var(--tlj-color-accent) !important;
    -webkit-text-fill-color: currentColor !important;
}
.tlj-ai-page .tlj-ai-viz-table th,
.tlj-ai-page .tlj-ai-viz-table th:hover,
.tlj-ai-page .tlj-ai-viz-table th:focus-within {
    background: var(--tlj-color-surface-2) !important;
    color: var(--tlj-color-text-secondary) !important;
    box-shadow: none !important;
}
.tlj-ai-page .tlj-ai-viz-table th .tlj-ai-viz-sort,
.tlj-ai-page .tlj-ai-viz-table th .tlj-ai-viz-sort:hover,
.tlj-ai-page .tlj-ai-viz-table th .tlj-ai-viz-sort:focus,
.tlj-ai-page .tlj-ai-viz-table th .tlj-ai-viz-sort:focus-visible,
.tlj-ai-page .tlj-ai-viz-table th .tlj-ai-viz-sort:active {
    background: transparent !important;
    border-color: transparent !important;
    color: inherit !important;
    -webkit-text-fill-color: currentColor !important;
}
.tlj-ai-page .tlj-ai-viz-table th .tlj-ai-viz-sort:hover,
.tlj-ai-page .tlj-ai-viz-table th .tlj-ai-viz-sort:focus-visible {
    color: var(--tlj-color-accent) !important;
}

/* Buscador: un único borde exterior, nunca outline/sombra interior adicional. */
.tlj-ai-page .tlj-ai-history-search,
.tlj-ai-page .tlj-ai-history-search:focus,
.tlj-ai-page .tlj-ai-history-search:active,
.tlj-ai-page .tlj-ai-history-search:focus-within {
    outline: 0 !important;
    box-shadow: none !important;
}
.tlj-ai-page .tlj-ai-history-search:focus-within {
    border-color: rgba(var(--tlj-color-accent-rgb), .72) !important;
    background: var(--tlj-color-surface) !important;
}
.tlj-ai-page .tlj-ai-history-search input,
.tlj-ai-page .tlj-ai-history-search input:hover,
.tlj-ai-page .tlj-ai-history-search input:focus,
.tlj-ai-page .tlj-ai-history-search input:focus-visible,
.tlj-ai-page .tlj-ai-history-search input:active {
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    color: var(--tlj-color-text-secondary) !important;
    -webkit-text-fill-color: var(--tlj-color-text-secondary) !important;
}

/* Feedback de utilidad por respuesta. */
.tlj-ai-feedback-actions {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: 2px;
    padding-left: 5px;
    border-left: 1px solid rgba(var(--tlj-color-accent-rgb), .12);
}
.tlj-ai-page .tlj-ai-feedback-button,
.tlj-ai-page .tlj-ai-feedback-button:focus,
.tlj-ai-page .tlj-ai-feedback-button:active {
    display: inline-grid;
    width: 31px;
    height: 31px;
    place-items: center;
    padding: 0 !important;
    border: 1px solid transparent !important;
    border-radius: 7px !important;
    background: transparent !important;
    color: var(--tlj-color-text-muted-2) !important;
    -webkit-text-fill-color: currentColor !important;
    cursor: pointer;
}
.tlj-ai-page .tlj-ai-feedback-button:hover,
.tlj-ai-page .tlj-ai-feedback-button:focus-visible,
.tlj-ai-page .tlj-ai-feedback-button.is-active {
    border-color: rgba(var(--tlj-color-accent-rgb), .22) !important;
    background: rgba(var(--tlj-color-accent-rgb), .055) !important;
    color: var(--tlj-color-accent) !important;
}
.tlj-ai-page .tlj-ai-feedback-button svg {
    width: 17px;
    height: 17px;
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.tlj-ai-page .tlj-ai-feedback-button:disabled {
    opacity: .45 !important;
    cursor: wait !important;
}

/* =========================================================
   1.0.91 · Historial escalable, retención, móvil y accesibilidad
   ========================================================= */
.tlj-ai-history-head-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tlj-ai-history-settings,
.tlj-ai-history-more {
    appearance: none !important;
    -webkit-appearance: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

.tlj-ai-history-settings {
    display: inline-flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--tlj-color-text-muted-2);
    cursor: pointer;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}

.tlj-ai-history-settings:hover,
.tlj-ai-history-settings:focus-visible {
    border-color: rgba(var(--tlj-color-accent-rgb), .28) !important;
    background: rgba(var(--tlj-color-accent-rgb), .07) !important;
    color: var(--tlj-color-accent) !important;
}

.tlj-ai-history-settings svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tlj-ai-history-more {
    width: 100%;
    min-height: 34px;
    margin-top: 8px;
    padding: 0 10px;
    border: 1px solid var(--tlj-color-border) !important;
    border-radius: 8px;
    background: transparent !important;
    color: var(--tlj-color-text-muted) !important;
    font-size: 10.5px;
    font-weight: 800;
    cursor: pointer;
}

.tlj-ai-history-more:hover:not(:disabled),
.tlj-ai-history-more:focus-visible:not(:disabled) {
    border-color: rgba(var(--tlj-color-accent-rgb), .34) !important;
    background: rgba(var(--tlj-color-accent-rgb), .06) !important;
    color: var(--tlj-color-accent) !important;
}

.tlj-ai-history-more:disabled { opacity: .55; cursor: wait; }

.tlj-ai-retention-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 16px;
}

.tlj-ai-retention-choice {
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid var(--tlj-color-border) !important;
    border-radius: 9px;
    background: var(--tlj-color-surface-2) !important;
    color: var(--tlj-color-text-secondary) !important;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.tlj-ai-retention-choice:hover,
.tlj-ai-retention-choice:focus-visible,
.tlj-ai-retention-choice.is-selected {
    border-color: rgba(var(--tlj-color-accent-rgb), .52) !important;
    background: rgba(var(--tlj-color-accent-rgb), .09) !important;
    color: var(--tlj-color-accent) !important;
}

.tlj-ai-retention-choice.is-selected {
    box-shadow: inset 0 0 0 1px rgba(var(--tlj-color-accent-rgb), .22) !important;
}

.tlj-ai-page .tlj-ai-sidebar-close,
.tlj-ai-page .tlj-ai-head-action.tlj-ai-mobile-panel-toggle:not(.tlj-modal-close),
.tlj-ai-sidebar-backdrop {
    display: none;
}

.tlj-ai-sr-status {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

html.tlj-ai-sidebar-open,
html.tlj-ai-sidebar-open body {
    overflow: hidden;
}

@media (max-width: 620px){
    .tlj-ai-retention-options { grid-template-columns: 1fr; }
}

/* =========================================================
   1.0.92 · Personalización y productividad por usuario
   ========================================================= */
.tlj-ai-productivity-body {
    display: grid;
    gap: 14px;
    overflow: auto;
}

.tlj-ai-pref-section {
    padding: 14px;
    border: 1px solid var(--tlj-color-border);
    border-radius: 12px;
    background: var(--tlj-color-surface-2);
}

.tlj-ai-pref-heading {
    display: grid;
    gap: 3px;
    margin-bottom: 10px;
}

.tlj-ai-pref-heading strong {
    color: var(--tlj-color-text-primary);
    font-size: 13.5px;
    font-weight: 900;
    line-height: 1.35;
}

.tlj-ai-pref-heading span,
.tlj-ai-pref-empty {
    color: var(--tlj-color-text-muted-2);
    font-size: 12px;
    line-height: 1.5;
}

.tlj-ai-pref-segmented {
    display: inline-grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(92px, auto);
    gap: 6px;
}

.tlj-ai-page .tlj-ai-pref-segmented button:not(.tlj-modal-action),
.tlj-ai-page .tlj-ai-pref-check,
.tlj-ai-page .tlj-ai-pref-remove,
.tlj-ai-page .tlj-ai-saved-prompt {
    appearance: none !important;
    -webkit-appearance: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    filter: none !important;
    text-transform: none !important;
}

.tlj-ai-page .tlj-ai-pref-segmented button:not(.tlj-modal-action) {
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--tlj-color-border) !important;
    border-radius: 8px;
    background: transparent !important;
    color: var(--tlj-color-text-secondary) !important;
    font-size: 10.5px;
    font-weight: 850;
    cursor: pointer;
}

.tlj-ai-page .tlj-ai-pref-segmented button:not(.tlj-modal-action):hover,
.tlj-ai-page .tlj-ai-pref-segmented button:not(.tlj-modal-action):focus-visible,
.tlj-ai-page .tlj-ai-pref-segmented button:not(.tlj-modal-action).is-selected {
    border-color: rgba(var(--tlj-color-accent-rgb), .5) !important;
    background: rgba(var(--tlj-color-accent-rgb), .09) !important;
    color: var(--tlj-color-accent) !important;
}

.tlj-ai-quick-action-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.tlj-ai-page .tlj-ai-pref-check {
    display: grid;
    gap: 3px;
    min-height: 58px;
    padding: 9px 10px;
    text-align: left;
    border: 1px solid var(--tlj-color-border) !important;
    border-radius: 9px;
    background: transparent !important;
    color: var(--tlj-color-text-secondary) !important;
    cursor: pointer;
}

.tlj-ai-pref-check strong { color: currentColor; font-size: 12px; line-height: 1.35; }
.tlj-ai-pref-check span { color: var(--tlj-color-text-muted-2); font-size: 11px; line-height: 1.42; }

.tlj-ai-page .tlj-ai-pref-check:hover,
.tlj-ai-page .tlj-ai-pref-check:focus-visible,
.tlj-ai-page .tlj-ai-pref-check.is-selected {
    border-color: rgba(var(--tlj-color-accent-rgb), .46) !important;
    background: rgba(var(--tlj-color-accent-rgb), .07) !important;
    color: var(--tlj-color-accent) !important;
}

.tlj-ai-template-list,
.tlj-ai-favorite-list {
    display: grid;
    gap: 6px;
    margin-bottom: 9px;
}

.tlj-ai-pref-list-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 8px 9px;
    border: 1px solid var(--tlj-color-border);
    border-radius: 8px;
    background: var(--tlj-color-surface);
}

.tlj-ai-pref-list-row > div { min-width: 0; display: grid; gap: 2px; }
.tlj-ai-pref-list-row strong,
.tlj-ai-pref-list-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tlj-ai-pref-list-row strong { color: var(--tlj-color-text-primary); font-size: 11.75px; }
.tlj-ai-pref-list-row span { color: var(--tlj-color-text-muted-2); font-size: 10.75px; }

.tlj-ai-page .tlj-ai-pref-remove {
    min-height: 30px;
    padding: 0 9px;
    border: 1px solid var(--tlj-color-border) !important;
    border-radius: 7px;
    background: transparent !important;
    color: var(--tlj-color-text-muted) !important;
    font-family: var(--tlj-font-family) !important;
    font-size: 9.5px;
    font-weight: 800;
    cursor: pointer;
}
.tlj-ai-page .tlj-ai-pref-remove:hover,
.tlj-ai-page .tlj-ai-pref-remove:focus-visible {
    border-color: rgba(220,80,80,.35) !important;
    background: rgba(220,80,80,.06) !important;
    color: var(--tlj-color-danger, #d95b5b) !important;
}

.tlj-ai-template-editor {
    display: grid;
    grid-template-columns: minmax(130px, .55fr) minmax(220px, 1.45fr) auto;
    gap: 7px;
    align-items: stretch;
}

.tlj-ai-page .tlj-ai-template-editor input,
.tlj-ai-page .tlj-ai-template-editor textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--tlj-color-border) !important;
    border-radius: 8px;
    background: var(--tlj-color-surface) !important;
    color: var(--tlj-color-text-primary) !important;
    box-shadow: none !important;
    outline: none !important;
    font-size: 11.5px;
}
.tlj-ai-page .tlj-ai-template-editor input { min-height: 38px; padding: 0 10px; }
.tlj-ai-page .tlj-ai-template-editor textarea {
    height: 38px;
    min-height: 38px;
    padding: 9px 10px;
    overflow-y: hidden;
    line-height: 18px;
    resize: vertical;
}
.tlj-ai-page .tlj-ai-template-editor textarea:focus,
.tlj-ai-page .tlj-ai-template-editor textarea:not(:placeholder-shown) {
    overflow-y: auto;
}
.tlj-ai-page .tlj-ai-template-editor input:focus,
.tlj-ai-page .tlj-ai-template-editor textarea:focus {
    border-color: rgba(var(--tlj-color-accent-rgb), .58) !important;
    box-shadow: none !important;
}

.tlj-ai-saved-prompts {
    display: grid;
    gap: 8px;
    width: min(860px, 100%);
    margin: 12px auto 0;
}
.tlj-ai-saved-prompts[hidden] { display: none !important; }
.tlj-ai-saved-prompts-group { display: grid; gap: 5px; }
.tlj-ai-saved-prompts-group > strong {
    color: var(--tlj-color-text-muted-2);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .7px;
    text-transform: uppercase;
}
.tlj-ai-saved-prompts-list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }

.tlj-ai-page .tlj-ai-saved-prompt {
    max-width: min(360px, 100%);
    min-height: 34px;
    padding: 6px 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px solid var(--tlj-color-border) !important;
    border-radius: 999px;
    background: transparent !important;
    color: var(--tlj-color-text-muted) !important;
    font-size: 9.5px;
    font-weight: 750;
    cursor: pointer;
}
.tlj-ai-page .tlj-ai-saved-prompt:hover,
.tlj-ai-page .tlj-ai-saved-prompt:focus-visible {
    border-color: rgba(var(--tlj-color-accent-rgb), .42) !important;
    background: rgba(var(--tlj-color-accent-rgb), .07) !important;
    color: var(--tlj-color-accent) !important;
}

.tlj-ai-user-prompt-actions {
    display: flex;
    position: relative;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 4px;
    opacity: 0;
    transform: translateY(-2px);
    transition: opacity .16s ease, transform .16s ease;
}

.tlj-ai-message:hover > .tlj-ai-message-actions,
.tlj-ai-message:focus-within > .tlj-ai-message-actions,
.tlj-ai-message.is-menu-open > .tlj-ai-message-actions,
.tlj-ai-message:hover > .tlj-ai-user-prompt-actions,
.tlj-ai-message:focus-within > .tlj-ai-user-prompt-actions,
.tlj-ai-message.is-menu-open > .tlj-ai-user-prompt-actions,
.tlj-ai-message.is-editing > .tlj-ai-user-prompt-actions {
    opacity: 1;
    transform: translateY(0);
}

.tlj-ai-message-action--icon {
    width: 33px;
    min-width: 33px;
    height: 33px;
    min-height: 33px;
    justify-content: center;
    padding: 0;
}

.tlj-ai-message-action--icon > span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.tlj-ai-page .tlj-ai-message-pin.is-active {
    border-color: rgba(var(--tlj-color-accent-rgb), .28);
    background: rgba(var(--tlj-color-accent-rgb), .065);
    color: var(--tlj-color-accent);
}

.tlj-ai-message-more {
    position: relative;
    z-index: 30;
    display: inline-flex;
}

.tlj-ai-message-menu {
    position: absolute;
    z-index: 12;
    top: calc(100% - 1px);
    min-width: 190px;
    padding: 5px;
    border: 1px solid var(--tlj-color-border-strong);
    border-radius: 9px;
    background: var(--tlj-color-surface-2);
    box-shadow: 0 12px 30px rgba(var(--tlj-color-shadow-rgb), .18);
}

.tlj-ai-message--user .tlj-ai-message-menu { right: 0; }
.tlj-ai-message--assistant .tlj-ai-message-menu { left: 0; }

.tlj-ai-page .tlj-ai-message-menu button:not(.tlj-modal-action) {
    display: block;
    width: 100%;
    min-height: 34px;
    padding: 7px 9px;
    border-radius: 7px;
    color: var(--tlj-color-text-secondary);
    font-size: 11px;
    font-weight: 700;
    text-align: left;
}

.tlj-ai-page .tlj-ai-message-menu button:not(.tlj-modal-action):hover,
.tlj-ai-page .tlj-ai-message-menu button:not(.tlj-modal-action):focus-visible,
.tlj-ai-page .tlj-ai-message-menu button:not(.tlj-modal-action):active {
    background: rgba(var(--tlj-color-accent-rgb), .075);
    color: var(--tlj-color-accent);
    box-shadow: none;
}

.tlj-ai-message-editor {
    width: min(100%, 720px);
    min-height: 88px;
    resize: vertical;
    padding: 10px 11px;
    border: 1px solid var(--tlj-color-border-strong);
    border-radius: 8px;
    background: var(--tlj-color-surface);
    color: var(--tlj-color-text);
    font: inherit;
    line-height: 1.55;
}

.tlj-ai-message-editor:focus,
.tlj-ai-message-editor:focus-visible {
    border-color: var(--tlj-color-accent);
    background: var(--tlj-color-surface);
    color: var(--tlj-color-text);
    box-shadow: 0 0 0 2px rgba(var(--tlj-color-accent-rgb), .12);
}

.tlj-ai-message-editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 7px;
    margin-top: 8px;
}

.tlj-ai-message.is-search-match .tlj-ai-message-bubble {
    border-color: rgba(var(--tlj-color-accent-rgb), .62);
    box-shadow: 0 0 0 1px rgba(var(--tlj-color-accent-rgb), .16);
}

.tlj-ai-message.is-search-current .tlj-ai-message-bubble {
    border-color: var(--tlj-color-accent);
    box-shadow: 0 0 0 3px rgba(var(--tlj-color-accent-rgb), .13);
}

.tlj-ai-message.is-pinned-jump .tlj-ai-message-bubble {
    animation: tljAiPinnedJump 1.15s ease;
}

@keyframes tljAiPinnedJump{
    0%, 100% { box-shadow: none; }
    40% { box-shadow: 0 0 0 4px rgba(var(--tlj-color-accent-rgb), .18); }
}

.tlj-ai-page .tlj-ai-favorite-prompt.is-active {
    border-color: rgba(var(--tlj-color-accent-rgb), .3) !important;
    color: var(--tlj-color-accent) !important;
}
.tlj-ai-favorite-prompt svg { fill: none; stroke: currentColor; stroke-width: 1.7; }
.tlj-ai-favorite-prompt.is-active svg { fill: rgba(var(--tlj-color-accent-rgb), .18); }

/* Densidad exclusivamente visual: no cambia contenido, prompts ni cálculo. */
.tlj-ai-page.tlj-ai-density-compact .tlj-ai-message { margin-bottom: 9px; }
.tlj-ai-page.tlj-ai-density-compact .tlj-ai-message-bubble { padding-top: 10px; padding-bottom: 10px; line-height: 1.48; }
.tlj-ai-page.tlj-ai-density-compact .tlj-ai-message-bubble p { margin-top: 5px; margin-bottom: 5px; }
.tlj-ai-page.tlj-ai-density-compact .tlj-ai-visualization { margin-top: 10px; gap: 7px; }
.tlj-ai-page.tlj-ai-density-compact .tlj-ai-followups { margin-top: 8px; padding-top: 8px; }

@media (hover: none), (pointer: coarse){
    .tlj-ai-message-actions,
    .tlj-ai-user-prompt-actions { opacity: 1; transform: none; }
}

@media (max-width: 700px){
    .tlj-ai-conversation-searchbar { grid-template-columns: minmax(0, 1fr) auto 32px 32px 32px; padding-inline: 8px; gap: 3px; }
    .tlj-ai-pinned-panel { margin-inline: 8px; }
    .tlj-ai-quick-action-options { grid-template-columns: 1fr; }
    .tlj-ai-template-editor { grid-template-columns: 1fr; }
    .tlj-ai-pref-segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-flow: row; }
}

/* =========================================================
   1.0.93 · Preferencias cerradas + flujos de trabajo
   ========================================================= */
.tlj-ai-productivity-dialog,
.tlj-ai-workflow-dialog,
.tlj-ai-report-dialog,
.tlj-ai-workspace-dialog {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(var(--tlj-ai-dialog-width, 900px), 100%);
    max-height: min(900px, calc(100dvh - 2 * var(--tlj-modal-layer-pad, 20px)));
    overflow: hidden;
}

.tlj-ai-workspace-dialog { --tlj-ai-dialog-width: 980px; }

.tlj-ai-productivity-body,
.tlj-ai-workflow-body,
.tlj-ai-report-body,
.tlj-ai-workspace-body {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding-bottom: 22px;
}.tlj-ai-productivity-dialog .tlj-calendar-dialog__foot,
.tlj-ai-workflow-dialog .tlj-calendar-dialog__foot,
.tlj-ai-report-dialog .tlj-calendar-dialog__foot,
.tlj-ai-workspace-dialog .tlj-calendar-dialog__foot {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
}
.tlj-ai-productivity-dialog .tlj-calendar-dialog__head,
.tlj-ai-workflow-dialog .tlj-calendar-dialog__head,
.tlj-ai-report-dialog .tlj-calendar-dialog__head,
.tlj-ai-workspace-dialog .tlj-calendar-dialog__head {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
}

.tlj-ai-productivity-dialog .tlj-calendar-dialog__foot,
.tlj-ai-workflow-dialog .tlj-calendar-dialog__foot,
.tlj-ai-report-dialog .tlj-calendar-dialog__foot {
    padding-top: 14px;
    border-top: 1px solid var(--tlj-color-divider);
    background: var(--tlj-color-surface);
}

/* Etiquetas y tarjetas de Preferencias más legibles. */

/* Ajustes de Historial: ningún estado puede heredar azul del tema. */
.tlj-ai-page .tlj-ai-history-settings,
.tlj-ai-page .tlj-ai-history-settings:hover,
.tlj-ai-page .tlj-ai-history-settings:focus,
.tlj-ai-page .tlj-ai-history-settings:focus-visible,
.tlj-ai-page .tlj-ai-history-settings:active {
    appearance: none !important;
    -webkit-appearance: none !important;
    border: 1px solid transparent !important;
    background: transparent !important;
    color: var(--tlj-color-text-muted-2) !important;
    -webkit-text-fill-color: currentColor !important;
    box-shadow: none !important;
    text-shadow: none !important;
    outline: 0 !important;
    filter: none !important;
}
.tlj-ai-page .tlj-ai-history-settings:hover,
.tlj-ai-page .tlj-ai-history-settings:focus-visible {
    border-color: rgba(var(--tlj-color-accent-rgb), .28) !important;
    background: rgba(var(--tlj-color-accent-rgb), .07) !important;
    color: var(--tlj-color-accent) !important;
}
.tlj-ai-page .tlj-ai-history-settings:active { transform: none !important; }
.tlj-ai-page .tlj-ai-history-settings svg,
.tlj-ai-page .tlj-ai-history-settings:hover svg,
.tlj-ai-page .tlj-ai-history-settings:focus svg,
.tlj-ai-page .tlj-ai-history-settings:active svg {
    fill: none !important;
    stroke: currentColor !important;
}

/* Accesos directos con contador. */
.tlj-ai-head-action--badge { position: relative; }
.tlj-ai-head-action--badge > span {
    position: absolute;
    top: -5px;
    right: -5px;
    display: grid;
    min-width: 16px;
    height: 16px;
    place-items: center;
    padding: 0 4px;
    border: 2px solid var(--tlj-color-surface);
    border-radius: 999px;
    background: var(--tlj-color-accent);
    color: var(--tlj-color-accent-contrast, #031011);
    font-size: 8.5px;
    font-weight: 900;
    line-height: 1;
}
.tlj-ai-head-action--badge > span[hidden] { display: none !important; }

/* Flujos. */
.tlj-ai-review-presets {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.tlj-ai-page .tlj-ai-workflow-preset,
.tlj-ai-page .tlj-ai-workflow-analysis-main {
    appearance: none !important;
    -webkit-appearance: none !important;
    border: 1px solid var(--tlj-color-border) !important;
    border-radius: 10px !important;
    background: transparent !important;
    color: var(--tlj-color-text-secondary) !important;
    -webkit-text-fill-color: currentColor !important;
    box-shadow: none !important;
    cursor: pointer;
}
.tlj-ai-page .tlj-ai-workflow-preset {
    display: grid;
    gap: 4px;
    min-height: 64px;
    padding: 11px;
    text-align: left;
}
.tlj-ai-workflow-preset strong { color: currentColor; font-size: 12px; }
.tlj-ai-workflow-preset span { color: var(--tlj-color-text-muted-2); font-size: 10.5px; }
.tlj-ai-page .tlj-ai-workflow-preset:hover,
.tlj-ai-page .tlj-ai-workflow-preset:focus-visible,
.tlj-ai-page .tlj-ai-workflow-analysis-main:hover,
.tlj-ai-page .tlj-ai-workflow-analysis-main:focus-visible {
    border-color: rgba(var(--tlj-color-accent-rgb), .42) !important;
    background: rgba(var(--tlj-color-accent-rgb), .06) !important;
    color: var(--tlj-color-accent) !important;
}

.tlj-ai-workflow-analyses { display: grid; gap: 7px; }
.tlj-ai-workflow-analysis-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(120px, .34fr) auto;
    gap: 7px;
    align-items: center;
}
.tlj-ai-page .tlj-ai-workflow-analysis-main {
    display: grid;
    gap: 2px;
    min-width: 0;
    padding: 9px 10px;
    text-align: left;
}
.tlj-ai-workflow-analysis-main strong,
.tlj-ai-workflow-analysis-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tlj-ai-workflow-analysis-main strong { font-size: 11.5px; }
.tlj-ai-workflow-analysis-main span { color: var(--tlj-color-text-muted-2); font-size: 10px; }
.tlj-ai-page .tlj-ai-workflow-collection-select,
.tlj-ai-page .tlj-ai-collection-editor input {
    appearance: none !important;
    -webkit-appearance: none !important;
    min-height: 38px;
    border: 1px solid var(--tlj-color-border) !important;
    border-radius: 8px !important;
    background: var(--tlj-color-surface) !important;
    color: var(--tlj-color-text-secondary) !important;
    -webkit-text-fill-color: currentColor !important;
    box-shadow: none !important;
    outline: 0 !important;
    font-size: 10.75px;
}
.tlj-ai-page .tlj-ai-workflow-collection-select { padding: 0 28px 0 10px; }
.tlj-ai-page .tlj-ai-collection-editor input { width: 100%; padding: 0 10px; }
.tlj-ai-page .tlj-ai-workflow-collection-select:focus,
.tlj-ai-page .tlj-ai-collection-editor input:focus { border-color: rgba(var(--tlj-color-accent-rgb), .6) !important; }

.tlj-ai-collection-list { display: grid; gap: 6px; margin-bottom: 8px; }
.tlj-ai-collection-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: center;
    padding: 8px 9px;
    border: 1px solid var(--tlj-color-border);
    border-radius: 8px;
}
.tlj-ai-collection-row strong { color: var(--tlj-color-text-primary); font-size: 11.5px; }
.tlj-ai-collection-row > span { color: var(--tlj-color-text-muted-2); font-size: 10px; }
.tlj-ai-collection-editor { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }

/* Sesión de revisión activa. */
.tlj-ai-review-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 14px 8px;
    padding: 9px 11px;
    border: 1px solid rgba(var(--tlj-color-accent-rgb), .24);
    border-radius: 10px;
    background: rgba(var(--tlj-color-accent-rgb), .055);
}
.tlj-ai-review-bar[hidden] { display: none !important; }
.tlj-ai-review-bar > div:first-child { display: grid; gap: 2px; }
.tlj-ai-review-bar strong { color: var(--tlj-color-text-primary); font-size: 11.5px; }
.tlj-ai-review-bar span { color: var(--tlj-color-text-muted-2); font-size: 10px; }
.tlj-ai-review-bar > div:last-child { display: flex; gap: 6px; }

/* Constructor de informe. */
.tlj-ai-report-items { display: grid; gap: 8px; }
.tlj-ai-report-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--tlj-color-border);
    border-radius: 9px;
    background: var(--tlj-color-surface-2);
}
.tlj-ai-report-item > div { min-width: 0; display: grid; gap: 3px; }
.tlj-ai-report-item strong { color: var(--tlj-color-text-primary); font-size: 11.5px; }
.tlj-ai-report-item span { overflow: hidden; color: var(--tlj-color-text-muted-2); font-size: 10.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tlj-ai-page .tlj-ai-report-add.is-active,
.tlj-ai-page .tlj-ai-save-analysis.is-active { color: var(--tlj-color-accent) !important; border-color: rgba(var(--tlj-color-accent-rgb), .24) !important; }

@media (max-width: 700px){
    .tlj-ai-productivity-body,
    .tlj-ai-workflow-body,
    .tlj-ai-report-body { padding: 14px; }
    .tlj-ai-productivity-dialog .tlj-calendar-dialog__foot,
    .tlj-ai-workflow-dialog .tlj-calendar-dialog__foot,
    .tlj-ai-report-dialog .tlj-calendar-dialog__foot { padding: 12px 15px 14px; }
    .tlj-ai-review-presets { grid-template-columns: 1fr; }
    .tlj-ai-workflow-analysis-row { grid-template-columns: 1fr; }
    .tlj-ai-collection-editor { grid-template-columns: 1fr; }
    .tlj-ai-review-bar { align-items: flex-start; flex-direction: column; }
    .tlj-ai-review-bar > div:last-child { width: 100%; }
    .tlj-ai-review-bar > div:last-child button:not(.tlj-modal-action) { flex: 1; }
}

/* =========================================================
   1.0.94 · Tipografía global TLJ + Workspace avanzado
   ========================================================= */
/* La página y todos sus controles heredan la tipografía real de la web. */
.tlj-ai-page :is(button:not(.tlj-modal-action), input, textarea, select, option) {
    font-family: inherit !important;
    font-style: normal !important;
}
.tlj-ai-page :is(button:not(.tlj-modal-action), input, textarea, select) * {
    font-family: inherit !important;
}

/* Placeholder del prompt de plantilla: misma escala que Nombre de la plantilla. */
.tlj-ai-page .tlj-ai-template-editor input::placeholder,
.tlj-ai-page .tlj-ai-template-editor textarea::placeholder {
    color: var(--tlj-color-text-muted-2) !important;
    -webkit-text-fill-color: var(--tlj-color-text-muted-2) !important;
    font-family: inherit !important;
    font-size: 11.5px !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
    opacity: 1 !important;
}

.tlj-ai-workspace-list {
    display: grid;
    gap: 7px;
}
.tlj-ai-workspace-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 9px 10px;
    border: 1px solid var(--tlj-color-border);
    border-radius: 9px;
    background: var(--tlj-color-surface);
}
.tlj-ai-workspace-row > div:first-child {
    display: grid;
    gap: 2px;
    min-width: 0;
}
.tlj-ai-workspace-row strong {
    overflow: hidden;
    color: var(--tlj-color-text-primary);
    font-size: 11.75px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tlj-ai-workspace-row span {
    overflow: hidden;
    color: var(--tlj-color-text-muted-2);
    font-size: 10.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tlj-ai-workspace-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: flex-end;
}
.tlj-ai-comparison-editor {
    display: grid;
    grid-template-columns: minmax(140px, .55fr) minmax(240px, 1.35fr) minmax(125px, .45fr) minmax(125px, .45fr) auto;
    gap: 7px;
    align-items: stretch;
    margin-top: 8px;
}
.tlj-ai-page .tlj-ai-comparison-editor :is(input, textarea, select) {
    width: 100%;
    min-width: 0;
    min-height: 39px;
    border: 1px solid var(--tlj-color-border) !important;
    border-radius: 8px !important;
    background: var(--tlj-color-surface) !important;
    color: var(--tlj-color-text-primary) !important;
    -webkit-text-fill-color: currentColor !important;
    box-shadow: none !important;
    outline: none !important;
    font-size: 11px;
}
.tlj-ai-page .tlj-ai-comparison-editor input,
.tlj-ai-page .tlj-ai-comparison-editor select {
    height: 42px;
    min-height: 42px;
    padding: 0 12px;
    font-size: 12px;
    line-height: normal;
}
.tlj-ai-page .tlj-ai-comparison-editor textarea {
    height: 42px;
    min-height: 42px;
    padding: 11px 12px;
    overflow-y: hidden;
    font-size: 12px;
    line-height: 18px;
    resize: vertical;
}
.tlj-ai-page .tlj-ai-comparison-editor :is(input, textarea, select):focus {
    border-color: rgba(var(--tlj-color-accent-rgb), .58) !important;
    box-shadow: none !important;
}
.tlj-ai-workspace-presets {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.tlj-ai-page .tlj-ai-workspace-preset {
    display: grid;
    gap: 4px;
    min-height: 68px;
    padding: 11px 12px;
    border: 1px solid var(--tlj-color-border) !important;
    border-radius: 10px !important;
    background: transparent !important;
    color: var(--tlj-color-text-secondary) !important;
    -webkit-text-fill-color: currentColor !important;
    box-shadow: none !important;
    text-align: left;
    cursor: pointer;
}
.tlj-ai-page .tlj-ai-workspace-preset strong { color: currentColor; font-size: 12px; font-weight: 850; }
.tlj-ai-page .tlj-ai-workspace-preset span { color: var(--tlj-color-text-muted-2); font-size: 10.75px; line-height: 1.45; }
.tlj-ai-page .tlj-ai-workspace-preset:hover,
.tlj-ai-page .tlj-ai-workspace-preset:focus-visible {
    border-color: rgba(var(--tlj-color-accent-rgb), .42) !important;
    background: rgba(var(--tlj-color-accent-rgb), .06) !important;
    color: var(--tlj-color-accent) !important;
}

@media (max-width: 860px){
    .tlj-ai-comparison-editor { grid-template-columns: 1fr 1fr; }
    .tlj-ai-comparison-editor textarea { grid-column: 1 / -1; }
    .tlj-ai-comparison-editor > button:not(.tlj-modal-action) { grid-column: 1 / -1; }
}
@media (max-width: 620px){
    .tlj-ai-workspace-row { grid-template-columns: 1fr; }
    .tlj-ai-workspace-row-actions { justify-content: flex-start; }
    .tlj-ai-workspace-presets,
    .tlj-ai-comparison-editor { grid-template-columns: 1fr; }
    .tlj-ai-comparison-editor textarea,
    .tlj-ai-comparison-editor > button:not(.tlj-modal-action) { grid-column: auto; }
}

/* =========================================================
   1.0.96 · Refinado visual integral
   Selectores, uso IA, iconos, legibilidad, modales y workspace.
   ========================================================= */

/* Selectores superiores: un único borde real de la caja, sin líneas auxiliares. */
.tlj-ai-page .tlj-ai-context .custom-select.tlj-ai-select {
    width: 100%;
    height: 44px;
    min-height: 44px;
    border: 1px solid var(--tlj-color-border-strong);
    border-radius: 8px;
    background-clip: padding-box;
    box-shadow: none;
    overflow: visible;
}
.tlj-ai-page .tlj-ai-context .custom-select.tlj-ai-select .selected {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 0;
    align-items: center;
    justify-content: space-between;
    border: 0;
    border-radius: 7px;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
}
.tlj-ai-page .tlj-ai-context .custom-select.tlj-ai-select:hover,
.tlj-ai-page .tlj-ai-context .custom-select.tlj-ai-select:focus-within {
    border-color: rgba(var(--tlj-color-accent-rgb), .58);
    box-shadow: none;
}
html[data-tlj-theme="light"] .tlj-ai-page .tlj-ai-context .custom-select.tlj-ai-select {
    border-color: rgba(var(--tlj-color-accent-rgb), .42);
}
html[data-tlj-theme="light"] .tlj-ai-page .tlj-ai-context .custom-select.tlj-ai-select:hover,
html[data-tlj-theme="light"] .tlj-ai-page .tlj-ai-context .custom-select.tlj-ai-select:focus-within {
    border-color: rgba(var(--tlj-color-accent-rgb), .72);
}

/* Uso IA: dos tarjetas compactas con disponible, consumido y progreso. */
.tlj-ai-usage-row {
    margin-top: 10px;
    padding: 10px 10px 9px;
    border: 1px solid var(--tlj-color-border);
    border-radius: 10px;
    background: linear-gradient(145deg, rgba(var(--tlj-color-accent-rgb), .035), transparent 66%), var(--tlj-color-surface-2);
}
.tlj-ai-usage-summary {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
}
.tlj-ai-usage-icon {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 1px solid rgba(var(--tlj-color-accent-rgb), .24);
    border-radius: 9px;
    background: rgba(var(--tlj-color-accent-rgb), .065);
    color: var(--tlj-color-accent);
}
.tlj-ai-usage-icon svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.tlj-ai-usage-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}
.tlj-ai-usage-copy > span {
    color: var(--tlj-color-text-secondary);
    font-size: 12px;
    font-weight: 850;
}
.tlj-ai-usage-copy > small {
    color: var(--tlj-color-text-muted-2);
    font-size: 9.75px;
    font-weight: 650;
    line-height: 1.25;
}
.tlj-ai-usage-summary > strong {
    min-width: 32px;
    color: var(--tlj-color-accent);
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
    text-align: right;
}
.tlj-ai-usage-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 6px;
    color: var(--tlj-color-text-muted-2);
    font-size: 9.25px;
    font-weight: 650;
}

/* Cabecera principal: tamaño compacto y estable. */
.tlj-ai-page .tlj-ai-chat-head-actions { gap: 8px; }
.tlj-ai-page .tlj-ai-head-action:not(.tlj-modal-close),
.tlj-ai-page .tlj-ai-delete {
    width: 46px !important;
    height: 46px !important;
    flex: 0 0 46px !important;
    border-radius: 10px !important;
}
.tlj-ai-page .tlj-ai-head-action:not(.tlj-modal-close) svg {
    width: 24px !important;
    height: 24px !important;
    stroke-width: 1.8;
}
.tlj-ai-page .tlj-ai-delete svg {
    width: 27px !important;
    height: 27px !important;
    stroke-width: 1.8;
}
.tlj-ai-page .tlj-ai-head-action--badge > span {
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    font-size: 9.5px;
}

/* Iconos del Historial: Ajustes usa el mismo lenguaje/icono que Preferencias. */
.tlj-ai-page .tlj-ai-history-settings,
.tlj-ai-page .tlj-ai-history-clear {
    width: 38px !important;
    height: 38px !important;
    flex: 0 0 38px !important;
    border-radius: 9px !important;
}
.tlj-ai-page .tlj-ai-history-settings svg,
.tlj-ai-page .tlj-ai-history-clear svg {
    width: 20px !important;
    height: 20px !important;
    stroke-width: 1.75;
}
.tlj-ai-page .tlj-ai-history-pin {
    width: 36px !important;
    min-width: 36px !important;
    min-height: 44px;
    flex-basis: 36px !important;
}
.tlj-ai-page .tlj-ai-history-pin svg {
    width: 18px !important;
    height: 18px !important;
}
.tlj-ai-page .tlj-ai-history-row {
    grid-template-columns: minmax(0, 1fr) 36px 36px;
    gap: 5px;
}

/* Mayor legibilidad de conversación y contexto. */
.tlj-ai-chat-head small {
    display: block;
    margin-bottom: 7px;
    color: var(--tlj-color-accent);
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 1.45px;
    text-transform: uppercase;
}
.tlj-ai-page .tlj-ai-active-context__label {
    font-size: 11.25px;
    letter-spacing: 1.15px;
}
.tlj-ai-page .tlj-ai-active-context__items span {
    min-height: 29px;
    padding: 0 10px;
    font-size: 11.5px;
}
.tlj-ai-page .tlj-ai-message-bubble {
    font-size: 13.25px;
    line-height: 1.68;
}
.tlj-ai-page .tlj-ai-message-scope {
    font-size: 10px;
}
.tlj-ai-page .tlj-ai-message-action {
    font-size: 10.25px;
}

/* Ayudas inferiores más legibles. */
.tlj-ai-page .tlj-ai-input-help {
    margin-top: 6px;
    font-size: 11px;
    font-weight: 650;
    line-height: 1.35;
}
.tlj-ai-page .tlj-ai-footnote {
    padding-bottom: 15px;
    font-size: 12.25px;
    font-weight: 550;
    line-height: 1.55;
}

/* Workspace: placeholders perfectamente centrados y sin recortes. */
.tlj-ai-page .tlj-ai-comparison-editor textarea:focus,
.tlj-ai-page .tlj-ai-comparison-editor textarea:not(:placeholder-shown) {
    overflow-y: auto;
}
.tlj-ai-page .tlj-ai-comparison-editor input::placeholder,
.tlj-ai-page .tlj-ai-comparison-editor textarea::placeholder {
    color: var(--tlj-color-text-muted-2) !important;
    -webkit-text-fill-color: var(--tlj-color-text-muted-2) !important;
    font-size: 12px !important;
    line-height: 18px !important;
    opacity: 1 !important;
}

/* Flujos + Workspace: textos internos mayores, sin alterar sus cabeceras. */
.tlj-ai-page :is(.tlj-ai-workflow-body,.tlj-ai-workspace-body) {
    font-size: 12.5px;
}
.tlj-ai-page :is(.tlj-ai-workflow-body,.tlj-ai-workspace-body) .tlj-ai-pref-heading strong {
    font-size: 14px;
    line-height: 1.35;
}
.tlj-ai-page :is(.tlj-ai-workflow-body,.tlj-ai-workspace-body) .tlj-ai-pref-heading span {
    font-size: 12px;
    line-height: 1.55;
}
.tlj-ai-page .tlj-ai-workflow-preset strong,
.tlj-ai-page .tlj-ai-workspace-preset strong {
    font-size: 13px;
}
.tlj-ai-page .tlj-ai-workflow-preset span,
.tlj-ai-page .tlj-ai-workspace-preset span {
    font-size: 11.5px;
    line-height: 1.5;
}
.tlj-ai-page .tlj-ai-workflow-analysis-main strong,
.tlj-ai-page .tlj-ai-workspace-row strong,
.tlj-ai-page .tlj-ai-collection-row strong {
    font-size: 12.75px;
}
.tlj-ai-page .tlj-ai-workflow-analysis-main span,
.tlj-ai-page .tlj-ai-workspace-row span,
.tlj-ai-page .tlj-ai-collection-row > span {
    font-size: 11.25px;
}
.tlj-ai-page :is(.tlj-ai-workflow-body,.tlj-ai-workspace-body) :is(input,textarea,select,button:not(.tlj-modal-action)) {
    font-size: 11.75px;
}

@media (max-width: 720px){
    .tlj-ai-page .tlj-ai-head-action:not(.tlj-modal-close),
    .tlj-ai-page .tlj-ai-delete {
        width: 40px !important;
        height: 40px !important;
        flex-basis: 40px !important;
    }
    .tlj-ai-page .tlj-ai-head-action:not(.tlj-modal-close) svg { width: 21px !important; height: 21px !important; }
    .tlj-ai-page .tlj-ai-delete svg { width: 23px !important; height: 23px !important; }
    .tlj-ai-page .tlj-ai-chat-head h2 { font-size: 26px; }
    .tlj-ai-page .tlj-ai-chat-head small { font-size: 12.5px; }
    .tlj-ai-page .tlj-ai-message-bubble { font-size: 12.75px; }
}
@media (max-width: 720px){
    .tlj-ai-page .tlj-ai-chat-head { flex-wrap: wrap; }
    .tlj-ai-page .tlj-ai-chat-head-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
        margin-left: auto;
    }
}

/* 1.0.117 · Confianza del análisis y fijación segura al Panel. */
.tlj-ai-viz-panel-tools{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-top:12px;padding-top:10px;border-top:1px solid rgba(var(--tlj-color-accent-rgb),.12)}
.tlj-ai-viz-quality{display:inline-flex;align-items:center;min-height:28px;padding:5px 9px;border:1px solid rgba(var(--tlj-color-accent-rgb),.14);border-radius:7px;background:rgba(var(--tlj-color-accent-rgb),.04);color:var(--tlj-color-text-muted);font-size:10px;font-weight:700;line-height:1.3}
.tlj-ai-viz-quality.is-high{color:var(--tlj-color-positive-text);border-color:rgba(var(--tlj-color-positive-rgb),.24);background:var(--tlj-color-positive-bg)}
.tlj-ai-viz-quality.is-low{color:var(--tlj-color-negative-text);border-color:rgba(var(--tlj-color-negative-rgb),.24);background:var(--tlj-color-negative-bg)}
.tlj-ai-viz-pin{margin-left:auto}
.tlj-ai-viz-pin.is-success{color:var(--tlj-color-positive-text);border-color:rgba(var(--tlj-color-positive-rgb),.28);background:var(--tlj-color-positive-bg)}
