* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    margin-bottom: 30px;
    padding: 20px;
    background-color: white;
    color: #2c3e50;
    border-radius: 5px;
    border: 1px solid #ddd;
}

/* 头部内容布局 */
.header-content {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

/* 头部图片样式 */
.header-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 5px;
}

/* 头部文本样式 */
.header-text h1 {
    margin-bottom: 10px;
    color: #2c3e50;
}

.header-text p {
    color: #2c3e50;
    margin-bottom: 5px;
}

.header-text a {
    color: #3498db;
    text-decoration: underline;
}

/* 主布局 - 侧边栏和主内容区 */
.main-layout {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

/* 侧边栏样式 - 项目信息模块 */
.sidebar {
    flex: 0 0 250px;
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    resize: horizontal;
    overflow: auto;
    min-width: 200px;
    max-width: 500px;
}

.sidebar h3 {
    margin-bottom: 20px;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.project-info .form-group {
    margin-bottom: 15px;
}

.project-info label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.project-info input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    background-color: #e3f2fd; /* 淡蓝色背景 */
}

.project-info input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}

.project-info select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    background-color: #e3f2fd; /* 淡蓝色背景 */
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

.project-info select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}

/* 主内容区 */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* 新增/编辑风险模块 */
#risk-form-section {
    background-color: white;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    resize: vertical;
    overflow: auto;
    min-height: 60px;
    max-height: 800px;
}

/* 风险列表模块 */
#risk-list-section {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    resize: vertical;
    overflow: auto;
    min-height: 300px;
    max-height: 800px;
}

@media (min-width: 768px) {
    main {
        grid-template-columns: 1fr 2fr;
    }
}

@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
    }
    
    .sidebar {
        flex: 0 0 auto;
    }
}

section {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* 折叠部分样式 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 5px 0;
}

.toggle-button {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #3498db;
    padding: 2px;
    border-radius: 3px;
}

.toggle-button:hover {
    background-color: #f0f0f0;
}

#risk-form {
    margin-top: 10px;
}

.form-group {
    margin-bottom: 15px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

input, select, textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}

/* 影响程度、可能性、风险等级、风险量化要素、风险敞口、已发生损失输入框样式 - 支持多行显示和垂直调整大小 */
#risk-impact-degree, #risk-possibility, #risk-level, 
#risk-quantitative-elements, #risk-exposure, #risk-occurred-loss {
    min-height: 80px;
    resize: vertical;
    font-size: 14px;
    line-height: 1.4;
}

.checkbox-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.checkbox-group label {
    font-weight: normal;
    display: flex;
    align-items: center;
    gap: 5px;
}

.form-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

button {
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

button[type="submit"] {
    background-color: #3498db;
    color: white;
}

button[type="submit"]:hover {
    background-color: #2980b9;
}

#cancel-edit {
    background-color: #95a5a6;
    color: white;
}

#cancel-edit:hover {
    background-color: #7f8c8d;
}

.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#search-input {
    flex: 1;
}

#search-btn {
    background-color: #2ecc71;
    color: white;
}

#search-btn:hover {
    background-color: #27ae60;
}

.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-bar select {
    flex: 1;
    min-width: 120px;
}

#reset-filters {
    background-color: #e67e22;
    color: white;
}

#reset-filters:hover {
    background-color: #d35400;
}

.risk-item {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 15px;
    background-color: #fff;
    transition: box-shadow 0.3s;
}

.risk-item:hover {
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
}

.risk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.risk-name {
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
}

.risk-category {
    background-color: #3498db;
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 14px;
}

.risk-level {
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 14px;
    font-weight: bold;
}

.level-低 {
    background-color: #2ecc71;
    color: white;
}

.level-中 {
    background-color: #f39c12;
    color: white;
}

.level-高 {
    background-color: #e74c3c;
    color: white;
}

.level-严重 {
    background-color: #8e44ad;
    color: white;
}

.risk-priority {
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 14px;
    font-weight: bold;
}

.priority-低 {
    background-color: #2ecc71;
    color: white;
}

