:root {
    --ink: #122424;
    --accent: #0d9488;
    --font: "Ubuntu Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    --sidebar-width: 16rem;
}

.white-label-theme {
    --accent: var(--white-label-primary);
}

.white-label-theme .sidebar-panel {
    background: var(--white-label-primary);
}

.white-label-theme .sidebar-link-active {
    background: color-mix(in srgb, var(--white-label-secondary) 30%, transparent);
    color: var(--white-label-on-primary);
}

.white-label-theme .sidebar-link,
.white-label-theme .sidebar-group-label,
.white-label-theme .sidebar-footer,
.white-label-theme .sidebar-brand-text .text-teal-200\/70 {
    color: var(--white-label-muted-text);
}

.white-label-theme .sidebar-link:hover,
.white-label-theme .sidebar-brand-text .text-white {
    color: var(--white-label-on-primary);
}

.white-label-theme .btn-primary:hover:not(:disabled) {
    filter: brightness(0.88);
    background: var(--white-label-primary);
}

.white-label-theme .sidebar-toggle-btn {
    border-color: var(--white-label-primary);
    background: var(--white-label-primary);
    color: var(--white-label-on-primary);
}

.white-label-theme .sidebar-toggle-btn:hover {
    border-color: var(--white-label-primary);
    background: var(--white-label-primary);
    color: var(--white-label-on-primary);
}

.white-label-theme .app-header .btn-ghost {
    border-color: var(--white-label-primary);
    background: var(--white-label-primary);
    color: var(--white-label-on-primary);
}

.white-label-theme .app-header .btn-ghost:hover {
    border-color: var(--white-label-primary);
    background: var(--white-label-primary);
    color: var(--white-label-on-primary);
    filter: brightness(0.88);
}

.white-label-theme .input:focus {
    border-color: var(--white-label-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--white-label-primary) 22%, transparent);
}

.white-label-preview {
    --preview-primary: #0d9488;
    --preview-secondary: #ccfbf1;
    --preview-on-primary: #fff;
    --preview-on-secondary: #122424;
    --preview-muted: rgba(255, 255, 255, 0.86);
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
    background: #fff;
}

.white-label-preview-sidebar {
    min-height: 8rem;
    padding: 0.9rem;
    background: var(--preview-primary);
    color: var(--preview-on-primary);
}

.white-label-preview-sidebar small,
.white-label-preview-sidebar span {
    color: var(--preview-muted);
}

.white-label-preview-active {
    margin-top: 0.65rem;
    border-radius: 0.55rem;
    padding: 0.45rem 0.6rem;
    background: color-mix(in srgb, var(--preview-secondary) 35%, transparent);
    color: var(--preview-on-primary) !important;
}

.white-label-preview-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem;
}

.white-label-preview-button {
    border-radius: 0.55rem;
    background: var(--preview-primary);
    padding: 0.45rem 0.75rem;
    color: var(--preview-on-primary);
    font-size: 0.75rem;
    font-weight: 700;
}

html, body {
    font-family: var(--font);
}

.brand-logo-sidebar,
.brand-logo-mobile {
    border-radius: 0.65rem;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

.brand-logo-guest {
    border-radius: 1.25rem;
    object-fit: contain;
    display: block;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.guest-bg {
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(45, 212, 191, 0.35), transparent 55%),
        radial-gradient(ellipse 70% 50% at 90% 80%, rgba(15, 118, 110, 0.45), transparent 50%),
        linear-gradient(160deg, #0c1a1a 0%, #134e4a 45%, #0f766e 100%);
}

.sidebar-panel {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    background: linear-gradient(180deg, #0f2929 0%, #0c1a1a 100%);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    will-change: transform;
}

html.sidebar-open .sidebar-panel {
    transform: translateX(0);
}

.sidebar-panel-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.sidebar-brand {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    flex-shrink: 0;
}

.sidebar-nav {
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.sidebar-footer {
    flex-shrink: 0;
}

.sidebar-close-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: rgba(204, 251, 241, 0.9);
    background: rgba(255, 255, 255, 0.06);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sidebar-close-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.28);
    color: #fff;
}

/* Ícone X (fechar) dentro da sidebar */
.sidebar-close-icon {
    position: relative;
    display: block;
    width: 0.95rem;
    height: 0.95rem;
}

.sidebar-close-icon::before,
.sidebar-close-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.sidebar-close-icon::before {
    transform: translateY(-50%) rotate(45deg);
}

.sidebar-close-icon::after {
    transform: translateY(-50%) rotate(-45deg);
}

/* Sanduíche no header: só quando a sidebar está fechada */
.sidebar-toggle-btn.sidebar-toggle-btn--header {
    display: none !important;
}

html.sidebar-closed .sidebar-toggle-btn.sidebar-toggle-btn--header {
    display: inline-flex !important;
}

.sidebar-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    border-radius: 0.65rem;
    border: 1px solid rgba(13, 148, 136, 0.35);
    background: #f0fdfa;
    color: var(--accent);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sidebar-toggle-btn:hover {
    background: #ccfbf1;
    border-color: var(--accent);
    color: #0f766e;
}

.app-header .btn-ghost {
    border-color: rgba(13, 148, 136, 0.35);
    background: #f0fdfa;
    color: var(--accent);
}

.app-header .btn-ghost:hover {
    background: #ccfbf1;
    border-color: var(--accent);
    color: #0f766e;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 35;
    border: 0;
    padding: 0;
    margin: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

html.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
}

@media (min-width: 1024px) {
    html.sidebar-open .sidebar-backdrop {
        opacity: 0;
        pointer-events: none;
    }
}

.app-main {
    min-width: 0;
    min-height: 100vh;
    transition: margin-left 0.22s ease;
}

@media (min-width: 1024px) {
    html.sidebar-open .app-main {
        margin-left: var(--sidebar-width, 16rem);
    }

    html.sidebar-closed .app-main {
        margin-left: 0;
    }
}

.sidebar-toggle-icon,
.sidebar-toggle-icon::before,
.sidebar-toggle-icon::after {
    display: block;
    width: 1rem;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.sidebar-toggle-icon {
    position: relative;
}

.sidebar-toggle-icon::before,
.sidebar-toggle-icon::after {
    content: '';
    position: absolute;
    left: 0;
}

.sidebar-toggle-icon::before {
    top: -5px;
}

.sidebar-toggle-icon::after {
    top: 5px;
}

.sidebar-link {
    display: block;
    border-radius: 0.75rem;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    color: rgba(204, 251, 241, 0.75);
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.sidebar-link-active {
    background: rgba(13, 148, 136, 0.35);
    color: #fff;
}

.sidebar-group {
    margin: 0.25rem 0;
}

.sidebar-group-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.875rem 0.25rem;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(153, 246, 228, 0.45);
}

.sidebar-category-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.sidebar-link-nested {
    padding-left: 1.25rem;
}

.label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #334155;
}

.input {
    width: 100%;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    color: var(--ink);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 0.75rem;
    background: var(--accent);
    padding: 0.7rem 1.1rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #fff;
    transition: background 0.15s ease, transform 0.1s ease;
}

.btn-primary:hover:not(:disabled) {
    background: #0f766e;
}

.btn-primary:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-ghost {
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    padding: 0.45rem 0.85rem;
    font-weight: 500;
    color: #475569;
    transition: background 0.15s ease;
}

.btn-ghost:hover {
    background: #f8fafc;
}

.btn-primary.is-loading,
.btn-ghost.is-loading {
    opacity: 0.7;
    pointer-events: none;
}

/* WhatsApp live panel */
.wa-live {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
}

.wa-live-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 999px;
    background: #94a3b8;
}

.wa-live.is-active {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.wa-live.is-active .wa-live-dot {
    background: #f59e0b;
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5);
    animation: wa-pulse 1.4s ease-out infinite;
}

.wa-live.is-connected {
    border-color: #99f6e4;
    background: #f0fdfa;
    color: #0f766e;
}

.wa-live.is-connected .wa-live-dot {
    background: #14b8a6;
}

.wa-live.is-error {
    border-color: #fecdd3;
    background: #fff1f2;
    color: #9f1239;
}

.wa-live.is-error .wa-live-dot {
    background: #e11d48;
}

@keyframes wa-pulse {
    0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.45); }
    70% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
    100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.wa-panel {
    transition: border-color 0.35s ease, box-shadow 0.35s ease, background 0.35s ease;
}

