/* Catálogo de conversas da IDE. Mantém o visual P&B da página sem alterar o chat. */
.history-panel {
    flex: 0 0 auto;
    margin: 10px 14px 0;
    padding: 14px;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow-heavy);
    background: var(--surface);
    color: var(--text-primary);
    max-height: min(54vh, 620px);
    overflow-y: auto;
    z-index: 10;
}

.history-panel [hidden] {
    display: none !important;
}

.history-panel-header,
.history-status-row,
.history-section-heading,
.history-search-row,
.history-pagination,
.history-detail-actions {
    display: flex;
    align-items: center;
}

.history-panel-header {
    justify-content: space-between;
    gap: 12px;
}

.history-kicker {
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .8px;
    text-transform: uppercase;
}

.history-panel-title {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -.2px;
}

.history-source-note,
.history-credential-hint,
.history-continuation-limit,
.history-action-feedback,
.history-empty-copy {
    color: var(--text-secondary);
    font-size: 11.5px;
    line-height: 1.5;
}

.history-source-note {
    margin: 5px 0 12px;
    max-width: 860px;
}

.history-credential-details {
    border: 1px solid var(--border-color);
    background: var(--surface-2);
}

.history-credential-details > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
    list-style-position: inside;
    text-transform: uppercase;
    letter-spacing: .35px;
}

.history-credential-details > summary span {
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

.history-credential-details > summary:focus-visible {
    outline: 2px solid #000;
    outline-offset: -2px;
}

.history-credential-form {
    padding: 10px;
    border-top: 1px solid var(--border-color);
}

.history-field-label {
    display: block;
    margin-bottom: 5px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .35px;
}

.history-credential-controls {
    display: flex;
    align-items: stretch;
    gap: 7px;
}

.history-token-input,
.history-search-input {
    min-width: 0;
    border: 1px solid var(--border-color);
    border-radius: 0;
    background: var(--surface);
    color: var(--text-primary);
    outline: none;
    font: 500 13px var(--font-sans);
}

.history-token-input {
    flex: 1 1 280px;
    min-height: 34px;
    padding: 7px 9px;
}

.history-token-input:focus,
.history-search-input:focus {
    box-shadow: 3px 3px 0 #000;
}

.history-credential-hint {
    margin-top: 5px;
}

.history-login-link {
    display: inline-flex;
    margin-top: 7px;
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 800;
    text-decoration: underline;
}

.history-status-row {
    justify-content: space-between;
    gap: 12px;
    padding: 8px 1px 4px;
}

.history-status {
    min-width: 0;
    color: var(--text-secondary);
    font-size: 11.5px;
    font-weight: 700;
}

.history-status.is-error,
.history-detail-error {
    color: #7b0000;
}

.history-last-checked {
    flex: 0 0 auto;
    color: var(--text-secondary);
    font-size: 10.5px;
    font-weight: 700;
    text-align: right;
}

.history-content-grid {
    display: flex;
    flex-direction: column;
    width: 100%;
    position: static;
}

.history-catalog-column,
.history-detail-column,
.history-local-sessions {
    min-width: 0;
    border: 1px solid var(--border-color);
    background: var(--surface);
}

.history-catalog-column,
.history-detail-column {
    display: flex;
    flex-direction: column;
    min-height: 220px;
}

.history-section-heading {
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-2);
}

.history-section-heading h3 {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .1px;
}

.history-count,
.history-detail-source {
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .35px;
}

.history-search-row {
    padding: 8px;
    border-bottom: 1px solid #e1e1e1;
}

.history-search-input {
    width: 100%;
    min-height: 32px;
    padding: 6px 8px;
}

