:root {
    --bg: #f7f7fb;
    --surface: #ffffff;
    --surface-soft: #f2f3f8;
    --surface-strong: #e8eaf3;
    --sidebar: #14151f;
    --sidebar-line: rgba(255, 255, 255, 0.12);
    --text: #1b1d2a;
    --muted: #71758b;
    --line: #dddfeb;
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --mint: #eef2ff;
    --amber: #a86412;
    --coral: #be3d5a;
    --violet: #6d28d9;
    --danger: #b42318;
    --success: #067647;
    --warning: #a15c07;
    --shadow: 0 22px 50px rgba(25, 28, 45, 0.09);
    --radius: 8px;
    --sidebar-width: 252px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.theme-dark {
    --bg: #101116;
    --surface: #171923;
    --surface-soft: #202232;
    --surface-strong: #282b3f;
    --text: #f4f5fb;
    --muted: #a7abc0;
    --line: #303349;
    --mint: #252a55;
    --shadow: 0 22px 50px rgba(0, 0, 0, 0.32);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
}

a {
    color: var(--primary);
    text-decoration: none;
}

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

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    padding: 11px 12px;
    outline: none;
}

input[type="color"] {
    min-width: 54px;
    padding: 4px;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.16);
}

textarea {
    resize: vertical;
}

hr {
    width: 100%;
    border: 0;
    border-top: 1px solid var(--line);
}

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 18px;
    background: var(--sidebar);
    color: #fff;
    border-right: 1px solid rgba(0, 0, 0, 0.2);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 54px;
    color: #fff;
}

.brand-mark,
.avatar,
.workspace-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #4f46e5, #1d4ed8);
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0;
}

.brand-mark.large,
.avatar.large {
    width: 54px;
    height: 54px;
}

.avatar.xlarge {
    width: 72px;
    height: 72px;
    margin: 0 auto 12px;
    font-size: 18px;
}

.brand-copy strong,
.brand-copy small,
.workspace-switcher strong,
.workspace-switcher small,
.user-pill span,
.user-pill small,
td small,
.metric small {
    display: block;
}

.brand-copy small {
    max-width: 154px;
    color: #bec3d9;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav {
    display: grid;
    gap: 4px;
    overflow: auto;
    padding-right: 2px;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    color: #d8dcef;
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 8px 10px;
    font-weight: 760;
    font-size: 14px;
}

.nav a.active,
.nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.10);
    border-color: var(--sidebar-line);
}

.nav-icon {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.08);
    color: #c7d2fe;
    font-size: 11px;
    font-weight: 900;
}

.sidebar-card {
    border: 1px solid var(--sidebar-line);
    border-radius: var(--radius);
    padding: 12px;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-card strong,
.sidebar-card a,
.sidebar-label {
    display: block;
}

.sidebar-label {
    color: #bec3d9;
    font-size: 12px;
    font-weight: 800;
}

.sidebar-card a {
    margin-top: 8px;
    color: #c7d2fe;
    font-size: 13px;
    font-weight: 800;
}

.logout-form {
    margin-top: auto;
}

.main {
    min-width: 0;
    padding: 22px;
}

.topbar,
.topbar-actions,
.workspace-switcher,
.panel-header,
.row-actions,
.builder-toolbar,
.chat-actions,
.chat-contact-title,
.conversation-meta,
.inline-actions,
.composer-footer {
    display: flex;
    align-items: center;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    justify-content: space-between;
    gap: 16px;
    min-height: 66px;
    margin: -22px -22px 20px;
    padding: 14px 22px;
    background: rgba(247, 247, 251, 0.88);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px);
}

body.theme-dark .topbar {
    background: rgba(16, 17, 22, 0.88);
}

.workspace-switcher {
    gap: 10px;
    min-width: 220px;
}

.workspace-switcher small,
.user-pill small,
.panel-header p,
.metric small,
td small,
.muted,
.empty,
.timeline small,
.list-row p,
.team-card p,
.conversation-copy small,
.message small,
.chat-header p,
.window-indicator,
.status-row span,
.limit-list,
.auth-brand-panel .eyebrow {
    color: var(--muted);
}

.workspace-switcher strong,
.user-pill span {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.global-search {
    position: relative;
    width: min(520px, 38vw);
}

.global-search input {
    padding-right: 44px;
    background: var(--surface);
}

.global-search .icon-button {
    position: absolute;
    right: 4px;
    top: 4px;
}

.topbar-actions {
    gap: 8px;
}

.user-pill {
    min-width: 154px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    padding: 8px 12px;
    text-align: right;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.page-heading h1,
.auth-panel h1,
.install-panel h1,
.auth-brand-panel h1 {
    margin: 0;
    font-size: 30px;
    line-height: 1.1;
    letter-spacing: 0;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--amber);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.content-grid {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}

.content-grid.two,
.dashboard-grid {
    grid-template-columns: minmax(360px, 1.2fr) minmax(300px, 0.8fr);
}

.content-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel,
.metric,
.auth-panel,
.install-panel,
.conversation-list,
.chat-panel,
.contact-context,
.automation-sidebar,
.flow-builder {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.panel,
.metric {
    min-width: 0;
    padding: 16px;
}

.panel.soft {
    box-shadow: none;
    background: var(--surface-soft);
}

.panel-header {
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.panel-header.tight {
    margin-bottom: 10px;
}

.panel-header h2,
.chat-header h2,
.contact-card h2,
.contact-profile h2,
.empty-state h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.2;
    letter-spacing: 0;
}

.panel-header p,
.team-card p,
.list-row p,
.activity-line p,
.conversation-copy small,
.empty-state p {
    margin: 4px 0 0;
    font-size: 13px;
}

.metric {
    position: relative;
    overflow: hidden;
}

.metric:after {
    content: "";
    position: absolute;
    right: -22px;
    top: -18px;
    width: 74px;
    height: 74px;
    border-radius: 18px;
    background: rgba(79, 70, 229, 0.10);
    transform: rotate(14deg);
}

.metric span,
label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.metric strong {
    display: block;
    margin: 8px 0 4px;
    font-size: 32px;
    line-height: 1;
}

.button,
.icon-button,
.segmented button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    padding: 0 14px;
    cursor: pointer;
    font-weight: 850;
}

.button:hover,
.icon-button:hover,
.segmented button:hover {
    border-color: rgba(79, 70, 229, 0.45);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.10);
}

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

.button.primary:hover {
    background: var(--primary-dark);
}

.button.ghost {
    border-color: var(--sidebar-line);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.button.small,
.icon-button.small {
    min-height: 32px;
    padding-inline: 10px;
    font-size: 12px;
}

.button.full,
.full {
    width: 100%;
}

.icon-button {
    width: 38px;
    min-width: 38px;
    padding: 0;
}

.icon-button.danger {
    color: var(--danger);
}

.alert {
    margin-bottom: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
    background: var(--surface-soft);
}

.alert.success {
    color: var(--success);
    background: #ecfdf3;
    border-color: #abefc6;
}

.alert.error {
    color: var(--danger);
    background: #fef3f2;
    border-color: #fecdca;
}

.alert.warning {
    color: var(--warning);
    background: #fffaeb;
    border-color: #fedf89;
}

.form-grid {
    display: grid;
    gap: 12px;
}

.form-grid.tight {
    gap: 8px;
}

.split-controls,
.filter-bar,
.bulk-bar,
.composer-tools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.filter-bar {
    grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(150px, 0.55fr)) auto;
    align-items: end;
    margin-bottom: 12px;
}

.bulk-bar {
    grid-template-columns: 180px minmax(180px, 1fr) auto;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
    padding: 10px;
    margin-bottom: 12px;
}

.list,
.conversation-stack,
.timeline,
.status-stack,
.limit-list,
.usage-bars {
    display: grid;
    gap: 10px;
}

.list.compact,
.timeline {
    gap: 8px;
}

.list-row,
.activity-line,
.status-row,
.team-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 11px;
    background: var(--surface);
}

.activity-line {
    justify-content: flex-start;
}

.status-row {
    background: var(--surface-soft);
}

.badge,
.tag,
.unread-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    border-radius: 999px;
    background: var(--surface-strong);
    color: var(--muted);
    padding: 3px 9px;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.badge.inbound,
.badge.active,
.badge.open,
.badge.approved,
.badge.sent,
.badge.customer {
    color: var(--success);
    background: #ecfdf3;
}

.badge.outbound,
.badge.draft,
.badge.queued,
.badge.lead,
.badge.prospect,
.badge.submitted {
    color: var(--primary);
    background: #eef2ff;
}

.badge.paused,
.badge.pending,
.badge.scheduled {
    color: var(--warning);
    background: #fffaeb;
}

