:root { font-family: system-ui, sans-serif; background: #f4f6fa; color: #12202c; }
* { box-sizing: border-box; }
body { display: grid; grid-template-columns: 14rem minmax(0, 1fr); margin: 0; min-height: 100vh; }
aside { background: #142733; padding: 1.5rem; color: #e8f5f3; }
aside a { display: block; color: inherit; text-decoration: none; padding: .5rem 0; }
nav { margin: 1.5rem 0; }
.brand { font-weight: 750; }
main { width: min(100%, 76rem); padding: clamp(1rem, 4vw, 3rem); }
section, .summary { background: white; border: 1px solid #dce3e9; border-radius: .7rem; padding: 1.25rem; margin-block: 1rem; }
section h2 { margin-top: 0; }
.summary, form { display: flex; flex-wrap: wrap; align-items: end; gap: .8rem; }
.summary { gap: 2rem; }
label { display: grid; gap: .3rem; }
input, select, textarea, button { font: inherit; border: 1px solid #aabac4; border-radius: .35rem; padding: .45rem .65rem; }
button { cursor: pointer; background: #126760; border-color: #126760; color: white; }
textarea { width: 100%; }
.compose { display: grid; }
.compose button { justify-self: start; }
table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
th, td { text-align: left; padding: .55rem; border-bottom: 1px solid #dce3e9; overflow-wrap: anywhere; }
article { border-top: 1px solid #dce3e9; margin-top: 1rem; }
article form { margin-top: .75rem; }
.count, .notice { background: #e7f5f2; padding: .35rem .55rem; border-radius: .35rem; }
.message { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 720px) { body { display: block; } nav { display: flex; flex-wrap: wrap; gap: 1rem; } }
aside nav { display: grid; gap: .25rem; }
aside nav a { border-radius: .35rem; padding: .55rem .65rem; }
aside nav a[aria-current="page"] { background: #284751; color: white; font-weight: 650; }
aside nav .nav-sub { margin-left: .7rem; font-size: .9rem; }
.nav-group { margin-bottom: .3rem; }
.page-heading, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; }
.page-heading { justify-content: space-between; }
h1 small { color: #506575; font-size: .65em; margin-left: .3em; }
.action { border-radius: .35rem; padding: .5rem .75rem; background: #126760; color: white; text-decoration: none; }
.summary.overview { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); }
.overview a { color: inherit; text-decoration: none; }
.overview strong { display: block; font-size: 1.8rem; }
.stack { display: grid; align-items: start; }
.stack button { justify-self: start; }
.workspace { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; gap: 1rem; }
.metrics { display: grid; grid-template-columns: max-content 1fr; gap: .6rem 1rem; }
.metrics dd { margin: 0; }
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    margin: 0 0 .75rem;
    padding: 0 .25rem;
    border-bottom: 1px solid #aabac4;
}
.tabs a {
    margin-bottom: -1px;
    padding: .55rem .85rem;
    border: 1px solid transparent;
    border-radius: .45rem .45rem 0 0;
    color: #36505e;
    font-weight: 600;
    text-decoration: none;
}
.tabs a:hover { background: #e7f5f2; color: #126760; }
.tabs a[aria-current="page"] {
    border-color: #aabac4 #aabac4 #fff;
    background: #fff;
    color: #126760;
    box-shadow: inset 0 3px #126760;
}
.tabs a:focus-visible {
    position: relative;
    z-index: 1;
    outline: 2px solid #126760;
    outline-offset: 2px;
}
.pagination { display: flex; flex-wrap: wrap; gap: 1rem; margin: 0; }
.secondary { color: #126760; background: transparent; }
@media (max-width: 720px) { .workspace { grid-template-columns: 1fr; gap: 0; } }
.rich-editor { min-width: 0; border: 1px solid #dce3e9; border-radius: .45rem; padding: .75rem; }
.rich-editor p { color: #506575; font-size: .9rem; margin-bottom: 0; }
.rich-toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: .5rem; padding-block: .4rem; }
.rich-toolbar button { font-size: .9rem; }
.rich-modes[hidden] { display: none; }
.rich-modes button {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
}
.rich-modes button::before {
    content: "";
    inline-size: .55rem;
    block-size: .55rem;
    border: 1px solid currentColor;
    border-radius: 50%;
}
.rich-modes button[aria-pressed="true"] {
    background: #126760;
    color: #fff;
}
.rich-modes button[aria-pressed="true"]::before { background: currentColor; }
.rich-modes button:disabled { opacity: .5; cursor: default; }

.rich-input { min-height: 12rem; padding: .75rem; border: 1px solid #aabac4; border-radius: .35rem; }
.rich-input, .rich-preview { overflow-wrap: anywhere; }
.rich-input img, .rich-preview img { max-width: 100%; height: auto; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; }
.media-grid figure { margin: 0; min-width: 0; border: 1px solid #dce3e9; border-radius: .45rem; padding: .75rem; }
.media-grid img { display: block; width: 100%; height: 9rem; object-fit: contain; margin-bottom: .5rem; }
.media-grid input { width: 100%; min-width: 0; }
.tag-list { display: flex; flex-wrap: wrap; gap: .25rem; margin-block: .25rem; }
.tag-list a { color: #126760; text-decoration: none; }
.tag-picker { margin-block: .5rem; }
.tag-picker fieldset:not([data-assignment-picker]) { max-height: 10rem; overflow: auto; }
.relay-detail { position: relative; cursor: help; text-decoration: underline dotted; text-underline-offset: .2em; }
.relay-tooltip { display: none; position: absolute; z-index: 5; inset-inline-end: 0; top: 100%; width: max-content; max-width: min(22rem, 80vw); padding: .55rem .7rem; border-radius: .4rem; background: #20343a; color: #fff; font-size: .875rem; line-height: 1.4; text-decoration: none; box-shadow: 0 2px 8px #0003; }
.relay-detail:hover .relay-tooltip, .relay-detail:focus .relay-tooltip { display: block; }
[data-assignment-picker] { position: relative; min-inline-size: 0; margin: 0; padding: 0; border: 0; }
[data-assignment-picker] legend { margin-bottom: .35rem; padding: 0; font-weight: 600; }
[data-assignment-picker] [hidden] { display: none; }
.assignment-control { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; padding: .3rem; border: 1px solid #aabac4; border-radius: .45rem; background: #fff; }
.assignment-control:focus-within { outline: 2px solid #126760; outline-offset: 2px; }
.assignment-chips { display: contents; }
.assignment-chip { display: inline-flex; gap: .25rem; align-items: center; padding: .2rem .45rem; border-radius: .35rem; background: #e7f5f2; color: #184b4a; overflow-wrap: anywhere; }
.assignment-control .assignment-search { flex: 1 1 9rem; min-width: 0; border: 0; outline: 0; }
.assignment-chip .assignment-remove { padding: 0 .2rem; border: 0; background: transparent; color: inherit; line-height: 1.2; }
.assignment-remove:hover, .assignment-remove:focus-visible { background: #cbe8e2; }
.assignment-options { position: absolute; z-index: 8; inset-inline: 0; top: 100%; max-height: 13rem; overflow: auto; margin-top: .25rem; border: 1px solid #aabac4; border-radius: .45rem; background: #fff; box-shadow: 0 3px 12px #0002; }
.assignment-options .assignment-option { display: block; width: 100%; padding: .55rem .7rem; text-align: start; border: 0; border-radius: 0; background: #fff; color: #142733; }
.assignment-options .assignment-option:hover, .assignment-options .assignment-option:focus-visible { background: #e7f5f2; }
.assignment-empty { margin: 0; padding: .55rem .7rem; color: #506575; }
.toast-stack { position: fixed; z-index: 100; inset-block-start: 1rem; inset-inline-end: 1rem; display: grid; gap: .5rem; width: min(24rem, calc(100vw - 2rem)); pointer-events: none; }
.toast { display: flex; align-items: start; justify-content: space-between; gap: .6rem; padding: .7rem .85rem; border: 1px solid; border-inline-start-width: .35rem; border-radius: .45rem; box-shadow: 0 3px 12px #0002; pointer-events: auto; }
.toast-success { background: #e7f6ef; color: #115135; border-color: #369469; }
.toast-error { background: #fff0ef; color: #84241e; border-color: #c84a42; }
.toast-warning { background: #fff5dc; color: #704b00; border-color: #b88416; }
.toast-info { background: #eaf4fa; color: #204d68; border-color: #4d8caf; }
.toast .toast-close { background: transparent; border: 0; color: inherit; font-size: 1.2rem; line-height: 1; padding: .1rem .25rem; }

/* Keep the composer controls within their grid tracks, including native Safari selects. */
.campaign-workspace > *,
.campaign-workspace .stack > *,
.campaign-workspace label { min-inline-size: 0; }
.campaign-workspace .stack,
.campaign-workspace label { grid-template-columns: minmax(0, 1fr); }
.campaign-workspace :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea, fieldset, iframe) {
    min-inline-size: 0;
    max-inline-size: 100%;
}
.campaign-workspace label > :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) { inline-size: 100%; }
.campaign-workspace .campaign-test h2 { overflow-wrap: anywhere; }
.campaign-workspace .rich-preview { max-inline-size: 100%; overflow: auto; }
.campaign-workspace details + h2,
.campaign-workspace :is(.rich-preview, .message, details) + form { margin-top: 1rem; }
.campaign-workspace .audience-filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .65rem;
    border: 1px solid #dce3e9;
    border-radius: .45rem;
    margin-inline: 0;
    padding: .75rem;
}
.campaign-workspace .audience-filters legend { padding-inline: .25rem; font-weight: 600; }
.campaign-workspace .audience-filters p { margin: 0; }
@media (max-width: 1050px) {
    .campaign-workspace { grid-template-columns: minmax(0, 1fr); gap: 0; }
}

.count-chart {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    gap: .35rem .85rem;
    max-width: 40rem;
}

.count-chart dd {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 5ch;
    align-items: center;
    gap: .65rem;
    margin: 0;
}

.count-chart meter,
.engagement-chart meter {
    width: 100%;
}

.count-chart dd span {
    text-align: right;
}

.engagement-chart {
    max-width: 40rem;
    table-layout: fixed;
}

.engagement-chart meter {
    display: block;
}

.engagement-chart tbody th {
    font-weight: normal;
}

/* Shared admin sizing and surfaces */
.admin-shell {
    --surface: #fff;
    --canvas: #f7f9fa;
    --line: #dbe3e7;
    --ink: #20313b;
    --muted: #536775;
    --accent: #116660;
    --accent-soft: #e8f4f1;
    grid-template-columns: 13rem minmax(0, 1fr);
    color: var(--ink);
    background: var(--canvas);
    font-size: .9375rem;
    line-height: 1.5;
}

.admin-shell .site-sidebar {
    background: var(--surface);
    color: var(--muted);
    border-inline-end: 1px solid var(--line);
    padding: 1.25rem .875rem;
}

.admin-shell .brand { padding-inline: .55rem; color: var(--ink); }
.admin-shell .site-sidebar nav { margin-block: 1rem 1.4rem; }
.admin-shell .site-sidebar nav a { padding: .425rem .6rem; }
.admin-shell .site-sidebar nav .nav-sub { margin-inline-start: .85rem; }
.admin-shell .site-sidebar nav a:hover,
.admin-shell .site-sidebar nav .nav-parent-active { background: var(--canvas); color: var(--accent); }
.admin-shell .site-sidebar nav a[aria-current="page"] {
    background: var(--accent-soft);
    color: var(--accent);
    box-shadow: inset 3px 0 var(--accent);
}
.admin-shell main { width: min(100%, 92rem); min-width: 0; padding: clamp(1rem, 3vw, 2.4rem); }
.admin-shell h1 { margin: 0 0 1rem; font-size: 1.65rem; line-height: 1.2; letter-spacing: -.025em; }
.admin-shell h2 { font-size: 1.15rem; line-height: 1.3; }
.admin-shell h3 { font-size: 1rem; }
.admin-shell .page-heading { margin-bottom: 1rem; }
.admin-shell .page-heading h1 { margin: 0; }
.admin-shell .page-heading .actions { margin-inline-start: auto; }
.admin-shell main a:not(.action) { color: var(--accent); text-underline-offset: .17em; }
.admin-shell section,
.admin-shell .summary { border-color: var(--line); border-radius: .5rem; padding: 1rem; }
.admin-shell .workspace > section { min-width: 0; }
.admin-shell .stack > :is(label, fieldset) { min-width: 0; }
.admin-shell .stack :is(input, select, textarea) { max-width: 100%; }
.admin-shell input:not([type="checkbox"]):not([type="radio"]),
.admin-shell select,
.admin-shell button,
.admin-shell .action { min-block-size: 2.25rem; }
.admin-shell label { gap: .2rem; }
.admin-shell :is(input, select, textarea):focus-visible,
.admin-shell :is(a, button, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.admin-shell .toolbar { gap: .6rem; }
.admin-shell .toolbar label { color: var(--muted); font-size: .875rem; font-weight: 600; }
.admin-shell .toolbar :is(input, select) { font-size: .9375rem; font-weight: 400; color: var(--ink); }

.table-scroll { max-width: 100%; overflow-x: auto; margin-top: .85rem; }
.table-scroll table { margin: 0; }
.admin-shell th {
    background: #f2f5f7;
    color: #435864;
    font-size: .82rem;
    font-weight: 650;
}
.admin-shell :is(th, td) { border-color: #e6ecef; vertical-align: top; }
.admin-shell tbody tr:last-child td { border-bottom: 0; }
.record-name { font-weight: 650; }
.cell-meta { display: block; color: var(--muted); margin-top: .2rem; }
.status-label,
.record-tags .count,
.admin-shell .filter-chip {
    display: inline-block;
    padding: .12rem .5rem;
    border-radius: .35rem;
    color: var(--accent);
    background: var(--accent-soft);
    font-weight: 500;
    font-size: .82rem;
    text-decoration: none;
}
.record-tags { margin: .2rem 0 0; }
.admin-shell .filter-chip { align-self: end; margin-block-end: .35rem; }
.record-tags a:hover, .filter-chip:hover { text-decoration: underline; }
.row-actions { font-size: .875rem; }
.row-actions details { min-width: 6rem; }
.row-actions details[open] { min-width: min(14rem, 60vw); }
.row-actions summary { cursor: pointer; color: var(--accent); }
.row-actions .secondary { min-height: 1.8rem; margin-top: .3rem; }
.admin-shell .assignment-control .assignment-search,
.admin-shell .assignment-chip .assignment-remove { min-block-size: unset; }
.admin-shell .assignment-options { position: static; box-shadow: none; }
.admin-shell .dashboard-overview {
    background: transparent;
    border: 0;
    padding: 0;
    gap: .75rem;
}
.dashboard-overview > a {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: .5rem;
    padding: .85rem 1rem;
}
.admin-shell main .dashboard-overview > a { color: var(--ink); }
.dashboard-overview > a:hover { border-color: var(--accent); }
.import-workspace { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.import-workspace pre { overflow: auto; }
.admin-shell .tabs { gap: .125rem; }
.admin-shell .tabs a { padding: .45rem .65rem; }

@media (max-width: 720px) {
    .admin-shell .site-sidebar { border-inline-end: 0; border-bottom: 1px solid var(--line); }
    .admin-shell .site-sidebar nav { display: flex; flex-wrap: wrap; align-items: start; }
    .admin-shell main { padding: 1rem; }
    .admin-shell .import-workspace { grid-template-columns: minmax(0, 1fr); }
}

.admin-shell .settings-panel form.stack { max-width: 42rem; }
.admin-shell .page-heading h2 { margin: 0; }

.admin-shell .toolbar select {
    appearance: none;
    block-size: 2.25rem;
    padding-inline-end: 1.8rem;
    background: linear-gradient(45deg, transparent 50%, var(--muted) 50%) right 12px center / 5px 5px no-repeat,
                linear-gradient(135deg, var(--muted) 50%, transparent 50%) right 7px center / 5px 5px no-repeat,
                var(--surface);
}

.draft-preview {
    color: inherit;
    width: min(52rem, calc(100% - 2rem));
    max-height: calc(100% - 2rem);
    padding: clamp(1rem, 3vw, 1.5rem);
    border: 1px solid #dbe3e7;
    border-radius: .55rem;
    overflow: auto;
}

.draft-preview::backdrop { background: rgb(20 39 51 / .45); }
.draft-preview .page-heading { margin: 0; }
.draft-preview .page-heading h2 { margin: 0; }
.draft-preview-frame {
    display: block;
    width: 100%;
    height: min(25rem, 55vh);
    border: 1px solid #dce3e9;
    border-radius: .45rem;
}

.public-signup {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    justify-items: center;
    padding: clamp(1rem, 7vw, 4rem) 1rem;
    background: #f3f7f7;
    line-height: 1.5;
}

.signup-card {
    width: min(100%, 32rem);
    padding: clamp(1rem, 5vw, 2rem);
    border: 1px solid #dce3e9;
    border-radius: .75rem;
    background: #fff;
}

.signup-card h1 { margin: 0; font-size: clamp(1.5rem, 5vw, 2rem); line-height: 1.2; }
.signup-card > p { margin: .65rem 0 1rem; }
.signup-fields { gap: .8rem; grid-template-columns: minmax(0, 1fr); }
.signup-fields label small, .signup-help { color: #536775; }
.signup-fields > label { font-weight: 600; }
.signup-fields :is(input[type="email"], input[autocomplete="name"]) { min-width: 0; width: 100%; min-height: 2.55rem; font-weight: 400; }
.signup-fields button { justify-self: stretch; min-height: 2.65rem; font-weight: 650; }
.signup-lists { display: grid; gap: .4rem; min-width: 0; margin: 0; border: 0; padding: 0; }
.signup-lists legend { margin-bottom: .3rem; padding: 0; font-weight: 650; }
.signup-choice { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: .55rem; cursor: pointer; }
.signup-choice input { margin: .28rem 0 0; accent-color: #126760; }
.signup-choice small { display: block; }
.signup-lists .signup-choice { border: 1px solid #dce3e9; border-radius: .4rem; padding: .55rem .7rem; overflow-wrap: anywhere; }
.signup-fields .signup-consent { font-weight: 400; }
.signup-help { margin: 0; font-size: .875rem; }
.signup-error { margin: .75rem 0; padding: .55rem .7rem; border-radius: .35rem; color: #84241e; background: #fff0ef; }
.signup-field-error { color: #84241e; font-size: .875rem; }
.signup-field-error:empty { display: none; }
.signup-fields [aria-invalid="true"] { border-color: #b33f37; }
.signup-embedded { min-height: 0; padding: .75rem; background: #fff; }
.signup-embedded .signup-card { border: 0; padding: 0; }

.app-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: baseline;
    gap: .25rem 1rem;
    margin-top: 1.5rem;
    border-top: 1px solid #dce3e9;
    padding-top: .75rem;
    color: #536775;
    font-size: .8rem;
}
.app-footer a { color: #116660; }
.app-footer > :first-child { justify-self: start; }
.app-footer > :nth-child(2) { text-align: center; }
.app-footer > :last-child { justify-self: end; text-align: right; }

@media (max-width: 450px) {
    .app-footer { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .25rem .4rem; }
}

.record-removal { margin-top: .35rem; }
.admin-shell .record-removal summary { color: #84241e; cursor: pointer; }
.record-removal .danger { background: #84241e; border-color: #84241e; }
.record-removal form p { margin: .35rem 0 0; }

.list-description {
    color: #536775;
    font-weight: 400;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.signup-lists .signup-promoted {
    border-width: 2px;
    border-color: #126760;
    background: #f3faf8;
}