.history-catalog-list,
.history-message-list,
.history-local-list {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.history-catalog-list {
    flex: 1 1 auto;
    min-height: 108px;
    max-height: 245px;
    padding: 7px;
}

.history-chat-card,
.history-local-card {
    width: 100%;
    display: block;
    border: 1px solid #b8b8b8;
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.history-chat-card + .history-chat-card,
.history-local-card + .history-local-card {
    margin-top: 6px;
}

.history-chat-card {
    padding: 8px 9px;
}

.history-chat-card:hover:not(:disabled),
.history-local-card:hover:not(:disabled),
.history-chat-card.is-selected,
.history-local-card.is-selected {
    border-color: #000;
    background: var(--surface-2);
    box-shadow: 2px 2px 0 #000;
}

.history-chat-card:focus-visible,
.history-local-card:focus-visible,
.history-detail-actions .btn:focus-visible,
.history-pagination .btn:focus-visible {
    outline: 2px solid #000;
    outline-offset: 2px;
}

.history-chat-card:disabled,
.history-local-card:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.history-card-title,
.history-local-card-title {
    display: block;
    overflow: hidden;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-card-meta,
.history-local-card-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
}

.history-card-meta span:last-child,
.history-local-card-meta span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-pagination {
    justify-content: space-between;
    gap: 6px;
    padding: 7px;
    border-top: 1px solid var(--border-color);
}

.history-page-button {
    min-height: 29px;
    padding: 4px 8px;
    font-size: 10.5px;
}

.history-page-label {
    color: var(--text-secondary);
    font-size: 10.5px;
    font-weight: 800;
}

.history-detail-source {
    max-width: 50%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-detail-empty,
.history-detail-error {
    padding: 16px 12px;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.5;
}

.history-detail-body {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
}

.history-detail-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 9px 10px 7px;
}

.history-detail-chat-title {
    overflow-wrap: anywhere;
    font-size: 13px;
    line-height: 1.35;
}

.history-detail-meta span {
    color: var(--text-secondary);
    font-size: 10.5px;
    font-weight: 700;
}

.history-truncated-note {
    margin: 0 10px 7px;
    padding: 6px 8px;
    border-left: 3px solid #000;
    background: var(--surface-2);
    color: var(--text-secondary);
    font-size: 10.5px;
    font-weight: 700;
}

.history-message-list {
    flex: 1 1 auto;
    min-height: 96px;
    max-height: 205px;
    padding: 0 10px 8px;
}

.history-message {
    padding: 7px 8px;
    border: 1px solid #d0d0d0;
    background: var(--surface);
}

.history-message + .history-message {
    margin-top: 6px;
}

.history-message-role {
    display: block;
    margin-bottom: 3px;
    color: var(--text-secondary);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .5px;
    text-transform: uppercase;
}

.history-message-content {
    display: block;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 11.5px;
    line-height: 1.45;
}

.history-detail-actions {
    flex-wrap: wrap;
    gap: 7px;
    padding: 8px 10px 0;
}

.history-detail-actions .btn {
    min-height: 31px;
    padding: 5px 8px;
    font-size: 10.5px;
}

.history-continuation-limit,
.history-action-feedback {
    padding: 6px 10px 0;
}

.history-action-feedback {
    min-height: 22px;
    font-weight: 800;
}

.history-local-sessions {
    margin-top: 12px;
}

.history-local-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 7px;
    max-height: 128px;
    padding: 7px;
}

.history-local-card {
    padding: 8px;
}

.history-local-card + .history-local-card {
    margin-top: 0;
}

.history-refresh-button {
    flex: 0 0 auto;
}

.history-refresh-button.is-loading i {
    animation: history-spin .8s linear infinite;
}

@keyframes history-spin {
    to { transform: rotate(360deg); }
}

.history-panel button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 720px) {
    .history-panel {
        margin: 8px 10px 0;
        padding: 10px;
        max-height: min(64vh, 700px);
    }

    .history-content-grid {
        display: flex;
        flex-direction: column;
        width: 100%;
        position: static;
    }

    .history-catalog-list,
    .history-message-list {
        max-height: 175px;
    }

    .history-detail-column {
        min-height: 190px;
    }
}