.badge.failed,
.badge.rejected,
.badge.cancelled,
.badge.blocked,
.badge.urgent,
.priority-urgent {
    color: var(--danger);
    background: #fef3f2;
}

.priority-high {
    color: var(--coral);
    background: #fff0ed;
}

.priority-normal {
    color: var(--primary);
    background: #eef2ff;
}

.priority-low {
    color: var(--muted);
    background: var(--surface-strong);
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.tag-cloud.compact {
    margin-top: 0;
}

.tag {
    border: 1px solid var(--line);
    background: var(--surface);
}

.table-wrap {
    overflow: auto;
}

.data-table,
table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 11px 9px;
    text-align: left;
    vertical-align: top;
}

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

td small {
    margin-top: 4px;
    font-size: 12px;
}

.selected-row {
    background: rgba(79, 70, 229, 0.07);
}

.empty-cell,
.empty {
    text-align: center;
}

.strong-link {
    display: block;
    color: var(--text);
    font-weight: 900;
}

.bar-chart,
.stack-chart {
    display: flex;
    align-items: end;
    gap: 8px;
    min-height: 210px;
    padding: 18px 8px 4px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
    overflow-x: auto;
}

.bar-chart span,
.stack-chart span {
    position: relative;
    display: flex;
    align-items: end;
    justify-content: center;
    min-width: 32px;
    border-radius: 7px 7px 0 0;
    background: linear-gradient(180deg, #7c3aed, var(--primary));
}

.stack-chart span {
    overflow: hidden;
    background: var(--mint);
}

.stack-chart i {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--violet);
}

.bar-chart small,
.stack-chart small {
    position: absolute;
    bottom: -24px;
    color: var(--muted);
    font-size: 11px;
}

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

.mini-metrics span,
.usage-grid span {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    background: var(--surface-soft);
}

.mini-metrics strong,
.usage-grid strong {
    display: block;
    font-size: 24px;
}

.inbox-premium {
    display: grid;
    grid-template-columns: 340px minmax(420px, 1fr) 330px;
    gap: 14px;
    min-height: calc(100vh - 148px);
}

.premium-list,
.premium-chat,
.contact-context {
    min-height: calc(100vh - 148px);
    overflow: hidden;
}

.premium-list {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    padding: 10px;
}

.sticky-filter {
    display: grid;
    gap: 9px;
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 0 0 10px;
    background: var(--surface);
}

.segmented {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 4px;
    background: var(--surface-soft);
}

.segmented button {
    min-height: 32px;
    border: 0;
    background: transparent;
    font-size: 12px;
}

.segmented button.active {
    background: var(--surface);
    box-shadow: 0 4px 14px rgba(21, 28, 25, 0.08);
}

.conversation-stack {
    overflow: auto;
    padding-right: 2px;
}

.conversation-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 10px;
    color: var(--text);
}

.conversation-card.active,
.conversation-card:hover {
    border-color: var(--line);
    background: var(--surface-soft);
}

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

.conversation-copy strong,
.conversation-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.unread-dot {
    min-width: 24px;
    color: #fff;
    background: var(--coral);
}

.premium-chat {
    display: grid;
    grid-template-rows: auto auto minmax(300px, 1fr) auto;
}

.chat-header {
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    padding: 14px;
}

.chat-contact-title,
.chat-actions {
    gap: 10px;
}

.window-indicator {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    padding: 10px 14px;
    font-size: 13px;
    background: var(--surface-soft);
}

.message-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    overflow: auto;
}

.message {
    display: flex;
}

.message.inbound {
    justify-content: flex-start;
}

.message.outbound {
    justify-content: flex-end;
}

.message-bubble {
    max-width: min(680px, 86%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 11px 13px;
    background: var(--surface-soft);
}

.message.outbound .message-bubble {
    color: #1e1b4b;
    background: #eef2ff;
    border-color: #c7d2fe;
}

.message p {
    margin: 6px 0;
}

.premium-composer {
    display: grid;
    gap: 10px;
    border-top: 1px solid var(--line);
    padding: 12px;
}

.composer-tools {
    grid-template-columns: 120px 1fr 1fr 1fr;
}

.composer-footer {
    justify-content: space-between;
    gap: 10px;
}

.contact-context {
    display: grid;
    align-content: start;
    gap: 12px;
    padding: 12px;
    overflow: auto;
}

.contact-card,
.contact-profile {
    text-align: center;
}

.settings-summary {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 9px 12px;
    margin: 0;
}

.settings-summary.compact {
    grid-template-columns: 130px minmax(0, 1fr);
    font-size: 13px;
}

.settings-summary dt {
    color: var(--muted);
    font-weight: 900;
}

.settings-summary dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.timeline > div {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px;
    background: var(--surface);
}

.timeline p {
    margin: 5px 0;
    color: var(--muted);
    font-size: 13px;
}

.crm-layout,
.settings-layout,
.automation-hub {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 16px;
    align-items: start;
}

.automation-hub {
    grid-template-columns: 310px minmax(0, 1fr);
}

.automation-sidebar,
.crm-side,
.settings-side {
    display: grid;
    gap: 12px;
    align-content: start;
}

.filter-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    background: var(--surface);
}

.automation-list-panel {
    margin-bottom: 14px;
}

.row-actions {
    gap: 6px;
}

.row-actions.vertical {
    align-items: stretch;
    flex-direction: column;
}

.row-actions.vertical form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
}

.flow-builder {
    overflow: hidden;
    margin-bottom: 16px;
}

.flow-editor-bar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 180px 130px auto auto;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.flow-title-input {
    border: 0;
    padding: 4px;
    font-size: 19px;
    font-weight: 900;
    box-shadow: none;
}

.editor-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.save-indicator,
.zoom-pill {
    justify-self: end;
    min-width: 70px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-align: center;
    background: var(--surface-soft);
}

.flow-editor-grid {
    display: grid;
    grid-template-columns: 240px minmax(480px, 1fr) 320px;
    min-height: 720px;
}

.block-palette,
.inspector {
    padding: 12px;
    background: var(--surface-soft);
    overflow: auto;
}

.block-palette {
    border-right: 1px solid var(--line);
}

.inspector {
    border-left: 1px solid var(--line);
}

.block-button {
    display: grid;
    gap: 4px;
    width: 100%;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    padding: 10px;
    text-align: left;
    cursor: grab;
}

.block-button:hover {
    border-color: var(--primary);
}

.block-button small {
    color: var(--muted);
    font-size: 12px;
}

.canvas-shell {
    position: relative;
    min-width: 0;
    overflow: hidden;
    background-color: #fbfbfe;
    background-image:
        linear-gradient(var(--line) 1px, transparent 1px),
        linear-gradient(90deg, var(--line) 1px, transparent 1px);
    background-size: 28px 28px;
}

body.theme-dark .canvas-shell {
    background-color: #141622;
}

.canvas-grid {
    position: relative;
    width: 2600px;
    height: 1800px;
    transform-origin: 0 0;
}

.edge-layer,
.node-layer {
    position: absolute;
    inset: 0;
}

.edge-layer {
    overflow: visible;
    pointer-events: none;
}

.flow-edge {
    fill: none;
    stroke: rgba(79, 70, 229, 0.78);
    stroke-width: 3;
}

.flow-edge-label {
    fill: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.flow-node {
    position: absolute;
    width: 244px;
    min-height: 108px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 16px 34px rgba(25, 28, 45, 0.12);
    overflow: hidden;
    cursor: grab;
}

.flow-node.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15), 0 16px 34px rgba(25, 28, 45, 0.12);
}

.flow-node header {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    padding: 10px;
    color: #fff;
    background: var(--primary);
}

.flow-node[data-type="condition"] header,
.flow-node[data-type="randomizer"] header {
    background: var(--violet);
}

.flow-node[data-type="delay"] header,
.flow-node[data-type="webhook"] header {
    background: var(--amber);
}

.flow-node[data-type="handoff"] header,
.flow-node[data-type="end"] header {
    background: var(--coral);
}

.flow-node strong {
    font-size: 13px;
}

.flow-node .node-body {
    padding: 10px;
    color: var(--muted);
    font-size: 13px;
}

.node-actions {
    display: flex;
    gap: 4px;
}

.node-actions button,
.node-port {
    width: 24px;
    height: 24px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    cursor: pointer;
}

.node-port {
    position: absolute;
    right: -10px;
    top: 50%;
    border-color: var(--primary);
    background: #fff;
    color: var(--primary);
    transform: translateY(-50%);
}

.node-port.input {
    left: -10px;
    right: auto;
}

.minimap {
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: 170px;
    height: 112px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: var(--shadow);
}

