﻿/*
 * =================================================================================================
 *  样式表目录 (Table of Contents)
 * =================================================================================================
 *
 *  1.  全局变量与基础样式 (Global Variables & Base Styles)
 *  2.  主要布局结构 (Main Layout)
 *  3.  顶部标题栏 (Header)
 *  4.  侧边栏 (Sidebar)
 *      - 4.1 容器与布局 (Container & Layout)
 *      - 4.2 控制区 (切换与搜索) (Controls: Toggle & Search)
 *      - 4.3 折叠状态 (Collapsed State)
 *      - 4.4 树形导航 (Tree Navigation)
 *  5.  主内容区 (Main Content)
 *      - 5.1 通用面板与卡片 (Generic Panels & Cards)
 *      - 5.2 项目信息表单 (Project Info Form)
 *      - 5.3 计费项选择网格 (Billing Item Selection Grid)
 *  6.  已选计费项列表 (Selected Items List)
 *      - 6.1 列表容器 (Container)
 *      - 6.2 结果卡片 (Result Card)
 *      - 6.3 拖拽排序样式 (Drag & Drop Sorting Styles)
 *  7.  底部浮动汇总栏 (Sticky Summary Footer)
 *      - 7.1 基础与桌面端样式 (Base & Desktop Styles)
 *      - 7.2 移动端响应式样式 (Mobile Responsive Styles)
 *      - 7.3 项目状态显示样式 (Project Status Display)
 *  8.  通用模态框/弹窗 (Global Modal)
 *  9.  特定模态框样式 (Specific Modal Styles)
 *      - 9.1 项目管理弹窗 (Projects Modal)
 *      - 9.2 工程勘察弹窗 (Survey Modal Fixes)
 * 10.  登录、注册与用户管理 (Auth & User Management)
 *      - 10.1 登录界面 (Login Screen)
 *      - 10.2 注册验证码 (Verification Code)
 *      - 10.3 用户管理界面 (User Management Panel)
 * 11.  通用组件 (Utility Components)
 *      - 11.1 操作按钮 (Action Buttons)
 *      - 11.2 提示工具 (Tooltips)
 * 12.  页面页脚 (App Footer)
 * 13.  动画效果 (Animations)
 * 14.  全局响应式调整 (Global Responsive Adjustments)
 * 15.  全局顶部公告条 (Global Announcement Bar)
 * =================================================================================================
 */


/* --- 1. 全局变量与基础样式 --- */

:root {
    /* 定义颜色、字体、阴影等全局变量 */
    --primary-color: #005A9C;
    /* 主题色：专业蓝 */
    --primary-light: #E6F4FF;
    /* 主题浅色 */
    --background-color: #F4F7FC;
    --card-background: #FFFFFF;
    --text-color: #333;
    --text-light: #8A92A6;
    --border-color: #E9ECEF;
    --danger-color: #cc0000;
    /* 警示红色，用于删除按钮 */
    --shadow: 0 10px 30px rgba(22, 8, 49, 0.05);
    --font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    font-size: 16px;
}

/* --- 2. 主要布局结构 --- */

.app-container {
    /* 页面内容主容器 */
    max-width: 1600px;
    margin: 20px auto;
    padding: 0 30px;
}

.main-layout {
    /* 主体内容区采用 Flex 布局，分为侧边栏和主内容区 */
    display: flex;
    gap: 80px; /* 侧边栏和主内容区之间的间距 */
    align-items: flex-start;
}


/* --- 3. 顶部标题栏 --- */

.app-header {
    background: linear-gradient(135deg, #007BFF 0%, #005A9C 100%);
    color: white;
    padding: 40px;
    border-radius: 16px;
    margin-bottom: 30px;
    text-align: center;
    position: relative;
    overflow: hidden; /* 隐藏超出范围的装饰性元素 */
    box-shadow: 0 8px 25px rgba(0, 90, 156, 0.25);
}

/* 使用伪元素创建背景装饰性圆圈 */
.app-header::before,
.app-header::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.05);
    z-index: 0;
}

.app-header::before {
    width: 200px;
    height: 200px;
    top: -50px;
    left: -50px;
}

.app-header::after {
    width: 300px;
    height: 300px;
    bottom: -100px;
    right: -100px;
}

/* 确保标题和文本在装饰性圆圈之上 */
.app-header h1,
.app-header p {
    position: relative;
    z-index: 1;
}

.app-header h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 700;
}

.app-header h1 i {
    margin-right: 15px;
}

.app-header p {
    margin: 10px 0 0;
    opacity: 0.85;
}

/* 退出登录按钮 */
#logout-btn {
    position: absolute;
    top: 20px;
    right: 25px;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
}

#logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: white;
}


/* --- 4. 侧边栏 --- */

/* 4.1 容器与布局 */
.sidebar-container {
    position: relative; /* 为切换按钮的绝对定位提供父级 */
    flex-shrink: 0;     /* 防止侧边栏在 Flex 布局中被压缩 */
    width: 280px;
    transition: width 0.3s ease-in-out;
}

.module-sidebar {
    width: 100%;
    height: calc(100vh - 120px); /* 视口高度减去大致的上下边距，使其具有粘性效果 */
    min-height: 500px;
    background-color: var(--card-background);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease-in-out, opacity 0.2s;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-shrink: 0; /* 防止头部被压缩 */
}

.sidebar-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.sidebar-title i {
    font-size: 1.4rem;
}

.sidebar-content {
    overflow-y: auto; /* 当内容超出时显示滚动条 */
    padding-right: 10px;
}