@media (max-width: 480px) {
    .history-panel-header {
        align-items: flex-start;
    }

    .history-panel-title {
        font-size: 15px;
    }

    .history-credential-details > summary {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }

    .history-credential-controls {
        flex-wrap: wrap;
    }

    .history-token-input {
        flex-basis: 100%;
    }

    .history-status-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }

    .history-last-checked {
        text-align: left;
    }

    .history-detail-actions .btn {
        flex: 1 1 100%;
        justify-content: center;
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   SHELL DA IDE: sessões compactas à esquerda, conversa ampla ao centro
───────────────────────────────────────────────────────────────────────────── */
.app-layout {
    display: grid;
    grid-template-columns: var(--history-sidebar-width, minmax(268px, 304px)) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    width: 100%;
    max-width: none;
    margin: 0;
    overflow: hidden;
}

header.app-header {
    grid-column: 1 / -1;
    grid-row: 1;
}

.history-panel {
    grid-column: 1;
    grid-row: 2;
    position: relative;
    min-width: 0;
    min-height: 0;
    height: 100%;
    max-height: none;
    margin: 0;
    padding: 14px 12px;
    border: 0;
    border-right: 1px solid var(--border-color);
    box-shadow: none;
    overflow-y: auto;
    background: rgba(255, 255, 255, .98);
    z-index: 20;
}

.app-layout.history-dock-right .history-panel {
    grid-column: 2;
    border-right: 0;
    border-left: 1px solid var(--border-color);
}

@media (min-width: 821px) {
    .app-layout.history-dock-right {
        grid-template-columns: minmax(0, 1fr) var(--history-sidebar-width, minmax(268px, 304px));
    }
}

.app-layout.history-dock-right .chat-workspace {
    grid-column: 1;
    border-left: 0;
    border-right: 1px solid #e2e2e2;
}

@media (min-width: 821px) {
    .app-layout.history-sidebar-collapsed {
        grid-template-columns: 56px minmax(0, 1fr);
    }

    .app-layout.history-sidebar-collapsed.history-dock-right {
        grid-template-columns: minmax(0, 1fr) 56px;
    }

    .history-sidebar-collapsed .history-panel {
        padding: 10px 6px;
        overflow-x: hidden;
    }

    .history-sidebar-collapsed .history-panel-header {
        display: block;
    }

    .history-sidebar-collapsed .history-panel-header > div:first-child,
    .history-sidebar-collapsed .history-source-note,
    .history-sidebar-collapsed .history-credential-details,
    .history-sidebar-collapsed .history-status-row,
    .history-sidebar-collapsed .history-content-grid,
    .history-sidebar-collapsed .history-local-sessions {
        display: none !important;
    }

    .history-sidebar-collapsed .history-panel-tools {
        width: 100%;
        margin-top: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 7px;
    }

    .history-sidebar-collapsed .history-panel-tools .btn {
        width: 100%;
        min-height: 34px;
        justify-content: center;
        padding: 5px 2px;
    }

    .history-sidebar-collapsed .history-panel-tools .btn span,
    .history-sidebar-collapsed .history-mobile-close {
        display: none !important;
    }
}

.history-panel-header {
    align-items: flex-start;
    gap: 8px;
}

.history-panel-tools {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 5px;
}

.history-panel-tools .btn {
    min-height: 30px;
    padding: 4px 7px;
    font-size: 10px;
}

.history-panel-tools .history-refresh-button span {
    display: none;
}

.history-panel-title {
    font-size: 15px;
    line-height: 1.15;
}

.history-source-note {
    margin: 6px 0 9px;
    font-size: 10.5px;
    line-height: 1.4;
}

.history-status-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
    padding: 7px 1px 5px;
}

.history-status,
.history-last-checked {
    font-size: 10px;
    text-align: left;
}

.history-content-grid,
.history-content-grid:not([hidden]) {
    position: static;
    top: auto;
    left: auto;
    transform: none;
    z-index: auto;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: none;
    padding: 0;
    border: none;
    box-shadow: none;
    background: transparent;
    overflow: visible;
}

.history-drawer-toolbar {
    display: none !important;
}

.history-detail-column,
.history-local-sessions {
    display: none !important;
}

.history-content-grid .history-catalog-column {
    width: 100%;
    min-height: 0;
}

.history-content-grid .history-catalog-list {
    max-height: calc(100vh - 280px);
    overflow-y: auto;
}

