/* ======================================================
   Gantt Chart (CSS-only, no library) + additional styles
   ====================================================== */

/* ── EVM Warning Banner ── */
.evm-warn-banner {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 16px; margin: 0 0 14px 0;
    border-radius: 8px; border: 1px solid transparent;
    font-size: 0.9rem; line-height: 1.45;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}
.evm-warn-banner.hidden { display: none; }
.evm-warn-banner--info    { background: #EFF6FF; border-color: #93C5FD; color: #1E3A8A; }
.evm-warn-banner--warn    { background: #FFFBEB; border-color: #FBBF24; color: #78350F; }
.evm-warn-banner--danger  { background: #FEF2F2; border-color: #F87171; color: #7F1D1D; }
.evm-warn-icon  { font-size: 1.4rem; line-height: 1; flex-shrink: 0; margin-top: 2px; }
.evm-warn-body  { flex: 1; min-width: 0; }
.evm-warn-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 4px; }
.evm-warn-tag   {
    display: inline-block; margin-left: 6px; padding: 1px 8px;
    border-radius: 999px; font-size: 0.7rem; font-weight: 800;
    background: rgba(255, 255, 255, 0.7); color: inherit;
    vertical-align: middle; letter-spacing: 0.5px;
}
.evm-warn-list  { margin: 4px 0 0 18px; padding: 0; }
.evm-warn-list li { margin: 2px 0; }
.evm-warn-empty { margin: 4px 0 0 0; font-style: italic; opacity: 0.8; }
.evm-warn-close {
    background: transparent; border: 0; cursor: pointer;
    font-size: 1.3rem; line-height: 1; color: inherit; opacity: 0.6;
    padding: 0 4px; align-self: flex-start;
}
.evm-warn-close:hover { opacity: 1; }

/* ── EVM KPI Row ── */
.kpi-grid-12 {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.7rem;
    margin-bottom: 0.85rem;
}
@media (max-width: 1280px) { .kpi-grid-12 { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px)  { .kpi-grid-12 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px)  { .kpi-grid-12 { grid-template-columns: repeat(2, 1fr); } }

.evm-section-title {
    font-size: 0.75rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.07em; color: #4a5568;
    margin: 0.5rem 0 0.5rem 0.1rem;
    display: flex; align-items: center; gap: 0.5rem;
}
.evm-section-title::after {
    content: ''; flex: 1; height: 1px; background: #e2e8f0;
}
.evm-empty { color: #a0aec0; font-size: 0.85rem; padding: 1rem; text-align: center; }

/* ── S-Curve section ── */
.scurve-section {
    background: #fff; border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    padding: 1.1rem; margin-bottom: 0.85rem;
}
.scurve-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0.85rem; flex-wrap: wrap; gap: 0.5rem;
}
.scurve-header h4 { font-size: 0.95rem; font-weight: 700; color: #2d3748; margin: 0; }
.scurve-controls { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.scurve-controls label { font-size: 0.75rem; font-weight: 700; color: #718096; text-transform: uppercase; letter-spacing: 0.05em; }
.scurve-body { height: 300px; position: relative; }

/* ── Global Filter Bar (v2) ── */
.xer-filters-bar {
    display: flex; align-items: flex-end; flex-wrap: wrap; gap: 0.6rem;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
    padding: 0.75rem 1.1rem; margin-bottom: 1.1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.filter-group {
    display: flex; flex-direction: column; min-width: 130px;
}
.filter-group label {
    font-size: 0.67rem; font-weight: 800; color: #4a5568;
    margin-bottom: 0.25rem; text-transform: uppercase; letter-spacing: 0.05em;
}
.filter-divider { width: 1px; background: #e2e8f0; align-self: stretch; margin: 0 0.25rem; }
.filter-date-range {
    display: flex; align-items: flex-end; gap: 0.4rem;
}
.filter-date-range label { font-size: 0.67rem; font-weight: 800; color: #4a5568; text-transform: uppercase; letter-spacing: 0.05em; }
.filter-date-range .date-inputs { display: flex; align-items: center; gap: 0.3rem; }
.filter-date-range .date-inputs span { font-size: 0.8rem; color: #718096; font-weight: 600; }
.filter-search-box { position: relative; }
.filter-search-box input { padding-left: 1.85rem !important; }
.filter-search-box::before { content: '🔍'; position: absolute; left: 0.5rem; top: 50%; transform: translateY(-50%); font-size: 0.75rem; z-index: 1; }
.filter-baseline-toggle {
    display: flex; align-items: center; gap: 0.4rem;
    background: #f7fafc; border: 1.5px solid #e2e8f0; border-radius: 6px;
    padding: 0.4rem 0.75rem; cursor: pointer;
    font-size: 0.8rem; font-weight: 600; color: #4a5568;
    transition: all 0.15s; white-space: nowrap; user-select: none;
}
.filter-baseline-toggle:has(input:checked) {
    background: #ebf8ff; border-color: #3182ce; color: #1a4971;
}
.filter-baseline-toggle input { margin: 0; cursor: pointer; accent-color: #3182ce; }
.filter-actions { display: flex; align-items: flex-end; gap: 0.4rem; margin-left: auto; }

/* Date range icon style */
.date-range-label {
    display: flex; align-items: center; gap: 0.35rem;
    font-size: 0.7rem; font-weight: 800; color: #dd6b20;
    text-transform: uppercase; letter-spacing: 0.05em;
}
.date-range-label::before { content: '📅'; font-size: 0.8rem; }
input[type="date"].form-input { min-width: 130px; }

/* ── Activities Split View (legacy, kept for fallback) ── */
.activities-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    /* No fixed height — let both panels grow freely */
    min-height: 480px;
    height: calc(100vh - 260px);
    max-height: 900px;
}
.activities-split .tab-panel { overflow: hidden; display: flex; flex-direction: column; }
.activities-split #grid-activities { flex: 1; min-height: 0; overflow: auto; }

/* ── Activities Primavera-style (combined grid + Gantt) ── */
.activities-primavera {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    height: calc(100vh - 260px);
    min-height: 520px;
    max-height: 900px;
    overflow: hidden;
}

.primavera-container {
    flex: 1; overflow: hidden; position: relative;
    background: #fafbfc;
    display: flex; flex-direction: column;
}

/* P6-style table header (frozen) */
.p6-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font-size: 0.78rem;
    color: #2d3748;
    user-select: none;
    direction: ltr; /* Override any page-level RTL for engineering tables */
}
.primavera-container,
.activities-primavera { direction: ltr; }
.p6-table thead th:nth-child(3) { overflow: hidden; text-overflow: ellipsis; }
.p6-table tbody td:nth-child(3) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.primavera-container .p6-table thead th {
    position: sticky; top: 0; z-index: 20;
    background: linear-gradient(180deg, #2d3748 0%, #1a202c 100%);
    color: #fff;
    text-align: left;
    padding: 0.55rem 0.6rem;
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-right: 1px solid rgba(255,255,255,0.08);
    border-bottom: 2px solid #1a202c;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
.p6-table thead th .sort-arrow {
    display: inline-block; width: 10px; opacity: 0.6; margin-left: 2px;
}
.p6-table thead th.sorted-asc .sort-arrow::after { content: '▲'; opacity: 1; }
.p6-table thead th.sorted-desc .sort-arrow::after { content: '▼'; opacity: 1; }
.p6-table thead th.sorted-asc .sort-arrow,
.p6-table thead th.sorted-desc .sort-arrow { opacity: 1; color: #ffd700; }
.p6-table thead th.gantt-head {
    cursor: default;
    background: linear-gradient(180deg, #1a365d 0%, #1a202c 100%);
    border-left: 1px solid #3182ce;
    text-align: center;
}

/* Body rows */
.p6-table tbody tr { transition: background 0.06s; }
.p6-table tbody td {
    padding: 0.36rem 0.6rem;
    border-bottom: 1px solid #edf2f7;
    border-right: 1px solid #edf2f7;
    vertical-align: middle;
    line-height: 1.35;
    background: inherit;
}
.p6-table tbody td:last-child { border-right: none; }

/* Gantt cell — holds a bar */
.p6-table td.gantt-cell {
    padding: 0;
    position: relative;
    background: #fff;
    border-left: 1px solid #e2e8f0;
    overflow: hidden;
    height: 30px;
}
.p6-table td.gantt-cell .gantt-bar-row {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    height: 14px;
    border-radius: 3px;
    min-width: 2px;
    box-shadow: inset 0 -1px 0 rgba(0,0,0,0.12);
    cursor: pointer;
    transition: filter 0.12s, transform 0.12s;
}
.p6-table td.gantt-cell .gantt-bar-row:hover { filter: brightness(1.1); }
.p6-table td.gantt-cell .gantt-bar-row .gantt-progress-fill {
    position: absolute; left: 0; top: 0; bottom: 0;
    background: rgba(255,255,255,0.32);
    border-radius: 3px 0 0 3px;
}
.p6-table td.gantt-cell .gantt-bar-row .gantt-bar-label {
    position: absolute; left: 6px; top: 0; bottom: 0;
    display: flex; align-items: center;
    font-size: 0.62rem; color: #fff; font-weight: 700;
    white-space: nowrap; text-shadow: 0 1px 1px rgba(0,0,0,0.45);
    overflow: hidden;
    max-width: calc(100% - 8px);
    pointer-events: none;
}
.p6-table td.gantt-cell .gantt-month-tick {
    position: absolute; top: 0; bottom: 0;
    border-left: 1px dashed #cbd5e0;
    pointer-events: none;
}
.p6-table td.gantt-cell .data-date-line {
    position: absolute; top: 0; bottom: 0;
    width: 2px; background: #e53e3e;
    pointer-events: none;
    z-index: 3;
}
.p6-table td.gantt-cell .data-date-flag {
    position: absolute; top: 1px;
    transform: translateX(-50%);
    background: #e53e3e; color: #fff;
    font-size: 0.55rem; font-weight: 700;
    padding: 1px 4px; border-radius: 2px;
    white-space: nowrap;
    z-index: 4;
}

/* WBS group rows — color-coded by hierarchy level */
.p6-table tbody tr.p6-wbs { cursor: pointer; font-weight: 700; }
.p6-table tbody tr.p6-wbs td { font-weight: 700; }
.p6-table tbody tr.p6-wbs:hover { filter: brightness(1.05); }

/* Level 0: Project — deepest navy */
.p6-table tbody tr.p6-l0 td { background: #1a365d !important; color: #fff; border-bottom: 1px solid #142a4a; }
.p6-table tbody tr.p6-l0 td.gantt-cell { background: #1a365d !important; }
.p6-table tbody tr.p6-l0 .wbs-toggle { color: #ffd700; }

/* Level 1: Area — medium navy */
.p6-table tbody tr.p6-l1 td { background: #2c5282 !important; color: #fff; border-bottom: 1px solid #24466e; }
.p6-table tbody tr.p6-l1 td.gantt-cell { background: #2c5282 !important; }
.p6-table tbody tr.p6-l1 .wbs-toggle { color: #90cdf4; }

/* Level 2: Sub-area — blue */
.p6-table tbody tr.p6-l2 td { background: #bee3f8 !important; color: #1a365d; border-bottom: 1px solid #a0cdee; }
.p6-table tbody tr.p6-l2 td.gantt-cell { background: #bee3f8 !important; }
.p6-table tbody tr.p6-l2 .wbs-toggle { color: #2c5282; }

/* Level 3: Sub-sub — light blue */
.p6-table tbody tr.p6-l3 td { background: #e6f3fc !important; color: #2d3748; border-bottom: 1px solid #d4ebf8; }
.p6-table tbody tr.p6-l3 td.gantt-cell { background: #e6f3fc !important; }
.p6-table tbody tr.p6-l3 .wbs-toggle { color: #2c5282; }

/* Level 4+: very light */
.p6-table tbody tr.p6-l4 td { background: #f0f7fc !important; color: #2d3748; }

/* Activity rows */
.p6-table tbody tr.p6-act td { background: #fff; }
.p6-table tbody tr.p6-act:nth-child(even) td { background: #fafbfc; }
.p6-table tbody tr.p6-act:hover td { background: #ebf8ff !important; }
.p6-table tbody tr.p6-act.selected td { background: #fef3c7 !important; }

.wbs-toggle {
    display: inline-block;
    width: 14px;
    font-size: 0.7rem;
    margin-right: 4px;
    text-align: center;
    user-select: none;
}
.wbs-indent {
    display: inline-block;
}
.act-id-cell { font-family: 'SF Mono', Consolas, monospace; font-weight: 700; font-size: 0.72rem; }
.act-id-cell.lvl-0 { color: #fff; }
.act-name-cell { font-weight: 500; }
.act-name-cell.lvl-0,
.act-name-cell.lvl-1 { color: #fff; }
.act-wbs-cell { font-size: 0.7rem; color: #4a5568; }
.p6-l2 .act-wbs-cell, .p6-l3 .act-wbs-cell, .p6-l4 .act-wbs-cell { color: #2d3748; }

.act-status-cell .status-chip {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    font-size: 0.66rem; font-weight: 700; letter-spacing: 0.3px;
}
.status-Completed { background: #c6f6d5; color: #22543d; }
.status-In-Progress { background: #bee3f8; color: #2a4365; }
.status-Not-Started { background: #e2e8f0; color: #4a5568; }

.act-progress-bar {
    position: relative; height: 12px; background: #edf2f7;
    border-radius: 6px; overflow: hidden; min-width: 80px;
}
.act-progress-bar-fill {
    position: absolute; left: 0; top: 0; bottom: 0;
    background: linear-gradient(90deg, #38a169, #2f855a);
    border-radius: 6px;
}
.act-progress-text {
    position: absolute; left: 0; right: 0; top: 0; bottom: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.62rem; font-weight: 700; color: #1a202c;
}
.act-var-cell { text-align: right; font-weight: 700; }
.act-var-cell.negative { color: #e53e3e; }
.act-var-cell.positive { color: #38a169; }

.p6-empty {
    padding: 2rem; text-align: center; color: #718096; font-size: 0.85rem;
}
.p6-toolbar {
    padding: 0.5rem 0.85rem;
    background: #f7fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.72rem; color: #4a5568;
}
.p6-toolbar input.p6-search {
    flex: 1; max-width: 320px;
    padding: 0.35rem 0.6rem;
    border: 1px solid #cbd5e0;
    border-radius: 5px;
    font-size: 0.78rem;
}
.p6-toolbar select.p6-filter {
    padding: 0.35rem 0.5rem;
    border: 1px solid #cbd5e0;
    border-radius: 5px;
    font-size: 0.76rem;
    background: #fff;
}
.p6-counter { font-weight: 700; color: #2c5282; margin-left: 0.4rem; }

.gantt-panel {
    background: #fff; border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: flex; flex-direction: column; overflow: hidden;
}
.gantt-panel-header {
    padding: 0.85rem 1.1rem; border-bottom: 1px solid #f0f4f8;
    display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.gantt-panel-header h4 { font-size: 0.875rem; font-weight: 700; color: #2d3748; margin: 0; }
.gantt-panel-body { flex: 1; overflow: auto; position: relative; }

/* Gantt internals */
.gantt-wrap { min-width: 600px; }
.gantt-header {
    position: sticky; top: 0; z-index: 10;
    background: #f7fafc;
    border-bottom: 2px solid #e2e8f0;
    /* Match the AG Grid header height of 48px */
    height: 48px;
    overflow: visible;
}

/* Date labels — rotated 90°, bottom-anchored to align with column header baseline */
.gantt-month {
    position: absolute;
    bottom: 2px;
    left: 0;
    font-size: 0.6rem;
    font-weight: 700;
    color: #4a5568;
    white-space: nowrap;
    letter-spacing: 0.3px;
    pointer-events: none;
    /* Rotate 90° counter-clockwise so text reads upward */
    writing-mode: vertical-rl;
    transform: translateX(-50%) rotate(180deg);
    transform-origin: center bottom;
    line-height: 1;
    max-height: 46px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gantt-month-tick {
    position: absolute; top: 0; width: 1px; height: 48px;
    background: #e2e8f0; opacity: 0.7;
}
.gantt-dd-line { position: absolute; top: 0; bottom: 0; width: 2px;
    background: #3182ce; opacity: 0.7; z-index: 5; pointer-events: none; }
.gantt-dd-label { position: absolute; top: 0; transform: translateX(-50%);
    background: #3182ce; color: #fff; font-size: 0.6rem; font-weight: 700;
    padding: 1px 4px; border-radius: 2px; white-space: nowrap; z-index: 6; line-height: 14px; }
.gantt-body { position: relative; padding-top: 0; }
.gantt-row { position: relative; height: 28px; border-bottom: 1px solid #f0f4f8;
    box-sizing: border-box; }
.gantt-row:hover { background: #f8fafc; }
.gantt-row--selected { background: #fef3c7; }
.gantt-row--selected:hover { background: #fde68a; }
.gantt-bar {
    position: absolute; top: 4px; height: 20px; border-radius: 3px;
    min-width: 2px; cursor: pointer; transition: opacity 0.15s, transform 0.15s, box-shadow 0.15s;
}
.gantt-bar:hover { opacity: 1 !important; filter: brightness(1.1); }
.gantt-bar--selected {
    opacity: 1 !important;
    box-shadow: 0 0 0 2px #d97706, 0 0 8px rgba(217, 119, 6, 0.5);
    transform: translateY(-1px);
    z-index: 3;
}
.gantt-progress { height: 100%; border-radius: 3px 0 0 3px; }
.gantt-truncated-note {
    text-align: center;
    padding: 12px 8px;
    color: #92400e;
    background: linear-gradient(180deg, #fef3c7 0%, #fffbeb 100%);
    border-top: 1px dashed #fbbf24;
    font-size: 0.75rem;
    font-weight: 600;
}

@media (max-width: 1024px) {
    .activities-split { grid-template-columns: 1fr; height: auto; min-height: 320px; }
    .gantt-panel { height: 400px; }
}

/* ── Look-Ahead controls ── */
.lookahead-controls { display: flex; align-items: center; gap: 0.5rem; }
.lookahead-controls label { font-size: 0.8rem; font-weight: 600; color: #718096; }
.lookahead-controls input[type=number] { width: 65px; }

/* ── OOS Source Filter (Update / Baseline / Comparison) ── */
.oos-source-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-bottom: 1px solid #cbd5e0;
    flex-wrap: wrap;
}
.oos-source-filter select {
    padding: 8px 14px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    background: #fff;
    color: #1e293b;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    min-width: 180px;
}
.oos-source-filter select:hover { border-color: #14b8a6; }
.oos-source-filter select:focus {
    outline: none;
    border-color: #14b8a6;
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}
.oos-source-filter #oos-source-hint {
    font-size: 0.78rem;
    color: #64748b;
    font-style: italic;
    flex: 1;
    min-width: 280px;
}

/* ── Upload Flow Note ── */
.flow-note {
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 0.8rem;
    text-align: center;
    border: 1px solid transparent;
    transition: all 0.2s;
}
.flow-note--idle  { background:#f1f5f9; color:#475569; border-color:#cbd5e0; }
.flow-note--ok    { background:#d1fae5; color:#065f46; border-color:#10b981; }
.flow-note--warn  { background:#fef3c7; color:#92400e; border-color:#f59e0b; }

/* ── Runtime Diagnostics Panel ── */
.diag-card {
    background: #f8fafc;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 12px;
}
.diag-header {
    padding: 0.7rem 1rem;
    background: #1e293b;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    user-select: none;
}
.diag-header:hover { background: #334155; }
.diag-conf {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.diag-conf--high    { background:#10b981; color:#fff; }
.diag-conf--medium  { background:#f59e0b; color:#fff; }
.diag-conf--low     { background:#ef4444; color:#fff; }
.diag-conf--blocked { background:#991b1b; color:#fff; }
.diag-conf--unknown { background:#64748b; color:#fff; }

.diag-body { padding: 1rem 1.2rem; }
.diag-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 0.8rem;
}
.diag-grid h4 {
    font-size: 0.78rem;
    text-transform: uppercase;
    color: #475569;
    margin: 0 0 0.4rem 0;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #14b8a6;
    padding-bottom: 4px;
}
.diag-tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.diag-tbl th, .diag-tbl td {
    padding: 5px 8px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}
.diag-tbl th {
    background: #e2e8f0;
    font-weight: 600;
    color: #1e293b;
}
.diag-list {
    margin: 0; padding-left: 18px;
    font-size: 0.82rem;
    color: #334155;
    line-height: 1.5;
}
.diag-list code {
    background: #e2e8f0;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.75rem;
    color: #0f172a;
}
.diag-sub {
    background: #fff;
    border-left: 3px solid #14b8a6;
    padding: 0.5rem 0.7rem;
    font-size: 0.78rem;
    color: #334155;
    border-radius: 4px;
    line-height: 1.5;
}

@media (max-width: 900px) {
    .diag-grid { grid-template-columns: 1fr; }
}

/* ── Look-Ahead Controls ── */
.lookahead-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.88rem;
}
.lookahead-controls label {
    color: #475569;
    font-weight: 500;
}
.lookahead-source-info {
    margin-left: 8px;
    font-size: 0.75rem;
    color: #64748b;
    font-style: italic;
    padding: 2px 8px;
    background: #f1f5f9;
    border-radius: 4px;
}
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

/* ── DCMA Threshold Editor Modal ── */
.dcma-thresh-modal {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(15, 23, 42, 0.5);
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.15s ease-out;
}
.dcma-thresh-card {
    background: #fff; padding: 24px; border-radius: 12px;
    max-width: 640px; width: 92vw; max-height: 90vh; overflow: auto;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}
.dcma-thresh-card h3 { margin: 0 0 8px 0; color: #1E293B; }
.dcma-thresh-help { color: #64748B; font-size: 0.85rem; margin: 0 0 16px 0; }
.dcma-thresh-card table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.dcma-thresh-card th { text-align: left; padding: 8px 6px; border-bottom: 2px solid #E2E8F0; color: #475569; font-size: 0.8rem; }
.dcma-thresh-card td { padding: 10px 6px; border-bottom: 1px solid #F1F5F9; vertical-align: top; }
.dcma-thresh-card input[type=number] {
    width: 80px; padding: 4px 6px;
    border: 1px solid #CBD5E1; border-radius: 4px; font-size: 0.9rem;
}
.dcma-thresh-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.dcma-thresh-actions .btn-primary, .dcma-thresh-actions .btn-secondary {
    padding: 6px 14px; border-radius: 6px; font-size: 0.9rem; cursor: pointer;
    border: 1px solid transparent;
}
.dcma-thresh-actions .btn-primary   { background: #14B8A6; color: #fff; }
.dcma-thresh-actions .btn-primary:hover   { background: #0D9488; }
.dcma-thresh-actions .btn-secondary { background: #F1F5F9; color: #1E293B; border-color: #CBD5E1; }
.dcma-thresh-actions .btn-secondary:hover { background: #E2E8F0; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ════════════════════════════════════════════════════════
   Mockup P6 Activities View (split layout + canvas Gantt)
   ════════════════════════════════════════════════════════ */
.p6-mockup-wrap { display:flex; flex-direction:column; height:100%; user-select:none; }
.p6-mockup-toolbar {
    display:flex; align-items:center; gap:6px;
    padding:5px 8px; background:#EDF2F7; border-bottom:1px solid #C0D4E8;
    flex-wrap:wrap; flex-shrink:0;
}
.p6-mockup-tit { font-size:12px; font-weight:700; color:#1E3A5F; margin-right:4px; white-space:nowrap; }
.p6-mockup-btn {
    padding:2px 8px; font-size:11px; background:#fff;
    border:1px solid #A8C0D6; border-radius:3px; cursor:pointer; color:#1A1A2E;
}
.p6-mockup-btn:hover { background:#D8EAF8; }
.p6-mockup-leg { display:flex; gap:8px; align-items:center; margin-left:auto; flex-wrap:wrap; }
.p6-li { display:flex; align-items:center; gap:3px; font-size:10px; color:#4A5568; }
.p6-lb { width:16px; height:8px; border-radius:2px; flex-shrink:0; }

.p6-mockup-split { display:flex; flex:1; overflow:hidden; min-height:0; }
.p6-mockup-left { width:282px; flex-shrink:0; display:flex; flex-direction:column; border-right:2px solid #2B6CB0; }
.p6-mockup-left .p6-mockup-lh { flex-shrink:0; overflow-x:auto; overflow-y:hidden; height:42px; }
.p6-mockup-left .p6-mockup-lh::-webkit-scrollbar { height:5px; }
.p6-mockup-left .p6-mockup-lh::-webkit-scrollbar-track { background:#F0F4F8; }
.p6-mockup-left .p6-mockup-lh::-webkit-scrollbar-thumb { background:#A8C0D6; border-radius:3px; }
.p6-mockup-left .p6-mockup-lb { flex:1; overflow:auto; }
.p6-mockup-left .p6-mockup-lb::-webkit-scrollbar { width:5px; height:5px; }
.p6-mockup-left .p6-mockup-lb::-webkit-scrollbar-track { background:#F0F4F8; }
.p6-mockup-left .p6-mockup-lb::-webkit-scrollbar-thumb { background:#A8C0D6; border-radius:3px; }

.p6-act-tbl { border-collapse:collapse; width:100%; min-width:820px; table-layout:fixed; font-size:11px; font-family:'Segoe UI',Arial,sans-serif; }

/* ── Column widths ── */
.p6-ch-id { width:85px; }
.p6-ch-nm { width:auto; min-width:180px; }
.p6-ch-dt { width:76px; }
.p6-ch-dr { width:58px; }
.p6-ch-co { width:90px; }

/* ── HEADER ── */
.p6-hdr { }
.p6-hdr th {
    position:sticky; top:0; z-index:10;
    background:#1E3A5F; color:#fff; font-weight:600; font-size:10.5px;
    text-align:left; padding:3px 4px; white-space:nowrap;
    border-right:1px solid #2D5088; border-bottom:2px solid #162B47;
    letter-spacing:0.02em;
}
.p6-hdr th:last-child { border-right:none; }

/* ── WBS ROWS ── */
.p6-wbs-row td {
    padding:2px 4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
    font-weight:600; font-size:11.5px; cursor:pointer;
    border-right:1px solid rgba(255,255,255,0.15); border-bottom:1px solid rgba(255,255,255,0.1);
}

/* WBS level background colors */
.p6-wbs-lvl-1 td { background:#1F4788; color:#fff; }
.p6-wbs-lvl-2 td { background:#2E6BB5; color:#fff; }
.p6-wbs-lvl-3 td { background:#4080C4; color:#fff; }
.p6-wbs-lvl-4 td { background:#5A96D0; color:#fff; }

.p6-wbs-lvl-1:hover td { background:#2A5A9E; }
.p6-wbs-lvl-2:hover td { background:#3878C0; }
.p6-wbs-lvl-3:hover td { background:#5090CF; }
.p6-wbs-lvl-4:hover td { background:#6AA5DA; }

.p6-wbs-row td:last-child { border-right:none; }

/* WBS name cell */
.p6-wbs-name { overflow:visible !important; white-space:nowrap; }
.p6-wbs-null { }
.p6-wbs-ico { margin-right:3px; font-size:11px; }
.p6-wbs-lbl { font-weight:700; }
.p6-wbs-cd { font-weight:400; opacity:0.8; font-size:10.5px; }

/* Rollup values in WBS row */
.p6-rollup { text-align:right !important; font-weight:600; font-size:11px; opacity:0.95; }

/* ── ACTIVITY ROWS ── */
.p6-act-row td {
    padding:2px 4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
    font-size:11px; color:#1A1A2E;
    border-right:1px solid #C0D4E8; border-bottom:1px solid #D8E8F0;
}
.p6-act-row td:last-child { border-right:none; }

/* Alternating row colors */
.p6-act-row.p6-even td { background:#fff; }
.p6-act-row.p6-odd  td { background:#EEF4FB; }

/* Row hover */
.p6-act-row:hover td { background:#D2E6F8 !important; }

/* Critical activities */
.p6-act-row.p6-crit td { background:#FFF5F5 !important; }
.p6-act-row.p6-crit td:first-child { border-left:3px solid #CC0000; }
.p6-act-row.p6-crit .p6-anmtxt { color:#990000; font-weight:600; }

/* Near-critical */
.p6-act-row.p6-near td { background:#FFFBF0 !important; }
.p6-act-row.p6-near td:first-child { border-left:3px solid #CC8800; }

/* ── CELL ALIGNMENT ── */
.p6-aid { font-family:Consolas,monospace; font-size:10px; color:#2B4DA7; font-weight:700; }
.p6-anm { }
.p6-anmtxt { display:inline; vertical-align:middle; }
.p6-dt { text-align:center; font-size:11px; }
.p6-dr { text-align:center; font-size:11px; }
.p6-co { text-align:right; font-size:11px; font-variant-numeric:tabular-nums; }

/* ── WBS toggle triangles ── */
.p6-tri { display:inline-block; width:0; height:0; cursor:pointer; margin-right:3px; vertical-align:middle; flex-shrink:0; }
.p6-tridn { border-left:4px solid transparent; border-right:4px solid transparent; border-top:6px solid #fff; }
.p6-trir { border-top:4px solid transparent; border-bottom:4px solid transparent; border-left:6px solid #fff; }

/* ── Activity status dots ── */
.p6-sd { display:inline-block; width:7px; height:7px; border-radius:50%; margin-right:4px; vertical-align:middle; flex-shrink:0; }
.p6-sdc { background:#28A428; }
.p6-sda { background:#0070CC; }
.p6-sdn { background:#A0A0A0; border:1px solid #808080; }

/* ── Indent spacer ── */
.p6-indent { display:inline-block; flex-shrink:0; }

/* ── RIGHT PANEL (canvas Gantt) ── */
.p6-mockup-right { flex:1; display:flex; flex-direction:column; overflow:hidden; }
.p6-mockup-rh { height:42px; flex-shrink:0; position:relative; overflow-x:auto; overflow-y:hidden; }
.p6-mockup-rh::-webkit-scrollbar { height:5px; }
.p6-mockup-rh::-webkit-scrollbar-track { background:#F0F4F8; }
.p6-mockup-rh::-webkit-scrollbar-thumb { background:#A8C0D6; border-radius:3px; }
.p6-mockup-tl { display:block; width:100%; height:42px; }
.p6-mockup-gb { flex:1; overflow:auto; position:relative; }
.p6-mockup-gb::-webkit-scrollbar { width:5px; }
.p6-mockup-gb::-webkit-scrollbar-track { background:#F0F4F8; }
.p6-mockup-gb::-webkit-scrollbar-thumb { background:#A8C0D6; border-radius:3px; }
.p6-mockup-gc { display:block; }

/* ── FOOTER ── */
.p6-mockup-ft {
    padding:3px 10px; background:#EDF2F7; border-top:1px solid #C0D4E8;
    font-size:10.5px; color:#4A5568;
    display:flex; justify-content:space-between; align-items:center; flex-shrink:0;
}
.p6-dd-badge { background:#FF4500; color:#fff; border-radius:3px; padding:1px 6px; font-size:10px; font-weight:700; }

/* ── FULL P6 SPLIT LAYOUT ── */
.p6-wrap { border:1px solid #8AAEC8; border-radius:4px; overflow:hidden; background:#fff; user-select:none; height:100%; display:flex; flex-direction:column; }

/* Toolbar */
.p6-tb { display:flex; align-items:center; gap:5px; padding:5px 8px; background:#EDF2F7; border-bottom:1px solid #C0D4E8; flex-wrap:wrap; flex-shrink:0; }
.p6-tb .tit { font-size:12px; font-weight:700; color:#1E3A5F; margin-right:2px; }
.p6-tb .btn { padding:2px 7px; font-size:11px; background:#fff; border:1px solid #A8C0D6; border-radius:3px; cursor:pointer; color:#1A1A2E; white-space:nowrap; }
.p6-tb .btn:hover { background:#D8EAF8; }
.p6-tb .p6-grp { display:flex; align-items:center; gap:4px; font-size:11px; color:#4A5568; cursor:pointer; margin-right:4px; }
.p6-tb .p6-grp input { margin:0; cursor:pointer; }
.p6-tb .tsgrp { display:flex; align-items:center; gap:3px; border-left:1px solid #C0D4E8; padding-left:7px; margin-left:2px; }
.p6-tb .tsgrp span { font-size:10.5px; color:#666; }
.p6-tb .tsbtn { padding:2px 7px; font-size:10.5px; background:#fff; border:1px solid #A8C0D6; border-radius:3px; cursor:pointer; color:#1A1A2E; }
.p6-tb .tsbtn:hover { background:#D8EAF8; }
.p6-tb .tsbtn.on { background:#2E6BB5; color:#fff; border-color:#1F4788; }
.p6-tb .zbtn { padding:2px 6px; font-size:12px; background:#fff; border:1px solid #A8C0D6; border-radius:3px; cursor:pointer; }
.p6-tb .zbtn:hover { background:#D8EAF8; }
.p6-tb .leg { display:flex; gap:7px; align-items:center; margin-left:auto; flex-wrap:wrap; }
.p6-tb .li { display:flex; align-items:center; gap:3px; font-size:10px; color:#4A5568; }
.p6-tb .lb { width:14px; height:8px; border-radius:2px; flex-shrink:0; }

/* Split pane */
.p6-split { display:flex; flex:1; overflow:hidden; min-height:0; }

/* Resize handle — thicker for easy targeting, full hover feedback */
.p6-split-handle { width:7px; cursor:col-resize; background:#2B6CB0; flex-shrink:0; transition:background .15s, width .1s; position:relative; }
.p6-split-handle:hover, .p6-split-handle:active { background:#5A9BD5; width:9px; }
.p6-split-handle::before {
    content:''; position:absolute; left:-3px; right:-3px; top:0; bottom:0;
    background:transparent; z-index:-1;
}
.p6-split-handle::after {
    content:''; display:block; width:3px; height:32px; margin:auto;
    background:rgba(255,255,255,0.4); border-radius:2px;
    position:absolute; top:50%; left:50%; transform:translate(-50%,-50%);
    transition:height .15s;
}
.p6-split-handle:hover::after { height:48px; background:rgba(255,255,255,0.7); }

/* LEFT PANE */
.p6-lp { width:270px; flex-shrink:0; display:flex; flex-direction:column; overflow:hidden; height:100%; min-height:0; }

/* Table inside left pane */
.p6-act-tbl { border-collapse:collapse; width:100%; min-width:670px; table-layout:fixed; font-size:11px; font-family:'Segoe UI',Arial,sans-serif; }

/* Column widths (shared between flex header and table cells) */
.p6-ch-id { width:90px; flex-shrink:0; }
.p6-ch-nm { width:auto; flex:1; min-width:120px; }
.p6-ch-dt { width:76px; flex-shrink:0; }
.p6-ch-dr { width:58px; flex-shrink:0; }
.p6-ch-co { width:90px; flex-shrink:0; }

/* ── FIXED HEADER (flex row, 42px, matches Gantt timeline exactly) ── */
.p6-lh {
    display:flex; align-items:center; height:42px; flex-shrink:0;
    background:#1E3A5F; color:#fff; font-weight:600; font-size:10.5px;
    border-bottom:2px solid #162B47; letter-spacing:0.02em;
}
.p6-lh > div {
    padding:3px 5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
    border-right:1px solid #2D5088; height:100%; display:flex; align-items:center;
}
.p6-lh > div:last-child { border-right:none; }
.p6-lh > .p6-ch-dt, .p6-lh > .p6-ch-dr { justify-content:center; }
.p6-lh > .p6-ch-co { justify-content:flex-end; }

/* Left scroll body */
.p6-lb2 { flex:1; overflow:auto; }
.p6-lb2::-webkit-scrollbar { width:5px; }
.p6-lb2::-webkit-scrollbar-track { background:#F0F4F8; }
.p6-lb2::-webkit-scrollbar-thumb { background:#A8C0D6; border-radius:3px; }

/* WBS ROWS */
.p6-wbs-row td {
    padding:2px 4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
    font-weight:600; font-size:11.5px; cursor:pointer;
    border-right:1px solid rgba(255,255,255,0.15); border-bottom:1px solid rgba(255,255,255,0.1);
}
.p6-wbs-row td:last-child { border-right:none; }
.p6-wbs-row:hover td { filter:brightness(1.1); }

/* WBS level colors (match spec exactly) */
.p6-wbs-lvl-1 td { background:#1F4788; color:#fff; }
.p6-wbs-lvl-2 td { background:#2E6BB5; color:#fff; }
.p6-wbs-lvl-3 td { background:#4080C4; color:#fff; }
.p6-wbs-lvl-4 td { background:#5A96D0; color:#fff; }
.p6-wbs-lvl-1:hover td { background:#2A5A9E; }
.p6-wbs-lvl-2:hover td { background:#3878C0; }
.p6-wbs-lvl-3:hover td { background:#5090CF; }
.p6-wbs-lvl-4:hover td { background:#6AA5DA; }

/* WBS name cell */
.p6-wbs-name { overflow:visible !important; white-space:nowrap; }
.p6-wbs-ico { margin-right:3px; font-size:11px; }
.p6-wbs-lbl { font-weight:700; }
.p6-wbs-cd { font-weight:400; opacity:0.8; font-size:10.5px; }
.p6-rollup { text-align:right !important; font-weight:600; font-size:11px; opacity:0.95; }

/* WBS toggle triangles */
.p6-tri { display:inline-block; width:0; height:0; cursor:pointer; margin-right:3px; vertical-align:middle; flex-shrink:0; }
.p6-tridn { border-left:4px solid transparent; border-right:4px solid transparent; border-top:6px solid #fff; }
.p6-trir { border-top:4px solid transparent; border-bottom:4px solid transparent; border-left:6px solid #fff; }

/* ACTIVITY ROWS */
.p6-act-row td {
    padding:2px 4px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
    font-size:11px; color:#1A1A2E;
    border-right:1px solid #C0D4E8; border-bottom:1px solid #D8E8F0;
}
.p6-act-row td:last-child { border-right:none; }

/* Alternating row colors */
.p6-act-row.p6-even td { background:#fff; }
.p6-act-row.p6-odd  td { background:#EEF4FB; }
.p6-act-row:hover td { background:#D2E6F8 !important; }

/* Critical activities (3px red left border) */
.p6-act-row.p6-crit td { background:#FFF5F5 !important; }
.p6-act-row.p6-crit td:first-child { border-left:3px solid #CC0000; }
.p6-act-row.p6-crit .p6-anmtxt { color:#990000; font-weight:600; }

/* Near-critical (3px amber left border) */
.p6-act-row.p6-near td { background:#FFFBF0 !important; }
.p6-act-row.p6-near td:first-child { border-left:3px solid #CC8800; }

/* CELL ALIGNMENT */
.p6-aid { font-family:Consolas,monospace; font-size:10px; color:#2B4DA7; font-weight:700; padding-left:5px !important; }
.p6-anm { }
.p6-anmtxt { display:inline; vertical-align:middle; }
.p6-dt { text-align:center; font-size:11px; }
.p6-dr { text-align:center; font-size:11px; }
.p6-co { text-align:right; font-size:11px; font-variant-numeric:tabular-nums; padding-right:5px !important; }

/* Indent spacer */
.p6-indent { display:inline-block; flex-shrink:0; }

/* Activity status dots */
.p6-sd { display:inline-block; width:7px; height:7px; border-radius:50%; margin-right:4px; vertical-align:middle; flex-shrink:0; }
.p6-sdc { background:#28A428; }
.p6-sda { background:#0070CC; }
.p6-sdn { background:#A0A0A0; border:1px solid #808080; }

/* RIGHT PANE */
.p6-rp { flex:1; display:flex; flex-direction:column; overflow:hidden; min-height:0; }
.p6-gh { height:42px; flex-shrink:0; overflow:hidden; border-bottom:2px solid #162B47; }
.p6-gs { flex:1; overflow-x:scroll; overflow-y:scroll; cursor:grab; position:relative; }
.p6-gs:active { cursor:grabbing; }
.p6-gs::-webkit-scrollbar { width:5px; height:5px; }
.p6-gs::-webkit-scrollbar-thumb { background:#A8C0D6; border-radius:3px; }
.p6-wrap canvas { display:block; }

/* Footer */
.p6-ft { padding:3px 10px; background:#EDF2F7; border-top:1px solid #C0D4E8; font-size:10.5px; color:#4A5568; display:flex; justify-content:space-between; align-items:center; flex-shrink:0; }
.p6-ddb { background:#FF4500; color:#fff; border-radius:3px; padding:1px 6px; font-size:10px; font-weight:700; }

/* ── EMPTY STATE ── */
.p6-empty { display:flex; align-items:center; justify-content:center; height:200px; color:#A0AEC0; font-size:14px; text-align:center; }

/* ── P6 TOOLBAR FLOATING (for old flat view compat) ── */
.p6-floating-bar { display:flex; align-items:center; gap:8px; padding:4px 10px; background:#EDF2F7; border-bottom:1px solid #CBD5E0; font-size:12px; }
.p6-floating-bar label { display:flex; align-items:center; gap:4px; cursor:pointer; }

