:root {
    --bg: #f6f8fb;
    --panel: #ffffff;
    --ink: #172033;
    --muted: #667085;
    --line: #d9e0ea;
    --primary: #146eb4;
    --primary-dark: #0e4f85;
    --warn: #fff7ed;
    --warn-line: #fdba74;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar { height: 64px; padding: 0 28px; display:flex; align-items:center; justify-content:space-between; background:#fff; border-bottom:1px solid var(--line); position:sticky; top:0; z-index:10; }
.brand { font-size: 22px; font-weight: 800; color: var(--ink); margin-right: 10px; }
.subtitle { color: var(--muted); font-size: 14px; }
.topbar nav a { margin-left: 18px; color: var(--ink); font-weight:600; }
.container { max-width: 1240px; margin: 0 auto; padding: 28px; }
.hero { display:flex; justify-content:space-between; gap: 20px; align-items:center; margin-bottom: 22px; }
h1 { margin: 0 0 8px; font-size: 32px; letter-spacing: -0.03em; }
h2 { margin: 0 0 14px; font-size: 20px; }
p { margin: 0; color: var(--muted); line-height:1.5; }
.button { display:inline-flex; align-items:center; justify-content:center; min-height: 40px; padding: 0 16px; border-radius: 10px; background: var(--primary); color:#fff; font-weight:700; border:1px solid var(--primary); }
.button:hover { background:var(--primary-dark); text-decoration:none; }
.button.ghost { background:#fff; color: var(--primary); border-color: var(--line); }
.button.danger { background:#fff; color:#b42318; border-color:#fecdca; }
.button.danger:hover { background:#fff1f3; color:#912018; text-decoration:none; }
.inline-delete-form { display:inline; margin:0; }
.actions { display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-end; }
.kpis { display:grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.card, .panel { background: var(--panel); border:1px solid var(--line); border-radius:16px; box-shadow: 0 10px 24px rgba(16,24,40,0.04); }
.card { padding: 18px; }
.card span { display:block; color: var(--muted); font-size:13px; margin-bottom:10px; }
.card strong { font-size:24px; letter-spacing:-0.02em; }
.card small { display:block; color: var(--muted); margin-top:4px; }
.panel { padding: 20px; margin-bottom: 22px; overflow:auto; }
.panel-title { display:flex; justify-content:space-between; align-items:center; margin-bottom: 14px; }
.panel-title span, .muted { color: var(--muted); font-size: 14px; }
.panel-grid { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.grid-two { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.narrow { max-width: 860px; margin-left:auto; margin-right:auto; }
table { width:100%; border-collapse:collapse; font-size:14px; }
th, td { text-align:left; padding: 11px 12px; border-bottom:1px solid var(--line); vertical-align:top; }
th { background:#f8fafc; font-size:12px; text-transform:uppercase; letter-spacing:.04em; color:#475467; }
tr:hover td { background:#fbfdff; }
.badge { display:inline-flex; padding: 4px 8px; border-radius:999px; background:#eef6ff; color:#175cd3; font-size:12px; font-weight:700; }
.form-grid { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.form-grid.compact { grid-template-columns: repeat(4, minmax(0,1fr)); }
.form-grid label { display:flex; flex-direction:column; gap:6px; color:#344054; font-weight:700; font-size:13px; }
input, select, textarea { width:100%; border:1px solid var(--line); border-radius:10px; padding:10px 12px; font:inherit; background:#fff; }
textarea { resize:vertical; }
.wide { grid-column: span 2; }
.full { grid-column: 1 / -1; }
.form-actions { grid-column:1 / -1; display:flex; justify-content:flex-end; }
.warning { padding:14px 16px; background: var(--warn); border:1px solid var(--warn-line); border-radius: 14px; margin-bottom: 18px; color:#9a3412; }
pre { white-space:pre-wrap; font-family:inherit; color:#344054; }
@media (max-width: 900px) {
    .kpis, .panel-grid, .grid-two, .form-grid, .form-grid.compact { grid-template-columns:1fr; }
    .hero { align-items:flex-start; flex-direction:column; }
    .wide, .full { grid-column:auto; }
}
.section-label { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; font-weight: 800; color: #344054; margin-bottom: 14px; }
.inline-form { display:flex; gap:10px; margin-top:16px; align-items:center; }
.inline-form input { max-width: 260px; }
.estimation-panel { border-color:#d946ef; background:#fff7fd; }
.estimation-panel th { background:#f5d0fe; color:#581c87; }
.classification-grid { display:grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.classification-card { padding: 14px 16px; border:1px solid var(--line); border-radius:14px; background:#fff; }
.classification-card h3 { margin:0 0 8px; font-size:16px; }
.classification-card p { margin:0; color:#667085; line-height:1.5; }
.classification-card.editable { border-color:#2563eb; background:#eff6ff; }
.classification-card.readonly { border-color:#7c3aed; background:#f5f3ff; }
.classification-card.control { border-color:#ea580c; background:#fff7ed; }
.source-chip { display:inline-block; margin-left:8px; padding:3px 8px; border-radius:999px; font-size:11px; letter-spacing:0; text-transform:none; }
.source-chip.manual { background:#dbeafe; color:#1d4ed8; }
.source-chip.readonly { background:#ede9fe; color:#6d28d9; }
.source-chip.control { background:#ffedd5; color:#c2410c; }
.source-chip.calc { background:#dcfce7; color:#15803d; }
.source-chip.mixed { background:#fef9c3; color:#a16207; }
.source-cell { color:#667085; font-size:12px; }
.hint { color:#98a2b3; font-weight:500; font-size:11px; }
.small-table td, .small-table th { font-size:12px; }
@media (max-width: 900px) { .classification-grid { grid-template-columns:1fr; } }

/* Effort.P weekly matrix */
.wide-panel { overflow: hidden; }
.table-scroll { overflow-x: auto; }
.matrix-table { min-width: 1500px; }
.matrix-table th, .matrix-table td { vertical-align: top; }
.week-cell { min-width: 130px; }
.phase-select { width: 120px; margin-bottom: 6px; font-size: 12px; padding: 6px; }
.md-input { width: 90px; padding: 6px; }
.button.small { padding: 8px 12px; font-size: 13px; }
.phase-badge { display:inline-block; margin-top:4px; padding:3px 7px; border-radius:999px; background:#eef2ff; color:#3730a3; font-size:11px; font-weight:800; }
.small-input { max-width: 90px; }
.button.small { padding: 8px 12px; font-size: 13px; }
.config-row { border-top: 1px solid var(--border); padding: 16px 0; }
.field-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}
select[multiple] {
    min-height: 128px;
}

/* Analysis Configuration role involvement matrix */
.wide-table-scroll {
    overflow-x: auto;
    padding-bottom: 8px;
}
.matrix-table th,
.matrix-table td {
    white-space: nowrap;
}
.role-matrix-table th:first-child,
.role-matrix-table td:first-child {
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 2;
    min-width: 180px;
}
.role-matrix-table th:first-child {
    z-index: 3;
}
.center-cell {
    text-align: center;
    vertical-align: middle;
}
.checkbox-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    cursor: pointer;
}
.checkbox-cell input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}
.small {
    font-size: 12px;
}
.warning-box {
    border: 1px solid #f59e0b;
    background: #fffbeb;
    color: #92400e;
    padding: 14px 16px;
    border-radius: 10px;
}


/* Professional navigation refinement */
.topbar { gap: 24px; }
.main-nav { display:flex; align-items:center; gap: 8px; }
.main-nav > a,
.nav-trigger {
    min-height: 38px;
    display:inline-flex;
    align-items:center;
    gap: 6px;
    padding: 0 12px;
    border-radius: 10px;
    color: var(--ink);
    font-weight: 700;
    border: 1px solid transparent;
    background: transparent;
    font: inherit;
    cursor: pointer;
}
.topbar .main-nav a { margin-left: 0; }
.main-nav > a:hover,
.nav-dropdown:hover .nav-trigger,
.nav-trigger:focus {
    background: #f8fafc;
    border-color: var(--line);
    text-decoration: none;
}
.nav-dropdown { position: relative; }
.nav-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 220px;
    padding: 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(16, 24, 40, 0.12);
    z-index: 50;
}
.nav-dropdown:hover .nav-menu,
.nav-dropdown:focus-within .nav-menu { display: block; }
.nav-menu a {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    color: var(--ink);
    font-weight: 700;
}
.nav-menu a:hover { background: #f8fafc; text-decoration: none; }

/* Project workspace header and tabs */
.project-hero {
    display:flex;
    justify-content:space-between;
    gap: 20px;
    align-items:flex-end;
    margin-bottom: 14px;
}
.project-hero h1 { margin-bottom: 8px; }
.eyebrow {
    display:inline-flex;
    margin-bottom: 8px;
    color: var(--primary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 800;
}
.project-workspace-nav,
.settings-nav {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 12px;
    margin: 0 0 22px;
    box-shadow: 0 10px 24px rgba(16,24,40,0.04);
}
.project-nav-title {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin: 2px 8px 10px;
}
.project-nav-grid {
    display:grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 8px;
}
.project-nav-item {
    display:flex;
    flex-direction:column;
    justify-content:center;
    min-height: 68px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
}
.project-nav-item span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    margin-bottom: 4px;
}
.project-nav-item strong {
    font-size: 13px;
    line-height: 1.2;
}
.project-nav-item:hover {
    border-color: #bfdbfe;
    background: #f8fbff;
    text-decoration:none;
}
.project-nav-item.active {
    border-color: var(--primary);
    background: #eff6ff;
    color: var(--primary-dark);
}
.project-nav-item.active span { color: var(--primary); }

.settings-hero { margin-bottom: 14px; }
.settings-nav { display:flex; flex-wrap:wrap; gap:8px; }
.settings-nav-item {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height: 40px;
    padding: 0 14px;
    border:1px solid var(--line);
    border-radius: 10px;
    background:#fff;
    color: var(--ink);
    font-weight: 800;
}
.settings-nav-item:hover { background:#f8fafc; text-decoration:none; }
.settings-nav-item.active { background:#eff6ff; border-color:var(--primary); color:var(--primary-dark); }

@media (max-width: 1100px) {
    .project-nav-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
    .topbar { height:auto; min-height:64px; align-items:flex-start; flex-direction:column; padding: 14px 18px; }
    .main-nav { flex-wrap:wrap; }
    .project-nav-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Collaborative EFM MVP */
.checkbox-grid {
    display:grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 8px;
}
.checkbox-card {
    display:flex !important;
    flex-direction:row !important;
    align-items:center;
    gap: 10px !important;
    padding: 12px;
    border:1px solid var(--line);
    border-radius: 12px;
    background:#fff;
    cursor:pointer;
}
.checkbox-card input { width:auto; }
.checkbox-card span { display:flex; flex-direction:column; gap:2px; }
.checkbox-card small { color: var(--muted); font-weight:500; }
.efm-switcher {
    background:#fff;
    border:1px solid var(--line);
    border-radius:16px;
    padding: 14px;
    margin: 0 0 22px;
    box-shadow: 0 10px 24px rgba(16,24,40,0.04);
}
.efm-switcher-title {
    display:flex;
    justify-content:space-between;
    gap: 12px;
    align-items:center;
    margin-bottom: 10px;
}
.efm-switcher-title strong { color: var(--ink); }
.efm-switcher-title span { color: var(--muted); font-size: 13px; }
.efm-tabs { display:flex; flex-wrap:wrap; gap: 8px; }
.efm-tab {
    display:inline-flex;
    flex-direction:column;
    gap: 2px;
    min-width: 140px;
    padding: 10px 12px;
    border:1px solid var(--line);
    border-radius: 12px;
    background:#fff;
    color: var(--ink);
    font-weight:800;
}
.efm-tab small { color: var(--muted); font-weight:600; }
.efm-tab.active { background:#eff6ff; border-color: var(--primary); color: var(--primary-dark); }
.efm-tab:hover { background:#f8fbff; text-decoration:none; }
@media (max-width: 900px) { .checkbox-grid { grid-template-columns:1fr; } }

/* Phase Responsibility Matrix */
.responsibility-table th small {
    color: rgba(15, 23, 42, 0.58);
    font-weight: 500;
}
.center-cell {
    text-align: center;
}
.checkbox-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 999px;
    background: #fff;
    font-size: 12px;
    font-weight: 700;
    color: #334155;
    cursor: pointer;
    white-space: nowrap;
}
.checkbox-pill input {
    width: auto;
    margin: 0;
}

.editable-team-table .table-input {
    width: 100%;
    min-width: 110px;
    border: 1px solid #d0d7e2;
    border-radius: 10px;
    padding: 9px 10px;
    font: inherit;
    background: #fff;
}
.editable-team-table .table-input.number { min-width: 72px; }
.editable-team-table .row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.button.small { padding: 8px 12px; border-radius: 10px; font-size: 13px; }
.button.danger { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.button.danger:hover { background: #fecaca; }


/* Team table polished action states */
.editable-team-table {
    border-collapse: separate;
    border-spacing: 0;
}
.editable-team-table th {
    background: #f8fafc;
    color: #334155;
    font-size: 12px;
    letter-spacing: .045em;
}
.editable-team-table td {
    vertical-align: middle;
    height: 64px;
}
.editable-team-table .team-read-row td {
    background: #fff;
}
.editable-team-table .team-edit-row td {
    background: #f8fbff;
    border-top: 1px solid #bfdbfe;
    border-bottom: 1px solid #bfdbfe;
}
.editable-team-table .team-edit-row td:first-child {
    border-left: 1px solid #bfdbfe;
    border-radius: 12px 0 0 12px;
}
.editable-team-table .team-edit-row td:last-child {
    border-right: 1px solid #bfdbfe;
    border-radius: 0 12px 12px 0;
}
.editable-team-table .row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}
.button.small.edit-action,
.button.small.cancel-action,
.button.small.remove-action,
.button.small.save-action {
    min-height: 34px;
    min-width: 76px;
    padding: 0 13px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1;
    box-shadow: none;
    text-decoration: none;
}
.button.small.edit-action {
    background: #ffffff;
    color: var(--primary-dark);
    border-color: #bfdbfe;
}
.button.small.edit-action:hover {
    background: #eff6ff;
    border-color: var(--primary);
    color: var(--primary-dark);
    text-decoration: none;
}
.button.small.save-action {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.button.small.save-action:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}
.button.small.cancel-action {
    background: #fff;
    color: #475467;
    border: 1px solid var(--line);
}
.button.small.cancel-action:hover {
    background: #f8fafc;
    color: var(--ink);
    text-decoration: none;
}
.button.small.remove-action {
    background: #fff;
    color: #b42318;
    border: 1px solid #fecdca;
}
.button.small.remove-action:hover {
    background: #fff1f3;
    color: #912018;
    border-color: #fda29b;
}
.editable-team-table .table-input {
    min-height: 40px;
    border-radius: 10px;
    border-color: #cbd5e1;
    background: #fff;
}
.editable-team-table .table-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(20, 110, 180, 0.12);
}


/* Overall EFM consolidation */
.consolidation-panel {
    border-color: #b7d7f5;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}
.consolidation-cards {
    display:grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 14px 0;
}
.consolidation-cards .classification-card {
    border-color: #dbeafe;
    background: #fff;
}
.consolidation-cards h3 {
    color: var(--primary-dark);
    font-size: 22px;
    margin: 0 0 6px;
}
.consolidation-note {
    margin: 10px 0 16px;
}
@media (max-width: 900px) {
    .consolidation-cards { grid-template-columns: 1fr; }
}

/* Effort.P bulk save refinement */
.matrix-title { align-items: flex-start; gap: 16px; }
.matrix-title .section-label { margin-bottom: 4px; }
.matrix-save-actions { margin-top: 16px; justify-content: flex-end; }
.matrix-table .md-input { background: #fff; }
.matrix-table .md-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(20, 110, 180, 0.12); outline: none; }


.success {
    padding: 14px 16px;
    background: #ecfdf3;
    border: 1px solid #abefc6;
    border-radius: 14px;
    margin-bottom: 18px;
    color: #067647;
}
.unsaved-indicator {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 999px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    font-size: 13px;
    font-weight: 800;
    margin-right: 10px;
}
.effort-matrix-table .sticky-col {
    position: sticky;
    background: #fff;
    z-index: 4;
}
.effort-matrix-table th:nth-child(1) {
    position: sticky;
    left: 0;
    z-index: 6;
}
.effort-matrix-table th:nth-child(2) {
    position: sticky;
    left: 58px;
    z-index: 6;
}
.effort-matrix-table .sticky-no {
    left: 0;
    min-width: 58px;
}
.effort-matrix-table .sticky-resource {
    left: 58px;
    min-width: 180px;
    font-weight: 800;
}
.effort-matrix-table tr:hover .sticky-col {
    background: #fbfdff;
}


.effort-matrix-table thead .phase-row th {
    background: #fff6a8;
    color: #334155;
    text-align: center;
    white-space: nowrap;
}
.effort-matrix-table thead .date-row th {
    background: #fffbd1;
    color: #475569;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
}
.effort-matrix-table thead .week-row th {
    background: #d8fbff;
    color: #0f172a;
    text-align: center;
}
.effort-matrix-table tfoot td {
    position: sticky;
    bottom: 0;
    background: #e7faff;
    border-top: 2px solid #67e8f9;
    font-weight: 900;
    z-index: 3;
}
.effort-matrix-table .md-input {
    min-width: 56px;
    text-align: center;
}

/* Estimator defaults preview */
.estimator-preview {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.estimator-preview-row {
    display: grid;
    grid-template-columns: minmax(220px, 1.3fr) minmax(180px, 1fr) minmax(180px, 1fr);
    gap: 12px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f8fafc;
}
.estimator-preview-row strong,
.estimator-preview-row b { color: var(--ink); }
.estimator-preview-row small,
.estimator-preview-row span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}
@media (max-width: 760px) {
    .estimator-preview-row { grid-template-columns: 1fr; }
}

/* Read-only estimator defaults use the same field footprint as normal PIC inputs. */
input[readonly] {
    background: #f8fafc;
    color: #344054;
    cursor: not-allowed;
}
.estimator-preview {
    margin-top: 8px;
}
.estimator-default-grid {
    margin-top: 14px;
}
.form-grid.estimator-preview,
.form-grid.estimator-default-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
@media (max-width: 900px) {
    .form-grid.estimator-preview,
    .form-grid.estimator-default-grid {
        grid-template-columns: 1fr;
    }
}

.module-nav-grid .project-nav-item { min-height: 64px; }
@media (max-width: 1300px) { .project-nav-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .project-nav-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 720px) { .project-nav-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Workbook-style module sections */
.workbook-parent-section {
    border-left: 4px solid var(--primary);
}
.workbook-parent-section h2 {
    margin-bottom: 4px;
}
.workbook-subsection {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fbfdff;
    overflow-x: auto;
}
.workbook-subsection h3 {
    margin: 0 0 12px;
    font-size: 16px;
    color: #172033;
}
.workbook-subsection table {
    background: #fff;
}

/* Phase 3D row correction controls */
.row-actions {
    min-width: 160px;
    vertical-align: top;
}
.row-actions details {
    margin-bottom: 8px;
}
.row-actions summary {
    cursor: pointer;
    font-weight: 800;
    color: var(--primary);
}
.inline-edit-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(160px, 1fr));
    gap: 10px;
    padding: 12px;
    margin-top: 8px;
    min-width: 520px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8fafc;
}
.inline-edit-grid label {
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
}
.inline-edit-grid input,
.inline-edit-grid select {
    width: 100%;
    margin-top: 4px;
}
.button.danger,
.badge.danger {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}
.reconciliation-section {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
}
.reconciliation-warning {
    background: #fff7ed;
}
.reconciliation-ok {
    background: #f0fdf4;
}

.money-auto, [data-money], .rate-auto, [data-rate] { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Phase Config bulk editing and drag ordering */
.phase-order-table { min-width: 1080px; }
.phase-order-table th:first-child,
.phase-order-table td:first-child { width: 150px; }
.phase-order-table tr.dragging td { background: #eef6ff; opacity: .75; }
.drag-cell { display:flex; align-items:center; gap:6px; }
.drag-handle { cursor: grab; user-select:none; font-size: 18px; color:#475467; padding: 4px 6px; border:1px solid var(--line); border-radius:8px; background:#fff; }
.phase-order-display { display:inline-flex; align-items:center; justify-content:center; min-width:32px; min-height:32px; border-radius:999px; background:#eef6ff; color:#175cd3; }
.phase-order-table input,
.phase-order-table select { min-width: 120px; }

.ratio-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin: 12px 0;
    padding: 10px 12px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
}
.ratio-summary span {
    font-size: 0.9rem;
}
.ratio-warning {
    color: #b91c1c;
    font-weight: 700;
}
button[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Phase 3R planning baseline readiness */
.readiness-panel { border-left: 6px solid #d0d5dd; }
.readiness-panel.readiness-ok { border-left-color: #16a34a; }
.readiness-panel.readiness-warning { border-left-color: #f59e0b; }
.readiness-panel.readiness-blocked { border-left-color: #dc2626; }
.readiness-counters { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.readiness-badge-ok { background:#dcfce7; color:#166534; }
.readiness-badge-warning, .readiness-warning { background:#fef3c7; color:#92400e; }
.readiness-badge-blocked { background:#fee2e2; color:#991b1b; }
.readiness-badge-neutral { background:#f2f4f7; color:#344054; }
.readiness-table td { vertical-align: top; }
.readiness-message { white-space: pre-wrap; }
.readiness-row-ok td { background:#fcfffd; }
.readiness-row-warning td { background:#fffdf5; }
.readiness-row-blocked td { background:#fffafa; }

/* Phase 4 Baseline Review / Approval / Lock */
.baseline-approval-panel { border-left: 5px solid #64748b; }
.baseline-approval-ready { border-left-color: #16a34a; }
.baseline-approval-submitted { border-left-color: #2563eb; }
.baseline-approval-rejected { border-left-color: #dc2626; }
.baseline-approval-locked { border-left-color: #0f766e; }
.approval-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.approval-grid > div {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}
.approval-grid span { display:block; color:#64748b; font-size:12px; margin-bottom:4px; }
.approval-grid strong { display:block; color:#0f172a; }
.approval-action-form {
  display: grid;
  gap: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  margin-top: 12px;
}
.approval-action-form label { display:grid; gap:4px; font-weight:600; color:#334155; }
.approval-action-form input,
.approval-action-form textarea {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}
.approval-review-actions { display:grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap:12px; }
.danger-form { border-color:#fecaca; }
.compact-note { margin-top: 12px; padding: 10px 12px; border-radius: 10px; }


/* Phase 4B/4C/5 Sales-to-PM Delivery Baseline flow */
.pm-handover-panel { border-left: 4px solid #64748b; }
.pm-handover-panel.baseline-approval-locked { border-left-color: #059669; }
.pm-handover-panel.baseline-approval-ready { border-left-color: #2563eb; }
.pm-handover-panel.baseline-approval-submitted { border-left-color: #7c3aed; }
