/* ==================== 全局样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0b1117;
    --bg-soft: #0f1b24;
    --panel: #121f2b;
    --panel-soft: #172433;
    --text-primary: #e6edf3;
    --text-secondary: #9fb0c3;
    --border-color: #233345;
    --accent: #2dd4bf;
    --accent-strong: #22c55e;
    --accent-warm: #f59e0b;
    --error: #ef4444;
    --info: #38bdf8;
    --shadow: 0 16px 40px rgba(3, 7, 18, 0.6);
    --radius-lg: 16px;
    --radius-md: 12px;
}

body {
    font-family: 'Manrope', 'Noto Sans SC', sans-serif;
    background: radial-gradient(circle at top, rgba(45, 212, 191, 0.08), transparent 45%),
                radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.08), transparent 40%),
                var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ==================== 登录页面 ==================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.login-container::before,
.login-container::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(0);
    opacity: 0.35;
}

.login-container::before {
    width: 360px;
    height: 360px;
    background: rgba(45, 212, 191, 0.15);
    top: -120px;
    right: -120px;
    animation: float 16s ease-in-out infinite;
}

.login-container::after {
    width: 300px;
    height: 300px;
    background: rgba(245, 158, 11, 0.12);
    bottom: -100px;
    left: -100px;
    animation: float 20s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(18px, -18px); }
}

.login-box {
    background: rgba(18, 31, 43, 0.95);
    padding: 40px 32px;
    border-radius: 24px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border-color);
    position: relative;
    z-index: 1;
}

.login-title {
    text-align: center;
    margin-bottom: 12px;
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 28px;
}

/* ==================== 表单元素 ==================== */
.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.3px;
}

input, select, textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-soft);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea {
    resize: vertical;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: rgba(45, 212, 191, 0.8);
    box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.12);
}

input:disabled {
    background: var(--panel-soft);
    cursor: not-allowed;
    opacity: 0.6;
}

.form-hint {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 6px;
    display: block;
}

/* ==================== 按钮 ==================== */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #2dd4bf, #38bdf8);
    color: #0b1117;
    box-shadow: 0 12px 28px rgba(45, 212, 191, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 32px rgba(45, 212, 191, 0.3);
}

.btn-full {
    width: 100%;
}

.btn-secondary {
    background: rgba(56, 189, 248, 0.15);
    color: var(--text-primary);
    border: 1px solid rgba(56, 189, 248, 0.4);
}

.btn-secondary:hover {
    background: rgba(56, 189, 248, 0.25);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #fecaca;
    border: 1px solid rgba(239, 68, 68, 0.45);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px dashed var(--border-color);
}

.btn-ghost:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.btn-compact {
    padding: 8px 14px;
    font-size: 13px;
}

.hidden {
    display: none !important;
}

.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--panel-soft);
    border: 1px solid var(--border-color);
    transition: 0.2s;
    border-radius: 999px;
}

.switch-slider:before {
    position: absolute;
    content: \"\";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 2px;
    background-color: var(--text-secondary);
    transition: 0.2s;
    border-radius: 50%;
}

.switch input:checked + .switch-slider {
    background-color: rgba(45, 212, 191, 0.25);
    border-color: rgba(45, 212, 191, 0.5);
}

.switch input:checked + .switch-slider:before {
    transform: translateX(20px);
    background-color: var(--accent);
}

