/* 甘特图样式（详细设计 §11.6）。
   颜色语义走 CSS 变量：DEC-001（蓝计划/绿实际）待客户确认，确认后只改这里，不动组件。 */
:root {
    --g-plan: #2563eb;          /* 当前计划条 */
    --g-actual: #22c55e;        /* 条内实际进度 */
    --g-baseline: #9ca3af;      /* 基线轮廓 */
    --g-milestone: #7c3aed;     /* 里程碑菱形 */
    --g-overdue: #dc2626;       /* 延期描边 / 今天线 */
    --g-due-soon: #f59e0b;      /* 即将到期标记 */
    --g-off-day: rgba(148, 163, 184, .16);   /* 周末底色 */
    --g-holiday: rgba(249, 115, 22, .12);    /* 节假日/停工底色 */
    --g-week-now: rgba(34, 197, 94, .10);    /* 当前周底色 */
    --g-grid: #eef1f5;
    --g-left-bg: #fff;
}

/* ---- 布局骨架：一个滚动容器 ---- */
.g-viewport {
    overflow: auto;
    position: relative;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    height: calc(100vh - 210px);
    min-height: 320px;
}
.g-canvas { position: relative; }

/* ---- 表头：sticky top；左上角再 sticky left ---- */
.g-header-band {
    position: sticky; top: 0; z-index: 30;
    display: flex; background: #f8fafc;
    border-bottom: 1px solid #dbe1e8;
}
.g-corner {
    position: sticky; left: 0; z-index: 40;
    flex: none; background: #f8fafc;
    border-right: 1px solid #dbe1e8;
    display: flex; align-items: end; gap: 6px;
    padding: 4px 8px;
}
.g-corner-right { margin-left: auto; padding-right: 14px; }
.g-splitter {
    position: absolute; right: -3px; top: 0; bottom: 0; width: 7px;
    cursor: col-resize; z-index: 41;
}
.g-splitter:hover { background: rgba(37, 99, 235, .25); }
.g-header-scroll { position: absolute; top: 0; height: 100%; overflow: hidden; }

