:root {
    color-scheme: light;
    --canvas: #f4f7f6;
    --surface: #ffffff;
    --surface-soft: #f8faf9;
    --ink: #15231d;
    --muted: #637269;
    --line: #dce6e0;
    --line-strong: #c8d7cf;
    --brand: #087f5b;
    --brand-deep: #065f46;
    --brand-soft: #e6f6ef;
    --brand-pale: #eefaf5;
    --sidebar-strong: #0a241c;
    --blue: #2563eb;
    --danger: #b42318;
    --danger-soft: #fff0ee;
    --warning: #9a6700;
    --warning-soft: #fff5d9;
    --sidebar: 272px;
    --sidebar-collapsed: 82px;
    --radius: 16px;
    --shadow: 0 12px 34px rgba(21, 49, 37, 0.07);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    min-width: 320px;
    background: var(--canvas);
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
}

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

a {
    color: inherit;
}

button,
.button {
    min-height: 42px;
    border: 0;
    border-radius: 10px;
    padding: 0.65rem 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 750;
    text-decoration: none;
    cursor: pointer;
    transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

button:active,
.button:active {
    transform: translateY(1px);
}

button:disabled,
.button:disabled {
    cursor: wait;
    opacity: 0.68;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.24);
    outline-offset: 2px;
}

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

.button.primary:hover,
button.primary:hover {
    background: var(--brand-deep);
}

.button.secondary,
button.secondary {
    color: var(--ink);
    background: #eaf0ed;
}

.button.ghost,
button.ghost {
    background: var(--surface);
    border: 1px solid var(--line-strong);
    color: var(--ink);
}

.button.danger,
button.danger {
    color: var(--danger);
    background: var(--danger-soft);
    border: 1px solid #f2c7c2;
}

.button.compact,
button.compact {
    min-height: 38px;
    padding: 0.48rem 0.75rem;
    font-size: 0.9rem;
}

.icon-button {
    width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
}

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

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: var(--sidebar);
    display: flex;
    flex-direction: column;
    background: #0f2f25;
    color: #edf8f3;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    transition: width 180ms ease, transform 180ms ease;
}

.sidebar-brand {
    min-height: 76px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark,
.tenant-avatar {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-weight: 900;
}

.brand-mark {
    background: #25d366;
    color: #082d1f;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.brand-copy,
.tenant-copy {
    min-width: 0;
    display: grid;
}

.brand-copy strong {
    font-size: 1rem;
}

.brand-copy small,
.tenant-copy small,
.sidebar-footer small {
    color: #9fc0b2;
}

.sidebar-collapse {
    margin-left: auto;
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 1.4rem;
}

.tenant-chip {
    margin: 1rem;
    padding: 0.8rem;
    display: flex;
    gap: 0.7rem;
    align-items: center;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.07);
}

.tenant-avatar {
    background: #d8f6e8;
    color: var(--brand-deep);
}

.tenant-copy strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.92rem;
}

.sidebar-nav {
    padding: 0.25rem 0.75rem;
}

.nav-label {
    margin: 0.5rem 0.65rem;
    color: #7fa697;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.nav-link {
    min-height: 46px;
    margin: 0.3rem 0;
    padding: 0.65rem 0.75rem;
    border-radius: 11px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #cce1d8;
    text-decoration: none;
    font-weight: 680;
}

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

.nav-link.active {
    color: #fff;
    background: rgba(37, 211, 102, 0.16);
    box-shadow: inset 3px 0 #25d366;
}

.nav-icon {
    width: 26px;
    flex: 0 0 26px;
    text-align: center;
    font-size: 1.15rem;
}