.priority-中 {
    background-color: #f39c12;
    color: white;
}

.priority-高 {
    background-color: #e74c3c;
    color: white;
}

.priority-紧急 {
    background-color: #8e44ad;
    color: white;
}

.risk-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.detail-item {
    display: flex;
}

.detail-label {
    font-weight: bold;
    margin-right: 5px;
    min-width: 80px;
}

.risk-description, .risk-response, .risk-impact-dimensions, .risk-compliance, .risk-definition {
    margin-bottom: 15px;
}

.risk-definition .detail-label {
    color: #2c3e50;
    border-bottom: 1px solid #3498db;
    padding-bottom: 3px;
    margin-bottom: 5px;
}

.risk-definition div:last-child {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 10px;
    font-size: 14px;
    color: #495057;
}

/* 新增的风险敞口、已发生损失和具体描述样式 */
.risk-exposure, .risk-occurred-loss, .risk-response-description {
    margin-bottom: 15px;
}

.risk-exposure .detail-label, 
.risk-occurred-loss .detail-label, 
.risk-response-description .detail-label {
    color: #2c3e50;
    border-bottom: 1px solid #3498db;
    padding-bottom: 3px;
    margin-bottom: 5px;
    font-weight: bold;
}

.risk-exposure div:last-child, 
.risk-occurred-loss div:last-child, 
.risk-response-description div:last-child {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 10px;
    font-size: 14px;
    color: #495057;
    white-space: pre-wrap; /* 保持文本中的换行和空格 */
}

.risk-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-edit {
    background-color: #f39c12;
    color: white;
}

.btn-edit:hover {
    background-color: #d35400;
}

.btn-delete {
    background-color: #e74c3c;
    color: white;
}

.btn-delete:hover {
    background-color: #c0392b;
}

.risk-status {
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 14px;
    font-weight: bold;
}

.status-评估中 {
    background-color: #3498db;
    color: white;
}

.status-已确认 {
    background-color: #2ecc71;
    color: white;
}

.status-计划中 {
    background-color: #9b59b6;
    color: white;
}

.status-已缓解 {
    background-color: #1abc9c;
    color: white;
}

.status-已解决 {
    background-color: #f39c12;
    color: white;
}

.status-已关闭 {
    background-color: #2c3e50;
    color: white;
}

.risk-department-review {
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 14px;
    font-weight: bold;
    background-color: #9b59b6;
    color: white;
    margin-left: 5px;
}

/* 逾期风险样式 */
.risk-overdue {
    border-left: 5px solid #e74c3c; /* 红色左边框表示逾期 */
}

.overdue-tag {
    background-color: #e74c3c;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 10px;
}

.updated-tag {
    background-color: #2ecc71;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 10px;
}

.modification-history {
    margin-bottom: 15px;
}

.modification-history .detail-label {
    color: #2c3e50;
    border-bottom: 1px solid #3498db;
    padding-bottom: 3px;
    margin-bottom: 5px;
    font-weight: bold;
}

.history-content {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 10px;
    font-size: 14px;
    color: #495057;
}

.last-modification p {
    margin: 5px 0;
}

.no-risks {
    text-align: center;
    padding: 30px;
    color: #7f8c8d;
}

footer {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    background-color: #ecf0f1;
    border-radius: 5px;
    color: #7f8c8d;
}

/* 子风险定义框样式 */
.definition-box {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    font-size: 14px;
    color: #495057;
    min-height: 60px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.5;
}

/* 风险内容两列布局 */
.risk-content-layout {
    display: flex;
    gap: 20px;
    margin-bottom: 5px; /* 减少底部间距 */
}

.risk-content-column {
    flex: 1;
}

.risk-content-column .detail-label {
    color: #2c3e50;
    border-bottom: 1px solid #3498db;
    padding-bottom: 3px;
    margin-bottom: 0; /* 移除标题与内容之间的间距 */
    font-weight: bold;
}

