/* PrivateShare 1.7.2 – corrected responsive single-sidebar collaboration workspace.
   All changes are presentational: legacy actions, endpoints, data and login stay in place. */
:root{
 --bg:#0a1020;--sidebar:#111b31;--panel:#131f35;--panel2:#182740;--card:#18243c;
 --border:#2a3a57;--text:#edf3ff;--muted:#a1b0cc;--accent:#758cff;--cyan:#a9b7ff;
 --input:#101b30;--hover:#263755;--shadow:0 14px 42px #040a1e2b;
 --ps-rail:#0b1428;--ps-accent:#667cf8;--ps-accent-soft:#768afa1f;
}
:root[data-theme="light"]{
 --bg:#f4f6fb;--sidebar:#fff;--panel:#fff;--panel2:#f0f3fa;--card:#fff;
 --border:#dfe5f0;--text:#17223d;--muted:#65738d;--accent:#596cdf;--cyan:#596cdf;
 --input:#f5f7fc;--hover:#e9eefb;--shadow:0 12px 32px #273f6b15;
 --ps-rail:#e9edfa;--ps-accent:#5669dd;--ps-accent-soft:#667af01a;
}
#app[hidden]{display:none!important}
/* Application rail + contextual navigation + content, deliberately distinct from third-party products */
#app.app-shell{display:grid;grid-template-columns:284px minmax(0,1fr);width:100%;min-width:0;min-height:100dvh;background:var(--bg)}
#app .ps-app-rail{grid-column:1;grid-row:1;position:sticky;top:0;z-index:35;height:100dvh;min-height:550px;background:var(--ps-rail);border-right:1px solid var(--border);display:flex;flex-direction:column;align-items:center;padding:16px 7px 14px;gap:17px}
#app .ps-rail-brand{width:47px;height:47px;display:grid;place-items:center;border-radius:13px;background:linear-gradient(135deg,#364ab9,#7663f3);box-shadow:0 10px 24px #3a42bc35}
#app .ps-rail-brand img{width:31px;height:31px;filter:brightness(1.7)}
#app .ps-rail-main,#app .ps-rail-bottom{width:100%;display:flex;flex-direction:column;gap:5px;align-items:center}
#app .ps-rail-bottom{margin-top:auto}
#app .ps-rail-link{position:relative;border:1px solid transparent;background:transparent;color:var(--muted);width:66px;min-height:59px;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:5px;border-radius:11px;padding:7px 3px;font-weight:600;letter-spacing:0;box-shadow:none;cursor:pointer;transition:background .15s,color .15s}
#app .ps-rail-link:hover{background:var(--hover);color:var(--text)}
#app .ps-rail-link.active{background:linear-gradient(130deg,#586dd657,#7d79f02f);color:#ecedff;border-color:#8794f62d;box-shadow:inset 3px 0 #8394ff}
:root[data-theme="light"] #app .ps-rail-link.active{color:#334bb7}
#app .ps-rail-link svg{width:21px;height:21px;stroke-width:1.85}
#app .ps-rail-link small{font-size:10px;line-height:1.15;max-width:65px;font-weight:650;overflow-wrap:anywhere;text-align:center}
#app .ps-rail-unread{position:absolute;top:4px;right:7px;width:9px;height:9px;border:2px solid var(--ps-rail);border-radius:50%;background:#f06980}
#app .ps-app-rail [hidden]{display:none!important}
#app .sidebar{grid-column:1;grid-row:1;width:auto;max-width:100%;min-width:0;flex-direction:column;flex:auto;height:100dvh;min-height:0;position:sticky;top:0;padding:20px 14px 14px;background:var(--sidebar);border-right:1px solid var(--border);overflow-y:auto;overscroll-behavior:contain}
#app .sidebar-brand{font-size:1.24rem;margin-bottom:18px;padding:0 8px}
#app .sidebar-brand .brand-logo{width:30px;height:30px}
#app .sidebar-section{margin:18px 12px 9px;font-size:.64rem}
#app .sidebar .nav-link{font-size:.85rem;gap:9px;padding:10px 11px}
#app .sidebar .nav-link svg{width:17px;height:17px}
#app .sidebar .nav-link.active{color:#c6cdff;background:#7184f021;box-shadow:inset 3px 0 #7d90ff}
#app .sidebar-user{margin-top:4px}
#app .sidebar-storage{padding:11px}
#app .main-wrap{grid-column:2;grid-row:1;width:100%;min-width:0;min-height:100dvh;display:flex;flex-direction:column;background:var(--bg)}
#app .topbar{height:69px;min-height:69px;gap:18px;background:var(--sidebar);padding:0 clamp(15px,2vw,32px);border-bottom:1px solid var(--border)}
#app .topbar-left{min-width:0;flex:0 1 auto}#app .topbar-right{gap:8px;min-width:0;flex:0 0 auto}
#app .top-search{max-width:550px;min-width:150px;flex:1 1 240px;border-radius:10px;background:var(--input)}
#app .content{max-width:1720px;width:100%;min-width:0;padding:clamp(18px,2.2vw,30px);margin:0 auto;flex:1}
#app .app-footer{padding:9px 22px;font-size:.67rem;opacity:.75}
#app .page-heading{margin-bottom:19px}#app .page-heading h1{font-size:clamp(1.55rem,2vw,2.05rem)}
#app .page-heading p{font-size:.84rem}
#app .panel{border-radius:12px;background:var(--panel);padding:19px;border-color:var(--border)}
#app .stat{border-radius:12px;padding:17px}#app .stats-grid{gap:12px;margin-bottom:16px}
#app .stat-value{font-size:1.77rem}#app .two-col{gap:14px}
#app .hero{border-radius:13px;min-height:142px;padding:22px 26px;background:radial-gradient(circle at 90% -10%,#6a78ce55,transparent 40%),linear-gradient(115deg,#172c58,#252954 66%,#2b315b)}
#app .hero h2{font-size:1.55rem}#app .hero-art{font-size:72px}
#app .quick-link{padding:13px;border-radius:10px}
#app .table-wrap{border:1px solid var(--border);border-radius:10px}
#app table th{background:var(--panel2);color:var(--muted)}
#app table td{border-bottom-color:var(--border)}
#app .btn.primary{background:linear-gradient(120deg,#4c6dff,#7767eb);color:#fff;border-color:transparent}
#app .nav-link.active{font-weight:750}
/* Chat gets the full width; the real chat room list becomes the contextual second column. */
#app[data-active-page="chat"]{grid-template-columns:284px minmax(0,1fr)}
#app[data-active-page="chat"] .sidebar{display:flex}
#app[data-active-page="chat"] .main-wrap{grid-column:2}
#app[data-active-page="chat"] .content{max-width:none;padding:14px 17px 15px;display:flex;flex-direction:column;min-height:0}
#app[data-active-page="chat"] .page-heading{margin:0 0 10px;min-height:43px;align-items:center}
#app[data-active-page="chat"] .page-heading h1{font-size:1.31rem;margin:0}
#app[data-active-page="chat"] .page-heading p{font-size:.77rem;margin-top:3px}
#app[data-active-page="chat"] .app-footer{display:none}
#app .chat-layout{height:calc(100dvh - 156px);min-height:480px;max-height:none;min-width:0;flex:1;border:1px solid var(--border);border-radius:12px;box-shadow:none;grid-template-columns:minmax(220px,285px) minmax(0,1fr);background:var(--panel);overflow:hidden}
#app .chat-layout.has-room-detail{grid-template-columns:minmax(220px,275px) minmax(0,1fr) 244px}
#app .chat-rooms{background:var(--sidebar);border-right:1px solid var(--border)}
#app .chat-rooms-top{padding:20px 15px 10px}
#app .chat-rooms-top strong{font-size:1.17rem}
#app .chat-rooms-top small{font-size:.73rem}
#app .chat-room-search{border-radius:8px;margin:9px 12px 13px}
#app .chat-room{border:0;border-radius:9px;padding:13px 10px;margin-bottom:3px;gap:11px;min-height:65px}
#app .chat-room.selected{background:linear-gradient(115deg,#5b75e82e,#5d79c11a);box-shadow:inset 3px 0 #8194ff}
#app .chat-room-avatar{border-radius:11px;width:39px;height:39px;background:linear-gradient(145deg,#4c6ee2,#9871e7)}
#app .chat-room-name{font-weight:720;font-size:.9rem}
#app .chat-thread{background:var(--panel)}
#app .chat-thread-header{background:var(--panel);min-height:70px;padding:11px 18px}
#app .chat-thread-avatar{border-radius:11px}
#app .chat-thread-scroll{background:radial-gradient(ellipse at 55% 65%,#5665c208,transparent 60%)}
#app .chat-message{margin-bottom:16px}
#app .chat-bubble{background:var(--panel2);border:1px solid var(--border);border-radius:13px 13px 13px 4px}
#app .chat-message.mine .chat-bubble{background:linear-gradient(115deg,#4656a958,#655cd746);border-color:#7d85d851;border-radius:13px 13px 4px 13px}
#app .chat-compose{padding:12px 16px 10px}
#app .chat-compose-line{border-radius:10px;min-height:50px;background:var(--input)}
#app .chat-send{border-radius:9px}
#app .chat-member-sidepanel{background:var(--sidebar);border-left:1px solid var(--border);padding:23px 17px}
#app .chat-member-sidepanel h3{font-size:1rem}
#app .chat-member-sidepanel .side-member-avatar{border-radius:50%;background:#5670d7}
#app .chat-member-sidepanel .detail-chip{background:#586de12a;color:#b7c6ff}
/* File space: generous document table with original actions visible */
#app[data-active-page="files"] .dropzone{padding:14px;margin-bottom:15px;border-radius:9px}
#app[data-active-page="files"] .dropicon{width:40px;height:40px;border-radius:9px}
#app[data-active-page="files"] .toolbar{margin-bottom:13px}
#app[data-active-page="files"] .panel{padding:18px}
#app[data-active-page="files"] .name-cell{gap:10px}
#app[data-active-page="files"] table td{padding:12px 13px}
/* Fixed visual hierarchy on tablets; native sidebar drawer remains accessible. */
@media(max-width:1450px){
 #app .chat-layout.has-room-detail{grid-template-columns:minmax(210px,268px) minmax(0,1fr)}
 #app .chat-layout.has-room-detail .chat-member-sidepanel{display:none}
 #app .topbar .breadcrumb-top .muted,#app .topbar .breadcrumb-top .slash{display:none}
}
@media(max-width:1150px){
 #app.app-shell{grid-template-columns:250px minmax(0,1fr)}
 #app[data-active-page="chat"]{grid-template-columns:250px minmax(0,1fr)}
 #app .chat-layout{grid-template-columns:minmax(210px,250px) minmax(0,1fr)}
 #app .content{padding:18px}
}

