/* ============ 全局样式 ============ */
* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; color: #303133; }

/* ============ 布局 ============ */
.layout { display: flex; height: 100vh; overflow: hidden; }
.layout .sidebar { width: 220px; background: #1f2d3d; color: #c0ccda; flex-shrink: 0; }
.layout .sidebar .logo { height: 60px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; font-weight: bold; border-bottom: 1px solid #2d3e50; }
.layout .sidebar .logo .dot { width: 8px; height: 8px; background: #409eff; border-radius: 50%; margin-right: 8px; }
.layout .sidebar .el-menu { border-right: none; background: transparent; }
.layout .sidebar .el-menu-item, .layout .sidebar .el-sub-menu__title { color: #c0ccda; }
.layout .sidebar .el-menu-item:hover, .layout .sidebar .el-sub-menu__title:hover { background: #263445 !important; }
.layout .sidebar .el-menu-item.is-active { background: #409eff !important; color: #fff; }

.layout .main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.layout .header { height: 56px; background: #fff; border-bottom: 1px solid #e4e7ed; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; }
.layout .header .breadcrumb { font-size: 14px; color: #606266; }
.layout .header .user-info { display: flex; align-items: center; gap: 12px; }
.layout .content { flex: 1; overflow: auto; padding: 16px; background: #f5f7fa; }

/* ============ 项目阶段健康度色点 ============ */
.stage-dots { display: flex; align-items: center; gap: 3px; }
.stage-dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; cursor: help; }

/* ============ 项目列表：表头吸顶 + 悬浮横向滚动条 ============ */
/* el-table 默认 overflow:hidden 会让 sticky 表头失效 */
.project-table.el-table { overflow: visible; }
.project-table .el-table__header-wrapper {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #fff;
}
.table-hscroll {
    position: sticky;
    bottom: 0;
    z-index: 9;
    height: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    background: #f5f7fa;
    border-top: 1px solid #ebeef5;
}
.table-hscroll-inner { height: 1px; }

/* ============ 登录页 ============ */
.login-page { height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-card { width: 400px; background: #fff; border-radius: 8px; padding: 40px; box-shadow: 0 8px 32px rgba(0,0,0,0.15); }
.login-card .title { text-align: center; font-size: 24px; font-weight: bold; color: #303133; margin-bottom: 8px; }
.login-card .subtitle { text-align: center; color: #909399; font-size: 14px; margin-bottom: 32px; }

/* ============ 卡片 ============ */
.stat-card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.stat-card .value { font-size: 28px; font-weight: bold; color: #303133; }
.stat-card .label { font-size: 13px; color: #909399; margin-top: 4px; }

/* ============ 看板 ============ */
.board-container { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 16px; min-height: 400px; }
.board-column { min-width: 280px; width: 280px; flex-shrink: 0; background: #ebecf0; border-radius: 8px; display: flex; flex-direction: column; max-height: calc(100vh - 180px); }
.board-column .column-header { padding: 12px 16px; font-weight: 600; font-size: 14px; display: flex; justify-content: space-between; align-items: center; border-radius: 8px 8px 0 0; }
.board-column .column-count { background: rgba(0,0,0,0.1); padding: 2px 8px; border-radius: 10px; font-size: 12px; color: #303133; }
.board-column .column-body { flex: 1; padding: 8px; overflow-y: auto; }
.board-column .drop-zone { min-height: 40px; }
.ghost-card { opacity: 0.4; background: #E6A23C !important; border-left-color: #E6A23C !important; }
.chosen-card { box-shadow: 0 4px 16px rgba(64,158,255,0.4) !important; transform: scale(1.02); }

.task-card { background: #fff; border-radius: 6px; padding: 12px; margin-bottom: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); cursor: grab; border-left: 3px solid transparent; transition: transform 0.1s; user-select: none; -webkit-user-select: none; -moz-user-select: none; }
.task-card:active { cursor: grabbing; }
.task-card:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.task-card.priority-urgent { border-left-color: #F56C6C; }
.task-card.priority-high { border-left-color: #E6A23C; }
.task-card.priority-medium { border-left-color: #409EFF; }
.task-card.priority-low { border-left-color: #909399; }
.task-card .title { font-size: 14px; font-weight: 500; color: #303133; margin-bottom: 8px; }
.task-card .meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: #909399; }
.task-card .key { font-family: monospace; }
.task-card .due-date.overdue { color: #F56C6C; font-weight: 500; }
.task-card .card-top { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.task-card .card-top .key { font-family: monospace; font-size: 12px; color: #909399; }
.task-card .mini-tag { font-size: 11px; padding: 1px 7px; border-radius: 10px; line-height: 16px; font-weight: 500; opacity: 0.9; }
.task-card .card-footer { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: #606266; margin-top: 8px; }
.task-card .card-footer .assignee { display: flex; align-items: center; gap: 4px; }
.task-card .card-footer .extras { display: flex; align-items: center; gap: 8px; }
.task-card .avatar-mini { width: 20px; height: 20px; border-radius: 50%; background: #409EFF; color: #fff; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.task-card .avatar-mini.unassigned { background: #c0c4cc; }
.task-card .subtask-badge { color: #409EFF; font-size: 11px; }

.count-badge { background: #f0f2f5; color: #606266; padding: 2px 8px; border-radius: 10px; font-size: 12px; }

/* ============ 进度条 ============ */
.progress-section { display: flex; gap: 8px; align-items: center; }
.progress-bar-wrap { flex: 1; height: 8px; background: #ebecf0; border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, #409eff, #67c23a); border-radius: 4px; transition: width 0.3s; }

/* ============ 详情页 ============ */
.task-detail { display: flex; flex-direction: column; gap: 12px; }
.summary-bar { background: #fff; border-radius: 8px; padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; box-shadow: 0 1px 6px rgba(0,0,0,.06); }
.summary-bar .s-code { font-family: monospace; color: #409EFF; font-weight: 600; font-size: 15px; margin-right: 8px; }
.summary-bar .s-name { font-size: 17px; font-weight: 600; color: #303133; margin-right: 10px; }
.summary-meta { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.summary-meta .mi { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #606266; }
.summary-meta .mi > label { color: #909399; font-size: 12px; white-space: nowrap; }
.detail-layout { display: flex; gap: 16px; align-items: flex-start; height: auto; }
.detail-layout .left-panel { flex: 1; min-width: 0; background: #fff; border-radius: 8px; padding: 8px 20px 20px; overflow: visible; }
.detail-layout .right-panel { width: 320px; flex-shrink: 0; background: #fff; border-radius: 8px; padding: 16px; position: sticky; top: 12px; max-height: calc(100vh - 120px); overflow-y: auto; }
.save-bar { position: sticky; bottom: 0; background: #fff; padding-top: 10px; margin-top: 12px; border-top: 1px solid #ebeef5; display: flex; gap: 8px; }
.tab-empty { color: #909399; text-align: center; padding: 32px 0; font-size: 13px; }

/* 附件列表 */
.attach-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.attach-item:last-child { border-bottom: none; }
.attach-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 4px; background: #000; cursor: pointer; flex: none; }
.attach-thumb-file { display: flex; align-items: center; justify-content: center; background: #f5f7fa; color: #909399; font-size: 12px; cursor: default; }
.attach-meta { flex: 1; min-width: 0; }
.attach-name { font-size: 14px; color: #303133; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-name:hover { color: #409EFF; }
.attach-sub { font-size: 12px; color: #909399; margin-top: 2px; }
.attr-label { font-size: 12px; color: #909399; margin-bottom: 4px; }

/* ============ 操作日志 ============ */
.activity-list { list-style: none; padding: 0; margin: 0; }
.activity-list li { padding: 10px 0; border-bottom: 1px solid #f0f0f0; display: flex; gap: 10px; }
.activity-list li:last-child { border-bottom: none; }
.activity-list .time { color: #909399; font-size: 12px; min-width: 100px; flex-shrink: 0; }
.activity-list .content { font-size: 13px; color: #606266; }

/* ============ 评论 ============ */
.comment-item { padding: 12px 0; border-bottom: 1px solid #f0f0f0; display: flex; gap: 12px; }
.comment-item .avatar { width: 32px; height: 32px; border-radius: 50%; background: #409eff; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.comment-item .body { flex: 1; min-width: 0; }
.comment-item .author { font-weight: 500; font-size: 13px; color: #303133; }
.comment-item .time { color: #909399; font-size: 12px; margin-left: 8px; }
.comment-item .content { margin-top: 6px; font-size: 14px; color: #606266; white-space: pre-wrap; word-break: break-word; }
.comment-item .actions { opacity: 0; transition: opacity .2s; margin-left: 8px; }
.comment-item:hover .actions { opacity: 1; }
.mention { color: #409EFF; font-weight: 500; background: #ecf5ff; border-radius: 3px; padding: 0 2px; }

/* ============ 消息中心 ============ */
.notify-item { display: flex; gap: 10px; padding: 12px 6px; border-bottom: 1px solid #f0f2f5; cursor: pointer; position: relative; }
.notify-item:hover { background: #f5f9ff; }
.notify-item.is-unread .notify-title-text { font-weight: 600; color: #303133; }
.notify-icon { width: 28px; height: 28px; border-radius: 50%; background: #ecf5ff; color: #409EFF; display: flex; align-items: center; justify-content: center; font-size: 14px; flex: 0 0 28px; }
.notify-title { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; line-height: 1.4; }
.notify-title-text { color: #606266; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notify-time { color: #c0c4cc; font-size: 12px; flex-shrink: 0; }
.notify-content { color: #909399; font-size: 12px; margin-top: 4px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-all; }
.notify-content.expanded { display: block; -webkit-line-clamp: unset; white-space: pre-wrap; }
.notify-toggle { color: #409EFF; font-size: 12px; margin-top: 4px; cursor: pointer; user-select: none; }
.notify-dot { width: 8px; height: 8px; border-radius: 50%; background: #409EFF; position: absolute; right: 0; top: 50%; transform: translateY(-50%); }

/* ============ 通用 ============ */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.section-title { font-size: 15px; font-weight: 600; color: #303133; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid #ebeef5; }
.empty-state { text-align: center; color: #909399; padding: 40px 0; }

/* ============ KPI 指标卡片 ============ */
.kpi-card {
    background: #fff;
    border: 1px solid #ebeef5;
    border-radius: 8px;
    padding: 14px 16px;
    transition: box-shadow .2s;
    border-left: 3px solid #409EFF;
    min-width: 0;
}
.kpi-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.kpi-card.warning { border-left-color: #E6A23C; }
.kpi-card.danger { border-left-color: #F56C6C; background: #fef0f0; }
.kpi-label { font-size: 13px; color: #909399; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-num { font-size: 26px; font-weight: 600; color: #303133; line-height: 1.2; }
.kpi-card.danger .kpi-num { color: #F56C6C; }
.kpi-sub { font-size: 12px; color: #909399; margin-top: 6px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 一键创建任务确认弹窗：保留换行 */
.seed-confirm-dialog .el-message-box__message { white-space: pre-wrap; }
.tag-type-requirement { background: #ecf5ff; color: #409eff; border-color: #d9ecff; }
.tag-type-mechanical { background: #f0f9eb; color: #67c23a; border-color: #e1f3d8; }
.tag-type-electrical { background: #fdf6ec; color: #e6a23c; border-color: #faecd8; }
.tag-type-procurement { background: #fef0f0; color: #f56c6c; border-color: #fde2e2; }
.tag-type-bug { background: #f4f4f5; color: #909399; border-color: #e9e9eb; }

/* ============ 工时填报：周历 7 列 ============ */
.ts-week {
    display: grid;
    grid-template-columns: repeat(7, minmax(150px, 1fr));
    gap: 12px;
}
@media (max-width: 1400px) { .ts-week { grid-template-columns: repeat(4, minmax(160px, 1fr)); } }
@media (max-width: 900px)  { .ts-week { grid-template-columns: repeat(2, minmax(160px, 1fr)); } }
@media (max-width: 560px)  { .ts-week { grid-template-columns: 1fr; } }
.ts-week .el-card.is-today { border-color: #409EFF; }
.ts-week .el-card.is-today .el-card__header { background: #ecf5ff; }
.ts-item:last-child { border-bottom: none !important; }
