/* ===========================================
   BullAnalytics · Toro (/toro)
   Pantalla dedicada de conversación analítica con Toro.
   Usa exclusivamente los tokens semánticos de market.css y components.css.
   =========================================== */

.toro-page {
    min-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    color: var(--color-ink);
    font-family: var(--font-family, 'Inter', system-ui, sans-serif);
    overflow-x: hidden;
}

/* Evitar colisión del widget flotante de feedback con el compositor de /toro */
.toro-page .feedback-widget {
    display: none;
}

.toro-page .nav {
    flex-shrink: 0;
    z-index: 40;
}

.toro-page .nav-inner {
    max-width: 1440px;
}

/* ==== Botón fantasma auxiliar ==== */
.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: var(--radius-control);
    border: 1px solid transparent;
    background: transparent;
    color: var(--color-muted);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color .15s ease, color .15s ease;
}

.btn-ghost:hover:not(:disabled) {
    background: var(--color-surface-3);
    color: var(--color-ink);
}

.btn-ghost:focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: 2px;
}

/* ==== Workspace principal (Sidebar + Conversación) ==== */
.toro-workspace {
    position: relative;
    flex: 1;
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr);
    min-height: 0;
    min-width: 0;
    background: var(--color-surface);
}

.toro-workspace.sidebar-collapsed {
    grid-template-columns: 0 minmax(0, 1fr);
}

.toro-drawer-backdrop {
    display: none;
    background: color-mix(in srgb, var(--color-ink) 45%, transparent);
    backdrop-filter: blur(2px);
    border: 0;
}

.toro-sidebar {
    background: var(--color-surface-2);
    border-right: 1px solid var(--color-line);
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    transition: transform .2s ease, opacity .15s ease;
}

.toro-workspace.sidebar-collapsed .toro-sidebar {
    border-right: 0;
    opacity: 0;
    pointer-events: none;
}

.toro-sidebar-top {
    padding: 14px;
    border-bottom: 1px solid var(--color-line);
    display: flex;
    align-items: center;
    gap: 8px;
}

.toro-new-chat {
    flex: 1;
    justify-content: flex-start;
}

.toro-new-chat svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.toro-drawer-close {
    display: none;
}

.toro-sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 0;
}

.toro-sidebar-group-title {
    padding: 0 8px 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--color-faint);
}

.toro-thread-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toro-thread-empty {
    padding: 10px;
    border-radius: var(--radius-control);
    border: 1px dashed var(--color-line-strong);
    font-size: 12px;
    color: var(--color-muted);
    line-height: 1.45;
}

.toro-thread-row {
    display: flex;
    align-items: center;
    gap: 4px;
    border-radius: var(--radius-control);
    border: 1px solid transparent;
    padding-right: 4px;
    transition: background-color .15s ease, border-color .15s ease;
}

.toro-thread-row:hover {
    background: var(--color-surface);
    border-color: var(--color-line);
}

.toro-thread-row.active {
    background: var(--color-surface);
    border-color: var(--color-line-strong);
    box-shadow: var(--shadow-card);
}

.toro-thread-item {
    flex: 1;
    min-width: 0;
    text-align: left;
    padding: 8px 10px;
    border: 0;
    background: transparent;
    color: var(--color-ink);
    display: flex;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
}

.toro-thread-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toro-thread-meta {
    font-size: 11px;
    color: var(--color-muted);
}

.toro-thread-delete {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 0;
    background: transparent;
    color: var(--color-faint);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity .15s ease, color .15s ease, background-color .15s ease;
}

.toro-thread-row:hover .toro-thread-delete,
.toro-thread-delete:focus-visible {
    opacity: 1;
}

.toro-thread-delete:hover {
    color: var(--color-danger);
    background: var(--color-danger-bg);
}

.toro-thread-delete svg {
    width: 14px;
    height: 14px;
}

.toro-sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toro-sidebar-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: var(--radius-control);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-muted);
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}

.toro-sidebar-link:hover {
    background: var(--color-surface);
    color: var(--color-ink);
}

.toro-sidebar-link svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.toro-sidebar-foot {
    padding: 12px 14px;
    border-top: 1px solid var(--color-line);
    background: var(--color-surface-2);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toro-quota-box {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.toro-quota-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--color-muted);
    font-variant-numeric: tabular-nums;
}