.minimap-node {
    position: absolute;
    width: 12px;
    height: 8px;
    border-radius: 3px;
    background: var(--primary);
}

.zoom-pill {
    position: absolute;
    left: 12px;
    bottom: 12px;
}

.inspector-form {
    display: grid;
    gap: 10px;
}

.inspector-fieldset {
    display: grid;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px;
    background: var(--surface);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.template-preview-phone {
    display: grid;
    gap: 8px;
    width: min(100%, 360px);
    margin: 14px auto 0;
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 18px;
    background: #f0f2ff;
}

.template-preview-phone > div,
.template-preview-phone > a {
    border-radius: var(--radius);
    background: #fff;
    padding: 10px;
}

.template-preview-phone > a {
    text-align: center;
    font-weight: 900;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.pricing-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14), var(--shadow);
}

.price {
    display: block;
    margin: 8px 0 12px;
    font-size: 30px;
}

.usage-bars label {
    display: grid;
    gap: 6px;
}

.usage-bars i {
    display: block;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-strong);
}

.usage-bars b {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
}

.auth-page,
.install-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--bg);
}

.premium-auth-shell {
    width: min(100%, 980px);
    display: grid;
    grid-template-columns: 1fr 0.8fr;
    gap: 16px;
}

.auth-shell,
.install-shell {
    width: min(100%, 520px);
}

.install-shell {
    width: min(100%, 760px);
}

.auth-panel,
.install-panel,
.auth-brand-panel {
    padding: 28px;
    border-radius: var(--radius);
}

.auth-brand-panel {
    display: grid;
    align-content: end;
    min-height: 420px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: #14151f;
    color: #fff;
}

.auth-brand-panel h1 {
    max-width: 520px;
    margin-bottom: 20px;
}

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

.auth-proof-grid span {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius);
    padding: 10px;
    background: rgba(255, 255, 255, 0.06);
    font-weight: 900;
}

.hidden {
    display: none !important;
}

