* {
    box-sizing: border-box;
}

:root {
    --bg: #eef3f8;
    --glass: rgba(255, 255, 255, 0.72);
    --glass-strong: rgba(255, 255, 255, 0.86);
    --line: rgba(133, 151, 174, 0.28);
    --text: #172033;
    --muted: #627084;
    --blue: #2563eb;
    --green: #16a34a;
    --red: #dc2626;
    --shadow: 0 18px 48px rgba(33, 47, 72, 0.12);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    font-family: Arial, "Microsoft YaHei", sans-serif;
    background:
        radial-gradient(circle at 12% 8%, rgba(37, 99, 235, 0.20), transparent 30%),
        radial-gradient(circle at 82% 16%, rgba(22, 163, 74, 0.16), transparent 28%),
        linear-gradient(135deg, #f7fbff 0%, var(--bg) 48%, #f4f7fb 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(rgba(255,255,255,.34) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.34) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, black, transparent 70%);
}

h1, h2 {
    margin: 0;
    letter-spacing: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 22px 32px;
    background: rgba(255, 255, 255, 0.66);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 30px rgba(33, 47, 72, 0.08);
    backdrop-filter: blur(18px);
}

.topbar h1 {
    font-size: 24px;
}

.topbar p,
.muted,
.muted-inline {
    color: var(--muted);
}

.topbar p,
.muted {
    margin: 7px 0 0;
}

.muted-inline {
    font-size: 13px;
}

.layout {
    position: relative;
    width: min(1280px, calc(100% - 32px));
    margin: 24px auto 52px;
}

.panel,
.login-panel {
    margin-bottom: 18px;
    padding: 20px;
    background: var(--glass);
    border: 1px solid rgba(255, 255, 255, 0.76);
    border-radius: 18px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px);
}

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

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

.stack,
.grid-form {
    display: grid;
    gap: 14px;
}

.grid-form {
    grid-template-columns: 1fr;
}

.wide {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 7px;
    color: #344056;
    font-size: 14px;
}

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

input,
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--line);
    border-radius: 10px;
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(37, 99, 235, 0.55);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
    background: rgba(255, 255, 255, 0.94);
}

textarea {
    resize: vertical;
}

button,
.ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    color: #ffffff;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border: 0;
    border-radius: 10px;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

button:hover,
.ghost:hover {
    transform: translateY(-1px);
    filter: brightness(1.02);
}

.ghost {
    color: #344056;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    box-shadow: none;
}

.danger {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    box-shadow: 0 8px 18px rgba(220, 38, 38, 0.20);
}

.btn-import {
    background: linear-gradient(135deg, #0ea5e9, #2563eb);
    box-shadow: 0 8px 18px rgba(14, 165, 233, 0.24);
}

.btn-export {
    background: linear-gradient(135deg, #14b8a6, #0f766e);
    box-shadow: 0 8px 18px rgba(20, 184, 166, 0.22);
}

.btn-export-all {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    box-shadow: 0 8px 18px rgba(139, 92, 246, 0.22);
}

.btn-enable {
    background: linear-gradient(135deg, #22c55e, #15803d);
    box-shadow: 0 8px 18px rgba(34, 197, 94, 0.22);
}

.btn-disable {
    background: linear-gradient(135deg, #f97316, #c2410c);
    box-shadow: 0 8px 18px rgba(249, 115, 22, 0.22);
}

.btn-whitelist {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    box-shadow: 0 8px 18px rgba(6, 182, 212, 0.22);
}

.btn-refresh {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 8px 18px rgba(245, 158, 11, 0.22);
}

.alert {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    backdrop-filter: blur(18px);
}

.alert.success {
    color: #047857;
    background: rgba(236, 253, 243, 0.86);
}

.alert.error {
    color: #b42318;
    background: rgba(254, 243, 242, 0.88);
}

.section-head,
.bulkbar,
.sender-bulk {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.section-head {
    justify-content: space-between;
}

.search {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-width: min(480px, 100%);
}

.search input {
    width: min(320px, 100%);
}

.sender-bulk {
    padding: 12px;
    background: rgba(255, 255, 255, 0.46);
    border: 1px solid var(--line);
    border-radius: 14px;
}

.sender-bulk textarea {
    flex: 1 1 420px;
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.46);
}

table {
    width: 100%;
    min-width: 1080px;
    border-collapse: separate;
    border-spacing: 0;
}

th,
td {
    padding: 12px 12px;
    border-bottom: 1px solid rgba(133, 151, 174, 0.20);
    text-align: left;
    vertical-align: middle;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #526173;
    font-size: 12px;
    font-weight: 700;
    background: rgba(248, 250, 252, 0.86);
    backdrop-filter: blur(14px);
}

tbody tr {
    transition: background .16s ease;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.56);
}

.pill,
.status-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

.pill.ok {
    color: #047857;
    background: rgba(236, 253, 243, 0.9);
}

.pill.off {
    color: #667085;
    background: rgba(242, 244, 247, 0.9);
}

.status-button {
    border: 0;
    box-shadow: none;
}

.status-button.ok {
    color: #ffffff;
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.status-button.off {
    color: #ffffff;
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.api-url {
    min-width: 340px;
    min-height: 31px;
    padding: 7px 9px;
    color: #405066;
    font-size: 12px;
    font-family: Consolas, "Courier New", monospace;
    background: rgba(255, 255, 255, 0.66);
}

.sender-cell,
.tag-cell {
    min-width: 180px;
    max-width: 240px;
    min-height: 30px;
    padding: 6px 8px;
    font-size: 12px;
    line-height: 1.35;
}

.sender-cell.saving,
.tag-cell.saving {
    border-color: rgba(37, 99, 235, 0.55);
    background: rgba(239, 246, 255, 0.92);
}

.sender-cell.save-ok,
.tag-cell.save-ok {
    border-color: rgba(22, 163, 74, 0.46);
}

.sender-cell.save-error,
.tag-cell.save-error {
    border-color: rgba(220, 38, 38, 0.7);
    background: rgba(254, 242, 242, 0.95);
}

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

.actions button {
    min-height: 34px;
    padding: 0 12px;
    border-radius: 9px;
    font-size: 13px;
}

.pager {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 18px;
    padding: 12px 0 2px;
}

.pager-pages,
.pager-controls,
.pager-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    color: #405066;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid transparent;
    border-radius: 10px;
}

.page-btn.active {
    color: #047857;
    background: rgba(236, 253, 243, 0.95);
    border-color: rgba(22, 163, 74, 0.42);
}

.page-btn.disabled {
    color: #b7c0cc;
    background: rgba(248, 250, 252, 0.72);
    border-color: rgba(217, 222, 231, 0.7);
    pointer-events: none;
}

.page-ellipsis {
    min-width: 34px;
    text-align: center;
    color: var(--muted);
}

.pager-controls select,
.jump-form input {
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.72);
}

.pager-controls select {
    width: 112px;
}

.jump-form input {
    width: 88px;
}

.pager-total {
    color: var(--text);
    font-size: 20px;
    font-weight: 700;
    white-space: nowrap;
}

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

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

    .layout {
        width: min(100% - 20px, 1280px);
        margin-top: 14px;
    }

    .panel,
    .login-panel {
        border-radius: 16px;
        padding: 14px;
    }

    .search,
    .bulkbar,
    .sender-bulk {
        width: 100%;
    }

    .search input {
        width: 100%;
    }
}