.toro-quota-track {
    height: 6px;
    border-radius: 999px;
    background: var(--color-line);
    overflow: hidden;
}

.toro-quota-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--color-brand);
    transition: width .25s ease;
}

.toro-quota-fill.is-danger {
    background: var(--color-danger);
}

.toro-sidebar-disclaimer {
    font-size: 11px;
    line-height: 1.4;
    color: var(--color-faint);
    margin: 0;
}

/* ==== Columna principal de conversación ==== */
.toro-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: var(--color-surface);
}

.toro-subbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--color-line);
    background: var(--color-surface);
    min-width: 0;
    flex-shrink: 0;
}

.toro-subbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.toro-drawer-open-btn {
    display: none;
}

.toro-thread-heading {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.toro-thread-name {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--color-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 42ch;
}

.toro-context-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--color-line);
    background: var(--color-brand-soft);
    color: var(--color-brand-strong);
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}

html.dark .toro-context-chip {
    color: var(--color-ink);
}

.toro-context-chip svg {
    width: 13px;
    height: 13px;
}

.toro-context-chip-clear {
    border: 0;
    background: transparent;
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border-radius: 999px;
    cursor: pointer;
    opacity: .75;
}

.toro-context-chip-clear:hover {
    opacity: 1;
    background: var(--color-surface-3);
}

.toro-subbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ==== Flujo de mensajes ==== */
.toro-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.toro-stream {
    max-width: 820px;
    width: 100%;
    margin: 0 auto;
    padding: 28px 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
}

/* ==== Bienvenida / Estado vacío ==== */
.toro-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 18px 0 8px;
    gap: 12px;
}

.toro-welcome-logo {
    width: 52px;
    height: 52px;
    display: block;
}

.toro-welcome-title {
    margin: 0;
    font-size: clamp(23px, 3vw, 29px);
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--color-ink);
    line-height: 1.2;
}

.toro-welcome-sub {
    margin: 0;
    max-width: 56ch;
    font-size: 14.5px;
    color: var(--color-muted);
    line-height: 1.6;
}

.toro-starter-grid {
    width: 100%;
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    text-align: left;
}

.toro-starter-card {
    padding: 15px 16px;
    border-radius: var(--radius-card);
    border: 1px solid var(--color-line);
    background: var(--color-surface-2);
    display: flex;
    flex-direction: column;
    gap: 7px;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.toro-starter-card:hover:not(:disabled) {
    border-color: var(--color-brand);
    background: var(--color-surface);
    box-shadow: var(--shadow-card);
}

.toro-starter-card:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.toro-starter-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--color-brand-strong);
}

html.dark .toro-starter-card-head {
    color: var(--color-success);
}

.toro-starter-card-head svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.toro-starter-card-prompt {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--color-ink);
    line-height: 1.45;
}

/* ==== Turnos de usuario y Toro ==== */
.turn-user {
    display: flex;
    justify-content: flex-end;
    min-width: 0;
}

.turn-user-pill {
    max-width: min(78%, 580px);
    padding: 12px 16px;
    border-radius: 16px 16px 4px 16px;
    background: var(--color-surface-3);
    border: 1px solid var(--color-line);
    color: var(--color-ink);
    font-size: 14.5px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.turn-assistant {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.turn-assistant-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.turn-assistant-id {
    display: flex;
    align-items: center;
    gap: 9px;
}

.turn-assistant-logo {
    width: 26px;
    height: 26px;
    display: block;
    flex-shrink: 0;
}

.turn-assistant-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-ink);
}

.freshness-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: var(--color-surface-2);
    border: 1px solid var(--color-line);
    color: var(--color-muted);
}

.freshness-badge.is-brand {
    background: var(--color-brand-soft);
    border-color: transparent;
    color: var(--color-brand-strong);
}

html.dark .freshness-badge.is-brand {
    color: var(--color-success);
}

.freshness-badge.is-info {
    background: var(--color-info-bg);
    border-color: transparent;
    color: var(--color-info);
}

.turn-prose {
    font-size: 15px;
    line-height: 1.65;
    color: var(--color-ink);
    min-width: 0;
    overflow-wrap: anywhere;
}

