.inbox-page-card {
    overflow: hidden;
}

.inbox-governance-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 24px 0;
    padding: 12px 14px;
    border: 1px solid rgba(215, 25, 32, .2);
    border-radius: 12px;
    background: rgba(215, 25, 32, .055);
    color: var(--text-secondary, #59616c);
    font-size: 12px;
    line-height: 1.45;
}

.inbox-governance-notice i {
    color: #d71920;
}

.inbox-mode-tabs {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 16px 24px 0;
    padding: 4px;
    border: 1px solid var(--border-color, #d7dce2);
    border-radius: 12px;
    background: var(--surface-secondary, #f2f3f5);
}

.inbox-mode-tabs[hidden] { display: none; }

.inbox-mode-tabs button {
    min-height: 38px;
    padding: 0 14px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-secondary, #59616c);
    font: inherit;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
    transition: background .18s ease, color .18s ease;
}

.inbox-mode-tabs button.active {
    background: var(--surface-primary, #fff);
    color: #d71920;
    box-shadow: 0 3px 10px rgba(20, 23, 28, .08);
}

.inbox-feedback {
    min-height: 0;
    margin: 0 24px;
}

.inbox-feedback:not(:empty) {
    margin-top: 14px;
}

.inbox-layout {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    min-height: 600px;
    margin: 18px 24px 24px;
    border: 1px solid var(--border-color, #d7dce2);
    border-radius: 16px;
    overflow: hidden;
    background: var(--surface-primary, #fff);
}

.inbox-conversations {
    min-width: 0;
    border-right: 1px solid var(--border-color, #d7dce2);
    background: var(--surface-secondary, #f5f6f7);
}

.inbox-list-toolbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 14px;
    border-bottom: 1px solid var(--border-color, #d7dce2);
}

.inbox-search {
    position: relative;
}

.inbox-search i {
    position: absolute;
    top: 50%;
    left: 13px;
    color: var(--text-muted, #7b8490);
    transform: translateY(-50%);
    pointer-events: none;
}

.inbox-search input {
    width: 100%;
    height: 42px;
    padding: 0 12px 0 38px;
    border: 1px solid var(--border-color, #d7dce2);
    border-radius: 11px;
    outline: none;
    background: var(--surface-primary, #fff);
    color: var(--text-primary, #17191d);
    font: inherit;
    font-size: 13px;
}

.inbox-search input:focus {
    border-color: rgba(215, 25, 32, .72);
    box-shadow: 0 0 0 3px rgba(215, 25, 32, .1);
}

.inbox-refresh,
.inbox-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color, #d7dce2);
    border-radius: 11px;
    background: var(--surface-primary, #fff);
    color: var(--text-secondary, #59616c);
    cursor: pointer;
}

.inbox-refresh { width: 42px; height: 42px; }
.inbox-refresh:hover,
.inbox-back:hover { border-color: rgba(215, 25, 32, .45); color: #d71920; }

.inbox-list-summary {
    padding: 11px 15px 7px;
    color: var(--text-muted, #7b8490);
    font-size: 11px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: .35px;
}

.inbox-conversation-list {
    display: grid;
    gap: 5px;
    max-height: 530px;
    padding: 6px 9px 12px;
    overflow-y: auto;
}

.inbox-conversation-item {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 11px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--text-primary, #17191d);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease;
}

.inbox-conversation-item:hover {
    border-color: var(--border-color, #d7dce2);
    background: var(--surface-primary, #fff);
}

.inbox-conversation-item.active {
    border-color: rgba(215, 25, 32, .28);
    background: rgba(215, 25, 32, .065);
}

.inbox-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border: 1px solid rgba(215, 25, 32, .18);
    border-radius: 12px;
    background: rgba(215, 25, 32, .095);
    color: #d71920;
    font-size: 14px;
    font-weight: 850;
}

.inbox-conversation-copy {
    min-width: 0;
}

.inbox-conversation-copy strong,
.inbox-conversation-copy span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inbox-conversation-copy strong { font-size: 13px; }
.inbox-conversation-copy span { margin-top: 4px; color: var(--text-muted, #7b8490); font-size: 11px; }

.inbox-conversation-meta {
    display: grid;
    justify-items: end;
    gap: 7px;
    color: var(--text-muted, #7b8490);
    font-size: 10px;
}

.inbox-unread-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 21px;
    height: 21px;
    padding: 0 6px;
    border-radius: 999px;
    background: #d71920;
    color: #fff;
    font-size: 10px;
    font-weight: 850;
}

.inbox-chat {
    min-width: 0;
    background: var(--surface-primary, #fff);
}

.inbox-chat-empty {
    display: grid;
    place-content: center;
    justify-items: center;
    min-height: 600px;
    padding: 30px;
    color: var(--text-muted, #7b8490);
    text-align: center;
}

.inbox-chat-empty[hidden] { display: none; }

.inbox-chat-empty strong { margin-top: 14px; color: var(--text-primary, #17191d); font-size: 17px; }
.inbox-chat-empty span { margin-top: 6px; font-size: 12px; }

.inbox-empty-icon {
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    border: 1px solid var(--border-color, #d7dce2);
    border-radius: 18px;
    background: var(--surface-secondary, #f5f6f7);
    color: #d71920;
    font-size: 23px;
}

.inbox-chat-active {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-height: 600px;
}

.inbox-chat-active[hidden] { display: none; }
.inbox-chat-active.is-visible:not([hidden]) { display: grid; }

.inbox-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 70px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-color, #d7dce2);
    background: var(--surface-primary, #fff);
}

.inbox-back { display: none; width: 38px; height: 38px; }
.inbox-chat-identity { min-width: 0; flex: 1; }
.inbox-chat-identity strong,
.inbox-chat-identity span { display: block; }
.inbox-chat-identity strong { color: var(--text-primary, #17191d); font-size: 14px; }
.inbox-chat-identity span { margin-top: 3px; color: var(--text-muted, #7b8490); font-size: 11px; }

.inbox-audit-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 9px;
    border: 1px solid var(--border-color, #d7dce2);
    border-radius: 999px;
    color: var(--text-secondary, #59616c);
    font-size: 10px;
    font-weight: 750;
}
.inbox-audit-label[hidden] { display: none; }

.inbox-message-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 455px;
    padding: 20px;
    overflow-y: auto;
    background:
        radial-gradient(circle at 90% 5%, rgba(215, 25, 32, .035), transparent 22rem),
        var(--surface-secondary, #f5f6f7);
}

.inbox-message {
    display: grid;
    gap: 5px;
    align-self: flex-start;
    max-width: min(72%, 620px);
}

.inbox-message.sent { align-self: flex-end; justify-items: end; }

.inbox-message-sender {
    padding: 0 4px;
    color: var(--text-muted, #7b8490);
    font-size: 10px;
    font-weight: 750;
}

.inbox-message-bubble {
    padding: 11px 13px;
    border: 1px solid var(--border-color, #d7dce2);
    border-radius: 5px 14px 14px 14px;
    background: var(--surface-primary, #fff);
    color: var(--text-primary, #17191d);
    box-shadow: 0 3px 10px rgba(20, 23, 28, .045);
}

.inbox-message.sent .inbox-message-bubble {
    border-color: rgba(215, 25, 32, .24);
    border-radius: 14px 5px 14px 14px;
    background: rgba(215, 25, 32, .075);
}

.inbox-message-bubble p {
    margin: 0;
    line-height: 1.5;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.inbox-message-time {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 4px;
    color: var(--text-muted, #7b8490);
    font-size: 9px;
}

.inbox-composer {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    align-items: end;
    gap: 4px;
    margin: 10px 12px 12px;
    padding: 6px;
    border: 1px solid var(--border-color, #d7dce2);
    border-radius: 18px;
    background: var(--surface-secondary, #f5f6f7);
    transition: border-color .18s ease, box-shadow .18s ease;
}

.inbox-composer:focus-within {
    border-color: rgba(215, 25, 32, .62);
    box-shadow: 0 0 0 3px rgba(215, 25, 32, .08);
}

.inbox-composer-field {
    min-width: 0;
}

.inbox-composer[hidden] {
    display: none;
}

.inbox-composer textarea {
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: 38px;
    min-height: 38px;
    max-height: 96px;
    padding: 9px 8px;
    resize: none;
    overflow-y: hidden;
    border: 1px solid transparent;
    border-radius: 10px;
    outline: none;
    background: transparent;
    color: var(--text-primary, #17191d);
    font: inherit;
    line-height: 1.4;
}

.inbox-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.inbox-attach-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    align-self: end;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary, #59616c);
    cursor: pointer;
    transition: border-color .18s ease, color .18s ease, background .18s ease;
}

.inbox-attach-button:hover {
    background: rgba(215, 25, 32, .08);
    color: #d71920;
}

.inbox-selected-file {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border-color, #d7dce2);
    border-radius: 10px;
    background: var(--surface-secondary, #f5f6f7);
    color: var(--text-secondary, #59616c);
    font-size: 11px;
}

.inbox-selected-file[hidden] { display: none; }
.inbox-selected-file span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-selected-file small { flex: 0 0 auto; color: var(--text-muted, #7b8490); }
.inbox-selected-file button {
    width: 26px;
    height: 26px;
    margin-left: auto;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #d71920;
    cursor: pointer;
}

.inbox-file-picker {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 3px 11px;
    min-height: 70px;
    padding: 14px;
    border: 1px dashed var(--border-color, #d7dce2);
    border-radius: 12px;
    background: var(--surface-secondary, #f5f6f7);
    color: var(--text-primary, #17191d);
    cursor: pointer;
}

.inbox-file-picker i { grid-row: 1 / span 2; color: #d71920; font-size: 18px; }
.inbox-file-picker span { font-size: 12px; font-weight: 750; }
.inbox-file-picker small { color: var(--text-muted, #7b8490); font-size: 10px; }

.inbox-message-attachment {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 210px;
    margin-top: 9px;
    padding: 10px;
    border: 1px solid var(--border-color, #d7dce2);
    border-radius: 11px;
    color: inherit;
    text-decoration: none;
}

.inbox-message-attachment i { color: #d71920; font-size: 19px; }
.inbox-message-attachment-copy { min-width: 0; }
.inbox-message-attachment-copy strong,
.inbox-message-attachment-copy small { display: block; }
.inbox-message-attachment-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.inbox-message-attachment-copy small { margin-top: 3px; color: var(--text-muted, #7b8490); font-size: 9px; }

.inbox-message-image {
    display: block;
    max-width: min(320px, 100%);
    margin-top: 9px;
    overflow: hidden;
    border: 1px solid var(--border-color, #d7dce2);
    border-radius: 11px;
    color: inherit;
    text-decoration: none;
}

.inbox-message-image img {
    display: block;
    width: 100%;
    max-height: 260px;
    object-fit: cover;
}

.inbox-message-image span { display: block; padding: 8px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }

.inbox-composer textarea:focus {
    border-color: transparent;
    box-shadow: none;
}

.inbox-composer > #mensagensEnviar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    min-width: 0;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #ec2932 0%, #d71920 52%, #a90f16 100%);
    color: #fff;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.inbox-composer > #mensagensEnviar:hover:not(:disabled) {
    background: linear-gradient(135deg, #f13a42 0%, #df1d25 52%, #b81017 100%);
}

.inbox-composer > #mensagensEnviar:disabled { opacity: .55; cursor: not-allowed; }

.inbox-list-empty {
    padding: 34px 18px;
    color: var(--text-muted, #7b8490);
    font-size: 12px;
    text-align: center;
}

.inbox-modal-subtitle { margin: 5px 0 0; color: var(--text-muted, #7b8490); font-size: 12px; }
.inbox-character-count { margin-top: 7px; color: var(--text-muted, #7b8490); font-size: 10px; text-align: right; }

html[data-theme='dark'] .inbox-layout,
html[data-theme='dark'] .inbox-chat,
html[data-theme='dark'] .inbox-chat-header,
html[data-theme='dark'] .inbox-composer {
    border-color: #35353a;
    background: #171719;
}

html[data-theme='dark'] .inbox-conversations,
html[data-theme='dark'] .inbox-message-list {
    border-color: #35353a;
    background:
        radial-gradient(circle at 90% 5%, rgba(215, 25, 32, .035), transparent 22rem),
        #141416;
}

html[data-theme='dark'] .inbox-list-toolbar,
html[data-theme='dark'] .inbox-chat-header,
html[data-theme='dark'] .inbox-composer { border-color: #35353a; }

html[data-theme='dark'] .inbox-search input,
html[data-theme='dark'] .inbox-refresh,
html[data-theme='dark'] .inbox-back,
html[data-theme='dark'] .inbox-composer textarea,
html[data-theme='dark'] .inbox-empty-icon,
html[data-theme='dark'] .inbox-attach-button,
html[data-theme='dark'] .inbox-selected-file,
html[data-theme='dark'] .inbox-file-picker {
    border-color: #39393e;
    background: #1d1d20;
    color: #f1f1f2;
}

html[data-theme='dark'] .inbox-composer textarea {
    border-color: transparent;
    background: transparent;
}

html[data-theme='dark'] .inbox-conversation-item { color: #f1f1f2; }
html[data-theme='dark'] .inbox-conversation-item:hover { border-color: #3c3c41; background: #1d1d20; }
html[data-theme='dark'] .inbox-conversation-item.active { border-color: rgba(215, 25, 32, .34); background: rgba(215, 25, 32, .09); }
html[data-theme='dark'] .inbox-message-bubble { border-color: #39393e; background: #202023; color: #f1f1f2; box-shadow: 0 4px 12px rgba(0, 0, 0, .18); }
html[data-theme='dark'] .inbox-message.sent .inbox-message-bubble { border-color: rgba(215, 25, 32, .34); background: rgba(169, 15, 22, .16); }
html[data-theme='dark'] .inbox-mode-tabs { border-color: #35353a; background: #141416; }
html[data-theme='dark'] .inbox-mode-tabs button.active { background: #242427; color: #ef4b51; box-shadow: none; }
html[data-theme='dark'] .inbox-governance-notice { border-color: rgba(215, 25, 32, .26); background: rgba(215, 25, 32, .07); color: #b7bac0; }

@media (max-width: 820px) {
    .inbox-page-header { align-items: stretch; }
    .inbox-page-header .btn-add { width: 100%; justify-content: center; }
    .inbox-layout { grid-template-columns: 1fr; min-height: 560px; margin: 14px; }
    .inbox-conversations { border-right: 0; }
    .inbox-chat { display: none; }
    .inbox-layout.has-active-conversation .inbox-conversations { display: none; }
    .inbox-layout.has-active-conversation .inbox-chat { display: block; }
    .inbox-back { display: inline-flex; }
    .inbox-chat-active,
    .inbox-chat-empty { min-height: 560px; }
    .inbox-conversation-list { max-height: 490px; }
    .inbox-message-list { max-height: 415px; }
    .inbox-message { max-width: 86%; }
}

@media (max-width: 520px) {
    .inbox-governance-notice,
    .inbox-mode-tabs { margin-left: 14px; margin-right: 14px; }
    .inbox-mode-tabs { display: flex; }
    .inbox-mode-tabs button { flex: 1; padding: 0 9px; }
    .inbox-chat-header { padding: 10px; }
    .inbox-audit-label { padding: 6px; }
    .inbox-audit-label i { display: none; }
    .inbox-message-list { padding: 14px 10px; }
    .inbox-composer { grid-template-columns: 38px minmax(0, 1fr) 38px; }
    .inbox-attach-button { width: 38px; }
    .inbox-composer > #mensagensEnviar { min-height: 38px; }
}
