:root {
    --bg: #f5f6f8; --white: #fff; --border: #e8eaed; --text: #1a1a2e; --text2: #6b7280;
    --primary: #3b82f6; --green: #10b981; --orange: #f59e0b; --red: #ef4444;
    --shadow: 0 1px 3px rgba(0,0,0,.06); --radius: 8px; --radius-lg: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; overflow-x: hidden; }

.auth-overlay { position: fixed; inset: 0; background: linear-gradient(135deg, #667eea, #764ba2); display: flex; align-items: center; justify-content: center; z-index: 9999; padding: 20px; }
.auth-card { background: white; border-radius: 16px; padding: 40px 32px; width: 100%; max-width: 400px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.auth-logo { font-size: 40px; margin-bottom: 12px; }
.auth-card h2 { font-size: 20px; margin-bottom: 6px; }
.auth-desc { color: #9ca3af; font-size: 13px; margin-bottom: 24px; }
.auth-input-group { display: flex; border: 2px solid var(--border); border-radius: 8px; overflow: hidden; }
.auth-input-group input { flex: 1; padding: 12px; border: none; font-size: 14px; outline: none; background: #fafafa; min-width: 0; }
.auth-input-group button { padding: 12px 20px; background: var(--primary); color: white; border: none; font-size: 14px; cursor: pointer; white-space: nowrap; }
.auth-error { color: var(--red); font-size: 13px; margin-top: 10px; }

.dashboard { max-width: 1500px; margin: 0 auto; padding: 0 16px 30px; }
.header { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; flex-wrap: wrap; gap: 10px; }
.header-left { display: flex; align-items: center; gap: 10px; }
.logo { font-size: 24px; }
.header h1 { font-size: 18px; font-weight: 600; }
.expire-tag { background: #eff6ff; color: var(--primary); padding: 5px 12px; border-radius: 16px; font-size: 11px; }

.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-card { background: white; border-radius: var(--radius-lg); padding: 16px 18px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.stat-icon { font-size: 28px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: #f9fafb; border-radius: 10px; flex-shrink: 0; }
.stat-value { font-size: 22px; font-weight: 700; }
.stat-label { font-size: 11px; color: var(--text2); }
.highlight-green { color: var(--green); }
.highlight-orange { color: var(--orange); }

/* ========== 左右布局（仅在小屏幕才变上下） ========== */
.main-content { display: flex; gap: 14px; align-items: flex-start; }
.sidebar { width: 270px; flex-shrink: 0; }
.content-area { flex: 1; min-width: 0; }
.panel { background: white; border-radius: var(--radius); padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.panel h3 { font-size: 14px; margin-bottom: 8px; }
.form-group { margin-bottom: 10px; }
.form-group label { font-size: 12px; font-weight: 600; color: #555; display: block; margin-bottom: 4px; }
.form-input, .form-select { width: 100%; padding: 8px 10px; border: 1px solid #ddd; border-radius: 5px; font-size: 12px; }
.calendar-input { width: 100%; padding: 8px 10px; border: 1px solid #ddd; border-radius: 5px; margin-bottom: 8px; font-size: 12px; }
.date-tabs { display: flex; gap: 3px; background: #f3f4f6; border-radius: 6px; padding: 2px; margin-bottom: 6px; }
.date-tab { flex: 1; padding: 5px 8px; border: none; background: transparent; border-radius: 4px; font-size: 11px; cursor: pointer; color: var(--text2); }
.date-tab.active { background: white; color: var(--primary); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.filter-label { font-size: 10px; color: #888; text-align: center; }
.btn-filter { background: var(--red); color: white; width: 100%; padding: 10px; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 600; margin-top: 4px; }
.column-checks { display: flex; flex-wrap: wrap; gap: 5px; }
.column-checks label { font-size: 11px; display: flex; align-items: center; gap: 3px; cursor: pointer; padding: 3px 7px; background: #f9fafb; border-radius: 4px; border: 1px solid #e5e7eb; white-space: nowrap; }
.column-checks label:hover { background: #eff6ff; border-color: var(--primary); }

.filter-bar { background: white; border-radius: var(--radius); padding: 12px 18px; display: flex; justify-content: space-between; align-items: center; box-shadow: var(--shadow); border: 1px solid var(--border); margin-bottom: 8px; }
.table-title { font-size: 15px; font-weight: 600; }
.table-count { font-size: 11px; color: var(--text2); background: #f3f4f6; padding: 4px 10px; border-radius: 12px; }
.table-container { background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.table-wrapper { overflow-x: auto; overflow-y: auto; max-height: 55vh; }
.data-table { width: 100%; min-width: 800px; border-collapse: collapse; font-size: 12px; }
.data-table th { background: #f9fafb; padding: 10px 12px; font-weight: 600; color: var(--text2); font-size: 11px; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; cursor: pointer; z-index: 1; text-align: left; }
.data-table td { padding: 8px 12px; border-bottom: 1px solid #f3f4f6; white-space: nowrap; }
.data-table tr:hover td { background: #f9fafb; }
.tag { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 10px; font-weight: 500; }
.tag-new { background: #ecfdf5; color: #10b981; } .tag-rise { background: #eff6ff; color: #3b82f6; }
.tag-stable { background: #fffbeb; color: #f59e0b; } .tag-warning { background: #fef2f2; color: #ef4444; }
.tag-high { background: #f3e8ff; color: #9333ea; } .tag-mid { background: #f3f4f6; color: #6b7280; }

.pagination { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-top: 1px solid var(--border); background: #fafafa; flex-wrap: wrap; gap: 8px; }
.page-size-select { padding: 5px 8px; border: 1px solid #ddd; border-radius: 5px; font-size: 12px; cursor: pointer; }
.page-btns { display: flex; gap: 3px; flex-wrap: wrap; }
.page-btns button { padding: 5px 10px; border: 1px solid #ddd; border-radius: 4px; background: white; cursor: pointer; font-size: 12px; color: #555; }
.page-btns button.active { background: var(--primary); color: white; border-color: var(--primary); }
.page-btns button:disabled { opacity: 0.4; cursor: not-allowed; }

.charts-section { background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow); border: 1px solid var(--border); margin-top: 10px; }
.chart-header { display: flex; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.chart-close { background: none; border: none; font-size: 16px; cursor: pointer; color: var(--text2); }
.charts-row { display: grid; grid-template-columns: 1fr 1fr; }
.chart-box { height: 250px; }

/* 只在屏幕小于900px时才变成上下布局 */
@media (max-width: 900px) {
    .main-content { flex-direction: column; }
    .sidebar { width: 100%; }
    .stats-row { grid-template-columns: 1fr 1fr; gap: 8px; }
    .data-table { min-width: 650px; }
}
@media (max-width: 500px) {
    .stats-row { grid-template-columns: 1fr; }
}