/* 自定义滚动条样式 */
.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* 4.2 控制区 (切换与搜索) */
.sidebar-controls {
    display: flex;
    flex-direction: column;
    gap: 15px; /* 控制切换器和搜索框之间的间距 */
    margin-bottom: 15px;
    flex-shrink: 0; /* 防止此区域被压缩 */
}

.view-toggle {
    display: flex;
    background-color: #E9ECEF;
    border-radius: 8px;
    padding: 4px;
    width: 100%;
    box-sizing: border-box;
}

.view-toggle .toggle-btn {
    flex: 1; /* 让两个按钮平分宽度 */
    text-align: center;
    background-color: transparent;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
    transition: all 0.2s ease-in-out;
    -webkit-appearance: none; /* 移除移动端默认样式 */
    appearance: none;
}

.view-toggle .toggle-btn.active {
    background-color: var(--card-background);
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
    transform: scale(1.02); /* 激活时轻微放大 */
}

.sidebar-search {
    position: relative;
}

.sidebar-search .fa-search {
    position: absolute;
    top: 50%;
    left: 15px;
    transform: translateY(-50%);
    color: var(--text-light);
    pointer-events: none; /* 让图标不影响输入框的点击 */
}

.sidebar-search input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 15px 12px 40px; /* 左侧内边距为图标留出空间 */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    background-color: #F8F9FA;
}

.sidebar-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: var(--card-background);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* 4.3 折叠状态 */
.sidebar-toggle {
    position: absolute;
    top: 15px;
    right: -18px; /* 位于侧边栏外部 */
    z-index: 10;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    color: var(--text-light);
    font-size: 1.2rem;
    transition: right 0.3s ease-in-out, left 0.3s ease-in-out, transform 0.3s ease-in-out;
}

.sidebar-toggle:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

body.sidebar-collapsed .sidebar-container {
    width: 0; /* 折叠时容器宽度为0 */
}

body.sidebar-collapsed .module-sidebar {
    transform: translateX(-100%); /* 向左移出视口 */
    opacity: 0;
}

body.sidebar-collapsed .sidebar-toggle {
    right: auto;
    left: 10px; /* 移动到页面左侧边缘 */
    transform: rotate(180deg); /* 箭头翻转 */
}

/* 4.4 树形导航 */
.tree-nav,
.tree-nav ul {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

.tree-nav-category > .category-header-wrapper {
    display: flex;
    align-items: center;
    padding: 12px 10px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.tree-nav-category > .category-header-wrapper:hover {
    background-color: #f8f9fa;
}

.tree-nav-category .category-icon {
    margin-right: 10px;
    color: var(--primary-color);
}

.tree-nav-category .category-name {
    flex-grow: 1; /* 占据剩余空间 */
}

.tree-nav-category .toggle-arrow {
    transition: transform 0.3s;
    font-size: 0.8em;
}

.tree-nav-category.collapsed .toggle-arrow {
    transform: rotate(-90deg); /* 折叠时箭头旋转 */
}

.tree-nav-items {
    padding-left: 20px;
    max-height: 1000px; /* 设置一个足够大的最大高度以实现动画 */
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
}

.tree-nav-category.collapsed .tree-nav-items {
    max-height: 0; /* 折叠时高度为0，实现平滑收起效果 */
}

.tree-nav-item {
    padding: 10px 10px 10px 15px;
    border-left: 2px solid var(--border-color);
    margin-left: 5px;
    cursor: pointer;
    border-radius: 0 6px 6px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-light);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.tree-nav-item:hover,
.tree-nav-item.highlight {
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 500;
}

.tree-nav-item i {
    width: 16px;
    text-align: center;
}

.tree-nav-item .status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: transparent;
    margin-left: auto; /* 自动推到最右侧 */
    transition: background-color 0.3s;
}

.tree-nav-item.completed {
    color: #333; /* 完成项的文字颜色加深 */
}

.tree-nav-item.completed .status-indicator {
    background-color: #28a745; /* 绿色状态点 */
    box-shadow: 0 0 8px #28a745;
}

/* 用于搜索功能，隐藏不匹配的项 */
.tree-nav-category.hidden-by-search,
.tree-nav-item.hidden-by-search {
    display: none;
}


/* --- 5. 主内容区 --- */

.main-content {
    flex: 1; /* 占据剩余的所有宽度 */
    min-width: 0; /* 防止内容过长时撑开布局 */
}

/* 内容面板切换效果 */
.content-panel {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.content-panel.active {
    display: block;
}

/* 5.1 通用面板与卡片 */
.card {
    background-color: var(--card-background);
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    overflow: hidden;
}

.card-header {
    background-color: #fff;
    color: #343a40;
    padding: 18px 25px;
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-header i {
    color: var(--primary-color);
}

.card-body {
    padding: 30px;
}

/* 5.2 项目信息表单 */
.project-info-form {
    display: grid;
    grid-template-columns: 1fr; /* 移动端默认单列 */
    gap: 20px;
}

/* 响应式网格布局 */
@media (min-width: 768px) {
    .project-info-form {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .project-info-form {
        grid-template-columns: repeat(4, 1fr);
    }
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
    display: flex;
    align-items: center;
}

.form-group input,
.form-group select {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease-in-out;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* 5.3 计费项选择网格 */
.selection-grid {
    display: grid;
    /* 自动适应的网格布局，每项最小宽度360px */
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 30px;
    padding-top: 5px;
}

.selection-item {
    /* 通过 CSS 变量接收来自 JS 的主题色 */
    --item-color: var(--item-theme-color, var(--primary-color));
    --item-bg: var(--item-theme-bg, var(--primary-light));
    background-color: var(--card-background);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(22, 8, 49, 0.04);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

/* 顶部的彩色装饰条 */
.selection-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: var(--item-color);
    transition: height 0.3s ease, box-shadow 0.3s ease;
}

.selection-item:hover {
    transform: translateY(-8px); /* 悬浮时上移 */
    box-shadow: 0 12px 30px rgba(22, 8, 49, 0.08), 0 0 0 1px var(--item-color);
}

.selection-item:hover::before {
    height: 6px;
    box-shadow: 0 0 15px var(--item-color);
}

/* 被选中（高亮）时的样式 */
.selection-item.highlight {
    box-shadow: 0 0 0 3px var(--primary-color), 0 12px 30px rgba(0, 90, 156, 0.2);
    transform: scale(1.02);
}

.selection-item-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 12px;
}

.selection-item-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--item-bg);
    flex-shrink: 0;
}

.selection-item-header i {
    color: var(--item-color);
    font-size: 1.6rem;
}

.selection-item h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: #333;
}

.selection-item p {
    margin: 0 0 20px 0;
    color: var(--text-light);
    font-size: 0.9rem;
    flex-grow: 1; /* 占据剩余空间，确保按钮总在底部 */
}

.selection-item .action-button {
    width: 100%;
    background: var(--item-bg);
    color: var(--item-color);
    font-weight: 600;
    padding: 12px 20px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.selection-item:hover .action-button {
    background: var(--item-color);
    color: white;
    transform: scale(1.03);
}

.selection-item .action-button:disabled,
.selection-item .action-button:disabled:hover {
    background-color: #f0f0f0;
    color: #adb5bd;
    cursor: not-allowed;
    transform: none;
    border-color: #e9ecef;
}

/* 前期工作工程勘察弹窗内的附加费用布局 */
.additional-fee-section {
    display: grid;
    /* 使用两列布局，左边是 checkbox，右边是输入框 */
    grid-template-columns: auto 1fr;
    gap: 10px 20px; /* 行间距10px，列间距20px */
    align-items: center; /* 垂直居中对齐 */
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.additional-fee-section .form-group-checkbox {
    grid-column: 1 / -1; /* 让 checkbox 标题行占据整行宽度 */
    display: flex;
    align-items: center;
    gap: 10px;
}

.additional-fee-section .form-group-checkbox input[type="checkbox"] {
    transform: scale(1.3);
    margin: 0;
}

.additional-fee-section .form-group-checkbox label {
    margin: 0;
    font-weight: normal; /* 移除加粗，让 strong 标签控制 */
}

.additional-fee-section .form-group {
    margin-bottom: 0;
    grid-column: 2 / 3; /* 让输入框组只占据第二列 */
    padding-left: 25px !important; /* 保持缩进 */
}

.additional-fee-section .form-group label {
    font-size: 0.9em;
    margin-bottom: 8px;
}


/* --- 6. 已选计费项列表 --- */

/* 6.1 列表容器 */
#results-section {
    margin-top: 40px;
}

#results-section .card-header {
    border-radius: 12px 12px 0 0;
}

#results-container {
    margin-top: 0;
    padding: 25px;
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 20px;
}

