/* إعادة التأهيل والتشغيل — قسم مستقل */

.rehab-workspace {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
}

.rehab-hero {
    background: linear-gradient(135deg, #0f766e 0%, #0d9488 50%, #14b8a6 100%);
    border: none;
    color: #fff;
    padding: 0;
    overflow: hidden;
    border-radius: 16px;
}

.rehab-hero-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 18px 20px 12px;
}

.rehab-hero-text h2 {
    margin: 0 0 4px;
    font-size: 1.25rem;
    font-weight: 700;
}

.rehab-hero-text p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.82rem;
    max-width: 560px;
    line-height: 1.5;
}

.rehab-hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
    padding: 0 16px 16px;
}

.rehab-stat {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 10px 12px;
    text-align: center;
}

.rehab-stat .val {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
}

.rehab-stat .lbl {
    display: block;
    font-size: 0.72rem;
    opacity: 0.88;
    margin-top: 2px;
}

.rehab-subtabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.rehab-subtab {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--text-muted);
    padding: 8px 14px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.rehab-subtab:hover,
.rehab-subtab.active {
    background: rgba(13, 148, 136, 0.22);
    border-color: rgba(45, 212, 191, 0.45);
    color: #99f6e4;
}

.rehab-module-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rehab-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
}

.rehab-card h3 {
    margin: 0 0 12px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rehab-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.rehab-form-grid label span {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.rehab-table-wrap {
    overflow-x: auto;
}

.rehab-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.rehab-table th,
.rehab-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
    text-align: right;
}

.rehab-table th {
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

.rehab-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}

.rehab-badge.in_progress,
.rehab-badge.warn {
    background: rgba(234, 179, 8, 0.18);
    color: #facc15;
}

.rehab-badge.completed,
.rehab-badge.good {
    background: rgba(34, 197, 94, 0.18);
    color: #4ade80;
}

.rehab-badge.planned {
    background: rgba(59, 130, 246, 0.18);
    color: #60a5fa;
}

.rehab-badge.bad,
.rehab-badge.cancelled {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
}

.rehab-alert {
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 0.8rem;
}

.rehab-alert.warn {
    background: rgba(234, 179, 8, 0.12);
    border: 1px solid rgba(234, 179, 8, 0.3);
    color: #fbbf24;
}

.rehab-alert.bad {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.rehab-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
    font-size: 0.85rem;
}

body.light-mode .rehab-subtab.active {
    color: #0f766e;
    background: rgba(13, 148, 136, 0.12);
}

.rehab-phases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.rehab-phase-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    border-right: 4px solid #0d9488;
}

.rehab-phase-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 0.88rem;
}

.rehab-phase-num {
    background: #0d9488;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.rehab-phase-weight {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-right: auto;
}

.rehab-phase-contrib {
    font-size: 0.78rem;
    margin-top: 8px;
    color: var(--text-muted);
}

.rehab-phase-detail {
    margin-bottom: 12px;
}

.rehab-sub-block {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-color);
}

.rehab-sub-block h4 {
    margin: 0 0 8px;
    font-size: 0.85rem;
}

.rehab-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0 0 12px;
}

.rehab-hint--info {
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(13, 148, 136, 0.12);
    border: 1px solid rgba(45, 212, 191, 0.25);
    line-height: 1.5;
    color: inherit;
}

/* الميزانية والكلف */
.rehab-cost-exec-strip {
    margin-top: 8px;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(13, 148, 136, 0.08);
    border: 1px solid rgba(45, 212, 191, 0.2);
}

.rehab-cost-exec-strip h3 {
    margin: 0 0 10px;
    font-size: 0.9rem;
}

.rehab-cost-exec-strip h3 small {
    font-weight: 400;
    opacity: 0.75;
    font-size: 0.78rem;
}

.rehab-cost-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.rehab-cost-kpi {
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(148, 163, 184, 0.08);
    text-align: center;
}

.rehab-cost-kpi .lbl {
    display: block;
    font-size: 0.72rem;
    opacity: 0.8;
    margin-bottom: 4px;
}

.rehab-cost-kpi strong {
    font-size: 0.95rem;
}

.rehab-cost-section-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.rehab-cost-section-head h3 {
    margin: 0;
}

.rehab-cost-section-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.rehab-cost-planned-input {
    max-width: 140px;
    min-width: 100px;
}

.rehab-cost-form-wide {
    grid-column: 1 / -1;
}

.rehab-cost-form-actions {
    grid-column: 1 / -1;
}

.rehab-budget-split-warn p {
    margin: 0 0 8px;
}

.rehab-budget-split-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.rpm-warn-text {
    color: #f59e0b;
}

body.light-mode .rpm-warn-text {
    color: #b45309;
}

.rehab-cost-child-row td {
    background: rgba(255, 255, 255, 0.02);
}

.rehab-cost-child-row .rehab-cost-child-indent {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding-right: 8px;
    color: var(--text-muted, #94a3b8);
    font-size: 0.92em;
}

.rehab-cost-child-row .rehab-cost-child-indent i {
    font-size: 0.75em;
    opacity: 0.7;
}

.rehab-cost-child-code {
    color: var(--text-muted, #94a3b8);
    font-size: 0.9em;
}

.rehab-cost-parent-row td {
    font-weight: 600;
}

.rehab-cost-subtotal {
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
    font-weight: 400;
}

body.light-mode .rehab-cost-child-row td {
    background: #f8fafc;
}

.rehab-cost-table td.num {
    text-align: left;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.rehab-cost-phase-name {
    font-weight: 600;
}

.rehab-cost-phase-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    font-weight: 700;
}

.rehab-cost-row--selectable {
    cursor: pointer;
    transition: background 0.15s ease;
}

.rehab-cost-row--selectable:hover td {
    background: rgba(37, 99, 235, 0.06);
}

.rehab-cost-row--active td {
    background: rgba(37, 99, 235, 0.12) !important;
    box-shadow: inset 3px 0 0 #2563eb;
}

.rehab-cost-row--applied td {
    animation: rehab-cost-flash 1.2s ease;
}

@keyframes rehab-cost-flash {
    0%, 100% { background: transparent; }
    30% { background: rgba(16, 185, 129, 0.18); }
}

.rehab-cost-planned-cell .rehab-cost-planned-input {
    width: 100%;
    max-width: 160px;
}

.rehab-cost-actions {
    white-space: nowrap;
    text-align: center;
}

.rehab-cost-custom-tag {
    display: inline-block;
    font-size: 0.68rem;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
    font-weight: 600;
    margin-right: 4px;
}

.rehab-cost-planned-cell {
    min-width: 200px;
    vertical-align: top;
}

.rehab-cost-planned-cell .rehab-cost-planned-input {
    width: 100%;
    max-width: 180px;
    margin-bottom: 6px;
}

.rehab-cost-breakdown-list {
    list-style: none;
    margin: 8px 0 6px;
    padding: 0;
}

.rehab-cost-breakdown-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 8px;
    padding: 4px 8px;
    margin-bottom: 4px;
    border-radius: 6px;
    background: rgba(13, 148, 136, 0.08);
    border-right: 3px solid #0d9488;
    font-size: 0.82rem;
}

.rehab-cost-breakdown-item--sub {
    margin-right: 10px;
    border-right-color: #0891b2;
    background: rgba(8, 145, 178, 0.07);
}

.rehab-cost-breakdown-item--activity {
    margin-right: 22px;
    border-right-width: 2px;
    border-right-color: #94a3b8;
    background: rgba(148, 163, 184, 0.1);
    font-size: 0.78rem;
}

.rehab-cost-breakdown-item--phase {
    border-right-color: #0f766e;
    background: rgba(15, 118, 110, 0.1);
    font-weight: 600;
}

.rehab-cost-breakdown-code {
    font-family: ui-monospace, monospace;
    font-size: 0.75rem;
    color: #0d9488;
    flex-shrink: 0;
}

.rehab-cost-breakdown-tag {
    font-size: 0.68rem;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-muted, #64748b);
    margin-right: auto;
}

.rehab-cost-breakdown-empty {
    margin: 6px 0 0;
    font-size: 0.78rem;
    color: var(--text-muted, #94a3b8);
    font-style: italic;
}

.rehab-cost-breakdown-name {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted, #475569);
}

.rehab-cost-breakdown-name i {
    font-size: 0.7rem;
    opacity: 0.6;
}

.rehab-cost-breakdown-del {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 4px;
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.rehab-cost-breakdown-del:hover {
    background: #ef4444;
    color: #fff;
}

.rehab-cost-item-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(148, 163, 184, 0.3);
}

.rehab-cost-item-picker .rehab-cost-item-select {
    flex: 1 1 160px;
    min-width: 140px;
    font-size: 0.82rem;
}

.rehab-cost-item-picker .rehab-cost-custom-inline {
    flex: 1 1 140px;
    min-width: 120px;
    font-size: 0.82rem;
}

.rehab-cost-item-picker .rehab-cost-item-add-btn {
    flex-shrink: 0;
}

body.light-mode .rehab-cost-breakdown-item {
    background: #f0fdfa;
}

.rehab-doc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rehab-doc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    background: rgba(148, 163, 184, 0.04);
}

.rehab-doc-meta {
    flex: 1;
    min-width: 0;
}

.rehab-doc-meta strong {
    display: block;
    font-size: 0.92rem;
}

.rehab-doc-meta small {
    color: var(--text-muted, #64748b);
    font-size: 0.78rem;
}

.rehab-doc-browser label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 480px;
}

.rehab-quote-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.rehab-quote-actions .filter-select {
    min-width: 120px;
    font-size: 0.8rem;
}

.rehab-card--inner {
    background: rgba(148, 163, 184, 0.06);
    border-style: dashed;
}

.rehab-manage-block {
    margin-bottom: 12px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.rehab-manage-block-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.rehab-manage-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.82rem;
}

.rehab-manage-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-color);
}

