:root {
    --bg: #f5f7f9;
    --surface: #ffffff;
    --ink: #172026;
    --muted: #62717d;
    --line: #dce4ea;
    --accent: #0c7f66;
    --accent-ink: #ffffff;
    --warn: #9a5b00;
    --danger: #b3261e;
    --info: #2457a6;
    --shadow: 0 12px 28px rgba(25, 38, 52, 0.08);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--bg);
}

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

button,
.panel-head a {
    align-items: center;
    background: var(--accent);
    border: 0;
    border-radius: 6px;
    color: var(--accent-ink);
    cursor: pointer;
    display: inline-flex;
    gap: 8px;
    min-height: 40px;
    padding: 0 14px;
    text-decoration: none;
    white-space: nowrap;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

button.ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.28);
}

svg {
    fill: none;
    height: 18px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    width: 18px;
}

.sidebar {
    background: #10251f;
    color: #ecf8f4;
    display: flex;
    flex-direction: column;
    height: 100vh;
    left: 0;
    padding: 18px 14px;
    position: fixed;
    top: 0;
    width: 248px;
}

.brand {
    align-items: center;
    display: flex;
    font-weight: 750;
    gap: 10px;
    line-height: 1.1;
    min-height: 42px;
}

.brand.big {
    color: var(--ink);
    margin-bottom: 28px;
}

.brand-mark {
    align-items: center;
    background: #22b18e;
    border-radius: 6px;
    color: #08231d;
    display: inline-flex;
    font-weight: 850;
    height: 34px;
    justify-content: center;
    width: 34px;
}

nav {
    display: grid;
    gap: 4px;
    margin-top: 26px;
}

nav a {
    align-items: center;
    border-radius: 6px;
    color: #c9ddd7;
    display: flex;
    gap: 10px;
    min-height: 42px;
    padding: 0 10px;
    text-decoration: none;
}

nav a.active,
nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.logout {
    margin-top: auto;
}

.main {
    margin-left: 248px;
    min-width: 0;
    padding: 26px;
}

.topbar {
    align-items: center;
    display: flex;
    gap: 18px;
    justify-content: space-between;
    margin-bottom: 20px;
}

.eyebrow {
    color: var(--muted);
    font-size: 12px;
    font-weight: 760;
    margin: 0 0 5px;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-size: 28px;
    margin-bottom: 0;
}

h2 {
    font-size: 18px;
    margin-bottom: 16px;
}

h3 {
    color: var(--muted);
    font-size: 14px;
    margin: 20px 0 10px;
}

.user-chip {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    display: grid;
    min-width: 160px;
    padding: 10px 12px;
}

.user-chip span {
    color: var(--muted);
    font-size: 12px;
    text-transform: capitalize;
}

.panel,
.metric {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    min-width: 0;
}

.panel {
    margin-bottom: 18px;
    padding: 18px;
}

.panel-head {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 14px;
}

.panel-head h2 {
    margin-bottom: 0;
}

.panel-head span {
    color: var(--muted);
}

.metric-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 18px;
}

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

.metric {
    min-height: 92px;
    padding: 16px;
}

.metric span {
    color: var(--muted);
    display: block;
    font-size: 13px;
}

.metric strong {
    display: block;
    font-size: 32px;
    margin-top: 12px;
}

.split {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.7fr);
}

.split > * {
    min-width: 0;
}

.form-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.form-grid.wide {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.span-2 {
    grid-column: span 2;
}

label {
    color: var(--muted);
    display: grid;
    font-size: 13px;
    font-weight: 700;
    gap: 6px;
}

input,
select,
textarea {
    background: #fbfcfd;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    min-height: 40px;
    padding: 8px 10px;
    width: 100%;
}

textarea {
    resize: vertical;
}

.inline-form,
.button-row {
    align-items: end;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.table-wrap {
    max-width: 100%;
    overflow-x: auto;
}

table {
    border-collapse: collapse;
    min-width: 560px;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 11px 10px;
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.empty {
    color: var(--muted);
    text-align: center;
}

.status {
    border-radius: 999px;
    display: inline-flex;
    font-size: 12px;
    font-weight: 800;
    padding: 4px 9px;
    text-transform: capitalize;
    white-space: nowrap;
}

.status.opted_in,
.status.approved,
.status.processing,
.status.completed,
.status.delivered,
.status.read {
    background: #dff5ed;
    color: #07634e;
}

.status.unknown,
.status.pending,
.status.scheduled,
.status.draft,
.status.paused {
    background: #fff2d6;
    color: var(--warn);
}

.status.opted_out,
.status.rejected,
.status.failed,
.status.cancelled {
    background: #ffe2df;
    color: var(--danger);
}

.check-list,
.row-list {
    display: grid;
    gap: 10px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.check-list li {
    border-left: 3px solid var(--accent);
    color: var(--muted);
    padding-left: 10px;
}

.row-list li {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 10px 0;
}

.row-list em {
    color: var(--muted);
    font-style: normal;
}

.flash {
    border-radius: 6px;
    margin-bottom: 14px;
    padding: 11px 13px;
}

.flash.success {
    background: #dff5ed;
    color: #075744;
}

.flash.error {
    background: #ffe2df;
    color: var(--danger);
}

.login-shell {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    max-width: 440px;
    padding: 28px;
    width: 100%;
}

.login-panel p {
    color: var(--muted);
}

.stack {
    display: grid;
    gap: 14px;
}

@media (max-width: 980px) {
    .sidebar {
        height: auto;
        position: static;
        width: auto;
    }

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

    .logout {
        margin-top: 16px;
    }

    .main {
        margin-left: 0;
        padding: 18px;
        width: 100%;
    }

    .metric-grid,
    .split,
    .form-grid,
    .form-grid.wide {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: span 1;
    }

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

    .empty {
        text-align: left;
    }
}