.turn-prose > *:first-child {
    margin-top: 0;
}

.turn-prose > *:last-child {
    margin-bottom: 0;
}

.turn-prose .toro-p {
    margin: 0 0 12px;
}

.turn-prose .toro-h1 {
    margin: 20px 0 10px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.turn-prose .toro-h2 {
    margin: 18px 0 8px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.015em;
}

.turn-prose .toro-h3 {
    margin: 16px 0 7px;
    font-size: 15.5px;
    font-weight: 700;
}

.turn-prose .toro-h4 {
    margin: 14px 0 6px;
    font-size: 14.5px;
    font-weight: 700;
}

.turn-prose .toro-list {
    margin: 8px 0 12px;
    padding-left: 20px;
}

.turn-prose .toro-list li {
    margin-bottom: 6px;
}

.turn-prose .toro-hr {
    border: 0;
    border-top: 1px solid var(--color-line);
    margin: 16px 0;
}

.turn-prose .toro-link {
    color: var(--color-brand-strong);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

html.dark .turn-prose .toro-link {
    color: var(--color-success);
}

.turn-prose .toro-code {
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 13px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: var(--color-surface-3);
    border: 1px solid var(--color-line);
}

.turn-prose .toro-pre {
    margin: 12px 0;
    padding: 12px;
    border-radius: var(--radius-control);
    border: 1px solid var(--color-line);
    background: var(--color-surface-2);
    overflow-x: auto;
    font-size: 12.5px;
    line-height: 1.5;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: var(--color-ink);
}

.turn-prose .toro-quote {
    margin: 12px 0;
    padding: 10px 14px;
    border-left: 3px solid var(--color-brand);
    border-radius: 0 var(--radius-control) var(--radius-control) 0;
    background: var(--color-surface-2);
    color: var(--color-muted);
    font-size: 14px;
}

.turn-prose .toro-callout {
    margin: 14px 0;
    padding: 12px 14px;
    border-radius: var(--radius-control);
    border: 1px solid var(--color-line);
    border-left: 3px solid var(--color-warning);
    background: var(--color-warning-bg);
    color: var(--color-ink);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13.5px;
    line-height: 1.5;
}

.turn-prose .toro-callout-icon {
    width: 18px;
    height: 18px;
    color: var(--color-warning-strong);
    flex-shrink: 0;
    margin-top: 2px;
}

/* ==== Tablas desplazables en /toro ==== */
.turn-prose .toro-table-shell {
    margin: 14px 0;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-card);
    background: var(--color-surface);
    overflow: hidden;
    max-width: 100%;
    min-width: 0;
}

.turn-prose .toro-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    border: 0;
    border-radius: 0;
    margin: 0;
    -webkit-overflow-scrolling: touch;
}

.turn-prose .toro-table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    font-size: 13px;
    line-height: 1.48;
    font-variant-numeric: tabular-nums;
}

.turn-prose .toro-table th,
.turn-prose .toro-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-line);
    text-align: left;
    vertical-align: top;
    word-break: normal;
    overflow-wrap: break-word;
}

.turn-prose .toro-table tbody tr:last-child td {
    border-bottom: 0;
}

.turn-prose .toro-table th {
    background: var(--color-surface-2);
    font-size: 12px;
    font-weight: 700;
    color: var(--color-muted);
    white-space: nowrap;
}

.turn-prose .toro-table th:first-child,
.turn-prose .toro-table td:first-child {
    min-width: 148px;
    font-weight: 600;
    color: var(--color-ink);
}

.turn-prose .toro-table th.num,
.turn-prose .toro-table td.num {
    text-align: right;
    white-space: nowrap;
}

.turn-prose .toro-table tbody tr:hover {
    background: var(--color-surface-2);
}

/* ==== Tarjetas de acción propuesta (Deep-links) ==== */
.toro-actions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toro-action-card {
    padding: 14px 16px;
    border-radius: var(--radius-card);
    border: 1px solid var(--color-line);
    background: var(--color-surface-2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.toro-action-card-left {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}

.toro-action-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-control);
    background: var(--color-brand-soft);
    color: var(--color-brand-strong);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

html.dark .toro-action-icon {
    color: var(--color-success);
}

.toro-action-icon svg {
    width: 20px;
    height: 20px;
}

.toro-action-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--color-ink);
}