.history-overlay:not([hidden]) {
    display: none;
}

.history-panel.history-panel-mobile-open ~ .history-overlay:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: block;
    background: rgba(0, 0, 0, .18);
}

.history-mobile-toggle {
    display: none;
}

.history-mobile-close {
    display: none;
}

.history-resize-handle {
    position: absolute;
    z-index: 3;
    top: 0;
    right: -4px;
    bottom: 0;
    width: 8px;
    cursor: col-resize;
    touch-action: none;
}

.history-resize-handle::after {
    position: absolute;
    top: 50%;
    right: 3px;
    width: 2px;
    height: 42px;
    background: transparent;
    content: '';
    transform: translateY(-50%);
    transition: background-color .15s ease, height .15s ease;
}

.history-resize-handle:hover::after,
.history-resize-handle:focus-visible::after,
.history-resizing .history-resize-handle::after {
    height: 64px;
    background: #000;
}

.history-resize-handle:focus-visible {
    outline: 2px solid #000;
    outline-offset: -2px;
}

.app-layout.history-dock-right .history-resize-handle {
    right: auto;
    left: -4px;
}

.app-layout.history-dock-right .history-resize-handle::after {
    right: auto;
    left: 3px;
}

.history-resizing,
.history-resizing * {
    cursor: col-resize !important;
    user-select: none !important;
}

.history-local-sessions {
    margin-top: 10px;
    border: 0;
}

.history-local-sessions .history-section-heading {
    padding: 6px 1px;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
}

.history-local-list {
    display: flex;
    max-height: none;
    flex-direction: column;
    gap: 5px;
    padding: 7px 0;
}

.history-local-card {
    padding: 7px 8px;
}

.history-local-card + .history-local-card {
    margin-top: 0;
}

.chat-workspace {
    grid-column: 2;
    grid-row: 2;
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
    border-left: 1px solid #e2e2e2;
    background: rgba(255, 255, 255, .35);
}

.chat-workspace main.chat-container {
    min-height: 0;
    flex: 1 1 auto;
    padding: 16px 24px calc(138px + var(--safe-bottom));
}

.chat-workspace footer.chat-footer {
    right: 0;
    bottom: 0;
    left: 0;
}

.chat-workspace .empty-state {
    max-width: 680px;
    margin: auto;
    border-width: 1px;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, .16);
}

.history-panel + .history-overlay + .chat-workspace {
    min-height: 0;
}

/* Barra de comandos: ocupa uma faixa curta e deixa o restante para a conversa. */
.command-bar {
    flex: 0 0 auto;
    width: 100%;
    margin: 0 auto 12px;
    padding: 9px 10px;
    border: 1px solid #d0d0d0;
    background: rgba(255, 255, 255, .88);
}

.command-bar-heading,
.command-registry-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.command-kicker,
.artifact-kicker {
    display: block;
    color: var(--text-secondary);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .7px;
    text-transform: uppercase;
}

.command-bar h2,
.artifact-panel h2 {
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
}

.command-search-wrap {
    position: relative;
    flex: 0 1 230px;
}

.command-search-wrap i {
    position: absolute;
    top: 9px;
    left: 9px;
    color: var(--text-secondary);
    font-size: 11px;
}

.command-search-wrap input {
    width: 100%;
    min-height: 29px;
    padding: 5px 8px 5px 27px;
    border: 1px solid var(--border-color);
    outline: 0;
    background: var(--surface);
    color: var(--text-primary);
    font: 500 11px var(--font-sans);
}

.command-search-wrap input:focus {
    box-shadow: 2px 2px 0 #000;
}

.command-quick-chips,
.command-category-chips,
.command-registry-list {
    display: flex;
    gap: 5px;
}

.command-quick-chips,
.command-category-chips {
    overflow-x: auto;
    scrollbar-width: thin;
}

.command-quick-chips {
    margin-top: 8px;
}

.command-registry-row {
    margin-top: 7px;
    color: var(--text-secondary);
    font-size: 9.5px;
    font-weight: 700;
}

.command-category-chips {
    justify-content: flex-end;
}

