/* ==================== 基础重置 ==================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #0052d9;
  --primary-light: #e8f0fe;
  --primary-dark: #003cab;
  --success: #2ba471;
  --warning: #e37318;
  --danger: #d54941;
  --info: #009788;
  --secondary: #8c8c8c;
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --text: #1c1c1c;
  --text-secondary: #666;
  --border: #e8e8e8;
  --sidebar-w: 230px;
  --header-h: 56px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.1);
}
html { font-size: 14px; }
body { font-family: -apple-system, "Microsoft YaHei", "Segoe UI", sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ==================== 布局 ==================== */
.app-layout { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar {
  width: var(--sidebar-w); background: linear-gradient(180deg, #001e3c 0%, #003380 100%);
  color: rgba(255,255,255,.85); position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  display: flex; flex-direction: column; transition: transform .3s;
}
.sidebar-header { padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-header .logo { font-size: 18px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 8px; }
.sidebar-header .logo .icon { width: 28px; height: 28px; background: var(--primary); border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
.sidebar-header .subtitle { font-size: 11px; color: rgba(255,255,255,.5); margin-top: 4px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar-nav .nav-section-title { font-size: 11px; color: rgba(255,255,255,.35); padding: 16px 20px 6px; text-transform: uppercase; letter-spacing: 1px; }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: rgba(255,255,255,.7); font-size: 14px; transition: all .2s; border-left: 3px solid transparent; }
.sidebar-nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.sidebar-nav a.active { background: rgba(255,255,255,.12); color: #fff; border-left-color: var(--primary); }
.sidebar-nav a .nav-icon { width: 18px; text-align: center; font-size: 15px; }
.sidebar-footer { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.1); font-size: 12px; color: rgba(255,255,255,.4); }

/* 主区域 */
.main-area { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }

/* 顶部栏 */
.topbar { height: var(--header-h); background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 50; }
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-left .page-title { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.user-info { display: flex; align-items: center; gap: 8px; cursor: pointer; position: relative; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }
.user-name { font-size: 13px; }
.user-role-badge { font-size: 11px; color: var(--text-secondary); }
.dropdown-menu { position: absolute; top: 100%; right: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 160px; padding: 6px 0; display: none; z-index: 200; }
.dropdown-menu.show { display: block; }
.dropdown-menu a { display: block; padding: 8px 16px; color: var(--text); font-size: 13px; }
.dropdown-menu a:hover { background: var(--primary-light); text-decoration: none; }

/* 内容区 */
.content { flex: 1; padding: 24px; }
.content-sm { max-width: 1400px; margin: 0 auto; }

/* ==================== 卡片 ==================== */
.card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }
.card-body.no-pad { padding: 0; }

/* ==================== 统计卡片 ==================== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); position: relative; overflow: hidden; border-left: 4px solid var(--primary); transition: transform .2s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.danger { border-left-color: var(--danger); }
.stat-card.success { border-left-color: var(--success); }
.stat-card.info { border-left-color: var(--info); }
.stat-card .stat-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; line-height: 1; }
.stat-card .stat-extra { font-size: 12px; color: var(--text-secondary); margin-top: 8px; }

/* ==================== 徽章/标签 ==================== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; line-height: 18px; white-space: nowrap; }
.badge-warning { background: #fff7e6; color: #d46b08; }
.badge-info { background: #e6f7ff; color: #096dd9; }
.badge-primary { background: #e8f0fe; color: #0052d9; }
.badge-secondary { background: #f0f0f0; color: #595959; }
.badge-success { background: #f0f9eb; color: #529b2e; }
.badge-danger { background: #fef0f0; color: #c45656; }
.badge-lg { font-size: 13px; padding: 4px 14px; border-radius: 14px; }

/* ==================== 按钮 ==================== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 18px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text); font-size: 13px; cursor: pointer; transition: all .2s; text-decoration: none; }
.btn:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); color: #fff; border-color: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #22945f; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b53d35; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover { background: #c26314; color: #fff; }
.btn-outline { background: transparent; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-lg { padding: 10px 28px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ==================== 表单 ==================== */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.form-group label .req { color: var(--danger); margin-left: 2px; }
.form-control { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; background: #fff; transition: border-color .2s; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0,82,217,.1); }
textarea.form-control { min-height: 80px; resize: vertical; }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-hint { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.form-actions { display: flex; gap: 10px; padding-top: 8px; }

/* ==================== 表格 ==================== */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th { background: #fafafa; padding: 12px 16px; text-align: left; font-weight: 600; color: var(--text-secondary); border-bottom: 2px solid var(--border); white-space: nowrap; }
table.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); }
table.data-table tbody tr:hover { background: #fafbfc; }
table.data-table .link-cell a { font-weight: 500; }
table.data-table .link-cell a:hover { text-decoration: underline; }
.text-ellipsis { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ==================== 筛选栏 ==================== */
.filter-bar { background: #fff; border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px; box-shadow: var(--shadow); display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.filter-bar .filter-item { display: flex; align-items: center; gap: 6px; }
.filter-bar .filter-item label { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.filter-bar .filter-item select, .filter-bar .filter-item input { padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.filter-bar .filter-spacer { flex: 1; }

/* ==================== 分页 ==================== */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 20px; }
.pagination a, .pagination span { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; color: var(--text); text-decoration: none; }
.pagination a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { color: var(--text-secondary); cursor: not-allowed; }

/* ==================== 看板 ==================== */
.kanban-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kanban-column { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; max-height: calc(100vh - 180px); }
.kanban-column-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.kanban-column-header .col-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kanban-column-header .col-count { font-size: 12px; color: var(--text-secondary); background: #f0f0f0; padding: 1px 8px; border-radius: 10px; }
.kanban-cards { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.kanban-card { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 12px; cursor: pointer; transition: all .2s; border-left-width: 3px; }
.kanban-card:hover { box-shadow: var(--shadow-lg); transform: translateX(2px); }
.kanban-card .kc-title { font-size: 13px; font-weight: 500; margin-bottom: 8px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kanban-card .kc-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 11px; color: var(--text-secondary); }

/* ==================== 详情页 ==================== */
.detail-header { background: #fff; border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.detail-header .dh-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.detail-header .dh-title { font-size: 20px; font-weight: 600; line-height: 1.4; }
.detail-header .dh-no { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.detail-header .dh-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.detail-header .dh-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.detail-header .dh-meta-item .label { font-size: 12px; color: var(--text-secondary); margin-bottom: 2px; }
.detail-header .dh-meta-item .value { font-size: 14px; font-weight: 500; }

.info-row { display: flex; padding: 12px 0; border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: none; }
.info-row .ir-label { width: 140px; flex-shrink: 0; font-size: 13px; color: var(--text-secondary); }
.info-row .ir-value { flex: 1; font-size: 14px; }

/* 时间线 */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 24px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before { content: ''; position: absolute; left: -24px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--primary); }
.timeline-item.reject::before { background: var(--danger); box-shadow: 0 0 0 2px var(--danger); }
.timeline-item .ti-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.timeline-item .ti-action { font-weight: 500; font-size: 14px; }
.timeline-item .ti-time { font-size: 12px; color: var(--text-secondary); }
.timeline-item .ti-operator { font-size: 12px; color: var(--primary); }
.timeline-item .ti-comment { font-size: 13px; color: var(--text); background: #f9f9f9; padding: 8px 12px; border-radius: 6px; margin-top: 4px; }
.timeline-item .ti-status-change { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* ==================== 弹窗 ==================== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000; display: none; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 90%; max-width: 560px; max-height: 85vh; overflow-y: auto; }
.modal-lg { max-width: 720px; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-secondary); padding: 0; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 4px; }
.modal-close:hover { background: #f0f0f0; }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ==================== 消息提示 ==================== */
.flash-messages { position: fixed; top: 70px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 12px 20px; border-radius: 6px; color: #fff; font-size: 13px; box-shadow: var(--shadow-lg); animation: slideIn .3s ease; min-width: 240px; }
.flash-success { background: var(--success); }
.flash-danger { background: var(--danger); }
.flash-info { background: var(--info); }
.flash-warning { background: var(--warning); }
@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ==================== 登录页 ==================== */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #001e3c 0%, #003380 40%, #0052d9 100%); position: relative; overflow: hidden; }
.login-page::before { content: ''; position: absolute; top: -50%; right: -20%; width: 600px; height: 600px; background: radial-gradient(circle, rgba(255,255,255,.05) 0%, transparent 70%); border-radius: 50%; }
.login-card { background: rgba(255,255,255,.95); backdrop-filter: blur(10px); border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.3); width: 400px; padding: 40px; position: relative; z-index: 1; }
.login-card .lc-logo { text-align: center; margin-bottom: 32px; }
.login-card .lc-logo .logo-icon { width: 56px; height: 56px; background: var(--primary); border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 24px; color: #fff; margin-bottom: 12px; }
.login-card .lc-logo h1 { font-size: 20px; font-weight: 700; color: var(--text); }
.login-card .lc-logo p { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.login-card .login-form .form-group { margin-bottom: 20px; }
.login-card .login-form label { font-size: 13px; font-weight: 500; margin-bottom: 8px; }
.login-card .login-form .form-control { padding: 10px 14px; font-size: 14px; }
.login-card .btn-login { width: 100%; padding: 12px; font-size: 15px; }
.login-card .lc-hint { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-secondary); text-align: center; line-height: 1.8; }

/* ==================== 工具类 ==================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-secondary); }
.fw-bold { font-weight: 600; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.w-full { width: 100%; }

/* 进度条 */
.progress-bar { height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden; }
.progress-bar .fill { height: 100%; border-radius: 4px; transition: width .5s; }
.progress-bar .fill.success { background: var(--success); }
.progress-bar .fill.warning { background: var(--warning); }
.progress-bar .fill.danger { background: var(--danger); }

/* ==================== 响应式 ==================== */
@media (max-width: 1024px) {
  .kanban-board { grid-template-columns: repeat(2, 1fr); }
  .form-row-3 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .form-row { grid-template-columns: 1fr; }
  .kanban-board { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}

/* ==================== 附件上传区域 ==================== */
.upload-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 4px; transition: all .2s; }
.upload-zone.dragover { border-color: var(--primary); background: var(--primary-light); }
.upload-zone-inner { padding: 24px; text-align: center; cursor: pointer; border-radius: 6px; transition: background .2s; }
.upload-zone-inner:hover { background: #fafbfc; }
.upload-zone-inner .upload-icon { font-size: 28px; display: block; margin-bottom: 8px; }
.upload-zone-inner .upload-text { font-size: 13px; color: var(--text); display: block; margin-bottom: 4px; }
.upload-zone-inner .upload-hint { font-size: 11px; color: var(--text-secondary); display: block; }

/* 文件列表 */
.file-list { margin-top: 8px; }
.file-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #f9f9f9; border-radius: 6px; margin-top: 6px; font-size: 13px; }
.file-item .file-item-icon { font-size: 16px; flex-shrink: 0; }
.file-item .file-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .file-item-size { color: var(--text-secondary); font-size: 12px; flex-shrink: 0; }
.file-item .file-item-remove { background: none; border: none; color: var(--danger); font-size: 18px; cursor: pointer; padding: 0 4px; line-height: 1; flex-shrink: 0; border-radius: 4px; }
.file-item .file-item-remove:hover { background: #fef0f0; }

/* 附件展示列表 */
.attachment-list { display: flex; flex-direction: column; gap: 8px; }
.attachment-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; transition: box-shadow .2s; }
.attachment-item:hover { box-shadow: var(--shadow); }
.attachment-item .att-icon { font-size: 22px; flex-shrink: 0; width: 32px; text-align: center; }
.attachment-item .att-info { flex: 1; min-width: 0; }
.attachment-item .att-name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-item .att-meta { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.attachment-item .att-actions { display: flex; gap: 6px; flex-shrink: 0; }
