/* Administrative correspondence module — isolated from the existing portal styles. */
#correspondence-view{display:block}#correspondence-view[hidden]{display:none!important}.corr-heading-actions{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.corr-stat-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin:0 0 18px}.corr-stat-card{background:rgba(255,255,255,.9);border:1px solid rgba(159,178,197,.65);border-radius:18px;padding:16px 18px;box-shadow:0 10px 30px rgba(23,50,77,.06);display:grid;gap:4px}.corr-stat-card span{font-size:.92rem;color:#5a7187}.corr-stat-card strong{font-size:1.7rem;color:#17324d}.corr-stat-card small{color:#75899b}
.corr-workspace{overflow:visible}.corr-tabs{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:14px;border-bottom:1px solid #dce6f1;padding-bottom:10px}.corr-tabs button{border:0;background:transparent;padding:8px 12px;border-radius:10px;cursor:pointer;color:#50697e}.corr-tabs button.active{background:#eaf5fb;color:#1f70b7;font-weight:700}.corr-tabs .corr-export-action{margin-inline-start:auto;background:#1f70b7;color:#fff;font-weight:700}.corr-tabs .corr-export-action:hover{filter:brightness(.96)}
.corr-filters{display:grid;grid-template-columns:minmax(220px,1fr) 180px auto auto;gap:10px;align-items:center;margin-bottom:14px}.corr-filters input,.corr-filters select{margin:0}.corr-archive-toggle{margin:0;white-space:nowrap;display:flex;align-items:center;gap:6px}
.corr-table td,.corr-table th{vertical-align:middle}.corr-ref{white-space:nowrap;color:#1f70b7}.corr-line{display:block;margin-top:3px}.corr-badge{display:inline-flex;align-items:center;white-space:nowrap;border-radius:999px;padding:4px 9px;font-size:.82rem;font-weight:700;background:#eef3f7;color:#426078}.status-pending{background:#fff4d9;color:#886400}.status-returned{background:#fff0e7;color:#a24e20}.status-approved,.status-completed,.status-sent{background:#e9f7ee;color:#217a45}.status-draft{background:#edf2f6;color:#53697b}.status-archived{background:#eceff2;color:#687786}.priority-urgent{background:#fff0e7;color:#a24e20}.priority-very_urgent{background:#fdebec;color:#a61e28}
.corr-dialog{width:min(860px,calc(100vw - 30px));max-height:90vh;overflow:auto}.corr-detail-dialog{width:min(980px,calc(100vw - 30px))}.corr-org-dialog{width:min(1050px,calc(100vw - 30px))}.corr-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.corr-export-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.corr-dialog textarea{width:100%;resize:vertical}.corr-submit-up{margin-top:14px}
.corr-meta-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-bottom:14px}.corr-meta{border:1px solid #dce6f1;border-radius:12px;padding:10px 12px;background:#f9fbfc;display:grid;gap:3px}.corr-meta span{font-size:.78rem;color:#6c8294}.corr-meta strong{font-size:.95rem;color:#17324d}.corr-detail-card{border-top:1px solid #e2eaf1;padding-top:14px;margin-top:14px}.corr-detail-card h3{margin:0 0 10px}.corr-body-text{white-space:pre-wrap;line-height:1.9;margin:0}.corr-action-buttons{display:flex;gap:8px;flex-wrap:wrap}.corr-attachments{display:grid;gap:8px}.corr-attachment{display:flex;justify-content:space-between;gap:12px;align-items:center;border:1px solid #e0e8ef;border-radius:12px;padding:10px 12px}.corr-attachment-form{display:flex;gap:10px;align-items:center;margin-top:10px;flex-wrap:wrap}
.corr-timeline{position:relative;display:grid;gap:0}.corr-timeline-item{display:grid;grid-template-columns:18px 1fr;gap:10px;position:relative;padding:0 0 18px}.corr-timeline-item:before{content:"";position:absolute;right:7px;top:14px;bottom:-2px;width:2px;background:#dce6f1}.corr-timeline-item:last-child:before{display:none}.corr-timeline-dot{width:10px;height:10px;border-radius:50%;background:#1f70b7;margin-top:5px;z-index:1}.corr-timeline-item p{margin:5px 0;white-space:pre-wrap}.corr-org-toolbar{display:flex;justify-content:space-between;gap:14px;align-items:center;flex-wrap:wrap;margin-bottom:12px}.corr-level-select{min-width:180px}
@media (max-width:900px){.corr-filters{grid-template-columns:1fr 1fr}.corr-export-grid,.corr-meta-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:620px){.corr-stat-grid,.corr-form-grid,.corr-export-grid,.corr-meta-grid,.corr-filters{grid-template-columns:1fr}.corr-heading-actions{width:100%}.corr-heading-actions button{flex:1}.corr-tabs .corr-export-action{margin-inline-start:0}.corr-table th:nth-child(5),.corr-table td:nth-child(5),.corr-table th:nth-child(7),.corr-table td:nth-child(7){display:none}.corr-attachment{align-items:flex-start}.corr-attachment-form input{width:100%}}

.corr-export-step{display:grid;gap:12px}.corr-dispatch-card{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));justify-content:space-between;align-items:center;gap:16px;padding:16px 18px;border:1px solid #b8d8e8;border-radius:14px;background:#f4fbff}.corr-dispatch-card span{color:#60798d}.corr-dispatch-card strong{font-size:1.2rem;color:#123c52;direction:ltr}.corr-export-file-row{display:flex;gap:10px;align-items:center}.corr-export-file-row input{flex:1}.corr-export-attachments{display:grid;gap:8px}.corr-export-attachments .corr-attachments{border:1px solid #e2ebf1;border-radius:12px;padding:10px;min-height:52px;background:#fff}.corr-export-step[hidden]{display:none!important}
@media(max-width:620px){.corr-export-file-row{align-items:stretch;flex-direction:column}}

.corr-export-draft-fields{display:grid;gap:10px;padding:14px 0;border-bottom:1px solid #e3edf2}.corr-export-draft-fields button{justify-self:start}.corr-dispatch-card>div{display:grid;gap:3px}.corr-dispatch-card>div+div{border-inline-start:1px solid #d8e8ef;padding-inline-start:16px}.status-draft{background:#fff6dc;color:#8a6700}
@media(max-width:620px){.corr-dispatch-card{grid-template-columns:1fr}.corr-dispatch-card>div+div{border-inline-start:0;border-top:1px solid #d8e8ef;padding-inline-start:0;padding-top:10px}}

/* v12: correspondence routing and unread notifications */
.correspondence-nav{position:relative}.corr-nav-label{min-width:0}.corr-nav-badge{margin-inline-start:auto;min-width:22px;height:22px;padding:0 6px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;background:#c62828;color:#fff;font-size:.72rem;font-weight:800;line-height:1;box-shadow:0 2px 8px rgba(198,40,40,.22)}.corr-nav-badge[hidden]{display:none!important}
.corr-unread-row{background:rgba(31,112,183,.055)}.corr-unread-row td{font-weight:600}.corr-new-badge{display:inline-flex;margin-inline-start:7px;padding:2px 7px;border-radius:999px;background:#1f70b7;color:#fff;font-size:.7rem;font-weight:800;vertical-align:middle}
.corr-export-conditional{display:grid;gap:8px}.corr-export-conditional[hidden]{display:none!important}#corr-export-party-edit-wrap{display:grid;gap:8px}#corr-export-party-edit-wrap[hidden],#corr-export-destination-wrap[hidden]{display:none!important}
.corr-current-holder{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin:12px 0 2px;padding:11px 14px;border:1px solid #b8d8e8;border-radius:12px;background:#f4fbff;color:#50697e}.corr-current-holder strong{color:#17324d;font-size:1rem}
.corr-route-recipient{display:flex;gap:10px;align-items:center;padding:12px 14px;border:1px solid #dce6f1;border-radius:12px;background:#f9fbfc;margin-bottom:10px}.corr-route-recipient span{color:#6c8294}.corr-route-recipient strong{color:#17324d}.corr-route-note{margin:5px 0 0;color:#53697b;white-space:pre-wrap}.corr-timeline-item strong{line-height:1.7}


/* v13: sidebar consistency + compact three-dot correspondence actions */
.sidebar .correspondence-nav{white-space:nowrap}
.sidebar .correspondence-nav .corr-nav-label{font:inherit;font-size:inherit!important;font-weight:inherit;line-height:inherit;white-space:nowrap;width:auto!important;text-align:inherit!important}
.correspondence-nav.active .corr-nav-label{font-weight:inherit}
.corr-row-actions{display:flex;align-items:center;gap:4px;white-space:nowrap}
.corr-more-menu{position:relative;display:inline-block}
.corr-more-menu>summary{list-style:none;cursor:pointer;display:inline-grid;place-items:center;width:34px;height:32px;border-radius:9px;color:#50697e;font-size:1.25rem;font-weight:700;user-select:none}
.corr-more-menu>summary::-webkit-details-marker{display:none}.corr-more-menu>summary:hover{background:#eef5f8}
.corr-more-menu-popover{position:absolute;z-index:40;inset-inline-end:0;top:calc(100% + 5px);min-width:180px;padding:6px;background:#fff;border:1px solid #dce6f1;border-radius:11px;box-shadow:0 12px 34px rgba(23,50,77,.16)}
.corr-more-menu-popover button{width:100%;text-align:right;background:transparent;border:0;border-radius:8px;padding:9px 10px;font-size:.875rem}.corr-more-menu-popover button:hover{background:#f7f9fc}.corr-more-menu-popover .corr-more-delete{color:#b42318}

/* v15: اختيار عدة مستلمين للصادر الداخلي */
.corr-route-checks{display:grid;gap:10px;margin-top:4px}.corr-route-group{margin:0;padding:10px 12px;border:1px solid var(--line);border-radius:10px}.corr-route-group legend{font-weight:700;color:var(--ink)}.corr-route-group .check-label{margin:6px 0}