.command-chip,
.command-category-chip {
    flex: 0 0 auto;
    min-height: 25px;
    padding: 4px 8px;
    border: 1px solid #b8b8b8;
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    font: 800 10px var(--font-mono);
    white-space: nowrap;
}

.command-chip:hover,
.command-chip:focus-visible,
.command-category-chip:hover,
.command-category-chip:focus-visible,
.command-category-chip.is-active {
    border-color: #000;
    background: #000;
    color: #fff;
    outline: 0;
}

.command-registry-list:not([hidden]) {
    max-height: 86px;
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px solid #e0e0e0;
    overflow-y: auto;
    flex-wrap: wrap;
}

.command-registry-item {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    padding: 4px 7px;
    border: 1px solid #d0d0d0;
    background: #fafafa;
    color: var(--text-primary);
    cursor: pointer;
    font: 700 10px var(--font-sans);
}

.command-registry-item:hover,
.command-registry-item:focus-visible {
    border-color: #000;
    outline: 0;
    box-shadow: 2px 2px 0 #000;
}

.command-registry-item small {
    margin-left: 5px;
    color: var(--text-secondary);
    font: 500 9px var(--font-sans);
}

/* Artefatos aparecem somente após uma resposta que realmente os anunciou. */
.artifact-panel {
    flex: 0 0 auto;
    width: min(760px, 100%);
    margin: 0 auto 16px;
    padding: 10px;
    border: 1px solid var(--border-color);
    background: var(--surface);
    box-shadow: 3px 3px 0 rgba(0, 0, 0, .12);
}

.artifact-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 7px;
    border-bottom: 1px solid #e0e0e0;
}

.artifact-count {
    min-width: 20px;
    padding: 2px 5px;
    border: 1px solid var(--border-color);
    font: 800 10px var(--font-mono);
    text-align: center;
}

.artifact-list {
    display: grid;
    gap: 6px;
    margin-top: 7px;
}

.artifact-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 8px;
    border: 1px solid #d0d0d0;
}

.artifact-item-info {
    min-width: 0;
}

.artifact-item-name {
    display: block;
    overflow: hidden;
    font-size: 11px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.artifact-item-meta {
    display: block;
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 9.5px;
}

.artifact-download-button {
    flex: 0 0 auto;
    min-height: 28px;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    font: 800 10px var(--font-sans);
}

.artifact-download-button:hover:not(:disabled),
.artifact-download-button:focus-visible {
    background: #000;
    color: #fff;
    outline: 0;
}

.artifact-status {
    min-height: 16px;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
}

@media (max-width: 820px) {
    .app-layout {
        display: flex;
        max-width: none;
        flex-direction: column;
    }

    .history-mobile-toggle {
        display: inline-flex;
    }

    .history-panel {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 95;
        width: min(318px, 88vw);
        height: 100dvh;
        transform: translateX(-105%);
        border-right: 1px solid var(--border-color);
        box-shadow: 6px 0 0 rgba(0, 0, 0, .12);
        transition: transform .2s ease;
    }

    .history-resize-handle {
        display: none;
    }

    .history-mobile-close {
        display: inline-flex;
    }

    .history-panel.history-panel-mobile-open {
        transform: translateX(0);
    }

    .chat-workspace {
        min-height: 0;
        flex: 1 1 auto;
        border-left: 0;
    }

    .chat-workspace main.chat-container {
        padding: 12px 12px calc(128px + var(--safe-bottom));
    }

    .history-content-grid:not([hidden]) {
        position: static !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        left: auto !important;
        transform: none !important;
        z-index: auto !important;
        width: 100% !important;
        max-height: none !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        box-shadow: none !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .history-drawer-toolbar {
        position: sticky;
        top: -12px;
        z-index: 2;
        background: var(--surface);
    }

    .history-content-grid .history-catalog-list,
    .history-content-grid .history-message-list {
        max-height: 28vh;
    }

    .command-bar-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 7px;
    }

    .command-search-wrap {
        width: 100%;
        flex-basis: auto;
    }
}

@media (max-width: 480px) {
    .history-panel {
        padding: calc(12px + var(--safe-top)) 10px 12px;
    }

    .history-panel-header {
        align-items: center;
    }

    .history-import-button span,
    .history-refresh-button span {
        display: none;
    }

    .history-panel-tools .btn {
        width: 31px;
        padding: 4px;
        justify-content: center;
    }

    .command-bar {
        margin-bottom: 9px;
        padding: 8px;
    }

    .command-registry-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }

    .command-category-chips {
        width: 100%;
        justify-content: flex-start;
    }

    .artifact-item {
        align-items: flex-start;
        flex-direction: column;
    }

    .artifact-download-button {
        width: 100%;
    }
}

