html:has(#copilotoMainView:not([hidden])),
body:has(#copilotoMainView:not([hidden])) {
    overflow: hidden !important;
    height: 100%;
}

body:has(#copilotoMainView:not([hidden])) .main-wrapper,
body:has(#copilotoMainView:not([hidden])) .content-area {
    overflow: hidden;
    min-height: 0;
}

.prisma-copiloto-view {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.prisma-copiloto-view .catalog-page-header,
.prisma-copiloto-view .copiloto-summary,
.prisma-copiloto-view .copiloto-tag-filters,
.prisma-copiloto-view .client-radar-status {
    flex-shrink: 0;
}

.prisma-copiloto-view .prisma-radar-lead {
    color: rgba(255, 255, 255, 0.92);
}

.prisma-copiloto-view .prisma-radar-stat {
    background: #fff;
    border: 1px solid #e2e6ea;
}

.prisma-copiloto-view .prisma-radar-stat--urgent {
    background: #fff7ed;
    border-color: #fdba74;
}

.prisma-copiloto-view .prisma-radar-stat__value {
    color: #1e293b;
}

.prisma-copiloto-view .prisma-radar-stat__label {
    color: #475569;
    font-weight: 600;
}

.prisma-copiloto-view .prisma-radar-stat--urgent .prisma-radar-stat__value {
    color: #9a3412;
}

.prisma-copiloto-view .prisma-radar-stat--urgent .prisma-radar-stat__label {
    color: #c2410c;
}

.prisma-copiloto-view .copiloto-mode .ai-training-mode__label {
    color: rgba(255, 255, 255, 0.88);
}

.copiloto-stat-filter {
    cursor: pointer;
    text-align: left;
    font: inherit;
    appearance: none;
    display: block;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.copiloto-stat-filter:hover {
    border-color: #c5cdd6;
    background: #f8fafc;
}

.copiloto-stat-filter.is-active {
    border-color: #2fc6f6;
    box-shadow: 0 0 0 1px #2fc6f6;
    background: #f0fbff;
}

.copiloto-stat-filter--urgent.is-active {
    border-color: #f97316;
    box-shadow: 0 0 0 1px #f97316;
    background: #fff7ed;
}

.copiloto-tag-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 8px;
}

.copiloto-tag-chip {
    border: 1px solid #dfe3e8;
    background: #fff;
    color: #535c69;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.copiloto-tag-chip.is-active {
    background: #e8f8fd;
    border-color: #2fc6f6;
    color: #1a6b80;
}

.copiloto-shell {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) minmax(280px, 360px);
    grid-template-rows: minmax(0, 1fr);
    gap: 12px;
    flex: 1;
    min-height: 0;
    margin-top: 8px;
    overflow: hidden;
}

.copiloto-thread {
    border: 1px solid #e2e6ea;
    border-radius: 12px;
    background: #fff;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#copilotoThreadWrap {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

#copilotoThreadWrap[hidden] {
    display: none !important;
}

.copiloto-messages {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.copiloto-composer {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    padding: 10px 12px;
    border-top: 1px solid #eef1f4;
    background: #fafbfc;
}

.copiloto-message-input {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    resize: none;
    border: 1px solid #dfe3e8;
    border-radius: 10px;
    padding: 8px 10px;
    font: inherit;
    font-size: 13px;
    line-height: 1.4;
    outline: none;
}

.copiloto-message-input:focus {
    border-color: #2fc6f6;
}

.copiloto-message-send {
    margin-bottom: 2px;
}

.copiloto-thread-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.copiloto-action-panel {
    border: 1px solid #e2e6ea;
    border-radius: 12px;
    background: #fff;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: auto;
    padding: 12px;
}

.copiloto-action-placeholder {
    margin: auto;
    color: #80868e;
    font-size: 14px;
    text-align: center;
    padding: 16px;
}

#copilotoActionWrap {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
}

#copilotoActionWrap[hidden] {
    display: none !important;
}

.copiloto-panel-title {
    margin: 0 0 8px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #80868e;
}

.copiloto-context {
    border-bottom: 1px solid #eef1f4;
    padding-bottom: 12px;
}

.copiloto-context-body {
    font-size: 13px;
}

.copiloto-context-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.copiloto-context-key {
    color: #80868e;
    font-weight: 600;
}

.copiloto-context-val {
    color: #333;
    font-weight: 700;
    text-align: right;
}

.copiloto-context-summary {
    margin: 8px 0 0;
    color: #535c69;
    line-height: 1.45;
}

.copiloto-context-empty {
    margin: 0;
    color: #80868e;
    font-size: 13px;
}

.copiloto-evidence {
    margin-top: 8px;
    font-size: 12px;
    color: #535c69;
}

.copiloto-evidence ul {
    margin: 6px 0 0;
    padding-left: 18px;
}

.copiloto-link-btn {
    margin-top: 8px;
    border: none;
    background: none;
    color: #0ea5e9;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
}

.copiloto-compose .ai-training-analysis {
    margin-top: 0;
}

.copiloto-compose {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid #eef1f4;
    padding-top: 14px;
}

.copiloto-compose-header {
    margin-bottom: 6px;
}

.copiloto-compose-header .copiloto-panel-title {
    margin-bottom: 0;
}

.copiloto-compose-hint {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.45;
    color: #535c69;
}

.copiloto-payment-banner {
    margin: 0 0 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
    color: #065f46;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 600;
}

.copiloto-payment-banner button {
    display: inline-block;
    margin-top: 6px;
    border: none;
    background: none;
    padding: 0;
    color: #047857;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
}

.copiloto-field-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #80868e;
    margin: 0 0 6px;
}

