:root {
    --bg: #f7f5ff;
    --surface: #ffffff;
    --surface-2: #f1edff;
    --surface-3: #fbfaff;
    --text: #17122f;
    --muted: #756c91;
    --line: #ddd5f3;
    --line-soft: #ede8fb;
    --green: #10a772;
    --red: #c24150;
    --blue: #7c3aed;
    --purple: #7c3aed;
    --purple-dark: #4c1d95;
    --purple-soft: #f1edff;
    --yellow: #ad7b05;
    --shadow-xs: 0 1px 2px rgba(76, 29, 149, 0.05);
    --shadow-sm: 0 10px 26px rgba(76, 29, 149, 0.08);
    --shadow-md: 0 22px 56px rgba(76, 29, 149, 0.14);
    --ease: 160ms ease;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

button,
.button-link,
.conversation-card,
.quick-action-grid a,
.integration-card,
.metric-card {
    transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease), background var(--ease), color var(--ease);
}

button:hover,
.button-link:hover,
.quick-action-grid a:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.app-shell * {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.app-shell *::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.app-shell *::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: #cbd5e1;
    background-clip: padding-box;
}

.app-shell *::-webkit-scrollbar-track {
    background: transparent;
}

button:disabled,
button.is-loading {
    cursor: not-allowed;
    opacity: 0.72;
}

.app-shell {
    display: grid;
    grid-template-columns: 216px 344px minmax(0, 1fr);
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
    background: var(--bg);
}

.page-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

.integrations-shell {
    grid-template-columns: 260px minmax(720px, 1fr);
}

.sidebar,
.inbox-panel,
.detail-panel {
    min-width: 0;
    padding: 16px;
}

.work-area {
    min-width: 0;
    padding: 26px;
}

.compact-sidebar {
    min-height: 100vh;
}

.sidebar {
    background: #0f172a;
    color: #fff;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.brand-mark,
.avatar {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: 8px;
    background: #2f80ed;
    color: #fff;
    font-weight: 800;
}

.avatar img {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
}

.app-shell .brand-mark,
.app-shell .avatar {
    width: 36px;
    height: 36px;
}

.brand span,
.channel-card span,
.eyebrow,
.preview,
.metric-grid span,
.detail-header span,
.message small {
    color: var(--muted);
}

.sidebar .brand span,
.sidebar .channel-card span {
    color: #b9c5d2;
}

.nav-list {
    display: grid;
    gap: 6px;
    margin-bottom: 20px;
}

.app-shell .nav-item {
    padding: 9px 10px;
    font-size: 14px;
}

.user-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: -14px 0 24px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
}

