/* Rezvan Rail v4.6.4 — communications/persistence/UI stabilization */
:root{--rr464-nav:#fff;--rr464-nav-2:#f7f9fc;--rr464-border:#e5eaf1;--rr464-text:#172033;--rr464-muted:#68758a;--rr464-accent:#8a1538}
[data-theme="dark"]{--rr464-nav:#0f151f;--rr464-nav-2:#121925;--rr464-border:#263244;--rr464-text:#f5f7fb;--rr464-muted:#93a0b4}
html,body{max-width:100%;overflow-x:hidden!important}body:not(.tv-page) .layout,body:not(.tv-page) .main,body:not(.tv-page) main,body:not(.tv-page) section,body:not(.tv-page) article{min-width:0;max-width:100%}
/* Never use burgundy/red as the navbar surface. Accent remains available for CTAs only. */
body:not(.tv-page) .department-navbar{background:var(--rr464-nav)!important;color:var(--rr464-text)!important;border-color:var(--rr464-border)!important;overflow:visible!important}
body:not(.tv-page) .navbar-primary{background:var(--rr464-nav)!important;color:var(--rr464-text)!important;border-bottom:1px solid var(--rr464-border)!important;overflow:visible!important}
body:not(.tv-page) .navbar-secondary{background:var(--rr464-nav-2)!important;color:var(--rr464-text)!important;border-bottom:1px solid var(--rr464-border)!important;overflow:visible!important}
body:not(.tv-page) .navbar-brand,body:not(.tv-page) .navbar-brand b,body:not(.tv-page) .navbar-group-button{color:var(--rr464-text)!important}
body:not(.tv-page) .navbar-brand small,body:not(.tv-page) .navbar-primary .user-account-control small{color:var(--rr464-muted)!important}
body:not(.tv-page) .navbar-group-button:hover,body:not(.tv-page) .navbar-group.open .navbar-group-button{background:var(--rr464-nav-2)!important}
body:not(.tv-page) .navbar-icon-button,body:not(.tv-page) .navbar-mobile-toggle{background:var(--rr464-nav-2)!important;border:1px solid var(--rr464-border)!important;color:var(--rr464-text)!important}
body:not(.tv-page) .navbar-primary .connection-pill,body:not(.tv-page) .navbar-primary .user-account-actions button{color:var(--rr464-text)!important;border-color:var(--rr464-border)!important}
body:not(.tv-page) .navbar-primary .user-account-control{color:var(--rr464-text)!important;background:var(--rr464-nav-2)!important;border-color:var(--rr464-border)!important}
body:not(.tv-page) .navbar-dropdown{z-index:5400!important;background:var(--rr464-nav)!important;border-color:var(--rr464-border)!important}
/* Theme control: icons only, centered, no red active slab. */
body:not(.tv-page) .theme-segment{width:84px!important;height:42px!important;display:flex!important;align-items:center!important;justify-content:center!important;gap:4px!important;padding:3px!important;border:1px solid var(--rr464-border)!important;background:var(--rr464-nav-2)!important;border-radius:14px!important;margin:0!important}
body:not(.tv-page) .theme-segment button{width:35px!important;height:34px!important;min-width:35px!important;min-height:34px!important;padding:0!important;display:grid!important;place-items:center!important;border-radius:10px!important;background:transparent!important;color:var(--rr464-muted)!important;box-shadow:none!important}
body:not(.tv-page) .theme-segment button.active{background:var(--rr464-nav)!important;color:var(--rr464-text)!important;box-shadow:0 1px 5px rgba(15,23,42,.10)!important;border:1px solid var(--rr464-border)!important}
body:not(.tv-page) .theme-segment svg{display:block!important;width:18px!important;height:18px!important;margin:auto!important;stroke:currentColor!important;fill:none!important;stroke-width:1.8!important}
/* Global search is an actual compact input popover. */
body:not(.tv-page) .global-search-shell{position:relative!important;z-index:5200!important;width:44px!important;height:44px!important;flex:0 0 44px!important}
body:not(.tv-page) .global-search-shell.open .global-search-trigger{opacity:0!important;pointer-events:none!important;transform:scale(.82)!important}
body:not(.tv-page) .global-search{z-index:5200!important;width:min(430px,calc(100vw - 28px))!important;min-width:300px!important;max-width:430px!important;overflow:hidden!important;background:var(--rr464-nav)!important;border-color:var(--rr464-border)!important}
body:not(.tv-page) .global-search-row{display:grid!important;grid-template-columns:26px minmax(0,1fr) 32px!important;align-items:center!important;gap:8px!important;width:100%!important;min-width:0!important}
body:not(.tv-page) .global-search input#globalSearchInput{display:block!important;visibility:visible!important;opacity:1!important;position:static!important;width:100%!important;max-width:none!important;min-width:0!important;height:42px!important;padding:0 4px!important;color:var(--rr464-text)!important;background:transparent!important;border:0!important;outline:0!important;font-size:13px!important}
body:not(.tv-page) .global-search input#globalSearchInput::placeholder{color:var(--rr464-muted)!important;opacity:.9!important}
/* Every modal is above header/search/dropdowns and owns its scroll. */
body:not(.tv-page) .modal-backdrop{z-index:10000!important;overflow:auto!important;padding:18px!important}
body:not(.tv-page) .modal-backdrop .modal{max-height:calc(100dvh - 36px)!important;overflow:hidden!important;display:flex!important;flex-direction:column!important;min-width:0!important}
body:not(.tv-page) .modal-backdrop .modal>.modal-head{flex:0 0 auto!important}
body:not(.tv-page) .modal-backdrop .modal>form,body:not(.tv-page) .modal-backdrop .modal>.modal-body,body:not(.tv-page) .modal-backdrop .modal>.modal-content{overflow-y:auto!important;overflow-x:hidden!important;min-height:0!important;min-width:0!important}
/* Unified communications */
.rr464-communications-page .main{width:100%!important;max-width:none!important;overflow:hidden!important}
.rr464-communications-shell{width:min(100%,1500px)!important;max-width:100%!important;height:min(780px,calc(100dvh - 156px));min-height:560px;margin:0 auto;display:grid;grid-template-columns:minmax(270px,330px) minmax(0,1fr);gap:14px;overflow:hidden!important}
.rr464-communications-shell>*{min-width:0!important;max-width:100%!important;height:100%;overflow:hidden}
.rr464-communications-sidebar,.rr464-communication-pane{padding:0!important;display:flex!important;flex-direction:column!important;min-height:0!important}
.rr464-communications-sidebar-head{padding:16px;display:flex;align-items:center;justify-content:space-between;gap:8px;border-bottom:1px solid var(--rr464-border)}
.rr464-communications-sidebar-head h2{margin:0;font-size:17px}.rr464-communications-sidebar-head small{color:var(--rr464-muted)}
.rr464-communication-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;padding:9px 12px}.rr464-communication-tabs button{min-width:0;border:0;border-radius:11px;padding:9px 6px;background:var(--rr464-nav-2);color:var(--rr464-muted);cursor:pointer}.rr464-communication-tabs button.active{background:var(--rr464-nav);box-shadow:inset 0 0 0 1px var(--rr464-border);color:var(--rr464-text);font-weight:800}
.rr464-communications-search{padding:0 12px 10px}.rr464-communications-search input{width:100%;min-width:0}
.rr464-communication-list{flex:1;min-height:0;overflow-y:auto!important;overflow-x:hidden!important;padding:0 8px 12px}
.rr464-comm-row{width:100%;max-width:100%;min-width:0;display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:9px;align-items:center;text-align:right;border:0;border-radius:14px;padding:10px;background:transparent;color:inherit;cursor:pointer}.rr464-comm-row:hover,.rr464-comm-row.active{background:var(--rr464-nav-2)}.rr464-comm-row>span:nth-child(2){min-width:0}.rr464-comm-row b,.rr464-comm-row small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rr464-comm-row em{font-style:normal;text-align:left;white-space:nowrap}
.rr464-conversation-active{height:100%;min-height:0;display:flex;flex-direction:column}.rr464-conversation-head{flex:0 0 auto;min-width:0}.rr464-participants{flex:0 0 auto;overflow-x:auto;overflow-y:hidden;max-width:100%}.rr464-messages{flex:1 1 auto;min-height:0;overflow-y:auto!important;overflow-x:hidden!important;padding:16px!important}.rr464-message{max-width:min(78%,720px)!important;min-width:0!important}.rr464-message p{overflow-wrap:anywhere;word-break:break-word}.rr464-files{max-width:100%;min-width:0}.rr464-image{display:block;max-width:min(100%,420px)!important}.rr464-image img{display:block;width:auto!important;height:auto!important;max-width:100%!important;max-height:360px!important;object-fit:contain;border-radius:14px}.rr464-file{max-width:100%;overflow-wrap:anywhere}
.rr464-composer{flex:0 0 auto;max-width:100%;min-width:0}.rr464-compose-row{display:grid!important;grid-template-columns:44px minmax(0,1fr) auto!important;min-width:0}.rr464-compose-row textarea{width:100%!important;min-width:0!important;max-width:100%!important;resize:none}.rr46-attachment-preview{max-width:100%;overflow-x:auto}.rr462-stage-file{max-width:220px}
/* Generic table containment */
body:not(.tv-page) .table-wrap,body:not(.tv-page) .table-scroll,body:not(.tv-page) .rr-table-shell{max-width:100%!important;overflow-x:auto!important;-webkit-overflow-scrolling:touch}
body:not(.tv-page) table{max-width:none}
@media(max-width:840px){
 body:not(.tv-page) .global-search{position:fixed!important;top:76px!important;left:12px!important;right:auto!important;width:min(360px,calc(100vw - 24px))!important;min-width:0!important;max-width:360px!important;max-height:min(42dvh,340px)!important}
 body:not(.tv-page) .modal-backdrop{padding:8px!important;align-items:flex-end!important}
 body:not(.tv-page) .modal-backdrop .modal{width:100%!important;max-width:100%!important;max-height:92dvh!important;border-radius:22px 22px 0 0!important}
 .rr464-communications-page .main{padding-inline:10px!important;padding-bottom:86px!important}
 .rr464-communications-shell{height:calc(100dvh - 158px)!important;min-height:520px!important;display:block!important;position:relative!important;overflow:hidden!important}
 .rr464-communications-sidebar,.rr464-communication-pane{position:absolute!important;inset:0!important;width:100%!important;max-width:100%!important;height:100%!important;transition:transform .24s ease,opacity .2s ease}
 .rr464-communication-pane{transform:translateX(-105%);opacity:0;pointer-events:none}.rr464-conversation-open .rr464-communications-sidebar{transform:translateX(105%);opacity:0;pointer-events:none}.rr464-conversation-open .rr464-communication-pane{transform:translateX(0);opacity:1;pointer-events:auto}
 .rr464-message{max-width:90%!important}.rr464-image{max-width:100%!important}.rr464-image img{max-height:300px!important}
 .rr464-communications-sidebar-head{padding:12px}.rr464-communication-tabs{grid-template-columns:repeat(2,minmax(0,1fr));overflow-x:auto}.rr464-communication-tabs #adminCommTab:not([hidden]){grid-column:1/-1}
}
@media(max-width:390px){.rr464-compose-row{grid-template-columns:40px minmax(0,1fr) 58px!important}.rr464-send{padding-inline:8px!important}.rr464-communications-shell{height:calc(100dvh - 150px)!important}}
@media(prefers-reduced-motion:reduce){.rr464-communications-sidebar,.rr464-communication-pane{transition:none!important}}