@media (max-width: 1280px) {
    .inbox-premium,
    .flow-editor-grid {
        grid-template-columns: 300px minmax(420px, 1fr);
    }

    .contact-context,
    .inspector {
        grid-column: 1 / -1;
        min-height: auto;
    }

    .pricing-grid,
    .content-grid.three {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1020px) {
    .app-shell,
    .content-grid.two,
    .dashboard-grid,
    .crm-layout,
    .settings-layout,
    .automation-hub,
    .premium-auth-shell,
    .inbox-premium {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .global-search {
        width: 100%;
    }

    .topbar {
        position: static;
        flex-wrap: wrap;
    }

    .flow-editor-grid {
        grid-template-columns: 1fr;
    }

    .block-palette,
    .inspector {
        border: 0;
    }
}

@media (max-width: 720px) {
    .main,
    .auth-page,
    .install-page {
        padding: 14px;
    }

    .topbar {
        margin: -14px -14px 16px;
        padding: 14px;
    }

    .metric-grid,
    .pricing-grid,
    .content-grid.three,
    .filter-bar,
    .bulk-bar,
    .composer-tools,
    .split-controls,
    .mini-metrics,
    .usage-grid,
    .flow-editor-bar {
        grid-template-columns: 1fr;
    }

    .chat-header,
    .composer-footer,
    .panel-header {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
    }

    .user-pill {
        min-width: 0;
        text-align: left;
    }

    .canvas-grid {
        width: 1800px;
        height: 1400px;
    }
}

/* Premium visual pass */
.app-shell {
    transition: grid-template-columns 0.2s ease;
}

body.sidebar-collapsed .app-shell {
    --sidebar-width: 84px;
}

.sidebar {
    gap: 14px;
    background:
        linear-gradient(180deg, rgba(79, 70, 229, 0.16), rgba(20, 21, 31, 0) 34%),
        var(--sidebar);
}

.brand-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
}

.brand-row .brand {
    min-width: 0;
    flex: 1 1 auto;
}

.sidebar-collapse-button {
    border-color: var(--sidebar-line);
    background: rgba(255, 255, 255, 0.07);
    color: #d8dcef;
}

.sidebar-primary-action {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(129, 140, 248, 0.32);
    border-radius: var(--radius);
    padding: 10px;
    color: #fff;
    background: rgba(79, 70, 229, 0.16);
}

.sidebar-primary-action:hover {
    border-color: rgba(199, 210, 254, 0.58);
    background: rgba(79, 70, 229, 0.24);
}

.nav-group-label {
    display: block;
    margin: 13px 8px 5px;
    color: #8f98bd;
    font-size: 11px;
    font-weight: 950;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.nav a.active {
    background: rgba(255, 255, 255, 0.13);
    box-shadow: inset 3px 0 0 #818cf8;
}

.nav a {
    position: relative;
}

.nav a:hover .nav-icon,
.nav a.active .nav-icon {
    color: #fff;
    background: rgba(129, 140, 248, 0.28);
}

body.sidebar-collapsed .sidebar {
    align-items: center;
    padding: 16px 12px;
}

body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .nav-text,
body.sidebar-collapsed .nav-group-label,
body.sidebar-collapsed .sidebar-card {
    display: none;
}

body.sidebar-collapsed .brand-row,
body.sidebar-collapsed .brand,
body.sidebar-collapsed .sidebar-primary-action,
body.sidebar-collapsed .nav,
body.sidebar-collapsed .nav a,
body.sidebar-collapsed .logout-form,
body.sidebar-collapsed .logout-form .button {
    width: 100%;
}

body.sidebar-collapsed .brand,
body.sidebar-collapsed .sidebar-primary-action,
body.sidebar-collapsed .nav a {
    justify-content: center;
    padding-inline: 0;
}

body.sidebar-collapsed .sidebar-collapse-button {
    position: absolute;
    top: 72px;
    right: 16px;
    width: 28px;
    min-width: 28px;
    min-height: 28px;
    font-size: 10px;
}

body.sidebar-collapsed .logout-form .button {
    font-size: 0;
}

body.sidebar-collapsed .logout-form .button:before {
    content: "SA";
    font-size: 11px;
}

.topbar {
    box-shadow: 0 10px 28px rgba(25, 28, 45, 0.05);
}

.topbar-cta {
    background: var(--text);
    color: var(--surface);
}

.topbar-cta:hover {
    border-color: var(--text);
    box-shadow: 0 0 0 3px rgba(27, 29, 42, 0.10);
}

.page-heading {
    align-items: end;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    background:
        linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(255, 255, 255, 0) 48%),
        var(--surface);
    box-shadow: 0 14px 34px rgba(25, 28, 45, 0.05);
}

.page-heading p:not(.eyebrow) {
    max-width: 760px;
    margin: 7px 0 0;
    color: var(--muted);
}

.page-action {
    white-space: nowrap;
}

.panel,
.metric,
.conversation-list,
.chat-panel,
.contact-context,
.automation-sidebar,
.flow-builder {
    box-shadow: 0 16px 40px rgba(25, 28, 45, 0.07);
}

th {
    background: var(--surface-soft);
}

.data-table tr:hover td,
table tr:hover td {
    background: rgba(79, 70, 229, 0.04);
}

.conversation-card {
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.conversation-card.active,
.conversation-card:hover {
    border-color: rgba(79, 70, 229, 0.22);
    transform: translateY(-1px);
}

.message-bubble {
    box-shadow: 0 10px 22px rgba(25, 28, 45, 0.06);
}

body.theme-dark .message.outbound .message-bubble {
    color: #f4f5fb;
    background: #272a44;
    border-color: #3b3f68;
}

.flow-page {
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.flow-list-rail {
    position: sticky;
    top: 86px;
    display: grid;
    gap: 12px;
    max-height: calc(100vh - 108px);
    overflow: auto;
}

.flow-search-card,
.rail-details,
.flow-list {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 14px 34px rgba(25, 28, 45, 0.06);
}

.flow-search-card {
    display: grid;
    gap: 8px;
    padding: 12px;
}

.rail-details {
    padding: 10px;
}

.rail-details summary {
    cursor: pointer;
    color: var(--text);
    font-weight: 900;
}

.rail-details form {
    margin-top: 10px;
}

.flow-list {
    display: grid;
    gap: 6px;
    padding: 8px;
}

.flow-list-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 10px;
    color: var(--text);
}

.flow-list-item:hover,
.flow-list-item.active {
    border-color: rgba(79, 70, 229, 0.24);
    background: var(--mint);
}

.flow-list-item strong,
.flow-list-item small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.flow-list-item small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.flow-workspace {
    min-width: 0;
}

.flow-builder-premium {
    min-height: calc(100vh - 148px);
    margin-bottom: 14px;
}

.flow-command-bar {
    display: grid;
    grid-template-columns: auto minmax(220px, 1fr) minmax(150px, 190px) 128px minmax(520px, auto) auto auto;
    gap: 8px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    padding: 10px;
    background: linear-gradient(180deg, var(--surface), var(--surface-soft));
}

.flow-title-group {
    min-width: 0;
}

.flow-command-bar .flow-title-input {
    width: 100%;
    min-height: 38px;
    border: 1px solid transparent;
    background: transparent;
}

.flow-command-bar .flow-title-input:hover,
.flow-command-bar .flow-title-input:focus {
    border-color: var(--line);
    background: var(--surface);
}

.flow-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.flow-command-bar .save-indicator,
.flow-command-bar .zoom-pill {
    position: static;
    left: auto;
    bottom: auto;
    justify-self: end;
}

.flow-command-bar .zoom-pill {
    min-width: 62px;
    color: var(--primary);
    background: var(--mint);
}

.flow-onboarding {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid var(--line);
    padding: 12px 16px;
    background:
        linear-gradient(90deg, rgba(79, 70, 229, 0.12), rgba(168, 100, 18, 0.08)),
        var(--surface);
}

.flow-onboarding strong {
    display: block;
    margin-bottom: 3px;
}

.flow-onboarding p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.flow-builder-premium .flow-editor-grid {
    grid-template-columns: 260px minmax(680px, 1fr) 340px;
    min-height: calc(100vh - 246px);
    transition: grid-template-columns 0.2s ease;
}

.flow-builder-premium.palette-collapsed .flow-editor-grid {
    grid-template-columns: 0 minmax(680px, 1fr) 340px;
}

.flow-builder-premium.inspector-collapsed .flow-editor-grid {
    grid-template-columns: 260px minmax(680px, 1fr) 0;
}

.flow-builder-premium.palette-collapsed.inspector-collapsed .flow-editor-grid {
    grid-template-columns: 0 minmax(680px, 1fr) 0;
}

.flow-builder-premium.palette-collapsed [data-builder-panel="palette"],
.flow-builder-premium.inspector-collapsed [data-builder-panel="inspector"] {
    width: 0;
    min-width: 0;
    border: 0;
    padding: 0;
    opacity: 0;
    overflow: hidden;
}

.flow-builder-premium .block-palette,
.flow-builder-premium .inspector {
    background: var(--surface-soft);
}

.flow-builder-premium .block-palette {
    border-right: 1px solid var(--line);
}

.flow-builder-premium .inspector {
    border-left: 1px solid var(--line);
}

.flow-builder-premium .block-button {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    min-height: 72px;
    margin-bottom: 9px;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.flow-builder-premium .block-button:hover {
    border-color: rgba(79, 70, 229, 0.42);
    box-shadow: 0 10px 22px rgba(25, 28, 45, 0.08);
    transform: translateY(-1px);
}

.block-icon,
.node-kind,
.quick-add-menu button span {
    display: grid;
    place-items: center;
    min-width: 36px;
    height: 28px;
    border-radius: 999px;
    background: var(--mint);
    color: var(--primary);
    font-size: 11px;
    font-weight: 950;
}

.flow-builder-premium .canvas-shell {
    min-height: calc(100vh - 246px);
    cursor: grab;
    background-color: #fbfbfe;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(79, 70, 229, 0.18) 1px, transparent 0),
        linear-gradient(rgba(221, 223, 235, 0.42) 1px, transparent 1px),
        linear-gradient(90deg, rgba(221, 223, 235, 0.42) 1px, transparent 1px);
    background-size: 24px 24px, 96px 96px, 96px 96px;
}

body.theme-dark .flow-builder-premium .canvas-shell {
    background-color: #121420;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(129, 140, 248, 0.22) 1px, transparent 0),
        linear-gradient(rgba(48, 51, 73, 0.52) 1px, transparent 1px),
        linear-gradient(90deg, rgba(48, 51, 73, 0.52) 1px, transparent 1px);
}

.flow-builder-premium .canvas-shell.is-panning {
    cursor: grabbing;
}

.flow-builder-premium .canvas-grid {
    width: 3200px;
    height: 2200px;
}

.flow-builder-premium .flow-edge {
    stroke-linecap: round;
    stroke-linejoin: round;
}

.flow-builder-premium .flow-edge.edge-no {
    stroke: rgba(190, 61, 90, 0.82);
}

.flow-builder-premium .flow-edge-label {
    paint-order: stroke;
    stroke: var(--surface);
    stroke-width: 6px;
}

.flow-builder-premium .flow-node {
    width: 286px;
    min-height: 148px;
    border-color: rgba(79, 70, 229, 0.18);
    box-shadow: 0 18px 34px rgba(25, 28, 45, 0.13);
    cursor: default;
}

.flow-builder-premium .flow-node.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15), 0 18px 34px rgba(25, 28, 45, 0.14);
}

.flow-builder-premium .flow-node header {
    align-items: start;
    padding: 12px;
    background: linear-gradient(135deg, #4f46e5, #1d4ed8);
    cursor: grab;
}

.flow-builder-premium .flow-node.dragging header {
    cursor: grabbing;
}

.flow-builder-premium .trigger-node {
    border-width: 2px;
    border-color: #4f46e5;
}

.flow-builder-premium .trigger-node header {
    background: linear-gradient(135deg, #15172a, #4f46e5);
}

.flow-builder-premium .flow-node[data-type="condition"] header,
.flow-builder-premium .flow-node[data-type="randomizer"] header {
    background: linear-gradient(135deg, #6d28d9, #3730a3);
}

.flow-builder-premium .flow-node[data-type="delay"] header,
.flow-builder-premium .flow-node[data-type="webhook"] header {
    background: linear-gradient(135deg, #a86412, #7c3aed);
}

.flow-builder-premium .flow-node[data-type="handoff"] header,
.flow-builder-premium .flow-node[data-type="end"] header {
    background: linear-gradient(135deg, #be3d5a, #7f1d1d);
}

.node-title-wrap {
    display: grid;
    min-width: 0;
    gap: 3px;
    flex: 1 1 auto;
}

.node-title-wrap strong,
.node-title-wrap small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.node-title-wrap small {
    color: rgba(255, 255, 255, 0.76);
    font-size: 11px;
    font-weight: 800;
}

.flow-builder-premium .node-actions {
    align-items: center;
    opacity: 0;
    transition: opacity 0.16s ease;
}

.flow-builder-premium .flow-node:hover .node-actions,
.flow-builder-premium .flow-node.selected .node-actions {
    opacity: 1;
}

.flow-builder-premium .node-actions button {
    width: auto;
    min-width: 0;
    height: 26px;
    border-radius: 999px;
    padding: 0 8px;
    font-size: 10px;
    font-weight: 900;
}

.flow-builder-premium .flow-node .node-body {
    min-height: 76px;
    padding: 12px;
}

.flow-builder-premium .node-body p {
    display: -webkit-box;
    max-height: 58px;
    margin: 0;
    overflow: hidden;
    color: var(--muted);
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.branch-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 9px;
}

.branch-preview span,
.handoff-chip,
.trigger-chip {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 3px 8px;
    background: var(--surface-strong);
    color: var(--text);
    font-size: 11px;
    font-weight: 900;
}

.handoff-chip {
    color: var(--coral);
    background: #fff1f3;
}

.trigger-chip {
    color: var(--primary);
    background: var(--mint);
}

.flow-builder-premium .node-outputs {
    display: grid;
    gap: 7px;
    padding: 0 12px 12px;
}

.output-add {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    border: 1px dashed rgba(79, 70, 229, 0.36);
    border-radius: 999px;
    background: var(--surface);
    color: var(--primary);
    padding: 4px 10px 4px 5px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 900;
}

.output-add:hover {
    border-style: solid;
    background: var(--mint);
}

.output-add span {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
}

.output-add.yes {
    color: var(--success);
    border-color: rgba(8, 116, 67, 0.34);
}

.output-add.yes span {
    background: var(--success);
}

.output-add.no {
    color: var(--coral);
    border-color: rgba(190, 61, 90, 0.34);
}

.output-add.no span {
    background: var(--coral);
}

.flow-builder-premium .node-port {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    box-shadow: 0 8px 18px rgba(25, 28, 45, 0.15);
}

.flow-builder-premium .node-port.input {
    color: var(--muted);
    border-color: var(--line);
}

.quick-add-menu {
    position: absolute;
    z-index: 30;
    display: grid;
    gap: 6px;
    width: 286px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.quick-add-menu strong {
    padding: 3px 4px 7px;
    font-size: 13px;
}

.quick-add-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text);
    padding: 5px 7px;
    text-align: left;
    cursor: pointer;
    font-weight: 850;
}

.quick-add-menu button:hover {
    border-color: rgba(79, 70, 229, 0.22);
    background: var(--mint);
}

.flow-builder-premium .minimap {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
}

body.theme-dark .flow-builder-premium .minimap {
    background: rgba(23, 25, 35, 0.9);
}

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

.version-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.is-dragging-flow,
.is-dragging-flow * {
    user-select: none !important;
}

@media (max-width: 1480px) {
    .flow-page {
        grid-template-columns: 270px minmax(0, 1fr);
    }

    .flow-command-bar {
        grid-template-columns: auto minmax(180px, 1fr) minmax(140px, 170px) 120px auto;
    }

    .flow-command-bar .save-indicator,
    .flow-command-bar .zoom-pill {
        justify-self: start;
    }
}

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

    .flow-list-rail {
        position: static;
        max-height: none;
    }

    .flow-builder-premium .flow-editor-grid,
    .flow-builder-premium.palette-collapsed .flow-editor-grid,
    .flow-builder-premium.inspector-collapsed .flow-editor-grid,
    .flow-builder-premium.palette-collapsed.inspector-collapsed .flow-editor-grid {
        grid-template-columns: 1fr;
    }

    .flow-builder-premium.palette-collapsed [data-builder-panel="palette"],
    .flow-builder-premium.inspector-collapsed [data-builder-panel="inspector"] {
        display: none;
    }
}

@media (max-width: 860px) {
    .flow-command-bar,
    .flow-meta-strip {
        grid-template-columns: 1fr;
    }

    .flow-actions {
        justify-content: flex-start;
    }

    .flow-onboarding {
        align-items: stretch;
        flex-direction: column;
    }

    .flow-builder-premium .canvas-grid {
        width: 2200px;
        height: 1600px;
    }
}

/* Product UX refactor */
.product-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
    gap: 16px;
    align-items: stretch;
    margin-bottom: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    background:
        linear-gradient(135deg, rgba(79, 70, 229, 0.10), rgba(255, 255, 255, 0) 52%),
        var(--surface);
    box-shadow: 0 18px 44px rgba(25, 28, 45, 0.07);
}

.product-hero h2 {
    max-width: 820px;
    margin: 8px 0;
    font-size: 28px;
    line-height: 1.1;
}

.product-hero p,
.channel-health-card p,
.inbox-state-copy span,
.form-section h3 + p {
    color: var(--muted);
}

.hero-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 3px 9px;
    color: var(--primary);
    background: var(--mint);
    font-size: 12px;
    font-weight: 950;
    text-transform: uppercase;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.channel-health-card {
    display: grid;
    align-content: center;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    background: var(--surface-soft);
}

.channel-health-card h3 {
    margin: 0;
    font-size: 20px;
}

.setup-meter {
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-strong);
}

.setup-meter span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), #7c3aed);
}