/* 6.2 结果卡片 */
.result-card {
    --item-theme-color: var(--primary-color);
    background-color: var(--card-background);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(22, 8, 49, 0.04);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    padding: 0;
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--item-theme-color); /* 左侧彩色标识 */
    animation: fadeIn 0.5s ease-out;
}

.result-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 25px;
    margin: 0;
    border-bottom: none;
    background: transparent;
}

.result-card .card-header h3 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0;
}

.result-card .card-header i {
    color: var(--item-theme-color);
    font-size: 1.3rem;
}

.result-card .card-actions {
    display: flex;
    gap: 10px; /* 编辑和删除按钮之间的间距 */
}

.result-card .remove-btn,
.result-card .edit-btn {
    background-color: #f8f9fa;
    color: #6c757d;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.result-card .edit-btn:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.result-card .remove-btn:hover {
    background-color: #fdeeee;
    color: #d9534f;
    border-color: #d9534f;
    transform: translateY(-1px);
}

.result-card .remove-btn:hover i {
    color: #d9534f;
}

.result-card-body {
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 15px;
    border-top: 1px solid var(--border-color);
    margin: 0 25px; /* 与卡片内边距对齐 */
}

.result-card-body .result-details {
    flex-grow: 1;
}

.result-card-body p {
    margin: 0;
    color: var(--text-light);
    font-size: 0.95rem;
}

.result-card .final-cost {
    font-weight: 700;
    font-size: 2rem;
    color: var(--primary-color);
    text-align: right;
    margin: 0;
    white-space: nowrap;
}

/* 6.3 拖拽排序样式 */
.result-card {
    cursor: grab; /* 提示用户此卡片可拖拽 */
}

.result-card:active {
    cursor: grabbing; /* 拖拽过程中的鼠标样式 */
}

/* 拖动时，被拖动元素的原位置占位符样式 */
.sortable-ghost {
    opacity: 0.4;
    background-color: var(--primary-light);
    border: 2px dashed var(--primary-color);
}


/* --- 7. 底部浮动汇总栏 (分层布局版) --- */

/* 7.1 基础容器样式 */
#section-summary {
    position: sticky;
    bottom: 0;
    z-index: 100;
    margin-bottom: 0;
    border-top: 3px solid var(--primary-color); /* 顶部线条加粗一点 */
    box-shadow: 0 -10px 40px rgba(22, 8, 49, 0.12); /* 阴影稍微加深 */
    border-radius: 12px 12px 0 0;
    background: rgba(255, 255, 255, 0.98); /* 增加不透明度 */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-sizing: border-box;
    width: auto;
    transition: margin-left 0.3s ease-in-out;
}