.risk-content-column div:last-child {
    background-color: white; /* 将背景色改为白色 */
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 5px; /* 减少内边距 */
    font-size: 14px;
    color: #495057;
    white-space: pre-wrap; /* 保持文本中的换行和空格 */
    margin-top: 0; /* 硿保内容与标题之间没有额外间距 */
}

/* 保持原有的风险描述、应对措施等样式以确保向后兼容 */
.risk-description, .risk-response, .risk-impact-dimensions, .risk-compliance, .risk-definition {
    margin-bottom: 5px; /* 减少底部间距 */
}

.risk-definition .detail-label {
    color: #2c3e50;
    border-bottom: 1px solid #3498db;
    padding-bottom: 3px;
    margin-bottom: 0; /* 移除标题与内容之间的间距 */
}

.risk-definition div:last-child {
    background-color: white; /* 将背景色改为白色 */
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 5px; /* 减少内边距 */
    font-size: 14px;
    color: #495057;
}

/* 新增的风险敞口、已发生损失和具体描述样式 */
.risk-exposure, .risk-occurred-loss, .risk-response-description {
    margin-bottom: 5px; /* 减少底部间距 */
}

.risk-exposure .detail-label, 
.risk-occurred-loss .detail-label, 
.risk-response-description .detail-label {
    color: #2c3e50;
    border-bottom: 1px solid #3498db;
    padding-bottom: 3px;
    margin-bottom: 0; /* 移除标题与内容之间的间距 */
    font-weight: bold;
}

.risk-exposure div:last-child, 
.risk-occurred-loss div:last-child, 
.risk-response-description div:last-child {
    background-color: white; /* 将背景色改为白色 */
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 5px; /* 减少内边距 */
    font-size: 14px;
    color: #495057;
    white-space: pre-wrap; /* 保持文本中的换行和空格 */
    margin-top: 0; /* 硿保内容与标题之间没有额外间距 */
}

/* 风险指标库链接样式 */
.risk-library-link {
    margin-top: 10px;
}

.risk-library-link a {
    color: #3498db;
    text-decoration: underline;
    font-size: 14px;
}

.risk-library-link a:hover {
    color: #2980b9;
}

/* 项目风险信息样式 */
.project-risk-info {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.project-risk-info label {
    font-weight: bold;
    color: #2c3e50;
}

.risk-info-content {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 10px;
    margin-top: 5px;
    max-height: 400px;
    overflow-y: auto;
}

.risk-info-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.risk-info-list li {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.risk-info-list li:last-child {
    border-bottom: none;
}

.risk-basic-info strong {
    color: #2c3e50;
    font-size: 14px;
}

.risk-details {
    margin-top: 5px;
}

.risk-description {
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 5px;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.4;
    max-height: none;
}

.risk-category-info {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12px;
}

.main-category {
    background-color: #3498db;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
}

.sub-category {
    background-color: #2ecc71;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
}

.identify-info {
    background-color: #9b59b6;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
}

.no-risk-info {
    color: #6c757d;
    font-style: italic;
    text-align: center;
    padding: 10px;
}

/* 项目修改历史记录样式 */
.project-modification-history {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.project-modification-history label {
    font-weight: bold;
    color: #2c3e50;
}

.modification-history-content {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 10px;
    margin-top: 5px;
    max-height: 200px;
    overflow-y: auto;
}

.history-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.history-list li {
    padding: 5px 0;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.history-list li:last-child {
    border-bottom: none;
}

.timestamp {
    color: #6c757d;
    font-weight: normal;
}

.risk-name {
    font-weight: bold;
    color: #3498db;
}

.no-history {
    color: #6c757d;
    font-style: italic;
    text-align: center;
    padding: 10px;
}

/* 修改历史详细内容样式 */
.changes-detail {
    margin-top: 10px;
    padding: 10px;
    background-color: #e9f7fe;
    border-radius: 4px;
    border-left: 3px solid #3498db;
}

.changes-detail ul {
    margin: 5px 0;
    padding-left: 20px;
}

.changes-detail li {
    margin: 3px 0;
    font-size: 13px;
}

.changes-detail strong {
    color: #2c3e50;
}
