:root {
    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --border: #E2E8F0;
    --text: #0F172A;
    --muted: #64748B;
    --sidebar: #0F172A;
    --sidebar-muted: #94A3B8;
    --primary: #059669;
    --primary-hover: #047857;
    --danger: #DC2626;
    --warning: #D97706;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 1px 3px rgba(0, 0, 0, .06);
    --sidebar-width: 260px;
    --sidebar-rail-width: 72px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

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

.auth-shell {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: clamp(1.25rem, 4vw, 3rem);
}

.auth-card {
    width: min(100%, 28rem);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    background: var(--surface);
    box-shadow: 0 18px 48px rgba(15, 23, 42, .1), var(--shadow);
    padding: clamp(1.5rem, 5vw, 2.25rem);
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    color: var(--text);
    font-size: 1rem;
    font-weight: 750;
    letter-spacing: -.025em;
}

.auth-brand:hover {
    color: var(--text);
}

.auth-brand__name {
    line-height: 1.2;
}

.auth-card .flash-stack {
    margin-top: 1.5rem;
}

.auth-card__header {
    margin: 1.75rem 0 1.5rem;
}

.auth-card__eyebrow {
    margin: 0 0 .4rem;
    color: var(--primary);
    font-size: .7rem;
    font-weight: 750;
    letter-spacing: .085em;
    text-transform: uppercase;
}

.auth-card__title {
    margin: 0;
    color: var(--text);
    font-size: 1.65rem;
    font-weight: 750;
    letter-spacing: -.045em;
    line-height: 1.15;
}

.auth-card__description {
    margin: .55rem 0 0;
    color: var(--muted);
    font-size: .9rem;
}

.auth-form {
    display: grid;
    gap: 1rem;
}

.auth-form__options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-top: -.15rem;
}

.auth-form__options .form-check {
    min-width: 0;
}

.auth-form__options .form-check-label {
    color: #475569;
    font-size: .8125rem;
}

.auth-link,
.auth-back-link {
    color: var(--primary);
    font-size: .8125rem;
    font-weight: 650;
}

.auth-link:hover,
.auth-back-link:hover {
    color: var(--primary-hover);
}

.auth-submit {
    width: 100%;
    margin-top: .25rem;
}

.auth-back-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-top: 1.35rem;
}

.auth-back-link svg {
    width: 1rem;
    height: 1rem;
    stroke-width: 2.25;
}

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

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

a:hover {
    color: var(--primary-hover);
}

.app-shell {
    min-height: 100vh;
}

.app-sidebar {
    position: fixed;
    z-index: 1040;
    inset: 0 auto 0 0;
    display: flex;
    width: var(--sidebar-width);
    flex-direction: column;
    overflow: hidden;
    background: var(--sidebar);
    border-right: 1px solid rgba(148, 163, 184, .12);
    color: #fff;
    transition: width .2s ease, transform .2s ease;
}

.app-sidebar__brand {
    display: flex;
    min-height: 88px;
    align-items: center;
    gap: .75rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(148, 163, 184, .14);
    color: #fff;
}

.app-sidebar__brand:hover {
    color: #fff;
}

.brand-mark {
    display: inline-flex;
    width: 2rem;
    height: 2rem;
    flex: 0 0 2rem;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(110, 231, 183, .5);
    border-radius: 10px;
    background: rgba(5, 150, 105, .16);
    color: #34d399;
}

.brand-mark svg {
    width: 1.15rem;
    height: 1.15rem;
    stroke-width: 2.25;
}

.brand-name {
    min-width: 0;
    color: #f8fafc;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -.025em;
    line-height: 1.2;
    white-space: nowrap;
}

.sidebar-nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: .25rem;
    padding: 1.25rem .75rem;
}

.sidebar-nav__divider {
    height: 1px;
    margin: .65rem .5rem;
    background: rgba(148, 163, 184, .2);
}

