/* ===== «إدارة» — عناصر خاصة بالنظام فوق تنسيق نظام المصنع (app.css) ===== */

/* القوائم */
.o_pad { padding: 14px 16px 0; margin-bottom: 0; }
.o_list_table tr.o_row_ok td:first-child { box-shadow: inset -3px 0 0 var(--o-success); }
.o_list_table tr.o_row_bad td { background: #fff6f5; }
.o_list_table tr.o_row_bad td:first-child { box-shadow: inset -3px 0 0 var(--o-danger); }
.o_list_table tr.o_row_warn td { background: #fffaeb; }
.o_more_row { padding: 10px 16px; display: flex; align-items: center; gap: 8px; }
.o_kpi.bad .val { color: var(--o-danger); }
.o_kpi.warn .val { color: var(--o-warning); }
.o_kpi .val { font-size: 22px; }
.o_kpi_link { cursor: pointer; }
.o_kpi_link:hover { border-color: var(--o-brand); }
tr.clk { cursor: pointer; }
tr.clk:hover td { background: #f6f8f9; }
.o_section_title { font-size: 15px; margin: 18px 0 8px; color: var(--o-heading); display: flex; align-items: baseline; gap: 6px; }
.o_section_title small { font-weight: 400; color: var(--o-muted); font-size: 12px; }
.o_btn_row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.o_check { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; font-size: 13.5px; margin-inline-end: 10px; }
.o_tab_cnt { background: var(--o-danger); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 6px; margin-inline-start: 6px; }
.o_head_total { display: flex; flex-direction: column; align-items: flex-end; padding-bottom: 4px; }
.o_head_total small { color: var(--o-muted); font-size: 12px; }
.o_head_total b { font-size: 20px; color: var(--o-brand); }
.o_avatar.sm { width: 22px; height: 22px; font-size: 10px; background: var(--o-brand-light); vertical-align: middle; }
.o_details { border: 1px solid var(--o-border-light); border-radius: var(--o-radius); padding: 6px 10px; margin-bottom: 8px; background: #fcfcfd; }
.o_details summary { cursor: pointer; color: var(--o-heading); }
.o_details[open] summary { margin-bottom: 8px; }

/* المرفقات */
.o_files { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.o_file_chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--o-border); border-radius: 999px; padding: 1px 4px 1px 10px; background: #fff; font-size: 13px; max-width: 100%; }
.o_file_chip a { display: inline-flex; gap: 5px; align-items: center; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o_file_chip small { color: var(--o-muted); font-size: 11.5px; }
.o_file_add { display: inline-flex; gap: 2px; }
.o_doc_link { display: inline-flex; align-items: center; gap: 3px; margin-inline-end: 8px; font-size: 12.5px; }
.o_docs_grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-bottom: 8px; }
.o_doc_slot { border: 1px dashed var(--o-border); border-radius: var(--o-radius); padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }

/* المجاميع */
.o_totals .o_tot_row { display: flex; justify-content: space-between; gap: 16px; padding: 5px 2px; border-bottom: 1px solid var(--o-border-light); }
.o_totals .o_tot_row.grand { font-size: 16px; color: var(--o-heading); border-bottom: 2px solid var(--o-brand); }
.o_totals .o_tot_row.grand b { color: var(--o-brand); }
.o_totals .o_tot_row.muted { color: var(--o-muted); font-size: 13px; }
.o_sec_sum { max-width: 520px; }

/* محرر جدول الكميات */
.o_lines_tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.o_boq { min-width: 980px; }
.o_boq .c_no { width: 58px; }
.o_boq .c_code { width: 84px; font-size: 12.5px; }
.o_boq .c_desc { min-width: 280px; }
.o_boq .c_lab { width: 150px; }
.o_boq .c_prog { width: 150px; }
.o_no_input { width: 54px; text-align: center; }
.o_sec_input { font-weight: 700; }
.o_section_row.sub > td { background: #f9fafb; font-weight: 500; color: var(--o-text); font-size: 13px; }
.o_line_zero td { color: var(--o-faint); }
.o_line_name { cursor: pointer; }
.o_line_name:hover { color: var(--o-action); }
.o_sug_diff { color: var(--o-warning) !important; font-weight: 600; }
.o_row_acts { display: inline-flex; gap: 0; }
.o_row_acts .o_icon_btn { padding: 2px 3px; font-size: 12px; }
.o_lab_cell { display: flex; flex-direction: column; gap: 2px; }
.o_seg_mini { display: inline-flex; border: 1px solid var(--o-border); border-radius: var(--o-radius); overflow: hidden; }
.o_seg_mini button { border: 0; background: #fff; font: inherit; font-size: 12px; padding: 1px 8px; cursor: pointer; color: var(--o-text); }
.o_seg_mini button + button { border-inline-start: 1px solid var(--o-border); }
.o_seg_mini button.active { background: var(--o-brand); color: #fff; }
.o_seg_mini button:disabled { cursor: default; }
.o_pct_in { width: 52px; border: 0; border-bottom: 1px solid var(--o-border); background: none; font: inherit; text-align: center; color: var(--o-heading); outline: 0; }
.o_pct_in:focus { border-bottom-color: var(--o-action); }
.o_boq_head { margin-bottom: 8px; gap: 8px; }

/* المؤثرات السعرية */
.o_factors { display: flex; flex-direction: column; gap: 10px; }
.o_factor { border: 1px solid var(--o-border); border-radius: 6px; padding: 10px 12px; background: #fff; }
.o_factor_head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.o_factor_head .o_icon { color: var(--o-brand); }
.o_factor_head .text-muted { font-size: 12.5px; }
.o_levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.o_level { border: 1px solid var(--o-border); background: #fff; border-radius: var(--o-radius); padding: 6px 8px; cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: start; font: inherit; min-height: 74px; }
.o_level .n { font-weight: 700; font-size: 15px; color: var(--o-heading); }
.o_level .l { font-size: 12px; color: var(--o-text); line-height: 1.35; flex: 1; }
.o_level .m { font-size: 12px; color: var(--o-muted); }
.o_level:hover:not(:disabled) { border-color: var(--o-action); }
.o_level.active { background: var(--o-brand); border-color: var(--o-brand); }
.o_level.active .n, .o_level.active .l, .o_level.active .m { color: #fff; }
.o_level:disabled { cursor: default; }
.o_factor_impact { margin-bottom: 12px; }
.o_factor_mini { display: flex; flex-direction: column; gap: 4px; }
.o_factor_mini .o_num_sm { width: 60px; text-align: center; }
.o_factor_mini .row { display: grid; grid-template-columns: 220px auto 64px 1fr; gap: 10px; align-items: center; padding: 3px 0; border-bottom: 1px solid var(--o-border-light); font-size: 13.5px; }
.o_shares { flex-wrap: wrap; gap: 14px !important; }
.o_shares label { display: inline-flex; align-items: center; gap: 4px; }
.o_shares .o_input { width: 60px; flex: none; }
@media (max-width: 900px) { .o_levels { grid-template-columns: 1fr 1fr; } .o_factor_mini .row { grid-template-columns: 1fr; } }

/* البوابة */
.o_portal_card { cursor: pointer; }
.o_portal_card:hover { border-color: var(--o-brand); box-shadow: var(--o-shadow); }
.o_prog_big .o_prog_bar { height: 12px; }
.o_portal_kv { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin-top: 10px; }
.o_portal_kv span { display: block; font-size: 12px; color: var(--o-muted); }
.o_sub_lines { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow: auto; border: 1px solid var(--o-border-light); border-radius: var(--o-radius); padding: 6px 8px; }

/* الخط الزمني للمشاريع */
.o_tl { display: flex; flex-direction: column; gap: 4px; }
.o_tl_row { display: grid; grid-template-columns: 260px 1fr; gap: 10px; align-items: center; cursor: pointer; padding: 2px 0; }
.o_tl_row:hover .o_tl_name { color: var(--o-action); }
.o_tl_name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o_tl_track { position: relative; height: 20px; background: #f4f5f7; border-radius: 3px; }
.o_tl_today { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--o-danger); z-index: 2; }
.o_tl_bar { position: absolute; top: 2px; bottom: 2px; background: #b9dfe1; border-radius: 3px; overflow: hidden; display: flex; align-items: center; }
.o_tl_bar i { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--o-brand); }
.o_tl_bar span { position: relative; font-size: 11px; padding-inline: 5px; color: #fff; font-weight: 600; text-shadow: 0 0 2px rgba(0, 0, 0, .35); }
.o_tl_bar.late { background: #f4c7c2; }
.o_tl_bar.late i { background: var(--o-danger); }
.o_tl_bar.risk { background: #f7dfa5; }
.o_tl_bar.risk i { background: #c98a00; }
.o_tl_axis { display: flex; justify-content: space-between; padding-inline-start: 270px; font-size: 11.5px; color: var(--o-muted); }

/* حمل الفرق */
.o_load th, .o_load td { white-space: nowrap; }
.o_load_cell { text-align: center; font-weight: 600; }
.o_load_cell.some { background: #e7f4f5; }
.o_load_cell.full { background: #fdf0cf; color: var(--o-warning); }
.o_load_cell.over { background: var(--o-danger-bg); color: var(--o-danger); }

/* مخطط جانت */
.o_gantt { display: flex; flex-direction: column; gap: 3px; overflow-x: auto; min-width: 0; }
.o_gantt_head, .o_gantt_row { display: grid; grid-template-columns: 250px minmax(520px, 1fr); gap: 8px; align-items: center; }
.o_gantt_name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o_gantt_name small { color: var(--o-warning); }
.o_gantt_head .o_gantt_name { font-weight: 600; color: var(--o-heading); }
.o_gantt_axis { position: relative; height: 18px; border-bottom: 1px solid var(--o-border); }
.o_gantt_axis span { position: absolute; font-size: 11px; color: var(--o-muted); transform: translateX(50%); white-space: nowrap; }
.o_gantt_track { position: relative; height: 22px; background: repeating-linear-gradient(to left, #f7f8fa 0, #f7f8fa 40px, #fff 40px, #fff 80px); border-radius: 3px; }
.o_gantt_bar { position: absolute; top: 3px; bottom: 3px; background: #9fd3d6; border-radius: 3px; overflow: hidden; min-width: 4px; }
.o_gantt_bar i { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--o-brand); }
.o_gantt_bar.sub { background: #f3d9a3; }
.o_gantt_bar.sub i { background: #b7791f; }
.o_gantt_bar.late { outline: 2px solid var(--o-danger); }

/* منحنى S */
.o_scurve_wrap { width: 100%; }
.o_scurve { width: 100%; height: 170px; }
.o_scurve .ax { stroke: #9ca3af; stroke-width: 1; }
.o_scurve .grid { stroke: #e5e7eb; stroke-width: 1; stroke-dasharray: 3 3; }
.o_scurve text { font-size: 10px; fill: #6b7280; }
.o_scurve .plan { fill: none; stroke: var(--o-brand); stroke-width: 2.2; }
.o_scurve .act { fill: none; stroke: #c2410c; stroke-width: 2; stroke-dasharray: 5 3; }
.o_scurve .now { stroke: var(--o-danger); stroke-width: 1; stroke-dasharray: 2 2; }
.o_scurve .dot { fill: #c2410c; }
.o_legend span::before { content: ''; display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin-inline-end: 5px; background: var(--o-brand); }
.o_legend span.act::before { background: #c2410c; }
.o_legend span.now::before { background: var(--o-danger); height: 1px; }

/* الهيكل الوظيفي */
.o_org ul { list-style: none; margin: 0; padding-inline-start: 26px; border-inline-start: 1px dashed #cdd2d8; }
.o_org > ul { border: 0; padding: 0; }
.o_org li { margin: 6px 0; }
.o_org_node { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--o-border); border-radius: 6px; padding: 5px 10px; background: #fff; cursor: pointer; }
.o_org_node:hover { border-color: var(--o-brand); }
.o_org_node.demo { border-style: dashed; }
.o_org_node b { display: block; font-size: 13.5px; color: var(--o-heading); }
.o_org_node small { color: var(--o-muted); font-size: 12px; }
.o_perm_matrix td, .o_perm_matrix th { font-size: 12.5px; }
.o_perm_groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 10px; }
.o_perm_group { border: 1px solid var(--o-border-light); border-radius: var(--o-radius); padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.o_perm_group b { color: var(--o-brand); margin-bottom: 2px; }
.o_comment { margin-top: 10px; align-items: flex-start; }
.o_comment .o_area { flex: 1; }
.o_settings { padding: 16px; max-width: 1160px; margin: 0 auto; }
.o_settings_body { padding: 12px 18px; }

/* الطباعة: خطاب العرض */
.p_letter { font-size: 10.5pt; line-height: 1.8; margin: 6px 0 12px; direction: rtl; }
.p_letter p { margin: 0 0 6px; }
.p_co.en { direction: ltr; text-align: left; }

/* ===== القاعدة المشتركة (الخادم): أعلى الصفحة، وشريط التصفح بحساب آخر ===== */
#o_as { flex: none; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #e6f3fb; color: #0b4a6b; padding: 7px 16px; font-size: 13.5px; border-bottom: 1px solid #b3d9ee; }
.o_nav_btn { background: transparent; border: 1px solid rgba(255, 255, 255, .4); color: #fff; border-radius: 6px; padding: 3px 9px; display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: 13px; cursor: pointer; line-height: 1.4; }
.o_nav_btn:hover { background: rgba(255, 255, 255, .16); }
.o_user_name { font-size: 13px; color: #fff; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) { .o_user_name { display: none; } }
