:root {
    color-scheme: light;
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    background: #eef2f7;
    color: #1f2937;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

.page {
    min-height: 100vh;
    padding: 32px;
}

.panel {
    width: min(1180px, 100%);
    margin: 0 auto;
    background: #ffffff;
    border: 1px solid #d9e2ef;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 16px 45px rgba(31, 41, 55, 0.08);
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.top-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

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

p {
    margin: 0;
    color: #64748b;
}

.add-form {
    display: grid;
    grid-template-columns: auto minmax(160px, 220px) auto minmax(220px, 320px) auto;
    align-items: center;
    gap: 10px;
    margin: 18px 0 22px;
}

label {
    font-weight: 700;
}

input,
textarea {
    height: 40px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0 12px;
    font-size: 15px;
    font-family: inherit;
}

textarea {
    height: auto;
    min-height: 76px;
    padding: 10px 12px;
    resize: vertical;
}

.button,
.icon-button {
    min-height: 40px;
    border: 0;
    border-radius: 6px;
    padding: 0 16px;
    background: #2563eb;
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
}

.button-secondary {
    background: #0f766e;
}

.button-checkin {
    background: #16a34a;
}

.icon-button {
    min-height: 34px;
    padding: 0 12px;
    background: #334155;
}

.icon-button.danger {
    background: #dc2626;
}

.icon-button.send {
    background: #7c3aed;
}

.small-button {
    min-height: 34px;
    border: 0;
    border-radius: 6px;
    padding: 0 10px;
    background: #475569;
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
}

.send-form {
    display: grid;
    grid-template-columns: minmax(180px, 260px) minmax(260px, 1fr) auto;
    align-items: end;
    gap: 12px;
    margin-bottom: 12px;
    padding: 14px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #f8fafc;
}

.send-form-compact {
    grid-template-columns: minmax(220px, 320px) auto;
    justify-content: start;
}

.field {
    display: grid;
    gap: 6px;
}

.field-message {
    min-width: 0;
}

.smtp-note {
    margin-bottom: 18px;
    color: #64748b;
    font-size: 13px;
}

.messages {
    display: grid;
    gap: 8px;
}

.message {
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 14px;
}

.message-success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.message-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

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

th,
td {
    padding: 13px 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}

th {
    background: #f8fafc;
    color: #475569;
    font-size: 13px;
}

tr:last-child td {
    border-bottom: 0;
}

.badge,
.status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 700;
}

.badge-ok,
.status-ok {
    background: #dcfce7;
    color: #166534;
}

.badge-warn {
    background: #ffedd5;
    color: #9a3412;
}

.status-bad {
    background: #fee2e2;
    color: #991b1b;
}

.status-idle {
    background: #e2e8f0;
    color: #475569;
}

.muted,
.error-text {
    color: #64748b;
}

.error-text {
    max-width: 280px;
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.45;
}

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

.email-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto;
    gap: 8px;
}

.email-form input {
    min-width: 0;
}

.empty {
    height: 120px;
    text-align: center;
    color: #64748b;
}

@media (max-width: 720px) {
    .page {
        padding: 14px;
    }

    .panel {
        padding: 16px;
    }

    .topbar,
    .top-actions,
    .add-form,
    .send-form {
        grid-template-columns: 1fr;
        display: grid;
    }
}
