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

:root, html[data-theme="dark"] {
    --primary: #F97316;
    --primary-hover: #EA580C;
    --primary-soft: rgba(249, 115, 22, 0.1);
    --primary-border: rgba(249, 115, 22, 0.2);
    --bg: #0A0A0A;
    --bg-sidebar: #0F0F0F;
    --bg-surface: #18181B;
    --bg-hover: #27272A;
    --bg-elevated: #1A1A1A;
    --bg-header: rgba(10, 10, 10, 0.8);
    --text: #FAFAFA;
    --text-secondary: #A1A1AA;
    --text-muted: #71717A;
    --border: #27272A;
    --border-light: #1F1F23;
    --overlay: rgba(0, 0, 0, 0.7);
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --font-mono: "SF Mono", Monaco, "JetBrains Mono", "Courier New", monospace;
    --sidebar-w: 260px;
    --sidebar-collapsed-w: 68px;
    --header-h: 56px;
    --radius: 8px;
}

body.light, html[data-theme="light"] {
    --primary: #EA580C;
    --primary-hover: #C2410C;
    --primary-soft: rgba(234, 88, 12, 0.08);
    --primary-border: rgba(234, 88, 12, 0.15);
    --bg: #FFFFFF;
    --bg-sidebar: #FAFAFA;
    --bg-surface: #FFFFFF;
    --bg-hover: #F4F4F5;
    --bg-elevated: #FFFFFF;
    --bg-header: rgba(255, 255, 255, 0.85);
    --text: #18181B;
    --text-secondary: #52525B;
    --text-muted: #A1A1AA;
    --border: #E4E4E7;
    --border-light: #F4F4F5;
    --overlay: rgba(0, 0, 0, 0.5);
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
::selection { background: var(--primary); color: #fff; }

html, body { height: 100%; overflow: hidden; }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.2s;
}
.sidebar-overlay.active { display: block; opacity: 1; }

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    z-index: 999;
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease, transform 0.2s ease;
}

body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-w); }

.sidebar-header {
    padding: 0 16px;
    height: var(--header-h);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
}

.logo-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #fff;
    padding: 2px;
}
.logo-icon img { width: 100%; height: 100%; object-fit: contain; }

.logo-text {
    min-width: 0;
    opacity: 1;
    transition: opacity 0.15s;
    white-space: nowrap;
}
body.sidebar-collapsed .logo-text { opacity: 0; width: 0; pointer-events: none; }

.logo-text h1 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}
.logo-text span {
    font-size: 11px;
    color: var(--primary);
    font-weight: 600;
    font-family: var(--font-mono);
}

.icon-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.15s;
}
.icon-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    color: var(--primary);
}

.search-box {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    position: relative;
    flex-shrink: 0;
}
body.sidebar-collapsed .search-box { opacity: 0; pointer-events: none; height: 0; padding: 0; border: none; overflow: hidden; }

.search-icon {
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.search-box input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-surface);
    font-size: 13px;
    color: var(--text);
    outline: none;
    font-family: var(--font-sans);
}
.search-box input:focus { border-color: var(--primary); background: var(--bg-hover); }
.search-box input::placeholder { color: var(--text-muted); }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    min-height: 0;
}

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

.nav-section-title {
    padding: 12px 10px 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-family: var(--font-mono);
    white-space: nowrap;
    overflow: hidden;
}
body.sidebar-collapsed .nav-section-title { opacity: 0; height: 4px; padding: 0; pointer-events: none; }

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

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    margin: 1px 0;
    transition: all 0.15s;
    white-space: nowrap;
    overflow: hidden;
}
body.sidebar-collapsed .nav-link {
    padding: 8px;
    justify-content: center;
}

.nav-icon {
    flex-shrink: 0;
    opacity: 0.7;
    width: 18px;
    height: 18px;
}
.nav-link span { transition: opacity 0.15s; }
body.sidebar-collapsed .nav-link span { opacity: 0; width: 0; pointer-events: none; }

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text);
}
.nav-link:hover .nav-icon { opacity: 1; }

.nav-link.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 600;
}
.nav-link.active .nav-icon { opacity: 1; }

body.sidebar-collapsed .nav-link:hover::after,
body.sidebar-collapsed .nav-link.active::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-elevated);
    color: var(--text);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    border: 1px solid var(--border);
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.main-content {
    margin-left: var(--sidebar-w);
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.2s ease;
}
body.sidebar-collapsed .main-content { margin-left: var(--sidebar-collapsed-w); }

.top-header {
    height: var(--header-h);
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    flex-shrink: 0;
    z-index: 10;
}

.top-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--text-secondary);
    border-radius: 6px;
}
.menu-toggle:hover { background: var(--bg-hover); color: var(--text); }

.collapse-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.15s;
}
.collapse-btn:hover { background: var(--bg-hover); color: var(--primary); border-color: var(--primary); }