.rehab-manage-list li code {
    color: #0d9488;
    font-size: 0.72rem;
}

.rehab-ok { color: #22c55e; }
.rehab-warn { color: #f59e0b; }

.btn-danger {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #f87171 !important;
    border: 1px solid rgba(239, 68, 68, 0.4) !important;
}


.rehab-stat--primary .val {
    font-size: 1.35rem;
}

.rehab-exec-ring {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    padding: 18px;
}

.rehab-ring-wrap {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.rehab-ring-svg {
    width: 120px;
    height: 120px;
    transform: rotate(-90deg);
}

.rehab-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 10;
}

.rehab-ring-fg {
    fill: none;
    stroke: #5eead4;
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s ease;
}

.rehab-exec-ring .rehab-ring-bg,
.rehab-exec-ring .rehab-ring-fg {
    stroke: rgba(13, 148, 136, 0.2);
}

.rehab-exec-ring .rehab-ring-fg {
    stroke: #0d9488;
}

.rehab-ring-label {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #0f766e;
}

.rehab-ring-label span {
    font-size: 1.35rem;
}

.rehab-ring-label small {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.rehab-exec-kpis {
    list-style: none;
    padding: 0;
    margin: 10px 0 0;
    font-size: 0.82rem;
}

.rehab-exec-kpis li {
    margin: 4px 0;
}

.rehab-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

.rehab-progress-bar {
    position: relative;
    height: 22px;
    background: rgba(148, 163, 184, 0.15);
    border-radius: 6px;
    overflow: hidden;
    min-width: 90px;
}

.rehab-progress-bar span {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    z-index: 1;
}

.rehab-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0d9488, #14b8a6);
    border-radius: 6px;
    transition: width 0.4s ease;
}

.rehab-table--pm th {
    font-size: 0.72rem;
    white-space: nowrap;
}

.rehab-table--compact td {
    font-size: 0.75rem;
}

.rehab-table td.num {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.rehab-tag {
    font-size: 0.68rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(148, 163, 184, 0.15);
}

.rehab-phase-chart {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rehab-phase-bar-row {
    display: grid;
    grid-template-columns: 1fr 2fr auto;
    gap: 8px;
    align-items: center;
    font-size: 0.75rem;
}

.rehab-phase-bar-row .bar-track {
    position: relative;
    height: 14px;
    background: rgba(148, 163, 184, 0.12);
    border-radius: 4px;
    overflow: hidden;
}

.rehab-phase-bar-row .bar-weight {
    position: absolute;
    height: 100%;
    background: rgba(13, 148, 136, 0.2);
}

.rehab-phase-bar-row .bar-done {
    position: absolute;
    height: 100%;
    background: #0d9488;
}

.rehab-gantt-card--full {
    width: 100%;
    max-width: none;
    padding: 16px 12px;
}

.rehab-gantt-card {
    overflow-x: auto;
}

.rehab-gantt-block {
    margin-bottom: 24px;
    padding: 14px 10px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.04);
    width: 100%;
    box-sizing: border-box;
}

.rehab-gantt-table {
    width: 100%;
    min-width: 0;
    direction: rtl;
}

.rehab-gantt-block-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.rehab-gantt-block-head h4 {
    margin: 0;
    font-size: 0.95rem;
    color: #0d9488;
}

.rehab-gantt-range {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.rehab-gantt-header,
.rehab-gantt-row {
    display: grid;
    grid-template-columns: minmax(200px, 24%) minmax(0, 1fr) 52px;
    gap: 12px;
    align-items: center;
    width: 100%;
}

.rehab-gantt-header {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.rehab-gantt-col-label {
    text-align: right;
    padding-right: 4px;
}

.rehab-gantt-col-pct {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.rehab-gantt-col-chart {
    min-width: 0;
    width: 100%;
    direction: rtl;
}

.rehab-gantt-months {
    position: relative;
    height: 30px;
    border-bottom: 2px solid rgba(13, 148, 136, 0.3);
    margin-bottom: 2px;
    direction: rtl;
}

.rehab-gantt-month-mark {
    position: absolute;
    bottom: 4px;
    transform: translateX(50%);
    font-size: 0.68rem;
    color: #0d9488;
    font-weight: 600;
    white-space: nowrap;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.rehab-gantt-track {
    position: relative;
    height: 30px;
    background: rgba(148, 163, 184, 0.12);
    border-radius: 6px;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    direction: rtl;
}

.rehab-gantt-rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.rehab-gantt-row {
    font-size: 0.78rem;
    min-height: 40px;
}

.rehab-gantt-label {
    text-align: right;
    line-height: 1.35;
    padding-right: 8px;
}

.rehab-gantt-label strong {
    display: block;
    font-size: 0.82rem;
}

.rehab-gantt-label small {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.rehab-gantt-chart-hint {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-align: center;
    margin: 2px 0 4px;
    opacity: 0.85;
}

.rehab-gantt-gridline {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(148, 163, 184, 0.25);
    pointer-events: none;
}

.rehab-gantt-bar {
    position: absolute;
    top: 4px;
    height: 22px;
    border-radius: 4px;
    min-width: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.rehab-gantt-bar--rehab {
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.55), rgba(37, 99, 235, 0.45));
}

.rehab-gantt-bar--ops {
    background: linear-gradient(180deg, rgba(168, 85, 247, 0.55), rgba(126, 34, 206, 0.45));
}

/* الإنجاز يبدأ من يمين الشريط (بداية المهمة) ويمتد لليسار */
.rehab-gantt-done {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(180deg, #14b8a6, #0d9488);
    border-radius: 0 4px 4px 0;
    pointer-events: none;
}

.rehab-gantt-pct {
    text-align: center;
    font-weight: 700;
    font-size: 0.82rem;
    color: #0d9488;
}

/* تنبيهات الجدول الزمني */
.rehab-alerts {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.rehab-alerts--compact {
    margin-bottom: 12px;
    padding: 10px 12px;
}

.rehab-alerts-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 700;
    color: #f59e0b;
    margin-bottom: 8px;
}

body.light-mode .rehab-alerts-head {
    color: #b45309;
}

.rehab-alerts-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rehab-alert-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.2);
    font-size: 0.82rem;
}

body.light-mode .rehab-alert-item {
    background: rgba(255, 255, 255, 0.7);
}

.rehab-alert-item--danger { border-right: 3px solid #ef4444; }
.rehab-alert-item--warn { border-right: 3px solid #f59e0b; }
.rehab-alert-item--info { border-right: 3px solid #3b82f6; }

.rehab-alert-item-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: right;
}

.rehab-alert-item-text span {
    opacity: 0.85;
    font-size: 0.78rem;
}

.rehab-alert-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.rehab-alert-badge--danger { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.rehab-alert-badge--warn { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.rehab-alert-badge--info { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }

body.light-mode .rehab-alert-badge--danger { color: #dc2626; background: #fee2e2; }
body.light-mode .rehab-alert-badge--warn { color: #b45309; background: #fef3c7; }
body.light-mode .rehab-alert-badge--info { color: #2563eb; background: #dbeafe; }

.rehab-gantt-alert {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
}

.rehab-gantt-alert--danger { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.rehab-gantt-alert--warn { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.rehab-gantt-alert--info { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }

body.light-mode .rehab-gantt-alert--danger { color: #dc2626; background: #fee2e2; }
body.light-mode .rehab-gantt-alert--warn { color: #b45309; background: #fef3c7; }
body.light-mode .rehab-gantt-alert--info { color: #2563eb; background: #dbeafe; }

.rehab-gantt-row--danger { background: rgba(239, 68, 68, 0.06); border-radius: 6px; }
.rehab-gantt-row--warn { background: rgba(245, 158, 11, 0.06); border-radius: 6px; }
.rehab-gantt-row--info { background: rgba(59, 130, 246, 0.05); border-radius: 6px; }

.rehab-gantt-bar--overdue {
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.45);
}

@media (max-width: 900px) {
    .rehab-gantt-header,
    .rehab-gantt-row {
        grid-template-columns: minmax(140px, 30%) minmax(0, 1fr) 44px;
        gap: 8px;
    }

    .rehab-gantt-month-mark {
        font-size: 0.58rem;
        max-width: 56px;
    }
}

.rehab-cp-chain {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rehab-cp-step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    border-right: 3px solid #0d9488;
}

.rehab-cp-step .num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #0d9488;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.rehab-cp-step small {
    display: block;
    color: var(--text-muted);
    margin-top: 2px;
}

.rehab-report-actions,
.rehab-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.rehab-report-actions {
    margin-top: 12px;
    margin-bottom: 0;
}

.rehab-mermaid-out {
    margin-top: 12px;
    padding: 12px;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 8px;
    font-size: 0.72rem;
    max-height: 280px;
    overflow: auto;
    white-space: pre-wrap;
    direction: ltr;
    text-align: left;
}

.rehab-deliverable-list {
    columns: 2;
    font-size: 0.8rem;
    padding-right: 18px;
}

.rehab-deliverable-list li {
    margin-bottom: 4px;
}

/* عرض مجلس الإدارة — شاشة */
.rehab-board-screen {
    width: 100%;
    background: var(--card-bg, rgba(255, 255, 255, 0.04));
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 14px;
    padding: 16px 20px 22px;
    box-sizing: border-box;
}

.rehab-board-screen-title {
    margin: 0 0 14px;
    text-align: center;
    font-size: 1.05rem;
    font-weight: 800;
    color: #0f766e;
    letter-spacing: 0.01em;
}

body.light-mode .rehab-board-screen-title {
    color: #0d9488;
}

.rehab-board-screen .rpm-board {
    width: 100%;
    max-width: none;
}

.rpm-board-hero {
    display: grid;
    grid-template-columns: auto 1fr minmax(200px, 260px);
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
    padding: 18px 20px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.18) 0%, rgba(13, 148, 136, 0.08) 100%);
    border: 1px solid rgba(45, 212, 191, 0.2);
}

.rpm-board-ring-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.rpm-board-ring {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 7px solid #0d9488;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    font-weight: 800;
    color: #14b8a6;
    background: rgba(15, 23, 42, 0.35);
    box-shadow: 0 4px 16px rgba(13, 148, 136, 0.25);
}

body.light-mode .rpm-board-ring {
    background: #fff;
    color: #0f766e;
}

.rpm-board-ring-lbl {
    font-size: 0.72rem;
    opacity: 0.8;
}

.rpm-board-head-text h1 {
    margin: 0 0 8px;
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.35;
    color: #f0fdfa;
}

body.light-mode .rpm-board-head-text h1 {
    color: #134e4a;
}

.rpm-board-kicker {
    margin: 0 0 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #5eead4;
    opacity: 0.9;
}

body.light-mode .rpm-board-kicker {
    color: #0f766e;
}

.rpm-board-goal {
    margin: 0 !important;
    font-size: 0.9rem !important;
    opacity: 0.92;
}

.rpm-board-schedule-card {
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(148, 163, 184, 0.2);
    text-align: center;
}

body.light-mode .rpm-board-schedule-card {
    background: #fff;
}

.rpm-board-schedule-card p {
    margin: 8px 0 0;
    font-size: 0.78rem;
    line-height: 1.45;
    opacity: 0.85;
}

.rpm-board-timeline {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}

.rpm-board-tl-card {
    padding: 14px 16px;
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.rpm-board-tl-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.9rem;
    font-weight: 600;
}

.rpm-board-tl-bar {
    height: 12px;
    background: rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    overflow: hidden;
}

.rpm-board-tl-bar div {
    height: 100%;
    min-width: 2px;
    background: linear-gradient(90deg, #0d9488, #2dd4bf);
    border-radius: 8px;
    transition: width 0.3s ease;
}

.rpm-board-tl-bar--ops div {
    background: linear-gradient(90deg, #2563eb, #60a5fa);
}

.rpm-board-section {
    margin-bottom: 20px;
}

.rpm-board-section h2,
.rpm-board-panel h2 {
    margin: 0 0 10px;
    font-size: 1rem;
    font-weight: 700;
    color: #2dd4bf;
}

body.light-mode .rpm-board-section h2,
body.light-mode .rpm-board-panel h2 {
    color: #0f766e;
}

.rpm-board-table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.rpm-board-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.rpm-board-table th,
.rpm-board-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    text-align: center;
    vertical-align: middle;
}

.rpm-board-table thead th {
    background: #0f766e;
    color: #fff;
    font-weight: 700;
    font-size: 0.82rem;
    border: none;
}

.rpm-board-table tbody tr:hover {
    background: rgba(13, 148, 136, 0.06);
}

.rpm-board-table tbody tr:last-child td {
    border-bottom: none;
}

.rpm-board-name {
    text-align: right !important;
    font-weight: 600;
    min-width: 180px;
}

.rpm-board-num {
    font-weight: 700;
    color: #14b8a6;
    width: 48px;
}

body.light-mode .rpm-board-num {
    color: #0f766e;
}

.rpm-board-pct-cell {
    min-width: 110px;
}

.rpm-board-mini-bar {
    height: 6px;
    background: rgba(148, 163, 184, 0.25);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}

.rpm-board-mini-bar div {
    height: 100%;
    background: linear-gradient(90deg, #0d9488, #34d399);
    border-radius: 4px;
}

.rpm-board-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.rpm-board-panel {
    padding: 14px 16px;
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.rpm-board-list {
    margin: 0;
    padding-right: 18px;
    font-size: 0.86rem;
    line-height: 1.65;
}

.rpm-board-list li {
    margin-bottom: 6px;
}

.rpm-board-list li span {
    opacity: 0.75;
    font-size: 0.8rem;
}

/* مقدمة وملاحظات تقرير المجلس */
.rehab-board-edit {
    margin-bottom: 12px;
}

.rehab-board-notes-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rehab-board-notes-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.rehab-board-notes-label textarea {
    width: 100%;
    min-height: 88px;
    resize: vertical;
    font-weight: 400;
    line-height: 1.55;
}

.rehab-board-notes-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.rehab-board-edit-meta {
    opacity: 0.75;
    font-size: 0.78rem;
}

.rehab-board-edit--readonly .rehab-board-readonly-block {
    margin-bottom: 10px;
}

.rehab-board-edit--readonly .rehab-board-readonly-block strong {
    display: block;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.rehab-board-edit--readonly .rehab-board-readonly-block p {
    margin: 0;
    white-space: pre-wrap;
    line-height: 1.55;
    opacity: 0.92;
}

.rehab-board-archive-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rehab-board-archive-item {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.12);
}

body.light-mode .rehab-board-archive-item {
    border-color: #e2e8f0;
    background: #f8fafc;
}

.rehab-board-archive-main {
    flex: 1 1 220px;
    min-width: 0;
}

.rehab-board-archive-main strong {
    display: block;
    margin-bottom: 4px;
}

.rehab-board-archive-main small {
    display: block;
    opacity: 0.75;
    font-size: 0.78rem;
}

.rehab-board-archive-preview {
    margin: 6px 0 0;
    font-size: 0.82rem;
    opacity: 0.85;
    line-height: 1.45;
}

.rehab-board-archive-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.rehab-board-archive-item.is-active {
    border-color: rgba(20, 184, 166, 0.55);
    box-shadow: 0 0 0 1px rgba(20, 184, 166, 0.25);
}

body.light-mode .rehab-board-archive-item.is-active {
    border-color: #14b8a6;
    background: #ecfdf5;
}

.rehab-board-archive-view-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(20, 184, 166, 0.12);
    border: 1px solid rgba(20, 184, 166, 0.35);
}

body.light-mode .rehab-board-archive-view-bar {
    background: #ecfdf5;
    border-color: #99f6e4;
}

.rehab-board-archive-view-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.88rem;
}

.rehab-board-archive-view-label i {
    margin-left: 6px;
    color: #2dd4bf;
}

.rehab-board-archive-view-label small {
    opacity: 0.8;
    font-size: 0.78rem;
}

.rehab-board-archive-view-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rpm-board-intro {
    margin-bottom: 18px;
}

.rpm-board-intro-inner {
    border-right: 3px solid #0d9488;
}

body.light-mode .rpm-board-intro-inner {
    border-right-color: #14b8a6;
}

.rpm-board-narrative {
    margin-bottom: 20px;
}

.rpm-board-narrative-inner {
    padding: 14px 16px;
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.15);
}

body.light-mode .rpm-board-narrative-inner {
    background: #f8fafc;
}

.rpm-board-narrative-block {
    margin-bottom: 14px;
}

.rpm-board-narrative-block:last-of-type {
    margin-bottom: 8px;
}

.rpm-board-narrative-block h3 {
    margin: 0 0 8px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f766e;
}

body.light-mode .rpm-board-narrative-block h3 {
    color: #0d9488;
}

.rpm-board-prose {
    font-size: 0.88rem;
    line-height: 1.7;
    text-align: right;
    white-space: pre-wrap;
}

.rpm-board-narrative-meta {
    margin: 10px 0 0;
    padding-top: 10px;
    border-top: 1px dashed rgba(148, 163, 184, 0.25);
    font-size: 0.75rem;
    opacity: 0.75;
    text-align: left;
}

/* ملخص مالي — مجلس الإدارة */
.rpm-board-cost {
    margin-bottom: 20px;
}

.rpm-board-cost--empty {
    padding-bottom: 4px;
}

.rpm-board-cost-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.rpm-board-cost-kpi {
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(13, 148, 136, 0.1);
    border: 1px solid rgba(45, 212, 191, 0.2);
    text-align: center;
}

body.light-mode .rpm-board-cost-kpi {
    background: #f0fdfa;
}

.rpm-board-cost-kpi span {
    display: block;
    font-size: 0.72rem;
    opacity: 0.85;
    margin-bottom: 4px;
}

.rpm-board-cost-kpi strong {
    font-size: 0.92rem;
    font-weight: 800;
}

.rpm-board-money {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-size: 0.82rem;
}

.rpm-board-table--cost thead th {
    font-size: 0.78rem;
}

.rpm-board-cost-parent td {
    font-weight: 700;
}

.rpm-board-cost-child td {
    font-size: 0.82rem;
}

.rpm-board-cost-child .rpm-board-name {
    padding-right: 12px;
    color: var(--text-muted, #94a3b8);
}

.rpm-cost-breakdown-line {
    font-size: 0.75rem;
    color: var(--text-muted, #64748b);
    margin-top: 3px;
    font-weight: 400;
}

@media (max-width: 900px) {
    .rpm-board-cost-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.rpm-board-footer {
    margin: 8px 0 0;
    padding-top: 14px;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
    font-size: 0.78rem;
    opacity: 0.7;
    text-align: center;
}

.rpm-muted {
    opacity: 0.7;
    font-style: italic;
}

.rpm-st {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.rpm-st--done { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.rpm-st--good { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.rpm-st--prog { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.rpm-st--wait { background: rgba(148, 163, 184, 0.2); color: #94a3b8; }
.rpm-st--warn { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.rpm-st--bad { background: rgba(239, 68, 68, 0.2); color: #f87171; }

body.light-mode .rpm-st--done { color: #15803d; background: #dcfce7; }
body.light-mode .rpm-st--good { color: #16a34a; background: #dcfce7; }
body.light-mode .rpm-st--prog { color: #2563eb; background: #dbeafe; }
body.light-mode .rpm-st--wait { color: #64748b; background: #f1f5f9; }
body.light-mode .rpm-st--warn { color: #b45309; background: #fef3c7; }
body.light-mode .rpm-st--bad { color: #dc2626; background: #fee2e2; }

@media (max-width: 900px) {
    .rpm-board-hero {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .rpm-board-ring-wrap {
        margin: 0 auto;
    }

    .rpm-board-timeline,
    .rpm-board-cols {
        grid-template-columns: 1fr;
    }
}

body.light-mode .rpm-board-hero {
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdfa 55%, #e0f2fe 100%);
    border-color: #99f6e4;
}

body.light-mode .rpm-board-head-text h1 {
    color: #134e4a;
}

body.light-mode .rpm-board-tl-card {
    background: #fff;
}

.rehab-board-screen .rf-print-table {
    width: 100%;
}

/* تقرير مجلس الإدارة — ألوان واضحة عند الطباعة/PDF (خارج @media print لتعمل في المعاينة أيضاً) */
body.printing-rehab-pm .rpm-board,
body.printing-rehab-pm .rpm-board * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

body.printing-rehab-pm .rpm-board {
    color: #0f172a !important;
}

body.printing-rehab-pm .rpm-board-hero {
    background: #ecfdf5 !important;
    border: 1px solid #99f6e4 !important;
    color: #0f172a !important;
}

body.printing-rehab-pm .rpm-board-head-text h1 {
    color: #134e4a !important;
}

body.printing-rehab-pm .rpm-board-kicker {
    color: #0f766e !important;
    opacity: 1 !important;
}

body.printing-rehab-pm .rpm-board-goal,
body.printing-rehab-pm .rpm-board-goal strong {
    color: #334155 !important;
    opacity: 1 !important;
}

body.printing-rehab-pm .rpm-board-ring {
    background: #fff !important;
    color: #0f766e !important;
    border-color: #0f766e !important;
    box-shadow: none !important;
}

body.printing-rehab-pm .rpm-board-ring-lbl {
    color: #475569 !important;
    opacity: 1 !important;
}

body.printing-rehab-pm .rpm-board-schedule-card {
    background: #fff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

body.printing-rehab-pm .rpm-board-schedule-card p {
    color: #334155 !important;
    opacity: 1 !important;
}

body.printing-rehab-pm .rpm-board-schedule-card .rpm-st {
    border: 1px solid #86efac !important;
}

body.printing-rehab-pm .rpm-board-timeline {
    margin-bottom: 14px;
}

body.printing-rehab-pm .rpm-board-tl-card {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
}

body.printing-rehab-pm .rpm-board-tl-head,
body.printing-rehab-pm .rpm-board-tl-head span,
body.printing-rehab-pm .rpm-board-tl-head strong {
    color: #0f172a !important;
}

body.printing-rehab-pm .rpm-board-tl-bar {
    background: #e2e8f0 !important;
}

body.printing-rehab-pm .rpm-board-tl-bar div {
    background: #0d9488 !important;
}

body.printing-rehab-pm .rpm-board-tl-bar--ops div {
    background: #2563eb !important;
}

body.printing-rehab-pm .rpm-board-section h2,
body.printing-rehab-pm .rpm-board-panel h2 {
    color: #0f766e !important;
}

body.printing-rehab-pm .rpm-board-table-wrap {
    border-color: #cbd5e1 !important;
}

body.printing-rehab-pm .rpm-board-table th,
body.printing-rehab-pm .rpm-board-table td {
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
    background: #fff !important;
}

body.printing-rehab-pm .rpm-board-table thead th {
    background: #0f766e !important;
    color: #fff !important;
}

body.printing-rehab-pm .rpm-board-table tbody tr:nth-child(even) td {
    background: #f8fafc !important;
}

body.printing-rehab-pm .rpm-board-num {
    color: #0f766e !important;
}

body.printing-rehab-pm .rpm-board-mini-bar {
    background: #e2e8f0 !important;
}

body.printing-rehab-pm .rpm-board-mini-bar div {
    background: #0d9488 !important;
}

body.printing-rehab-pm .rpm-board-panel {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
}

body.printing-rehab-pm .rpm-board-list li,
body.printing-rehab-pm .rpm-board-list li strong {
    color: #0f172a !important;
}

body.printing-rehab-pm .rpm-board-list li span {
    color: #475569 !important;
    opacity: 1 !important;
}

body.printing-rehab-pm .rpm-board-intro-inner,
body.printing-rehab-pm .rpm-board-narrative-inner {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
}

body.printing-rehab-pm .rpm-board-prose {
    color: #0f172a !important;
}

body.printing-rehab-pm .rpm-board-narrative-meta,
body.printing-rehab-pm .rpm-board-footer,
body.printing-rehab-pm .rpm-muted {
    color: #64748b !important;
    opacity: 1 !important;
}

body.printing-rehab-pm .rpm-board-cost-kpi {
    background: #f0fdfa !important;
    border: 1px solid #99f6e4 !important;
}

body.printing-rehab-pm .rpm-board-cost-kpi span {
    color: #475569 !important;
}

body.printing-rehab-pm .rpm-board-cost-kpi strong {
    color: #0f172a !important;
}

body.printing-rehab-pm .rpm-st {
    border: 1px solid #cbd5e1 !important;
}

body.printing-rehab-pm .rpm-st--done {
    background: #dcfce7 !important;
    color: #15803d !important;
}

body.printing-rehab-pm .rpm-st--good {
    background: #dcfce7 !important;
    color: #15803d !important;
}

body.printing-rehab-pm .rpm-st--prog {
    background: #dbeafe !important;
    color: #1e40af !important;
}

body.printing-rehab-pm .rpm-st--wait {
    background: #f1f5f9 !important;
    color: #475569 !important;
}

body.printing-rehab-pm .rpm-st--warn {
    background: #fef3c7 !important;
    color: #b45309 !important;
}

body.printing-rehab-pm .rpm-st--bad {
    background: #fee2e2 !important;
    color: #dc2626 !important;
}

@media print {
    body.printing-rehab-pm > *:not(#rehabPmPrintSheet) {
        display: none !important;
        visibility: hidden !important;
    }

    body.printing-rehab-pm #rehabPmPrintSheet {
        display: block !important;
        visibility: visible !important;
        position: static !important;
        left: auto !important;
        top: auto !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        color: #000 !important;
    }

    body.printing-rehab-pm {
        background: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    @page {
        size: A4 landscape;
        margin: 8mm 10mm;
    }

    body.printing-rehab-corr @page {
        size: A4 portrait;
        margin: 8mm 10mm;
    }

    body.printing-rehab-pm .rpm-hero {
        display: flex;
        gap: 16px;
        align-items: center;
        margin-bottom: 16px;
    }

    body.printing-rehab-pm .rpm-ring {
        width: 80px;
        height: 80px;
        border-radius: 50%;
        border: 6px solid #0d9488;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        font-weight: 700;
        color: #0d9488;
        flex-shrink: 0;
    }

    body.printing-rehab-pm .rpm-kpis {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        margin: 12px 0 16px;
    }

    body.printing-rehab-pm .rpm-kpis div {
        text-align: center;
        padding: 8px;
        border: 1px solid #ccc;
        border-radius: 6px;
    }

    body.printing-rehab-pm h2 {
        font-size: 11pt;
        color: #0f766e;
        margin: 14px 0 8px;
        page-break-after: avoid;
    }

    body.printing-rehab-pm .rf-print-table {
        font-size: 9pt;
    }

    body.printing-rehab-pm .rpm-doc-title {
        font-size: 14pt;
        color: #0f766e;
        margin: 0 0 12px;
    }

    body.printing-rehab-pm .rpm-hint {
        font-size: 9pt;
        color: #64748b;
        margin: 0 0 12px;
    }

    body.printing-rehab-pm .rpm-phase-block {
        margin-bottom: 16px;
        page-break-inside: avoid;
    }

    body.printing-rehab-pm .rpm-phase-block h2,
    body.printing-rehab-pm .rpm-gantt-section h2 {
        font-size: 11pt;
        color: #0f766e;
        margin: 12px 0 6px;
        page-break-after: avoid;
    }

    body.printing-rehab-pm .rpm-phase-block h2 span,
    body.printing-rehab-pm .rpm-gantt-section h2 span,
    body.printing-rehab-pm .rpm-sub span {
        font-weight: 400;
        color: #475569;
        font-size: 9pt;
    }

    body.printing-rehab-pm .rpm-sub {
        font-size: 10pt;
        margin: 10px 0 4px;
        color: #334155;
    }

    body.printing-rehab-pm .rpm-table-compact td,
    body.printing-rehab-pm .rpm-table-compact th {
        padding: 4px 6px;
    }

    body.printing-rehab-pm .rpm-gantt-section {
        margin-bottom: 14px;
        page-break-inside: avoid;
    }

    body.printing-rehab-pm .rpm-gantt-bar-cell {
        width: 120px;
    }

    body.printing-rehab-pm .rpm-gantt-track {
        height: 10px;
        background: #e2e8f0;
        border-radius: 4px;
        overflow: hidden;
    }

    body.printing-rehab-pm .rpm-gantt-fill {
        height: 100%;
        background: #0d9488;
        border-radius: 4px;
    }

    body.printing-rehab-pm .rpm-board h2 {
        font-size: 10pt;
        color: #0f766e;
    }

    body.printing-rehab-pm .rpm-board-intro {
        margin: 10px 0 14px;
        page-break-inside: avoid;
    }

    body.printing-rehab-pm .rpm-board-intro-inner {
        background: #f8fafc !important;
        border: 1px solid #cbd5e1;
        border-right: 3px solid #0f766e !important;
    }

    body.printing-rehab-pm .rpm-board-prose {
        font-size: 10pt;
        line-height: 1.65;
        color: #0f172a;
    }

    body.printing-rehab-pm .rpm-board-cost {
        margin: 12px 0 16px;
        page-break-inside: avoid;
    }

    body.printing-rehab-pm .rpm-board-cost-kpis {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        margin-bottom: 10px;
    }

    body.printing-rehab-pm .rpm-board-cost-kpi {
        background: #f0fdfa !important;
        border: 1px solid #99f6e4;
        padding: 8px;
        text-align: center;
        font-size: 9pt;
    }

    body.printing-rehab-pm .rpm-board-money {
        font-size: 8.5pt;
    }
}

/* الطلبات والتقارير */
.rehab-corr-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rehab-corr-hint {
    margin: 0 0 10px;
    font-size: 0.85rem;
    opacity: 0.8;
}

.rehab-corr-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.rehab-corr-filter {
    border: 1px solid var(--border, #334155);
    background: transparent;
    color: inherit;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.8rem;
    cursor: pointer;
}

.rehab-corr-filter.active {
    background: var(--accent, #0ea5e9);
    border-color: transparent;
    color: #fff;
}

.rehab-corr-actions {
    white-space: nowrap;
}

.rehab-corr-actions .btn {
    margin-inline-start: 4px;
}

.rehab-corr-form-card {
    margin-top: 4px;
}

.rehab-corr-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rehab-corr-kind-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.rehab-corr-kind-opt {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}

.rehab-corr-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.rehab-corr-form label,
.rehab-corr-form-card label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.rehab-corr-body {
    min-height: 160px;
    resize: vertical;
    font-weight: 400;
    font-family: 'Amiri', 'Traditional Arabic', serif;
    font-size: 1.05rem;
    line-height: 1.9;
}

.rehab-corr-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rehab-badge.info {
    background: rgba(14, 165, 233, 0.18);
    color: #38bdf8;
}

body.printing-rehab-pm .rpm-corr-doc {
    color: #111;
    font-size: 11pt;
    line-height: 1.65;
}

body.printing-rehab-pm .rpm-corr-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

body.printing-rehab-pm .rpm-corr-type {
    display: inline-block;
    padding: 4px 14px;
    border: 2px solid #0f172a;
    border-radius: 6px;
    font-weight: 700;
    font-size: 12pt;
}

body.printing-rehab-pm .rpm-corr-priority--urgent {
    color: #b91c1c;
    font-weight: 700;
    border: 1px solid #fca5a5;
    padding: 2px 8px;
    border-radius: 4px;
}

body.printing-rehab-pm .rpm-corr-address {
    margin-bottom: 14px;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

body.printing-rehab-pm .rpm-corr-address p {
    margin: 4px 0;
}

body.printing-rehab-pm .rpm-corr-title {
    margin: 0 0 12px;
    font-size: 14pt;
    border-bottom: 2px solid #0f172a;
    padding-bottom: 6px;
}

body.printing-rehab-pm .rpm-corr-meta-line {
    margin: 4px 0 10px;
    font-size: 10pt;
}

body.printing-rehab-pm .rpm-corr-body {
    margin: 16px 0 28px;
    min-height: 180px;
    text-align: justify;
}

body.printing-rehab-pm .rpm-corr-sign {
    display: flex;
    justify-content: flex-end;
    margin-top: 36px;
}

body.printing-rehab-pm .rpm-corr-sign-block {
    width: 220px;
    text-align: center;
}

body.printing-rehab-pm .rpm-corr-sign-line {
    height: 1px;
    background: #0f172a;
    margin: 28px 0 6px;
}

.rehab-corr-amiri-note {
    margin: 0;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(14, 165, 233, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.35);
    font-size: 0.85rem;
}

.rehab-corr-amiri-note i {
    margin-left: 6px;
    opacity: 0.85;
}

body.printing-rehab-pm .rpm-amiri-doc {
    color: #111;
    font-family: 'Amiri', 'Traditional Arabic', 'Arabic Typesetting', serif;
    position: relative;
}

body.printing-rehab-pm .rpm-amiri-page-sheet,
.corr-print-preview-inner .rpm-amiri-page-sheet {
    --corr-font-pt: 12;
    --corr-line-height: 1.55;
    --corr-footer-bottom: 0mm;
    font-size: calc(var(--corr-font-pt) * 1pt);
    line-height: var(--corr-line-height, 1.55);
    position: relative;
    width: 100%;
    height: 281mm;
    max-height: 281mm;
    overflow: hidden;
    box-sizing: border-box;
    padding: 0 8mm;
    page-break-after: avoid;
    break-after: avoid-page;
    page-break-inside: avoid;
    break-inside: avoid-page;
}

body.printing-rehab-corr .rpm-amiri-page-sheet {
    height: 281mm;
    max-height: 281mm;
}

body.printing-rehab-pm .rpm-amiri-content,
.corr-print-preview-inner .rpm-amiri-content {
    max-height: calc(281mm - 34mm - var(--corr-footer-bottom, 0mm));
    overflow: hidden;
}

body.printing-rehab-pm .rpm-amiri-footer-block,
.corr-print-preview-inner .rpm-amiri-footer-block {
    position: absolute;
    bottom: var(--corr-footer-bottom, 0mm);
    left: 0;
    right: 0;
    margin-top: 0;
    padding-top: 0;
    page-break-inside: avoid;
    break-inside: avoid-page;
}

body.printing-rehab-pm .rf-print-doc.rf-print-amiri {
    font-family: 'Amiri', 'Traditional Arabic', 'Arabic Typesetting', serif;
}

body.printing-rehab-pm .rpm-amiri-org {
    text-align: center;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 2px double #0f172a;
}

body.printing-rehab-pm .rpm-amiri-logo {
    display: block;
    width: 55%;
    max-width: 120mm;
    height: auto;
    max-height: 14mm;
    margin: 0 auto 4px;
    object-fit: contain;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

body.printing-rehab-pm .rpm-amiri-org strong {
    display: block;
    font-size: 1.17em;
    font-weight: 700;
}

body.printing-rehab-pm .rpm-amiri-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.96em;
}

body.printing-rehab-pm .rpm-amiri-route {
    margin-bottom: 6px;
    padding: 4px 0;
    border-top: 1px solid #cbd5e1;
    border-bottom: 1px solid #cbd5e1;
}

body.printing-rehab-pm .rpm-amiri-route p {
    margin: 2px 0;
}

body.printing-rehab-pm .rpm-amiri-line {
    margin: 0 0 6px;
    font-size: 0.96em;
}

body.printing-rehab-pm .rpm-amiri-body {
    margin: 8px 0;
    text-align: justify;
    min-height: 0;
    line-height: inherit;
}

body.printing-rehab-corr .rpm-amiri-body {
    flex: none;
}

body.printing-rehab-pm .rpm-amiri-footer-block {
    margin-top: 0;
}

body.printing-rehab-corr .rpm-amiri-footer-block {
    margin-top: 0;
    padding-top: 0;
}

body.printing-rehab-pm .rpm-amiri-closing {
    margin: 0 0 8px;
    text-align: center;
    font-size: 0.96em;
}

body.printing-rehab-pm .rpm-amiri-sign {
    display: flex;
    justify-content: flex-end;
}

body.printing-rehab-pm .rpm-amiri-sign-block {
    width: 190px;
    text-align: center;
    font-size: 0.96em;
}

body.printing-rehab-pm .rpm-amiri-sign-line {
    height: 1px;
    background: #0f172a;
    margin: 12px 0 4px;
}

body.printing-rehab-pm .rpm-amiri-sign-block small {
    font-size: 0.92em;
}

body.printing-rehab-pm .rpm-amiri-urgent {
    position: absolute;
    top: 0;
    left: 0;
    border: 2px solid #b91c1c;
    color: #b91c1c;
    font-weight: 700;
    padding: 2px 8px;
    font-size: 10pt;
}

/* ─── ورقة طباعة كلف المراحل ─── */
.rpm-cost-sheet {
    color: #0f172a;
}

.rpm-cost-sheet-hero {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid #99f6e4;
    border-radius: 10px;
    background: linear-gradient(135deg, #f0fdfa 0%, #ecfeff 100%);
}

.rpm-cost-sheet-ring {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 5px solid #0d9488;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #fff;
}

.rpm-cost-sheet-ring span {
    font-size: 1rem;
    font-weight: 800;
    color: #0f766e;
    line-height: 1.1;
}

.rpm-cost-sheet-ring small {
    font-size: 0.62rem;
    color: #64748b;
}

.rpm-cost-sheet-kicker {
    margin: 0 0 4px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #0d9488;
    letter-spacing: 0.02em;
}

.rpm-cost-sheet-head h1 {
    margin: 0;
    font-size: 1.15rem;
    color: #0f766e;
}

.rpm-cost-sheet-sub {
    margin: 4px 0 0;
    font-size: 0.82rem;
    color: #475569;
}

.rpm-cost-sheet-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.rpm-cost-sheet-kpi {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    text-align: center;
}

.rpm-cost-sheet-kpi--accent {
    border-color: #5eead4;
    background: #f0fdfa;
}

.rpm-cost-sheet-kpi span {
    display: block;
    font-size: 0.72rem;
    color: #64748b;
    margin-bottom: 4px;
}

.rpm-cost-sheet-kpi strong {
    font-size: 0.9rem;
    font-weight: 800;
    color: #0f172a;
}

.rpm-cost-sheet-table-wrap {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 12px;
}

.rpm-cost-sheet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.rpm-cost-sheet-table thead th {
    background: #0f766e;
    color: #fff;
    padding: 8px 10px;
    font-size: 0.76rem;
    font-weight: 700;
    text-align: center;
    border: 1px solid #0d9488;
}

.rpm-cost-sheet-table tbody td,
.rpm-cost-sheet-table tfoot td {
    padding: 7px 10px;
    border: 1px solid #e2e8f0;
    vertical-align: middle;
}

.rpm-cost-phase-row {
    background: #fff;
}

.rpm-cost-phase-row:nth-child(4n+1) {
    background: #f8fafc;
}

.rpm-cost-seq {
    text-align: center;
    font-weight: 800;
    color: #0f766e;
    width: 36px;
}

.rpm-cost-phase-name strong {
    display: block;
    font-size: 0.84rem;
}

.rpm-cost-wbs {
    display: block;
    margin-top: 2px;
    font-size: 0.68rem;
    color: #64748b;
}

.rpm-cost-money {
    text-align: left;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    font-size: 0.8rem;
}

.rpm-cost-pct {
    text-align: center;
    min-width: 72px;
}

.rpm-cost-pct-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
}

.rpm-cost-pct-bar {
    flex: 1;
    max-width: 48px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.rpm-cost-pct-bar div {
    height: 100%;
    background: #0d9488;
    border-radius: 999px;
}

.rpm-cost-breakdown-row td {
    padding: 4px 10px 10px !important;
    background: #f8fafc !important;
    border-top: none !important;
}

.rpm-cost-breakdown-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.72rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}

.rpm-cost-breakdown-table thead th {
    background: #e2e8f0;
    color: #334155;
    padding: 4px 8px;
    font-weight: 700;
    border: 1px solid #cbd5e1;
}

.rpm-cost-breakdown-table td {
    padding: 3px 8px;
    border: 1px solid #e2e8f0;
}

.rpm-cbd-code {
    width: 56px;
    font-family: ui-monospace, monospace;
    color: #0d9488;
    font-weight: 600;
}

.rpm-cbd--sub .rpm-cbd-name {
    padding-right: 8px;
}

.rpm-cbd--act .rpm-cbd-name {
    padding-right: 18px;
    color: #475569;
}

.rpm-cbd-tag {
    width: 72px;
    text-align: center;
    color: #64748b;
    font-size: 0.68rem;
}

.rpm-cbd-pct {
    width: 52px;
    text-align: center;
    font-weight: 700;
    color: #0f766e;
    white-space: nowrap;
}

.rpm-cbd-money {
    text-align: left;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    font-size: 0.68rem;
}

.rpm-cost-total-row {
    background: #ecfdf5 !important;
    font-weight: 700;
}

.rpm-cost-total-row td {
    border-top: 2px solid #0f766e !important;
}

.rpm-cost-sheet-notes {
    margin: 10px 0 14px;
    padding: 8px 12px;
    border-radius: 6px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    font-size: 0.74rem;
    color: #78350f;
}

.rpm-cost-sheet-notes ul {
    margin: 0;
    padding-right: 18px;
}

.rpm-cost-sheet-notes li {
    margin-bottom: 3px;
}

.rpm-cost-sheet-sign {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin: 18px 0 10px;
    page-break-inside: avoid;
}

.rpm-cost-sign-block {
    text-align: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: #334155;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.rpm-cost-sign-label {
    display: block;
    margin-bottom: 4px;
}

.rpm-cost-sign-name {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}

.rpm-cost-sign-space {
    width: 100%;
    min-height: 52px;
    flex: 1;
}

.rpm-cost-sign-line {
    width: calc(100% - 16px);
    height: 1px;
    background: #94a3b8;
    margin: 0 8px;
}

.rpm-cost-page--final {
    display: flex;
    flex-direction: column;
    min-height: 240mm;
    margin-top: 8px;
    padding-top: 8px;
}

.rpm-cost-final-body {
    flex: 0 0 auto;
}

.rpm-cost-final-sign-wrap {
    margin-top: auto;
    padding-top: 35mm;
    page-break-inside: avoid;
}

.rpm-cost-page--final .rpm-cost-sheet-sign {
    margin: 0 0 16px;
}

.rpm-cost-page--final .rpm-cost-sheet-footer {
    margin-top: 12px;
}

.rpm-cost-sheet-footer {
    margin: 0;
    padding-top: 8px;
    border-top: 1px dashed #cbd5e1;
    text-align: center;
    font-size: 0.72rem;
    color: #64748b;
}

/* صفحات منفصلة — كل مرحلة في صفحة */
.rpm-cost-page--cover {
    margin-bottom: 8px;
}

.rpm-cost-index-title {
    margin: 0 0 8px;
    padding: 8px 10px 0;
    font-size: 0.84rem;
    color: #0f766e;
}

.rpm-cost-index-table thead th {
    font-size: 0.72rem;
}

.rpm-cost-page--phase {
    margin-top: 4px;
}

.rpm-cost-page--sheet {
    margin-top: 0;
}

.rpm-cost-phase-block {
    page-break-inside: avoid;
    break-inside: avoid-page;
}

.rpm-cost-phase-block--sep {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px dashed #cbd5e1;
}

.rpm-cost-phase-block--compact .rpm-cost-phase-page-head {
    padding: 8px 10px;
    margin-bottom: 8px;
}

.rpm-cost-phase-block--compact .rpm-cost-phase-page-badge {
    width: 36px;
    height: 36px;
    font-size: 1rem;
}

.rpm-cost-phase-block--compact .rpm-cost-phase-page-title h2 {
    font-size: 0.88rem;
}

.rpm-cost-phase-block--compact .rpm-cost-phase-page-kpis {
    gap: 6px;
    margin-bottom: 8px;
}

.rpm-cost-phase-block--compact .rpm-cost-phase-page-kpi {
    padding: 6px 8px;
}

.rpm-cost-phase-block--compact .rpm-cost-phase-page-kpi strong {
    font-size: 0.78rem;
}

.rpm-cost-phase-block--compact .rpm-cost-phase-page-progress {
    margin-bottom: 8px;
    padding: 6px 10px;
}

.rpm-cost-phase-block--compact .rpm-cost-breakdown-table {
    font-size: 0.68rem;
}

.rpm-cost-phase-block--compact .rpm-cost-breakdown-table thead th,
.rpm-cost-phase-block--compact .rpm-cost-breakdown-table td {
    padding: 2px 6px;
}

.rpm-cost-phase-page-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 2px solid #0f766e;
    border-radius: 10px;
    background: linear-gradient(135deg, #f0fdfa 0%, #fff 100%);
}

.rpm-cost-phase-page-badge {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #0f766e;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rpm-cost-phase-page-kicker {
    margin: 0 0 4px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #0d9488;
}

.rpm-cost-phase-page-title {
    flex: 1;
    min-width: 0;
}

.rpm-cost-phase-page-title h2 {
    margin: 0;
    font-size: 1rem;
    color: #0f172a;
    line-height: 1.35;
}

.rpm-cost-phase-page-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-top: 6px;
    font-size: 0.72rem;
    color: #64748b;
}

.rpm-cost-phase-page-status {
    flex-shrink: 0;
}

.rpm-cost-phase-page-kpis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.rpm-cost-phase-page-kpi {
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    text-align: center;
}

.rpm-cost-phase-page-kpi span {
    display: block;
    font-size: 0.7rem;
    color: #64748b;
    margin-bottom: 4px;
}

.rpm-cost-phase-page-kpi strong {
    font-size: 0.88rem;
    font-weight: 800;
}

.rpm-cost-phase-page-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f1f5f9;
    font-size: 0.8rem;
}

.rpm-cost-phase-page-progress > span {
    flex-shrink: 0;
    font-weight: 700;
    color: #334155;
}

.rpm-cost-pct-wrap--wide {
    flex: 1;
}

.rpm-cost-pct-bar--wide {
    max-width: none;
    flex: 1;
    height: 10px;
}

.rpm-cost-phase-page-section {
    margin-bottom: 12px;
}

.rpm-cost-phase-page-section h3 {
    margin: 0 0 8px;
    font-size: 0.84rem;
    color: #0f766e;
    padding-bottom: 6px;
    border-bottom: 1px solid #99f6e4;
}

.rpm-cost-no-breakdown {
    margin: 0;
    padding: 12px;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    font-size: 0.78rem;
    color: #64748b;
    font-style: italic;
}

.rpm-cost-phase-page-foot {
    margin: 16px 0 0;
    padding-top: 8px;
    border-top: 1px dashed #cbd5e1;
    text-align: center;
    font-size: 0.68rem;
    color: #94a3b8;
}

.rpm-cost-final-title {
    margin: 0 0 12px;
    font-size: 1rem;
    color: #0f766e;
    text-align: center;
}

.rpm-cost-final-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.rpm-cost-final-item {
    padding: 12px;
    border: 2px solid #0f766e;
    border-radius: 8px;
    text-align: center;
    background: #ecfdf5;
}

.rpm-cost-final-item span {
    display: block;
    font-size: 0.72rem;
    color: #64748b;
    margin-bottom: 4px;
}

.rpm-cost-final-item strong {
    font-size: 0.95rem;
    font-weight: 800;
}

    @page cost-portrait {
        size: A4 portrait;
        margin: 12mm 14mm;
    }

    body.printing-rehab-portrait .rf-print-cost-phases .rf-print-page-wrap {
        page: cost-portrait;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-page--cover {
        page-break-after: always;
        break-after: page;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-page--sheet {
        page-break-before: always;
        break-before: page;
        page-break-inside: avoid;
        break-inside: avoid-page;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-page--sheet-compact {
        page-break-inside: avoid;
        break-inside: avoid-page;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-phase-block {
        page-break-inside: avoid;
        break-inside: avoid-page;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-phase-block--compact .rpm-cost-phase-page-head {
        padding: 6px 8px !important;
        margin-bottom: 6px !important;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-phase-block--compact .rpm-cost-breakdown-table {
        font-size: 7pt;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-page--final {
        page-break-before: always;
        break-before: page;
        page-break-inside: avoid;
        display: flex;
        flex-direction: column;
        min-height: 240mm;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-final-sign-wrap {
        margin-top: auto;
        padding-top: 40mm;
        page-break-inside: avoid;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-sign-space {
        min-height: 22mm;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-sheet-sign {
        margin-top: 0;
        page-break-inside: avoid;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-phase-page-head,
    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-phase-page-kpis,
    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-phase-page-progress {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-breakdown-table {
        font-size: 7.5pt;
        page-break-inside: auto;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cbd-pct,
    body.printing-rehab-pm .rf-print-cost-phases .rpm-cbd-money {
        font-size: 7.5pt;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-phase-page-section {
        flex: 1;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-phase-page-kpis {
        grid-template-columns: repeat(2, 1fr);
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-phase-page-badge {
        background: #0f766e !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-phase-page-head {
        background: #f0fdfa !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-final-item {
        background: #ecfdf5 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-sheet-hero {
        background: #f0fdfa !important;
        border: 1px solid #99f6e4;
        page-break-after: avoid;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-sheet-kpis {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
        margin-bottom: 10px;
        page-break-after: avoid;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-sheet-kpi {
        background: #f8fafc !important;
        border: 1px solid #cbd5e1;
        padding: 6px;
        font-size: 8.5pt;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-sheet-table {
        font-size: 8.5pt;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-sheet-table thead th {
        background: #0f766e !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-phase-row {
        page-break-inside: avoid;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-breakdown-row {
        page-break-inside: avoid;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-total-row {
        background: #ecfdf5 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-sheet-notes {
        background: #fffbeb !important;
        font-size: 7.5pt;
        page-break-inside: avoid;
    }

    body.printing-rehab-pm .rf-print-cost-phases .rpm-cost-pct-bar div {
        background: #0d9488 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}


.rehab-corr-ref-hint {
    display: block;
    margin-top: 4px;
    font-weight: 500;
    font-size: 0.78rem;
    opacity: 0.75;
}

.rehab-corr-board-hint {
    display: block;
    margin-top: 4px;
    font-weight: 500;
    font-size: 0.78rem;
    color: #f59e0b;
    opacity: 0.95;
}

body.light-mode .rehab-corr-board-hint {
    color: #b45309;
}

/* واجهة الطلبات والتقارير — القائمة الرئيسية */
.corr-workspace {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.corr-hero {
    padding: 16px 18px;
    background: linear-gradient(135deg, #0c4a6e 0%, #0369a1 55%, #0284c7 100%);
    color: #fff;
    border: none;
}

.corr-hero h2 {
    margin: 0 0 4px;
    font-size: 1.15rem;
}

.corr-hero p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.85rem;
}

.corr-hero-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.corr-module-body {
    min-height: 120px;
}

/* ─── معاينة الطباعة — الطلبات والتقارير ─── */
.corr-print-modal {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.corr-print-modal.hidden {
    display: none !important;
}

.corr-print-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.corr-print-modal-panel {
    position: relative;
    z-index: 1;
    width: min(980px, 98vw);
    max-height: 94vh;
    background: #f8fafc;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.corr-print-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
}

.corr-print-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.corr-print-control-lbl {
    font-size: 0.78rem;
    color: #64748b;
    white-space: nowrap;
}

.corr-print-control-val {
    min-width: 52px;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 700;
    color: #0f172a;
}

.corr-print-ctrl-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    cursor: pointer;
}

.corr-print-ctrl-btn:hover {
    background: #e2e8f0;
}

.corr-print-preview-scroller {
    overflow: auto;
    padding: 16px;
    flex: 1;
    background: #e2e8f0;
}

.corr-print-preview-inner {
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: center;
}

.corr-print-preview-stage {
    width: 210mm;
    min-width: 210mm;
    transform: scale(var(--corr-preview-scale, 1));
    transform-origin: top center;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.corr-print-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
}

.corr-print-modal-head h3 {
    margin: 0 0 4px;
    font-size: 1rem;
    color: #0f172a;
}

.corr-print-preview-status {
    margin: 0;
    font-size: 0.82rem;
    color: #059669;
}

.corr-print-preview-status.is-warn {
    color: #b45309;
}

.corr-print-modal-close {
    border: none;
    background: #f1f5f9;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    color: #475569;
}

.corr-print-preview-inner .rf-print-doc {
    font-family: 'Amiri', 'Traditional Arabic', 'Arabic Typesetting', serif;
    color: #111;
}

.corr-print-preview-inner .rpm-amiri-org {
    text-align: center;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 2px double #0f172a;
}

.corr-print-preview-inner .rpm-amiri-logo {
    display: block;
    width: 55%;
    max-width: 120mm;
    max-height: 14mm;
    margin: 0 auto 4px;
    object-fit: contain;
}

.corr-print-preview-inner .rpm-amiri-org strong {
    display: block;
    font-size: 1.17em;
    font-weight: 700;
}

.corr-print-preview-inner .rpm-amiri-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.96em;
}

.corr-print-preview-inner .rpm-amiri-route {
    margin-bottom: 6px;
    padding: 4px 0;
    border-top: 1px solid #cbd5e1;
    border-bottom: 1px solid #cbd5e1;
}

.corr-print-preview-inner .rpm-amiri-route p {
    margin: 2px 0;
}

.corr-print-preview-inner .rpm-amiri-body {
    margin: 8px 0;
    text-align: justify;
    line-height: inherit;
}

.corr-print-preview-inner .rpm-amiri-closing {
    margin: 0 0 8px;
    text-align: center;
    font-size: 0.96em;
}

.corr-print-preview-inner .rpm-amiri-sign {
    display: flex;
    justify-content: flex-end;
}

.corr-print-preview-inner .rpm-amiri-sign-block {
    width: 190px;
    text-align: center;
    font-size: 0.96em;
}

.corr-print-preview-inner .rpm-amiri-sign-line {
    height: 1px;
    background: #0f172a;
    margin: 12px 0 4px;
}

.corr-print-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}