.sidebar-nav__link {
    display: flex;
    min-height: 44px;
    align-items: center;
    gap: .875rem;
    border-radius: 9px;
    color: var(--sidebar-muted);
    font-weight: 600;
    padding: .65rem .875rem;
    transition: background-color .15s ease, color .15s ease;
    white-space: nowrap;
}

.sidebar-nav__link:hover {
    background: rgba(148, 163, 184, .1);
    color: #f8fafc;
}

.sidebar-nav__link.is-active {
    background: var(--primary);
    box-shadow: 0 8px 18px rgba(5, 150, 105, .22);
    color: #fff;
}

.sidebar-nav__link svg,
.sidebar-nav__link i {
    width: 1.25rem;
    height: 1.25rem;
    flex: 0 0 1.25rem;
    stroke-width: 2;
}

.sidebar-nav__label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-sidebar__footer {
    padding: .75rem;
}

.sidebar-logout-form {
    margin-bottom: .25rem;
}

.sidebar-logout-button {
    color: #fca5a5;
}

.sidebar-logout-button:hover,
.sidebar-logout-button:focus-visible {
    background: rgba(239, 68, 68, .12);
    color: #fecaca;
}

.sidebar-collapse-button {
    display: flex;
    width: 100%;
    min-height: 42px;
    align-items: center;
    gap: .875rem;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--sidebar-muted);
    font-weight: 600;
    padding: .625rem .875rem;
    text-align: left;
}

.sidebar-collapse-button:hover,
.sidebar-collapse-button:focus-visible {
    background: rgba(148, 163, 184, .1);
    color: #fff;
}

.sidebar-collapse-button svg,
.sidebar-collapse-button i {
    width: 1.25rem;
    height: 1.25rem;
    flex: 0 0 1.25rem;
}

.app-main {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    transition: margin-left .2s ease;
}

.app-topbar {
    position: sticky;
    z-index: 1020;
    top: 0;
    display: flex;
    min-height: 88px;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: rgba(255, 255, 255, .95);
    border-bottom: 1px solid var(--border);
    padding: 0 clamp(1.25rem, 3vw, 3rem);
    backdrop-filter: blur(12px);
}

.app-topbar__leading,
.app-topbar__actions {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.app-topbar__title {
    margin: 0;
    color: var(--text);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -.03em;
}

.mobile-menu-button,
.icon-button {
    display: inline-flex;
    width: 2.5rem;
    height: 2.5rem;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--muted);
    transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}

.mobile-menu-button:hover,
.icon-button:hover,
.mobile-menu-button:focus-visible,
.icon-button:focus-visible {
    border-color: #a7f3d0;
    background: #ecfdf5;
    color: var(--primary);
}

.mobile-menu-button svg,
.icon-button svg,
.button-icon svg,
.btn svg {
    width: 1.05rem;
    height: 1.05rem;
    stroke-width: 2.25;
}

.app-content {
    width: min(100%, 1440px);
    margin: 0 auto;
    padding: clamp(1.5rem, 3vw, 3rem);
}

.page-stack {
    display: grid;
    gap: 1.5rem;
}

.page-intro {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .1rem;
}