.copiloto-field-optional {
    display: inline-block;
    margin-left: 6px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: none;
    color: #a8adb4;
}

.copiloto-field-help {
    margin: 6px 0 0;
    font-size: 12px;
    line-height: 1.35;
    color: #a8adb4;
}

.copiloto-instruct-wrap {
    margin-bottom: 10px;
}

.copiloto-instruct,
.copiloto-draft {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border-radius: 10px;
    border: 1px solid #dfe3e8;
    background: #fff;
    color: #333;
    padding: 10px 12px;
    font: inherit;
    font-size: 13px;
    line-height: 1.45;
    resize: none;
    overflow-x: hidden;
    overflow-y: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
    outline: none;
}

.copiloto-instruct:focus,
.copiloto-draft:focus {
    border-color: #2fc6f6;
}

.copiloto-instruct {
    min-height: 56px;
    background: #fafbfc;
}

.copiloto-generate-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.copiloto-generate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid #2fc6f6;
    background: #e8f8fd;
    color: #0e7490;
    border-radius: 10px;
    padding: 8px 14px;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.copiloto-generate-btn:hover:not(:disabled) {
    background: #d4f3fc;
    border-color: #0ea5e9;
}

.copiloto-generate-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.copiloto-draft-wrap {
    margin-bottom: 8px;
}

.copiloto-draft-label-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.copiloto-draft-label-row .copiloto-field-label {
    margin-bottom: 0;
}

.copiloto-draft-composer {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    padding: 8px;
    border: 1px solid #dfe3e8;
    border-radius: 12px;
    background: #fafbfc;
}

.copiloto-draft-composer:focus-within {
    border-color: #2fc6f6;
    box-shadow: 0 0 0 1px rgba(47, 198, 246, 0.35);
}

.copiloto-draft-composer .copiloto-draft {
    flex: 1;
    min-height: 96px;
    max-height: 220px;
    border: none;
    background: transparent;
    padding: 4px 2px;
}

.copiloto-draft-composer .copiloto-draft:focus {
    border: none;
    box-shadow: none;
}

.copiloto-draft-send,
.copiloto-message-send {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #2fc6f6;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    transition: background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}

.copiloto-draft-send:hover:not(:disabled),
.copiloto-message-send:hover:not(:disabled) {
    background: #0ea5e9;
}

.copiloto-draft-send:active:not(:disabled),
.copiloto-message-send:active:not(:disabled) {
    transform: scale(0.96);
}

.copiloto-draft-send:disabled,
.copiloto-message-send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.copiloto-send-status {
    display: block;
    min-height: 18px;
    font-size: 12px;
    color: #80868e;
}

.copiloto-send-status.is-ok {
    color: #047857;
    font-weight: 700;
}

.copiloto-send-status.is-err {
    color: #b91c1c;
    font-weight: 700;
}

.copiloto-edited-badge {
    display: inline-block;
    margin-left: 6px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: #fef3c7;
    color: #b45309;
    border-radius: 999px;
    padding: 2px 8px;
    vertical-align: middle;
}

.copiloto-tag-badge {
    display: inline-block;
    margin-top: 4px;
    margin-right: 4px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border-radius: 999px;
    padding: 2px 7px;
    background: #f1f5f9;
    color: #475569;
}

.copiloto-tag-badge--enviar_pix {
    background: #dcfce7;
    color: #15803d;
}

.copiloto-tag-badge--urgente {
    background: #fee2e2;
    color: #b91c1c;
}

.copiloto-tag-badge--sem_analise {
    background: #e0e7ff;
    color: #4338ca;
}

.copiloto-tag-badge--insatisfeito {
    background: #fce7f3;
    color: #be185d;
}

.copiloto-tag-badge--edited {
    background: #fef3c7;
    color: #b45309;
}

.copiloto-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eef1f4;
}

.copiloto-quick-actions .btn-create {
    width: 100%;
    justify-content: center;
}

@media (max-width: 1100px) {
    .copiloto-shell {
        grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr) minmax(200px, 40vh);
    }

    .copiloto-action-panel {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .copiloto-shell {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(180px, 35vh) minmax(0, 1fr) minmax(220px, 45vh);
    }

    .copiloto-list {
        order: 1;
    }

    .copiloto-thread {
        order: 2;
    }

    .copiloto-action-panel {
        order: 3;
        grid-column: auto;
    }

    .copiloto-instruct,
    .copiloto-draft {
        font-size: 16px;
    }

    .copiloto-draft-send,
    .copiloto-message-send {
        width: 44px;
        height: 44px;
    }
}