.summary-body {
    padding: 15px 30px; /* 增加左右内边距 */
}

/* 7.2 PC端分层布局核心样式 */
.summary-desktop {
    display: flex;
    flex-direction: column; /* 垂直排列 */
    gap: 12px; /* 上下两层的间距 */
}

/* 上层：项目信息 + 金额 */
.summary-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center; /* 垂直居中 */
    padding-bottom: 12px;
    border-bottom: 1px solid #eaeaea; /* 柔和的分割线 */
}

/* 左上：项目概况组 */
.project-overview-group {
    display: flex;
    align-items: center; /* 水平排列 */
    gap: 15px; /* 元素间距 */
}

/* 项目状态显示条 */
.project-status-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background-color: #f0f7ff; /* 极淡的蓝色背景 */
    border: 1px solid #cce5ff;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-color);
    max-width: 300px;
}

.project-status-display .project-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 已选计数徽章 */
.summary-item-count a {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #f8f9fa;
    color: #666;
    padding: 6px 16px;
    border: 1px solid #e9ecef;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.summary-item-count a:hover {
    background-color: #e2e6ea;
    color: #333;
}

/* 右上：金额显示区 */
.summary-totals {
    text-align: right;
    display: flex;
    align-items: baseline; /* 基线对齐，让文字底部对齐 */
    gap: 20px; /* 各项金额之间的间距 */
}

.summary-totals p {
    margin: 0;
    font-size: 0.9rem;
    color: #888;
}

.summary-totals .total-amount {
    font-size: 2.2rem; /* 大号字体突出总价 */
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
    margin-left: 10px;
}

/* 下层：折扣 + 按钮 */
.summary-row-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 左下：折扣设置 */
.discount-section {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #fcfcfc;
    padding: 5px 10px;
    border-radius: 8px;
}

.discount-section label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #555;
}

.discount-section select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    min-width: 160px;
}

.discount-section input#custom-discount {
    width: 100px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
}

/* 右下：按钮组 */
.summary-buttons {
    display: flex;
    gap: 12px;
}

.summary-buttons .action-button {
    padding: 10px 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.summary-buttons .action-button i {
    margin-right: 6px;
}

/* 另存为按钮的特殊颜色 */
.btn-save-as {
    background-color: #17a2b8;
}
.btn-save-as:hover {
    background-color: #138496;
}

/* 保存按钮的特殊颜色 */
.btn-save {
    background-color: #28a745;
}
.btn-save:hover {
    background-color: #218838;
}

/* 导出按钮保持主色调 */
#export-btn {
    background-color: var(--primary-color);
}
#export-btn:hover {
    filter: brightness(1.1);
}

/* 响应式适配：确保在较窄的屏幕上也能正常显示 */
@media (max-width: 1199px) {
    .summary-desktop { display: none; } /* 移动端逻辑接管 */
}

/* 针对侧边栏展开/收起的定位调整 */
@media (min-width: 993px) {
    #section-summary {
        margin-left: 360px;
    }
    body.sidebar-collapsed #section-summary {
        margin-left: 80px;
    }
}

/* 7.2 移动端响应式样式 */
.summary-mobile {
    display: none; /* 默认隐藏，仅在小屏幕显示 */
}

@media (max-width: 1199px) {
    /* 切换显示 PC 和 Mobile 版本的汇总栏 */
    .summary-desktop {
        display: none;
    }
    .summary-mobile {
        display: block;
    }

    .summary-body {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 15px;
    }

    .summary-main {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    .summary-totals-mobile {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    /* 隐藏原有的 p 标签，使用伪元素显示信息 */
    .summary-totals-mobile p {
        display: none;
    }
    .summary-totals-mobile::before {
        content: attr(data-summary-text); /* 从 data 属性获取文本 */
        white-space: pre;
        font-size: 0.8rem;
        color: var(--text-light);
        line-height: 1.5;
        order: 1;
    }
    .summary-totals-mobile::after {
        content: attr(data-total-amount); /* 从 data 属性获取金额 */
        font-size: 2.4rem;
        font-weight: 700;
        color: var(--primary-color);
        line-height: 1.1;
        order: 2;
    }

    /* 展开/收起按钮 */
    .summary-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: var(--primary-light);
        color: var(--primary-color);
        border: none;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        cursor: pointer;
        transition: transform 0.3s ease-in-out;
    }

    /* 可折叠的详细内容区域 */
    .summary-details-collapsible {
        width: 100%;
        overflow: hidden;
        max-height: 0; /* 默认收起 */
        transition: max-height 0.4s ease-in-out, padding-top 0.4s ease-in-out;
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    #section-summary.is-expanded .summary-details-collapsible {
        max-height: 500px; /* 展开时的高度 */
        padding-top: 20px;
    }

    #section-summary.is-expanded .summary-toggle {
        transform: rotate(180deg); /* 按钮箭头翻转 */
    }

    .summary-item-count-mobile a {
        background-color: var(--primary-light);
        color: var(--primary-color);
        border: 1px solid transparent;
        border-radius: 50px;
        font-weight: 600;
        padding: 10px 24px;
        display: flex;
        justify-content: center;
        width: auto;
        max-width: 220px;
        margin: 0 auto;
        font-size: 1rem;
    }

    .summary-item-count-mobile a:hover {
        background-color: #d1e9ff;
    }

    .discount-section-mobile .discount-section {
        justify-content: space-between;
    }

    .discount-section-mobile select,
    .discount-section-mobile input {
        min-width: 0;
        flex-grow: 1;
    }

    /* 移动端底部按钮组 */
    .export-btn-mobile {
        display: flex;
        gap: 10px;
    }
    .export-btn-mobile .action-button {
        flex: 1; /* 让按钮平分宽度 */
        padding: 12px 10px;
        font-size: 1rem;
        font-weight: 600;
    }
    .export-btn-mobile .action-button i {
        font-size: 1.1em;
        vertical-align: middle;
    }
}