.compact-checklist {
    display: grid;
    gap: 7px;
    margin: 0;
}

.compact-checklist div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.compact-checklist dt,
.compact-checklist dd {
    margin: 0;
    font-size: 13px;
}

.compact-checklist dt {
    color: var(--muted);
    font-weight: 850;
}

.compact-checklist dd {
    font-weight: 950;
}

.next-steps-strip,
.crm-summary-strip,
.team-summary-strip,
.admin-command-strip,
.settings-command-strip,
.inbox-command-strip {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.next-steps-strip,
.crm-summary-strip,
.team-summary-strip,
.admin-command-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.crm-summary-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.next-steps-strip article,
.crm-summary-strip article,
.team-summary-strip article,
.admin-command-strip article {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    background: var(--surface);
    box-shadow: 0 12px 28px rgba(25, 28, 45, 0.05);
}

.next-steps-strip article {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px 12px;
}

.next-steps-strip article span {
    grid-row: span 2;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #fff;
    background: var(--primary);
    font-weight: 950;
}

.next-steps-strip p,
.admin-command-strip span,
.crm-summary-strip span,
.team-summary-strip span {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.crm-summary-strip strong,
.team-summary-strip strong {
    display: block;
    margin-top: 6px;
    font-size: 26px;
}

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

.quick-action-grid a {
    display: grid;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    color: var(--text);
    background: var(--surface-soft);
}

.quick-action-grid a:hover {
    border-color: rgba(79, 70, 229, 0.28);
    background: var(--mint);
}

.quick-action-grid small {
    color: var(--muted);
}

.channel-command {
    display: grid;
    gap: 14px;
}

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

.channel-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    background: var(--surface);
    box-shadow: 0 12px 30px rgba(25, 28, 45, 0.05);
}

.channel-card.selected {
    border-color: rgba(79, 70, 229, 0.34);
    background: var(--mint);
}

.channel-card.muted {
    opacity: 0.78;
}

.channel-card p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.channel-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #1d4ed8);
    font-weight: 950;
}

.integration-setup-shell,
.studio-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
    gap: 16px;
    align-items: start;
    margin-bottom: 16px;
}

.setup-journey,
.technical-card,
.studio-main,
.studio-side {
    min-width: 0;
}

.setup-steps,
.studio-steps {
    display: grid;
    gap: 10px;
}

.setup-step {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    background: var(--surface-soft);
}

.setup-step span {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--primary);
    background: var(--mint);
    font-weight: 950;
}

.setup-step.done span {
    color: #fff;
    background: var(--success);
}

.setup-step.current {
    border-color: rgba(79, 70, 229, 0.28);
}

.setup-step p {
    margin: 4px 0 0;
    color: var(--muted);
}

.advanced-config,
.filter-drawer {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px;
    background: var(--surface-soft);
}

.advanced-config summary,
.filter-drawer summary {
    cursor: pointer;
    font-weight: 950;
}

.advanced-config .form-grid,
.filter-drawer .form-grid,
.filter-drawer form {
    margin-top: 10px;
}

.webhook-bar {
    grid-template-columns: minmax(150px, 0.7fr) minmax(240px, 1fr) minmax(220px, 1fr) auto;
}

.studio-steps {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 14px;
}

.studio-steps span {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 10px;
    color: var(--muted);
    background: var(--surface-soft);
    font-size: 12px;
    font-weight: 950;
    text-align: center;
}

.studio-steps span.active {
    color: var(--primary);
    border-color: rgba(79, 70, 229, 0.28);
    background: var(--mint);
}

.form-section {
    display: grid;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    background: var(--surface-soft);
}

.form-section h3 {
    margin: 0;
    font-size: 15px;
}

.studio-side {
    display: grid;
    gap: 16px;
}

.preview-panel {
    position: sticky;
    top: 86px;
}

.analytics-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
    gap: 14px;
    align-items: end;
}

.analytics-toolbar h2 {
    margin: 0 0 4px;
}

.analytics-toolbar p {
    margin: 0;
    color: var(--muted);
}

.analytics-filter {
    grid-template-columns: 1fr 1fr auto;
    margin-bottom: 0;
}

.chart-legend {
    display: flex;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.chart-legend span:before {
    content: "";
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 5px;
    border-radius: 50%;
    background: var(--primary);
}

.chart-legend span + span:before {
    background: var(--violet);
}

.executive-chart {
    min-height: 250px;
}

.product-table {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.product-table table {
    border-collapse: separate;
    border-spacing: 0;
}

.product-table th,
.product-table td {
    padding: 13px 11px;
}

.product-table tr:last-child td {
    border-bottom: 0;
}

.inbox-command-strip {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px;
    background: var(--surface);
    box-shadow: 0 12px 28px rgba(25, 28, 45, 0.05);
}

.queue-tabs {
    display: inline-grid;
    grid-template-columns: repeat(3, auto);
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 4px;
    background: var(--surface-soft);
}

.queue-tabs a {
    border-radius: 6px;
    padding: 8px 11px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
}

.queue-tabs a.active {
    color: var(--primary);
    background: var(--surface);
    box-shadow: 0 8px 20px rgba(25, 28, 45, 0.07);
}

.inbox-state-copy {
    display: grid;
    justify-items: end;
    gap: 2px;
    text-align: right;
}

.inbox-product {
    min-height: calc(100vh - 230px);
}

.inbox-product .premium-list,
.inbox-product .premium-chat,
.inbox-product .contact-context {
    min-height: calc(100vh - 230px);
}

.inbox-product .sticky-filter {
    gap: 10px;
}

.premium-window {
    background: linear-gradient(90deg, var(--surface-soft), var(--surface));
}

.contextual-side .panel.soft {
    background: var(--surface);
}

.settings-command-strip {
    grid-template-columns: repeat(4, auto);
    justify-content: start;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 6px;
    background: var(--surface);
}

.settings-command-strip a {
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--muted);
    font-weight: 900;
}

.settings-command-strip a.active,
.settings-command-strip a:hover {
    color: var(--primary);
    background: var(--mint);
}

.team-summary-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.team-actions-grid .panel {
    background: linear-gradient(180deg, var(--surface), var(--surface-soft));
}

.admin-command-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pricing-product .pricing-card {
    display: grid;
    gap: 12px;
}

.pricing-product .pricing-card.selected {
    background:
        linear-gradient(135deg, rgba(79, 70, 229, 0.09), rgba(255, 255, 255, 0)),
        var(--surface);
}

.rail-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    background: var(--surface);
    box-shadow: 0 14px 34px rgba(25, 28, 45, 0.06);
}