.sidebar-footer {
    margin-top: auto;
    padding: 1rem;
    display: grid;
    gap: 0.6rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.security-note {
    display: flex;
    gap: 0.55rem;
    align-items: center;
    color: #bcebd5;
    font-size: 0.86rem;
}

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

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 76px;
    padding: 0.85rem clamp(1rem, 3vw, 2rem);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.topbar-leading,
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-actions form {
    margin: 0;
}

.page-kicker {
    margin: 0 0 0.12rem;
    color: var(--brand);
    font-size: 0.68rem;
    font-weight: 850;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.app-topbar h1 {
    margin: 0;
    font-size: clamp(1.15rem, 2.2vw, 1.5rem);
    line-height: 1.2;
}

.mobile-menu {
    display: none;
}

.content {
    width: min(1320px, 100%);
    margin: 0 auto;
    padding: clamp(1rem, 3vw, 2rem);
}

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

.page-heading h2 {
    margin: 0 0 0.25rem;
    font-size: clamp(1.55rem, 3vw, 2.2rem);
}

.page-heading p {
    margin: 0;
    max-width: 720px;
    color: var(--muted);
    line-height: 1.55;
}

.heading-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.heading-actions form {
    display: flex;
    gap: 0.5rem;
}

.heading-actions select {
    min-height: 42px;
    max-width: 230px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
    background: var(--surface);
}

.grid {
    display: grid;
    gap: 1rem;
}

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

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

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

.section-gap {
    margin-top: 1rem;
}

.field-gap {
    margin-top: 0.8rem;
}

.button-gap {
    margin-top: 0.8rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-body {
    padding: clamp(1rem, 2vw, 1.4rem);
}

.card-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid var(--line);
}

.card-header h2,
.card-header h3,
.card-body h2,
.card-body h3 {
    margin: 0;
}

.metric-card {
    padding: 1.15rem;
}

.metric-label {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.metric-value {
    margin: 0.35rem 0 0;
    font-size: clamp(1.75rem, 4vw, 2.35rem);
    font-weight: 850;
}

.metric-detail {
    margin: 0.4rem 0 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.status {
    width: fit-content;
    padding: 0.3rem 0.58rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.status.success {
    color: #067647;
    background: #dcfae6;
}

.status.warning {
    color: var(--warning);
    background: var(--warning-soft);
}

.status.danger {
    color: var(--danger);
    background: var(--danger-soft);
}

.status.paused {
    color: #6941c6;
    background: #f1ebff;
}

.status.muted,
.status.neutral {
    color: #526058;
    background: #edf1ef;
}

.data-table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.data-table th,
.data-table td {
    padding: 0.82rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.data-table th {
    color: var(--muted);
    background: var(--surface-soft);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

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

.data-table a {
    color: var(--brand-deep);
    font-weight: 780;
    text-decoration: none;
}

.data-table a:hover {
    text-decoration: underline;
}

.subtle {
    color: var(--muted);
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    overflow-wrap: anywhere;
}

.empty-state {
    padding: clamp(2rem, 6vw, 4.5rem) 1rem;
    text-align: center;
}

.empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    display: grid;
    place-items: center;
    border-radius: 18px;
    color: var(--brand);
    background: var(--brand-soft);
    font-size: 1.8rem;
}

.empty-state h3 {
    margin: 0;
}

.empty-state p {
    max-width: 520px;
    margin: 0.55rem auto 1.15rem;
    color: var(--muted);
    line-height: 1.55;
}

.filter-bar {
    margin-bottom: 1rem;
    padding: 0.9rem;
    display: grid;
    grid-template-columns: minmax(180px, 2fr) repeat(3, minmax(130px, 1fr)) auto;
    gap: 0.7rem;
    align-items: end;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
}

.field {
    min-width: 0;
    display: grid;
    gap: 0.38rem;
}

.field label,
.field-label {
    color: #34443b;
    font-size: 0.82rem;
    font-weight: 750;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
    color: var(--ink);
    background: #fff;
}

.field textarea {
    min-height: 112px;
    resize: vertical;
    line-height: 1.5;
}

.field-help {
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.4;
}

.form-section {
    padding: 1.15rem;
    border-bottom: 1px solid var(--line);
}

.form-section:last-child {
    border-bottom: 0;
}

.form-section-heading {
    margin-bottom: 1rem;
}

.form-section-heading h3 {
    margin: 0 0 0.25rem;
}

.form-section-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    line-height: 1.4;
}

.checkbox input {
    width: 18px;
    height: 18px;
    margin-top: 0.1rem;
}

.builder-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
    gap: 1rem;
    align-items: start;
}

.preview-card {
    position: sticky;
    top: 96px;
    overflow: hidden;
}

.preview-stage {
    min-height: 540px;
    padding: 2rem 1rem;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 15% 15%, rgba(8, 127, 91, 0.06), transparent 28%),
        #efeae2;
}

.phone-preview {
    width: min(360px, 100%);
    padding: 0.8rem;
    border: 7px solid #19231f;
    border-radius: 28px;
    background: #e9e4dc;
    box-shadow: 0 20px 40px rgba(25, 35, 31, 0.18);
}

.phone-bar {
    margin: -0.8rem -0.8rem 0.8rem;
    padding: 0.8rem 1rem;
    border-radius: 20px 20px 0 0;
    background: #075e54;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 750;
}

.message-bubble {
    overflow: hidden;
    border-radius: 9px 9px 9px 2px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.preview-media {
    min-height: 118px;
    display: none;
    place-items: center;
    color: var(--muted);
    background: #dfe6e2;
    font-weight: 750;
}

.preview-media.visible {
    display: grid;
}

.preview-copy {
    padding: 0.75rem;
}

.preview-header {
    margin: 0 0 0.45rem;
    font-weight: 800;
}

.preview-body {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 0.9rem;
    line-height: 1.45;
}

.preview-footer {
    margin: 0.55rem 0 0;
    color: #7b8780;
    font-size: 0.76rem;
}

.preview-buttons {
    display: grid;
    border-top: 1px solid var(--line);
}

.preview-button {
    padding: 0.62rem;
    color: #1476d4;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 700;
    border-bottom: 1px solid var(--line);
}

.button-builder {
    display: grid;
    gap: 0.65rem;
}

.button-row {
    padding: 0.8rem;
    display: grid;
    grid-template-columns: 150px minmax(140px, 1fr) minmax(180px, 1.3fr) auto;
    gap: 0.55rem;
    align-items: end;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
}

.button-row .field label {
    font-size: 0.72rem;
}

.alert {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 11px;
    line-height: 1.45;
}

.alert.success {
    color: #05603a;
    background: #e6f8ee;
    border: 1px solid #b9ebcf;
}

.alert.error {
    color: var(--danger);
    background: var(--danger-soft);
    border: 1px solid #f2c7c2;
}

.alert.info {
    color: #175cd3;
    background: #eff6ff;
    border: 1px solid #c7ddff;
}

.detail-list {
    margin: 0;
    display: grid;
}

.detail-list > div {
    padding: 0.8rem 0;
    display: grid;
    grid-template-columns: minmax(130px, 0.7fr) minmax(0, 1.3fr);
    gap: 1rem;
    border-bottom: 1px solid var(--line);
}

.detail-list > div:last-child {
    border-bottom: 0;
}

.detail-list dt {
    color: var(--muted);
}

.detail-list dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.history {
    margin: 0;
    padding: 0;
    list-style: none;
}

.history li {
    position: relative;
    padding: 0 0 1rem 1.5rem;
}

.history li::before {
    content: "";
    position: absolute;
    left: 0.15rem;
    top: 0.35rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-soft);
}

.history li::after {
    content: "";
    position: absolute;
    left: 0.37rem;
    top: 1rem;
    bottom: 0;
    width: 1px;
    background: var(--line);
}

.history li:last-child::after {
    display: none;
}

.history p {
    margin: 0.2rem 0 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.resource-stack {
    display: grid;
    gap: 0.85rem;
}

.resource-card {
    padding: 1rem;
    display: grid;
    gap: 0.8rem;
}

.resource-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.resource-title h3 {
    margin: 0;
}

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

.resource-meta div {
    padding: 0.7rem;
    border-radius: 10px;
    background: var(--surface-soft);
}

.resource-meta small {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--muted);
}

.login-page {
    min-height: 100vh;
    margin: 0;
    padding: 1rem;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 15% 10%, rgba(37, 211, 102, 0.12), transparent 28%),
        linear-gradient(145deg, #eef6f2, #f9fbfa);
}

.login-card {
    width: min(460px, 100%);
    padding: clamp(1.25rem, 4vw, 2rem);
}

.login-card h1 {
    margin: 0.3rem 0 0.6rem;
    font-size: clamp(1.7rem, 5vw, 2.35rem);
}

.login-card > p {
    color: var(--muted);
    line-height: 1.55;
}

.login-card .field {
    margin-top: 0.85rem;
}

.login-card .button {
    width: 100%;
    margin-top: 1.2rem;
}

.login-card .button + .button {
    margin-top: 0.65rem;
}

.sidebar-backdrop {
    display: none;
}

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

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

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

body.sidebar-collapsed .sidebar-brand,
body.sidebar-collapsed .tenant-chip {
    justify-content: center;
}

body.sidebar-collapsed .sidebar-collapse {
    position: static;
    width: 38px;
    height: 38px;
    min-height: 38px;
    margin-top: 0.7rem;
    transform: rotate(180deg);
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: var(--sidebar-strong);
    box-shadow: none;
}

body.sidebar-collapsed .sidebar-brand {
    min-height: 130px;
    padding: 1rem 0.7rem;
    flex-direction: column;
    gap: 0;
}

body.sidebar-collapsed .tenant-chip {
    margin: 0.8rem;
    padding: 0.6rem;
}

body.sidebar-collapsed .sidebar-nav {
    padding-inline: 0.65rem;
}

body.sidebar-collapsed .nav-link {
    justify-content: center;
    min-height: 48px;
    padding-inline: 0;
}

.aligned-check-grid {
    align-items: stretch;
}

.aligned-check-grid .checkbox {
    align-items: center;
    min-height: 46px;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.aligned-check-grid .checkbox input {
    flex: 0 0 18px;
    margin: 0;
}

.choice-card {
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.choice-card:hover {
    border-color: #9ccfba;
    background: var(--brand-pale);
}

.choice-card:has(input:checked) {
    border-color: var(--brand);
    background: var(--brand-pale);
    box-shadow: 0 0 0 1px rgba(8, 127, 91, 0.08);
}

.choice-copy {
    display: grid;
    gap: 0.18rem;
}

.choice-copy strong {
    color: var(--ink);
    font-size: 0.92rem;
}

.choice-copy small {
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.developer-tabs {
    display: flex;
    gap: 0.45rem;
    margin: -0.25rem 0 1rem;
    padding: 0.35rem;
    width: fit-content;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #edf3f0;
}

.developer-tab {
    min-height: 40px;
    padding: 0.55rem 0.9rem;
    border-radius: 9px;
    color: var(--muted);
    font-weight: 750;
    text-decoration: none;
}

.developer-tab:hover,
.developer-tab.active {
    color: var(--brand-deep);
    background: #fff;
    box-shadow: 0 2px 8px rgba(21, 49, 37, 0.08);
}

.profile-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
    gap: 1rem;
    align-items: start;
}

.profile-form {
    margin-top: 1rem;
}

.profile-side {
    display: grid;
    gap: 1rem;
}

.password-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.password-card h3,
.password-card p {
    margin: 0;
}

.password-card p {
    margin-top: 0.3rem;
    color: var(--muted);
}

.security-card {
    overflow: hidden;
}

.security-card-main {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: clamp(1.1rem, 3vw, 1.5rem);
    border-bottom: 1px solid var(--line);
}

.security-card-main h2,
.security-state h3,
.enrollment-heading h3,
.recovery-panel h3 {
    margin: 0.25rem 0 0.4rem;
}

.security-card-main p:last-child,
.security-state p,
.enrollment-heading p,
.recovery-panel p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.security-icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: var(--brand-deep);
    background: var(--brand-soft);
    font-size: 1.35rem;
}

.security-state {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: clamp(1.1rem, 3vw, 1.5rem);
}

.security-actions,
.inline-actions,
.table-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.security-actions form,
.table-actions form {
    margin: 0;
}

.policy-note {
    margin-top: 0.65rem !important;
    color: var(--brand-deep) !important;
    font-weight: 700;
}

.enrollment-panel,
.recovery-panel {
    margin: 1rem;
    padding: clamp(1rem, 3vw, 1.35rem);
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-soft);
}

.enrollment-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.setup-key {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    padding: 0.85rem;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: #fff;
}

.setup-key span {
    display: block;
    margin-bottom: 0.3rem;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.setup-key code {
    color: var(--ink);
    font-size: 1rem;
    overflow-wrap: anywhere;
}

.enrollment-confirm {
    display: grid;
    grid-template-columns: minmax(180px, 0.45fr) auto;
    align-items: end;
    gap: 0.8rem;
    margin-top: 1rem;
}

.step-up-dialog {
    width: min(500px, calc(100% - 2rem));
    max-height: calc(100vh - 2rem);
    padding: 0;
    overflow: auto;
    border: 0;
    border-radius: 18px;
    color: var(--ink);
    background: #fff;
    box-shadow: 0 24px 80px rgba(5, 30, 21, 0.28);
}

.step-up-dialog::backdrop {
    background: rgba(5, 24, 17, 0.58);
    backdrop-filter: blur(2px);
}

.step-up-card {
    display: grid;
    gap: 1rem;
    padding: clamp(1.1rem, 4vw, 1.5rem);
}

.dialog-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.dialog-heading h2 {
    margin: 0.25rem 0 0;
    font-size: 1.45rem;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
    margin-top: 0.25rem;
}

.inbox-shell {
    display: grid;
    grid-template-columns: minmax(280px, 0.32fr) minmax(0, 0.68fr);
    min-height: 650px;
    gap: 1rem;
}

.conversation-list,
.conversation-panel {
    overflow: hidden;
}

.inbox-search {
    display: flex;
    gap: 0.5rem;
    padding: 0.85rem;
    border-bottom: 1px solid var(--line);
}

.inbox-search input {
    width: 100%;
}

.conversation-link {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.7rem;
    padding: 0.85rem;
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid var(--line);
}

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

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

.conversation-preview {
    margin-top: 0.2rem;
    color: var(--muted);
    font-size: 0.78rem;
}

.conversation-meta {
    display: grid;
    justify-items: end;
    gap: 0.35rem;
}

.conversation-time {
    color: var(--muted);
    font-size: 0.7rem;
}

.conversation-back {
    display: none;
}

.conversation-link:hover,
.conversation-link.active {
    background: var(--brand-pale);
}

.conversation-link small,
.conversation-header p {
    display: block;
    margin: 0.15rem 0 0;
    color: var(--muted);
}

.conversation-avatar {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--brand-deep);
    background: var(--brand-pale);
    font-weight: 800;
}

.unread-badge {
    min-width: 24px;
    padding: 0.15rem 0.4rem;
    border-radius: 999px;
    color: #fff;
    background: var(--brand);
    text-align: center;
    font-size: 0.75rem;
}

.conversation-panel {
    display: flex;
    flex-direction: column;
}

.conversation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--line);
}

.conversation-header h3 {
    margin: 0;
}

.message-timeline {
    flex: 1;
    min-height: 420px;
    max-height: 620px;
    overflow-y: auto;
    padding: 1rem;
    background: #f4f7f5;
}

.message-bubble {
    width: fit-content;
    max-width: min(78%, 680px);
    margin: 0 0 0.75rem;
    padding: 0.65rem 0.8rem;
    border-radius: 14px 14px 14px 4px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(4, 35, 27, 0.08);
}

.message-bubble.outbound {
    margin-left: auto;
    border-radius: 14px 14px 4px 14px;
    background: #dff7ea;
}

.message-bubble p {
    margin: 0.2rem 0;
    overflow-wrap: anywhere;
}

.message-meta {
    display: flex;
    justify-content: flex-end;
    gap: 0.35rem;
    margin-top: 0.2rem;
}

.message-bubble small,
.message-bubble span {
    color: var(--muted);
    font-size: 0.72rem;
}

.message-media-preview {
    display: block;
    margin: 0.45rem 0;
    overflow: hidden;
    border-radius: 10px;
    background: var(--surface-soft);
}

.message-media-preview img {
    display: block;
    width: min(320px, 100%);
    max-height: 300px;
    object-fit: cover;
}

.message-attachment-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.45rem 0;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--brand-deep);
    background: #fff;
    font-weight: 750;
    text-decoration: none;
}