/* Ajustes finais de leitura: o painel de sessões é uma navegação lateral, e a
   conversa mantém a maior parte da área útil. */
.app-layout {
    grid-template-columns: var(--history-sidebar-width, minmax(268px, 304px)) minmax(0, 1fr);
    width: 100%;
    max-width: none;
    margin: 0;
}

.history-panel {
    padding: 16px 14px;
    background: rgba(255, 255, 255, .985);
}

.history-panel-header {
    display: block;
}

.history-panel-header > div:first-child {
    min-width: 0;
}

.history-panel-title {
    font-size: 18px;
    line-height: 1.1;
    letter-spacing: -.35px;
}

.history-panel-tools {
    width: 100%;
    margin-top: 10px;
    justify-content: flex-start;
}

.history-panel-tools .history-import-button {
    flex: 1 1 auto;
    justify-content: center;
}

.history-panel-tools .history-refresh-button {
    flex: 0 0 34px;
    justify-content: center;
}

.history-source-note {
    max-width: 260px;
    margin: 10px 0 12px;
    color: #666;
    font-size: 10px;
}

.history-credential-details > summary {
    line-height: 1.35;
}

.history-local-sessions {
    padding-bottom: 8px;
}

.chat-workspace .empty-state {
    max-width: 600px;
    padding: 26px 24px;
    border: 1px solid #d5d5d5;
    background: rgba(255, 255, 255, .82);
    box-shadow: 4px 4px 0 rgba(0, 0, 0, .10);
}

.chat-workspace .empty-desc {
    max-width: 520px;
}

.command-bar {
    border-color: #bdbdbd;
    background: rgba(255, 255, 255, .94);
}

.artifact-panel {
    max-height: 280px;
    overflow-y: auto;
}

.artifact-response + .artifact-response {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #dcdcdc;
}

.artifact-response-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.artifact-response-heading strong {
    min-width: 0;
    overflow: hidden;
    font-size: 10.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.artifact-response-heading span {
    flex: 0 0 auto;
    color: var(--text-secondary);
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
}

.artifact-response-list {
    display: grid;
    gap: 6px;
}

@media (max-width: 820px) {
    .app-layout {
        grid-template-columns: none;
    }

    .app-layout.history-dock-right .history-panel {
        left: 0;
        right: auto;
        border-right: 1px solid var(--border-color);
        border-left: 0;
    }

    .app-layout.history-dock-right .chat-workspace {
        grid-column: auto;
        border-right: 0;
    }

    .history-panel {
        padding-top: calc(14px + var(--safe-top));
    }

    .chat-workspace .empty-state {
        max-width: 560px;
    }
}

@media (min-width: 821px) {
    /* O cabeçalho continua sendo o ponto de reabertura quando a lateral foi
       recolhida ou movida para o outro lado. */
    .history-mobile-toggle {
        display: inline-flex;
    }
}

@media (max-width: 600px) {
    header.app-header {
        gap: 8px;
    }

    .header-brand {
        flex: 1 1 auto;
        min-width: 0;
        gap: 7px;
    }

    .brand-info {
        max-width: 112px;
    }

    .brand-title {
        overflow: hidden;
        font-size: 13px;
        text-overflow: ellipsis;
    }

    .brand-sub,
    .brand-badge {
        display: none;
    }

    .header-actions {
        flex: 0 0 auto;
        gap: 4px;
    }

    .status-badge {
        min-width: 31px;
        padding: 6px;
        justify-content: center;
    }

    .status-badge span#statusLabel {
        display: none;
    }

    .btn-new-chat span {
        display: none;
    }

    .btn-new-chat {
        padding: 6px 8px;
    }

    .history-panel-title {
        font-size: 17px;
    }

    .chat-workspace main.chat-container {
        padding-right: 10px;
        padding-left: 10px;
    }

    .chat-workspace .empty-state {
        padding: 20px 14px;
        border-color: #c8c8c8;
        box-shadow: 3px 3px 0 rgba(0, 0, 0, .10);
    }

    .artifact-response-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }

    .artifact-response-heading span {
        white-space: normal;
    }
}

