:root {
    --ink: #12161c;
    --muted: #667085;
    --line: #e6e8ee;
    --paper: #f4f6f8;
    --panel: #ffffff;
    --sidebar: #12181f;
    --sidebar-text: #e8edf2;
    --sidebar-dim: #93a0ad;
    --accent: #0f6f6a;
    --accent-ink: #f4fffe;
    --good: #0f7a45;
    --bad: #b42318;
    --warn: #9a6700;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: "Source Sans 3", "Segoe UI", sans-serif;
    font-size: 15.5px;
    line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-weight: 600; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.1rem; }

.icon { width: 18px; height: 18px; flex: none; display: block; }

.shell { display: flex; min-height: 100vh; }

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 200px;
    overflow-y: auto;
    background: var(--sidebar);
    color: var(--sidebar-text);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    z-index: 2;
}

.main { margin-left: 200px; }

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
    margin: 0 8px 28px;
}
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--accent);
    color: var(--accent-ink);
    display: grid;
    place-items: center;
}
.brand strong { display: block; font-size: 1.05rem; font-weight: 600; color: var(--sidebar-text); }
.brand-sub { display: block; color: var(--sidebar-dim); font-size: 0.82rem; }
.card .brand strong { color: var(--ink); }
.card .brand-sub { color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 42px;
    padding: 0 12px;
    border-radius: 10px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 15px;
}
.nav a:hover { background: rgba(255, 255, 255, 0.06); text-decoration: none; }
.nav a.active { background: rgba(255, 255, 255, 0.1); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    position: fixed;
    top: 0;
    left: 200px;
    right: 0;
    z-index: 2;
    height: 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 0 32px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 1.25rem; line-height: 1.2; }
.topbar-title p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-end { display: flex; align-items: center; gap: 16px; flex: none; }
.topbar-account { display: flex; align-items: center; gap: 4px; }
.topbar-account a, .topbar-account button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ink);
    background: none;
    border: 0;
    padding: 8px 12px;
    border-radius: 10px;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}
.topbar-account a:hover, .topbar-account button:hover { background: var(--paper); text-decoration: none; }

