* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #1a1a2e;
    --bg-sidebar: #16213e;
    --bg-main: #0f0f1a;
    --bg-card: #1f1f3a;
    --text-primary: #e8e8e8;
    --text-secondary: #a0a0a0;
    --accent: #a855f7;
    --accent-hover: #c084fc;
    --border: #2a2a4a;
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #f87171;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
}

/* 密码保护 */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-main);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.auth-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    max-width: 360px;
    width: 90%;
}

.auth-box h2 {
    margin-bottom: 8px;
    font-size: 1.5rem;
}

.auth-box p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.auth-box input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 16px;
}

.auth-box input:focus {
    outline: none;
    border-color: var(--accent);
}

.auth-box button {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.auth-box button:hover {
    background: var(--accent-hover);
}

.error-msg {
    color: var(--danger);
    margin-top: 12px;
    font-size: 0.9rem;
}

.container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.logo {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding: 0 20px;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.nav-section ul {
    list-style: none;
}

.nav-section li {
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-section li:hover {
    background: rgba(168, 85, 247, 0.1);
    border-left-color: var(--accent);
}

.nav-section li.active {
    background: rgba(168, 85, 247, 0.15);
    border-left-color: var(--accent);
    color: var(--accent);
}

.nav-section li.empty {
    color: var(--text-secondary);
    font-style: italic;
    cursor: default;
}

.nav-section li.empty:hover {
    background: none;
    border-left-color: transparent;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-footer button {
    width: 100%;
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-footer button:hover {
    background: var(--accent);
    border-color: var(--accent);
}

#logout-btn:hover {
    background: var(--danger);
    border-color: var(--danger);
}

/* 主内容区 */
.main {
    flex: 1;
    margin-left: 280px;
    display: flex;
    flex-direction: column;
}

.header {
    padding: 16px 32px;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.breadcrumb {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.update-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

/* 欢迎页 */
.welcome {
    max-width: 900px;
    margin: 0 auto;
}

.welcome h2 {
    font-size: 1.75rem;
    margin-bottom: 8px;
}

.welcome > p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.quick-actions h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.action-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.action-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.action-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 12px;
}

.action-text {
    font-size: 0.9rem;
}

/* 报告内容 */
.report-view {
    max-width: 900px;
    margin: 0 auto;
}

.report-header {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.report-title {
    font-size: 1.75rem;
    margin-bottom: 8px;
}

.report-meta {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.report-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px;
}

/* Markdown 样式 */
.report-content h1 { font-size: 1.75rem; margin: 24px 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.report-content h2 { font-size: 1.4rem; margin: 24px 0 12px; color: var(--accent); }
.report-content h3 { font-size: 1.15rem; margin: 20px 0 10px; }
.report-content p { margin: 12px 0; }
.report-content ul, .report-content ol { margin: 12px 0; padding-left: 24px; }
.report-content li { margin: 6px 0; }
.report-content table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.report-content th, .report-content td { padding: 12px; border: 1px solid var(--border); text-align: left; }
.report-content th { background: var(--bg-dark); }
.report-content code { background: var(--bg-dark); padding: 2px 6px; border-radius: 4px; font-family: 'Monaco', 'Menlo', monospace; font-size: 0.9em; }
.report-content pre { background: var(--bg-dark); padding: 16px; border-radius: 8px; overflow-x: auto; margin: 16px 0; }
.report-content pre code { padding: 0; background: none; }
.report-content blockquote { border-left: 4px solid var(--accent); padding-left: 16px; margin: 16px 0; color: var(--text-secondary); font-style: italic; }
.report-content hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* 响应式 - 移动端优化 */
@media (max-width: 768px) {
    .container { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; border-right: none; border-bottom: 1px solid var(--border); }
    .sidebar.collapsed .nav { display: none; }
    .sidebar.collapsed .sidebar-footer { display: none; }
    .logo { padding: 16px; }
    .logo h1 { font-size: 1.1rem; }
    .menu-toggle { display: block; background: var(--bg-card); border: 1px solid var(--border); color: var(--text-primary); padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 1rem; }
    .nav { max-height: 50vh; overflow-y: auto; padding: 8px 0; }
    .nav-section { margin-bottom: 16px; }
    .nav-section h3 { padding: 0 16px; font-size: 0.7rem; }
    .nav-section li { padding: 12px 16px; font-size: 0.85rem; }
    .sidebar-footer { padding: 12px 16px; }
    .main { margin-left: 0; }
    .header { padding: 12px 16px; flex-direction: column; gap: 8px; align-items: flex-start; }
    .breadcrumb { font-size: 0.85rem; }
    .content { padding: 16px; }
    .welcome h2 { font-size: 1.3rem; }
    .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 24px; }
    .stat-card { padding: 12px 8px; border-radius: 8px; }
    .stat-number { font-size: 1.5rem; }
    .stat-label { font-size: 0.7rem; }
    .action-grid { grid-template-columns: 1fr; gap: 12px; }
    .action-card { padding: 16px; display: flex; align-items: center; gap: 12px; text-align: left; }
    .action-icon { font-size: 1.5rem; margin-bottom: 0; }
    .report-view { max-width: 100%; }
    .report-header { margin-bottom: 20px; padding-bottom: 16px; }
    .report-title { font-size: 1.3rem; }
    .report-content { padding: 16px; border-radius: 8px; }
    .report-content h1 { font-size: 1.3rem; }
    .report-content h2 { font-size: 1.15rem; }
    .report-content h3 { font-size: 1rem; }
    .report-content table { display: block; overflow-x: auto; white-space: nowrap; }
    .report-content th, .report-content td { padding: 8px; font-size: 0.85rem; }
}

.menu-toggle { display: none; }