.toro-action-desc {
    font-size: 12.5px;
    color: var(--color-muted);
    margin-top: 2px;
    overflow-wrap: anywhere;
}

/* ==== Tarjetas interactivas de confirmación CRUD de alertas ==== */
.toro-crud-card {
    padding: 16px;
    border-radius: var(--radius-card);
    border: 1px solid var(--color-brand);
    background: var(--color-surface-2);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.toro-crud-card.is-delete {
    border-color: var(--color-danger);
}

.toro-crud-card.is-confirmed {
    border-color: var(--color-brand);
    background: var(--color-brand-soft);
}

.toro-crud-card.is-cancelled {
    border-color: var(--color-line);
    opacity: .85;
}

.toro-crud-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.toro-crud-title-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    flex: 1 1 220px;
}

.toro-crud-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-control);
    background: var(--color-brand-soft);
    color: var(--color-brand-strong);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

html.dark .toro-crud-icon {
    color: var(--color-success);
}

.toro-crud-icon.is-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.toro-crud-icon.is-success {
    background: var(--color-surface);
    color: var(--color-brand-strong);
}

html.dark .toro-crud-icon.is-success {
    color: var(--color-success);
}

.toro-crud-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-ink);
}

.toro-crud-sub {
    margin-top: 2px;
    font-size: 12.5px;
    color: var(--color-muted);
    line-height: 1.45;
}

.toro-crud-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    min-width: 0;
}

.toro-crud-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.toro-crud-field--full {
    grid-column: 1 / -1;
}

.toro-crud-label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--color-muted);
}

.toro-crud-input,
.toro-crud-select {
    width: 100%;
    padding: 8px 11px;
    border-radius: var(--radius-control);
    border: 1px solid var(--color-line-strong);
    background: var(--color-surface);
    color: var(--color-ink);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    font-variant-numeric: tabular-nums;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.toro-crud-input:focus,
.toro-crud-select:focus {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 2px var(--color-brand-soft);
}

.toro-crud-summary {
    padding: 11px 13px;
    border-radius: var(--radius-control);
    border: 1px solid var(--color-line);
    background: var(--color-surface);
    font-size: 13px;
    color: var(--color-ink);
    line-height: 1.5;
}

.toro-crud-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    border-radius: var(--radius-control);
    border: 1px solid var(--color-danger);
    background: var(--color-danger-bg);
    color: var(--color-danger);
    font-size: 12.5px;
    font-weight: 600;
}

.toro-crud-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.toro-crud-confirm-btn {
    border-color: var(--color-brand);
    color: var(--color-brand-strong);
    background: var(--color-surface);
    font-weight: 700;
}

html.dark .toro-crud-confirm-btn {
    color: var(--color-success);
}

.toro-crud-confirm-btn:hover:not(:disabled) {
    background: var(--color-brand-soft);
    border-color: var(--color-brand);
}

/* ==== Citas y acciones por turno ==== */
.turn-assistant .toro-citations {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    padding-top: 0;
    border-top: 0;
}

.turn-assistant .toro-citation {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--color-line);
    background: var(--color-surface-2);
    color: var(--color-brand-strong);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}

html.dark .turn-assistant .toro-citation {
    color: var(--color-success);
}

.turn-assistant .toro-citation:hover {
    border-color: var(--color-brand);
    background: var(--color-brand-soft);
}

.turn-assistant .toro-citation svg {
    width: 13px;
    height: 13px;
}

.turn-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.turn-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.turn-action-btn:hover {
    background: var(--color-surface-2);
    border-color: var(--color-line);
    color: var(--color-ink);
}

.turn-action-btn.active {
    background: var(--color-brand-soft);
    color: var(--color-brand-strong);
}

html.dark .turn-action-btn.active {
    color: var(--color-success);
}

.turn-action-btn svg {
    width: 15px;
    height: 15px;
}

/* ==== Estado Pensando / Herramientas ==== */
.toro-thinking {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    border-radius: var(--radius-card);
    border: 1px solid var(--color-line);
    background: var(--color-surface-2);
}

.thinking-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.thinking-step {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-muted);
}

.thinking-step.is-done {
    color: var(--color-success);
}

.thinking-step.is-active {
    color: var(--color-ink);
}

