* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
    color: #d9ecff;
    background:
        radial-gradient(circle at 18% 18%, rgba(34, 146, 255, 0.18), transparent 40%),
        radial-gradient(circle at 80% 76%, rgba(0, 203, 168, 0.12), transparent 42%),
        linear-gradient(160deg, #041227, #0a2441 46%, #0b2f4b);
}

.admin-shell {
    width: min(1280px, 94vw);
    margin: 2.5rem auto 3rem;
    display: grid;
    gap: 1rem;
}

.admin-header h1 {
    margin: 0;
    font-size: clamp(1.4rem, 2.8vw, 2rem);
    color: #f2f8ff;
}

.admin-header p {
    margin: 0.4rem 0 0;
    color: #9db5d3;
}

.glass-card {
    border-radius: 16px;
    border: 1px solid rgba(139, 186, 226, 0.28);
    background: linear-gradient(140deg, rgba(10, 35, 62, 0.82), rgba(7, 23, 42, 0.9));
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
    padding: 1rem;
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.6rem;
    margin-bottom: 0.7rem;
}

.source-snapshot {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin-bottom: 0.7rem;
}

.source-column {
    border: 1px solid rgba(138, 181, 216, 0.22);
    border-radius: 10px;
    background: rgba(7, 24, 42, 0.7);
    padding: 0.55rem 0.7rem;
}

.source-column h3 {
    margin: 0 0 0.45rem;
    font-size: 0.84rem;
    color: #b9d2ea;
}

.source-column ul {
    margin: 0;
    padding-left: 1rem;
    display: grid;
    gap: 0.22rem;
    color: #d9ecff;
    font-size: 0.83rem;
}

.auth-card h2 {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
    color: #f2f8ff;
}

.auth-card label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
    color: #b8ccdf;
}

.auth-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.6rem;
}

input,
select,
button {
    border-radius: 10px;
    border: 1px solid rgba(137, 177, 211, 0.28);
    font: inherit;
}

input,
select {
    width: 100%;
    padding: 0.58rem 0.65rem;
    background: rgba(5, 18, 34, 0.8);
    color: #e8f4ff;
}

input::placeholder {
    color: #86a5c5;
}

button {
    padding: 0.55rem 0.78rem;
    background: linear-gradient(130deg, #1297ff, #0f76d8);
    color: #f5fbff;
    font-weight: 600;
    cursor: pointer;
}

button.secondary {
    background: rgba(14, 44, 71, 0.95);
}

button:hover {
    filter: brightness(1.07);
}

.panel-toolbar {
    display: grid;
    gap: 0.6rem;
    grid-template-columns: repeat(6, minmax(150px, 1fr));
    align-items: end;
    margin-bottom: 0.65rem;
}

.toolbar-group label {
    display: block;
    font-size: 0.82rem;
    margin-bottom: 0.25rem;
    color: #adc6df;
}

.toolbar-actions {
    display: flex;
    gap: 0.45rem;
    justify-content: flex-end;
    flex-wrap: wrap;
    grid-column: 1 / -1;
}

.status-message {
    margin: 0.5rem 0;
    min-height: 1.2rem;
    font-size: 0.9rem;
    color: #9ac0e8;
}

.panel-card h2 {
    margin: 0 0 0.55rem;
    font-size: 1.02rem;
    color: #f2f8ff;
}

.table-wrap {
    overflow: auto;
    border: 1px solid rgba(142, 182, 218, 0.25);
    border-radius: 12px;
}

.email-card h2 {
    margin: 0 0 0.7rem;
    font-size: 1.03rem;
    color: #f2f8ff;
}

.email-status-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.6rem;
}

.status-box {
    border: 1px solid rgba(138, 181, 216, 0.24);
    border-radius: 10px;
    background: rgba(7, 24, 42, 0.78);
    padding: 0.6rem 0.7rem;
}

.status-box span {
    display: block;
    font-size: 0.74rem;
    color: #9db9d7;
    margin-bottom: 0.25rem;
    letter-spacing: 0.02em;
}

.status-box strong {
    color: #e8f3ff;
    font-size: 0.9rem;
    font-weight: 600;
    word-break: break-word;
}

.email-test-row {
    margin-top: 0.7rem;
    display: grid;
    gap: 0.6rem;
    grid-template-columns: 1fr auto;
}

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

th,
td {
    text-align: left;
    padding: 0.58rem 0.65rem;
    border-bottom: 1px solid rgba(139, 181, 218, 0.16);
    vertical-align: top;
}

th {
    background: rgba(8, 28, 49, 0.88);
    color: #d7ebff;
    font-size: 0.84rem;
    position: sticky;
    top: 0;
    z-index: 1;
}

td {
    color: #c4ddf7;
    font-size: 0.88rem;
}

td .row-actions {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.row-actions button {
    font-size: 0.74rem;
    padding: 0.35rem 0.48rem;
    border-radius: 8px;
}

.row-actions button.danger {
    background: linear-gradient(130deg, #cb4a64, #9b1f3f);
}

.pagination-bar {
    margin-top: 0.62rem;
    display: flex;
    gap: 0.6rem;
    align-items: center;
    justify-content: flex-end;
}

.pagination-bar span {
    font-size: 0.85rem;
    color: #b6cee7;
}

.system-card h2 {
    margin: 0 0 0.6rem;
}

.visitor-card table {
    min-width: 980px;
}

.leaderboard-card h2 {
    margin: 0 0 0.45rem;
}

.leaderboard-table {
    min-width: 760px;
}

.leaderboard-table th,
.leaderboard-table td {
    white-space: nowrap;
}

.leaderboard-table th:first-child,
.leaderboard-table td:first-child {
    width: 90px;
}

.leaderboard-table td:first-child {
    font-weight: 700;
    color: #90c7ff;
}

.visitor-card td:last-child {
    max-width: 420px;
    white-space: normal;
    word-break: break-word;
}

@media (max-width: 960px) {
    .overview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .source-snapshot {
        grid-template-columns: 1fr;
    }

    .panel-toolbar {
        grid-template-columns: 1fr 1fr;
    }

    .toolbar-actions {
        justify-content: flex-start;
        grid-column: 1 / -1;
    }

    .email-status-grid {
        grid-template-columns: 1fr 1fr;
    }

    .email-test-row {
        grid-template-columns: 1fr;
    }

    .pagination-bar {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

@media (max-width: 620px) {
    .panel-toolbar {
        grid-template-columns: 1fr;
    }

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