/* 极小屏幕额外优化 */
@media (max-width: 480px) {
    .discount-section-mobile .discount-section {
        flex-wrap: wrap;
        justify-content: flex-start;
    }
    .discount-section-mobile .discount-section label {
        display: none; /* 隐藏标签以节省空间 */
    }
    .discount-section-mobile select,
    .discount-section-mobile input {
        flex-grow: 1;
        min-width: 120px;
    }
}
/* --- 7.3 项目状态显示样式 (修改部分) --- */

/* 新增：用于垂直排列项目名称和已选项数的包裹容器 */
.project-overview-group {
    display: flex;
    flex-direction: column; /* 核心：设置主轴为垂直方向 */
    align-items: flex-start; /* 项目向左对齐 */
    gap: 8px; /* 设置垂直间距 */
    flex-shrink: 0;
}

/* 修改：调整项目状态显示样式，使其更紧凑 */
.project-status-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px; /* 减小内边距 */
    background-color: rgba(0, 90, 156, 0.1);
    border-radius: 50px;
    font-size: 0.9rem; /* 减小字体大小 */
    font-weight: 600;
    color: var(--primary-color);
    flex-shrink: 0;
    max-width: 250px; /* 适当减小最大宽度 */
}

/* 修改：调整已选项数样式，使其与上方对齐且更紧凑 */
.summary-item-count a {
    display: flex;
    align-items: center;
    gap: 8px; /* 减小图标与文字间距 */
    background-color: var(--primary-light);
    color: var(--primary-color);
    padding: 6px 14px; /* 减小内边距 */
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem; /* 减小字体大小 */
    transition: all 0.3s ease;
    cursor: pointer;
}

.project-status-display .project-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-status-display .status-star {
    color: #ffc107;
    font-size: 1.1em; /* 调整星号大小 */
    font-weight: bold;
    line-height: 1;
}

/* 移动端特定样式 (这部分不受影响，无需修改) */
#project-status-mobile {
    margin: 0 auto 15px auto;
    justify-content: center;
    max-width: 90%;
}

/* --- 8. 通用模态框/弹窗 --- */

.modal-container {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0; /* 默认透明 */
    transition: opacity 0.3s ease;
    pointer-events: none; /* 默认不可点击 */
}

/* 显示时的状态 */
.modal-container.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 0;
    border: none;
    width: 90%;
    max-width: 800px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
    transform: scale(0.95); /* 默认缩小 */
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 85vh; /* 限制最大高度，防止内容过长 */
}

.modal-container.show .modal-content {
    transform: scale(1); /* 显示时恢复正常大小 */
}

#modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    position: sticky; /* 头部在内容滚动时固定 */
    top: 0;
    background-color: #fefefe;
    z-index: 10;
}

#modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

.close-btn {
    color: #aaa;
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover,
.close-btn:focus {
    color: black;
}

#modal-body {
    padding: 25px;
}

#modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end; /* 按钮靠右对齐 */
    gap: 10px;
    position: sticky; /* 脚部在内容滚动时固定 */
    bottom: 0;
    background-color: #fefefe;
    z-index: 10;
}

#modal-footer .action-button {
    padding: 10px 24px;
    font-weight: 600;
}

/* 弹窗内的表单样式 */
.modal-form .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* 弹窗内的选项组（如 Radio/Checkbox） */
.options-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.options-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}

.options-group input {
    width: auto;
    accent-color: var(--primary-color);
    transform: scale(1.2);
}
/* 信息模态框内文样式 */
#info-modal-body {
    padding: 25px; /* 为内容区提供25像素的内边距 */
    line-height: 1.8;  /* 将行高样式移到此处，方便管理 */
}
#info-modal-body h3 {
    font-size: 1.1em;
    color: var(--primary-color);
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

#info-modal-body h3:first-child {
    margin-top: 0;
}

#info-modal-body p {
    margin-bottom: 1em;
}

#info-modal-body code {
    background-color: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: Consolas, monospace;
}

/* --- 9. 特定模态框样式 --- */

/* 9.1 项目管理弹窗 */
#projects-modal-header {
    padding: 20px 25px;
    background-color: var(--card-background);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1;
}

/* 确保项目弹窗标题颜色正确 */
#projects-modal-header h2,
#projects-modal-header h2 i.fas {
    color: #212529 !important; /* 使用 !important 强制覆盖通用样式 */
}

#projects-modal-body {
    padding: 0; /* 移除内边距，由内部网格控制 */
}

#project-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    padding: 25px;
    max-height: 60vh;
    overflow-y: auto;
}

.project-card {
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border-left: 5px solid transparent;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 90, 156, 0.1);
    border-left-color: var(--primary-color);
}

.project-card-header {
    flex-grow: 1;
    margin-bottom: 20px;
}

.project-card h3 {
    margin: 0 0 12px 0;
    font-size: 1.25em;
    color: var(--primary-color);
    word-break: break-all; /* 防止长标题溢出 */
}

.project-card small {
    display: block;
    color: var(--text-light);
    font-size: 0.9em;
    line-height: 1.6;
}

.project-card-footer {
    display: flex;
    gap: 12px;
}