.user-strip span {
    overflow: hidden;
    color: #dce6f0;
    font-size: 13px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-strip a {
    color: #9ec5ff;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

.nav-item {
    color: #dce6f0;
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 8px;
}

.nav-item.active,
.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.app-shell .nav-item.active {
    box-shadow: inset 3px 0 0 #60a5fa;
}

.section-title,
.conversation-head,
.topbar,
.detail-header,
.ai-actions,
.reply-box div,
.inline-form {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-title {
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 800;
}

.channel-card {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 10px;
    position: relative;
    padding: 9px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.app-shell .integration-panel {
    margin-top: 18px;
}

.app-shell .integration-panel .section-title {
    margin-bottom: 8px;
}

.app-shell .channel-card h3 {
    margin-bottom: 2px;
    font-size: 14px;
}

.app-shell .channel-card span {
    display: none;
}

.setup-panel {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.stack-form {
    display: grid;
    gap: 9px;
}

.stack-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.stack-form input,
.stack-form select,
.stack-form textarea {
    width: 100%;
    min-height: 40px;
    padding: 0 10px;
}

.stack-form textarea {
    min-height: 78px;
    padding: 10px;
    resize: vertical;
}

.setup-panel .stack-form input,
.setup-panel .stack-form select,
.setup-panel .stack-form textarea {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.setup-panel .stack-form input::placeholder,
.setup-panel .stack-form textarea::placeholder {
    color: #aebdca;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #dce6f0;
    font-size: 13px;
    font-weight: 800;
}

.check-row input {
    width: 16px;
    min-height: 16px;
}

.setup-panel small {
    color: #b9c5d2;
    line-height: 1.35;
}

.channel-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 12px;
    font-weight: 900;
}

.channel-card strong,
.channel-card span {
    display: block;
}

.channel-card span {
    margin-top: 3px;
    font-size: 11px;
    line-height: 1.35;
}

.status {
    grid-column: 2;
    width: fit-content;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-style: normal;
    background: rgba(255, 255, 255, 0.12);
}

.status.connected,
.status.active {
    color: #9af3c6;
}

.status.needs_review {
    color: #ffd38a;
}

.status.disconnected {
    color: #f5a3aa;
}

.inbox-panel {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-height: 0;
    overflow: hidden;
    background: #ffffff;
    border-right: 1px solid var(--line-soft);
    box-shadow: 1px 0 0 rgba(15, 23, 42, 0.02);
}

.topbar {
    align-items: flex-start;
    margin-bottom: 12px;
}

.eyebrow {
    margin: 0 0 4px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    line-height: 1.1;
}

h1 {
    font-size: 24px;
    letter-spacing: 0;
}

h2 {
    font-size: 20px;
    letter-spacing: 0;
}

.topbar-actions,
.search-row,
.ai-actions {
    display: flex;
    gap: 6px;
}

.topbar-actions button {
    min-height: 34px;
    padding: 0 10px;
    font-size: 13px;
}

.app-shell #applyFilters {
    display: none;
}

button,
select,
input,
textarea {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
}

button {
    min-height: 38px;
    padding: 0 12px;
    font-weight: 750;
}

.button-link {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    background: var(--surface);
    font-weight: 800;
    text-decoration: none;
}

.primary-link {
    border-color: var(--blue);
    background: var(--blue);
    color: #fff;
}

.primary {
    border-color: var(--blue);
    background: var(--blue);
    color: #fff;
}

.ghost-button {
    min-height: 32px;
    background: transparent;
}

.icon-button {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.app-shell .metric-grid {
    display: none;
}

.metric-grid.wide {
    gap: 14px;
    margin-bottom: 20px;
}

.dashboard-metrics {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.metric-grid article {
    padding: 12px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: var(--surface);
}

.metric-grid span,
.metric-grid strong {
    display: block;
}

.metric-grid strong {
    margin-top: 5px;
    font-size: 20px;
}

.search-row,
.filter-row {
    margin-bottom: 8px;
}

.filter-row {
    display: none;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.filter-row select {
    color: var(--muted);
    font-size: 13px;
}

.search-row input {
    min-width: 0;
    flex: 1;
}

.search-row input,
.search-row select,
.filter-row select,
textarea {
    min-height: 38px;
    padding: 0 12px;
}

.app-shell .search-row {
    padding: 8px;
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    background: #f8fafc;
}

.app-shell .search-row input,
.app-shell .search-row select {
    border-color: transparent;
    background: transparent;
}

.toggle-filter {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 42px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.toggle-filter input {
    width: 16px;
    height: 16px;
}

.conversation-list {
    display: grid;
    gap: 4px;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 2px 16px 0;
}

.conversation-card {
    position: relative;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 10px;
    width: 100%;
    padding: 10px;
    text-align: left;
    border: 1px solid transparent;
    border-radius: 12px;
    background: var(--surface);
}

.conversation-card:hover {
    border-color: #d9e5f3;
    background: #f8fbff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-xs);
}

.conversation-card.active {
    border-color: #c8d9ff;
    background: #f5f8ff;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.08);
}

.conversation-card.active::before {
    content: "";
    position: absolute;
    inset: 9px auto 9px 0;
    width: 3px;
    border-radius: 999px;
    background: var(--blue);
}

.conversation-card.is-demo {
    border-style: dashed;
    background: #fffdf8;
}

.conversation-card.is-demo.active {
    border-color: #d9b76a;
    background: #fffdf7;
    box-shadow: 0 12px 28px rgba(173, 123, 5, 0.1);
}

.conversation-avatar {
    position: relative;
    background: color-mix(in srgb, var(--accent) 88%, #111827);
}

.conversation-avatar i {
    position: absolute;
    right: -3px;
    bottom: -3px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border: 2px solid var(--surface);
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 8px;
    font-style: normal;
    font-weight: 900;
    line-height: 14px;
    text-align: center;
}

.conversation-main,
.conversation-main span {
    display: block;
    min-width: 0;
}

.conversation-head {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.conversation-head small {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.conversation-head strong {
    overflow: hidden;
    font-size: 13px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.subject {
    display: none !important;
}

.preview {
    overflow: hidden;
    margin-top: 4px;
    color: #5c6b7d;
    font-size: 12px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-tags {
    display: flex !important;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 5px;
}

.conversation-tags em:not(.demo-tag) {
    display: none;
}

.conversation-tags em,
.customer-tags span {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 11px;
    font-style: normal;
    font-weight: 900;
}

.conversation-tags .demo-tag,
.source-badge.demo {
    background: #fff7df;
    color: #9a6b00;
}

.source-badge.live {
    background: #e9fbf2;
    color: #0d8b61;
}

.source-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    margin-left: 8px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
    vertical-align: middle;
}

.conversation-tags .priority.high,
.customer-tags .priority.high {
    background: #fff1f2;
    color: var(--red);
}

.conversation-tags .priority.normal,
.customer-tags .priority.normal {
    background: #eef5ff;
    color: var(--blue);
}

.conversation-tags .priority.low,
.customer-tags .priority.low {
    background: #ecfdf5;
    color: var(--green);
}

.conversation-meta {
    display: grid;
    justify-items: end;
    gap: 5px;
}

.conversation-meta small {
    min-width: 30px;
    padding: 3px 6px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--accent) 16%, white);
    color: var(--accent);
    font-weight: 900;
}

.conversation-meta b {
    display: grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--red);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
}

.conversation-meta em {
    display: none;
}

.conversation-meta .high {
    color: var(--red);
}

.conversation-meta .normal {
    color: var(--muted);
}

.conversation-list.loading-list .conversation-card {
    opacity: 0.64;
    background: linear-gradient(90deg, #ffffff 25%, #f6f9fd 37%, #ffffff 63%);
    background-size: 400% 100%;
    animation: skeleton-pulse 1.25s ease-in-out infinite;
}

.detail-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 14px;
    height: 100vh;
    min-height: 0;
    overflow: hidden;
    background: var(--bg);
}

.detail-header,
.message-thread,
.typing-row,
.ai-panel,
.reply-box {
    grid-column: 1;
}

.detail-header {
    grid-row: 1;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    padding: 13px 14px;
    border: 1px solid var(--line-soft);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

.detail-header h2 {
    overflow: hidden;
    max-width: 100%;
    font-size: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-header #detailIntent {
    display: inline-block;
    overflow: hidden;
    max-width: 360px;
    color: var(--muted);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.message-thread {
    grid-row: 2;
}

.typing-row {
    grid-row: 3;
}

.ai-panel {
    grid-row: 3;
}

.reply-box {
    grid-row: 3;
}

.avatar.large {
    width: 44px;
    height: 44px;
    background: #0f766e;
}

.insight-strip {
    display: none;
    gap: 8px;
    flex-wrap: wrap;
}

.insight-strip span {
    padding: 7px 10px;
    border: 1px solid var(--line-soft);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    font-size: 13px;
}

.insight-strip strong {
    color: var(--text);
}

.action-panel,
.customer-card-panel,
.note-panel,
.task-panel {
    min-height: 0;
    padding: 12px;
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

.context-rail {
    grid-column: 2;
    grid-row: 1 / 4;
    display: grid;
    align-content: start;
    gap: 12px;
    min-height: 0;
    overflow: auto;
    padding-right: 2px;
}

.context-rail .customer-card-panel,
.context-rail .action-panel,
.context-rail .task-panel,
.context-rail .note-panel {
    box-shadow: var(--shadow-xs);
}

.app-shell .ai-panel {
    display: none;
}

.customer-card-panel .section-title small {
    padding: 4px 8px;
    border-radius: 999px;
    background: #ecfdf5;
    color: var(--green);
    font-size: 11px;
    font-weight: 900;
}

.app-shell .customer-card-panel {
    align-self: stretch;
    box-shadow: var(--shadow-xs);
}

.customer-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.customer-card-grid div {
    min-width: 0;
    padding: 10px 11px;
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    background: #fbfdff;
}

.customer-card-grid span {
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

.customer-card-grid strong {
    display: block;
    overflow: hidden;
    margin-top: 3px;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.customer-card-panel p {
    display: -webkit-box;
    overflow: hidden;
    margin: 10px 0 0;
    color: #475569;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.customer-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.app-shell .customer-tags {
    padding-top: 10px;
    border-top: 1px solid var(--line-soft);
}

.next-action-card {
    display: block;
    margin-top: 10px;
    padding: 11px;
    border: 1px solid #cfe0ff;
    border-radius: 12px;
    background: #f7fbff;
}

.next-action-card span {
    display: block;
    color: var(--blue);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.next-action-card strong {
    display: block;
    margin-top: 5px;
    color: #1e293b;
    font-size: 12px;
    line-height: 1.4;
}

.inline-form {
    display: grid;
    align-items: stretch;
    grid-template-columns: 1fr;
    gap: 8px;
}

.inline-form label {
    display: grid;
    flex: 1;
    gap: 5px;
    min-width: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.inline-form select {
    min-height: 36px;
    padding: 0 10px;
}

.action-panel small,
.note-panel small {
    display: block;
    min-height: 18px;
    margin-top: 8px;
    color: var(--muted);
}

.note-panel textarea {
    width: 100%;
    min-height: 72px;
    padding: 10px;
    resize: vertical;
}

.task-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
}

.task-form input {
    min-height: 36px;
    padding: 0 10px;
}

.task-list {
    display: grid;
    gap: 7px;
    margin-top: 8px;
    max-height: 112px;
    overflow: auto;
}

.task-list button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 36px;
    padding: 7px 9px;
    text-align: left;
    background: var(--surface);
}

.task-list span {
    font-weight: 800;
}

.task-list small {
    color: var(--muted);
}

.task-panel small {
    display: block;
    min-height: 18px;
    margin-top: 8px;
    color: var(--muted);
}

.message-thread {
    display: flex;
    flex-direction: column;
    gap: 9px;
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 18px;
    border: 1px solid var(--line-soft);
    border-radius: 16px;
    background:
        radial-gradient(circle at 18px 18px, rgba(37, 99, 235, 0.035) 0 2px, transparent 2px 18px),
        linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    scroll-behavior: smooth;
}

.date-separator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 2px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.date-separator::before,
.date-separator::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--line);
}

.date-separator span {
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--surface-2);
}

.message {
    position: relative;
    max-width: min(72%, 690px);
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 17px 17px 17px 7px;
    border-color: #e5edf6;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.035);
}

.message.agent {
    align-self: flex-end;
    border-color: #d3e1ff;
    border-radius: 17px 17px 7px 17px;
    background: #eaf2ff;
}

.message p {
    margin: 0 0 6px;
    line-height: 1.45;
}

.message small {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.message-error {
    display: block;
    margin-top: 6px;
    color: var(--red);
    font-size: 12px;
    font-style: normal;
    font-weight: 800;
    line-height: 1.35;
}

.retry-outbound {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    margin-top: 8px;
    padding: 0 10px;
    border: 1px solid #f1b9c0;
    border-radius: 8px;
    background: #fff5f6;
    color: var(--red);
    font-size: 12px;
    font-weight: 900;
}

.retry-outbound:disabled {
    cursor: wait;
    opacity: 0.7;
}

.ai-panel,
.reply-box {
    padding: 12px;
    border: 1px solid var(--line-soft);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: none;
}

.ai-panel {
    max-height: 118px;
    overflow: auto;
}

.ai-panel .ai-tone-tabs {
    display: none;
}

.ai-panel .ai-actions {
    margin-top: 8px;
}

.reply-box {
    position: sticky;
    bottom: 0;
    z-index: 5;
    box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.05);
}

.ai-panel p {
    display: -webkit-box;
    overflow: hidden;
    margin: 0;
    color: #44546a;
    font-size: 13px;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.ai-tone-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: -2px 0 12px;
}

.ai-tone-tabs button {
    min-height: 32px;
    padding: 0 10px;
    color: var(--muted);
    background: var(--surface);
    font-size: 12px;
}

.ai-tone-tabs button.active,
.ai-tone-tabs button:hover {
    border-color: #cfe0ff;
    background: #eef5ff;
    color: var(--blue);
}

.reply-box textarea {
    width: 100%;
    min-height: 82px;
    max-height: 138px;
    padding: 12px 13px;
    border-color: #dbe5f1;
    border-radius: 14px;
    background: #fbfdff;
    line-height: 1.45;
    resize: vertical;
}

.reply-box textarea:focus,
.note-panel textarea:focus,
.search-row input:focus,
select:focus,
input:focus {
    outline: 3px solid rgba(37, 99, 235, 0.12);
    border-color: var(--blue);
}

.reply-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.reply-toolbar strong {
    font-size: 15px;
}

.reply-toolbar span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.quick-replies button {
    min-height: 30px;
    padding: 0 9px;
    color: var(--blue);
    background: #eef5ff;
    border-color: #cfe0ff;
    font-size: 12px;
}

.quick-replies button:hover {
    background: #e5efff;
}

.reply-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
}

.reply-actions #trainAi {
    color: var(--muted);
    background: #f8fafc;
}

.reply-actions .primary {
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.16);
}

.reply-actions .primary {
    min-width: 120px;
}

.reply-box small {
    display: block;
    min-height: 18px;
    margin-top: 8px;
    color: var(--muted);
}

.typing-row {
    display: none;
    align-items: center;
    gap: 4px;
    min-height: 18px;
    padding-left: 4px;
}

.typing-row.is-visible {
    display: flex;
}

.typing-row span {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #9aa9ba;
    animation: typing-dot 1.2s ease-in-out infinite;
}

.typing-row span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-row span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes typing-dot {
    0%,
    70%,
    100% {
        opacity: 0.35;
        transform: translateY(0);
    }

    35% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

.auth-body {
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(440px, 100%);
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 18px 45px rgba(23, 32, 42, 0.08);
}

.auth-brand {
    margin-bottom: 18px;
    color: var(--text);
}

.auth-brand span {
    color: var(--muted);
}

.stack-form.light {
    margin-top: 18px;
}

.form-alert {
    padding: 10px 12px;
    border: 1px solid #f2bcc3;
    border-radius: 8px;
    background: #fff1f2;
    color: #b4232f;
    font-weight: 800;
}

.auth-hint {
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.table-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.table-card .section-title input {
    width: min(260px, 100%);
    min-height: 38px;
    padding: 0 10px;
}

.responsive-table {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

th,
td {
    padding: 13px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

td {
    color: var(--text);
}

td:first-child {
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-avatar {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border-radius: 8px;
    color: #fff;
    background: #0f766e;
    font-size: 12px;
    font-weight: 900;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.pill.high {
    color: var(--red);
    background: #fff1f2;
}

.pill.low {
    color: var(--green);
    background: #ecfdf5;
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.span-2 {
    grid-column: span 2;
}

.chart-card {
    min-height: 260px;
}

.bar-chart {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 12px;
    min-height: 210px;
    align-items: end;
}

.bar-item {
    display: grid;
    gap: 7px;
    justify-items: center;
    min-width: 0;
}

.bar-track {
    position: relative;
    display: flex;
    align-items: end;
    width: 100%;
    height: 140px;
    overflow: hidden;
    border-radius: 8px;
    background: var(--surface-2);
}

.bar-track span {
    display: block;
    width: 100%;
    border-radius: 8px 8px 0 0;
    background: linear-gradient(180deg, #60a5fa 0%, var(--blue) 100%);
}

.bar-item strong {
    font-size: 14px;
}

.bar-item small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
}

.progress-row,
.agent-row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(100px, 1.4fr) auto;
    gap: 10px;
    align-items: center;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
}

.agent-row {
    grid-template-columns: minmax(130px, 1fr) minmax(120px, 1.4fr) auto auto;
}

.progress-row:last-child,
.agent-row:last-child {
    border-bottom: 0;
}

.progress-row span,
.agent-row span,
.agent-row small {
    color: var(--muted);
    font-weight: 800;
}

.progress-row div,
.agent-row div {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-2);
}

.progress-row i,
.agent-row i {
    display: block;
    height: 100%;
    min-width: 6px;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--blue), #38bdf8);
}

.agent-row strong,
.progress-row strong {
    white-space: nowrap;
}

.customer-insight-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.crm-customer-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.crm-customer-card header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
}

.crm-customer-card header strong,
.crm-customer-card header small {
    display: block;
}

.crm-customer-card header small {
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-customer-card header b {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border: 1px solid #cfe0ff;
    border-radius: 999px;
    background: #eef5ff;
    color: var(--blue);
    font-size: 14px;
}

.customer-summary {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
}

.customer-summary span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.customer-summary p {
    margin: 0;
    line-height: 1.45;
}

.customer-mini-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.customer-mini-stats span {
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-3);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.customer-mini-stats strong {
    display: block;
    overflow: hidden;
    color: var(--text);
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-reply-details {
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.ai-reply-details summary {
    cursor: pointer;
    padding: 11px 12px;
    font-weight: 900;
}

.ai-reply-details p {
    margin: 0;
    padding: 10px 12px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    line-height: 1.45;
}

.integration-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.integrations-shell .work-area {
    background: var(--bg);
}

.setup-flow {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.setup-flow span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.setup-flow strong {
    display: block;
    margin-top: 5px;
}

.integration-card,
.webhook-box {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.webhook-box {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    margin-bottom: 18px;
}

.webhook-box span {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.webhook-box code {
    overflow-x: auto;
    padding: 11px;
    border-radius: 8px;
    background: var(--surface-2);
}

.copy-button {
    min-height: 38px;
    white-space: nowrap;
}

.integration-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.integration-head h2 {
    margin: 0;
    font-size: 18px;
}

.integration-head span {
    color: var(--muted);
    font-size: 13px;
}

.health-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.health-list span {
    min-height: 28px;
    padding: 6px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.health-list .ok {
    color: var(--green);
    background: #ecfdf5;
}

.health-list .warn {
    color: var(--yellow);
    background: #fffbeb;
}

.integration-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.setup-guide {
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
}

.setup-guide summary {
    cursor: pointer;
    padding: 12px;
    font-weight: 900;
}

.setup-guide[open] summary {
    border-bottom: 1px solid var(--line);
}

.copy-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 12px;
}

.copy-row span {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.copy-row code {
    overflow-x: auto;
    padding: 10px;
    border-radius: 8px;
    background: var(--surface-2);
}

.guide-fields {
    padding: 0 12px;
}

.guide-fields p {
    margin: 0 0 8px;
    color: var(--muted);
    line-height: 1.45;
}

.guide-fields strong {
    color: var(--text);
}

.permission-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 12px 0;
}

.permission-list span {
    padding: 5px 8px;
    border-radius: 999px;
    color: var(--blue);
    background: #eef5ff;
    font-size: 12px;
    font-weight: 900;
}

.setup-guide ol {
    margin: 12px;
    padding-left: 22px;
}

.setup-guide li {
    margin-bottom: 8px;
    color: var(--text);
    line-height: 1.4;
}

.doc-link {
    display: inline-flex;
    align-items: center;
    margin: 0 12px 12px;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--blue);
    font-weight: 900;
    text-decoration: none;
    background: var(--surface);
}

.integration-notice,
.event-error,
.empty-state {
    color: var(--muted);
}

.empty-state {
    display: grid;
    place-items: center;
    min-height: 180px;
    padding: 28px;
    border: 1px dashed #cbd8e8;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
    text-align: center;
    line-height: 1.5;
}

.empty-state strong {
    color: var(--text);
}

.empty-state span {
    max-width: 280px;
}

.skeleton,
.is-loading::after {
    background: linear-gradient(90deg, #eef3f8 25%, #f8fafc 37%, #eef3f8 63%);
    background-size: 400% 100%;
    animation: skeleton-pulse 1.25s ease-in-out infinite;
}

.skeleton {
    min-height: 16px;
    border-radius: 8px;
}

@keyframes skeleton-pulse {
    0% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0 50%;
    }
}

.toast-root {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1000;
    display: grid;
    gap: 10px;
    width: min(360px, calc(100vw - 32px));
}

.toast {
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    background: var(--surface);
    box-shadow: var(--shadow-md);
    font-weight: 800;
    line-height: 1.35;
    animation: toast-in 180ms ease both;
}

.toast.success {
    border-color: rgba(15, 159, 110, 0.35);
    background: #ecfdf5;
    color: #047857;
}

.toast.error {
    border-color: rgba(194, 65, 80, 0.35);
    background: #fff1f2;
    color: var(--red);
}

.toast.leaving {
    animation: toast-out 180ms ease both;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateY(8px);
    }
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(15, 23, 42, 0.46);
}

.modal-card {
    width: min(560px, 100%);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.modal-card header,
.modal-card footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}

.modal-card footer {
    justify-content: flex-end;
    border-top: 1px solid var(--line);
    border-bottom: 0;
}

.modal-body {
    padding: 18px;
}

.event-error {
    display: block;
    margin: -6px 0 10px;
}

.outbound-card {
    margin-top: 18px;
}

.events-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.team-grid {
    grid-template-columns: minmax(280px, 0.8fr) minmax(420px, 1.2fr);
}

.settings-grid {
    display: grid;
    grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
    gap: 14px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    gap: 14px;
}

.quick-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.quick-action-grid a {
    display: flex;
    align-items: center;
    min-height: 54px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    background: #fbfcfe;
    font-weight: 900;
    text-decoration: none;
}

.quick-action-grid a:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.light-check {
    display: flex;
    color: var(--text);
}

.quick-reply-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.quick-reply-list article {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
}

.quick-reply-list strong {
    display: block;
    margin-bottom: 6px;
}

.quick-reply-list p {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.team-management-list {
    display: grid;
    gap: 10px;
}

.team-member-card {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) 150px 130px auto;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
}

.team-member-card strong,
.team-member-card span {
    display: block;
}

.team-member-card span {
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.team-member-card select {
    min-height: 38px;
    padding: 0 10px;
}

.compact-table {
    min-width: 520px;
}

.report-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.report-row:last-child {
    border-bottom: 0;
}

.report-row span {
    color: var(--muted);
}

.report-row strong {
    font-size: 20px;
}

@media (max-width: 1320px) {
    .detail-panel {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(0, 1fr) auto;
    }

    .context-rail {
        display: none;
    }
}

@media (max-width: 1180px) {
    .app-shell {
        grid-template-columns: 210px 330px minmax(420px, 1fr);
    }

    .page-shell {
        grid-template-columns: 240px 1fr;
    }

    .integrations-shell {
        grid-template-columns: 230px minmax(0, 1fr);
    }

    .report-grid,
    .integration-grid,
    .setup-flow,
    .events-grid,
    .team-grid,
    .settings-grid,
    .dashboard-grid,
    .customer-insight-grid,
    .dashboard-metrics {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: auto;
    }

    .detail-panel {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(0, 1fr) auto;
    }

    .context-rail,
    .customer-card-panel,
    .action-panel,
    .task-panel,
    .note-panel {
        display: none;
    }
}

@media (max-width: 760px) {
    .app-shell {
        display: block;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .page-shell {
        display: block;
    }

    .integrations-shell {
        display: block;
    }

    .sidebar,
    .inbox-panel,
    .detail-panel,
    .work-area {
        padding: 16px;
    }

    .sidebar,
    .inbox-panel,
    .detail-panel {
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .inbox-panel {
        border-right: 0;
        border-bottom: 1px solid var(--line-soft);
    }

    .detail-panel {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(420px, 58vh) auto;
        background: var(--surface);
    }

    .context-rail {
        display: none;
    }

    .compact-sidebar {
        min-height: 0;
    }

    .metric-grid,
    .quick-action-grid,
    .customer-card-grid,
    .progress-row,
    .agent-row {
        grid-template-columns: 1fr;
    }

    .filter-row {
        grid-template-columns: 1fr;
    }

    .conversation-card {
        grid-template-columns: 42px minmax(0, 1fr) auto;
    }

    .conversation-list {
        max-height: 55vh;
    }

    .message-thread {
        min-height: 0;
    }

    .message {
        max-width: 92%;
    }

    .ai-panel {
        max-height: none;
    }

    .bar-chart {
        gap: 8px;
    }

    .customer-mini-stats {
        grid-template-columns: 1fr;
    }

    .team-member-card {
        grid-template-columns: 1fr;
    }

    .topbar,
    .detail-header,
    .search-row,
    .inline-form,
    .task-form {
        align-items: stretch;
        flex-direction: column;
    }

    .task-form {
        display: flex;
    }

    .reply-toolbar,
    .reply-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .conversation-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }

    .conversation-meta {
        justify-items: start;
    }

    .message {
        max-width: 100%;
    }

    .toast-root {
        right: 16px;
        bottom: 16px;
        left: 16px;
        width: auto;
    }
}

/* NovaCRM purple SaaS refresh */
body {
    background:
        radial-gradient(circle at top left, rgba(124, 58, 237, 0.12), transparent 34vw),
        linear-gradient(180deg, #fbfaff 0%, var(--bg) 100%);
}

button,
.button-link,
input,
select,
textarea {
    border-radius: 12px;
}

button,
.button-link {
    min-height: 40px;
    border-color: #e5def7;
    color: #302454;
    background: #ffffff;
    font-weight: 800;
}

button:hover,
.button-link:hover {
    border-color: #c4b5fd;
    background: #faf7ff;
    box-shadow: 0 10px 22px rgba(124, 58, 237, 0.1);
}

.primary,
.primary-link,
.reply-actions .primary {
    border-color: transparent;
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    color: #fff;
    box-shadow: 0 12px 24px rgba(109, 40, 217, 0.22);
}

.primary:hover,
.primary-link:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    color: #fff;
}

.sidebar {
    background:
        radial-gradient(circle at 20% 0%, rgba(196, 181, 253, 0.2), transparent 34%),
        linear-gradient(180deg, #2e1065 0%, #160a38 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
    margin-bottom: 16px;
}

.brand-mark,
.avatar {
    border-radius: 14px;
    background: linear-gradient(135deg, #a78bfa 0%, #6d28d9 100%);
    box-shadow: 0 10px 24px rgba(109, 40, 217, 0.26);
}

.user-strip {
    margin: 0 0 18px;
    border-color: rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
}

.nav-list {
    gap: 4px;
}

.nav-item {
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 14px;
    font-weight: 750;
}

.nav-item.active,
.nav-item:hover,
.app-shell .nav-item.active {
    background: rgba(255, 255, 255, 0.13);
    color: #fff;
    box-shadow: inset 3px 0 0 #c4b5fd;
}

.app-shell {
    grid-template-columns: 220px 336px minmax(0, 1fr);
    background: transparent;
}

.page-shell {
    grid-template-columns: 244px minmax(0, 1fr);
    background: transparent;
}

.integrations-shell {
    grid-template-columns: 244px minmax(0, 1fr);
}

.sidebar,
.inbox-panel,
.detail-panel {
    padding: 18px;
}

.work-area {
    padding: 28px;
}

.app-shell .integration-panel {
    display: none;
}

.inbox-panel {
    background: rgba(255, 255, 255, 0.86);
    border-right: 1px solid #eee7fb;
    backdrop-filter: blur(18px);
}

.topbar {
    align-items: center;
    margin-bottom: 16px;
}

.eyebrow {
    color: #8b7bad;
    font-size: 10px;
}

h1 {
    font-size: 26px;
    font-weight: 850;
}

h2 {
    font-size: 21px;
    font-weight: 850;
}

.app-shell .topbar-actions #applyFilters,
.app-shell .topbar-actions #focusReply,
.app-shell .metric-grid,
.app-shell .filter-row,
.app-shell .context-rail,
.app-shell .insight-strip,
.app-shell .ai-panel {
    display: none;
}

.app-shell .topbar-actions {
    flex: 0 0 auto;
}

.app-shell .topbar-actions button {
    min-height: 38px;
    padding: 0 12px;
}

.app-shell .search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 10px 12px;
    border-color: #ede7fb;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: var(--shadow-xs);
}

.app-shell .search-row select {
    display: none;
}

.conversation-list {
    gap: 8px;
    padding-right: 4px;
}

.conversation-card {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 11px;
    padding: 12px;
    border-color: #eee7fb;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(76, 29, 149, 0.04);
}

.conversation-card:hover {
    border-color: #d8ccfb;
    background: #fdfbff;
}

.conversation-card.active {
    border-color: #a78bfa;
    background: linear-gradient(180deg, #ffffff 0%, #f8f5ff 100%);
    box-shadow: 0 14px 30px rgba(124, 58, 237, 0.13);
}

.conversation-card.active::before {
    inset: 12px auto 12px 0;
    background: #7c3aed;
}

.conversation-card.is-demo {
    border-color: #eee7fb;
    border-style: solid;
    background: #fff;
    opacity: 0.78;
}

.conversation-head strong {
    font-size: 14px;
    color: #191033;
}

.preview {
    color: #756c91;
    font-size: 12px;
}

.conversation-tags {
    margin-top: 6px;
}

.conversation-tags .demo-tag {
    background: #f5efff;
    color: #7c3aed;
}

.conversation-meta small {
    min-width: 32px;
    border-radius: 10px;
    background: #f1edff;
    color: #6d28d9;
}

.conversation-meta b {
    background: #7c3aed;
}

.detail-panel {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 14px;
    background: transparent;
}

.detail-header {
    border-color: #eee7fb;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 30px rgba(76, 29, 149, 0.07);
}

.detail-header .icon-button {
    background: #f6f1ff;
    color: #6d28d9;
}

.source-badge.live,
.customer-card-panel .section-title small {
    background: #ecfdf5;
    color: #0f9f6e;
}

.source-badge.demo {
    background: #f5efff;
    color: #7c3aed;
}

.message-thread {
    border-color: #eee7fb;
    border-radius: 22px;
    background:
        radial-gradient(circle at 16px 16px, rgba(124, 58, 237, 0.045) 0 2px, transparent 2px 20px),
        linear-gradient(180deg, #ffffff 0%, #fbf9ff 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.date-separator {
    color: #8b7bad;
}

.date-separator span {
    background: #f3efff;
}

.message {
    max-width: min(68%, 700px);
    border-color: #eee7fb;
    border-radius: 18px 18px 18px 8px;
    color: #20183c;
    background: #fff;
    box-shadow: 0 8px 18px rgba(76, 29, 149, 0.06);
}

.message.agent {
    border-color: #d8ccfb;
    border-radius: 18px 18px 8px 18px;
    background: linear-gradient(135deg, #f4efff 0%, #ebe4ff 100%);
}

.reply-box {
    border-color: #eee7fb;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -14px 34px rgba(76, 29, 149, 0.08);
}

.reply-toolbar strong {
    color: #191033;
}

.reply-toolbar span {
    display: none;
}

.quick-replies {
    gap: 8px;
}

.quick-replies button {
    min-height: 32px;
    border-color: #e6dcff;
    border-radius: 999px;
    background: #f5f0ff;
    color: #6d28d9;
}

.reply-box textarea,
.note-panel textarea,
input,
select,
textarea {
    border-color: #e5def7;
    background: #fff;
}

.reply-box textarea {
    min-height: 74px;
    border-radius: 18px;
    background: #fbfaff;
}

.reply-actions #trainAi {
    display: none;
}

.reply-actions {
    justify-content: flex-end;
}

.reply-actions .primary {
    min-width: 132px;
    border-radius: 14px;
}

.table-card,
.integration-card,
.webhook-box,
.setup-flow,
.crm-customer-card,
.auth-card,
.modal-card,
.quick-reply-list article,
.team-member-card,
.customer-summary,
.customer-mini-stats span {
    border-color: #eee7fb;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 28px rgba(76, 29, 149, 0.06);
}

.metric-grid {
    gap: 12px;
}

.metric-grid article {
    border-color: #eee7fb;
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #fbf9ff 100%);
    box-shadow: var(--shadow-xs);
}

.metric-grid strong {
    color: #26164f;
}

.dashboard-grid,
.report-grid,
.integration-grid,
.customer-insight-grid,
.settings-grid,
.team-grid,
.events-grid {
    gap: 16px;
}

.bar-track,
.progress-row div,
.agent-row div {
    background: #f0eaff;
}

.bar-track span,
.progress-row i,
.agent-row i {
    background: linear-gradient(180deg, #a78bfa 0%, #7c3aed 100%);
}

.progress-row i,
.agent-row i {
    background: linear-gradient(90deg, #8b5cf6, #c084fc);
}

.quick-action-grid a {
    border-color: #eee7fb;
    border-radius: 16px;
    background: #fff;
}

.quick-action-grid a:hover {
    border-color: #c4b5fd;
    color: #6d28d9;
}

.health-list .ok,
.status.connected,
.status.active {
    color: #0f9f6e;
}

.health-list .warn,
.status.needs_review {
    color: #9a6b00;
}

.permission-list span,
.pill,
.customer-tags span {
    background: #f3efff;
    color: #6d28d9;
}

.webhook-box code,
.copy-row code,
.payload-detail pre {
    border-radius: 14px;
}

.empty-state {
    border-color: #d8ccfb;
    border-radius: 20px;
    background: linear-gradient(180deg, #fff 0%, #fbf9ff 100%);
}

.toast,
.modal-card {
    border-radius: 18px;
}

.auth-body {
    background:
        radial-gradient(circle at top, rgba(124, 58, 237, 0.18), transparent 36vw),
        linear-gradient(180deg, #fbfaff 0%, #f3efff 100%);
}

.auth-card {
    border-radius: 24px;
    box-shadow: 0 26px 70px rgba(76, 29, 149, 0.14);
}

.auth-card .brand-mark {
    border-radius: 16px;
}

@media (max-width: 1180px) {
    .app-shell {
        grid-template-columns: 208px 320px minmax(0, 1fr);
    }
}

@media (max-width: 760px) {
    .sidebar {
        border-radius: 0 0 24px 24px;
    }

    .app-shell .topbar-actions {
        display: none;
    }

    .conversation-list {
        max-height: 46vh;
    }

    .message {
        max-width: 96%;
    }

    .reply-box {
        position: sticky;
        bottom: 12px;
    }
}

/* Inbox composition inspired by modern support suites */
.app-shell {
    grid-template-columns: 236px 420px minmax(0, 1fr);
    gap: 0;
    background: #f8f6ff;
}

.app-shell .sidebar {
    padding: 20px 14px;
    background:
        radial-gradient(circle at 18% 4%, rgba(96, 165, 250, 0.22), transparent 26%),
        radial-gradient(circle at 80% 42%, rgba(124, 58, 237, 0.22), transparent 34%),
        linear-gradient(180deg, #06152f 0%, #081126 58%, #06101f 100%);
}

.app-shell .brand {
    padding: 2px 8px 14px;
}

.app-shell .brand strong {
    font-size: 18px;
}

.app-shell .brand span {
    color: rgba(255, 255, 255, 0.62);
}

.app-shell .user-strip {
    min-height: 58px;
    margin: 0 4px 22px;
    padding: 11px 12px;
    border: 0;
    background: rgba(255, 255, 255, 0.09);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.app-shell .nav-item {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 10px;
}

.app-shell .nav-item.active,
.app-shell .nav-item:hover {
    background: linear-gradient(135deg, rgba(67, 56, 202, 0.92), rgba(79, 70, 229, 0.92));
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.18);
}

.app-shell .integration-panel {
    display: block;
    margin: 22px 4px 0;
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.app-shell .integration-panel .section-title {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.app-shell .integration-panel .icon-button {
    width: 26px;
    height: 26px;
    min-height: 26px;
    border-color: rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.app-shell .channel-card {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px 4px;
    border-top-color: rgba(255, 255, 255, 0.08);
}

.app-shell .channel-card span {
    display: none;
}

.app-shell .channel-card strong {
    overflow: hidden;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-shell .channel-icon {
    width: 31px;
    height: 31px;
    border-radius: 10px;
    font-size: 10px;
}

.app-shell .status {
    grid-column: auto;
    min-width: 24px;
    padding: 3px 7px;
    color: rgba(255, 255, 255, 0.76);
    background: rgba(255, 255, 255, 0.14);
    font-size: 0;
}

.app-shell .status::before {
    content: "";
    display: block;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: currentColor;
}

.app-shell .status.connected::before,
.app-shell .status.active::before {
    background: #22c55e;
}

.app-shell .status.needs_review::before {
    background: #f59e0b;
}

.app-shell .status.disconnected::before {
    background: #ef4444;
}

.app-shell .inbox-panel {
    padding: 18px 14px;
    background: #ffffff;
    border-right: 1px solid #e8e2f6;
}

.app-shell .topbar {
    min-height: 52px;
    margin-bottom: 14px;
}

.app-shell .topbar .eyebrow {
    display: none;
}

.app-shell .topbar h1 {
    font-size: 21px;
}

.app-shell .topbar-actions button {
    min-height: 38px;
}

.app-shell #refreshInbox {
    width: 42px;
    padding: 0;
    overflow: hidden;
    color: transparent;
}

.app-shell #refreshInbox::before {
    content: "↻";
    color: #4f46e5;
    font-size: 18px;
}

.app-shell #focusReply {
    display: inline-flex;
    min-width: 104px;
    justify-content: center;
}

.app-shell .search-row {
    position: relative;
    margin-bottom: 14px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.app-shell .search-row::before {
    content: "⌕";
    position: absolute;
    left: 14px;
    top: 50%;
    color: #8b7bad;
    transform: translateY(-50%);
}

.app-shell .search-row input {
    min-height: 44px;
    padding-left: 38px;
    border-color: #e8e2f6;
    border-radius: 14px;
    background: #fbfaff;
}

.app-shell .conversation-list {
    gap: 8px;
}

.app-shell .conversation-card {
    min-height: 84px;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    padding: 12px;
    border-radius: 14px;
    border-color: #eee8fb;
}

.app-shell .conversation-card.active {
    border-color: #6366f1;
    background: #f7f5ff;
    box-shadow: 0 14px 28px rgba(79, 70, 229, 0.13);
}

.app-shell .conversation-avatar,
.app-shell .avatar.large {
    width: 42px;
    height: 42px;
    border-radius: 999px;
}

.app-shell .conversation-avatar i {
    right: -4px;
    bottom: -4px;
    border-color: #fff;
}

.app-shell .conversation-head strong {
    font-size: 14px;
}

.app-shell .preview {
    max-width: 100%;
    margin-top: 5px;
    color: #6d6387;
}

.app-shell .conversation-tags {
    display: none !important;
}

.app-shell .conversation-meta {
    align-content: space-between;
}

.app-shell .conversation-meta small {
    min-width: 36px;
    background: #f1edff;
}

.app-shell .detail-panel {
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 0;
    padding: 0;
    background: #ffffff;
}

.app-shell .detail-header {
    grid-row: 1;
    min-height: 94px;
    margin: 0;
    padding: 22px 24px 16px;
    border-width: 0 0 1px;
    border-radius: 0;
    box-shadow: none;
}

.app-shell .detail-header h2 {
    font-size: 20px;
}

.app-shell .detail-header #detailIntent {
    max-width: 520px;
}

.app-shell .detail-header .icon-button {
    width: 38px;
    height: 38px;
    border-color: #e8e2f6;
}

.detail-tabs {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    align-items: center;
    gap: 22px;
    min-height: 48px;
    padding: 0 24px;
    border-bottom: 1px solid #e8e2f6;
    background: #fff;
}

.detail-tabs button {
    position: relative;
    min-height: 48px;
    padding: 0;
    border: 0;
    border-radius: 0;
    color: #62577d;
    background: transparent;
    box-shadow: none;
    font-size: 13px;
    font-weight: 850;
}

.detail-tabs button:hover {
    color: #4f46e5;
    background: transparent;
    box-shadow: none;
    transform: none;
}

.detail-tabs button.active {
    color: #4f46e5;
}

.detail-tabs button.active::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 999px 999px 0 0;
    background: #4f46e5;
}

.app-shell .message-thread {
    grid-row: 3;
    margin: 0;
    padding: 22px 24px;
    border: 0;
    border-radius: 0;
    background:
        linear-gradient(#e8e2f6 1px, transparent 1px) center 78px / 100% 1px no-repeat,
        #ffffff;
    box-shadow: none;
}

.app-shell .message {
    max-width: min(58%, 560px);
    padding: 12px 14px;
    border-color: #e8e2f6;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(32, 24, 60, 0.05);
}

.app-shell .message.agent {
    border-color: #c7d2fe;
    background: #eef2ff;
}

.app-shell .date-separator {
    margin: 10px 0 8px;
}

.app-shell .date-separator span {
    background: #fff;
}

.app-shell .reply-box {
    grid-row: 4;
    position: static;
    margin: 0;
    padding: 14px 24px 20px;
    border-width: 1px 0 0;
    border-radius: 0;
    background: #ffffff;
    box-shadow: 0 -10px 28px rgba(24, 14, 54, 0.045);
}

.app-shell .reply-toolbar,
.app-shell .quick-replies {
    display: none;
}

.app-shell .reply-box textarea {
    min-height: 66px;
    max-height: 130px;
    border-color: #e8e2f6;
    border-radius: 14px;
    background: #fff;
}

.composer-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.composer-tools button {
    min-height: 32px;
    padding: 0 9px;
    border: 0;
    color: #62577d;
    background: transparent;
    box-shadow: none;
    font-size: 12px;
}

.composer-tools button:hover {
    color: #4f46e5;
    background: #f3efff;
    box-shadow: none;
}

.app-shell .reply-actions {
    align-items: center;
    justify-content: flex-end;
    margin-top: -32px;
}

.app-shell .reply-actions .primary {
    min-width: 92px;
    min-height: 38px;
    border-radius: 10px;
}

.app-shell .reply-box small {
    margin-top: 8px;
}

@media (max-width: 1240px) {
    .app-shell {
        grid-template-columns: 220px 360px minmax(0, 1fr);
    }

    .app-shell .message {
        max-width: 72%;
    }
}

@media (max-width: 920px) {
    .app-shell {
        display: block;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .app-shell .sidebar,
    .app-shell .inbox-panel,
    .app-shell .detail-panel {
        height: auto;
        min-height: 0;
    }

    .app-shell .integration-panel {
        display: none;
    }

    .detail-tabs {
        overflow-x: auto;
    }

    .app-shell .message-thread {
        min-height: 420px;
    }

    .app-shell .reply-actions {
        margin-top: 10px;
    }
}

/* Make every inner page use the same shell language as Inbox */
.page-shell {
    grid-template-columns: 236px minmax(0, 1fr);
    min-height: 100vh;
    background: #f8f6ff;
}

.page-shell.integrations-shell {
    grid-template-columns: 236px minmax(0, 1fr);
}

.page-shell .sidebar {
    min-height: 100vh;
    padding: 20px 14px;
    background:
        radial-gradient(circle at 18% 4%, rgba(96, 165, 250, 0.22), transparent 26%),
        radial-gradient(circle at 80% 42%, rgba(124, 58, 237, 0.22), transparent 34%),
        linear-gradient(180deg, #06152f 0%, #081126 58%, #06101f 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
}

.page-shell .brand {
    gap: 12px;
    margin-bottom: 16px;
    padding: 2px 8px 14px;
}

.page-shell .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
}

.page-shell .brand strong {
    color: #fff;
    font-size: 18px;
    line-height: 1.05;
}

.page-shell .brand span {
    color: rgba(255, 255, 255, 0.62);
}

.page-shell .user-strip {
    min-height: 58px;
    margin: 0 4px 22px;
    padding: 11px 12px;
    border: 0;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.09);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.page-shell .user-strip span {
    color: rgba(255, 255, 255, 0.9);
}

.page-shell .user-strip a {
    color: #bfdbfe;
}

.page-shell .nav-list {
    gap: 4px;
}

.page-shell .nav-item {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 14px;
    font-weight: 750;
}

.page-shell .nav-item.active,
.page-shell .nav-item:hover {
    background: linear-gradient(135deg, rgba(67, 56, 202, 0.92), rgba(79, 70, 229, 0.92));
    color: #fff;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.18);
}

.page-shell .work-area {
    min-height: 100vh;
    padding: 28px 32px;
    background:
        radial-gradient(circle at 100% 0%, rgba(124, 58, 237, 0.08), transparent 30vw),
        #fbfaff;
}

.page-shell .topbar {
    min-height: 58px;
    margin-bottom: 18px;
}

.page-shell .topbar h1 {
    color: #17122f;
    font-size: 26px;
}

.page-shell .topbar-actions {
    gap: 10px;
}

.page-shell .button-link,
.page-shell .topbar-actions button {
    border-radius: 14px;
}

.page-shell .metric-grid article,
.page-shell .table-card,
.page-shell .integration-card,
.page-shell .webhook-box,
.page-shell .setup-flow,
.page-shell .crm-customer-card,
.page-shell .team-member-card {
    border: 1px solid #e8e2f6;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(76, 29, 149, 0.055);
}

.page-shell .metric-grid article {
    min-height: 104px;
    padding: 16px;
}

.page-shell .metric-grid span {
    color: #756c91;
    font-size: 14px;
    font-weight: 700;
}

.page-shell .metric-grid strong {
    margin-top: 10px;
    color: #17122f;
    font-size: 25px;
}

.page-shell .dashboard-grid,
.page-shell .report-grid,
.page-shell .integration-grid,
.page-shell .customer-insight-grid,
.page-shell .settings-grid,
.page-shell .team-grid,
.page-shell .events-grid {
    gap: 18px;
}

.page-shell .section-title {
    color: #17122f;
    font-size: 15px;
}

.page-shell .bar-track {
    border-radius: 12px;
    background: #f0eaff;
}

.page-shell .bar-track span {
    border-radius: inherit;
    background: linear-gradient(180deg, #a78bfa 0%, #7c3aed 100%);
}

.page-shell .progress-row,
.page-shell .agent-row,
.page-shell .report-row {
    border-color: #e8e2f6;
}

.page-shell .progress-row i,
.page-shell .agent-row i {
    background: linear-gradient(90deg, #8b5cf6, #c084fc);
}

.page-shell .quick-action-grid a {
    border-color: #e8e2f6;
    border-radius: 14px;
}

.page-shell .quick-action-grid a:hover {
    border-color: #a78bfa;
}

.page-shell input,
.page-shell select,
.page-shell textarea {
    border-color: #e8e2f6;
    border-radius: 14px;
}

.page-shell .responsive-table {
    border-radius: 14px;
}

@media (max-width: 920px) {
    .page-shell,
    .page-shell.integrations-shell {
        display: block;
    }

    .page-shell .sidebar {
        min-height: 0;
        border-radius: 0 0 24px 24px;
    }

    .page-shell .work-area {
        min-height: 0;
        padding: 20px;
    }
}

/* Inner page density and dashboard polish */
.page-shell .work-area {
    overflow-x: hidden;
}

.page-shell .eyebrow {
    color: #8b73c9;
    font-size: 11px;
    letter-spacing: 0;
    text-transform: uppercase;
}

.page-shell .topbar {
    align-items: flex-start;
    border-bottom: 0;
}

.page-shell .topbar h1 {
    margin-top: 3px;
    letter-spacing: 0;
}

.page-shell .button-link,
.page-shell .topbar-actions button,
.page-shell button {
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.page-shell .button-link:hover,
.page-shell .topbar-actions button:hover,
.page-shell button:hover {
    transform: translateY(-1px);
}

.page-shell .primary-link,
.page-shell button.primary,
.page-shell .topbar-actions .primary-link {
    border: 0;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: #fff;
    box-shadow: 0 12px 26px rgba(124, 58, 237, 0.2);
}

.page-shell .metric-grid.dashboard-metrics {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.page-shell .metric-grid.wide {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.page-shell .metric-grid.dashboard-metrics article,
.page-shell .metric-grid.wide article {
    min-height: 86px;
    padding: 14px 16px;
}

.page-shell .metric-grid.dashboard-metrics span,
.page-shell .metric-grid.wide span {
    max-width: 130px;
    color: #756c91;
    font-size: 12px;
    line-height: 1.25;
}

.page-shell .metric-grid.dashboard-metrics strong,
.page-shell .metric-grid.wide strong {
    margin-top: 8px;
    font-size: 24px;
    letter-spacing: 0;
}

.page-shell .dashboard-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: stretch;
}

.page-shell .dashboard-grid > .span-2 {
    grid-column: span 12;
}

.page-shell .dashboard-grid > .table-card:not(.span-2) {
    grid-column: span 6;
}

.page-shell .report-grid,
.page-shell .settings-grid,
.page-shell .team-grid,
.page-shell .customer-insight-grid,
.page-shell .integration-grid,
.page-shell .events-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
}

.page-shell .report-grid > .table-card,
.page-shell .settings-grid > .table-card,
.page-shell .team-grid > .table-card,
.page-shell .customer-insight-grid > .crm-customer-card,
.page-shell .integration-grid > .integration-card,
.page-shell .events-grid > .webhook-box {
    grid-column: span 6;
}

.page-shell .report-grid > .span-2,
.page-shell .settings-grid > .span-2,
.page-shell .team-grid > .span-2 {
    grid-column: span 12;
}

.page-shell .table-card,
.page-shell .integration-card,
.page-shell .crm-customer-card,
.page-shell .team-member-card {
    position: relative;
    overflow: hidden;
}

.page-shell .table-card::before,
.page-shell .integration-card::before,
.page-shell .crm-customer-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, rgba(124, 58, 237, 0.72), rgba(192, 132, 252, 0.18), transparent);
    opacity: 0;
    transition: opacity 0.18s ease;
}

.page-shell .table-card:hover::before,
.page-shell .integration-card:hover::before,
.page-shell .crm-customer-card:hover::before {
    opacity: 1;
}

.page-shell .chart-card {
    min-height: 0;
    padding: 18px;
}

.page-shell .bar-chart {
    min-height: 0;
    align-items: end;
    gap: 12px;
    padding: 18px 4px 0;
}

.page-shell .weekly-chart .bar-item {
    min-width: 0;
}

.page-shell .weekly-chart .bar-track {
    height: 132px;
}

.page-shell .bar-item strong {
    margin-top: 9px;
    color: #21163f;
    font-size: 13px;
}

.page-shell .bar-item small {
    color: #82769f;
    font-size: 11px;
}

.page-shell .progress-row,
.page-shell .agent-row,
.page-shell .report-row {
    min-height: 42px;
    gap: 12px;
    padding: 10px 0;
}

.page-shell .progress-row span,
.page-shell .agent-row span,
.page-shell .report-row span {
    color: #5f5578;
    font-weight: 750;
}

.page-shell .quick-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.page-shell .quick-action-grid a {
    min-height: 48px;
    color: #4f46e5;
    background: #faf7ff;
}

.page-shell .crm-customer-card {
    padding: 16px;
}

.page-shell .crm-customer-card header {
    gap: 12px;
}

.page-shell .crm-customer-card header b {
    color: #6d28d9;
    background: #f0e9ff;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 12px;
}

.page-shell .customer-mini-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.page-shell .customer-mini-stats span,
.page-shell .customer-summary,
.page-shell .next-action-card {
    border-color: #eee7fb;
    background: #fcfaff;
}

.page-shell .team-member-card {
    align-items: center;
    border-radius: 14px;
    background: #fcfaff;
}

.page-shell .stack-form.light {
    gap: 12px;
}

.page-shell .stack-form.light label,
.page-shell .section-title {
    color: #2a2145;
}

.page-shell .responsive-table table th {
    color: #8b73c9;
    font-size: 11px;
    letter-spacing: 0;
    text-transform: uppercase;
}

.page-shell .responsive-table table td {
    color: #3b3157;
}

.page-shell .empty-state {
    border: 1px dashed #d9cdf5;
    border-radius: 16px;
    background: #fbf8ff;
}

@media (max-width: 1280px) {
    .page-shell .metric-grid.dashboard-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .page-shell .dashboard-grid > .table-card:not(.span-2),
    .page-shell .report-grid > .table-card,
    .page-shell .settings-grid > .table-card,
    .page-shell .team-grid > .table-card,
    .page-shell .customer-insight-grid > .crm-customer-card,
    .page-shell .integration-grid > .integration-card,
    .page-shell .events-grid > .webhook-box {
        grid-column: span 12;
    }
}

@media (max-width: 720px) {
    .page-shell .work-area {
        padding: 16px;
    }

    .page-shell .topbar {
        display: grid;
        gap: 12px;
    }

    .page-shell .metric-grid.dashboard-metrics,
    .page-shell .metric-grid.wide,
    .page-shell .quick-action-grid,
    .page-shell .customer-mini-stats {
        grid-template-columns: 1fr;
    }

    .page-shell .weekly-chart .bar-track {
        height: 96px;
    }
}

/* Cleaner integration setup experience */
.integration-overview {
    display: grid;
    grid-template-columns: 180px 180px minmax(0, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}

.integration-overview article {
    display: grid;
    gap: 6px;
    min-height: 94px;
    padding: 16px;
    border: 1px solid #e8e2f6;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 28px rgba(76, 29, 149, 0.055);
}

.integration-overview span,
.integration-status-panel span,
.connection-badge,
.integration-steps span {
    color: #7a6b9b;
    font-size: 12px;
    font-weight: 800;
}

.integration-overview strong {
    color: #17122f;
    font-size: 28px;
    line-height: 1;
}

.integration-overview small {
    color: #81749f;
    font-weight: 650;
}

.webhook-summary {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.webhook-summary span {
    grid-column: 1 / -1;
}

.webhook-summary code {
    min-width: 0;
    overflow: hidden;
    padding: 12px 14px;
    border-radius: 13px;
    background: #f5f0ff;
    color: #3b2b66;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.integration-steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.integration-steps div {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 50px;
    padding: 10px 12px;
    border: 1px solid #eadffb;
    border-radius: 16px;
    background: #fff;
}

.integration-steps b {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 10px;
    background: linear-gradient(135deg, #8b5cf6, #4f46e5);
    color: #fff;
    font-size: 13px;
}

.integration-filterbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 16px;
    padding: 6px;
    width: fit-content;
    max-width: 100%;
    border: 1px solid #eadffb;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 10px 24px rgba(76, 29, 149, 0.05);
}

.integration-filterbar button {
    min-height: 36px;
    padding: 0 13px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #6d5b91;
    font-size: 13px;
    font-weight: 850;
}

.integration-filterbar button.active,
.integration-filterbar button:hover {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: #fff;
    box-shadow: 0 10px 20px rgba(124, 58, 237, 0.18);
}

.page-shell .integration-grid {
    align-items: start;
}

.page-shell .integration-card {
    padding: 18px;
}

.integration-card.is-connected {
    border-color: #d8f5e4;
}

.integration-card.needs-attention {
    border-color: #efe5ff;
}

.integration-head {
    align-items: center;
    gap: 13px;
}

.integration-head h2 {
    margin: 0;
    color: #17122f;
    font-size: 18px;
    letter-spacing: 0;
}

.integration-head > div:nth-child(2) {
    min-width: 0;
    flex: 1;
}

.integration-head > div:nth-child(2) span {
    display: block;
    overflow: hidden;
    color: #82769f;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.connection-badge {
    margin-left: auto;
    padding: 7px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.connection-badge.ok {
    color: #047857;
    background: #dcfce7;
}

.connection-badge.warn {
    color: #9a6a00;
    background: #fff5d6;
}

.connection-badge.muted {
    color: #756988;
    background: #ece7f2;
}

.integration-card.is-passive {
    border-color: #eee7f7;
    background: #fbfaff;
}

.integration-purpose {
    margin: 14px 0 0;
    padding: 12px 13px;
    border: 1px solid #eee7fb;
    border-radius: 14px;
    background: linear-gradient(135deg, #fbf8ff, #fff);
    color: #655978;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.45;
}

.integration-status-panel {
    display: grid;
    grid-template-columns: 1.1fr 1.3fr 0.9fr;
    gap: 10px;
    margin: 16px 0 12px;
}

.integration-status-panel div {
    min-width: 0;
    padding: 12px;
    border: 1px solid #eee7fb;
    border-radius: 14px;
    background: #fcfaff;
}

.integration-status-panel strong {
    display: block;
    overflow: hidden;
    margin-top: 5px;
    color: #241b3f;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.integration-mode-note {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 12px 0 0;
    padding: 11px 12px;
    border: 1px solid #e8ddfb;
    border-radius: 14px;
    background: #fbf8ff;
}

.integration-mode-note strong {
    flex: 0 0 auto;
    padding: 5px 9px;
    border-radius: 999px;
    background: #ede9fe;
    color: #6d28d9;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.integration-mode-note span {
    color: #5d5274;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.4;
}

.integration-mode-note.muted {
    border-color: #eee7f7;
    background: #f8f6fb;
}

.integration-mode-note.muted strong {
    background: #ece7f2;
    color: #756988;
}

.integration-mode-note.mock {
    border-color: #f1e4c6;
    background: #fffbeb;
}

.integration-mode-note.mock strong {
    background: #fef3c7;
    color: #9a5d00;
}

.compact-health {
    gap: 8px;
    margin-bottom: 12px;
}

.compact-health span {
    position: relative;
    padding: 7px 10px 7px 25px;
    border: 1px solid transparent;
    font-size: 12px;
}

.compact-health span::before {
    content: "";
    position: absolute;
    left: 10px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    transform: translateY(-50%);
}

.compact-health .ok::before {
    background: #10b981;
}

.compact-health .warn::before {
    background: #f59e0b;
}

.next-step-banner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    margin: 12px 0;
    padding: 12px 13px;
    border-radius: 14px;
    font-size: 13px;
}

.next-step-banner strong {
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
}

.next-step-banner span {
    color: #514566;
    font-weight: 650;
    line-height: 1.35;
}

.next-step-banner.ready {
    border: 1px solid #d8f5e4;
    background: #f0fdf4;
}

.next-step-banner.ready strong {
    color: #047857;
    background: #dcfce7;
}

.next-step-banner.todo {
    border: 1px solid #f2e4bd;
    background: #fffbeb;
}

.next-step-banner.todo strong {
    color: #9a6a00;
    background: #fff1bf;
}

.next-step-banner.passive {
    border: 1px solid #eee7f7;
    background: #f8f6fb;
}

.next-step-banner.passive strong {
    color: #756988;
    background: #ece7f2;
}

.integration-primary-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.integration-primary-actions button {
    min-height: 38px;
    padding: 0 13px;
    border: 1px solid #e5d8fb;
    border-radius: 13px;
    background: #fff;
    color: #5b21b6;
    font-size: 13px;
    font-weight: 850;
    box-shadow: 0 8px 18px rgba(76, 29, 149, 0.055);
}

.integration-primary-actions button:first-child:not(:disabled) {
    border-color: transparent;
    background: linear-gradient(135deg, #8b5cf6, #5b21b6);
    color: #fff;
}

.integration-primary-actions button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(76, 29, 149, 0.12);
}

.integration-primary-actions button:disabled {
    cursor: not-allowed;
    background: #f3eefb;
    color: #82769f;
}

.integration-webhook-box {
    margin-top: 10px;
    border: 1px solid #eadffb;
    border-radius: 16px;
    background: #fff;
}

.integration-webhook-box summary {
    cursor: pointer;
    padding: 12px 14px;
    color: #3b2b66;
    font-size: 13px;
    font-weight: 850;
    list-style: none;
}

.integration-webhook-box summary::-webkit-details-marker {
    display: none;
}

.integration-webhook-box summary::after {
    content: "+";
    float: right;
    color: #7c3aed;
    font-weight: 900;
}

.integration-webhook-box[open] summary::after {
    content: "-";
}

.integration-copy-kit {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: center;
    margin: 0 12px 12px;
    padding: 10px;
    border: 1px solid #e9ddfb;
    border-radius: 14px;
    background: #f9f5ff;
}

.integration-copy-kit div {
    min-width: 0;
}

.integration-copy-kit span {
    display: block;
    margin-bottom: 5px;
    color: #8b73c9;
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
}

.integration-copy-kit code {
    display: block;
    overflow: hidden;
    color: #3b2b66;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.integration-copy-kit button {
    min-height: 36px;
    padding: 0 11px;
    white-space: nowrap;
}

.integration-copy-kit small {
    color: #8a7aa8;
    font-size: 12px;
    font-weight: 700;
    text-align: right;
}

.verify-token-display {
    display: grid;
    gap: 7px;
    margin: 0 12px 12px;
    padding: 12px;
    border: 1px solid #ddd6fe;
    border-radius: 14px;
    background: #fff;
}

.verify-token-display span,
.meta-token-hint {
    color: #7c6aa0;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.verify-token-display code,
.meta-token-hint code {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    color: #3b2b66;
    font-size: 12px;
    text-overflow: ellipsis;
    vertical-align: bottom;
    white-space: nowrap;
}

.verify-token-display strong {
    color: #9f580a;
    font-size: 13px;
}

.verify-token-display small,
.webhook-warning {
    color: #8a6b20;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.45;
}

.verify-token-display.missing,
.webhook-warning {
    border-color: #fde68a;
    background: #fffbeb;
}

.webhook-warning {
    margin: 0 14px 14px;
    padding: 10px 12px;
    border: 1px solid #fde68a;
    border-radius: 12px;
}

.connection-info {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 12px 0;
}

.connection-info div {
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid #eee7fb;
    border-radius: 14px;
    background: #fbf8ff;
}

.connection-info .wide {
    grid-column: 1 / -1;
}

.connection-info span {
    display: block;
    color: #8b73c9;
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
}

.connection-info strong {
    display: block;
    margin-top: 5px;
    color: #352957;
    font-size: 13px;
    line-height: 1.35;
}

.integration-editor,
.compact-guide,
.technical-log-panel {
    margin-top: 12px;
    border: 1px solid #eadffb;
    border-radius: 16px;
    background: #fff;
}

.integration-editor summary,
.compact-guide summary,
.technical-log-panel > summary {
    cursor: pointer;
    padding: 13px 14px;
    color: #312352;
    font-weight: 850;
    list-style: none;
}

.integration-editor summary::-webkit-details-marker,
.compact-guide summary::-webkit-details-marker,
.technical-log-panel > summary::-webkit-details-marker {
    display: none;
}

.integration-editor summary::after,
.compact-guide summary::after,
.technical-log-panel > summary::after {
    content: "+";
    float: right;
    color: #7c3aed;
    font-weight: 900;
}

.integration-editor[open] summary::after,
.compact-guide[open] summary::after,
.technical-log-panel[open] > summary::after {
    content: "-";
}

.integration-editor form,
.compact-guide > div,
.compact-guide ol,
.compact-guide .doc-link {
    margin: 0 14px 14px;
}

.integration-editor .stack-form {
    padding-top: 0;
}

.integration-editor label {
    color: #4b3f68;
    font-size: 13px;
}

.field-help {
    display: block;
    margin-top: 6px;
    color: #82769f;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.35;
}

.token-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.token-input-row input {
    min-width: 0;
}

.generate-verify-token {
    min-height: 44px;
    padding: 0 13px;
    border: 1px solid #ddd6fe;
    border-radius: 13px;
    background: #f5f3ff;
    color: #5b21b6;
    font-size: 13px;
    font-weight: 850;
    white-space: nowrap;
}

.generate-verify-token:hover {
    border-color: #a78bfa;
    background: #ede9fe;
    transform: translateY(-1px);
}

.meta-token-hint {
    display: block;
    margin-top: 8px;
    padding: 9px 10px;
    border: 1px solid #ddd6fe;
    border-radius: 12px;
    background: #fbf8ff;
    text-transform: none;
}

.meta-token-hint.warning {
    border-color: #fde68a;
    background: #fffbeb;
    color: #9f580a;
}

.integration-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.integration-actions button,
.test-grid button {
    min-height: 44px;
    border-radius: 13px;
}

.integration-actions button:not(.primary),
.test-grid button {
    border: 1px solid #e2d7f8;
    background: #fff;
    color: #4f46e5;
}

.copy-mini {
    width: fit-content;
    min-height: 32px;
    margin-top: 8px;
    padding: 0 10px;
    font-size: 12px;
}

.test-editor h3 {
    margin: 0 0 10px;
    color: #251b40;
    font-size: 14px;
}

.test-grid {
    display: grid;
    gap: 10px;
}

.technical-log-panel {
    margin-top: 18px;
    background: #faf7ff;
}

.technical-log-panel .events-grid {
    padding: 0 14px 14px;
}

.technical-log-panel:not([open]) {
    box-shadow: none;
}

.integration-filter-empty {
    margin-top: 14px;
    padding: 18px;
    border: 1px dashed #d9c8fb;
    border-radius: 18px;
    background: #fbf8ff;
    color: #6c5b86;
    text-align: center;
}

@media (max-width: 1180px) {
    .integration-overview {
        grid-template-columns: 1fr 1fr;
    }

    .webhook-summary {
        grid-column: 1 / -1;
    }

    .integration-steps,
    .integration-status-panel {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .integration-overview,
    .integration-steps,
    .integration-status-panel,
    .connection-info,
    .integration-actions,
    .next-step-banner,
    .integration-copy-kit,
    .token-input-row {
        grid-template-columns: 1fr;
    }

    .generate-verify-token {
        width: 100%;
    }

    .integration-copy-kit small {
        text-align: left;
    }

    .integration-mode-note {
        display: block;
    }

    .integration-mode-note span {
        display: block;
        margin-top: 8px;
    }

    .webhook-summary {
        display: grid;
    }
}

/* Inbox production layout: clean two-pane messaging with drawer details */
body:has(.app-shell) {
    overflow: hidden;
    background: #f8f7fc;
}

body:has(.app-shell) .app-shell {
    grid-template-columns: 260px 380px minmax(0, 1fr);
    height: 100vh;
    min-height: 760px;
    overflow: hidden;
    color: #141022;
    background: #fff;
}

body:has(.app-shell) .sidebar {
    width: 260px;
    padding: 24px 18px;
    background:
        radial-gradient(circle at 12% 0%, rgba(139, 92, 246, 0.42), transparent 31%),
        linear-gradient(180deg, #100827 0%, #1b0d3d 52%, #090719 100%);
}

body:has(.app-shell) .brand {
    margin-bottom: 28px;
}

body:has(.app-shell) .brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 15px;
    background: linear-gradient(135deg, #a855f7, #5b21b6);
    box-shadow: 0 18px 34px rgba(124, 58, 237, 0.3);
}

body:has(.app-shell) .user-strip {
    margin-bottom: 30px;
    border-color: rgba(255, 255, 255, 0.16);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.09);
}

body:has(.app-shell) .nav-list {
    gap: 8px;
}

body:has(.app-shell) .nav-item {
    min-height: 44px;
    padding: 0 14px;
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 14px;
}

body:has(.app-shell) .nav-item.active,
body:has(.app-shell) .nav-item:hover {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    color: #fff;
    box-shadow: 0 14px 30px rgba(79, 70, 229, 0.28);
}

body:has(.app-shell) .integration-panel {
    margin-top: 34px;
}

body:has(.app-shell) .channel-card {
    min-height: 48px;
    padding: 8px 0;
}

body:has(.app-shell) .inbox-panel {
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr);
    width: 380px;
    min-width: 0;
    height: 100vh;
    padding: 28px 18px 18px;
    overflow: hidden;
    border-right: 1px solid #eee8f8;
    background: #fff;
}

body:has(.app-shell) .inbox-topbar {
    align-items: center;
    min-height: auto;
    margin: 0 0 20px;
}

body:has(.app-shell) .inbox-topbar h1 {
    margin: 0;
    color: #161126;
    font-size: 27px;
    line-height: 1.08;
}

body:has(.app-shell) .inbox-topbar p {
    margin: 7px 0 0;
    color: #887b9f;
    font-size: 13px;
    font-weight: 700;
}

body:has(.app-shell) .icon-action,
body:has(.app-shell) .icon-button {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    border: 1px solid #e8def8;
    border-radius: 14px;
    color: #6d28d9;
    background: #fff;
    box-shadow: 0 10px 26px rgba(76, 29, 149, 0.08);
}

body:has(.app-shell) .icon-action svg,
body:has(.app-shell) .icon-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.2;
}

body:has(.app-shell) #refreshInbox {
    color: #6d28d9;
    overflow: visible;
}

body:has(.app-shell) #refreshInbox::before {
    content: none;
}

body:has(.app-shell) .search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

body:has(.app-shell) .search-row select {
    display: none;
}

body:has(.app-shell) .search-row input {
    min-height: 48px;
    border: 1px solid #e8def8;
    border-radius: 17px;
    background: #fbf9ff;
    font-size: 14px;
}

body:has(.app-shell) .filter-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 2px;
}

body:has(.app-shell) .filter-row select,
body:has(.app-shell) .toggle-filter {
    flex: 0 0 auto;
    width: auto;
    min-height: 38px;
    border-radius: 999px;
    background: #fbf9ff;
    font-size: 12px;
    font-weight: 800;
}

body:has(.app-shell) .conversation-list {
    display: grid;
    align-content: start;
    gap: 10px;
    min-height: 0;
    overflow-y: auto;
    padding: 2px 4px 20px 0;
}

body:has(.app-shell) .conversation-card {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 12px;
    min-height: 98px;
    padding: 14px;
    border: 1px solid #eee8f8;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(32, 16, 64, 0.045);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

body:has(.app-shell) .conversation-card:hover {
    border-color: #d8c7fb;
    transform: translateY(-2px);
    box-shadow: 0 18px 38px rgba(76, 29, 149, 0.09);
}

body:has(.app-shell) .conversation-card.active {
    border-color: #8b5cf6;
    background: linear-gradient(135deg, #f7f3ff, #fff);
    box-shadow: 0 20px 44px rgba(124, 58, 237, 0.14);
}

body:has(.app-shell) .conversation-card.active::before {
    width: 4px;
    border-radius: 999px;
    background: #7c3aed;
}

body:has(.app-shell) .conversation-avatar {
    width: 48px;
    height: 48px;
    border-radius: 17px;
    background: linear-gradient(135deg, #a78bfa, #7c3aed);
    font-size: 15px;
}

body:has(.app-shell) .conversation-avatar i {
    right: -5px;
    bottom: -5px;
    min-width: 22px;
    height: 22px;
    border: 3px solid #fff;
    font-size: 9px;
}

body:has(.app-shell) .conversation-head strong {
    color: #161126;
    font-size: 15px;
}

body:has(.app-shell) .conversation-head small {
    color: #9287a8;
    font-size: 12px;
}

body:has(.app-shell) .subject {
    display: none;
}

body:has(.app-shell) .preview {
    display: -webkit-box;
    overflow: hidden;
    margin-top: 7px;
    color: #6f647f;
    font-size: 13px;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    white-space: normal;
}

body:has(.app-shell) .conversation-tags {
    display: flex !important;
    gap: 6px;
    margin-top: 10px;
}

body:has(.app-shell) .conversation-tags em:not(:first-child) {
    display: none;
}

body:has(.app-shell) .conversation-meta {
    display: grid;
    justify-items: end;
    align-content: space-between;
    min-height: 68px;
}

body:has(.app-shell) .conversation-meta small {
    min-width: 34px;
    height: 28px;
    border-radius: 10px;
    color: #6d28d9;
    background: #f2ecff;
}

body:has(.app-shell) .conversation-meta b {
    min-width: 24px;
    height: 24px;
    background: #7c3aed;
    box-shadow: 0 10px 22px rgba(124, 58, 237, 0.24);
}

body:has(.app-shell) .conversation-meta em {
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 11px;
}

body:has(.app-shell) .detail-panel {
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-width: 0;
    height: 100vh;
    overflow: hidden;
    background: #fff;
}

body:has(.app-shell) .detail-header {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    min-height: 92px;
    padding: 20px 28px;
    border-bottom: 1px solid #eee8f8;
}

body:has(.app-shell) .detail-header .avatar.large {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    background: linear-gradient(135deg, #0f766e, #14b8a6);
}

body:has(.app-shell) .detail-header h2 {
    margin: 3px 0;
    color: #161126;
    font-size: 22px;
}

body:has(.app-shell) .detail-header #detailIntent {
    color: #7d7192;
    font-size: 14px;
}

body:has(.app-shell) .detail-header-actions {
    display: flex;
    gap: 10px;
}

body:has(.app-shell) .mobile-back {
    display: none;
}

body:has(.app-shell) .insight-strip {
    position: absolute;
    top: 56px;
    left: 94px;
    display: flex;
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

body:has(.app-shell) .insight-strip span {
    padding: 4px 9px;
    border-radius: 999px;
    color: #6f647f;
    background: #f5f1ff;
    font-size: 12px;
    font-weight: 750;
}

body:has(.app-shell) .detail-tabs,
body:has(.app-shell) .typing-row {
    display: none;
}

body:has(.app-shell) .message-thread {
    min-height: 0;
    margin: 0;
    padding: 28px clamp(28px, 4vw, 58px);
    overflow-y: auto;
    border: 0;
    border-radius: 0;
    background:
        radial-gradient(circle at 50% 0%, rgba(124, 58, 237, 0.045), transparent 34%),
        #fff;
    box-shadow: none;
}

body:has(.app-shell) .date-separator {
    margin: 18px 0;
}

body:has(.app-shell) .date-separator span {
    padding: 6px 12px;
    border: 1px solid #eee8f8;
    border-radius: 999px;
    color: #8b7ca4;
    background: #fff;
    font-size: 12px;
}

body:has(.app-shell) .message {
    max-width: min(68%, 720px);
    margin-bottom: 16px;
    padding: 15px 17px;
    border: 1px solid #ece6f6;
    border-radius: 20px 20px 20px 8px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(27, 14, 54, 0.06);
}

body:has(.app-shell) .message.agent {
    border-color: #d8c7fb;
    border-radius: 20px 20px 8px 20px;
    background: linear-gradient(135deg, #f0eaff, #e9e6ff);
}

body:has(.app-shell) .message p {
    color: #201932;
    font-size: 16px;
    line-height: 1.55;
}

body:has(.app-shell) .message small {
    margin-top: 8px;
    color: #8b7ca4;
    font-size: 12px;
}

body:has(.app-shell) .message-error {
    margin-top: 8px;
    font-size: 13px;
}

body:has(.app-shell) .reply-box {
    position: sticky;
    bottom: 0;
    margin: 0;
    padding: 16px clamp(28px, 4vw, 58px) 22px;
    border-width: 1px 0 0;
    border-color: #eee8f8;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -18px 44px rgba(27, 14, 54, 0.075);
    backdrop-filter: blur(14px);
}

body:has(.app-shell) .reply-toolbar,
body:has(.app-shell) .quick-replies {
    display: none;
}

body:has(.app-shell) .reply-box textarea {
    min-height: 76px;
    max-height: 150px;
    padding: 16px 18px;
    border: 1px solid #e6ddf7;
    border-radius: 22px;
    background: #fff;
    color: #201932;
    font-size: 15px;
    line-height: 1.45;
    box-shadow: inset 0 1px 0 rgba(124, 58, 237, 0.04);
}

body:has(.app-shell) .reply-box textarea:focus {
    border-color: #a78bfa;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}

body:has(.app-shell) .composer-tools {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

body:has(.app-shell) .composer-tools button {
    min-height: 34px;
    padding: 0 10px;
    border-radius: 999px;
    color: #6f647f;
    background: transparent;
}

body:has(.app-shell) .composer-tools button:hover {
    color: #6d28d9;
    background: #f4efff;
}

body:has(.app-shell) .reply-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: -36px;
}

body:has(.app-shell) .reply-actions #trainAi {
    display: none;
}

body:has(.app-shell) .reply-actions .primary {
    min-width: 108px;
    min-height: 42px;
    border-radius: 15px;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    box-shadow: 0 16px 30px rgba(124, 58, 237, 0.22);
}

body:has(.app-shell) .reply-box small {
    display: block;
    min-height: 18px;
    margin-top: 8px;
    color: #7d7192;
}

body:has(.app-shell) .customer-drawer {
    position: fixed;
    inset: 0;
    z-index: 80;
    pointer-events: none;
}

body:has(.app-shell) .drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 8, 32, 0);
    transition: background 0.2s ease;
}

body:has(.app-shell) .drawer-panel {
    position: absolute;
    top: 16px;
    right: 16px;
    bottom: 16px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(440px, calc(100vw - 32px));
    overflow: hidden;
    border: 1px solid #eee8f8;
    border-radius: 28px;
    background: #fff;
    box-shadow: 0 30px 80px rgba(22, 10, 45, 0.22);
    transform: translateX(calc(100% + 32px));
    transition: transform 0.24s ease;
}

body:has(.app-shell) .customer-drawer.open {
    pointer-events: auto;
}

body:has(.app-shell) .customer-drawer.open .drawer-backdrop {
    background: rgba(15, 8, 32, 0.32);
}

body:has(.app-shell) .customer-drawer.open .drawer-panel {
    transform: translateX(0);
}

body:has(.app-shell) .drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 22px;
    border-bottom: 1px solid #eee8f8;
}

body:has(.app-shell) .drawer-header h3 {
    margin: 3px 0 0;
    color: #161126;
    font-size: 21px;
}

body:has(.app-shell) .customer-drawer .context-rail {
    display: grid;
    align-content: start;
    gap: 14px;
    min-height: 0;
    padding: 16px;
    overflow-y: auto;
}

body:has(.app-shell) .customer-drawer .customer-card-panel,
body:has(.app-shell) .customer-drawer .action-panel,
body:has(.app-shell) .customer-drawer .task-panel,
body:has(.app-shell) .customer-drawer .note-panel,
body:has(.app-shell) .customer-drawer .ai-panel {
    margin: 0;
    padding: 16px;
    border: 1px solid #eee8f8;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(27, 14, 54, 0.045);
}

body:has(.app-shell) .customer-drawer .ai-panel {
    margin: 0 16px 16px;
}

body:has(.app-shell) .customer-card-grid {
    grid-template-columns: 1fr 1fr;
}

body:has(.app-shell) .inline-form,
body:has(.app-shell) .task-form {
    grid-template-columns: 1fr;
}

body:has(.app-shell) .note-panel textarea {
    min-height: 110px;
}

@media (max-width: 1180px) {
    body:has(.app-shell) .app-shell {
        grid-template-columns: 220px 360px minmax(0, 1fr);
    }

    body:has(.app-shell) .sidebar {
        width: 220px;
    }
}

@media (max-width: 900px) {
    body:has(.app-shell) {
        overflow: auto;
    }

    body:has(.app-shell) .app-shell {
        display: grid;
        grid-template-columns: 1fr;
        height: 100vh;
        min-height: 0;
    }

    body:has(.app-shell) .sidebar {
        position: fixed;
        inset: auto 14px 14px;
        z-index: 40;
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: auto;
        height: 64px;
        padding: 10px 12px;
        border-radius: 22px;
        box-shadow: 0 24px 54px rgba(22, 10, 45, 0.24);
    }

    body:has(.app-shell) .sidebar .brand span,
    body:has(.app-shell) .user-strip,
    body:has(.app-shell) .integration-panel {
        display: none;
    }

    body:has(.app-shell) .sidebar .brand {
        margin: 0;
    }

    body:has(.app-shell) .nav-list {
        display: flex;
        flex: 1;
        justify-content: flex-end;
        overflow-x: auto;
    }

    body:has(.app-shell) .nav-item {
        flex: 0 0 auto;
        min-height: 38px;
        padding: 0 12px;
        font-size: 12px;
    }

    body:has(.app-shell) .inbox-panel {
        width: 100%;
        height: 100vh;
        padding: 18px 14px 92px;
    }

    body:has(.app-shell) .detail-panel {
        position: fixed;
        inset: 0;
        z-index: 30;
        display: grid;
        transform: translateX(100%);
        transition: transform 0.22s ease;
    }

    body.conversation-open:has(.app-shell) .detail-panel {
        transform: translateX(0);
    }

    body:has(.app-shell) .mobile-back {
        display: inline-grid;
    }

    body:has(.app-shell) .detail-header {
        grid-template-columns: 46px minmax(0, 1fr) auto;
        min-height: 84px;
        padding: 16px;
    }

    body:has(.app-shell) .detail-header .avatar.large {
        width: 46px;
        height: 46px;
    }

    body:has(.app-shell) .detail-header h2 {
        font-size: 18px;
    }

    body:has(.app-shell) .insight-strip {
        display: none;
    }

    body:has(.app-shell) .message-thread {
        padding: 18px 14px;
    }

    body:has(.app-shell) .message {
        max-width: 86%;
    }

    body:has(.app-shell) .reply-box {
        padding: 12px 14px 16px;
    }

    body:has(.app-shell) .composer-tools {
        overflow-x: auto;
        padding-bottom: 2px;
    }

    body:has(.app-shell) .reply-actions {
        margin-top: 10px;
    }
}

@media (max-width: 560px) {
    body:has(.app-shell) .conversation-card {
        min-height: 92px;
        padding: 12px;
        border-radius: 18px;
    }

    body:has(.app-shell) .filter-row select:nth-of-type(n+3) {
        display: none;
    }

    body:has(.app-shell) .message p {
        font-size: 15px;
    }

    body:has(.app-shell) .drawer-panel {
        inset: 0;
        width: 100vw;
        border-radius: 0;
    }
}