.theme-toggle {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.15s;
    position: relative;
    overflow: hidden;
}
.theme-toggle:hover { background: var(--bg-hover); border-color: var(--primary); color: var(--primary); }

.theme-toggle .sun-icon, .theme-toggle .moon-icon {
    position: absolute;
    transition: all 0.2s;
}
body.light .theme-toggle .sun-icon { opacity: 0; transform: rotate(90deg) scale(0); }
body.light .theme-toggle .moon-icon { opacity: 1; transform: rotate(0) scale(1); }
.theme-toggle .sun-icon { opacity: 1; transform: rotate(0) scale(1); }
.theme-toggle .moon-icon { opacity: 0; transform: rotate(-90deg) scale(0); }

.back-home-btn {
    height: 32px;
    padding: 0 14px;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}
.header-title h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.header-badge {
    padding: 2px 8px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-mono);
    border-radius: 4px;
    flex-shrink: 0;
}

.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
}

.welcome-page { flex: 1; overflow-y: auto; }
.welcome-content {
    max-width: 860px;
    margin: 0 auto;
    padding: 48px 40px 80px;
}

.hero-section {
    padding: 48px 0;
    margin-bottom: 48px;
    border-bottom: 1px solid var(--border-light);
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-mono);
    border-radius: 4px;
    margin-bottom: 20px;
}

.hero-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    padding: 12px;
}
.hero-icon img { width: 100%; height: 100%; object-fit: contain; }

.hero-section h1 {
    font-size: clamp(32px, 5vw, 44px);
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    line-height: 1.15;
}
.hero-section h1 span { color: var(--primary); }

.hero-subtitle {
    font-size: 17px;
    color: var(--text-secondary);
    max-width: 540px;
    margin-bottom: 28px;
    line-height: 1.6;
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn-primary-sm {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
    transition: background 0.15s;
}
.btn-primary-sm:hover { background: var(--primary-hover); text-decoration: none; }

.btn-ghost-sm {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary-border);
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
    transition: all 0.15s;
}
.btn-ghost-sm:hover { background: var(--primary-soft); text-decoration: none; }

.alert-box {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-left: 3px solid #f59e0b;
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 48px;
}
body.light .alert-box { background: rgba(245, 158, 11, 0.06); }
.alert-box-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #f59e0b;
    font-size: 14px;
    margin-bottom: 6px;
}
body.light .alert-box-title { color: #D97706; }
.alert-box-content { color: var(--text-secondary); font-size: 14px; line-height: 1.7; }
.alert-box-content ul { margin: 8px 0 0 20px; }
.alert-box-content li { margin-bottom: 4px; }
.alert-box-content a { color: var(--primary); text-decoration: underline; }

.info-section { margin-bottom: 48px; }

.section-header { margin-bottom: 20px; }
.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}
.section-desc { font-size: 14px; color: var(--text-secondary); }

.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.category-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    gap: 14px;
    transition: all 0.15s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}
.category-card:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
    transform: translateY(-1px);
}
.category-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: var(--radius);
    background: var(--primary-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    transition: all 0.15s;
}
.category-card:hover .category-icon { background: var(--primary); color: #fff; }
.category-info h3 { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.category-info p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 48px;
}
.feature-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: border-color 0.15s;
}
.feature-card:hover { border-color: var(--primary-border); }
.feature-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--primary-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    color: var(--primary);
}
.feature-card h3 { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.feature-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

.steps-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.step-item { display: flex; gap: 12px; }
.step-number {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 6px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    font-family: var(--font-mono);
}
.step-content h3 { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.step-content p { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

.doc-frame {
    flex: 1;
    border: none;
    display: none;
    background: var(--bg);
    width: 100%;
}
.doc-frame.active { display: block; }

.copyright {
    margin-top: 64px;
    padding-top: 32px;
    border-top: 1px solid var(--border-light);
}
.copyright p { font-size: 13px; color: var(--text-muted); }

.copyright-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.btn-outline-light {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}
.btn-outline-light:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }

@media (min-width: 1025px) { .collapse-btn { display: flex; } }

@media (max-width: 1024px) {
    .collapse-btn { display: none; }
    .sidebar { transform: translateX(-100%); width: var(--sidebar-w); }
    .sidebar.mobile-open { transform: translateX(0); }
    body.sidebar-collapsed .sidebar { width: var(--sidebar-w); }
    .main-content { margin-left: 0 !important; }
    .menu-toggle { display: flex; }
    .category-grid { grid-template-columns: 1fr; }
    .feature-grid { grid-template-columns: repeat(2, 1fr); }
    .steps-container { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .welcome-content { padding: 24px 20px 60px; }
    .hero-section { padding: 24px 0 32px; }
    .hero-section h1 { font-size: 28px; }
    .feature-grid { grid-template-columns: 1fr; }
    .steps-container { grid-template-columns: 1fr; }
    .top-header { padding: 0 12px; gap: 8px; }
    .header-badge { display: none; }
    .back-home-btn span { display: none; }
    .back-home-btn { padding: 0 10px; }
}