.reply-composer {
    display: grid;
    gap: 0.55rem;
    padding: 0.75rem;
    border-top: 1px solid var(--line);
    background: #fff;
}

.composer-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: end;
    gap: 0.55rem;
}

.composer-row textarea {
    width: 100%;
    min-height: 46px;
    max-height: 144px;
    padding: 0.72rem 0.85rem;
    resize: none;
    border-radius: 16px;
    line-height: 1.45;
}

.attachment-button {
    position: relative;
    flex: 0 0 auto;
    margin-bottom: 2px;
    cursor: pointer;
}

.attachment-button input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.composer-send {
    min-height: 46px;
    display: inline-flex;
    gap: 0.45rem;
    margin-bottom: 1px;
}

.composer-help {
    padding-inline: 3.2rem 0.2rem;
    color: var(--muted);
    font-size: 0.74rem;
}

.attachment-preview {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: min(440px, 100%);
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
}

.attachment-preview[hidden] {
    display: none;
}

.attachment-icon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    flex: 0 0 36px;
    border-radius: 10px;
    color: var(--brand-deep);
    background: var(--brand-soft);
}

.attachment-copy {
    min-width: 0;
    display: grid;
    flex: 1;
}

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

.attachment-copy small,
.table-note {
    color: var(--muted);
}