.content { padding: 108px 32px 32px; max-width: 1180px; }

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
}
.lede { color: var(--muted); margin: 4px 0 0; font-size: 15px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.button, button.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    background: var(--accent);
    color: var(--accent-ink);
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 0 16px;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.button:hover { text-decoration: none; filter: brightness(1.05); }
.button.secondary {
    background: var(--panel);
    color: var(--ink);
    border-color: var(--line);
}
.button.secondary:hover { background: #f8fafb; filter: none; }
.button.danger { background: var(--bad); color: #fff; }
.button .icon { width: 15px; height: 15px; }

.icon-btn {
    width: 36px;
    height: 36px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--muted);
    cursor: pointer;
    padding: 0;
}
.icon-btn:hover { color: var(--bad); border-color: #f3c9c4; background: #fff6f5; }
td form { margin: 0; }

.alert {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 18px;
    font-size: 15px;
}
.alert.error { border-color: #f3c9c4; background: #fff6f5; }

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px 20px;
}
.stat .icon { color: var(--accent); width: 22px; height: 22px; }
.stat b { display: block; font-size: 1.45rem; font-weight: 650; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 14px; }

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px;
}
.panel.flush { padding: 0; overflow: hidden; }
.section-label { margin: 0 0 12px; }

table { width: 100%; border-collapse: collapse; }
th, td {
    text-align: left;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
tr:last-child td { border-bottom: 0; }
th {
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
    background: #fafbfc;
}

.pill {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 10px;
    border-radius: 99px;
    background: #eef1f4;
    color: #3d4754;
    font-size: 13px;
    font-weight: 600;
}
.pill.subscribed, .pill.accepted, .pill.sent { background: #e7f6ee; color: var(--good); }
.pill.failed, .pill.bounced, .pill.complained { background: #fdecec; color: var(--bad); }
.pill.pending, .pill.sending, .pill.paused, .pill.draft { background: #fff6e5; color: var(--warn); }
.pill.skipped { background: #eef1f4; color: var(--muted); }

label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="file"], select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    font-size: 15px;
}
textarea { min-height: 220px; font-family: ui-monospace, monospace; font-size: 14px; }
.note-input { min-height: 120px; font-family: inherit; font-size: 15px; white-space: pre-wrap; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
.field { margin-bottom: 18px; }
.help { color: var(--muted); font-size: 13.5px; margin: 6px 0 0; }

.steps { margin: 12px 0 18px; padding-left: 1.25rem; color: var(--ink); }
.steps li { margin: 0 0 10px; }
.steps strong { font-weight: 600; }

.secret-field { position: relative; }
.secret-field input { padding-right: 44px; }
.secret-toggle {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}
.secret-toggle svg { width: 18px; height: 18px; display: block; margin: 0 auto; }
.secret-toggle .eye-shut { display: none; }
.secret-toggle[aria-pressed="true"] .eye-open { display: none; }
.secret-toggle[aria-pressed="true"] .eye-shut { display: block; }

.checkboxes { display: flex; flex-direction: column; gap: 8px; font-weight: 400; }
.checkboxes label { font-weight: 400; display: flex; align-items: center; gap: 8px; }

.filters { display: flex; gap: 10px; margin-bottom: 16px; }
.search { position: relative; flex: 1; max-width: 420px; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 38px; }

.guest { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.card { width: min(440px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.card .button { width: 100%; }

.pager { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 14px; }
.pager a { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.pager-disabled { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }

.split { display: grid; grid-template-columns: 1.5fr 0.9fr; gap: 20px; }

.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.campaign-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.9fr);
    gap: 20px;
    align-items: start;
    margin-bottom: 20px;
}
.stack { display: flex; flex-direction: column; gap: 16px; }
.panel-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-title.inset { margin: 0; padding: 16px 16px 0; }
.eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.audience-number {
    margin: 10px 0 2px;
    font-size: 2.75rem;
    font-weight: 650;
    letter-spacing: -0.03em;
    line-height: 1;
}
.sender-name { margin: 10px 0 2px; font-size: 1.15rem; font-weight: 650; }
.detail-list { margin: 14px 0 0; }
.detail-list div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 10px 0;
    border-top: 1px solid var(--line);
}
.detail-list dt { color: var(--muted); font-weight: 400; }
.detail-list dd { margin: 0; font-weight: 600; text-align: right; }
.audience-panel .help { margin-top: 14px; }
.mail-preview { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.mail-meta { display: grid; gap: 8px; padding: 14px 16px; background: #fafbfc; border-bottom: 1px solid var(--line); }
.mail-meta div { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.mail-meta span { color: var(--muted); }
.preview-frame { width: 100%; min-height: 420px; border: 0; display: block; background: #fff; }

.form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.8fr);
    gap: 16px;
    align-items: start;
}
.sender-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.campaign-form .field, .sender-form .field { margin-bottom: 12px; }
.campaign-form .field:last-child, .sender-form .field:last-child { margin-bottom: 0; }
.campaign-form label, .sender-form label { margin-bottom: 4px; }
.campaign-form .panel, .sender-form .panel { padding: 16px; }
.campaign-form .eyebrow, .sender-form .eyebrow { margin-bottom: 12px; }
.modal {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(18, 22, 28, 0.45);
}
.modal[hidden] { display: none; }
.modal-card {
    width: min(640px, 100%);
    max-height: min(92vh, 820px);
    overflow: auto;
    background: var(--panel);
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 18px 48px rgba(18, 22, 28, 0.2);
}
.modal-card .steps-fold { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; }
.steps-fold { margin-top: 16px; padding: 0; }
.steps-fold summary {
    cursor: pointer;
    padding: 14px 16px;
    font-weight: 600;
}
.steps-fold .steps { margin: 0; padding: 0 16px 14px 2.2rem; }
.steps-fold .steps li { margin-bottom: 6px; font-size: 14px; }
.campaign-form .body-input { min-height: 240px; }
.campaign-form .note-input { min-height: 88px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0 0; }
.tag-row span { color: var(--muted); font-size: 12.5px; }
.tag-row code {
    font-size: 12px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 2px 6px;
}
.meta { color: var(--muted); font-size: 13.5px; }
.row-actions { width: 1%; text-align: right; white-space: nowrap; }
.select-col { width: 48px; text-align: center; }
.select-col input { width: 16px; height: 16px; accent-color: var(--accent); }

@media (max-width: 860px) {
    .shell { display: block; }
    .sidebar { position: static; width: auto; padding: 16px; }
    .main { margin-left: 0; }
    .topbar { position: sticky; left: auto; right: auto; height: auto; min-height: 80px; padding: 12px 16px; align-items: flex-start; flex-wrap: wrap; }
    .topbar-end { width: 100%; justify-content: space-between; }
    .topbar-title p { white-space: normal; }
    .brand { margin-bottom: 10px; }
    .nav { flex-direction: row; flex-wrap: wrap; }
    .stats, .split, .campaign-grid, .form-grid, .field-row { grid-template-columns: 1fr; }
    .preview-frame { min-height: 280px; }
    .content { padding: 20px; }
    .page-head { align-items: flex-start; }
}
@media (max-width: 560px) {
    .stats { grid-template-columns: 1fr; }
}