.project-card-footer .action-button {
    flex-grow: 1;
    padding: 12px;
    font-size: 1em;
    font-weight: 600;
    border-radius: 8px;
}

/* 删除按钮的特殊样式 */
.project-card-footer .btn-delete {
    background-color: transparent;
    color: var(--danger-color);
    border: 1px solid #f1b0b7; /* 非常淡的红色边框 */
    font-weight: 500;
}

.project-card-footer .btn-delete:hover {
    background-color: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

#projects-modal-footer.new-footer-layout {
    display: flex;
    justify-content: space-between; /* 两端对齐 */
    align-items: center;
    background-color: #f8f9fa;
    border-top: 1px solid var(--border-color);
    position: sticky;
    bottom: 0;
    z-index: 1;
}

#projects-modal-footer.new-footer-layout .action-button {
    font-size: 1em;
    padding: 12px 24px;
    font-weight: 600;
}

#projects-modal-footer .btn-new {
    background-color: #28a745; /* 绿色 */
}

#projects-modal-footer .btn-new:hover {
    filter: brightness(1.1);
}

#projects-modal-footer .btn-close-modal {
    background-color: #6c757d; /* 灰色 */
}

#projects-modal-footer .btn-close-modal:hover {
    background-color: #5a6268;
}

/* 加载或空状态的提示文本 */
#project-list-placeholder {
    font-size: 1.1em;
    line-height: 1.8;
}

/* 9.2 工程勘察弹窗 (样式修复) */
/* 解决弹窗内下拉框无法正常点击的问题 */

/* 1. 为表单创建独立的、可靠的层叠上下文 */
.modal-form {
    position: relative;
    z-index: 1;
}

/* 2. 强制将所有 hr 分割线“下沉”到底层，消除遮挡 */
.modal-form hr {
    position: relative;
    z-index: -1;
}

/* 3. 强制将所有 form-group（包含下拉框）“上浮”到顶层，确保可点击 */
.modal-form .form-group {
    position: relative;
    z-index: 2;
}

/* 4. 确保动态生成的字段容器本身不会错误地创建层叠上下文 */
#modal-sd-dynamic-fields {
    position: relative;
    z-index: 1;
}


/* --- 10. 登录、注册与用户管理 --- */

/* 10.1 登录界面 */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    overflow: hidden;
}

/* 登录页背景粒子效果 */
#particles-js {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1;
}

.login-form {
    width: 100%;
    max-width: 400px;
    padding: 20px;
    position: relative;
    z-index: 2; /* 确保在粒子效果之上 */
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.login-form .card-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.login-title {
    text-align: center;
    font-size: 1.8rem;
    color: var(--primary-color);
    margin: 0 0 5px 0;
    border-bottom: none;
}

.login-subtitle {
    text-align: center;
    color: var(--text-light);
    margin: 0 0 20px 0;
}

.login-form .action-button {
    width: 100%;
    padding: 14px;
    font-size: 1.1rem;
    margin-top: 10px;
}

/* 错误消息文字样式 */
.error-message {
    color: #d9534f;
    font-size: 0.9rem;
    text-align: left; /* 稍微靠左，符合阅读习惯 */
    margin: 10px 0;
    min-height: 20px;
    display: none; /* 默认隐藏，由 JS 控制显示 */
    padding-left: 5px;
    border-left: 3px solid #d9534f; /* 左侧加个红条增强提示 */
    background-color: rgba(217, 83, 79, 0.1); /* 浅红色背景 */
    padding: 5px 8px;
    border-radius: 4px;
}

/* 输入框获得焦点或错误时的过渡效果 */
.form-group input {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* 输入框警告状态 */
.input-warning {
    border-color: #ffc107 !important;
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.25) !important;
}

/* 10.2 注册验证码 */
.verification-group > div {
    display: flex;
    gap: 10px;
    align-items: center;
}

.verification-group input {
    flex-grow: 1;
}

#get-code-btn {
    flex-shrink: 0; /* 防止按钮被压缩 */
    padding: 12px 15px;
    font-size: 0.9rem;
    background-color: #f8f9fa;
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap; /* 防止文字换行 */
}

#get-code-btn:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-color);
}

#get-code-btn:disabled {
    background-color: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    border-color: var(--border-color);
}

/* 10.3 用户管理界面 */
.user-management-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1999; /* 比登录页低一点 */
}

#user-list-container table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

#user-list-container th,
#user-list-container td {
    border: 1px solid var(--border-color);
    padding: 12px 15px;
    text-align: left;
    vertical-align: middle;
}

#user-list-container th {
    background-color: var(--primary-light);
    font-weight: 600;
}

/* 修改和删除按钮 */
#user-list-container .modify-password-btn {
    background-color: #e6f4ff;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 10px;
}

#user-list-container .modify-password-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

#user-list-container .delete-user-btn {
    background-color: #fdeeee;
    color: #d9534f;
    border: 1px solid #d9534f;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#user-list-container .delete-user-btn:hover {
    background-color: #d9534f;
    color: white;
}

/* 行内编辑样式 */
#user-list-container .editing-row {
    background-color: var(--primary-light); /* 编辑时行背景高亮 */
}

#user-list-container .edit-password-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid var(--primary-color);
    border-radius: 5px;
    font-size: 1rem;
}

/* 保存和取消按钮 */
#user-list-container .save-password-btn {
    background-color: #28a745;
    color: white;
    border: 1px solid #28a745;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 10px;
}

#user-list-container .save-password-btn:hover {
    filter: brightness(1.1);
}

