﻿/* ===== 设计变量与基础样式 ===== */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #edf4ff;
    --secondary-color: #64748b;
    --success-color: #15805d;
    --warning-color: #c27a12;
    --danger-color: #dc4545;
    --info-color: #2563eb;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e8edf4;
    --gray-300: #d8e0eb;
    --gray-400: #a1aec0;
    --gray-500: #718096;
    --gray-600: #56657b;
    --gray-700: #3e4d63;
    --gray-800: #202e43;
    --gray-900: #152238;
    --background: #f5f7fb;
    --surface: #fff;
    --surface-variant: #f5f7fb;
    --outline: #e4eaf2;
    --outline-variant: #cbd5e1;
    --text-primary: #1e2d43;
    --text-secondary: #708096;
    --text-disabled: #a1aec0;
    --text-on-primary: #fff;
    --shadow-1: 0 2px 6px rgb(30 50 80 / 3%);
    --shadow-2: 0 5px 16px rgb(30 50 80 / 7%);
    --shadow-3: 0 8px 24px rgb(30 50 80 / 9%);
    --shadow-4: 0 12px 32px rgb(30 50 80 / 12%);
    --shadow-5: 0 24px 70px rgb(20 35 60 / 18%);
    --radius-sm: 5px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 999px;
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 28px;
    --spacing-2xl: 40px;
    --font-family: 'Segoe UI', 'Microsoft YaHei UI', 'Microsoft YaHei', sans-serif;
    --font-size-xs: 12px;
    --font-size-sm: 13px;
    --font-size-base: 14px;
    --font-size-lg: 16px;
    --font-size-xl: 18px;
    --font-size-2xl: 23px;
    --font-size-3xl: 28px;
    --sidebar-width: 216px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 14px; line-height: 1.6; }