.page-intro__eyebrow {
    margin: 0 0 .4rem;
    color: var(--muted);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.page-intro__title {
    margin: 0;
    color: var(--text);
    font-size: clamp(1.55rem, 2.5vw, 2.125rem);
    font-weight: 750;
    letter-spacing: -.045em;
    line-height: 1.15;
}

.page-intro__description {
    max-width: 48rem;
    margin: .5rem 0 0;
    color: var(--muted);
    font-size: .975rem;
}

.app-card,
.table-card,
.metric-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.app-card__header,
.table-card__header {
    display: flex;
    min-height: 68px;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
}

.app-card__title,
.table-card__title {
    margin: 0;
    color: var(--text);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

.app-card__meta,
.table-card__meta {
    margin: .2rem 0 0;
    color: var(--muted);
    font-size: .8125rem;
}

.app-card__body {
    padding: 1.5rem;
}

.app-card__footer,
.table-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-top: 1px solid var(--border);
    padding: 1rem 1.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(11rem, 1fr) minmax(8rem, .55fr) auto;
    align-items: end;
    gap: 1rem;
}

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

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

.form-field {
    min-width: 0;
}

.form-field--action {
    display: flex;
    align-items: end;
}

.form-field--full {
    grid-column: 1 / -1;
}

.form-label {
    margin-bottom: .45rem;
    color: #334155;
    font-size: .8125rem;
    font-weight: 650;
}

.form-control,
.form-select {
    min-height: 44px;
    border-color: #cbd5e1;
    border-radius: 9px;
    background-color: #fff;
    color: var(--text);
    padding: .625rem .75rem;
}

.form-control::placeholder {
    color: #94a3b8;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 .2rem rgba(5, 150, 105, .14);
}

.form-control.is-invalid,
.was-validated .form-control:invalid {
    border-color: var(--danger);
}

.form-help,
.form-text {
    margin: .45rem 0 0;
    color: var(--muted) !important;
    font-size: .8125rem;
}

.invalid-feedback {
    color: var(--danger);
    font-size: .8125rem;
}

.btn {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border-radius: 9px;
    font-size: .875rem;
    font-weight: 650;
    padding: .625rem .9rem;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:focus-visible {
    box-shadow: 0 0 0 .22rem rgba(5, 150, 105, .18);
}

.btn-primary,
.btn-success {
    border-color: var(--primary) !important;
    background-color: var(--primary) !important;
    color: #fff !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-success:hover,
.btn-success:focus {
    border-color: var(--primary-hover) !important;
    background-color: var(--primary-hover) !important;
}

.btn-secondary,
.btn-outline-secondary {
    border-color: #cbd5e1 !important;
    background: #fff !important;
    color: #334155 !important;
}

.btn-secondary:hover,
.btn-outline-secondary:hover {
    border-color: #94a3b8 !important;
    background: #f8fafc !important;
    color: var(--text) !important;
}

.btn-ghost,
.btn-link {
    border-color: transparent !important;
    background: transparent !important;
    color: var(--muted) !important;
    text-decoration: none;
}

.btn-ghost:hover,
.btn-link:hover {
    background: #f1f5f9 !important;
    color: var(--text) !important;
}

.btn-danger,
.btn-outline-danger {
    border-color: var(--danger) !important;
    background: var(--danger) !important;
    color: #fff !important;
}

.btn-danger:hover,
.btn-outline-danger:hover {
    border-color: #b91c1c !important;
    background: #b91c1c !important;
}

.action-row,
.inline-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .625rem;
}

.table-responsive {
    max-height: min(62vh, 720px);
}

.table {
    --bs-table-bg: transparent;
    --bs-table-border-color: var(--border);
    margin-bottom: 0;
    color: var(--text);
    font-size: .875rem;
}

.table > :not(caption) > * > * {
    border-bottom-color: var(--border);
    padding: .95rem 1.25rem;
    vertical-align: middle;
}

.table > thead {
    position: sticky;
    z-index: 1;
    top: 0;
    background: #f8fafc;
}

.table > thead > tr > th {
    border-bottom-width: 1px;
    color: var(--muted);
    font-size: .6875rem;
    font-weight: 750;
    letter-spacing: .075em;
    text-transform: uppercase;
    white-space: nowrap;
}

.table > tbody > tr {
    transition: background-color .15s ease;
}

.table-hover > tbody > tr:hover > * {
    --bs-table-bg-state: #f8fafc;
    color: var(--text);
}

.table .action-cell,
.table th:last-child:has(.action-cell),
.table td:last-child:has(.action-cell) {
    text-align: right;
}

.table-card__footer .form-control {
    max-width: 28rem;
}

.delivery-progress {
    display: grid;
    min-width: 9rem;
    gap: .35rem;
}

.delivery-progress__track {
    display: block;
    height: .4rem;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e8f0;
}

.delivery-progress__fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
}

.delivery-progress__label {
    color: var(--muted);
    font-size: .75rem;
    white-space: nowrap;
}

.lead-save-bar {
    position: sticky;
    z-index: 2;
    bottom: 0;
    background: #fff;
}

.status-pill,
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .025em;
    line-height: 1;
    padding: .375rem .55rem;
    text-transform: capitalize;
}