.rail-heading small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
}

.flow-focus-page {
    grid-template-columns: 260px minmax(0, 1fr);
}

.flow-focus-page .flow-list-rail {
    gap: 10px;
}

.flow-focus-page .flow-search-card,
.flow-focus-page .rail-details {
    box-shadow: none;
}

@media (max-width: 1180px) {
    .product-hero,
    .integration-setup-shell,
    .studio-shell,
    .analytics-toolbar,
    .inbox-command-strip {
        grid-template-columns: 1fr;
    }

    .channel-grid,
    .next-steps-strip,
    .crm-summary-strip,
    .team-summary-strip,
    .admin-command-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .preview-panel {
        position: static;
    }

    .inbox-state-copy {
        justify-items: start;
        text-align: left;
    }
}

@media (max-width: 760px) {
    body.sidebar-collapsed .app-shell,
    .app-shell {
        --sidebar-width: 1fr;
    }

    body.sidebar-collapsed .brand-copy,
    body.sidebar-collapsed .nav-text,
    body.sidebar-collapsed .nav-group-label,
    body.sidebar-collapsed .sidebar-card {
        display: block;
    }

    .brand-row,
    .sidebar-primary-action,
    .nav a {
        justify-content: flex-start;
    }

    .sidebar-collapse-button {
        display: none;
    }

    .topbar-cta,
    .page-action {
        width: 100%;
    }

    .page-heading,
    .topbar-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .channel-grid,
    .next-steps-strip,
    .crm-summary-strip,
    .team-summary-strip,
    .admin-command-strip,
    .studio-steps,
    .quick-action-grid,
    .webhook-bar,
    .analytics-filter {
        grid-template-columns: 1fr;
    }
}

/* UI/UX V2 structural redesign */
:root {
    --bg: #f6f5f2;
    --surface: #ffffff;
    --surface-soft: #f3f2ee;
    --surface-strong: #e9e7df;
    --sidebar: #12131a;
    --sidebar-line: rgba(255, 255, 255, 0.10);
    --text: #202126;
    --muted: #72737d;
    --line: #e3e0d8;
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --mint: #eef2ff;
    --shadow: 0 18px 42px rgba(30, 31, 38, 0.08);
    --sidebar-width: 224px;
}

body {
    background: var(--bg);
}

.main {
    padding: 24px 28px 32px;
}

.sidebar {
    gap: 14px;
    padding: 16px 12px;
    background: #12131a;
    border-right: 0;
    box-shadow: 14px 0 34px rgba(18, 19, 26, 0.08);
}

.brand-row {
    min-height: 48px;
    padding: 2px 4px 12px;
    border-bottom: 1px solid var(--sidebar-line);
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: #f4f2ff;
    color: var(--primary);
}

.brand-copy strong {
    font-size: 13px;
    letter-spacing: 0;
}

.brand-copy small {
    color: #8f95aa;
}

.nav {
    gap: 6px;
    overflow: visible;
}

.nav a {
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    color: #abb0c2;
    padding: 8px 10px;
    font-size: 13px;
}

.nav a.active {
    color: #202126;
    background: #ffffff;
    box-shadow: none;
}

.nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.nav a.active:hover {
    color: #202126;
    background: #ffffff;
}

.nav-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #c9cdf7;
    font-size: 10px;
}

.nav a.active .nav-icon {
    background: var(--primary);
    color: #fff;
}

.sidebar-mini-link {
    margin-top: auto;
    border: 1px solid var(--sidebar-line);
    border-radius: 8px;
    padding: 10px;
    color: #c9cdf7;
    font-size: 12px;
    font-weight: 900;
    text-align: center;
}

.sidebar-mini-link:hover {
    background: rgba(255, 255, 255, 0.08);
}

body.sidebar-collapsed .app-shell {
    --sidebar-width: 76px;
}

body.sidebar-collapsed .sidebar {
    padding-inline: 10px;
}

body.sidebar-collapsed .sidebar-mini-link {
    width: 44px;
    height: 44px;
    overflow: hidden;
    padding: 0;
    font-size: 0;
}

body.sidebar-collapsed .sidebar-mini-link:before {
    content: "CF";
    display: grid;
    place-items: center;
    height: 100%;
    color: #c9cdf7;
    font-size: 10px;
}

.topbar {
    min-height: 64px;
    margin: -24px -28px 22px;
    padding: 12px 28px;
    border-bottom: 1px solid rgba(32, 33, 38, 0.06);
    background: rgba(246, 245, 242, 0.9);
    box-shadow: none;
}

body.theme-dark .topbar {
    background: rgba(16, 17, 22, 0.9);
}

.workspace-switcher {
    min-width: 190px;
}

.workspace-avatar,
.avatar {
    border-radius: 8px;
    background: #23243a;
}

.global-search input {
    border-color: transparent;
    background: rgba(255, 255, 255, 0.82);
}

.account-menu {
    position: relative;
}

.account-menu summary {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 190px;
    list-style: none;
    border: 1px solid rgba(32, 33, 38, 0.08);
    border-radius: 8px;
    padding: 6px 9px;
    background: rgba(255, 255, 255, 0.82);
    cursor: pointer;
}

.account-menu summary::-webkit-details-marker {
    display: none;
}

.account-menu summary strong,
.account-menu summary small {
    display: block;
}

.account-menu summary strong {
    font-size: 13px;
}

.account-menu summary small {
    color: var(--muted);
    font-size: 12px;
}

.account-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 80;
    display: grid;
    gap: 4px;
    min-width: 210px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.account-menu-panel a,
.account-menu-panel button {
    width: 100%;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    padding: 9px 10px;
    text-align: left;
    cursor: pointer;
    font-weight: 850;
}

.account-menu-panel a:hover,
.account-menu-panel button:hover {
    background: var(--surface-soft);
}

.page-heading {
    margin-bottom: 20px;
}

.page-heading h1 {
    font-size: 28px;
}

.panel,
.metric,
.conversation-list,
.chat-panel,
.contact-context {
    border: 0;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel.soft {
    background: rgba(255, 255, 255, 0.64);
}

.metric:after {
    display: none;
}

.compact-metrics {
    gap: 10px;
}

.compact-metrics .metric,
.crm-summary-strip article,
.team-summary-strip article,
.next-steps-strip article,
.admin-command-strip article {
    border: 0;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 12px 28px rgba(30, 31, 38, 0.06);
}

.next-steps-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.module-command {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
    border: 0;
    border-radius: 8px;
    padding: 20px;
    background:
        linear-gradient(135deg, rgba(79, 70, 229, 0.10), rgba(255, 255, 255, 0) 44%),
        rgba(255, 255, 255, 0.86);
    box-shadow: var(--shadow);
}

.module-command h2 {
    margin: 6px 0 4px;
    font-size: 26px;
    line-height: 1.1;
}

.module-command p {
    max-width: 760px;
    margin: 0;
    color: var(--muted);
}

.module-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.manager-panel {
    padding: 14px;
}

.manager-toolbar {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) auto;
    gap: 10px;
    margin-bottom: 12px;
}

.automation-filter-bar {
    grid-template-columns: minmax(260px, 1fr) 170px 190px auto;
}

.product-table {
    border: 0;
    border-radius: 8px;
    overflow: visible;
}

.product-table th {
    background: #f6f5f2;
}

.product-table td,
.product-table th {
    border-color: rgba(32, 33, 38, 0.08);
}

.row-menu {
    position: relative;
}

.row-menu summary {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    list-style: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 950;
}

.row-menu summary::-webkit-details-marker {
    display: none;
}