@media(max-width:900px){
 #app.app-shell,#app[data-active-page="chat"]{display:grid;grid-template-columns:minmax(0,1fr)}
 #app .main-wrap,#app[data-active-page="chat"] .main-wrap{grid-column:1;grid-row:1;min-height:100dvh;padding-bottom:68px}
 #app .ps-app-rail{display:flex;grid-column:1;grid-row:2;position:fixed;top:auto;left:0;right:0;bottom:0;height:66px;min-height:0;width:100%;z-index:70;border-right:0;border-top:1px solid var(--border);flex-direction:row;padding:5px 7px;gap:0;justify-content:center}
 #app .ps-rail-brand{display:none}
 #app .ps-rail-main,#app .ps-rail-bottom{display:contents}
 #app .ps-rail-link{width:auto;flex:1;min-width:0;min-height:55px;padding:6px 1px;gap:3px;max-width:108px}
 #app .ps-rail-link small{font-size:9px}
 #app .ps-app-rail .ps-rail-link:nth-of-type(n+5){display:none}
 #app .ps-app-rail .ps-rail-bottom [data-do="logout"]{display:none}
 #app .sidebar,#app[data-active-page="chat"] .sidebar{display:flex;grid-column:auto;position:fixed;left:0;top:0;bottom:0;width:min(280px,88vw);height:100dvh;max-width:88vw;transform:translateX(-108%);transition:transform .18s;z-index:86;box-shadow:0 16px 44px #0005}
 #app .sidebar.open,#app[data-active-page="chat"] .sidebar.open{transform:translateX(0)}
 #app .topbar{height:64px;min-height:64px;padding:0 12px}
 #app .topbar-left{min-width:0}#app .top-search{min-width:110px}
 #app .topbar .logout-topbar{padding:8px 9px}
 #app[data-active-page="chat"] .content{padding:11px 11px 0}
 #app .chat-layout{height:calc(100dvh - 222px);min-height:420px}
 #app .content{padding:15px}
}
@media(max-width:600px){
 #app .topbar{gap:7px}
 #app .topbar .top-search{display:none}
 #app .topbar .breadcrumb-top{font-size:.8rem}
 #app .topbar .topbar-right{gap:4px}
 #app .topbar .icon-button{width:33px;height:34px;border-radius:9px}
 #app .page-heading h1{font-size:1.52rem}
 #app .stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 #app .two-col{grid-template-columns:1fr}
 #app .chat-layout{height:calc(100dvh - 210px);min-height:360px;display:block}
 #app .chat-layout.has-room-detail{display:block}
 #app .chat-layout .chat-member-sidepanel{display:none}
 #app .chat-rooms,#app .chat-thread{height:100%}
 #app .chat-layout.in-room .chat-rooms{display:none}
 #app .chat-layout:not(.in-room) .chat-thread{display:none}
 #app .chat-room{min-height:64px}
 #app .chat-compose{padding:10px}
 #app .app-footer{display:none}
}
@media(prefers-reduced-motion:reduce){#app .ps-rail-link{transition:none}#app .sidebar{transition:none}}

#app .sidebar .nav{gap:3px}
#app .sidebar .nav-link{justify-content:flex-start}

/* 1.7.2: predictable responsive widths, prevent compressed dashboard cells. */
#app .page-heading,#app .hero,#app .stats-grid,#app .two-col,#app .panel,#app .chat-layout{min-width:0}
#app .hero>div:first-child{min-width:0;max-width:640px}
#app .stats-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
#app .stat{min-width:0;overflow-wrap:break-word}
#app .stat .stat-value{overflow-wrap:anywhere}
#app .two-col{grid-template-columns:minmax(0,1.45fr) minmax(280px,1fr)}
#app .topbar{min-width:0}
#app .topbar .breadcrumb-top{white-space:nowrap}
#app .topbar .breadcrumb-top strong{overflow:hidden;text-overflow:ellipsis;max-width:190px}
#app .sidebar .nav-link{width:100%;min-width:0}
#app .sidebar .nav-link.active{border-radius:10px}
#app .sidebar-bottom{margin-top:auto;padding-top:14px}
#app .sidebar-storage .row-between{flex-wrap:wrap}
#app .chat-layout .chat-thread{min-width:0}
@media (max-width:1370px) and (min-width:901px){
 #app .stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 #app .two-col{grid-template-columns:minmax(0,1fr)}
 #app .topbar{gap:10px}
 #app .top-search{flex-basis:170px;min-width:120px}
}
@media (max-width:900px){
 #app .stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 #app .two-col{grid-template-columns:minmax(0,1fr)}
 #app .sidebar,#app[data-active-page="chat"] .sidebar{width:min(284px,88vw);max-width:88vw}
 #app .main-wrap{width:100%}
 #app .ps-app-rail{display:flex}
}
@media (max-width:600px){
 #app .topbar-left{flex:1;min-width:0}
 #app .topbar .breadcrumb-top strong{max-width:145px}
 #app .stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 #app .stat{padding:12px}
 #app .stat-value{font-size:1.5rem}
 #app .hero{padding:18px 20px}
 #app .hero h2{font-size:1.3rem}
 #app .top-search{display:none}
}
@media (max-width:380px){
 #app .stats-grid{grid-template-columns:minmax(0,1fr)}
 #app .topbar-right{gap:2px}
}
@media(min-width:901px){
 #app .ps-app-rail{display:none!important}
}

/* 1.7.2: Exactly one desktop navigation; the old icon rail is mobile-only. */
@media (min-width: 901px) {
  #app .ps-app-rail { display: none !important; }
  #app.app-shell, #app[data-active-page="chat"] { grid-template-columns: 284px minmax(0, 1fr); }
  #app .sidebar { grid-column: 1; display: flex; z-index: 1; }
  #app .main-wrap { grid-column: 2; min-width: 0; }
}
@media (min-width: 901px) and (max-width: 1150px) {
  #app.app-shell, #app[data-active-page="chat"] { grid-template-columns: 250px minmax(0, 1fr); }
}

/* PrivateShare Projects 1.8 – maintain responsive single-sidebar layout */
#app[data-active-page="projects"] .content{max-width:1700px;width:100%;min-width:0}
@media(max-width:900px){#app .ps-app-rail .ps-rail-main [data-page="projects"]{display:flex}}

/* v1.8.1: Only the menu scrolls; current user / logout stay anchored. */
#app .sidebar,#app[data-active-page="chat"] .sidebar{
  display:flex; flex-direction:column; overflow:hidden; padding-bottom:0;
}
#app .sidebar .ps-sidebar-scroll{flex:1 1 auto;min-height:0;min-width:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--border) transparent;padding-bottom:14px;}
#app .sidebar .sidebar-bottom{flex:0 0 auto;margin-top:0;padding:12px 0 max(12px,env(safe-area-inset-bottom));background:var(--sidebar);border-top:1px solid var(--border);position:relative;z-index:2;box-shadow:0 -12px 22px -22px #0009;}
#app .sidebar .sidebar-bottom .sidebar-user{border-top:0;margin-top:0;padding:10px 5px 0;display:flex;align-items:center;gap:9px;min-width:0;}
#app .sidebar .sidebar-bottom .user-text{flex:1;min-width:0;}
#app .sidebar .sidebar-bottom .user-text strong,#app .sidebar .sidebar-bottom .user-text small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
#app .sidebar .sidebar-bottom .sidebar-user .icon-button{flex:none;}
#app .sidebar .sidebar-bottom .sidebar-storage{margin:0 2px;}
@media(max-width:900px){
 #app .sidebar,#app[data-active-page="chat"] .sidebar{overflow:hidden;}
 #app .sidebar .ps-sidebar-scroll{flex:1 1 auto;min-height:0;}
}
