:root {
    --bg: #0a0c10;
    --panel: rgba(18, 22, 30, 0.85);
    --panel-solid: #12161e;
    --panel-2: #181e2c;
    --text: #e8ecf4;
    --muted: #7e8a9e;
    --primary: #2dd4a0;
    --primary-hover: #25b888;
    --danger: #f87171;
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --radius: 16px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family:
        "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
        "Noto Sans SC", "Noto Sans CJK SC", "WenQuanYi Micro Hei",
        "Source Han Sans SC", system-ui, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse 80% 50% at 20% -10%, rgba(45, 212, 160, 0.10), transparent 60%),
        radial-gradient(ellipse 60% 40% at 85% 5%, rgba(129, 140, 248, 0.08), transparent 55%),
        radial-gradient(ellipse 50% 60% at 50% 110%, rgba(45, 212, 160, 0.05), transparent 50%);
    pointer-events: none;
}

::selection {
    background: rgba(45, 212, 160, 0.25);
    color: #fff;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}

.auth-wrap,
.admin-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.auth-card,
.admin-card {
    width: min(480px, 100%);
    background: var(--panel);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
    animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transition: box-shadow var(--transition), border-color var(--transition);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-card:hover,
.admin-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.admin-card.wide {
    width: min(960px, 100%);
}

h1 {
    margin: 0 0 8px;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

p {
    margin: 0 0 20px;
    color: var(--muted);
    line-height: 1.6;
    font-size: 14px;
}

label {
    display: block;
    margin: 14px 0 6px;
    font-size: 14px;
    color: var(--muted);
    font-weight: 500;
    transition: color var(--transition);
}

input:not([type="checkbox"]),
select {
    width: 100%;
    height: 44px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
    border-radius: 10px;
    padding: 0 14px;
    font: inherit;
    transition: all var(--transition);
}

input:not([type="checkbox"]):focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(24, 30, 44, 0.95);
    box-shadow: 0 0 0 3px rgba(45, 212, 160, 0.1);
}

input:not([type="checkbox"]):hover,
select:hover {
    border-color: var(--border-hover);
}

input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    cursor: pointer;
}

.toggle-track {
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: #2a3142;
    border: 1px solid var(--border);
    transition: background 0.2s, border-color 0.2s;
}

.toggle-track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #8b95a8;
    transition: transform 0.2s, background 0.2s;
}

input[type="checkbox"]:checked + .toggle-track {
    background: rgba(45, 212, 160, 0.25);
    border-color: rgba(45, 212, 160, 0.45);
}

input[type="checkbox"]:checked + .toggle-track::after {
    transform: translateX(20px);
    background: var(--primary);
}

input[type="checkbox"]:focus-visible + .toggle-track {
    box-shadow: 0 0 0 3px rgba(45, 212, 160, 0.15);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    cursor: pointer;
    user-select: none;
}

.checkbox-row span {
    color: var(--text);
    font-size: 14px;
}

.checkbox-box {
    position: relative;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    flex-shrink: 0;
    transition: border-color 0.2s, background 0.2s;
}

.checkbox-box::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid transparent;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity 0.15s;
}

input[type="checkbox"]:checked + .checkbox-box {
    background: rgba(45, 212, 160, 0.18);
    border-color: rgba(45, 212, 160, 0.55);
}

input[type="checkbox"]:checked + .checkbox-box::after {
    border-color: var(--primary);
    opacity: 1;
}

input[type="checkbox"]:focus-visible + .checkbox-box {
    box-shadow: 0 0 0 3px rgba(45, 212, 160, 0.15);
}

button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 10px;
    background: var(--primary);
    color: #052e1f;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    font: inherit;
    transition: all var(--transition);
    box-shadow: 0 2px 8px rgba(45, 212, 160, 0.25);
}

button:hover, .btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 212, 160, 0.35);
}

button:active, .btn:active {
    transform: translateY(0);
}

button.full, .btn.full {
    width: 100%;
    margin-top: 20px;
}

.btn.secondary {
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.btn.danger {
    background: rgba(248, 113, 113, 0.12);
    color: #f87171;
    border: 1px solid rgba(248, 113, 113, 0.2);
    box-shadow: none;
}

.btn.danger:hover {
    background: rgba(248, 113, 113, 0.2);
    border-color: rgba(248, 113, 113, 0.35);
    transform: translateY(-1px);
}

.msg {
    margin-top: 14px;
    font-size: 14px;
    padding: 12px 14px;
    border-radius: 10px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.msg.error {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.msg.success {
    color: var(--primary);
    background: rgba(45, 212, 160, 0.1);
    border: 1px solid rgba(45, 212, 160, 0.2);
}

.auth-links {
    margin-top: 18px;
    text-align: center;
}

.auth-links a {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    padding: 8px 16px;
    border-radius: 8px;
    display: inline-block;
}

.auth-links a:hover {
    background: rgba(45, 212, 160, 0.1);
    transform: translateY(-1px);
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

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

.section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    animation: fadeIn 0.5s ease;
}

.section h2 {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section h2::before {
    content: "";
    width: 4px;
    height: 18px;
    border-radius: 2px;
    background: var(--primary);
}

.table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel-2);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

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

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

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

th {
    color: var(--muted);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.02);
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    transition: all var(--transition);
}

.badge.admin {
    background: rgba(45, 212, 160, 0.15);
    color: var(--primary);
    border: 1px solid rgba(45, 212, 160, 0.3);
}

.badge.user {
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
    border: 1px solid var(--border);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    align-items: end;
}

.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
}

.switch-row label {
    margin: 0;
}

.switch-row > span:first-child {
    color: var(--text);
    font-size: 14px;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .admin-header {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-actions {
        width: 100%;
    }

    .admin-actions .btn {
        flex: 1;
    }
}