#user-list-container .cancel-edit-btn {
    background-color: #6c757d;
    color: white;
    border: 1px solid #6c757d;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#user-list-container .cancel-edit-btn:hover {
    filter: brightness(1.1);
}

#user-list-container button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* --- 11. 通用组件 --- */

/* 11.1 操作按钮 */
.action-button {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.action-button:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 90, 156, 0.2);
}

/* 特定颜色的按钮 */
.action-button.btn-save {
    background-color: #28a745;
}

.action-button.btn-save:hover {
    background-color: #218838;
}

/* 11.2 提示工具 (Tooltips) */
.tooltip-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
}

.tooltip-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #a0aec0;
    color: white;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    font-family: 'Courier New', Courier, monospace;
}

/* 原始的 tooltip 文本，将被 JS 读取并隐藏 */
.tooltip-text {
    display: none;
}

/* JS 动态生成的 tooltip 实例 */
.tooltip-dynamic-instance {
    position: fixed; /* 使用 fixed 定位，避免被父级 overflow 裁剪 */
    background-color: #2d3748;
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 10px 12px;
    z-index: 9999;
    font-size: 0.85rem;
    line-height: 1.4;
    max-width: 250px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    will-change: opacity, transform;
}

/* 小箭头 */
.tooltip-dynamic-instance::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
}

.tooltip-dynamic-instance.tooltip-arrow-up::after {
    bottom: 100%;
    border-color: transparent transparent #2d3748 transparent;
}

.tooltip-dynamic-instance.tooltip-arrow-down::after {
    top: 100%;
    border-color: #2d3748 transparent transparent transparent;
}


/* --- 12. 页面页脚 --- */

.app-footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 30px;
    color: var(--text-light);
    font-size: 0.9rem;
}

.app-footer p {
    margin: 0 0 10px 0;
}

.app-footer .footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.app-footer .footer-links a {
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.3s ease;
}

.app-footer .footer-links a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.app-footer .footer-links .separator {
    color: var(--border-color);
}


/* --- 13. 动画效果 --- */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* --- 14. 全局响应式调整 --- */

/* 平板及更小设备 */
@media (max-width: 992px) {
    .main-layout {
        display: block; /* 取消 Flex 布局，改为垂直堆叠 */
        gap: 40px;
    }

    .sidebar-container {
        position: static;
        width: 100% !important; /* 宽度占满 */
        margin-bottom: 25px;
    }

    .module-sidebar {
        position: static;
        width: 100%;
        box-sizing: border-box;
        height: auto;
        max-height: 400px; /* 限制最大高度，超出则滚动 */
        transform: none !important;
        opacity: 1 !important;
        margin-bottom: 0;
    }

    /* 在平板上隐藏侧边栏折叠按钮 */
    .sidebar-toggle {
        display: none;
    }

    /* 确保底部汇总栏在没有侧边栏时能正确对齐 */
    #section-summary {
        margin-left: 0 !important;
    }
}

/* 移动设备 */
@media (max-width: 767px) {
    /* 优化已选计费项卡片头部布局 */
    .result-card .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .result-card .card-header h3 {
        width: 100%;
    }
    .result-card .card-actions {
        width: 100%;
        justify-content: flex-end; /* 按钮靠右 */
    }

    /* 在小屏幕上，隐藏按钮内的文字，仅显示图标 */
    .result-card .card-actions .action-button span {
        display: none;
    }

    /* 调整按钮内边距，使其更紧凑 */
    .result-card .card-actions .action-button {
        padding: 6px 14px;
        font-size: 0.85rem;
    }

    /* 移除图标右侧的外边距 */
    .result-card .card-actions .action-button i {
        margin-right: 0;
        font-size: 0.9em;
    }
}

/* 复合型工程投资额输入容器样式 */
.composite-fields-container {
    margin-top: 20px;
    padding: 20px;
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.composite-fields-container h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1rem;
    color: var(--primary-color);
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 8px;
}

/* 复合型工程设计-综合阶段比例显示样式 */
.weighted-ratio-display {
    margin-top: 10px; /* 与上方的下拉框保持间距 */
    padding: 8px 12px;
    background-color: #f8f9fa; /* 淡灰色背景 */
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9em;
    color: var(--text-light);
    text-align: left;
}

.weighted-ratio-display b {
    color: var(--primary-color);
    font-size: 1.2em;
    font-weight: 600;
    margin-left: 8px;
}

/* 工程设计-独立的单值显示框样式 (最终版) */
.single-value-display {
    display: flex; /* 使用flex布局，方便对齐 */
    justify-content: flex-end; /* 内容靠右对齐 */
    align-items: baseline; /* 基线对齐，让数值和百分号看起来更协调 */
    width: 100%;
    box-sizing: border-box;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: #f8f9fa; /* 淡灰色背景 */
    font-size: 1rem; /* 调整单位文字大小 */
    color: var(--text-light);
    height: 47px; /* 与输入框高度保持一致 */
}

.single-value-display span {
    font-size: 1.2em; /* 突出数值 */
    font-weight: 600;
    color: var(--primary-color);
    margin-right: 4px; /* 数值和单位之间的间距 */
}

/* --- 15. Toast 通知样式 --- */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: #333;
    color: #fff;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.215, 0.610, 0.355, 1); /* 平滑的弹出和消失动画 */
    min-width: 250px;
    max-width: 350px;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast .toast-icon {
    font-size: 1.2rem;
}

.toast.success {
    background-color: #28a745;
}

.toast.error {
    background-color: #dc3545;
}

.toast.info {
    background-color: #17a2b8;
}

.toast-message a {
    color: #fff;
    font-weight: bold;
    text-decoration: underline;
}