.thinking-step svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.thinking-step-meta {
    margin-left: auto;
    font-size: 11.5px;
}

.skeleton-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 6px;
    border-top: 1px solid var(--color-line);
}

.skeleton-bar {
    height: 11px;
    border-radius: 999px;
    background: var(--color-line);
    animation: toro-pulse 1.3s ease-in-out infinite;
}

.skeleton-bar.w-85 { width: 85%; }
.skeleton-bar.w-65 { width: 65%; }
.skeleton-bar.w-45 { width: 45%; }

/* ==== Estado Error / Límite 429 ==== */
.toro-stream .toro-error-box {
    padding: 14px 16px;
    border-radius: var(--radius-card);
    border: 1px solid var(--color-danger);
    background: var(--color-danger-bg);
    color: var(--color-ink);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toro-error-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.toro-error-row svg {
    width: 20px;
    height: 20px;
    color: var(--color-danger);
    flex-shrink: 0;
    margin-top: 2px;
}

.toro-error-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-danger);
}

.toro-error-msg {
    margin: 3px 0 0;
    font-size: 13px;
    color: var(--color-ink);
}

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

.toro-countdown {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-muted);
    font-variant-numeric: tabular-nums;
}

/* ==== Estado Plan Free / Guest (Paywall educativo) ==== */
.toro-paywall {
    padding: 18px;
    border-radius: var(--radius-card);
    border: 1px solid var(--color-line-strong);
    background: var(--color-surface-2);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toro-paywall-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.toro-paywall-badge {
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--color-warning-bg);
    color: var(--color-warning-strong);
    font-size: 11px;
    font-weight: 700;
}

.toro-paywall h3 {
    margin: 0;
    font-size: 15.5px;
    font-weight: 700;
    color: var(--color-ink);
}

.toro-paywall p {
    margin: 0;
    font-size: 13.5px;
    color: var(--color-muted);
}

.toro-paywall ul {
    margin: 0;
    padding-left: 18px;
    font-size: 13px;
    color: var(--color-ink);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toro-paywall-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ==== Composer fijo abajo ==== */
.toro-composer-dock {
    flex-shrink: 0;
    border-top: 1px solid var(--color-line);
    background: var(--color-surface);
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
}

.toro-composer-wrap {
    max-width: 820px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.toro-composer {
    border: 1px solid var(--color-line-strong);
    border-radius: var(--radius-card);
    background: var(--color-surface-2);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.toro-composer:focus-within {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px var(--color-brand-soft);
}

.toro-composer .toro-input {
    width: 100%;
    min-height: 24px;
    max-height: 140px;
    padding: 0;
    resize: none;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--color-ink);
    font-size: 14.5px;
    line-height: 1.45;
    outline: none;
    box-shadow: none;
}

.toro-composer .toro-input:focus {
    border: 0;
    box-shadow: none;
}

.toro-composer .toro-input::placeholder {
    color: var(--color-faint);
}

.toro-composer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

.composer-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.composer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.toro-mic-btn {
    border-radius: var(--radius-control);
}

.toro-mic-btn.is-recording {
    border-color: var(--color-danger);
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.toro-mic-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* ==== Barra de grabación y revisión de transcripción (OpenRouter) ==== */
.toro-voice-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 9px 12px;
    border-radius: var(--radius-control);
    border: 1px solid var(--color-line);
    background: var(--color-surface);
    min-width: 0;
}

.toro-voice-bar.is-recording {
    border-color: var(--color-danger);
    background: var(--color-danger-bg);
}

.toro-voice-bar.is-transcribing {
    border-color: var(--color-info);
    background: var(--color-info-bg);
}

.toro-voice-bar.is-error {
    border-color: var(--color-danger);
    background: var(--color-danger-bg);
}

.voice-status {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    flex: 1 1 200px;
    flex-wrap: wrap;
}

.voice-rec-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--color-danger);
    flex-shrink: 0;
    animation: voice-dot-pulse 1.1s ease-in-out infinite;
}

@keyframes voice-dot-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .4; transform: scale(.85); }
}

.voice-status-text {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--color-ink);
}

.voice-sub-note {
    font-size: 11.5px;
    color: var(--color-muted);
}

.voice-timer {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-danger);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.voice-wave {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 18px;
}