.row-menu > div {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 35;
    display: grid;
    gap: 4px;
    min-width: 150px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.row-menu a,
.row-menu button {
    width: 100%;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    padding: 8px 9px;
    text-align: left;
    cursor: pointer;
    font-weight: 850;
}

.row-menu a:hover,
.row-menu button:hover {
    background: var(--surface-soft);
}

.danger-text {
    color: var(--danger) !important;
}

.app-drawer {
    position: fixed;
    top: 18px;
    right: 18px;
    bottom: 18px;
    z-index: 100;
    display: grid;
    align-content: start;
    gap: 14px;
    width: min(440px, calc(100vw - 36px));
    overflow: auto;
    border: 1px solid rgba(32, 33, 38, 0.10);
    border-radius: 8px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 28px 80px rgba(18, 19, 26, 0.24);
}

.app-drawer.wide {
    width: min(860px, calc(100vw - 36px));
}

.drawer-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
}

.drawer-header h2 {
    margin: 0;
    font-size: 20px;
}

.drawer-header p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.drawer-list {
    margin-top: 4px;
}

.drawer-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 16px;
    align-items: start;
}

.inline-preview {
    position: sticky;
    top: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: var(--surface-soft);
}

.bulk-bar {
    grid-template-columns: auto 170px minmax(180px, 1fr) auto;
}

.bulk-bar > span {
    color: var(--muted);
    font-weight: 900;
}

.list-first {
    grid-template-columns: minmax(0, 1fr) 320px;
}

.contact-inspector {
    position: sticky;
    top: 86px;
}

.empty-context {
    display: grid;
    gap: 4px;
    min-height: 180px;
    align-content: center;
}

.empty-context h2,
.empty-context p {
    margin: 0;
}

.settings-command-strip {
    grid-template-columns: repeat(7, auto);
    overflow-x: auto;
}

.settings-hub {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.settings-hub-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 4px 12px;
    align-items: center;
    min-height: 92px;
    border-radius: 8px;
    padding: 14px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 12px 30px rgba(30, 31, 38, 0.06);
}

.settings-hub-card:hover {
    background: #fff;
    box-shadow: 0 18px 42px rgba(30, 31, 38, 0.10);
}

.settings-hub-card span {
    grid-row: span 2;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: var(--mint);
    color: var(--primary);
    font-size: 11px;
    font-weight: 950;
}

.settings-hub-card small {
    color: var(--muted);
}

.oauth-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
    border-radius: 8px;
    padding: 14px;
    background: #f6f5f2;
}

.oauth-card p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.manual-fallback .advanced-config {
    background: #f8f7f4;
}

.manual-fallback .advanced-config form {
    margin-top: 12px;
}

.wizard-steps {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.preview-section .template-preview-phone {
    margin-inline: 0;
}

.queue-tabs {
    grid-template-columns: repeat(4, auto);
}

.queue-filter-popover {
    padding: 8px 10px;
}

.queue-filter-popover:not([open]) {
    border-color: transparent;
    background: transparent;
    padding-inline: 0;
}

.inbox-product {
    grid-template-columns: 320px minmax(460px, 1fr) 320px;
    gap: 12px;
}

.inbox-product .premium-list,
.inbox-product .premium-chat,
.inbox-product .contact-context {
    border: 0;
}

.conversation-card {
    border-radius: 8px;
}

.message-bubble {
    border: 0;
    border-radius: 8px;
}

body.admin-shell {
    --bg: #f4f6f8;
    --sidebar: #090b12;
    --primary: #5b5cf0;
}

body.admin-shell .sidebar {
    background: #090b12;
}

body.admin-shell .brand-mark {
    background: #ffffff;
    color: #090b12;
}

body.admin-shell .nav a.active .nav-icon {
    background: #090b12;
}

body.admin-shell .module-command,
body.admin-shell .admin-command-strip article {
    background: #ffffff;
}

body.focus-shell {
    overflow: hidden;
}

body.focus-shell .app-shell {
    --sidebar-width: 76px;
}

body.focus-shell .topbar,
body.focus-shell .page-heading {
    display: none;
}

body.focus-shell .main {
    padding: 0;
}

body.focus-shell .sidebar {
    z-index: 70;
}

.flow-focus-editor {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    height: 100vh;
    min-height: 720px;
    background: #f1f0ec;
}

.flow-focus-bar {
    display: grid;
    grid-template-columns: auto minmax(220px, 1fr) 180px 136px minmax(420px, auto) auto auto;
    gap: 8px;
    align-items: center;
    min-height: 62px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(32, 33, 38, 0.08);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
}

.focus-title {
    min-width: 0;
}

.flow-focus-bar .flow-title-input {
    height: 40px;
    border-color: transparent;
    background: transparent;
    font-size: 18px;
}

.flow-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.flow-focus-bar .save-indicator,
.flow-focus-bar .zoom-pill.inline {
    position: static;
    justify-self: auto;
}

.focus-onboarding {
    margin: 10px 12px 0;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 24px rgba(30, 31, 38, 0.06);
}

.focus-canvas-wrap {
    position: relative;
    min-height: 0;
    overflow: hidden;
}

.flow-focus-editor .canvas-shell {
    height: 100%;
    min-height: 0;
    border: 0;
    border-radius: 0;
    background-color: #f8f7f4;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(79, 70, 229, 0.16) 1px, transparent 0),
        linear-gradient(rgba(32, 33, 38, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(32, 33, 38, 0.04) 1px, transparent 1px);
    background-size: 24px 24px, 120px 120px, 120px 120px;
}

.flow-focus-editor .canvas-grid {
    width: 4200px;
    height: 2800px;
}

.floating-add-button {
    position: absolute;
    left: 22px;
    bottom: 26px;
    z-index: 38;
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    box-shadow: 0 18px 42px rgba(79, 70, 229, 0.35);
    cursor: pointer;
    font-size: 28px;
    font-weight: 850;
}

.floating-add-button:hover {
    background: var(--primary-dark);
}

.builder-drawer {
    position: absolute;
    top: 16px;
    bottom: 16px;
    z-index: 45;
    display: grid;
    align-content: start;
    gap: 14px;
    width: min(390px, calc(100% - 32px));
    overflow: auto;
    border: 1px solid rgba(32, 33, 38, 0.10);
    border-radius: 8px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 24px 70px rgba(18, 19, 26, 0.18);
}

.block-drawer {
    left: 16px;
}

.inspector-drawer {
    right: 16px;
}

.block-drawer-section {
    display: grid;
    gap: 8px;
}

.block-drawer-section > span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 950;
    text-transform: uppercase;
}

.builder-drawer .block-button {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    margin: 0;
    border: 1px solid rgba(32, 33, 38, 0.08);
    box-shadow: none;
}

.block-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--mint);
    color: var(--primary);
    font-size: 11px;
    font-weight: 950;
}

.drawer-type-badge {
    justify-self: start;
}

.flow-focus-editor .flow-node {
    width: 272px;
    min-height: 130px;
    overflow: visible;
    border: 1px solid rgba(32, 33, 38, 0.10);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 14px 34px rgba(30, 31, 38, 0.14);
    cursor: default;
}

.flow-focus-editor .flow-node.selected {
    border-color: rgba(79, 70, 229, 0.38);
    border-left-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.16), 0 18px 40px rgba(30, 31, 38, 0.18);
}

.flow-focus-editor .flow-node header {
    align-items: flex-start;
    border-bottom: 1px solid rgba(32, 33, 38, 0.07);
    border-radius: 8px 8px 0 0;
    color: var(--text);
    background: #fff;
    cursor: grab;
}

.flow-focus-editor .trigger-node {
    border-left-color: #11131a;
}

.flow-focus-editor .flow-node[data-type="condition"],
.flow-focus-editor .flow-node[data-type="randomizer"] {
    border-left-color: #6d28d9;
}

.flow-focus-editor .flow-node[data-type="delay"],
.flow-focus-editor .flow-node[data-type="webhook"] {
    border-left-color: #a86412;
}

.flow-focus-editor .flow-node[data-type="handoff"],
.flow-focus-editor .flow-node[data-type="end"] {
    border-left-color: #be3d5a;
}

.flow-focus-editor .node-kind {
    display: grid;
    place-items: center;
    min-width: 34px;
    height: 30px;
    border-radius: 8px;
    background: #f1f0ec;
    color: var(--primary);
    font-size: 10px;
    font-weight: 950;
}

.flow-focus-editor .node-title-wrap small {
    color: var(--muted);
}

.flow-focus-editor .node-actions {
    display: flex;
    opacity: 0;
    transition: opacity 0.16s ease;
}

.flow-focus-editor .flow-node:hover .node-actions,
.flow-focus-editor .flow-node.selected .node-actions {
    opacity: 1;
}

.flow-focus-editor .node-actions button {
    width: auto;
    height: 24px;
    border: 0;
    border-radius: 999px;
    background: #f3f2ee;
    color: var(--muted);
    padding: 0 7px;
    font-size: 10px;
}