.history-drawer-toolbar,
.history-detail-column,
.history-local-sessions {
    display: none !important;
}

/* No telefone o toolbar usa uma linha para a ação principal e uma grade de
   alvos quadrados para as ações secundárias. Assim os rótulos não são
   cortados pelo drawer estreito, e cada ícone continua acessível por title e
   aria-label. */
@media (max-width: 820px) {
    .history-panel-tools {
        display: grid;
        grid-template-columns: repeat(4, minmax(44px, 1fr));
        gap: 8px;
        width: 100%;
        margin-top: 10px;
        align-items: stretch;
    }

    .history-panel-tools .history-new-chat-button {
        grid-column: span 2;
        width: 100%;
        min-width: 0;
        min-height: 44px;
        justify-content: center;
        padding: 8px 12px;
    }

    .history-panel-tools .history-new-chat-button span,
    .history-panel-tools .history-pause-button span {
        display: inline-flex;
    }

    .history-panel-tools .history-pause-button {
        grid-column: span 2;
        width: 100%;
        min-width: 0;
        min-height: 44px;
        justify-content: center;
        padding: 8px 10px;
        font-size: 11px;
    }

    .history-panel-tools .history-dock-button,
    .history-panel-tools .history-collapse-button,
    .history-panel-tools .history-refresh-button,
    .history-panel-tools .history-mobile-close {
        width: 100%;
        min-width: 44px;
        min-height: 44px;
        padding: 0;
        justify-content: center;
    }

    /* O encaixe esquerda/direita só existe no layout desktop. No drawer
       móvel o botão não oferece uma ação útil e não deve consumir um alvo. */
    .history-panel-tools .history-dock-button {
        display: none;
    }

    .history-panel-tools .history-dock-button span,
    .history-panel-tools .history-collapse-button span,
    .history-panel-tools .history-refresh-button span,
    .history-panel-tools .history-mobile-close span {
        display: none;
    }

    .history-panel-tools .history-dock-button i,
    .history-panel-tools .history-collapse-button i,
    .history-panel-tools .history-refresh-button i,
    .history-panel-tools .history-mobile-close i {
        font-size: 15px;
    }

    .history-panel-tools .history-import-button {
        display: none !important;
    }
}

.history-login-link {
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--text-primary);
    color: var(--surface);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
}

.history-login-link:hover,
.history-login-link:focus-visible {
    background: var(--surface);
    color: var(--text-primary);
    outline: 2px solid var(--text-primary);
    outline-offset: 2px;
}

.history-panel-tools .history-pause-button:not(:disabled) {
    background: var(--text-primary);
    border-color: var(--text-primary);
    color: var(--surface);
}

.history-panel-tools .history-pause-button:disabled {
    cursor: not-allowed;
    opacity: .5;
}

@media (min-width: 821px) {
    .history-panel-tools {
        flex-wrap: wrap;
        row-gap: 8px;
    }

    .history-panel-tools .history-new-chat-button,
    .history-panel-tools .history-pause-button {
        flex: 1 1 calc(50% - 5px);
        min-width: 0;
        justify-content: center;
    }

    .history-sidebar-collapsed .history-panel-tools .history-new-chat-button,
    .history-sidebar-collapsed .history-panel-tools .history-pause-button {
        flex: 0 0 auto;
    }
}

@media (max-width: 820px) {
    .history-login-link {
        width: 100%;
        min-height: 44px;
    }
}