.status-pill svg {
    width: .85rem;
    height: .85rem;
    stroke-width: 2.25;
}

.status-pill--queued,
.status-pill--unknown,
.status-pill--draft,
.status-pill--skipped,
.status-pill--muted,
.badge.text-bg-secondary {
    border-color: #cbd5e1;
    background: #f1f5f9 !important;
    color: #475569 !important;
}

.status-pill--sent,
.status-pill--sending,
.status-pill--primary,
.badge.text-bg-primary {
    border-color: #bfdbfe;
    background: #eff6ff !important;
    color: #1d4ed8 !important;
}

.status-pill--delivered,
.status-pill--completed,
.status-pill--opted_in,
.status-pill--active,
.status-pill--success,
.badge.text-bg-success {
    border-color: #a7f3d0;
    background: #ecfdf5 !important;
    color: #047857 !important;
}

.status-pill--failed,
.status-pill--inactive,
.status-pill--danger,
.badge.text-bg-danger {
    border-color: #fecaca;
    background: #fef2f2 !important;
    color: #b91c1c !important;
}

.status-pill--replied {
    border-color: #c7d2fe;
    background: #eef2ff;
    color: #4338ca;
}

.status-pill--opted_out,
.status-pill--opted-out,
.status-pill--paused,
.status-pill--warning,
.badge.text-bg-warning {
    border-color: #fde68a;
    background: #fffbeb !important;
    color: #b45309 !important;
}

.empty-state {
    display: grid;
    min-height: 250px;
    place-items: center;
    padding: 2.5rem 1.5rem;
    text-align: center;
}

.empty-state__inner {
    max-width: 28rem;
}

.empty-state__icon {
    display: inline-flex;
    width: 3.5rem;
    height: 3.5rem;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    border: 1px solid #d1fae5;
    border-radius: 999px;
    background: #ecfdf5;
    color: var(--primary);
}

.empty-state__icon svg {
    width: 1.5rem;
    height: 1.5rem;
}

.empty-state__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.empty-state__body {
    margin: .45rem auto 0;
    color: var(--muted);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
    gap: 1rem;
}

.metric-card {
    padding: 1.15rem 1.25rem;
}

.metric-card__label {
    margin: 0;
    color: var(--muted);
    font-size: .7rem;
    font-weight: 750;
    letter-spacing: .075em;
    text-transform: uppercase;
}

.metric-card__value {
    margin: .35rem 0 0;
    color: var(--text);
    font-size: 1.5rem;
    font-weight: 750;
    letter-spacing: -.04em;
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    border: 1px solid;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: .9rem 1rem;
}

.alert-success {
    border-color: #a7f3d0;
    background: #ecfdf5;
    color: #065f46;
}