.voice-wave span {
    width: 3px;
    border-radius: 999px;
    background: var(--color-danger);
    animation: voice-wave-bar .9s ease-in-out infinite;
}

.voice-wave span:nth-child(1) { height: 7px; animation-delay: 0s; }
.voice-wave span:nth-child(2) { height: 14px; animation-delay: .12s; }
.voice-wave span:nth-child(3) { height: 10px; animation-delay: .24s; }
.voice-wave span:nth-child(4) { height: 16px; animation-delay: .08s; }
.voice-wave span:nth-child(5) { height: 9px; animation-delay: .3s; }
.voice-wave span:nth-child(6) { height: 15px; animation-delay: .18s; }
.voice-wave span:nth-child(7) { height: 11px; animation-delay: .4s; }
.voice-wave span:nth-child(8) { height: 8px; animation-delay: .22s; }

@keyframes voice-wave-bar {
    0%, 100% { transform: scaleY(.55); }
    50% { transform: scaleY(1.15); }
}

.voice-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.voice-stop-btn {
    padding: 6px 11px;
    font-size: 12px;
    border-color: var(--color-danger);
    color: var(--color-danger);
    background: var(--color-surface);
}

.voice-stop-btn:hover:not(:disabled) {
    border-color: var(--color-danger);
    background: var(--color-surface);
    color: var(--color-danger);
}

.toro-transcript-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 11px;
    border-radius: var(--radius-control);
    border: 1px solid var(--color-brand);
    background: var(--color-brand-soft);
    min-width: 0;
}

.transcript-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1 1 220px;
    flex-wrap: wrap;
}

.transcript-info svg {
    width: 15px;
    height: 15px;
    color: var(--color-brand-strong);
    flex-shrink: 0;
}

html.dark .transcript-info svg {
    color: var(--color-success);
}

.transcript-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-brand-strong);
}

html.dark .transcript-label {
    color: var(--color-ink);
}

.transcript-model-pill {
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--color-line);
    background: var(--color-surface);
    color: var(--color-muted);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.transcript-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.transcript-actions .btn-ghost {
    padding: 4px 8px;
    font-size: 11.5px;
    color: var(--color-ink);
}

@media (prefers-reduced-motion: reduce) {
    .voice-rec-dot,
    .voice-wave span,
    .skeleton-bar {
        animation: none;
    }
}

.context-select {
    max-width: 100%;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid var(--color-line);
    background: var(--color-surface);
    color: var(--color-ink);
    font-size: 12px;
    font-weight: 600;
}

.char-hint {
    font-size: 11.5px;
    color: var(--color-faint);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.toro-foot-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 11.5px;
    color: var(--color-muted);
}

/* ==== Responsive (Tablet <= 959px / Mobile <= 767px) ==== */
@media (max-width: 959px) {
    .toro-workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    .toro-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(300px, 86vw);
        z-index: 70;
        transform: translateX(-105%);
        box-shadow: var(--ba-shadow);
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .toro-workspace.drawer-open .toro-sidebar {
        transform: translateX(0);
    }

    .toro-drawer-backdrop {
        position: fixed;
        inset: 0;
        z-index: 65;
    }

    .toro-workspace.drawer-open .toro-drawer-backdrop {
        display: block;
    }

    .toro-drawer-close,
    .toro-drawer-open-btn {
        display: inline-flex;
    }

    .toro-desktop-collapse-btn {
        display: none;
    }
}

@media (max-width: 767px) {
    .toro-page {
        height: auto;
        min-height: 100vh;
    }

    .toro-subbar {
        padding: 10px 14px;
    }

    .toro-stream {
        padding: 16px 14px 20px;
        gap: 18px;
    }

    .toro-starter-grid {
        grid-template-columns: 1fr;
    }

    .toro-action-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .toro-crud-grid {
        grid-template-columns: 1fr;
    }

    .toro-composer-dock {
        padding: 10px 12px calc(74px + env(safe-area-inset-bottom, 0px));
    }

    .char-hint {
        display: none;
    }

    .toro-foot-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
        font-size: 11px;
    }

    .context-select {
        max-width: 158px;
    }

    .toro-voice-bar,
    .toro-transcript-banner {
        flex-direction: column;
        align-items: flex-start;
    }
}