body { display: flex; height: 100vh; overflow: hidden; background: var(--background); color: var(--text-primary); font-family: var(--font-family); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
svg.feather { display: inline-block; width: 20px; height: 20px; flex-shrink: 0; vertical-align: middle; }

/* ===== 导航 ===== */
.sidebar { flex: 0 0 var(--sidebar-width); width: var(--sidebar-width); display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--outline); z-index: 10; }
.sidebar-header { padding: 27px 22px 25px; }
.logo { display: flex; align-items: center; gap: 11px; }
.logo-mark { display: flex; align-items: center; justify-content: center; width: 39px; height: 43px; flex-shrink: 0; border-radius: 11px; background: var(--primary-color); color: #fff; box-shadow: 0 4px 10px rgb(37 99 235 / 16%); }
.logo-mark svg { width: 24px; height: 24px; }
.logo-copy { display: flex; flex-direction: column; }
.logo-copy > span { font-size: 22px; line-height: 1.4; font-weight: 700; letter-spacing: 1px; }
.logo-copy small { font-size: 10px; color: var(--text-secondary); letter-spacing: 0.5px; margin-top: 2px; white-space: nowrap; }
.nav-menu { flex: 1; overflow-y: auto; padding: 0 12px 20px; }
.nav-label { padding: 15px 12px 8px; color: #8c98aa; font-size: 11px; letter-spacing: 1px; }
.nav-label:not(:first-child) { margin-top: 13px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 13px; margin-bottom: 5px; border-radius: var(--radius-md); text-decoration: none; color: var(--gray-600); transition: background 160ms, color 160ms; }
.nav-item svg { width: 19px; height: 19px; stroke-width: 1.8; }
.nav-item:hover { background: var(--gray-50); color: var(--primary-color); }
.nav-item.active { background: var(--primary-light); color: var(--primary-color); font-weight: 600; }
.nav-item.active::after { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; margin-left: auto; }
.nav-item[data-page="history"] { margin-top: 24px; }
.sidebar-footer { margin: 0 18px; padding: 20px 3px 16px; border-top: 1px solid var(--outline); }
.user-info { display: flex; align-items: center; gap: 11px; }
.user-avatar { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 50%; color: #57728e; background: #eef2f7; }
.user-avatar svg { width: 18px; height: 18px; }
.user-info strong { display: block; font-size: 12px; font-weight: 600; }
.user-info span { display: block; font-size: 10px; color: var(--text-secondary); margin-top: 1px; }
.version { display: flex; justify-content: space-between; margin-top: 19px; color: #96a2b3; font-size: 10px; }

/* ===== 工作区 ===== */
.main-content { min-width: 0; flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.page-header { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 96px; padding: 13px 30px; background: var(--surface); border-bottom: 1px solid var(--outline); }
.header-left { min-width: 0; }
.breadcrumb { display: flex; align-items: center; gap: 9px; font-size: 10px; color: #94a0b2; margin-bottom: 5px; }
.breadcrumb span { color: #c3ccda; }
.page-title { font-size: var(--font-size-2xl); line-height: 1.45; font-weight: 650; letter-spacing: 0.4px; }
.page-subtitle { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }
.header-right { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.workspace-status { display: flex; align-items: center; gap: 6px; margin-right: 10px; font-size: 11px; color: var(--text-secondary); }
.workspace-status > span { width: 6px; height: 6px; background: #25a374; border-radius: 50%; }
.header-right .btn-icon { width: 34px; height: 34px; border: 1px solid var(--outline); background: #fff; }
.header-right svg { width: 17px; height: 17px; }
.page-container { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable; }
.page-content { display: none; padding: 24px 28px; width: 100%; max-width: 1480px; margin: 0 auto; }
.page-content.active { display: block; animation: fadeIn 180ms ease; }

/* ===== 首页概览 ===== */
.welcome-section { margin-bottom: 22px; }
.welcome-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 120px; padding: 18px 26px; border: 1px solid #dce8fc; border-radius: var(--radius-lg); background: #edf4ff; }
.welcome-copy { min-width: 0; }
.welcome-eyebrow { display: flex; align-items: center; gap: 7px; font-size: 10px; color: #6484b1; margin-bottom: 8px; letter-spacing: 1px; }
.welcome-eyebrow svg { width: 14px; height: 14px; }
.welcome-card h2 { font-size: 23px; line-height: 1.5; font-weight: 650; color: #1e4075; letter-spacing: 0.5px; }
.welcome-card p { font-size: 12px; margin-top: 6px; color: #6c83a4; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(70px, 1fr)); flex-shrink: 0; }
.stat-item { min-width: 89px; padding: 1px 20px; text-align: center; }
.stat-item + .stat-item { border-left: 1px solid #d7e3f6; }
.stat-number { display: block; font-size: 30px; line-height: 1.2; font-weight: 650; color: #275bc0; font-variant-numeric: tabular-nums; }
.stat-unit { margin-left: 4px; font-size: 11px; font-weight: 400; }
.stat-label { display: block; font-size: 10px; margin-top: 9px; color: #7288a7; white-space: nowrap; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.section-heading > div { display: flex; align-items: baseline; gap: 13px; }
.section-heading h2 { font-size: 15px; font-weight: 650; }
.section-heading span { font-size: 11px; color: #8693a6; }
.section-heading .section-count { font-size: 10px; border: 1px solid var(--outline); padding: 2px 8px; border-radius: var(--radius-full); background: #fff; white-space: nowrap; }
.modules-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.module-card { --module-color: #2563eb; --module-bg: #edf4ff; display: flex; flex-direction: column; position: relative; min-width: 0; padding: 18px 20px 14px; background: var(--surface); border: 1px solid var(--outline); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); cursor: pointer; transition: border-color 180ms, box-shadow 180ms, transform 180ms; }
.module-card:hover, .module-card:focus-within { border-color: #b0c8f7; box-shadow: var(--shadow-3); transform: translateY(-2px); }
.module-card[data-module="electrical"] { --module-color: #c48a21; --module-bg: #fff7e8; }
.module-card[data-module="foundation"] { --module-color: #15866d; --module-bg: #eaf7f2; }
.module-card[data-module="lifting"] { --module-color: #7960c4; --module-bg: #f2eefa; }
.module-card[data-module="concrete"] { --module-color: #507a9f; --module-bg: #edf4f9; }
.module-card.quick-access { --module-color: #71839f; --module-bg: #edf1f7; background: #fafbfd; border-style: dashed; box-shadow: none; }
.module-icon { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; margin-bottom: 10px; border-radius: 10px; background: var(--module-bg); color: var(--module-color); }
.module-icon svg { width: 21px; height: 21px; stroke-width: 1.8; }
.module-content { flex: 1; }
.module-content h3 { font-size: 16px; line-height: 1.5; font-weight: 650; color: var(--text-primary); }
.module-content p { margin-top: 5px; margin-bottom: 10px; font-size: 11px; line-height: 1.7; color: var(--text-secondary); }
.module-features { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.feature-tag { font-size: 10px; padding: 2px 7px; background: #f4f6f9; color: #8591a3; border-radius: 4px; white-space: nowrap; }
.recent-count { margin-bottom: 14px; font-size: 11px; color: #8591a3; }
.recent-count span { color: var(--primary-color); font-weight: 600; }
.module-action { display: flex; justify-content: flex-end; padding-top: 8px; border-top: 1px solid #f0f3f8; }
.module-action .btn { min-height: 28px; padding: 3px 0 3px 10px; color: var(--primary-color); background: transparent; font-size: 11px; border: 0; box-shadow: none; gap: 8px; }
.module-action .btn:hover:not(:disabled) { background: transparent; color: var(--primary-hover); box-shadow: none; }
.module-action svg { width: 14px; height: 14px; transition: transform 180ms; }
.module-card:hover .module-action svg { transform: translateX(3px); }
.workspace-note { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 21px 0 0; font-size: 10px; color: #94a1b3; }
.workspace-note svg { width: 13px; height: 13px; }

/* ===== 公共按钮 ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 8px 16px; border: 1px solid transparent; border-radius: var(--radius-md); font-family: var(--font-family); font-size: var(--font-size-sm); font-weight: 500; line-height: 1.4; text-align: center; text-decoration: none; cursor: pointer; transition: background 160ms, color 160ms, border-color 160ms; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--primary-color); color: var(--text-on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: #fff; color: var(--gray-600); border-color: var(--outline); }
.btn-secondary:hover:not(:disabled) { background: var(--gray-50); border-color: var(--outline-variant); }
.btn-icon { width: 34px; height: 34px; min-height: 34px; padding: 7px; color: var(--text-secondary); background: transparent; }
.btn-icon:hover:not(:disabled) { color: var(--primary-color); background: var(--primary-light); }
.btn svg { width: 16px; height: 16px; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd4e0; border: 1px solid var(--background); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #a7b4c5; }
:is(button, a, input, select, textarea):focus-visible { outline: 2px solid var(--primary-color); outline-offset: 3px; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ===== 窗口适配 ===== */
@media (max-width: 1150px) {
    :root { --sidebar-width: 196px; }
    .sidebar-header { padding-left: 18px; padding-right: 16px; }
    .page-header { padding-left: 24px; padding-right: 24px; }
    .page-content { padding: 22px; }
    .welcome-card { padding: 22px; gap: 16px; }
    .stat-item { padding: 0 13px; min-width: 76px; }
    .welcome-card h2 { font-size: 21px; }
    .module-card { padding: 18px 18px 13px; }
    .module-content p { min-height: 37px; }
}
@media (max-width: 960px) {
    .modules-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .welcome-card { flex-direction: column; align-items: stretch; }
    .stats-grid { margin-top: 4px; }
    .stat-item { text-align: left; padding-left: 15px; }
    .stat-item:first-child { padding-left: 0; }
    .stat-number { font-size: 25px; }
    .stat-label { margin-top: 4px; }
    .module-content p { min-height: 0; }
    .section-heading > div > span { display: none; }
}
@media (max-width: 720px) {
    :root { --sidebar-width: 68px; }
    .sidebar-header { padding: 22px 14px; }
    .logo-mark { width: 38px; height: 40px; }
    .logo-copy, .nav-label, .nav-item > span, .nav-item.active::after, .sidebar-footer { display: none; }
    .nav-menu { padding: 6px 10px; }
    .nav-item { justify-content: center; padding: 12px; margin-bottom: 9px; }
    .page-header { min-height: 100px; padding: 16px 20px; }
    .page-title { font-size: 21px; }
    .workspace-status { display: none; }
    .page-content { padding: 20px; }
}
@media (max-width: 520px) {
    .page-header { padding: 14px; gap: 8px; }
    .page-title { font-size: 19px; }
    .page-subtitle { display: none; }
    .header-right { gap: 5px; }
    .header-right .btn-icon { width: 30px; height: 30px; min-height: 30px; }
    .page-content { padding: 16px 14px; }
    .welcome-card { padding: 18px; }
    .welcome-card h2 { font-size: 19px; }
    .stat-item { min-width: 0; padding: 0 9px; }
    .stat-label { font-size: 9px; }
    .modules-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .section-count { display: none; }
    .workspace-note { align-items: flex-start; }
    .workspace-note svg { margin-top: 3px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
