.inbox-v2-shell {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .06);
}

.inbox-v2-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 24px 18px;
    border-bottom: 1px solid #eef0f3;
}

.inbox-v2-toolbar h2 {
    margin: 0 0 6px;
    font-size: 22px;
}

.inbox-v2-toolbar p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
}

.inbox-refresh-button,
.inbox-v2-search button,
.takeover-button,
.human-reply-box button,
.ai-reply-lock button {
    background: #111827;
    color: #fff;
    font-weight: 700;
}

.inbox-refresh-button {
    white-space: nowrap;
}

.inbox-v2-filters {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(160px, .8fr) minmax(260px, 1.6fr);
    gap: 12px;
    padding: 14px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #eef0f3;
}

.inbox-v2-filters select,
.inbox-v2-filters input {
    margin: 0;
    background: #fff;
}

.inbox-v2-search {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.inbox-v2-layout {
    display: grid;
    grid-template-columns: minmax(310px, 35%) minmax(0, 1fr);
    min-height: 620px;
}

.inbox-v2-sidebar {
    min-width: 0;
    background: #fff;
    border-right: 1px solid #e5e7eb;
}

.inbox-v2-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #eef0f3;
    color: #475569;
    font-size: 13px;
}

.inbox-v2-sidebar-head span {
    min-width: 28px;
    text-align: center;
    padding: 3px 7px;
    border-radius: 999px;
    background: #eef2f7;
    color: #334155;
    font-weight: 800;
}

.inbox-v2-shell .inbox-list {
    max-height: 680px;
    border-right: 0;
}

.inbox-v2-shell .inbox-item {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 12px;
    align-items: flex-start;
    padding: 15px 16px;
    border-left: 3px solid transparent;
    transition: background .16s ease, border-color .16s ease;
}

.inbox-v2-shell .inbox-item:hover {
    background: #f8fafc;
}

.inbox-v2-shell .inbox-item.selected {
    background: #f1f5f9;
    border-left-color: #111827;
}

.inbox-item-avatar,
.inbox-thread-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #111827;
    color: #fff;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .04em;
}

.inbox-item-avatar {
    width: 40px;
    height: 40px;
}

.inbox-item-body {
    min-width: 0;
}

.inbox-v2-shell .inbox-item-top strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.inbox-v2-shell .inbox-item p {
    margin-top: 6px;
}

.inbox-v2-shell .inbox-badges {
    margin-top: 8px;
}

.inbox-v2-shell .inbox-badge {
    background: #fff;
}

.inbox-v2-shell .handoff-ai {
    border-color: #bfdbfe;
    color: #1d4ed8;
    background: #eff6ff;
}

.inbox-v2-shell .handoff-human {
    border-color: #bbf7d0;
    color: #15803d;
    background: #f0fdf4;
}

.mode-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    margin-right: 5px;
}

.inbox-v2-thread {
    display: flex;
    flex-direction: column;
    max-height: 680px;
    padding: 0;
    background: #f8fafc;
}

.inbox-v2-empty {
    margin: auto;
    text-align: center;
    color: #64748b;
    padding: 40px;
    max-width: 420px;
}

.inbox-v2-empty strong {
    display: block;
    color: #334155;
    margin-top: 12px;
}

.inbox-v2-empty p {
    margin: 7px 0 0;
    line-height: 1.5;
}

.inbox-v2-empty-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e2e8f0;
    color: #475569;
    font-size: 22px;
}

.inbox-v2-thread .inbox-thread-head {
    margin: 0;
    padding: 16px 20px;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 3;
}

.inbox-thread-identity {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.inbox-thread-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
}

.inbox-thread-identity h3 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inbox-thread-meta {
    color: #94a3b8;
    font-size: 12px;
    white-space: nowrap;
}

.handoff-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 14px 18px 0;
    padding: 13px 14px;
    border: 1px solid;
    border-radius: 12px;
}

.handoff-controls.ai-active {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.handoff-controls.human-active {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.handoff-copy {
    min-width: 0;
}

.handoff-kicker {
    display: block;
    margin-bottom: 3px;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #64748b;
}

.handoff-copy strong {
    display: block;
    font-size: 13px;
}

.handoff-copy p {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 12px;
}

.secondary-button {
    background: #fff;
    border: 1px solid #cbd5e1;
    color: #334155;
    font-weight: 800;
    white-space: nowrap;
}

.takeover-button {
    white-space: nowrap;
}

.inbox-v2-thread .inbox-message-list {
    flex: 1;
    overflow-y: auto;
    padding: 18px 20px 24px;
    gap: 10px;
}

.inbox-message-row {
    display: flex;
    width: 100%;
}

.inbox-message-row.user {
    justify-content: flex-start;
}

.inbox-message-row.assistant,
.inbox-message-row.human {
    justify-content: flex-end;
}

.inbox-v2-shell .inbox-message {
    max-width: min(76%, 640px);
    border-radius: 14px;
    padding: 10px 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.inbox-v2-shell .inbox-message.user {
    margin-left: 0;
    background: #fff;
    border-color: #e2e8f0;
}

.inbox-v2-shell .inbox-message.assistant {
    background: #eef2ff;
    border-color: #dbeafe;
}

.inbox-v2-shell .inbox-message.human {
    background: #ecfdf5;
    border-color: #bbf7d0;
}

.inbox-message-author {
    margin-bottom: 4px;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #64748b;
}

.inbox-message-content {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.human-reply-box {
    position: sticky;
    bottom: 0;
    z-index: 3;
    padding: 12px 16px 14px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
}

.human-reply-box textarea {
    width: 100%;
    resize: vertical;
    min-height: 74px;
    max-height: 180px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 11px 12px;
    font: inherit;
    outline: none;
}

.human-reply-box textarea:focus {
    border-color: #94a3b8;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, .15);
}

.human-reply-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.human-reply-actions span {
    color: #94a3b8;
    font-size: 11px;
}

.human-reply-actions button {
    min-width: 92px;
}

.ai-reply-lock {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 16px;
    border-top: 1px solid #e5e7eb;
    background: rgba(255, 255, 255, .96);
    color: #64748b;
    font-size: 12px;
}

.ai-reply-lock button {
    white-space: nowrap;
}

button:disabled {
    opacity: .6;
    cursor: wait;
}

@media(max-width: 1000px) {
    .inbox-v2-layout {
        grid-template-columns: 1fr;
    }

    .inbox-v2-sidebar {
        border-right: 0;
        border-bottom: 1px solid #e5e7eb;
    }

    .inbox-v2-shell .inbox-list {
        max-height: 320px;
    }

    .inbox-v2-thread {
        min-height: 560px;
    }
}

@media(max-width: 720px) {
    .inbox-v2-toolbar,
    .handoff-controls,
    .human-reply-actions,
    .ai-reply-lock {
        align-items: stretch;
        flex-direction: column;
    }

    .inbox-v2-filters {
        grid-template-columns: 1fr;
    }

    .inbox-v2-search {
        grid-template-columns: 1fr;
    }

    .inbox-v2-shell .inbox-message {
        max-width: 92%;
    }
}
