:root {
    color-scheme: dark;
    --bg: #0f1117;
    --surface: #171a22;
    --surface-2: #1f2430;
    --line: #2b3140;
    --text: #eef2f8;
    --muted: #9aa5b5;
    --primary: #77e0c3;
    --primary-2: #5ab7ff;
    --danger: #ff6b6b;
    --warning: #f7c66a;
    --success: #7ee787;
    --shadow: 0 18px 50px rgba(0, 0, 0, .28);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    padding: 24px 18px;
    background: #12151d;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #071014;
    font-weight: 900;
}

.brand strong,
.brand span {
    display: block;
}

.brand span,
.muted,
.eyebrow {
    color: var(--muted);
}

nav {
    display: grid;
    gap: 8px;
}

nav a {
    color: var(--muted);
    text-decoration: none;
    padding: 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background .18s ease, color .18s ease;
}

nav a:hover,
nav a.active {
    background: var(--surface-2);
    color: var(--text);
}

.icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: #252b38;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
}

.smtp-state {
    margin-top: auto;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    font-size: 14px;
}

.smtp-state.ok {
    color: var(--success);
}

.smtp-state.warn {
    color: var(--warning);
}

.user-box {
    display: grid;
    gap: 4px;
    padding: 12px;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
}

.user-box span {
    font-weight: 800;
}

.user-box small {
    color: var(--muted);
    overflow-wrap: anywhere;
}

.user-box a {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    margin-top: 6px;
}

.main {
    margin-left: 280px;
    padding: 32px;
}

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

.eyebrow {
    margin: 0 0 6px;
    font-size: 13px;
}

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

h1 {
    margin-bottom: 0;
    font-size: 34px;
    letter-spacing: 0;
}

h2 {
    font-size: 20px;
}

.send-window {
    border-radius: 8px;
    padding: 10px 14px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--muted);
}

.send-window.open {
    color: var(--success);
}

.send-window.closed {
    color: var(--warning);
}

.notice {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid var(--line);
}

.notice.success {
    border-color: rgba(126, 231, 135, .45);
}

.notice.error {
    border-color: rgba(255, 107, 107, .55);
    color: #ffc4c4;
}

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

.metric,
.panel,
.form-panel,
.campaign-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.metric {
    padding: 20px;
}

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

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

.panel,
.form-panel {
    padding: 22px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.campaign-list {
    display: grid;
    gap: 16px;
}

.campaign-card {
    padding: 18px;
}

.campaign-head {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.campaign-head h3 {
    margin: 8px 0 4px;
}

.campaign-head p {
    color: var(--muted);
    margin-bottom: 0;
}

.campaign-actions {
    display: flex;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 10px;
    border-radius: 8px;
    background: #252b38;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

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

.status-completed {
    color: var(--success);
}

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

.progress-row {
    margin: 18px 0;
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    color: var(--muted);
    margin-bottom: 8px;
}

.progress-meta strong {
    color: var(--text);
}

.progress-track {
    height: 9px;
    border-radius: 8px;
    background: #252b38;
    overflow: hidden;
}

.progress-track div {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-2));
}

.campaign-details {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    color: var(--muted);
    font-size: 13px;
}

.sent-table {
    margin-top: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.sent-table div {
    display: grid;
    grid-template-columns: 1fr 180px;
    gap: 16px;
    padding: 10px 12px;
    border-top: 1px solid var(--line);
}

.sent-table div:first-child {
    border-top: 0;
}

.sent-table time {
    color: var(--muted);
}

form {
    margin: 0;
}

label {
    display: block;
    margin: 16px 0 8px;
    color: var(--muted);
    font-size: 14px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #11141b;
    color: var(--text);
    padding: 12px 14px;
    font: inherit;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(119, 224, 195, .12);
}

textarea {
    resize: vertical;
}

.code {
    font-family: "Cascadia Code", Consolas, monospace;
}

.two-cols {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.three-cols {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.form-note {
    margin-top: 14px;
}

.button,
.icon-button {
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    margin-top: 18px;
    text-decoration: none;
}

.button.compact {
    min-height: 36px;
    margin-top: 0;
    padding: 0 14px;
}

.button.primary {
    background: var(--primary);
    color: #071014;
}

.button.secondary {
    background: var(--surface-2);
    color: var(--text);
}

.button.ghost {
    color: var(--primary);
    border: 1px solid var(--line);
}

.inline-action {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.icon-button {
    width: 38px;
    height: 38px;
    background: var(--surface-2);
    color: var(--text);
}

.icon-button.danger {
    color: var(--danger);
}

.empty-state {
    display: grid;
    gap: 6px;
    padding: 32px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--line);
    border-radius: 8px;
}

.empty-state strong {
    color: var(--text);
}

.settings dl {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 12px 18px;
}

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

.settings dd {
    margin: 0;
}

.profile-panel {
    margin-top: 20px;
}

.profile-list {
    display: grid;
    gap: 12px;
}

.profile-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #11141b;
}

.profile-card h3 {
    margin-bottom: 6px;
}

.profile-card p,
.profile-card span,
.smtp-label {
    color: var(--muted);
}

.log-view {
    max-height: 420px;
    overflow: auto;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #090b10;
    color: #c6d3e1;
    font: 12px/1.5 "Cascadia Code", Consolas, monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

code {
    color: var(--primary);
}

.auth-page {
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-shell {
    width: min(100%, 460px);
}

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

.auth-brand {
    padding: 0;
    margin-bottom: 24px;
}

.auth-card h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.wide {
    width: 100%;
}

.auth-link {
    display: block;
    margin-top: 16px;
    color: var(--primary);
    text-align: center;
    text-decoration: none;
}

.checkline {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
}

.checkline input {
    width: 18px;
    height: 18px;
}

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

    .main {
        margin-left: 0;
        padding: 20px;
    }

    .metric-grid,
    .campaign-details,
    .two-cols,
    .three-cols {
        grid-template-columns: 1fr;
    }

    .topbar,
    .campaign-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .sent-table div {
        grid-template-columns: 1fr;
    }
}
