/* SPEC-0014 — conversas delimitadas; cores e marca herdadas do painel. */
#panel-respostas {
    --reply-surface: var(--bg-secondary);
    --reply-surface-soft: var(--bg-glass);
    --reply-border: var(--border);
    --reply-gap: 16px;
    --reply-radius: 14px;
}

#panel-respostas .replies-feedback:empty { display: none; }
#panel-respostas .reply-conversations { display: grid; gap: var(--reply-gap); }
#panel-respostas .reply-conversation {
    min-width: 0;
    border: 1px solid var(--reply-border);
    border-radius: var(--reply-radius);
    background: var(--reply-surface);
}
#panel-respostas .reply-conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--reply-gap);
    padding: 18px 20px;
    border-bottom: 1px solid var(--reply-border);
}
#panel-respostas .reply-conversation-contact { min-width: 0; flex: 1; }
#panel-respostas .reply-who { font-size: var(--fs-base); line-height: 1.4; font-weight: 700; }
#panel-respostas .reply-phone { margin: 5px 0 0; line-height: 1.5; overflow-wrap: anywhere; }
#panel-respostas .reply-tag { margin-top: 8px; line-height: 1.5; }
#panel-respostas .reply-conversation-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    min-width: 0;
    max-width: 45%;
    color: var(--text-secondary);
    font-size: var(--fs-xs);
    line-height: 1.5;
    text-align: right;
    overflow-wrap: anywhere;
}
#panel-respostas .reply-conversation-state {
    padding: 2px 9px;
    border: 1px solid var(--reply-border);
    border-radius: 999px;
    font-weight: 600;
    color: var(--text-secondary);
}
#panel-respostas .reply-conversation-state.is-open {
    color: var(--accent-hover);
    border-color: var(--border-hover);
    background: var(--reply-surface-soft);
}
#panel-respostas .reply-last { min-width: 0; font-size: var(--fs-xs); }
#panel-respostas .reply-conversation-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(250px, 0.42fr);
    align-items: start;
    gap: var(--reply-gap);
    padding: 18px 20px;
}
#panel-respostas .reply-message-block,
#panel-respostas .reply-triage-block {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--reply-border);
    border-radius: 12px;
    background: var(--reply-surface-soft);
}
#panel-respostas .reply-block-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
#panel-respostas .reply-conversation h4 { font-size: var(--fs-xs); line-height: 1.5; font-weight: 600; color: var(--text-primary); }
#panel-respostas .reply-count { margin: 0; white-space: nowrap; }
#panel-respostas .reply-older { margin-bottom: 10px; line-height: 1.5; }
#panel-respostas .reply-messages { gap: 10px; }
#panel-respostas .reply-message { grid-template-columns: 44px minmax(0, 1fr); align-items: baseline; }
#panel-respostas .reply-message-time { line-height: 1.5; }
#panel-respostas .reply-message-text { font-size: var(--fs-sm); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
#panel-respostas .reply-preview .reply-message-text { -webkit-line-clamp: 3; }
#panel-respostas .reply-history { margin-top: 12px; }
#panel-respostas .reply-history summary {
    width: fit-content;
    max-width: 100%;
    min-height: 44px;
    padding: 10px 0;
    color: var(--accent-hover);
    font-size: var(--fs-xs);
    font-weight: 600;
    cursor: pointer;
    overflow-wrap: anywhere;
}
#panel-respostas .reply-history summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
#panel-respostas .reply-history-note { margin: 4px 0 12px; color: var(--text-muted); font-size: var(--fs-xs); line-height: 1.5; }
#panel-respostas .reply-full-messages .reply-message { grid-template-columns: minmax(0, 1fr); gap: 3px; padding-top: 10px; border-top: 1px solid var(--reply-border); }
#panel-respostas .reply-full-messages .reply-message-text { display: block; overflow: visible; -webkit-line-clamp: unset; }
#panel-respostas .reply-triage-fields { margin-top: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
#panel-respostas .reply-triage-subject { grid-column: 1 / -1; }
#panel-respostas .reply-triage-field { min-width: 0; }
#panel-respostas .reply-triage-field dt { margin-bottom: 6px; color: var(--text-muted); font-size: var(--fs-xs); line-height: 1.5; }
#panel-respostas .reply-triage-field dd { margin: 0; color: var(--text-primary); font-size: var(--fs-sm); line-height: 1.5; overflow-wrap: anywhere; }
#panel-respostas .reply-subject { align-items: flex-start; }
#panel-respostas .reply-chip { line-height: 1.5; }
#panel-respostas .reply-conversation-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    border-top: 1px solid var(--reply-border);
}
#panel-respostas .reply-action-note { color: var(--text-muted); font-size: var(--fs-xs); line-height: 1.5; flex: 1 1 180px; }
#panel-respostas .reply-actions { min-width: 0; justify-content: flex-end; gap: 8px; flex: 0 1 auto; }
#panel-respostas .reply-action { min-height: 44px; padding: 9px 12px; white-space: normal; text-align: center; line-height: 1.4; }
#panel-respostas .reply-action.is-primary { color: var(--on-accent); }
#panel-respostas .reply-action.is-link { text-decoration: underline; text-underline-offset: 3px; }
#panel-respostas .replies-empty { margin: 0; border: 1px dashed var(--reply-border); border-radius: var(--reply-radius); line-height: 1.6; }

@media (max-width: 900px) {
    #panel-respostas .reply-conversation-content { grid-template-columns: minmax(0, 1fr); }
    #panel-respostas .reply-conversation-footer { flex-direction: column; align-items: stretch; }
    #panel-respostas .reply-action-note { flex: none; }
    #panel-respostas .reply-actions { justify-content: flex-start; }
}

@media (max-width: 600px) {
    #panel-respostas .reply-conversation-header { flex-direction: column; gap: 12px; }
    #panel-respostas .reply-conversation-meta { align-items: flex-start; max-width: 100%; text-align: left; }
    #panel-respostas .reply-conversation-header,
    #panel-respostas .reply-conversation-content,
    #panel-respostas .reply-conversation-footer { padding: 14px; }
    #panel-respostas .reply-conversation-content { gap: 12px; }
    #panel-respostas .reply-block-heading { flex-wrap: wrap; gap: 4px; }
    #panel-respostas .replies-filters { width: 100%; }
    #panel-respostas .replies-filter-btn { min-height: 44px; flex: 1; }
    #panel-respostas .reply-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
    #panel-respostas .reply-action { width: 100%; justify-content: center; }
}

@media (max-width: 390px) {
    #panel-respostas { --reply-gap: 12px; }
    #panel-respostas .reply-message-block,
    #panel-respostas .reply-triage-block { padding: 12px; }
    #panel-respostas .reply-triage-fields { gap: 12px 8px; }
}

@media (min-width: 1440px) {
    #panel-respostas .reply-conversation-content { grid-template-columns: minmax(0, 1fr) minmax(300px, 0.4fr); }
}
