:root {
    color-scheme: light;
    --bg: #f6f8fb;
    --panel: #ffffff;
    --text: #1f2937;
    --muted: #667085;
    --line: #d9e2ec;
    --blue: #1663b7;
    --blue-dark: #0d4f95;
    --green: #087443;
    --red: #b42318;
    --amber: #a15c07;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
}

a {
    color: var(--blue);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px 32px;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
}

.topbar h1,
.login-box h1 {
    margin: 0 0 6px;
    font-size: 24px;
}

.topbar p {
    margin: 0;
    color: var(--muted);
}

.page {
    width: min(1180px, calc(100% - 32px));
    margin: 24px auto 48px;
}

.panel,
.stat,
.login-box {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.panel {
    margin-top: 18px;
    padding: 20px;
}

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

.panel-heading h2 {
    margin: 0;
    font-size: 18px;
}

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

.stat {
    padding: 16px;
}

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

.stat strong {
    display: block;
    margin-top: 8px;
    font-size: 30px;
}

form {
    margin: 0;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
}

input[type="text"],
input[type="password"],
input[type="file"],
textarea {
    width: 100%;
    border: 1px solid #b8c4d2;
    border-radius: 6px;
    padding: 10px 12px;
    font: inherit;
    background: #ffffff;
}

textarea {
    resize: vertical;
    line-height: 1.45;
}

button,
.link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 0;
    border-radius: 6px;
    padding: 0 16px;
    background: var(--blue);
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

button:hover,
.link-button:hover {
    background: var(--blue-dark);
}

button:disabled {
    background: #98a2b3;
    cursor: not-allowed;
}

.inline-form,
.send-form,
.button-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.inline-form input[type="file"] {
    max-width: 360px;
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-weight: 400;
}

.template-form {
    display: grid;
    gap: 10px;
}

.hint {
    color: var(--muted);
    font-size: 13px;
}

.alert {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
    background: #eef4ff;
}

.alert.success {
    border-color: #abefc6;
    background: #ecfdf3;
    color: var(--green);
}

.alert.danger {
    border-color: #fecdca;
    background: #fef3f2;
    color: var(--red);
}

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

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

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

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

.badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 3px 8px;
    background: #eef2f6;
    color: #344054;
    font-size: 12px;
    font-weight: 700;
}

.badge.sent {
    background: #dcfae6;
    color: var(--green);
}

.badge.failed {
    background: #fee4e2;
    color: var(--red);
}

.badge.pending {
    background: #fef0c7;
    color: var(--amber);
}

.badge.skipped {
    background: #e4e7ec;
    color: #475467;
}

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

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.login-box {
    width: min(420px, calc(100% - 32px));
    padding: 24px;
}

.login-box button {
    width: 100%;
    margin-top: 14px;
}

@media (max-width: 760px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
        padding: 18px;
    }

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

    .panel-heading {
        align-items: flex-start;
        flex-direction: column;
    }
}