.wa-panel--waiting {
    border-color: #fde68a;
    box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.15);
}

.wa-panel--connected {
    border-color: #99f6e4;
    box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.2);
}

.wa-status-badge--ok {
    background: #f0fdfa;
    color: #0f766e;
    box-shadow: inset 0 0 0 1px #99f6e4;
}

.wa-status-badge--wait {
    background: #fffbeb;
    color: #92400e;
    box-shadow: inset 0 0 0 1px #fde68a;
}

.wa-connected-banner {
    margin-top: 1.5rem;
    border-radius: 0.75rem;
    border: 1px solid #99f6e4;
    background: linear-gradient(120deg, #f0fdfa, #ccfbf1);
    padding: 1rem 1.25rem;
    animation: wa-fade-in 0.45s ease;
}

.wa-avatar {
    position: relative;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 9999px;
    overflow: hidden;
    background: #ecfdf5;
    border: 2px solid #99f6e4;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wa-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wa-avatar-fallback {
    font-family: var(--font);
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f766e;
    line-height: 1;
}

@keyframes wa-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.wa-field-flash {
    animation: wa-flash 0.6s ease;
}

@keyframes wa-flash {
    0% { background: rgba(13, 148, 136, 0.18); }
    100% { background: transparent; }
}

.wa-qr-wrap {
    position: relative;
    border-radius: 0.75rem;
}

.wa-qr-wrap.is-scanning::after {
    content: '';
    position: absolute;
    left: 8%;
    right: 8%;
    height: 2px;
    top: 12%;
    background: linear-gradient(90deg, transparent, #0d9488, transparent);
    animation: wa-scan 2.2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes wa-scan {
    0% { top: 12%; opacity: 0.2; }
    50% { opacity: 1; }
    100% { top: 88%; opacity: 0.2; }
}

/* Conversation sandbox (admin) */
.sandbox-panel {
    height: 64rem;
    max-height: 64rem;
}

@media (min-width: 1280px) {
    .sandbox-panel {
        height: 72rem;
        max-height: 72rem;
    }
}

.sandbox-chat {
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d4cdc4' fill-opacity='0.35'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.sandbox-bubble {
    max-width: 85%;
    padding: 0.5rem 0.65rem 0.35rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.45;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
    word-break: break-word;
}

.sandbox-bubble--in {
    margin-right: auto;
    background: #fff;
    border-top-left-radius: 0.125rem;
}

.sandbox-bubble--out {
    margin-left: auto;
    background: #dcf8c6;
    border-top-right-radius: 0.125rem;
}

.sandbox-bubble__body {
    white-space: pre-wrap;
}

.sandbox-bubble__time {
    margin-top: 0.2rem;
    text-align: right;
    font-size: 0.625rem;
    color: rgba(0, 0, 0, 0.45);
}

.sandbox-quick {
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
}

.inbox-page {
    margin: -1.5rem -1rem 0;
    height: calc(100vh - 5.5rem);
    min-height: 28rem;
}

@media (min-width: 640px) {
    .inbox-page { margin-left: -1.5rem; margin-right: -1.5rem; }
}

@media (min-width: 1024px) {
    .inbox-page { margin-left: -2rem; margin-right: -2rem; }
}

.inbox-shell {
    display: flex;
    height: 100%;
    background: #ece5dd;
    border-top: 1px solid #d1d5db;
    overflow: hidden;
}

.inbox-list {
    width: 18rem;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-right: 1px solid #e2e8f0;
}

.inbox-list-head {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.inbox-contact-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: .75rem;
    padding: .55rem .75rem;
    border: 1px solid #dbe3e8;
    border-radius: 999px;
    background: #f0f2f5;
    color: #64748b;
}
.inbox-contact-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #1f2937;
    font-size: .78rem;
}
.inbox-contact-results {
    position: absolute;
    top: calc(100% + .35rem);
    left: 0;
    right: 0;
    z-index: 45;
    max-height: 22rem;
    overflow-y: auto;
    border: 1px solid #dbe3e8;
    border-radius: .75rem;
    background: #fff;
    box-shadow: 0 14px 32px rgba(15,23,42,.16);
}
.inbox-contact-result {
    display: flex;
    align-items: center;
    gap: .65rem;
    width: 100%;
    padding: .7rem .75rem;
    border: 0;
    border-bottom: 1px solid #eef2f5;
    background: #fff;
    text-align: left;
    cursor: pointer;
}
.inbox-contact-result:hover { background: #f0fdfa; }
.inbox-contact-result:disabled { opacity: .55; cursor: wait; }
.inbox-contact-result-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.15rem;
    height: 2.15rem;
    flex: 0 0 2.15rem;
    border-radius: 999px;
    color: #0f766e;
    background: #ccfbf1;
    font-weight: 700;
}
.inbox-contact-result strong,
.inbox-contact-result small { display: block; }
.inbox-contact-result strong { color: #1f2937; font-size: .82rem; }
.inbox-contact-result small { margin-top: .1rem; color: #64748b; font-size: .69rem; }

.inbox-list-body {
    flex: 1;
    overflow-y: auto;
}

.inbox-chat {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    background: transparent;
}

.inbox-chat:hover { background: #f8fafc; }
.inbox-chat--active { background: #ccfbf1; }

.inbox-chat-body { min-width: 0; flex: 1; }

.inbox-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    overflow: hidden;
    background: #ccfbf1;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.inbox-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.inbox-avatar-fallback { font-size: 0.9rem; font-weight: 700; color: #0f766e; line-height: 1; }

.inbox-thread-who {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}
.inbox-thread-who .inbox-avatar { width: 2.75rem; height: 2.75rem; }

.inbox-chat-name { display: block; font-size: 0.875rem; font-weight: 600; color: #122424; }
.inbox-chat-tipo {
    display: inline-block;
    margin-left: 0.35rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: #0f766e;
    background: #ccfbf1;
    border-radius: 999px;
    padding: 0.05rem 0.4rem;
    vertical-align: middle;
}
.inbox-chat-produto {
    display: inline-block;
    margin-left: 0.35rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: #1e3a8a;
    background: #dbeafe;
    border-radius: 999px;
    padding: 0.05rem 0.4rem;
    vertical-align: middle;
}
.inbox-chat-preview { display: block; font-size: 0.75rem; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-chat-meta { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.15rem; }
.inbox-chat-time { font-size: 0.65rem; color: #94a3b8; }
.inbox-badge-unanswered {
    font-size: 0.6rem;
    font-weight: 700;
    color: #fff;
    background: #ea580c;
    border-radius: 999px;
    padding: 0.08rem 0.4rem;
    letter-spacing: 0.01em;
}

.inbox-chat--response-overdue {
    background: #fff1f2;
    box-shadow: inset 4px 0 0 #dc2626;
}
.inbox-chat--response-overdue:hover,
.inbox-chat--response-overdue.inbox-chat--active {
    background: #ffe4e6;
}
.inbox-badge-response-overdue {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: .1rem .45rem;
    color: #fff;
    background: #dc2626;
    font-size: .68rem;
    font-weight: 700;
    animation: inbox-response-alert 1.1s ease-in-out infinite;
}
@keyframes inbox-response-alert {
    50% { opacity: .58; }
}
.inbox-badge-progress {
    font-size: 0.6rem;
    font-weight: 700;
    color: #fff;
    background: #0d9488;
    border-radius: 999px;
    padding: 0.08rem 0.4rem;
    letter-spacing: 0.01em;
}
.inbox-badge-done {
    font-size: 0.6rem;
    font-weight: 700;
    color: #fff;
    background: #64748b;
    border-radius: 999px;
    padding: 0.08rem 0.4rem;
    letter-spacing: 0.01em;
}

.inbox-thread {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #e5ddd5;
}

.inbox-thread-head {
    padding: 0.75rem 1rem;
    background: #f0f2f5;
    border-bottom: 1px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.inbox-thread-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.inbox-mobile-actions-toggle { display: none; }

.inbox-infrastructure-tags{display:flex;flex-wrap:wrap;gap:.25rem;margin-top:.2rem}.inbox-infrastructure-tags .inbox-infrastructure-function{margin-top:0;background:#edf2f7;color:#475569}

.inbox-estabelecimento-wrap {
    min-width: 11rem;
    max-width: 16rem;
}
.inbox-estabelecimento-icon.inbox-action-icon { display: none; }

.inbox-thread { position: relative; }
.inbox-infrastructure-panel { position:absolute; z-index:25; top:0; right:0; width:min(24rem,100%); height:100%; padding:1rem; overflow-y:auto; border-left:1px solid #e2e8f0; background:#fff; box-shadow:-12px 0 32px rgba(15,23,42,.12); }
.inbox-infrastructure-head { display:flex; align-items:flex-start; justify-content:space-between; gap:.75rem; padding-bottom:.9rem; border-bottom:1px solid #e2e8f0; }.inbox-infrastructure-head strong{display:block;color:#122424}.inbox-infrastructure-head small{display:block;margin-top:.2rem;color:#64748b}.inbox-infrastructure-head button{font-size:1.4rem;color:#64748b}
.inbox-infrastructure-summary { display:grid; grid-template-columns:repeat(4,1fr); gap:.55rem; margin:1rem 0; }.inbox-infrastructure-summary span{padding:.6rem .25rem;text-align:center;border:1px solid #e2e8f0;border-radius:.45rem}.inbox-infrastructure-summary i,.inbox-infrastructure-summary b,.inbox-infrastructure-summary small{display:block}.inbox-infrastructure-summary i{height:1rem;font-style:normal;line-height:1rem;color:#155e75}.inbox-infrastructure-summary i svg{width:1rem;height:1rem;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.inbox-infrastructure-summary b{margin-top:.25rem;color:#1f2937;font-size:.9rem}.inbox-infrastructure-summary small{font-size:.62rem;color:#64748b}
.inbox-infrastructure-items{display:grid;gap:.55rem}.inbox-infrastructure-items>h4{margin:.15rem 0 .05rem;font-size:.7rem;font-weight:700;color:#334155}.inbox-infrastructure-card{display:flex;gap:.6rem;padding:.6rem;border:1px solid #dbe5ea;border-radius:.55rem;background:#fff;box-shadow:0 1px 2px rgba(15,23,42,.025)}.inbox-infrastructure-icon{display:flex;align-items:center;justify-content:center;width:2.15rem;height:2.15rem;flex:0 0 2.15rem;border-radius:.45rem;background:#eef8f9;color:#155e75}.inbox-infrastructure-icon svg{width:1.2rem;height:1.2rem;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.inbox-infrastructure-card-body{min-width:0;flex:1}.inbox-infrastructure-card header{display:flex;align-items:flex-start;gap:.4rem}.inbox-infrastructure-card header>div{min-width:0;flex:1}.inbox-infrastructure-card strong{display:block;color:#1f2937;font-size:.76rem;line-height:1.1}.inbox-infrastructure-card em{display:inline-block;margin-top:.2rem;padding:.12rem .35rem;border-radius:.2rem;background:#c8eff1;color:#0e7490;font-size:.58rem;font-style:normal;font-weight:700}.inbox-infrastructure-card header small{display:flex;align-items:center;gap:.22rem;padding-top:.05rem;color:#16a36a;font-size:.63rem}.inbox-infrastructure-card header small i{width:.45rem;height:.45rem;border-radius:50%;background:#22c55e}.inbox-infrastructure-more{padding:0 .1rem;color:#1e4864;font-size:1rem;line-height:.9}.inbox-infrastructure-card section{margin-top:.45rem;display:grid;gap:.17rem}.inbox-infrastructure-card section>div{display:grid;grid-template-columns:5.5rem minmax(0,1fr) auto;gap:.35rem;align-items:center;font-size:.67rem;line-height:1.1}.inbox-infrastructure-card section b{font-weight:500;color:#64748b}.inbox-infrastructure-card section span{overflow:hidden;color:#334155;white-space:nowrap;text-overflow:ellipsis}.inbox-infrastructure-card section button{width:1rem;height:1rem;color:#1e4864;line-height:1}.inbox-infrastructure-card section button svg{width:.85rem;height:.85rem;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.inbox-infrastructure-manage{display:flex;justify-content:center;margin-top:1rem}
.inbox-infrastructure-group{overflow:hidden;border:1px solid #bde7ed;border-radius:.75rem;background:#f8feff;box-shadow:0 1px 2px rgba(15,23,42,.025)}.inbox-infrastructure-group-terminal{padding:.6rem;background:linear-gradient(105deg,#fff 0%,#effcfd 100%)}.inbox-infrastructure-group-terminal .inbox-infrastructure-card{padding:0;border:0;border-radius:0;background:transparent;box-shadow:none}.inbox-infrastructure-group-printers{padding:.65rem;border-top:1px solid #c8edf1}.inbox-infrastructure-group-title{display:flex;align-items:center;gap:.35rem;margin-bottom:.55rem;color:#173d58}.inbox-infrastructure-group-title svg{width:1.1rem;height:1.1rem;stroke:#0e7490;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.inbox-infrastructure-group-title strong{font-size:.73rem}.inbox-infrastructure-group-title span{color:#64748b;font-size:.73rem}.inbox-infrastructure-group-tree{position:relative;display:grid;gap:.5rem;margin-left:.6rem;padding-left:.9rem}.inbox-infrastructure-group-tree:before{position:absolute;top:.05rem;bottom:1.05rem;left:0;width:2px;border-radius:2px;background:#65cddd;content:""}.inbox-infrastructure-group-tree .inbox-infrastructure-card{position:relative}.inbox-infrastructure-group-tree .inbox-infrastructure-card:before{position:absolute;top:50%;left:-.92rem;width:.78rem;height:2px;background:#65cddd;content:""}.inbox-infrastructure-group-tree .inbox-infrastructure-card:after{position:absolute;top:calc(50% - .22rem);left:-1.05rem;width:.44rem;height:.44rem;border-radius:50%;background:#65cddd;content:""}

.inbox-prod-drop { position: relative; }
.inbox-prod-btn {
    min-width: 8.5rem;
    max-width: 11rem;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.inbox-prod-btn:disabled { cursor: default; opacity: 0.6; }
.inbox-prod-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 30;
    min-width: 12rem;
    max-height: 14rem;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
    padding: 0.35rem;
}
.inbox-prod-menu.hidden { display: none; }
.inbox-prod-menu label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.45rem;
    font-size: 0.8125rem;
    color: #334155;
    border-radius: 0.5rem;
    cursor: pointer;
}
.inbox-prod-menu label:hover { background: #f8fafc; }

.inbox-thread-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.inbox-scroll-bottom {
    position: absolute;
    right: 1rem;
    bottom: 5.25rem;
    z-index: 5;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid #d1d5db;
    border-radius: 9999px;
    background: #fff;
    color: #0f766e;
    box-shadow: 0 2px 8px rgba(0,0,0,.16);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
}
.inbox-scroll-bottom:hover { background: #f8fafc; }
.inbox-scroll-bottom.hidden { display: none; }

.inbox-empty { padding: 1.5rem 1rem; font-size: 0.8rem; color: #64748b; }

.inbox-date-separator {
    position: sticky;
    top: 0.25rem;
    z-index: 4;
    align-self: center;
    display: flex;
    justify-content: center;
    width: 100%;
    min-height: 1.65rem;
    pointer-events: none;
}
.inbox-date-separator time {
    display: inline-flex;
    align-items: center;
    min-height: 1.55rem;
    padding: 0.2rem 0.65rem;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 0.45rem;
    background: rgba(255, 255, 255, 0.94);
    color: #475569;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
    backdrop-filter: blur(5px);
}

.inbox-bubble {
    max-width: 78%;
    padding: 0.4rem 0.6rem 0.3rem;
    border-radius: 0.55rem;
    font-size: 0.875rem;
    box-shadow: 0 1px 1px rgba(0,0,0,.06);
    word-break: break-word;
}

.inbox-bubble--in { margin-right: auto; background: #fff; border-top-left-radius: 0.1rem; }
.inbox-bubble--out { margin-left: auto; background: #d9fdd3; border-top-right-radius: 0.1rem; }
.inbox-bubble--ai.inbox-bubble--out { background: #e0f2fe; }
.inbox-bubble--human.inbox-bubble--out { background: #d9fdd3; }

.inbox-bubble-actor { display: block; font-size: 0.65rem; font-weight: 700; color: #0f766e; margin-bottom: 0.15rem; }
.inbox-bubble-text { white-space: pre-wrap; }
.inbox-bubble-foot { display: flex; align-items: center; justify-content: flex-end; gap: 0.2rem; margin-top: 0.15rem; }
.inbox-bubble-time { font-size: 0.6rem; color: rgba(0,0,0,.4); }
.inbox-forward-btn,
.inbox-edit-btn,
.inbox-delete-message-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    margin-left: .2rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-size: .9rem;
}
.inbox-reply-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    margin-left: .2rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-size: .9rem;
}
.inbox-forward-btn:hover,
.inbox-edit-btn:hover,
.inbox-delete-message-btn:hover,
.inbox-reply-btn:hover { color: #0f766e; background: rgba(255,255,255,.55); }
.inbox-delete-message-btn:hover { color: #b91c1c; }
.inbox-delete-message-btn { color: #dc2626; }
.inbox-delete-message-btn svg {
    width: .9rem;
    height: .9rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.inbox-message-deleted { color: #64748b; font-style: italic; }
.inbox-edited-label { margin-left: .15rem; color: rgba(0,0,0,.42); font-size: .58rem; font-style: italic; }
.inbox-reply-quoted {
    display: flex;
    flex-direction: column;
    gap: .08rem;
    max-width: 18rem;
    margin: .1rem 0 .35rem;
    padding: .38rem .5rem;
    overflow: hidden;
    border-left: 3px solid #0d9488;
    border-radius: .25rem;
    background: rgba(255,255,255,.58);
}
.inbox-reply-quoted strong { color:#0f766e; font-size:.66rem; }
.inbox-reply-quoted span { overflow:hidden; color:#475569; font-size:.68rem; white-space:nowrap; text-overflow:ellipsis; }
.inbox-forwarded-label { display:block; margin-bottom:.2rem; color:#64748b; font-size:.62rem; font-style:italic; }
.inbox-forward-card { width: min(32rem, calc(100vw - 2rem)); }
.inbox-forward-card .inbox-contact-search { margin-right: 2.5rem; }
.inbox-forward-results { max-height: min(24rem, 55vh); margin-top:.75rem; overflow-y:auto; border:1px solid #e2e8f0; border-radius:.75rem; }
.inbox-forward-success { color:#047857 !important; }
.inbox-ack { font-size: 0.72rem; letter-spacing: -0.14em; line-height: 1; }
.inbox-ack--sent { color: rgba(0,0,0,.38); }
.inbox-ack--delivered { color: rgba(0,0,0,.45); }
.inbox-ack--read { color: #53bdeb; }

.inbox-media { display: block; max-width: 16rem; max-height: 14rem; border-radius: 0.4rem; margin-bottom: 0.25rem; }
.inbox-audio { width: 14rem; margin-bottom: 0.2rem; }

.inbox-paste-upload-preview {
    position: relative;
    overflow: hidden;
    border-radius: .4rem;
}
.inbox-paste-upload-preview .inbox-media { margin-bottom: 0; }
.inbox-paste-upload-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .75rem;
    color: #fff;
    background: rgba(15, 23, 42, .62);
    font-size: .76rem;
    font-weight: 700;
}
.inbox-paste-upload-spinner {
    width: 1rem;
    height: 1rem;
    flex: 0 0 1rem;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 999px;
    animation: inbox-paste-upload-spin .75s linear infinite;
}
.inbox-bubble--upload-failed .inbox-paste-upload-overlay { background: rgba(185, 28, 28, .78); }
.inbox-bubble--upload-failed .inbox-paste-upload-spinner { display: none; }
.inbox-pending-send {
    display: grid;
    grid-template-columns: 1rem 1fr;
    align-items: center;
    gap: .45rem;
    min-width: 10rem;
    padding: .45rem .2rem;
    color: #475569;
    font-size: .75rem;
}
.inbox-pending-send small {
    grid-column: 1 / -1;
    max-width: 18rem;
    overflow: hidden;
    color: #334155;
    white-space: nowrap;
    text-overflow: ellipsis;
}
@keyframes inbox-paste-upload-spin { to { transform: rotate(360deg); } }

.inbox-composer {
    display: flex;
    align-items: flex-end;
    gap: 0.4rem;
    padding: 0.55rem 0.7rem;
    background: #f0f2f5;
    border-top: 1px solid #d1d5db;
}

.inbox-reply-compose,
.inbox-edit-compose {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin: 0 .7rem;
    padding: .45rem .65rem;
    border-left: 3px solid #0d9488;
    background: #fff;
    box-shadow: 0 -1px 3px rgba(15,23,42,.08);
}
.inbox-reply-compose.hidden,
.inbox-edit-compose.hidden { display:none; }
.inbox-reply-compose div,
.inbox-edit-compose div { min-width:0; }
.inbox-reply-compose strong,
.inbox-reply-compose span,
.inbox-edit-compose strong,
.inbox-edit-compose span { display:block; }
.inbox-reply-compose strong,
.inbox-edit-compose strong { color:#0f766e; font-size:.7rem; }
.inbox-reply-compose span,
.inbox-edit-compose span { overflow:hidden; color:#64748b; font-size:.72rem; white-space:nowrap; text-overflow:ellipsis; }
.inbox-reply-compose button,
.inbox-edit-compose button { border:0; background:transparent; color:#64748b; cursor:pointer; font-size:1.2rem; }
.inbox-discard-btn {
    width: 2.25rem;
    min-width: 2.25rem;
    padding: 0 !important;
    color:#dc2626 !important;
}
.inbox-delete-card { width: min(25rem, calc(100vw - 2rem)); }

.inbox-composer-tools { display: flex; gap: 0.2rem; }

.inbox-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.1rem;
    height: 2.1rem;
    padding: 0 0.35rem;
    border-radius: 0.5rem;
    font-size: 0.65rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #334155;
    cursor: pointer;
}

.inbox-icon-btn--live { background: #fecaca; border-color: #f87171; }

.inbox-input {
    flex: 1;
    resize: none;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    padding: 0.45rem 0.75rem;
    font-size: 0.875rem;
    max-height: 6rem;
}

.inbox-send { flex-shrink: 0; }

@media (max-width: 720px) {
    /* iOS amplia automaticamente inputs menores que 16px ao receber foco. */
    .inbox-contact-search input,
    [data-inbox-forward-search] { font-size: 16px; }
    /*
     * Mobile da Central: duas telas, como no WhatsApp.
     * A lista ocupa a tela inteira; ao abrir uma conversa, ela é
     * substituída pela conversa. Desktop permanece inalterado.
     */
    .inbox-page {
        /*
         * Mobile: a Central occupies the full width available by the viewport
         * and reaches the bottom edge, without changing the desktop layout.
         * The parent <main> has horizontal/bottom padding, so the negative
         * margins cancel that spacing only for the Central on mobile.
         */
        margin-left: -1rem;
        margin-right: -1rem;
        margin-bottom: -1.5rem;
        height: calc(100dvh - 4.75rem);
        min-height: 0;
    }

    .inbox-shell {
        position: relative;
        width: 100%;
        height: 100%;
    }

    .inbox-list {
        width: 100%;
        min-width: 100%;
        border-right: 0;
    }

    .inbox-list-head {
        padding: 0.75rem 0.9rem;
    }

    .inbox-chat {
        padding: 0.8rem 0.9rem;
    }

    .inbox-thread {
        display: none;
        width: 100%;
        min-width: 100%;
        height: 100%;
    }

    .inbox-page.inbox-mobile-chat-open .inbox-list {
        display: none;
    }

    .inbox-page.inbox-mobile-chat-open .inbox-thread {
        display: flex;
    }

    .inbox-thread-head {
        position: relative;
        min-height: 4.25rem;
        padding: 0.55rem 0.65rem;
        gap: 0.35rem;
        align-content: center;
        flex-wrap: nowrap;
        overflow: visible;
    }

    .inbox-thread-who {
        flex: 1;
        min-width: 0;
    }

    .inbox-thread-who .inbox-avatar {
        width: 2.5rem;
        height: 2.5rem;
    }

    .inbox-thread-actions {
        display: none;
        position: absolute;
        top: calc(100% + .35rem);
        right: .55rem;
        z-index: 90;
        width: auto;
        min-width: 10.25rem;
        justify-content: center;
        gap: 0.25rem;
        padding: .45rem;
        border: 1px solid #d9dee3;
        border-radius: .7rem;
        background: #fff;
        box-shadow: 0 10px 28px rgba(15, 23, 42, .2);
    }

    .inbox-thread-actions.is-open {
        display: flex;
        animation: inbox-mobile-actions-down .16s ease-out;
    }

    @keyframes inbox-mobile-actions-down {
        from { opacity: 0; transform: translateY(-.45rem); }
        to { opacity: 1; transform: translateY(0); }
    }

    .inbox-mobile-actions-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 2.35rem;
        width: 2.35rem;
        height: 2.35rem;
        padding: 0;
        border: 0;
        border-radius: .65rem;
        background: transparent;
        color: #475569;
        cursor: pointer;
    }
    .inbox-mobile-actions-toggle:hover,
    .inbox-mobile-actions-toggle[aria-expanded="true"] { background: #e2e8f0; color: #0f766e; }
    .inbox-mobile-actions-toggle svg { width: 1.35rem; height: 1.35rem; fill: currentColor; }

    .inbox-thread-actions .inbox-prod-drop {
        max-width: 8rem;
    }

    .inbox-thread-actions .inbox-prod-btn {
        min-width: 0;
        max-width: 8rem;
    }

    .inbox-mobile-back {
        flex: 0 0 2.35rem;
        width: 2.35rem;
        height: 2.35rem;
        border: 0;
        background: transparent;
        color: #0f766e;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 2rem;
        line-height: 1;
        cursor: pointer;
        border-radius: 999px;
    }

    .inbox-mobile-back:active {
        background: #e6fffb;
    }

    .inbox-thread-body {
        padding: 0.65rem;
        gap: 0.4rem;
    }

    .inbox-bubble {
        max-width: 92%;
    }

    .inbox-media {
        max-width: min(18rem, 78vw);
        max-height: 15rem;
    }

    .inbox-bubble .inbox-media-wrap {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    .inbox-bubble .inbox-media--image {
        width: auto;
        max-width: 100%;
        height: auto;
    }

    .inbox-media-modal {
        padding: .75rem;
    }

    .inbox-media-modal img {
        max-width: 100%;
        max-height: calc(100dvh - 1.5rem);
    }

    .inbox-composer {
        padding: 0.45rem;
        gap: 0.3rem;
    }

    .inbox-composer-tools {
        gap: 0.15rem;
    }

    .inbox-icon-btn {
        min-width: 2rem;
        height: 2rem;
        padding: 0 0.3rem;
    }

    .inbox-input {
        min-width: 0;
    }

    .inbox-send {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .inbox-scroll-bottom {
        right: 0.65rem;
        bottom: 4.75rem;
    }
}

/* O botão de voltar é exclusivamente mobile. */
.inbox-mobile-back {
    display: none;
}

@media (max-width: 720px) {
    .inbox-mobile-back {
        display: inline-flex;
    }
}

.hd-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    padding: 1rem;
}
.hd-modal.hidden { display: none; }
.hd-modal-card {
    width: 100%;
    max-width: 28rem;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 1rem;
    background: #fff;
    padding: 1.25rem 1.4rem;
    box-shadow: 0 20px 50px rgba(0,0,0,.18);
}

.inbox-close-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}
.inbox-close-task { display: inline-flex; align-items: center; gap: .45rem; }
.inbox-close-task svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.inbox-close-task-mobile { display: none; }
.inbox-close-task-hint { margin-top: .65rem; text-align: right; color: #64748b; font-size: .75rem; }
@media (max-width: 640px) {
    .inbox-close-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .inbox-close-no-message { grid-column: 1 / -1; width: 100%; }
    .inbox-close-main, .inbox-close-task { width: 100%; justify-content: center; }
    .inbox-close-task-desktop { display: none; }
    .inbox-close-task-mobile { display: inline; }
    .inbox-close-task-hint { text-align: center; }
}

/* Central de Atendimento: filtros compactos ao lado do nome da Central. */
.inbox-list-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
}
.inbox-list-title-row [data-inbox-store] {
    min-width: 0;
    flex: 1;
}
.inbox-filter-toggle {
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dbe5e5;
    border-radius: 0.65rem;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.inbox-filter-toggle svg {
    width: 1.1rem;
    height: 1.1rem;
}
.inbox-filter-toggle:hover,
.inbox-filter-toggle.is-active {
    background: #f0fdfa;
    border-color: #99f6e4;
    color: #0f766e;
}
.inbox-filters-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.45rem;
    margin-top: 0.55rem;
    padding: 0.55rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #f8fafc;
}
.inbox-filters-panel.hidden { display: none; }

@media (min-width: 721px) {
    .inbox-filters-panel {
        position: absolute;
        z-index: 20;
        width: 15rem;
        box-shadow: 0 12px 30px rgba(15,23,42,.12);
    }
    .inbox-list-head { position: relative; }
}


/* Help Desk: ações e nomes das mídias */
.inbox-media-wrap {
    position: relative;
    display: block;
    width: fit-content;
    max-width: 100%;
}
.inbox-media-wrap .inbox-media {
    width: auto;
    max-width: 100%;
    height: auto;
    margin-bottom: 0;
    object-fit: contain;
}
.inbox-media-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    margin-left: 0.25rem;
    border: 1px solid #d1d5db;
    border-radius: 9999px;
    background: #fff;
    color: #334155;
    text-decoration: none;
    cursor: pointer;
    vertical-align: middle;
}
.inbox-media-wrap .inbox-media-action {
    position: absolute;
    right: 0.35rem;
    top: 0.35rem;
    margin-left: 0;
    opacity: 0.92;
}
.inbox-media-wrap .inbox-media-open { right: 2.55rem; }
.inbox-media-name, .inbox-file-name {
    margin-top: 0.18rem;
    font-size: 0.72rem;
    color: #475569;
    overflow-wrap: anywhere;
}
.inbox-file-card {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 19rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.55rem;
    background: #fff;
}
.inbox-input[contenteditable="true"] {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    outline: none;
}
.inbox-input[contenteditable="true"]:empty::before {
    content: attr(data-placeholder);
    color: #94a3b8;
    pointer-events: none;
}
.inbox-file-icon { font-size: 1.15rem; }
.inbox-file-card .inbox-file-name { margin: 0; flex: 1; min-width: 0; }
.inbox-media-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: rgba(0,0,0,.78);
}
.inbox-media-modal img {
    max-width: min(92vw, 1200px);
    max-height: 90vh;
    object-fit: contain;
    border-radius: 0.35rem;
}
.inbox-media-modal-close {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: 9999px;
    background: #fff;
    color: #111827;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Ações de mídia: quadradas, arredondadas, destacadas e discretas */
.inbox-media-action {
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    padding: 0;
    margin-left: 0.25rem;
    border: 1px solid rgba(15, 118, 110, .45);
    border-radius: .45rem;
    background: #0f766e;
    color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,.16);
    font-size: .95rem;
}
.inbox-media-action:hover {
    background: #115e59;
    color: #fff;
}
.inbox-media-wrap .inbox-media-action {
    right: .35rem;
    top: .35rem;
    margin-left: 0;
}
.inbox-media-wrap .inbox-media-open { right: 2.6rem; }
.inbox-file-card .inbox-media-action {
    position: static;
    flex-shrink: 0;
}

/* Rodapé da Central — visual inspirado no WhatsApp */
.inbox-composer {
    position: relative;
    align-items: flex-end;
    padding: .45rem .7rem;
    gap: .45rem;
    min-height: 3.65rem;
}
.inbox-attach-wrap,
.inbox-emoji-wrap { position: relative; flex: 0 0 auto; }
.inbox-plus-btn,
.inbox-emoji-btn,
.inbox-camera-btn,
.inbox-mic-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.45rem;
    height: 2.45rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #334155;
    cursor: pointer;
    font-size: 1.65rem;
    line-height: 1;
}
.inbox-plus-btn:hover,
.inbox-emoji-btn:hover,
.inbox-camera-btn:hover,
.inbox-mic-btn:hover { background: #e7ecef; }
.inbox-emoji-btn { font-size: 1.45rem; }
.inbox-emoji-menu {
    position: absolute;
    left: 0;
    bottom: 3.05rem;
    z-index: 80;
    width: min(19rem, calc(100vw - 1rem));
    max-height: 16rem;
    padding: .55rem;
    overflow-y: auto;
    border: 1px solid #d8dee3;
    border-radius: .75rem;
    background: #fff;
    box-shadow: 0 8px 28px rgba(15,23,42,.16);
}
.inbox-emoji-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: .15rem; }
.inbox-emoji-grid button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: .4rem;
    background: transparent;
    cursor: pointer;
    font-size: 1.15rem;
}
.inbox-emoji-grid button:hover { background: #eef2f4; }
.inbox-attach-menu {
    position: absolute;
    left: 0;
    bottom: 3.05rem;
    z-index: 80;
    min-width: 12.5rem;
    padding: .35rem;
    border: 1px solid #d8dee3;
    border-radius: .75rem;
    background: #fff;
    box-shadow: 0 8px 28px rgba(15,23,42,.16);
}
.inbox-attach-menu button {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    padding: .65rem .7rem;
    border: 0;
    border-radius: .55rem;
    background: transparent;
    color: #1f2937;
    text-align: left;
    cursor: pointer;
    font-size: .85rem;
}
.inbox-attach-menu button:hover { background: #f1f5f9; }
.inbox-attach-menu span { width: 1.35rem; text-align: center; }
.inbox-input {
    min-height: 2.45rem;
    max-height: 9rem;
    overflow-y: auto;
    line-height: 1.35;
    padding: .55rem .8rem;
    border-radius: 1.2rem;
    background: #fff;
}
.inbox-send.hidden { display: none; }
.inbox-mic-btn,
.inbox-camera-btn { display: none; }

@media (max-width: 720px) {
    html.inbox-layout,
    body.inbox-layout { height: 100%; overflow: hidden; }
    body.inbox-layout { overscroll-behavior: none; }
    .inbox-page {
        position: fixed;
        left: 0; right: 0; top: 4.75rem; bottom: 0;
        width: 100vw; height: auto; min-height: 0; margin: 0;
        overflow: hidden;
    }
    .inbox-shell { height: 100%; min-height: 0; overflow: hidden; }
    .inbox-thread, .inbox-list { height: 100%; min-height: 0; overflow: hidden; }
    .inbox-thread-body {
        min-height: 0;
        flex: 1 1 auto;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    .inbox-composer {
        flex: 0 0 auto;
        width: 100%;
        box-sizing: border-box;
        padding: .35rem .45rem calc(.35rem + env(safe-area-inset-bottom));
        gap: .15rem;
        background: #f0f2f5;
        position: relative;
        z-index: 20;
    }
    .inbox-plus-btn, .inbox-emoji-btn, .inbox-camera-btn, .inbox-mic-btn {
        display: inline-flex;
        width: 2.35rem; height: 2.35rem; flex: 0 0 2.35rem;
    }
    .inbox-plus-btn { font-size: 1.7rem; }
    .inbox-input {
        min-width: 0; width: auto;
        min-height: 2.35rem; max-height: 8rem;
        padding: .5rem .75rem; font-size: 1rem;
        border-radius: 1.25rem; margin: 0;
    }
    .inbox-send {
        flex: 0 0 auto;
        min-width: 2.35rem; width: 2.35rem; height: 2.35rem;
        padding: 0; border-radius: 50%; font-size: 0;
    }
    .inbox-send::before { content: '➤'; font-size: 1rem; line-height: 1; }
    .inbox-attach-menu {
        left: .15rem;
        bottom: calc(3.05rem + env(safe-area-inset-bottom));
    }
}

/* UX de gravação de áudio — inspirado no WhatsApp */
.inbox-camera-btn svg,
.inbox-mic-btn svg,
.inbox-record-cancel svg {
    width: 1.35rem;
    height: 1.35rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.inbox-record-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.45rem;
    height: 2.45rem;
    flex: 0 0 2.45rem;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #374151;
    cursor: pointer;
}
.inbox-record-cancel:hover { background: #e7ecef; }
.inbox-recording-state {
    display: flex;
    align-items: center;
    gap: .45rem;
    flex: 1 1 auto;
    min-width: 0;
    height: 2.45rem;
    color: #374151;
    font-size: .9rem;
}
.inbox-recording-dot {
    width: .55rem;
    height: .55rem;
    flex: 0 0 .55rem;
    border-radius: 50%;
    background: #ef4444;
    animation: inbox-record-pulse 1s infinite;
}
.inbox-recording-bars {
    flex: 1 1 auto;
    height: 1.7rem;
    min-width: 4rem;
    opacity: .55;
    background:
      repeating-linear-gradient(90deg,
        transparent 0 2px,
        #64748b 2px 4px,
        transparent 4px 7px);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
@keyframes inbox-record-pulse {
    0%, 100% { opacity: .45; transform: scale(.85); }
    50% { opacity: 1; transform: scale(1); }
}

@media (max-width: 720px) {
    .inbox-composer.is-recording .inbox-attach-wrap,
    .inbox-composer.is-recording .inbox-input,
    .inbox-composer.is-recording .inbox-camera-btn,
    .inbox-composer.is-recording .inbox-mic-btn {
        display: none;
    }
    .inbox-composer.is-recording .inbox-record-cancel {
        display: inline-flex;
    }
    .inbox-composer.is-recording .inbox-recording-state {
        display: flex;
    }
    .inbox-composer.is-recording .inbox-send {
        display: inline-flex;
    }
}

.inbox-record-cancel,
.inbox-recording-state { display: none; }

/* Desktop — mesmos controles do compositor mobile */
@media (min-width: 721px) {
    .inbox-camera-btn,
    .inbox-mic-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 2.45rem;
        width: 2.45rem;
        height: 2.45rem;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: transparent;
        color: #334155;
        cursor: pointer;
    }

    .inbox-composer.is-recording .inbox-attach-wrap,
    .inbox-composer.is-recording .inbox-input,
    .inbox-composer.is-recording .inbox-camera-btn,
    .inbox-composer.is-recording .inbox-mic-btn {
        display: none;
    }

    .inbox-composer.is-recording .inbox-record-cancel,
    .inbox-composer.is-recording .inbox-recording-state,
    .inbox-composer.is-recording .inbox-send {
        display: inline-flex;
    }

    .inbox-composer.is-recording .inbox-recording-state {
        align-items: center;
    }
}

/* Ajuste final do botão Enviar — somente tamanho/formato da seta */
.inbox-send {
    position: relative;
    border-radius: 50%;
    width: 2.7rem;
    min-width: 2.7rem;
    height: 2.7rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    line-height: 1;
}

.inbox-send::before {
    content: '➤';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    font-size: 1.25rem;
    line-height: 1;
    text-align: center;
}

@media (max-width: 720px) {
    .inbox-send {
        width: 2.35rem;
        min-width: 2.35rem;
        height: 2.35rem;
    }

    .inbox-send::before {
        font-size: 1.25rem;
    }
}

/* Configuração individual da sirene */
.central-dash-filter { display:flex; flex-wrap:wrap; gap:.55rem; align-items:flex-end; }
.central-dash-filter .input { width:auto; min-width:9.5rem; }
.central-dash-cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:1rem; }
.central-dash-card { display:flex; min-height:8.5rem; flex-direction:column; padding:1.15rem; border:1px solid #e2e8f0; border-radius:1rem; background:#fff; color:#334155; box-shadow:0 1px 2px rgba(15,23,42,.04); }
.central-dash-card span { font-size:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:#64748b; }
.central-dash-card strong { margin-top:.5rem; font-size:1.85rem; line-height:1; color:#0f172a; }
.central-dash-card small { margin-top:auto; padding-top:.65rem; color:#94a3b8; }
.central-dash-card--amber { border-color:#fde68a; background:#fffbeb; }
.central-dash-card--blue { border-color:#bfdbfe; background:#eff6ff; }
.central-dash-card--red { border-color:#fecaca; background:#fff1f2; }
.central-dash-card--green { border-color:#99f6e4; background:#f0fdfa; }
.central-dash-panel { padding:1.25rem; border:1px solid #e2e8f0; border-radius:1rem; background:#fff; }
.central-dash-title { margin-bottom:1rem; font-size:1.05rem; font-weight:700; color:#0f172a; }
.central-dash-rank-row + .central-dash-rank-row { margin-top:.9rem; }
.central-dash-rank-track { height:.42rem; margin-top:.35rem; overflow:hidden; border-radius:999px; background:#f1f5f9; }
.central-dash-rank-track span { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,#14b8a6,#0f766e); }
.central-dash-trend-scroll { overflow-x:auto; padding-bottom:.35rem; }
.central-dash-trend { display:flex; align-items:stretch; height:13rem; gap:.3rem; }
.central-dash-trend-column { display:flex; min-width:30px; flex:1; flex-direction:column; align-items:center; }
.central-dash-trend-bars { display:flex; width:100%; flex:1; align-items:flex-end; justify-content:center; gap:2px; border-bottom:1px solid #e2e8f0; }
.central-dash-trend-bars span { width:38%; min-height:2px; border-radius:4px 4px 0 0; }
.central-dash-trend-bars .is-opened { background:#fbbf24; }
.central-dash-trend-bars .is-finished { background:#14b8a6; }
.central-dash-trend-column small { margin-top:.4rem; font-size:.58rem; color:#94a3b8; transform:rotate(-35deg); }
.central-dash-dot { display:inline-block; width:.55rem; height:.55rem; margin-right:.3rem; border-radius:999px; }
@media(max-width:720px){.central-dash-filter,.central-dash-filter .input,.central-dash-filter .btn-primary{width:100%}.central-dash-cards{grid-template-columns:repeat(2,minmax(0,1fr))}.central-dash-card{min-height:7.8rem;padding:.9rem}.central-dash-card strong{font-size:1.45rem}}

/* Configuração individual da sirene */
[data-siren-settings] select {
    min-height: 2.5rem;
    border: 1px solid #cbd5e1;
    border-radius: .55rem;
    background: #fff;
    padding: .45rem .7rem;
}
[data-siren-settings] input[type="range"] {
    accent-color: #16a34a;
}

/* Mobile: a navbar global do Chasqui aparece somente na lista de conversas.
   Na conversa, o conteúdo usa toda a altura disponível. Fixar o header evita
   que o viewport visual do iPhone o perca ao abrir/fechar o teclado. */
@media (max-width: 720px) {
    .app-header {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 40;
    }

    .app-main {
        padding-top: 4.75rem;
    }

    body.inbox-mobile-chat-active .app-header {
        display: none !important;
    }

    body.inbox-mobile-chat-active .app-main {
        padding-top: 0 !important;
    }

    body.inbox-mobile-chat-active .inbox-page {
        top: 0;
        height: 100dvh;
        height: 100vh;
    }

    body:not(.inbox-mobile-chat-active) .inbox-page {
        top: 4.75rem;
        height: calc(100dvh - 4.75rem);
        height: calc(100vh - 4.75rem);
    }
}

/* Mobile real-device bottom safe area: keep the composer above browser/home controls. */
@media (max-width: 720px) {
    body.inbox-mobile-chat-active .inbox-page {
        top: var(--inbox-mobile-visual-top, 0px);
        bottom: auto;
        height: var(--inbox-mobile-visual-height, calc(100dvh - env(safe-area-inset-bottom)));
        max-height: var(--inbox-mobile-visual-height, calc(100dvh - env(safe-area-inset-bottom)));
    }

    body.inbox-mobile-chat-active .inbox-composer {
        padding-bottom: calc(.35rem + env(safe-area-inset-bottom));
        margin-bottom: 0;
    }

    body:not(.inbox-mobile-chat-active) .inbox-page {
        bottom: env(safe-area-inset-bottom);
        height: calc(100dvh - 4.75rem - env(safe-area-inset-bottom));
    }

    body.inbox-mobile-chat-active .inbox-thread-head,
    body.inbox-mobile-chat-active .inbox-composer {
        flex: 0 0 auto;
    }
}

/* Ações da conversa: ícones compactos em desktop e mobile. */
.inbox-action-icon {
    width: 2.25rem;
    min-width: 2.25rem;
    height: 2.25rem;
    min-height: 2.25rem;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: .6rem;
}
.inbox-action-icon svg {
    width: 1.2rem;
    height: 1.2rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.inbox-estabelecimento-wrap {
    position: relative;
    width: 2.25rem;
    min-width: 2.25rem;
    max-width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 2.25rem;
}
.inbox-estabelecimento-icon.inbox-action-icon {
    display: inline-flex;
    color: #0f766e;
    border: 1px solid #cbd5e1;
    background: #fff;
    pointer-events: none;
}
.inbox-estabelecimento-wrap.is-pending .inbox-estabelecimento-icon {
    color: #b45309;
    border-color: #f59e0b;
    background: #fffbeb;
}
.inbox-estabelecimento-wrap [data-inbox-estabelecimento] {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    min-width: 0;
    opacity: 0;
    cursor: pointer;
}
.inbox-prod-btn {
    min-width: 2.25rem;
    max-width: 2.25rem;
    text-align: center;
}
@media (max-width: 720px) {
    .inbox-action-icon {
        width: 2.15rem;
        min-width: 2.15rem;
        height: 2.15rem;
        min-height: 2.15rem;
    }
    .inbox-discard-btn {
        width: 2.15rem;
        min-width: 2.15rem;
        padding: 0 !important;
    }
    .inbox-estabelecimento-wrap {
        position: relative;
        width: 2.15rem;
        min-width: 2.15rem;
        max-width: 2.15rem;
        height: 2.15rem;
        flex: 0 0 2.15rem;
    }
    .inbox-estabelecimento-icon.inbox-action-icon {
        display: inline-flex;
        width: 2.15rem;
        min-width: 2.15rem;
        height: 2.15rem;
        color: #0f766e;
        border: 1px solid #cbd5e1;
        background: #fff;
        pointer-events: none;
    }
    .inbox-estabelecimento-wrap.is-pending .inbox-estabelecimento-icon {
        color: #b45309;
        border-color: #f59e0b;
        background: #fffbeb;
    }
    .inbox-estabelecimento-wrap [data-inbox-estabelecimento] {
        position: absolute;
        inset: 0;
        z-index: 2;
        width: 100%;
        height: 100%;
        min-width: 0;
        opacity: 0;
        cursor: pointer;
    }
}

.inbox-thread-actions [data-inbox-encerrar] {
    color: #dc2626;
    border-color: #fecaca;
    background: #fff1f2;
}
.inbox-thread-actions [data-inbox-encerrar]:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

.inbox-loading {
    min-height: 9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    color: #64748b;
    font-size: .875rem;
}
.inbox-loading-spinner {
    width: 1.35rem;
    height: 1.35rem;
    border: 2px solid #cbd5e1;
    border-top-color: #64748b;
    border-radius: 999px;
    animation: chasqui-inbox-spin .75s linear infinite;
}
@keyframes chasqui-inbox-spin {
    to { transform: rotate(360deg); }
}

/* /conversas — handoff humano por conversa */
.inbox-chat--human-pending {
    background: #fff7ed;
    box-shadow: inset 3px 0 0 #ea580c;
}
.inbox-chat--human-pending:hover { background: #ffedd5; }
.inbox-chat--human-active {
    box-shadow: inset 3px 0 0 #0f766e;
}
.inbox-badge-human-pending,
.inbox-badge-human-active {
    font-size: 0.6rem;
    font-weight: 700;
    color: #fff;
    border-radius: 999px;
    padding: 0.08rem 0.4rem;
    letter-spacing: 0.01em;
}
.inbox-badge-human-pending { background: #ea580c; }
.inbox-badge-human-active { background: #0f766e; }
.inbox-automation-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}
.inbox-automation-state {
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    white-space: nowrap;
}
.inbox-automation-state--ai { background: #dcfce7; color: #166534; }
.inbox-automation-state--pending { background: #ffedd5; color: #9a3412; }
.inbox-automation-state--human { background: #ccfbf1; color: #115e59; }
.inbox-automation-btn { white-space: nowrap; }
.inbox-automation-btn--off { border-color: #0f766e; color: #0f766e; }
@media (max-width: 720px) {
    .inbox-automation-actions { gap: 0.3rem; }
    .inbox-automation-state { display: none; }
    .inbox-automation-btn { font-size: 0.72rem; padding-left: 0.55rem; padding-right: 0.55rem; }
}
