:root{font-family:Tahoma,Arial,sans-serif;color:#14213d;background:#f3f6fa}*{box-sizing:border-box}body{margin:0;background:#f3f6fa}.hidden{display:none!important}.topbar{display:flex;justify-content:space-between;align-items:center;padding:14px 22px;background:#10233f;color:white;gap:20px}.topbar h1{margin:0 0 4px;font-size:21px}.topbar p{margin:0;color:#c9d5e5;font-size:12px}.top-actions{display:flex;align-items:center;gap:9px}.project-picker{display:flex;align-items:center;gap:8px;font-size:12px}.project-picker select{min-width:180px}.tabs{display:flex;gap:4px;overflow:auto;padding:8px 12px;background:white;border-bottom:1px solid #d7dee8;position:sticky;top:0;z-index:20}.tab{white-space:nowrap;background:transparent;color:#344054;border:0;border-radius:8px;padding:9px 13px;cursor:pointer}.tab.active{background:#e8eef7;color:#0e4d92;font-weight:700}main{padding:16px;max-width:1700px;margin:auto}.view{display:none}.view.active{display:block}.panel{background:white;border:1px solid #dde4ed;border-radius:12px;padding:14px;box-shadow:0 2px 8px #1f2a4410;margin-bottom:14px}.panel-head,.toolbar{display:flex;justify-content:space-between;align-items:center;gap:12px}.panel-head.row{align-items:flex-start}.toolbar{margin-bottom:12px}.toolbar h2,.panel h3{margin:0 0 5px}.toolbar p,.panel-head p,.panel p{color:#667085;font-size:12px;margin:0}.toolbar-actions{display:flex;gap:8px;flex-wrap:wrap}button,.file-btn{border:0;border-radius:8px;padding:9px 13px;background:#1769aa;color:white;cursor:pointer;font:inherit}.secondary,.ghost{background:#e9eef5;color:#344054}.ghost{border:1px solid #637083}.small{padding:6px 10px;font-size:12px}.danger{background:#b42318}.success{background:#16803b}.icon-btn{background:transparent;color:#475467;font-size:24px;padding:0 8px}input,select,textarea{width:100%;border:1px solid #cfd8e4;border-radius:8px;padding:9px 10px;background:white;font:inherit;color:#1d2939}label{font-size:12px;color:#475467;display:grid;gap:5px}.badge{background:#e7edf5;color:#344054;border-radius:999px;padding:6px 10px;font-size:12px}.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px;margin-bottom:14px}.stat{background:white;border:1px solid #dfe6ef;border-radius:12px;padding:14px}.stat b{display:block;font-size:24px;margin-top:6px}.two-col{display:grid;grid-template-columns:1fr 1fr;gap:14px}.cad-layout{display:grid;grid-template-columns:minmax(0,2.2fr) minmax(320px,.8fr);gap:14px}.card-list{display:grid;gap:8px}.card-list.compact{max-height:400px;overflow:auto}.card{border:1px solid #dfe5ec;border-radius:10px;padding:10px;cursor:pointer}.card.active{outline:2px solid #4d8fd3;background:#f5f9ff}.card b{display:block}.card small{color:#667085}.table-scroll{overflow:auto;max-height:480px}.table-scroll.tall{max-height:620px}.small-table{max-height:280px}table{border-collapse:collapse;width:100%;font-size:12px}th,td{padding:9px 8px;border-bottom:1px solid #edf0f4;text-align:right;white-space:nowrap}th{position:sticky;top:0;background:#f8fafc;z-index:2;color:#475467}.filters{display:flex;gap:8px;margin-bottom:10px}.filters>*{max-width:320px}.map-panel{position:relative}.map-tools{display:flex;justify-content:space-between;color:#667085;font-size:11px;margin-bottom:8px}.map-viewport{height:650px;background:#18212d;border-radius:10px;overflow:hidden;cursor:grab;touch-action:none}.map-viewport:active{cursor:grabbing}#cadMap{width:100%;height:100%}.legend-box{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px;font-size:11px}.legend-item{display:flex;align-items:center;gap:5px}.legend-swatch{width:20px;height:3px;background:#ddd;border-radius:2px}.detail-box{padding:12px;background:#f8fafc;border:1px dashed #ccd4de;border-radius:10px;margin-top:10px}.callout{border-right:4px solid #1769aa}.auth-gate{position:fixed;inset:0;background:#10233ff0;z-index:999;display:grid;place-items:center}.auth-card{background:white;border-radius:16px;padding:26px;width:min(410px,92vw);display:grid;gap:12px}.auth-card h1{margin:0}.auth-card form{display:grid;gap:12px}.modal-head{display:flex;justify-content:space-between;align-items:center}.modal-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:14px}dialog{border:0;border-radius:14px;padding:0;min-width:min(620px,94vw);max-width:900px;box-shadow:0 20px 70px #0005}dialog::backdrop{background:#0d1726aa}#modalForm{padding:16px}#modalBody{display:grid;grid-template-columns:1fr 1fr;gap:12px;max-height:68vh;overflow:auto;padding:8px 1px}.span-2{grid-column:1/-1}.toast{position:fixed;left:22px;bottom:22px;background:#111827;color:#fff;border-radius:10px;padding:10px 14px;opacity:0;transform:translateY(8px);pointer-events:none;transition:.2s;z-index:1000}.toast.show{opacity:1;transform:translateY(0)}.status{display:inline-block;border-radius:999px;padding:4px 7px;font-size:11px;background:#eef2f6}.status.posted,.status.complete,.status.approved{background:#def7e7;color:#136c35}.status.draft,.status.pending{background:#fff3cd;color:#7a5d00}.status.submitted,.status.technical_approved,.status.printed{background:#dceeff;color:#185a92}.status.rejected,.status.cancelled{background:#fee4e2;color:#b42318}.map-node{cursor:pointer}.map-node.delivered{fill:#22a06b}.map-node.not_delivered{fill:#f1b434}.map-node.changed_after_delivery{fill:#e56b35}.map-node.executed{stroke:#fff;stroke-width:2}.pipe{fill:none;stroke:#4dabf7;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke}.street{fill:none;stroke:#7f8c99;stroke-width:1.3;vector-effect:non-scaling-stroke}.boundary{fill:none;stroke:#ef5350;stroke-width:2;stroke-dasharray:6 4;vector-effect:non-scaling-stroke}.annotation{fill:#e5e7eb;font-size:9px}.node-tooltip{pointer-events:none}.line-builder{border:1px solid #dfe5ec;border-radius:10px;padding:10px}.line-row{display:grid;grid-template-columns:1fr 100px 100px auto;gap:6px;align-items:center;margin-bottom:6px}.stock-pill{font-size:10px;color:#475467}.basket{background:#edf6ff;border:1px solid #a8c9ee;border-radius:9px;padding:8px;margin:8px 0}.muted{color:#667085;font-size:11px}hr{border:0;border-top:1px solid #edf0f4;margin:14px 0}.pipe-table-swatch{display:inline-block;width:12px;height:12px;border-radius:3px;margin-left:6px;vertical-align:-2px}.legend-item.pipe-toggle{background:#f8fafc;color:#344054;border:1px solid #d9e1ea;padding:5px 8px;border-radius:999px;font-size:11px}.legend-item.pipe-toggle.off{opacity:.42;text-decoration:line-through}.legend-item.pipe-toggle .legend-swatch{flex:0 0 20px}@media(max-width:980px){.two-col,.cad-layout{grid-template-columns:1fr}.topbar{align-items:flex-start;flex-direction:column}.top-actions{width:100%;flex-wrap:wrap}.map-viewport{height:480px}}@media(max-width:650px){main{padding:10px}#modalBody{grid-template-columns:1fr}.span-2{grid-column:auto}.tabs{padding:6px}.topbar{padding:12px}.line-row{grid-template-columns:1fr 80px}.line-row>*:nth-child(3),.line-row>*:nth-child(4){grid-column:auto}}

/* CAD review decision feedback */
.cad-review-toolbar{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin:10px 0}.cad-review-summary{display:flex;gap:7px;flex-wrap:wrap}.cad-review-filter{display:flex;align-items:center;gap:7px;grid-auto-flow:column}.cad-review-filter select{min-width:130px;padding:6px 8px}.cad-review-row.approved{background:#f0fbf4}.cad-review-row.rejected{background:#fff3f2}.cad-review-row.saving{opacity:.65}.cad-decision-cell{min-width:210px}.cad-decision-actions{display:inline-flex;gap:6px;margin-inline-start:8px}.cad-decision-actions button[disabled]{cursor:default;opacity:.45}.cad-decision-actions button.selected{opacity:1;box-shadow:0 0 0 2px #ffffff,0 0 0 4px currentColor;font-weight:700}.cad-decision-status{font-weight:700}.cad-review-row.approved .cad-decision-status::before{content:'✓ ';}.cad-review-row.rejected .cad-decision-status::before{content:'✕ ';}

.cad-review-row.approved .cad-reject:not([disabled]),.cad-review-row.rejected .cad-approve:not([disabled]){outline:1px dashed currentColor;outline-offset:2px}.cad-decision-actions button:not([disabled]){cursor:pointer}

.auth-link{margin-top:8px;width:100%}.auth-recovery-actions{display:flex;gap:8px;margin-top:8px}.auth-recovery-actions button{flex:1}.hint{font-size:.88rem;opacity:.8}.status.approved{background:#dcfce7;color:#166534}.status.pending{background:#fef3c7;color:#92400e}

/* MVP 3.1.0 — Map Delivery & UX upgrade */
:root{
  --brand:#1769aa;--brand-strong:#0f4f86;--brand-soft:#eaf4fd;
  --surface:#fff;--surface-2:#f8fafc;--border:#dbe4ee;--text:#14213d;--muted:#667085;
  --success:#16803b;--danger:#b42318;--warning:#b7791f;--shadow:0 10px 30px rgba(18,38,63,.08)
}
body{background:linear-gradient(180deg,#f6f9fc 0,#f1f5f9 100%);color:var(--text)}
.topbar{background:linear-gradient(135deg,#0f2746,#163d68);box-shadow:0 5px 18px rgba(14,34,60,.18)}
.tabs{box-shadow:0 3px 10px rgba(15,35,60,.04)}
.tab{transition:.16s ease}.tab:hover{background:#f1f5f9;color:#0e4d92}.tab.active{box-shadow:inset 0 -2px 0 #1769aa}
.panel{border-color:var(--border);box-shadow:var(--shadow)}
button,.file-btn{transition:transform .08s ease,box-shadow .14s ease,background .14s ease}
button:hover:not(:disabled),.file-btn:hover{box-shadow:0 5px 14px rgba(23,105,170,.18)}
button:active:not(:disabled){transform:translateY(1px)}
button:disabled{opacity:.45;cursor:not-allowed;box-shadow:none}
button.active-mode{background:#0f6b55;color:white;box-shadow:0 0 0 3px rgba(15,107,85,.13)}
input:focus,select:focus,textarea:focus{outline:none;border-color:#5b9bd5;box-shadow:0 0 0 3px rgba(23,105,170,.12)}

/* Login */
.auth-gate{background:radial-gradient(circle at 20% 15%,#1b4d7e 0,#10233f 42%,#08182c 100%)}
.auth-card{width:min(440px,92vw);padding:30px;border:1px solid rgba(255,255,255,.18);box-shadow:0 26px 80px rgba(0,0,0,.35)}
.auth-card h1{font-size:23px;color:#10233f}.auth-card>p{margin:0;color:#667085}
.auth-options{display:flex;justify-content:space-between;align-items:center;gap:10px}
.check-line{display:flex;align-items:center;gap:7px;cursor:pointer;color:#344054}.check-line input{width:auto;margin:0;accent-color:var(--brand)}
.text-btn{background:transparent;color:var(--brand);padding:4px 2px;box-shadow:none!important}.text-btn:hover{background:transparent;text-decoration:underline}
.primary-wide{width:100%;font-weight:700;padding:11px 14px}

/* CAD operational workspace */
.cad-layout{grid-template-columns:minmax(0,2.35fr) minmax(340px,.85fr);align-items:start}
.cad-side{position:sticky;top:62px;max-height:calc(100vh - 78px);overflow:auto}
.side-section{display:grid;gap:8px}.mini-actions{display:flex;gap:5px}.mini-actions button{padding:5px 8px}
.map-panel{overflow:hidden}.map-tools{gap:12px;flex-wrap:wrap;align-items:center}
.map-viewport{position:relative;border:1px solid #273647;box-shadow:inset 0 0 0 1px rgba(255,255,255,.025);background:radial-gradient(circle at 50% 45%,#202d3c,#141d28 78%)}
.map-viewport.delivery-select-mode{box-shadow:inset 0 0 0 2px #2dd4bf;cursor:crosshair}
.map-viewport.delivery-select-mode::after{content:'حالت انتخاب تحویل';position:absolute;top:10px;left:10px;background:#0f6b55;color:#fff;border-radius:999px;padding:5px 9px;font-size:10px;pointer-events:none;z-index:4}
.map-basket-bar{display:flex;justify-content:space-between;align-items:center;gap:12px;background:linear-gradient(90deg,#edf7ff,#f6fbff);border:1px solid #b9d7ee;border-radius:10px;padding:8px 10px;margin-bottom:8px;min-height:46px}
.map-basket-bar>div:first-child{display:flex;align-items:center;gap:7px;min-width:0}.count-badge{display:inline-grid;place-items:center;min-width:24px;height:24px;border-radius:999px;background:#1769aa;color:#fff;font-weight:700;font-size:11px}.map-basket-codes{color:#475467;font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:540px}.map-basket-actions{display:flex;gap:6px;flex:0 0 auto}
.map-layer-list{display:grid;gap:5px;max-height:300px;overflow:auto;padding-left:2px}
.map-layer-item{display:grid;grid-template-columns:auto auto minmax(0,1fr);align-items:center;gap:8px;border:1px solid #e2e8f0;border-radius:9px;padding:7px 8px;background:#fff;cursor:pointer;transition:.15s ease}
.map-layer-item:hover{border-color:#9fc5e6;background:#f7fbff}.map-layer-item.off{opacity:.55;background:#f8fafc}.map-layer-item input{width:auto;margin:0;accent-color:var(--brand)}
.layer-kind-dot{width:10px;height:10px;border-radius:50%;background:#94a3b8}.layer-kind-dot.connection{background:#f1b434}.layer-kind-dot.pipe{background:#4dabf7}.layer-kind-dot.street{background:#8b98a5}.layer-kind-dot.boundary{background:#ef5350}.layer-kind-dot.annotation,.layer-kind-dot.street_number{background:#a78bfa}
.map-layer-name{min-width:0}.map-layer-name b,.map-layer-name small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.map-layer-name b{font-size:11px;color:#344054}.map-layer-name small{font-size:9.5px;color:#7b8794;margin-top:2px}
.map-feature-detail{border:1px solid #e2e8f0;border-radius:10px;background:#f8fafc;padding:10px;min-height:72px}.feature-title{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:9px}.map-feature-detail dl{display:grid;grid-template-columns:auto 1fr;gap:5px 10px;margin:0 0 10px;font-size:11px}.map-feature-detail dt{color:#667085}.map-feature-detail dd{margin:0;color:#1f2937;font-weight:600}.warning-text{color:#9a6700;font-size:11px}
.map-hover-tooltip{position:absolute;z-index:8;pointer-events:none;background:#0f172acc;color:#fff;border:1px solid #ffffff24;border-radius:7px;padding:6px 8px;font-size:10px;max-width:260px;box-shadow:0 8px 24px #0005;backdrop-filter:blur(4px)}
.map-node{vector-effect:non-scaling-stroke;stroke:#17202c;stroke-width:1.1;transition:filter .12s ease}.map-node.eligible:hover{filter:brightness(1.2);stroke:#fff;stroke-width:2}.map-node.not-eligible{opacity:.78}.map-node.selected{stroke:#22d3ee!important;stroke-width:3!important;filter:drop-shadow(0 0 5px #22d3ee)}
.map-node-label{pointer-events:none;fill:#fff;font-family:Tahoma,Arial,sans-serif;font-weight:700;text-anchor:start;paint-order:stroke;stroke:#111827;stroke-width:2.8px;stroke-linejoin:round;vector-effect:non-scaling-stroke}
.pipe.map-interactive,.street.map-interactive,.boundary.map-interactive{pointer-events:stroke;cursor:pointer}.pipe.map-interactive:hover{stroke-width:4!important;filter:drop-shadow(0 0 2px #fff8)}
.legend-swatch.not_delivered{height:10px;width:10px;border-radius:50%;background:#f1b434}.legend-swatch.delivered{height:10px;width:10px;border-radius:50%;background:#22a06b}.legend-swatch.changed_after_delivery{height:10px;width:10px;border-radius:50%;background:#e56b35}.legend-swatch.selected{height:10px;width:10px;border-radius:50%;background:#22d3ee;box-shadow:0 0 0 2px #0e7490}
.legend-box{padding-top:2px}.legend-item{white-space:nowrap}
.status.not_delivered{background:#fff3cd;color:#7a5d00}.status.delivered{background:#def7e7;color:#136c35}.status.changed_after_delivery{background:#ffead5;color:#9a4d00}.status.executed{background:#dbeafe;color:#1d4ed8}

@media(max-width:1100px){.cad-side{position:static;max-height:none}.map-basket-bar{align-items:flex-start;flex-direction:column}.map-basket-actions{width:100%}.map-basket-actions button{flex:1}}
@media(max-width:650px){.auth-options{align-items:flex-start;flex-direction:column}.map-basket-codes{max-width:65vw}.map-tools span:last-child{display:none}}
.line-builder-head{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:8px}.line-builder-head small{display:block;color:#667085;margin-top:3px}.basket-title{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:7px}.basket-node-chips{display:flex;gap:5px;flex-wrap:wrap}.stock-low{color:#b42318;font-weight:700}

/* MVP 3.2.0 — Operations, Reports & UX */
.map-page-head{align-items:flex-end}.map-page-head .toolbar-actions{justify-content:flex-end}.cad-admin-panel,.cad-review-collapse{padding:0;overflow:hidden}.cad-admin-panel>summary,.cad-review-collapse>summary,.side-details>summary{list-style:none;cursor:pointer;display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 14px;color:#344054}.cad-admin-panel>summary::-webkit-details-marker,.cad-review-collapse>summary::-webkit-details-marker,.side-details>summary::-webkit-details-marker{display:none}.cad-admin-panel>summary::after,.cad-review-collapse>summary::after,.side-details>summary::after{content:'⌄';font-size:16px;color:#667085}.cad-admin-panel[open]>summary::after,.cad-review-collapse[open]>summary::after,.side-details[open]>summary::after{content:'⌃'}.cad-admin-panel>summary span,.cad-review-collapse>summary span{font-size:11px;font-weight:400;color:#667085}.cad-admin-panel[open]>summary,.cad-review-collapse[open]>summary{border-bottom:1px solid #edf0f4;background:#fafcff}.cad-admin-actions{display:flex;align-items:center;gap:10px;padding:12px 14px}.cad-review-collapse>.panel-head,.cad-review-collapse>.cad-review-toolbar,.cad-review-collapse>.table-scroll{margin:12px 14px}.side-details{border-top:1px solid #edf0f4;margin-top:4px}.side-details>summary{padding:10px 0}.side-details[open]>summary{margin-bottom:8px}.library-grid{align-items:start}.template-line-builder{border:1px solid #dfe5ec;border-radius:10px;padding:10px;background:#fbfdff}.template-add-row{grid-template-columns:minmax(0,1fr) 110px 20px auto}
.report-filter-panel{background:linear-gradient(180deg,#fff,#fbfdff)}.report-filters{display:grid;grid-template-columns:repeat(4,minmax(140px,1fr)) auto;gap:10px;align-items:end}.report-filters .wide-filter{grid-column:span 2}.report-apply{height:40px}.compact-stats{margin-top:12px;margin-bottom:0}.compact-stats .stat{padding:10px 12px}.compact-stats .stat b{font-size:18px}.positive-number{color:#147d42;font-weight:700}.negative-number{color:#b42318;font-weight:700}
#view-contractors #contractorReportBody>.panel{margin-bottom:12px}#contractorSummaryCards .stat:nth-child(5) b{color:#b42318}#contractorSummaryCards .stat:nth-child(6) b{color:#147d42}
@media(max-width:1000px){.report-filters{grid-template-columns:1fr 1fr}.report-filters .wide-filter{grid-column:span 2}.report-apply{grid-column:span 2}.map-page-head{align-items:flex-start;flex-direction:column}}
@media(max-width:620px){.report-filters{grid-template-columns:1fr}.report-filters .wide-filter,.report-apply{grid-column:auto}.cad-admin-panel>summary,.cad-review-collapse>summary{align-items:flex-start;flex-direction:column}.template-add-row{grid-template-columns:1fr 90px}.template-add-row span{display:none}}
@media print{.topbar,.tabs,.toolbar button,.toolbar .file-btn,.report-filter-panel button,.modal,.toast{display:none!important}body{background:#fff}.view{display:none!important}.view.active{display:block!important}main{max-width:none;padding:0}.panel{box-shadow:none;border:1px solid #bbb;break-inside:avoid}.table-scroll{max-height:none;overflow:visible}th{position:static}}
