* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: #f5f7fa; color: #333; }

.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #1f2937; color: #fff; flex-shrink: 0; }
.logo { padding: 20px; font-size: 18px; font-weight: bold; border-bottom: 1px solid #374151; }
.nav { display: flex; flex-direction: column; padding: 10px 0; }
.nav-item { padding: 14px 20px; color: #d1d5db; text-decoration: none; transition: .2s; }
.nav-item:hover, .nav-item.active { background: #374151; color: #fff; }

.main { flex: 1; display: flex; flex-direction: column; }
.topbar { height: 56px; background: #fff; border-bottom: 1px solid #e5e7eb; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; font-weight: 500; }
.user { color: #6b7280; font-size: 14px; }

.page { display: none; padding: 24px; }
.page.active { display: block; }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; border-bottom: 1px solid #e5e7eb; padding-bottom: 8px; }
.tab-btn { padding: 8px 16px; border: none; background: #e5e7eb; border-radius: 4px; cursor: pointer; font-size: 14px; }
.tab-btn.active { background: #2563eb; color: #fff; }
.tab-content { display: none; }
.tab-content.active { display: block; }

h3 { margin: 12px 0 16px; font-size: 18px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: #4b5563; }
.form-grid input, .form-grid select { padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 14px; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 10px; }

.btn { padding: 8px 16px; border: 1px solid #d1d5db; background: #fff; border-radius: 4px; cursor: pointer; font-size: 14px; }
.btn:hover { background: #f3f4f6; }
.btn.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn.primary:hover { background: #1d4ed8; }
.btn.green { background: #22c55e; color: #fff; border-color: #22c55e; }
.btn.green:hover { background: #16a34a; }
.btn.tiny { padding: 4px 8px; font-size: 12px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.05); cursor: pointer; transition: .2s; border: 2px solid transparent; }
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.card.selected { border-color: #2563eb; }
.card h4 { font-size: 16px; margin-bottom: 8px; }
.card p { font-size: 14px; color: #6b7280; margin: 4px 0; }
.card .stats { display: flex; gap: 12px; margin-top: 12px; }
.card .stat { background: #f3f4f6; padding: 6px 10px; border-radius: 4px; font-size: 13px; }

.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.05); margin-top: 12px; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #e5e7eb; font-size: 14px; }
.data-table th { background: #f9fafb; font-weight: 600; }
.data-table tr:hover { background: #f9fafb; }
.data-table tr.disabled { color: #9ca3af; background: #f3f4f6; }
.data-table tr.selected-row { background: #eff6ff !important; }
.data-table tr.selected-row td { border-bottom-color: #bfdbfe; }
.data-table td.editable-cell { background: #fffbeb; padding: 6px; }
.data-table .table-input { width: 100%; padding: 4px 6px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 13px; }
.data-table .table-input.invalid { border-color: #ef4444; background: #fef2f2; }

.filter-bar { display: flex; gap: 12px; align-items: flex-end; background: #fff; padding: 16px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.05); flex-wrap: wrap; }
.filter-bar label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.filter-bar input, .filter-bar select { padding: 6px 8px; border: 1px solid #d1d5db; border-radius: 4px; }

.detail-panel, #sn-result, #urdf-query-detail { background: #fff; padding: 16px; border-radius: 8px; margin-top: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.detail-panel h4, #sn-result h4, #urdf-query-detail h4 { margin-bottom: 12px; }

.jump-btns { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.selected-project { background: #eff6ff; border: 1px solid #bfdbfe; padding: 12px 16px; border-radius: 6px; color: #1e40af; margin: 12px 0; }

.param-preview { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.preview-box { height: 200px; background: #f3f4f6; display: flex; align-items: center; justify-content: center; color: #9ca3af; border-radius: 6px; margin-bottom: 16px; }
.small-input { width: 80px; padding: 4px 6px; }

.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #ccc; border-radius: 24px; transition: .2s; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .2s; }
input:checked + .slider { background: #2563eb; }
input:checked + .slider:before { transform: translateX(20px); }

.empty { color: #9ca3af; padding: 20px; text-align: center; }

/* 二级导航 */
.nav-group { display: flex; flex-direction: column; }
.nav-group-title { padding: 14px 20px; color: #d1d5db; cursor: pointer; transition: .2s; display: flex; justify-content: space-between; align-items: center; }
.nav-group-title:hover { background: #374151; color: #fff; }
.nav-group-title::after { content: '▸'; font-size: 12px; transition: .2s; }
.nav-group.open .nav-group-title::after { transform: rotate(90deg); }
.nav-group.active-group .nav-group-title { background: #374151; color: #fff; }
.nav-sub { display: none; flex-direction: column; background: #111827; }
.nav-group.open .nav-sub { display: flex; }
.nav-sub-item { padding: 10px 20px 10px 36px; color: #9ca3af; text-decoration: none; font-size: 14px; transition: .2s; }
.nav-sub-item:hover, .nav-sub-item.active { background: #2563eb; color: #fff; }

/* 卡片滚动区 */
.card-scroll { max-height: 320px; overflow-y: auto; padding-right: 8px; margin-bottom: 16px; }
.card-scroll::-webkit-scrollbar { width: 6px; }
.card-scroll::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

/* 选中行 */
.data-table tr.selected-row { background: #eff6ff !important; }
.data-table tr.selected-row td { border-bottom-color: #bfdbfe; }

/* 表格横向滚动 */
.table-wrap { overflow-x: auto; border-radius: 8px; }
.table-wrap .data-table { min-width: 2600px; margin-top: 0; }
.data-table th, .data-table td { white-space: nowrap; min-width: 120px; }

/* 多行信息 */
.multiline-td { line-height: 1.4; }
.line-text { font-size: 12px; color: #4b5563; margin: 2px 0; white-space: nowrap; }

/* 当前项目/任务信息条 */
.selected-project-bar { background: #eff6ff; border: 1px solid #bfdbfe; padding: 12px 16px; border-radius: 6px; color: #1e40af; margin-bottom: 16px; font-weight: 500; }

/* 版本功能区按钮 */
.version-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.version-section { display: none; }
.version-section.active { display: block; }

/* 分页 */
.pagination { display: flex; gap: 8px; margin-top: 12px; }

/* 分段卡片 */
.section-div { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.05); margin-bottom: 16px; }
.section-div h5 { font-size: 15px; margin-bottom: 12px; color: #111827; }
.section-div textarea { width: 100%; padding: 10px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 14px; resize: vertical; }

/* 任务信息面板 */
.task-info-panel { display: flex; flex-wrap: wrap; gap: 12px; background: #f9fafb; padding: 16px; border-radius: 6px; }
.info-item { display: flex; flex-direction: column; gap: 4px; min-width: 140px; }
.info-item span:first-child { font-size: 12px; color: #6b7280; }
.info-item span:last-child { font-size: 14px; color: #111827; font-weight: 500; }

/* 三列表单 */
.form-grid.three-col { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* 提示文字 */
.tip { color: #6b7280; padding: 12px 0; }

/* 审批三态下拉 */
.approval-select { padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 14px; background: #fff; }

/* 弹窗遮罩 */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.modal {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    width: 420px;
    max-width: 90%;
    box-shadow: 0 4px 20px rgba(0,0,0,.2);
}
.modal h5 { margin-bottom: 12px; font-size: 16px; }
.modal p { color: #6b7280; margin-bottom: 12px; }
.modal label { display: flex; flex-direction: column; gap: 6px; margin: 16px 0; font-size: 14px; color: #4b5563; }
.modal input { padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 14px; }