/* ==================== 头部与布局 ==================== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 40px 0;
    flex-wrap: wrap;
    gap: 16px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left {
    display: flex;
    flex-direction: column;
}

.header-title {
    font-size: 24px;
    font-weight: 700;
}

.header-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 6px;
}

.container {
    max-width: 1480px;
    margin: 0 auto;
    padding: 24px 24px 60px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.panel {
    background: rgba(18, 31, 43, 0.92);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 22px;
    box-shadow: var(--shadow);
    animation: rise 0.4s ease;
}

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

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

.section-title {
    font-size: 18px;
    font-weight: 700;
}

.section-subtitle {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.section-badge {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(45, 212, 191, 0.16);
    color: var(--accent);
    border: 1px solid rgba(45, 212, 191, 0.35);
}

.panel-form {
    margin-top: 16px;
}

.stats-strip {
    padding: 18px 20px;
    margin-bottom: 18px;
    border-radius: var(--radius-md);
    background: rgba(15, 27, 36, 0.6);
    border: 1px solid var(--border-color);
}

.stats-strip .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.stats-strip .stat-card {
    padding: 12px 14px;
}

.panel-subtitle {
    font-size: 15px;
    font-weight: 700;
    margin: 6px 0 14px;
    color: var(--text-primary);
}

.config-board-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.config-board-wide {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.config-card {
    background: var(--panel-soft);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.config-divider {
    height: 1px;
    background: var(--border-color);
    margin: 16px 0;
}

.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(15, 27, 36, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

.switch-label {
    font-size: 13px;
    font-weight: 600;
}

.config-section {
    margin-bottom: 18px;
}

.panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.tool-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.compact-line {
    flex-wrap: nowrap;
    overflow-x: visible;
}

.compact-line > * {
    flex: 0 0 auto;
}

.tool-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.tool-inline label {
    margin-bottom: 0;
    font-weight: 600;
}

.bulk-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: rgba(15, 27, 36, 0.6);
}

.bulk-actions.compact-line .bulk-left,
.bulk-actions.compact-line .bulk-right {
    flex-wrap: nowrap;
}

.input-compact {
    width: 140px;
    max-width: 140px;
}

.input-medium {
    width: 220px;
    max-width: 220px;
}

.select-compact {
    width: 160px;
    max-width: 160px;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.form-row .form-group {
    margin-bottom: 0;
}

.bulk-left,
.bulk-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.selection-count {
    font-size: 12px;
    color: var(--text-secondary);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 12px;
}

.page-info {
    font-size: 12px;
    color: var(--text-secondary);
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: rgba(15, 27, 36, 0.6);
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 600;
}

.tab-btn.active {
    color: var(--text-primary);
    border-color: rgba(45, 212, 191, 0.6);
    background: rgba(45, 212, 191, 0.18);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.panel-card {
    background: var(--panel-soft);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 16px;
}

.panel-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.panel-tools input,
.panel-tools select {
    max-width: 240px;
}

.action-menu {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.action-menu.open .action-list {
    display: flex;
}

.action-menu-cell {
    width: 100%;
    justify-content: flex-start;
}

.action-list {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: none;
    flex-direction: column;
    min-width: 160px;
    background: var(--panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    z-index: 20;
    box-shadow: var(--shadow);
}

.action-list-right {
    right: 0;
}

.action-link,
.action-item {
    text-align: left;
    background: transparent;
    color: var(--text-primary);
    border: none;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
    transition: background 0.2s ease;
    display: block;
    width: 100%;
}

.action-link:hover,
.action-item:hover {
    background: rgba(45, 212, 191, 0.18);
}

.action-link.danger,
.action-item.danger {
    color: #fecaca;
}

.action-link.danger:hover,
.action-item.danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* ==================== 统计卡片 ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--panel-soft);
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid var(--border-color);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 13px;
}

.stat-number {
    font-size: 22px;
    font-weight: 700;
    margin-top: 6px;
}

/* ==================== 状态提示 ==================== */
.status-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--panel-soft);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-secondary);
}

.status-indicator.success { background: var(--accent-strong); }
.status-indicator.error { background: var(--error); }
.status-indicator.loading {
    background: var(--accent-warm);
    animation: pulse 1.2s infinite ease-in-out;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.4); opacity: 1; }
}

.status-label {
    font-weight: 600;
}

.status-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.status-note {
    color: var(--text-secondary);
    font-size: 12px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    border: 1px solid transparent;
}

.status-active {
    background: rgba(34, 197, 94, 0.15);
    color: #bbf7d0;
    border-color: rgba(34, 197, 94, 0.4);
}

.status-warning {
    background: rgba(245, 158, 11, 0.16);
    color: #fde68a;
    border-color: rgba(245, 158, 11, 0.4);
}

.status-error {
    background: rgba(239, 68, 68, 0.18);
    color: #fecaca;
    border-color: rgba(239, 68, 68, 0.4);
}

.status-muted {
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-secondary);
    border-color: rgba(148, 163, 184, 0.3);
}

/* ==================== 表格 ==================== */
.table-container {
    overflow-x: visible;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

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

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

.checkbox-column {
    width: 42px;
    text-align: center;
}

#userTable {
    min-width: 0;
}

#userTable th,
#userTable td {
    white-space: nowrap;
}

th {
    background: rgba(15, 27, 36, 0.7);
    color: var(--text-secondary);
    cursor: pointer;
    position: sticky;
    top: 0;
}

th.sort-asc::after {
    content: ' ▲';
    font-size: 10px;
}

th.sort-desc::after {
    content: ' ▼';
    font-size: 10px;
}

tr:hover {
    background: rgba(23, 36, 51, 0.7);
}

.row-muted {
    opacity: 0.7;
}

.action-stack {
    display: grid;
    gap: 8px;
}

.switch-inline {
    margin-top: 6px;
}

.mono-code {
    font-family: 'Courier New', monospace;
    color: var(--info);
}

/* ==================== 提示框 ==================== */
.alert {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #bbf7d0;
}

.alert-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fecaca;
}

.alert-info {
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.4);
    color: #bae6fd;
}

.tip-list {
    display: grid;
    gap: 6px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fde68a;
}

/* ==================== 头像 ==================== */
.avatar-upload {
    display: grid;
    gap: 16px;
    align-items: center;
}

.avatar-preview {
    width: 88px;
    height: 88px;
    border-radius: 20px;
    object-fit: cover;
    border: 2px solid var(--border-color);
    box-shadow: var(--shadow);
}

.avatar-placeholder {
    width: 88px;
    height: 88px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--panel-soft);
    border: 2px dashed var(--border-color);
    font-size: 26px;
}

/* ==================== 文案折叠 ==================== */
details {
    background: var(--panel-soft);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-bottom: 16px;
}

details summary {
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 12px;
}

/* ==================== 响应式 ==================== */
@media (max-width: 980px) {
    .compact-line {
        flex-wrap: wrap;
    }

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

    .config-board-grid,
    .config-board-wide {
        grid-template-columns: 1fr;
    }

    .header {
        padding: 24px;
    }

    .container {
        padding: 20px 16px 50px;
    }
}

@media (max-width: 680px) {
    table {
        min-width: 600px;
    }

    .btn-row {
        flex-direction: column;
        align-items: stretch;
    }
}