/* --- 16. 工程咨询模块弹窗最终优化样式 (V3) --- */

/* 费用项列表容器 */
#consulting-items-container-v3 {
    background-color: transparent; /* 改为透明，由行本身控制背景 */
    border: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px; /* 行间距 */
}

/* 列表为空时的提示信息 */
#consulting-items-container-v3:empty::before {
    content: '请从上方选择并添加费用项目...';
    color: var(--text-light);
    font-size: 0.9em;
    text-align: center;
    padding: 35px 0;
    background-color: #f8f9fa;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    display: block; /* 确保伪元素能正常显示 */
}

/* 动态添加的每一行 (核心布局) */
.consulting-item-row-v3 {
    display: grid;
    /* 优化网格布局，使其更灵活、对齐更佳 */
    grid-template-columns: minmax(150px, 1.5fr) repeat(3, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    background-color: #fdfdff;
    border: 1px solid #e7eaf3;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
    animation: fadeIn 0.3s ease-out;
}

/* 行内的项目名称 */
.consulting-item-name-v3 {
    font-weight: 500;
    color: #333;
    font-size: 0.95em;
    padding-left: 5px;
    white-space: nowrap; /* 防止名称换行 */
}

/* 行内的输入框 */
.consulting-item-row-v3 input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px; /* 统一内边距 */
    font-size: 0.95rem; /* 统一字体大小 */
}

/* 行内的移除按钮 */
.remove-consulting-item-btn-v3 {
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
    color: var(--text-light);
    width: 36px;
    height: 38px;
    border-radius: 6px;
    font-size: 1.3rem;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-consulting-item-btn-v3:hover {
    background-color: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}


/* --- 新增：工程咨询模块弹窗优化样式 --- */
/* 分类标题行 */
.consulting-category-header {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    padding: 10px 12px;
    background-color: var(--primary-light);
    border-radius: 6px;
    margin-top: 10px;
    margin-bottom: 2px; /* 与下方第一行的间距 */
    display: flex;
    align-items: center;
    gap: 8px;
}
.consulting-category-header:first-child {
    margin-top: 0;
}
.consulting-category-header i {
    font-size: 0.9em;
}

/* 嵌套在分类下的项目行 */
.consulting-item-row-v3 {
    border-left: 3px solid var(--primary-color); /* 左侧加粗边框以示层级 */
    margin-left: 10px; /* 缩进 */
    width: calc(100% - 10px);
}
/* --- 新增样式结束 --- */

/* --- 新增：报价单层级表格样式 --- */
.hierarchical-fee-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 0.9em;
}
.hierarchical-fee-table th, .hierarchical-fee-table td {
    border: 1px solid #b0b0b0;
    padding: 8px 10px;
    text-align: center;
    vertical-align: middle;
}
.hierarchical-fee-table th {
    background-color: #f2f2f2;
    font-weight: 600;
}
/* 费用组成列左对齐 */
.hierarchical-fee-table td:nth-child(2) {
    text-align: left;
    padding-left: 15px;
}
/* 大类样式 */
.hierarchical-fee-table .category-row td:nth-child(2) {
    font-weight: 600;
}
/* 子类样式 */
.hierarchical-fee-table .subcategory-row td:nth-child(2) {
    font-weight: 500;
    padding-left: 30px;
}
/* 具体项样式 */
.hierarchical-fee-table .item-row td:nth-child(2) {
    padding-left: 45px;
}
/* 汇总行样式 */
.hierarchical-fee-table .summary-row td {
    font-weight: 600;
    background-color: #f8f9fa;
}
/* --- 新增样式结束 --- */
/* --- 新增：报价单层级表格备注列样式 --- */
.hierarchical-fee-table td:last-child {
    text-align: left;
    font-size: 0.9em;
    color: #555;
    min-width: 120px;
}
/* --- 登录后右上角公告 Toast --- */
.announcement-toast {
    position: fixed !important;
    top: 30px !important;
    right: 30px !important;
    width: 340px !important;
    z-index: 99999 !important;
    background: #ffffff !important; /* 强制背景为白色 */
    color: #333333 !important;      /* 强制文字为深色 */
    border-left: 5px solid #005A9C !important; /* 品牌蓝侧边条 */
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15) !important;
    padding: 20px !important;
    border-radius: 12px !important;
    display: flex !important;
    gap: 15px;
    animation: toastSlideIn 0.5s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.announcement-toast-title {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.announcement-toast-body {
    color: #666;
    font-size: 0.85rem;
    line-height: 1.5;
}

.announcement-toast i {
    color: #005A9C !important; /* 图标颜色改为品牌蓝 */
    font-size: 1.4rem !important;
    margin-top: 2px;
}

/* 退出动画 */
.announcement-toast.fade-out {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.5s ease;
}

@keyframes toastSlideIn {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
#admin-entrance {
    position: absolute;
    top: 20px;
    left: 145px; /* 避开“我的项目”按钮的位置 */
    background-color: rgba(255, 193, 7, 0.2); /* 使用琥珀色调区别于普通功能 */
    color: #fff;
    border: 1px solid rgba(255, 193, 7, 0.5);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    z-index: 2;
}

#admin-entrance:hover {
    background-color: rgba(255, 193, 7, 0.4);
    border-color: #ffc107;
    transform: translateY(-2px);
}

/* 移动端适配：如果是小屏幕，调整位置或隐藏文字 */
@media (max-width: 768px) {
    #admin-entrance {
        left: auto;
        right: 145px; /* 放在退出按钮旁边 */
        padding: 8px 10px;
    }
    #admin-entrance span, #admin-entrance i {
        margin: 0;
    }
}