.table-note {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.74rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.verification-guide ol {
    padding-left: 1.2rem;
}

.verification-guide li + li {
    margin-top: 0.55rem;
}

.verification-state {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.table-detail-row td {
    padding-top: 0.55rem;
    padding-bottom: 0.75rem;
    background: #fff8f6;
    font-size: 0.84rem;
}

.text-danger {
    color: var(--danger);
    font-weight: 750;
}

.closed-window {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--line);
    background: #fff8e7;
}

.phone-action-buttons .button {
    text-decoration: none;
}

.phone-action-buttons .button:hover {
    text-decoration: none;
}

.secure-action-form {
    display: grid;
    gap: 0.55rem;
    min-width: 240px;
    padding: 0.75rem 0;
}

.action-menu summary {
    cursor: pointer;
    font-weight: 700;
}

.compact-secret-input {
    width: 150px;
    min-height: 36px;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
}

.send-layout,
.split-detail {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.65fr);
    gap: 1rem;
    align-items: start;
}

.parameter-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.metric-link {
    color: inherit;
    text-decoration: none;
}

.metric-link:hover {
    border-color: var(--brand);
    transform: translateY(-2px);
}

.secret-card {
    padding: 1.25rem;
    border-color: #91dfb7;
    background: linear-gradient(135deg, #f1fff7, #fff);
}

.copy-field {
    padding: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.copy-field code {
    min-width: 0;
    flex: 1;
    overflow-wrap: anywhere;
}

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

.prose {
    line-height: 1.65;
}

.api-doc pre {
    max-width: 100%;
    padding: 1rem;
    overflow: auto;
    border-radius: 12px;
    color: #e9fff5;
    background: #102a22;
}

.endpoint-list {
    display: grid;
    gap: 0.5rem;
}

.endpoint-list code {
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-soft);
}

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

    .builder-layout {
        grid-template-columns: 1fr;
    }

    .send-layout,
    .split-detail {
        grid-template-columns: 1fr;
    }

    .preview-card {
        position: static;
    }

    .preview-stage {
        min-height: 440px;
    }

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

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

    .profile-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .button.compact,
    button.compact,
    .icon-button {
        min-height: 44px;
    }

    .icon-button {
        width: 44px;
        height: 44px;
    }

    .sidebar {
        width: min(88vw, 310px);
        transform: translateX(-105%);
        box-shadow: 20px 0 55px rgba(7, 33, 24, 0.24);
    }

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

    body.mobile-nav-open {
        overflow: hidden;
    }

    body.mobile-nav-open .sidebar {
        transform: translateX(0);
    }

    body.mobile-nav-open .sidebar-backdrop {
        position: fixed;
        inset: 0 0 0 min(88vw, 310px);
        z-index: 35;
        display: block;
        width: auto;
        height: 100%;
        min-height: 0;
        padding: 0;
        border-radius: 0;
        background: rgba(5, 20, 14, 0.48);
    }

    body.sidebar-collapsed .sidebar {
        width: min(88vw, 310px);
    }

    body.sidebar-collapsed .brand-copy,
    body.sidebar-collapsed .tenant-copy {
        display: grid;
    }

    body.sidebar-collapsed .nav-text,
    body.sidebar-collapsed .nav-label {
        display: initial;
    }

    body.sidebar-collapsed .sidebar-brand,
    body.sidebar-collapsed .tenant-chip {
        justify-content: initial;
    }

    body.sidebar-collapsed .sidebar-brand {
        min-height: 76px;
        padding: 1rem;
        flex-direction: row;
    }

    body.sidebar-collapsed .tenant-chip {
        margin: 1rem;
        padding: 0.8rem;
    }

    .sidebar-collapse {
        display: none;
    }

    .mobile-menu {
        display: inline-flex;
    }

    .app-topbar {
        align-items: center;
        padding-inline: 0.85rem;
    }

    .topbar-actions .ghost {
        display: none;
    }

    .content {
        padding: 1rem;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .grid.two,
    .grid.three,
    .grid.four,
    .form-row,
    .filter-bar,
    .resource-meta {
        grid-template-columns: 1fr;
    }

    .heading-actions,
    .heading-actions .button,
    .heading-actions form {
        width: 100%;
    }

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

    .parameter-fields,
    .check-grid {
        grid-template-columns: 1fr;
    }

    .copy-field {
        align-items: stretch;
        flex-direction: column;
    }

    .detail-list > div {
        grid-template-columns: 1fr;
        gap: 0.3rem;
    }

    .inbox-shell {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .conversation-list {
        max-height: calc(100vh - 190px);
        overflow-y: auto;
    }

    .inbox-shell.has-selection .conversation-list {
        display: none;
    }

    .inbox-shell:not(.has-selection) .conversation-panel {
        display: none;
    }

    .conversation-back {
        display: inline-flex;
        flex: 0 0 auto;
    }

    .conversation-header {
        align-items: flex-start;
    }

    .conversation-header-main {
        display: flex;
        align-items: flex-start;
        gap: 0.65rem;
        min-width: 0;
    }

    .message-timeline {
        min-height: 48vh;
        max-height: none;
    }

    .reply-composer {
        grid-template-columns: 1fr;
    }

    .composer-help {
        padding-inline: 0.2rem;
    }

    .composer-send span:first-child {
        display: none;
    }

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

    .phone-action-buttons {
        align-items: stretch;
        flex-direction: column;
    }

    .phone-action-buttons .button {
        width: 100%;
        min-height: 44px;
    }

    .security-state,
    .enrollment-heading,
    .password-card,
    .setup-key {
        align-items: stretch;
        flex-direction: column;
    }

    .security-actions,
    .security-actions form,
    .security-actions .button,
    .inline-actions,
    .inline-actions .button {
        width: 100%;
    }

    .enrollment-confirm {
        grid-template-columns: 1fr;
    }

    .developer-tabs {
        width: 100%;
    }

    .developer-tab {
        flex: 1;
        text-align: center;
    }

    .dialog-actions {
        flex-direction: column-reverse;
    }

    .dialog-actions .button {
        width: 100%;
    }
}

@media (max-width: 430px) {
    .topbar-actions .button {
        font-size: 0.82rem;
    }

    .app-topbar h1 {
        max-width: 140px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .grid.four {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}

/* Release 4.3: keep Developer API request telemetry inside its own viewport. */
.api-request-scroll {
    max-height: 460px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.api-request-scroll .data-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface, #fff);
}

/* Release 4.3: OpenAPI-backed endpoint reference. */
.api-doc-filter {
    max-width: 420px;
    margin-bottom: 1rem;
}
.api-operation-list {
    display: grid;
    gap: .75rem;
}
.api-operation {
    border: 1px solid var(--border, #dfe3e8);
    border-radius: 12px;
    overflow: clip;
    background: var(--surface, #fff);
}
.api-operation > summary {
    display: grid;
    grid-template-columns: auto minmax(180px, auto) minmax(220px, 1fr);
    gap: .75rem;
    align-items: center;
    cursor: pointer;
    padding: .9rem 1rem;
}
.api-operation > summary::marker {
    color: var(--accent, #0f766e);
}
.api-operation[open] > summary {
    border-bottom: 1px solid var(--border, #dfe3e8);
}
.api-operation-body {
    padding: 1rem;
}
.http-method {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    border-radius: 999px;
    padding: .25rem .55rem;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--accent, #0f766e);
    background: var(--accent-soft, #e6fffa);
}
.compact-table td,
.compact-table th {
    padding-top: .55rem;
    padding-bottom: .55rem;
}
@media (max-width: 760px) {
    .api-operation > summary {
        grid-template-columns: auto 1fr;
    }
    .api-operation > summary strong {
        grid-column: 1 / -1;
    }
}

/* Release 4.3.1: webhook tables remain readable with long endpoints and live status rows. */
.webhook-table-wrap {
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
}

.webhook-destination-table {
    min-width: 1060px;
    table-layout: fixed;
}

.webhook-destination-table .destination-name-col {
    width: 16%;
}

.webhook-destination-table .destination-endpoint-col {
    width: 30%;
}

.webhook-destination-table .destination-phones-col {
    width: 7%;
}

.webhook-destination-table .destination-verification-col {
    width: 16%;
}

.webhook-destination-table .destination-state-col {
    width: 10%;
}

.webhook-destination-table .destination-actions-col {
    width: 21%;
}

.destination-name,
.endpoint-value {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.endpoint-cell {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.55rem;
}

.endpoint-copy {
    min-height: 34px !important;
    padding: 0.35rem 0.58rem !important;
    font-size: 0.8rem !important;
}

.cell-center {
    text-align: center !important;
}

.nowrap {
    white-space: nowrap;
}

.webhook-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.webhook-actions form {
    margin: 0;
}

.action-menu {
    position: relative;
}

.action-menu > summary {
    list-style: none;
    user-select: none;
}

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

.action-menu[open] > summary {
    background: var(--brand-pale);
    border-color: #9ccfba;
}

.action-menu-panel {
    margin-top: 0.45rem;
    width: 190px;
    display: grid;
    gap: 0.25rem;
    padding: 0.4rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
}

.action-menu-item {
    min-height: 36px;
    width: 100%;
    justify-content: flex-start;
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
    background: transparent;
    color: var(--ink);
    font-size: 0.88rem;
}

.action-menu-item:hover {
    background: var(--surface-soft);
}

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

.webhook-delivery-header {
    align-items: center;
}

.delivery-refresh-controls {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.webhook-delivery-table {
    min-width: 1060px;
    table-layout: fixed;
}

.webhook-delivery-table .delivery-time-col {
    width: 18%;
}

.webhook-delivery-table .delivery-destination-col {
    width: 14%;
}

.webhook-delivery-table .delivery-event-col {
    width: 15%;
}

.webhook-delivery-table .delivery-phone-col {
    width: 18%;
}

.webhook-delivery-table .delivery-state-col {
    width: 11%;
}

.webhook-delivery-table .delivery-http-col {
    width: 6%;
}

.webhook-delivery-table .delivery-timing-col {
    width: 18%;
}

.delivery-delay-warning td {
    background: var(--warning-soft);
}

.delivery-timeline {
    margin-top: 0.45rem;
    font-size: 0.82rem;
}

.delivery-timeline > summary {
    width: fit-content;
    cursor: pointer;
    color: var(--brand-deep);
    font-weight: 700;
}

.delivery-timeline dl {
    display: grid;
    gap: 0.28rem;
    margin: 0.5rem 0 0;
}

.delivery-timeline dl > div {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 0.4rem;
}

.delivery-timeline dt {
    color: var(--muted);
    font-weight: 700;
}

.delivery-timeline dd {
    margin: 0;
}

@media (max-width: 760px) {
    .webhook-delivery-header,
    .delivery-refresh-controls {
        align-items: flex-start;
    }

    .delivery-refresh-controls {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}
