/**
 * admin.opencz.vip 管理后台样式
 * 深色侧边栏 + 浅色内容区，与管理场景匹配
 */
:root {
    --primary-color: #0066FF;
    --success-color: #28a745;
    --error-color: #dc3545;
    --sidebar-bg: #1a1d23;
    --sidebar-text: #e4e6eb;
    --sidebar-text-dim: #8b8f97;
    --main-bg: #f0f2f5;
    --card-bg: #ffffff;
    --text-main: #1d1d1f;
    --text-sec: #6e6e73;
    --border-color: #e4e6eb;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: var(--text-main);
    min-height: 100vh;
}

/* ========== 登录页 ========== */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1d23 0%, #2d333b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.login-header p {
    font-size: 14px;
    color: var(--text-sec);
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-sec);
    margin-bottom: 8px;
}

.login-form input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    transition: border-color 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.login-error {
    padding: 10px 12px;
    background: #fdf2f2;
    color: var(--error-color);
    font-size: 13px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #0055d4;
}

.btn-primary:disabled {
    background: #b2d1ff;
    cursor: not-allowed;
}

.btn-outline {
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    padding: 10px 20px;
    text-decoration: none;
}

.btn-outline:hover {
    background: #f5f5f7;
}

/* ========== 后台主框架 ========== */
.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.sidebar-badge {
    font-size: 11px;
    color: var(--sidebar-text-dim);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--sidebar-text-dim);
    text-decoration: none;
    transition: all 0.2s;
}

.nav-item:hover {
    color: var(--sidebar-text);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: white;
    background: rgba(0, 102, 255, 0.2);
    border-left: 3px solid var(--primary-color);
    padding-left: 17px;
}

.nav-icon {
    font-size: 18px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-info {
    font-size: 13px;
    color: var(--sidebar-text-dim);
    display: block;
    margin-bottom: 10px;
}

.btn-logout {
    background: none;
    border: 1px solid var(--sidebar-text-dim);
    color: var(--sidebar-text-dim);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
}

.btn-logout:hover {
    color: var(--sidebar-text);
    border-color: var(--sidebar-text);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--main-bg);
    min-width: 0;
}

.main-header {
    background: var(--card-bg);
    padding: 20px 28px;
    border-bottom: 1px solid var(--border-color);
}

.main-header h1 {
    font-size: 20px;
    font-weight: 600;
}

.content-area {
    flex: 1;
    padding: 24px;
    overflow: auto;
}

/* 页面切换 */
.page-content {
    display: none;
}

.page-content.active {
    display: block;
}

/* 概览页 - 统计卡片 */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.stat-label {
    display: block;
    font-size: 13px;
    color: var(--text-sec);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-main);
}

.stat-desc {
    display: block;
    font-size: 12px;
    color: var(--text-sec);
    margin-top: 4px;
}

/* 快捷入口 */
.quick-links h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text-main);
}

.link-card {
    display: block;
    background: var(--card-bg);
    padding: 16px 20px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: all 0.2s;
}

.link-card:hover {
    background: #f0f7ff;
}

/* 模块占位 */
.module-placeholder {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.placeholder-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 20px;
    opacity: 0.6;
}

.module-placeholder h3 {
    font-size: 18px;
    margin-bottom: 12px;
}

.module-placeholder p {
    color: var(--text-sec);
    font-size: 14px;
    margin-bottom: 24px;
}

/* 用户管理 / 发票管理模块 */
.users-module .invoice-form .form-row {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.invoice-module,
.users-module {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.invoice-form-card,
.invoice-list-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.invoice-form-card h3,
.invoice-list-card h3,
.invoice-toolbar h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.invoice-form .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.invoice-form .form-group {
    margin-bottom: 16px;
}

.invoice-form label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-sec);
    margin-bottom: 6px;
}

.invoice-form .required {
    color: var(--error-color);
}

.invoice-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
}

.invoice-form input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.invoice-form .form-hint {
    font-size: 12px;
    color: var(--text-sec);
    margin-top: -8px;
    margin-bottom: 12px;
}

.invoice-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.invoice-toolbar h3 {
    margin-bottom: 0;
}

.filter-bar {
    display: flex;
    gap: 8px;
    align-items: center;
}

.filter-input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    width: 200px;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
}

.invoice-list-wrap {
    overflow-x: auto;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
}

.invoice-table th,
.invoice-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.invoice-table th {
    font-weight: 600;
    color: var(--text-sec);
}

.invoice-table td {
    color: var(--text-main);
}

.invoice-table .cell-url {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.invoice-table .cell-time {
    color: var(--text-sec);
    font-size: 12px;
}

.invoice-table .cell-actions {
    white-space: nowrap;
}

.btn-link-sm {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 13px;
    cursor: pointer;
    padding: 0 4px;
}

.btn-link-sm:hover {
    text-decoration: underline;
}

.btn-danger-sm {
    color: var(--error-color);
}

.invoice-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-sec);
}