.g-header { display: flex; flex-direction: column; height: 66px; }
.g-h-row { display: flex; height: 22px; line-height: 22px; }
.g-h-cell {
    flex: none; font-size: 11px; color: #475569; text-align: center;
    border-right: 1px solid #e2e8f0; overflow: hidden; white-space: nowrap;
}
.g-h-month { font-weight: 600; text-align: left; padding-left: 6px; border-right-color: #cbd5e1; }
.g-h-week-now { background: var(--g-week-now); font-weight: 600; color: #15803d; }
.g-h-day.g-h-off { color: #b6bfca; background: var(--g-off-day); }
.g-h-day.g-h-today { background: var(--g-overdue); color: #fff; border-radius: 3px; font-weight: 700; }

/* ---- 时间轴背景：CSS 渐变画周网格线，非工作日/当前周是合并后的色块 ---- */
.g-bg {
    position: absolute; overflow: hidden; pointer-events: none;
    background-image: linear-gradient(to right, #dde3ea 1px, transparent 1px);
    /* background-size 由组件内联（周宽 = 日宽×7），网格线一周一条，不逐日画 */
}
.g-bg-block { position: absolute; top: 0; height: 100%; }
.g-bg-off { background: var(--g-off-day); }
.g-bg-holiday { background: var(--g-holiday); }
.g-bg-week-now { background: var(--g-week-now); }
.g-today-line {
    position: absolute; top: 0; height: 100%; width: 2px;
    background: var(--g-overdue); opacity: .75; z-index: 3;
}

/* ---- 行 ---- */
.g-row {
    position: absolute; left: 0; width: 100%; height: 36px;
    display: flex; outline: none;
}
.g-row:focus-visible .g-row-left { box-shadow: inset 0 0 0 2px rgba(37, 99, 235, .5); }
.g-row-alt .g-row-left { background: #fbfcfe; }
.g-row-selected .g-row-left { background: #eff6ff; }
.g-row:hover .g-row-left { background: #f1f5f9; }

.g-row-left {
    position: sticky; left: 0; z-index: 20;
    flex: none; height: 100%;
    background: var(--g-left-bg);
    border-right: 1px solid #dbe1e8;
    border-bottom: 1px solid var(--g-grid);
    display: flex; align-items: center; gap: 4px;
    padding: 0 8px 0 4px; font-size: 12.5px;
    cursor: default; overflow: hidden; white-space: nowrap;
}
.g-indent { flex: none; }
.g-caret {
    flex: none; width: 18px; border: 0; background: none;
    color: #64748b; font-size: 11px; padding: 0; cursor: pointer;
}
.g-caret-ph { flex: none; width: 18px; }
.g-wbs { flex: none; font-size: 11px; color: #94a3b8; min-width: 34px; }
.g-name-ms { color: var(--g-milestone); font-size: 11px; }
.g-name { overflow: hidden; text-overflow: ellipsis; }
.g-cancelled-text { color: #b6bfca; text-decoration: line-through; }
.g-risk { font-size: 11px; margin-left: 2px; }
.g-risk-critical { color: var(--g-overdue); }
.g-risk-warning { color: var(--g-due-soon); }
.g-risk-attention { color: #94a3b8; }
.g-owner {
    flex: none; margin-left: auto; width: 64px;
    font-size: 11.5px; color: #64748b;
    overflow: hidden; text-overflow: ellipsis; text-align: right;
}
.g-pct { flex: none; width: 40px; font-size: 11.5px; color: #475569; text-align: right; }

.g-row-bars { position: absolute; top: 0; height: 36px; border-bottom: 1px solid var(--g-grid); }

/* ---- 任务条 ---- */
.g-bar {
    position: absolute; top: 9px; height: 18px;
    background: var(--g-plan); border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .18);
    overflow: hidden; cursor: pointer; z-index: 5;
}
.g-bar-progress {
    position: absolute; left: 0; top: 0; height: 100%;
    background: var(--g-actual); opacity: .9;
}
.g-bar-parent {
    top: 12px; height: 8px; background: #334155; border-radius: 2px; cursor: default;
}
.g-bar-parent .g-bar-progress { background: #16a34a; }
.g-bar-overdue { box-shadow: 0 0 0 2px var(--g-overdue); }
.g-bar-blocked { background: repeating-linear-gradient(45deg, var(--g-plan), var(--g-plan) 6px, #d97706 6px, #d97706 9px); }
.g-selected { box-shadow: 0 0 0 2px #1d4ed8, 0 0 0 4px rgba(37, 99, 235, .3); }
.g-cancelled { opacity: .35; filter: grayscale(1); }

.g-due-soon {
    position: absolute; right: -3px; top: -3px; width: 8px; height: 8px;
    border-radius: 50%; background: var(--g-due-soon); border: 1px solid #fff;
}

/* 左右拖拽把手：只有可编辑的叶子任务才渲染 */
.g-h-l, .g-h-r {
    position: absolute; top: 0; width: 7px; height: 100%;
    cursor: ew-resize; z-index: 6;
}
.g-h-l { left: 0; border-radius: 3px 0 0 3px; }
.g-h-r { right: 0; border-radius: 0 3px 3px 0; }
.g-bar:hover .g-h-l, .g-bar:hover .g-h-r { background: rgba(255, 255, 255, .45); }

/* ---- 基线轮廓 ---- */
.g-baseline {
    position: absolute; top: 5px; height: 26px;
    border: 1.5px solid var(--g-baseline); border-radius: 4px;
    background: transparent; z-index: 2; pointer-events: none;
}

/* ---- 里程碑 ---- */
.g-ms {
    position: absolute; top: 11px; width: 14px; height: 14px;
    margin-left: -7px; background: var(--g-milestone);
    transform: rotate(45deg); cursor: pointer; z-index: 6;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.g-ms-done { background: #16a34a; }
.g-ms-overdue { box-shadow: 0 0 0 2px var(--g-overdue); }
.g-ms-baseline {
    position: absolute; top: 12px; width: 12px; height: 12px; margin-left: -6px;
    background: none; border: 1.5px solid var(--g-baseline);
    transform: rotate(45deg); z-index: 2; pointer-events: none;
}

/* ---- 依赖线 ---- */
.g-deps-wrap { position: absolute; pointer-events: none; z-index: 4; }
.g-deps { display: block; }
.g-dep-line { fill: none; stroke: #94a3b8; stroke-width: 1.5; }
.g-dep-arrow { fill: #94a3b8; }

/* ---- 拖动幽灵条 ---- */
.g-ghost {
    position: absolute; top: 7px; height: 22px; z-index: 15;
    background: rgba(37, 99, 235, .25);
    border: 1.5px dashed var(--g-plan); border-radius: 4px;
    pointer-events: none;
}
.g-ghost-label {
    position: absolute; top: -14px; z-index: 16;
    font-size: 11px; font-weight: 700; color: var(--g-plan);
    background: #fff; padding: 0 4px; border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2); pointer-events: none;
}
body.g-dragging { user-select: none; cursor: grabbing; }

/* ---- 检查器 / 图例 / 弹窗 ---- */
.g-inspector { width: 320px; flex: none; max-height: calc(100vh - 210px); overflow: auto; }
.g-inspector-table td { padding: 3px 6px; font-size: 13px; }
.g-lg { display: inline-block; width: 14px; height: 10px; border-radius: 2px; }
.g-lg-baseline { border: 1.5px solid var(--g-baseline); }
.g-lg-plan { background: var(--g-plan); }
.g-lg-actual { background: var(--g-actual); }
.g-lg-milestone { background: var(--g-milestone); transform: rotate(45deg); width: 10px; height: 10px; }
.g-modal-backdrop { background: rgba(15, 23, 42, .45); }

/* ---- 我的任务（WP-10）：延期/阻塞行的左侧色条，移动端卡片同样适用 ---- */
.mt-row-overdue { box-shadow: inset 3px 0 0 var(--g-overdue); }
.mt-row-blocked { box-shadow: inset 3px 0 0 var(--g-due-soon); }

/* 移动端：只读横向滚动（WP-10 口径），左栏收窄 */
@media (max-width: 768px) {
    .g-inspector { width: 100%; }
    .g-viewport { height: calc(100vh - 260px); }
}