.alert-danger {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.alert-warning {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.alert .btn-close {
    margin-left: auto;
}

.flash-stack {
    display: grid;
    gap: .75rem;
    margin-bottom: 1.5rem;
}

.pagination {
    --bs-pagination-color: var(--muted);
    --bs-pagination-border-color: var(--border);
    --bs-pagination-hover-color: var(--primary);
    --bs-pagination-hover-bg: #ecfdf5;
    --bs-pagination-hover-border-color: #a7f3d0;
    --bs-pagination-active-bg: var(--primary);
    --bs-pagination-active-border-color: var(--primary);
    margin: 0;
}

.page-link {
    border-radius: 7px !important;
    margin: 0 .15rem;
}

.guide-grid,
.guide-flow {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

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

.guide-step,
.guide-flow__step {
    min-height: 100%;
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}

.guide-step__number,
.guide-flow__icon {
    display: inline-flex;
    width: 2rem;
    height: 2rem;
    align-items: center;
    justify-content: center;
    margin-bottom: .9rem;
    border-radius: 8px;
    background: #ecfdf5;
    color: var(--primary);
    font-size: .8125rem;
    font-weight: 750;
}

.guide-flow__icon svg {
    width: 1rem;
    height: 1rem;
}

.guide-step h3,
.guide-flow__step h3 {
    margin: 0;
    font-size: .9375rem;
    font-weight: 700;
}

.guide-step p,
.guide-flow__step p {
    margin: .5rem 0 0;
    color: var(--muted);
    font-size: .875rem;
}

.guide-checklist,
.guide-list {
    display: grid;
    gap: .85rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.guide-checklist li,
.guide-list li {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    color: #334155;
}

.guide-checklist i,
.guide-list i {
    width: 1rem;
    height: 1rem;
    flex: 0 0 1rem;
    margin-top: .2rem;
    color: var(--primary);
}

.guide-list--warning i {
    color: var(--warning);
}

.guide-config {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.guide-config__item {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #f8fafc;
}

.guide-config__label {
    display: block;
    color: var(--muted);
    font-size: .6875rem;
    font-weight: 750;
    letter-spacing: .075em;
    text-transform: uppercase;
}

.guide-config__value {
    display: block;
    margin-top: .35rem;
    color: var(--text);
    font-weight: 700;
}

.inbox-shell {
    display: grid;
    min-height: 560px;
    grid-template-columns: minmax(250px, .85fr) minmax(0, 1.7fr);
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.conversation-list {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: #fbfdff;
}

.conversation-list__body {
    flex: 1;
    overflow: auto;
}

.conversation-list__header,
.message-thread__header {
    display: flex;
    min-height: 68px;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
}

.conversation-list__item {
    display: flex;
    gap: .75rem;
    border-bottom: 1px solid #edf2f7;
    color: var(--text);
    padding: 1rem 1.25rem;
}

.conversation-list__item:hover,
.conversation-list__item.is-active {
    background: #ecfdf5;
    color: var(--text);
}

.conversation-avatar {
    display: inline-flex;
    width: 2.5rem;
    height: 2.5rem;
    flex: 0 0 2.5rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #d1fae5;
    color: #047857;
    font-size: .8125rem;
    font-weight: 750;
}

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

.conversation-list__name {
    display: block;
    overflow: hidden;
    color: var(--text);
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-list__meta {
    display: block;
    overflow: hidden;
    margin-top: .2rem;
    color: var(--muted);
    font-size: .8125rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-thread {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.message-thread__messages {
    display: grid;
    flex: 1;
    align-content: start;
    gap: .75rem;
    padding: 1.25rem;
}

.message-row {
    display: flex;
}

.message-row--out {
    justify-content: flex-end;
}

.message-bubble {
    max-width: min(78%, 38rem);
    border: 1px solid var(--border);
    border-radius: 12px 12px 12px 3px;
    background: #fff;
    padding: .75rem .9rem;
}

.message-row--out .message-bubble {
    border-color: #a7f3d0;
    border-radius: 12px 12px 3px 12px;
    background: #ecfdf5;
}

.message-bubble__meta {
    display: flex;
    align-items: center;
    gap: .35rem;
    margin-top: .45rem;
    color: var(--muted);
    font-size: .7rem;
}

.message-bubble__meta svg,
.message-bubble__media svg {
    width: .8rem;
    height: .8rem;
    vertical-align: -.1em;
}

.message-bubble__time {
    color: var(--muted);
    font-size: .7rem;
}

.message-bubble__ai {
    color: #4338ca;
    font-weight: 700;
}

.message-thread__composer {
    border-top: 1px solid var(--border);
    padding: 1rem 1.25rem;
}

.template-variable-map,
.template-preview {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fafc;
    padding: 1rem;
}

.template-preview__bubble {
    width: min(100%, 31rem);
    margin-left: auto;
    border: 1px solid #a7f3d0;
    border-radius: 12px 12px 3px 12px;
    background: #ecfdf5;
    color: #065f46;
    padding: 1rem;
}

.template-preview__meta {
    margin-bottom: .4rem;
    color: #047857;
    font-size: .75rem;
    font-weight: 650;
}

.table-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: .625rem;
}

.table-toolbar .form-control,
.table-toolbar .form-select {
    min-width: 10.5rem;
}

.inline-consent-form {
    display: grid;
    grid-template-columns: minmax(7rem, 1fr) minmax(8rem, 1.25fr) auto;
    align-items: center;
    gap: .5rem;
}

.inline-consent-form .form-control {
    min-height: 38px;
    font-size: .8125rem;
    padding: .45rem .55rem;
}

.inline-consent-form .btn {
    min-height: 38px;
    padding: .45rem .65rem;
}

.sidebar-scrim {
    display: none;
}

body.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-rail-width);
}

body.sidebar-collapsed .app-main {
    margin-left: var(--sidebar-rail-width);
}

body.sidebar-collapsed .app-sidebar__brand,
body.sidebar-collapsed .sidebar-nav__link,
body.sidebar-collapsed .sidebar-collapse-button {
    justify-content: center;
    padding-left: .5rem;
    padding-right: .5rem;
}

body.sidebar-collapsed .brand-name,
body.sidebar-collapsed .sidebar-nav__label,
body.sidebar-collapsed .sidebar-collapse-button span {
    display: none;
}

@media (max-width: 991.98px) {
    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-field--action .btn {
        width: 100%;
    }

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

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

@media (max-width: 767.98px) {
    .app-sidebar {
        width: min(var(--sidebar-width), 86vw);
        transform: translateX(-100%);
    }

    .app-main,
    body.sidebar-collapsed .app-main {
        margin-left: 0;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    body.sidebar-open .app-sidebar {
        box-shadow: 14px 0 32px rgba(15, 23, 42, .22);
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-scrim {
        position: fixed;
        z-index: 1030;
        inset: 0;
        display: block;
        background: rgba(15, 23, 42, .45);
    }

    .app-topbar {
        min-height: 72px;
        padding: 0 1rem;
    }

    .app-topbar__title {
        font-size: 1.0625rem;
    }

    .app-content {
        padding: 1.25rem 1rem 2rem;
    }

    .page-intro,
    .app-card__header,
    .table-card__header,
    .app-card__footer,
    .table-card__footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .app-card__header,
    .table-card__header,
    .app-card__body,
    .app-card__footer,
    .table-card__footer {
        padding: 1rem;
    }

    .form-grid,
    .form-grid--two,
    .form-grid--three,
    .guide-grid,
    .guide-flow,
    .guide-config,
    .inbox-shell {
        grid-template-columns: minmax(0, 1fr);
    }

    .guide-grid--two {
        grid-template-columns: minmax(0, 1fr);
    }

    .form-field--action {
        width: 100%;
    }

    .table-responsive {
        max-height: none;
    }

    .table > :not(caption) > * > * {
        padding: .8rem 1rem;
    }

    .conversation-list {
        max-height: 290px;
        overflow: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .message-thread__messages {
        min-height: 280px;
        padding: 1rem;
    }

    .message-bubble {
        max-width: 90%;
    }

    .table-toolbar {
        width: 100%;
        justify-content: stretch;
    }

    .table-toolbar .form-control,
    .table-toolbar .form-select {
        min-width: 0;
        width: 100%;
    }

    .inline-consent-form {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (min-width: 768px) {
    .mobile-menu-button {
        display: none;
    }
}
