:root {
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #172033;
    background: #f4f6fa;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f4f6fa;
}

a {
    color: #2457c5;
}

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

.container {
    width: min(1180px, calc(100% - 2rem));
    margin-inline: auto;
}

.site-header {
    color: #fff;
    background: #15233f;
    border-bottom: 3px solid #3e79ed;
}

.header-content {
    display: flex;
    min-height: 64px;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand,
.main-nav a,
.link-button {
    color: #fff;
    text-decoration: none;
}

.brand {
    font-size: 1.15rem;
    font-weight: 700;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-toggle,
.mobile-nav-header,
.nav-backdrop {
    display: none;
}

.main-nav .nav-link {
    padding: .4rem .55rem;
    border-radius: 7px;
}

.main-nav .nav-link:hover {
    background: rgb(255 255 255 / 12%);
}

.main-nav .nav-link:focus-visible {
    outline: 3px solid rgb(255 255 255 / 45%);
    outline-offset: 2px;
}

.main-nav .nav-link.is-active {
    color: #15233f;
    background: #fff;
    box-shadow: 0 2px 8px rgb(0 0 0 / 18%);
    font-weight: 700;
}

.main-nav form {
    margin: 0;
}

.link-button,
.danger-link {
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.link-button {
    color: #fff;
}

.action-link {
    color: #2457c5;
}

.page-content {
    padding-block: 2rem 4rem;
}

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

.compact-heading {
    margin-bottom: 0;
}

.inline-control-form {
    display: flex;
    align-items: center;
    gap: .75rem;
}

h1,
h2 {
    margin-top: 0;
}

.muted {
    color: #667085;
}

.panel,
.auth-card,
.stat-card {
    border: 1px solid #dce2ec;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 16px rgb(28 39 62 / 6%);
}

.panel {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.auth-card {
    width: min(440px, 100%);
    padding: 2rem;
    margin: 4rem auto;
}

.two-factor-card {
    width: min(560px, 100%);
}

.qr-code {
    display: flex;
    justify-content: center;
    padding: 1rem;
}

.qr-code img {
    width: 260px;
    max-width: 100%;
    height: auto;
}

.secret-code {
    margin-bottom: 1rem;
    text-align: center;
    letter-spacing: .08em;
}

.recovery-codes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
    padding: 0;
    list-style: none;
}

.recovery-codes code {
    text-align: center;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stats-grid.compact {
    margin-bottom: 1rem;
}

.stat-card {
    display: grid;
    gap: .4rem;
    padding: 1.25rem;
}

.stat-card span {
    color: #667085;
}

.stat-card strong {
    font-size: 1.8rem;
}

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

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

.full-width {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: .4rem;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: .65rem .75rem;
    border: 1px solid #bfc8d8;
    border-radius: 7px;
    background: #fff;
}

textarea {
    padding: .75rem;
    border: 1px solid #bfc8d8;
    border-radius: 7px;
    resize: vertical;
}

fieldset {
    padding: 1rem;
    border: 1px solid #dce2ec;
    border-radius: 8px;
}

legend {
    padding-inline: .4rem;
    font-weight: 700;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgb(62 121 237 / 20%);
    border-color: #3e79ed;
}

.checkbox-field {
    display: flex;
    align-items: center;
    font-weight: 400;
}

.checkbox-field input {
    width: auto;
    min-height: auto;
}

.button-row,
.filter-form {
    display: flex;
    align-items: end;
    gap: .75rem;
}

.button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: .6rem 1rem;
    border: 1px solid #b8c2d2;
    border-radius: 7px;
    color: #1d2a44;
    background: #fff;
    text-decoration: none;
    cursor: pointer;
}

.button-primary {
    color: #fff;
    border-color: #2457c5;
    background: #2457c5;
}

.button-link {
    border-color: transparent;
}

.filter-form {
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #dce2ec;
    border-radius: 10px;
    background: #fff;
}

.filter-form label:first-child {
    flex: 1;
}

.table-wrapper {
    overflow-x: auto;
    border: 1px solid #dce2ec;
    border-radius: 10px;
    background: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: .8rem;
    border-bottom: 1px solid #e6eaf0;
    text-align: left;
    vertical-align: top;
}

th {
    color: #475467;
    background: #f8fafc;
}

.actions-column {
    white-space: nowrap;
}

.actions-column form {
    display: inline;
    margin-left: .75rem;
}

.danger-link {
    color: #b42318;
}

.badge {
    display: inline-block;
    padding: .2rem .5rem;
    border-radius: 999px;
    font-size: .78rem;
    background: #e8edf5;
}

.badge-active {
    color: #067647;
    background: #dcfae6;
}

.badge-draft {
    color: #344054;
    background: #e8edf5;
}

.badge-scheduled {
    color: #175cd3;
    background: #dbeafe;
}

.badge-archived,
.badge-cancelled {
    color: #667085;
    background: #eaecf0;
}

.badge-unsubscribed,
.badge-suppressed,
.badge-hard_bounced,
.badge-invalid {
    color: #b42318;
    background: #fee4e2;
}

.preview-table th {
    min-width: 190px;
}

.preview-table th span {
    display: block;
    margin-bottom: .5rem;
}

.filter-chip {
    display: inline-block;
    padding: .2rem .45rem;
    margin: .1rem;
    border-radius: 999px;
    font-size: .78rem;
    background: #e8edf5;
}

.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
}

.alert-success {
    color: #065f46;
    background: #d1fae5;
}

.alert-error {
    color: #991b1b;
    background: #fee2e2;
}

.empty-state {
    padding: 2rem;
    color: #667085;
    text-align: center;
}

.pagination {
    margin-top: 1rem;
}

.pagination nav > div:first-child {
    display: none;
}

.pagination nav > div:last-child {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

code {
    display: block;
    padding: .75rem;
    overflow-wrap: anywhere;
    border-radius: 6px;
    background: #eef2f7;
}

.variable-help {
    display: grid;
    gap: .6rem;
    padding: 1rem;
    border-radius: 8px;
    background: #eef4ff;
}

.variable-help div {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.variable-help code,
.variable-help small code {
    display: inline-block;
    padding: .25rem .45rem;
}

.code-editor,
.text-preview {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.email-preview {
    width: 100%;
    min-height: 620px;
    border: 1px solid #dce2ec;
    border-radius: 8px;
    background: #fff;
}

.text-preview {
    padding: 1rem;
    overflow-x: auto;
    white-space: pre-wrap;
    border-radius: 8px;
    background: #f8fafc;
}

.details-grid {
    display: grid;
    grid-template-columns: 2fr 2fr 1fr;
    gap: 1rem;
    margin: 0;
}

.details-grid div {
    min-width: 0;
}

.details-grid dt {
    color: #667085;
    font-size: .85rem;
}

.details-grid dd {
    margin: .25rem 0 0;
    overflow-wrap: anywhere;
}

.alert-info {
    color: #1849a9;
    background: #eaf2ff;
}

@media (max-width: 800px) {
    .page-heading,
    .filter-form,
    .button-row {
        align-items: stretch;
        flex-direction: column;
    }

    .header-content {
        min-height: 64px;
    }

    .menu-toggle {
        display: inline-flex;
        width: 44px;
        height: 44px;
        padding: 10px;
        flex-direction: column;
        flex-shrink: 0;
        justify-content: space-between;
        border: 1px solid rgb(255 255 255 / 35%);
        border-radius: 8px;
        color: #fff;
        background: transparent;
        cursor: pointer;
    }

    .menu-toggle span {
        display: block;
        width: 100%;
        height: 2px;
        border-radius: 2px;
        background: currentColor;
    }

    .menu-toggle:focus-visible,
    .menu-close:focus-visible {
        outline: 3px solid rgb(255 255 255 / 45%);
        outline-offset: 2px;
    }

    .main-nav {
        position: fixed;
        z-index: 1001;
        top: 0;
        right: 0;
        width: min(330px, 88vw);
        height: 100vh;
        height: 100dvh;
        padding: 1rem;
        overflow-y: auto;
        align-items: stretch;
        flex-direction: column;
        gap: .35rem;
        visibility: hidden;
        background: #15233f;
        box-shadow: -8px 0 30px rgb(0 0 0 / 28%);
        transform: translateX(100%);
        transition: transform 180ms ease, visibility 180ms;
    }

    .main-nav.is-open {
        visibility: visible;
        transform: translateX(0);
    }

    .mobile-nav-header {
        display: flex;
        min-height: 44px;
        margin-bottom: .75rem;
        align-items: center;
        justify-content: space-between;
        color: #fff;
        font-size: 1.1rem;
    }

    .menu-close {
        width: 44px;
        height: 44px;
        padding: 0;
        border: 0;
        color: #fff;
        background: transparent;
        cursor: pointer;
        font-size: 2rem;
        line-height: 1;
    }

    .main-nav .nav-link {
        width: 100%;
        padding: .75rem;
    }

    .main-nav form {
        margin-top: auto;
        padding: .75rem;
    }

    .nav-backdrop {
        position: fixed;
        z-index: 1000;
        inset: 0;
        display: block;
        visibility: hidden;
        border: 0;
        opacity: 0;
        background: rgb(9 17 31 / 65%);
        transition: opacity 180ms ease, visibility 180ms;
    }

    .nav-backdrop.is-open {
        visibility: visible;
        opacity: 1;
    }

    body.nav-open {
        overflow: hidden;
    }

    .stats-grid,
    .form-grid,
    .details-grid,
    .recovery-codes {
        grid-template-columns: 1fr;
    }

    .full-width {
        grid-column: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .main-nav,
    .nav-backdrop {
        transition: none;
    }
}