.flow-focus-editor .flow-node .node-body {
    min-height: 58px;
    padding: 10px 12px;
}

.flow-focus-editor .node-body p {
    display: -webkit-box;
    max-height: 54px;
    margin: 0;
    overflow: hidden;
    color: var(--text);
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.flow-focus-editor .flow-node[data-type="message"] .node-body p {
    display: inline-block;
    max-width: 100%;
    border-radius: 8px;
    padding: 9px 10px;
    background: #eef2ff;
    color: #27264f;
}

.flow-focus-editor .flow-node[data-type="condition"] .branch-preview span:first-child {
    color: var(--success);
    background: #ecfdf3;
}

.flow-focus-editor .flow-node[data-type="condition"] .branch-preview span:last-child {
    color: var(--danger);
    background: #fef3f2;
}

.flow-focus-editor .node-outputs {
    display: grid;
    gap: 6px;
    padding: 0 12px 12px;
}

.flow-focus-editor .message-choice-preview {
    display: grid;
    gap: 5px;
    margin-top: 8px;
}

.flow-focus-editor .message-choice-preview span {
    display: block;
    border: 1px solid rgba(79, 70, 229, 0.18);
    border-radius: 6px;
    padding: 6px 8px;
    background: #fff;
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
    text-align: center;
}

.flow-focus-editor .choice-hint,
.flow-focus-editor .output-empty {
    display: block;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}

.flow-focus-editor .output-empty {
    border: 1px dashed rgba(79, 70, 229, 0.24);
    border-radius: 6px;
    padding: 8px;
    text-align: center;
}

.flow-focus-editor .output-add {
    min-height: 30px;
    border-color: rgba(79, 70, 229, 0.24);
    background: #fff;
}

.flow-focus-editor .output-add.message-choice {
    justify-content: flex-start;
    gap: 8px;
    padding-inline: 10px;
    color: var(--primary);
    text-align: left;
}

.message-buttons-editor {
    display: grid;
    gap: 10px;
    margin: 0;
    border: 1px solid rgba(32, 33, 38, 0.10);
    border-radius: 8px;
    padding: 12px;
    background: #f8f8f6;
}

.message-buttons-editor legend {
    padding: 0 5px;
    color: var(--text);
    font-size: 13px;
    font-weight: 900;
}

.message-buttons-editor p,
.message-buttons-editor small,
.message-buttons-editor .empty-inline {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.message-button-list {
    display: grid;
    gap: 7px;
}

.message-button-row {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) 32px;
    gap: 7px;
    align-items: center;
}

.message-button-row > span {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e9e7ff;
    color: var(--primary);
    font-size: 11px;
    font-weight: 900;
}

.message-button-row input {
    min-width: 0;
}

.message-button-row .icon-button {
    width: 32px;
    height: 32px;
    color: var(--danger);
}

.flow-focus-editor .node-port {
    display: grid;
    place-items: center;
    box-shadow: 0 10px 24px rgba(30, 31, 38, 0.16);
}

.flow-focus-editor .flow-node.simulator-current {
    border-color: #16a36a;
    border-left-color: #16a36a;
    box-shadow: 0 0 0 4px rgba(22, 163, 106, 0.16), 0 18px 40px rgba(30, 31, 38, 0.18);
}

.flow-focus-editor .minimap {
    right: 18px;
    bottom: 18px;
}

.focus-status-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 42px;
    align-items: center;
    padding: 8px 14px;
    border-top: 1px solid rgba(32, 33, 38, 0.08);
    background: rgba(255, 255, 255, 0.92);
}

.flow-simulator {
    position: absolute;
    z-index: 36;
    top: 16px;
    right: 16px;
    bottom: 16px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: min(370px, calc(100% - 32px));
    border: 1px solid rgba(32, 33, 38, 0.14);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 24px 70px rgba(20, 22, 30, 0.24);
}

.flow-simulator.hidden {
    display: none;
}

.simulator-toolbar,
.simulator-whatsapp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.simulator-toolbar {
    min-height: 62px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(32, 33, 38, 0.10);
}

.simulator-toolbar > div,
.simulator-whatsapp-header > div {
    display: grid;
    gap: 2px;
}

.simulator-toolbar > div:last-child {
    display: flex;
    gap: 6px;
}

.simulator-toolbar small,
.simulator-whatsapp-header small {
    color: var(--muted);
    font-size: 11px;
}

.simulator-phone {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-height: 0;
    background: #eef0ec;
}

.simulator-whatsapp-header {
    justify-content: flex-start;
    gap: 10px;
    min-height: 58px;
    padding: 9px 12px;
    background: #0b6756;
    color: #fff;
}

.simulator-whatsapp-header small {
    color: rgba(255, 255, 255, 0.78);
}

.simulator-avatar {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fff;
    color: #0b6756;
    font-size: 11px;
    font-weight: 950;
}

.simulator-chat {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    padding: 14px 12px;
    overflow-y: auto;
    background: #e9e5df;
}

.embedded-signup-card {
    align-items: flex-start;
}

.embedded-signup-copy {
    display: grid;
    flex: 1;
    gap: 8px;
    min-width: 0;
}

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

.connection-mode label {
    position: relative;
    display: block;
    cursor: pointer;
}

.connection-mode input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.connection-mode span {
    display: grid;
    gap: 3px;
    min-height: 74px;
    border: 1px solid rgba(32, 33, 38, 0.12);
    border-radius: 8px;
    padding: 10px;
    background: #fff;
}

.connection-mode input:checked + span {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.12);
}

.connection-mode small {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}

.embedded-signup-status {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.embedded-signup-status.warning {
    color: #8a5a10;
}

.embedded-signup-status.error {
    color: var(--danger);
}

.embedded-signup-status.success {
    color: #087a4d;
}

@media (max-width: 820px) {
    .connection-mode {
        grid-template-columns: 1fr;
    }

    .embedded-signup-card {
        grid-template-columns: 1fr;
    }

    .flow-simulator {
        top: 8px;
        right: 8px;
        bottom: 8px;
        width: calc(100% - 16px);
    }
}

.simulator-bubble {
    max-width: 84%;
    border-radius: 7px;
    padding: 9px 10px;
    color: #202126;
    background: #fff;
    box-shadow: 0 1px 2px rgba(20, 22, 30, 0.10);
    font-size: 13px;
    line-height: 1.45;
    white-space: pre-wrap;
}

.simulator-bubble.user {
    align-self: flex-end;
    background: #d8f8c8;
}

.simulator-event {
    align-self: center;
    max-width: 90%;
    border-radius: 6px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.72);
    color: #66675f;
    font-size: 10px;
    text-align: center;
}

.simulator-event.error {
    color: var(--danger);
    background: #fff1f2;
}

.simulator-event.success {
    color: #087a4d;
    background: #ecfdf3;
}

.simulator-actions {
    display: grid;
    gap: 7px;
    padding: 10px;
    border-top: 1px solid rgba(32, 33, 38, 0.08);
    background: #f8f8f6;
}

.simulator-choice {
    width: 100%;
    min-height: 34px;
    border: 1px solid rgba(11, 103, 86, 0.22);
    border-radius: 6px;
    background: #fff;
    color: #08705d;
    font-weight: 850;
}

.simulator-input-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
}

.simulator-stop {
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.focus-status-strip span {
    border-radius: 999px;
    padding: 5px 9px;
    background: #f1f0ec;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

@media (max-width: 1280px) {
    .flow-focus-bar {
        grid-template-columns: auto minmax(220px, 1fr) 150px 130px;
    }

    .flow-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .flow-focus-bar .save-indicator,
    .flow-focus-bar .zoom-pill.inline {
        grid-row: 1;
    }
}

@media (max-width: 1180px) {
    .settings-hub,
    .list-first,
    .inbox-product,
    .drawer-split,
    .integration-setup-shell {
        grid-template-columns: 1fr;
    }

    .contact-inspector,
    .inline-preview {
        position: static;
    }

    .queue-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .module-command,
    .drawer-header,
    .oauth-card {
        align-items: stretch;
        flex-direction: column;
    }

    .module-command {
        display: grid;
    }

    .module-actions,
    .flow-actions {
        justify-content: flex-start;
    }

    .manager-toolbar,
    .automation-filter-bar,
    .bulk-bar,
    .wizard-steps,
    .settings-hub {
        grid-template-columns: 1fr;
    }

    .flow-focus-bar {
        grid-template-columns: 1fr;
        overflow: auto;
    }

    .builder-drawer,
    .block-drawer,
    .inspector-drawer {
        left: 10px;
        right: 10px;
        width: auto;
    }
}
