/* FRIENDHUB V9 — progressive UI redesign; leaves custom profile gradients alone */
:root{--fh9-highlight:#ff932e}
html[data-fh-theme=ember],html[data-fh-theme=dark]{--bg:#090b0e;--panel:#17191e;--panel2:#20232a;--line:#383a43;--text:#f6f5f2;--muted:#a6aab5;--accent:#ff932e;--ok:#48d4a4;--danger:#ff7282;color-scheme:dark}
html[data-fh-theme=graphite]{--bg:#111316;--panel:#24262a;--panel2:#303237;--line:#45494e;--text:#f2f3f6;--muted:#b6b7bd;--accent:#8ca9ff;--ok:#84dbbb;--danger:#ffa8b1;color-scheme:dark}
html[data-fh-theme=plum]{--bg:#100d17;--panel:#211a2b;--panel2:#30243d;--line:#51425f;--text:#f6efff;--muted:#bda9c5;--accent:#cb92ff;--ok:#82d7b3;--danger:#ff8eac;color-scheme:dark}
html[data-fh-theme=forest]{--bg:#0c1611;--panel:#17261e;--panel2:#263d2c;--line:#385645;--text:#eff8ee;--muted:#acc8b4;--accent:#8cdea4;--ok:#8cdea4;--danger:#ffaeae;color-scheme:dark}
html[data-fh-theme=ocean]{--bg:#071522;--panel:#122839;--panel2:#20384c;--line:#35586e;--text:#ebf8ff;--muted:#abcbd6;--accent:#74d9fc;--ok:#77dbb8;--danger:#ff9898;color-scheme:dark}
html[data-fh-theme=light]{--bg:#f5f3ef;--panel:#fff;--panel2:#eae7e2;--line:#d4cbc0;--text:#2d2d32;--muted:#646773;--accent:#bd6209;--ok:#198053;--danger:#bd2732;color-scheme:light}
html[data-fh-theme=ember] body,html[data-fh-theme=dark] body,html[data-fh-theme=graphite] body,html[data-fh-theme=plum] body,html[data-fh-theme=forest] body,html[data-fh-theme=ocean] body,html[data-fh-theme=light] body{background:var(--bg);color:var(--text)}
html[data-fh-theme=ember] .panel:not(#profile-card):not(#user-card),html[data-fh-theme=dark] .panel:not(#profile-card):not(#user-card),html[data-fh-theme=graphite] .panel:not(#profile-card):not(#user-card),html[data-fh-theme=plum] .panel:not(#profile-card):not(#user-card),html[data-fh-theme=forest] .panel:not(#profile-card):not(#user-card),html[data-fh-theme=ocean] .panel:not(#profile-card):not(#user-card),html[data-fh-theme=light] .panel:not(#profile-card):not(#user-card){background:var(--panel);border-color:var(--line);color:var(--text)}
.fh9-sticky-side{position:sticky!important;top:0!important;height:100dvh;overflow-y:auto;overscroll-behavior:contain;align-self:start;scrollbar-width:thin;background:var(--panel)}
.side .brand{font-weight:850;letter-spacing:-.5px;color:#fff}.side .brand span{color:var(--accent)}
.nav button.active{border-left:3px solid var(--accent);background:color-mix(in srgb,var(--accent) 12%,transparent)!important}
.main{min-width:0}
/* feed: discussion timeline left, posting composer right */
.fh9-feed-shell{display:grid!important;grid-template-columns:minmax(0,1fr) minmax(260px,330px)!important;gap:18px;align-items:start}
.fh9-feed-shell .community-main{min-width:0;grid-column:1}
.fh9-feed-shell .fh9-feed-aside{grid-column:2;position:sticky;top:15px;align-self:start;display:block!important;padding:0!important;border:0!important;background:transparent!important;min-width:0}
.fh9-feed-shell .fh9-feed-aside .composer{margin:0;padding:15px;display:block!important;background:var(--panel)!important;border:1px solid var(--line)!important;border-radius:16px}
.fh9-feed-shell .post{margin-bottom:12px}
.fh9-drop-target{position:relative;min-width:0}
.fh9-drop-target.fh9-drag-over{outline:2px dashed var(--accent)!important;outline-offset:3px;box-shadow:0 0 0 5px color-mix(in srgb,var(--accent) 20%,transparent)!important}
/* Discord-inspired three-column conversation */
#view-chat .fh9-chat-layout{display:grid!important;grid-template-columns:minmax(180px,230px) minmax(0,1fr) minmax(195px,250px)!important;gap:12px;min-height:calc(100dvh - 155px);align-items:stretch}
#view-chat .fh9-chat-layout>.panel{min-width:0;margin:0;max-width:none!important}
#view-chat .fh9-chat-layout>.panel:nth-child(2){display:flex;flex-direction:column;min-height:520px;overflow:hidden;padding:0}
#view-chat .fh9-chat-layout .conversations{max-height:calc(100dvh - 250px);overflow-y:auto;scrollbar-width:thin}
#view-chat .fh9-chat-layout #messages{flex:1;min-height:340px;height:calc(100dvh - 270px);max-height:calc(100dvh - 210px);overflow-y:auto;overscroll-behavior:contain;padding:14px}
#view-chat .fh9-chat-layout .chat-input{border-top:1px solid var(--line);padding:12px;gap:8px;flex-wrap:wrap}
#view-chat .fh9-chat-layout .chat-input textarea{min-height:54px;max-height:150px;background:var(--panel2);font-size:14px}
#view-chat .fh9-chat-top{display:flex;align-items:center;justify-content:space-between;padding:16px;border-bottom:1px solid var(--line);gap:12px;min-height:70px}
#view-chat .fh9-chat-top h2{margin:0;font-size:17px}
#view-chat #messages .bubble{max-width:min(82%,520px);padding:11px 15px;margin:5px 0;border-radius:16px;box-shadow:0 3px 10px #0002;overflow-wrap:anywhere}
#view-chat #messages .bubble.mine{border-bottom-right-radius:5px;background:color-mix(in srgb,var(--accent) 16%,var(--panel2))}
#view-chat #messages .bubble:not(.mine){border-bottom-left-radius:5px;background:var(--panel2)}
#view-chat #messages .bubble.fh85-new{animation:fh9-chat-enter .25s ease-out}
#view-chat #messages .bubble img{max-width:100%;height:auto;border-radius:12px}
@keyframes fh9-chat-enter{from{opacity:.35;transform:translateY(7px)}to{opacity:1;transform:translateY(0)}}
.fh9-peer{min-width:0;padding:16px!important;display:flex;flex-direction:column;align-items:flex-start;gap:8px;overflow:hidden}
.fh9-peer-banner{height:82px;border-radius:10px;background:linear-gradient(135deg,var(--accent),var(--panel2));width:100%;background-position:center;background-size:cover}
.fh9-peer-avatar{width:78px!important;height:78px!important;object-fit:cover;border:4px solid var(--panel);margin-top:-42px;border-radius:50%}
.fh9-peer h3{margin:3px 0 0;font-size:16px;overflow-wrap:anywhere}
.fh9-peer .fh9-peer-bio{font-size:13px;white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.5}
.fh9-peer-facts{display:flex;flex-direction:column;gap:6px;color:var(--muted);font-size:12px;overflow-wrap:anywhere}
.fh9-peer>button{width:100%;margin-top:8px}
.fh9-mobile-peer-toggle{display:none}
/* settings categories */
.fh9-settings-tabs{display:flex;gap:7px;flex-wrap:wrap;margin:8px 0 16px}
.fh9-settings-tabs button{padding:10px 13px}
.fh9-settings-tabs button[aria-selected=true]{background:var(--accent)!important;color:var(--bg)!important;border-color:var(--accent)!important}
.fh9-settings-panels{max-width:800px;min-width:0}
.fh9-settings-pane{display:grid;gap:13px}
.fh9-settings-pane[hidden]{display:none!important}
.fh9-settings-pane>h2{margin:0}
.fh9-control-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:10px;border:1px solid var(--line);border-radius:10px}
.fh9-control-row input{width:auto;min-width:18px}
.fh9-logout{color:var(--danger)!important;border-color:var(--danger)!important;align-self:flex-start}
/* permanent announcements, separate from temporary notification feed */
.fh9-announcements-section{margin:20px 0}
.fh9-announcements-head{margin:0 0 12px}
.fh9-announcements-head h2{margin:0 0 5px}
.fh9-announcement{margin:10px 0;padding:18px}
.fh9-announcement-meta{font-size:11px;color:var(--accent);text-transform:uppercase;letter-spacing:.4px;margin-bottom:12px}
.fh9-announcement>h3,.fh9-announcement>h4{margin:10px 0 5px}
.fh9-announcement>p{white-space:pre-wrap;margin:4px 0;line-height:1.6;overflow-wrap:anywhere}
.fh9-md-list::before{content:'• ';color:var(--accent)}
.fh9-md-spacer{min-height:8px}
.fh9-announcement-tools{display:flex;gap:8px;flex-wrap:wrap;margin-top:15px;border-top:1px solid var(--line);padding-top:12px}
.fh9-dev-announce textarea{width:100%;max-width:100%;min-height:115px}
.fh9-poll{display:grid;gap:8px;margin:12px 0;border:1px solid var(--line);border-radius:12px;padding:12px;background:var(--panel2)}
.fh9-poll h3{margin:0;font-size:17px}
.fh9-poll-choice{text-align:left;white-space:normal;overflow-wrap:anywhere}
.fh9-poll-choice.selected{border-color:var(--accent)!important;color:var(--accent)!important}
.fh9-timeout-controls{display:grid;grid-template-columns:1fr 130px 1.5fr;gap:8px}
.fh9-timeout-controls input,.fh9-timeout-controls select{min-width:0;width:100%}
.fh9-timeout-row{display:flex;justify-content:space-between;align-items:center;gap:10px;border-bottom:1px solid var(--line);padding:8px}
/* Groups: rules visible, editor full width, posts/polls merged */
#group-detail{min-width:0;--fh9-group-accent:var(--accent)}
#group-detail> .panel:first-child{border-top:3px solid var(--fh9-group-accent)}
#group-detail .fh9-group-style{margin:8px 0;padding:14px}
#group-detail .fh9-group-style h3{margin-top:0}
.fh9-group-rules{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.5}
.fh9-group-rules p{margin:4px 0}
.fh9-group-style-editor{display:grid;gap:8px;margin-top:12px}
.fh9-group-style-editor[hidden]{display:none}
.fh9-group-style-editor input[type=color]{width:94px;height:40px;padding:2px;cursor:pointer}
#fh81-group-style{display:none!important}
#fh81-tab-polls,#fh81-polls{display:none!important}
.fh9-group-posts-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(260px,315px);gap:14px;align-items:start}
.fh9-group-posts-layout #group-post-list{grid-column:1;grid-row:1;min-width:0}
.fh9-group-composers{grid-column:2;grid-row:1;display:grid;gap:12px;position:sticky;top:12px;align-self:start}
.fh9-group-composers>*{min-width:0}
.fh9-poll-compose{display:grid;gap:10px}
.fh9-poll-compose h3{margin:0;font-size:16px}
.fh9-timeline-item{margin:0 0 12px;padding:15px}
.fh9-timeline-item h2{font-size:19px;margin:12px 0 7px}
.fh9-timeline-author{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.fh9-post-text{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.6}
.fh9-poll-label{color:var(--accent)}
.fh9-uploaded-image{display:block;max-width:100%;width:auto;max-height:480px;object-fit:contain;border:1px solid var(--line);border-radius:10px;margin:12px 0;cursor:zoom-in}
.fh9-attach-label{display:flex;gap:7px;flex-direction:column;font-size:12px;color:var(--muted)}
.fh9-attach-label input[type=file]{font-size:12px;max-width:100%}
#group-chat-form.fh9-drop-target{flex-wrap:wrap}
#group-messages .group-msg img.fh9-uploaded-image{max-width:min(100%,400px);margin:5px 0}
/* accessibility */
html[data-fh9-reduce-motion=yes] *,html[data-fh9-reduce-motion=yes] *::before,html[data-fh9-reduce-motion=yes] *::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}
@media(prefers-reduced-motion:reduce){#view-chat .bubble{animation:none!important}}
@media(max-width:1200px){#view-chat .fh9-chat-layout{grid-template-columns:minmax(150px,210px) minmax(0,1fr)!important}#view-chat .fh9-peer{grid-column:1/-1;display:none}#view-chat .fh9-peer.fh9-mobile-open{display:flex}#view-chat .fh9-mobile-peer-toggle{display:block}.fh9-feed-shell{grid-template-columns:minmax(0,1fr) minmax(240px,290px)!important}}
@media(max-width:850px){.fh9-sticky-side{position:static!important;height:auto!important;overflow:visible!important}.fh9-feed-shell{display:flex!important;flex-direction:column-reverse!important}.fh9-feed-shell>*{width:100%}.fh9-feed-shell .fh9-feed-aside{position:static}.fh9-group-posts-layout{display:flex;flex-direction:column-reverse}.fh9-group-posts-layout #group-post-list,.fh9-group-composers{width:100%;position:static}.fh9-group-composers{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}#view-chat .fh9-chat-layout{grid-template-columns:1fr!important;min-height:unset}#view-chat .fh9-chat-layout>.panel:nth-child(1){max-height:150px}#view-chat .fh9-chat-layout>.panel:nth-child(2){min-height:430px}#view-chat .fh9-chat-layout #messages{height:47vh;max-height:65vh}.fh9-timeout-controls{grid-template-columns:1fr}}
@media(max-width:530px){.fh9-group-composers{grid-template-columns:1fr}.fh9-settings-tabs{overflow-x:auto;flex-wrap:nowrap;padding-bottom:8px}.fh9-settings-tabs button{white-space:nowrap}.fh9-timeline-item{padding:12px}.fh9-announcement{padding:12px}.fh9-peer{width:100%}.fh9-chat-top{padding:12px}}
/* Keep themes consistent even if older orange styles used hard-coded colors. */
html[data-fh-theme] .side{background:var(--panel)!important;color:var(--text)!important;border-color:var(--line)!important}
html[data-fh-theme] .nav button{color:var(--text)!important;border-color:transparent}
html[data-fh-theme] .nav button.active{color:var(--accent)!important;border-color:var(--accent)!important;background:color-mix(in srgb,var(--accent) 13%,var(--panel))!important}
html[data-fh-theme] .main input:not([type=checkbox]):not([type=color]):not([type=file]),html[data-fh-theme] .main textarea,html[data-fh-theme] .main select{color:var(--text);background:var(--panel2);border-color:var(--line)}
html[data-fh-theme] .main button.primary{background:var(--accent)!important;border-color:var(--accent)!important;color:var(--bg)!important}
html[data-fh-theme] .main .muted{color:var(--muted)}
@media(max-width:850px){
 html,body{width:100%;max-width:100%;overflow-x:hidden}
 #app.app{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important}
 #app.app>.side,#app.app>.main{box-sizing:border-box!important;width:100%!important;max-width:100vw!important;min-width:0!important}
 #app .nav{display:flex!important;max-width:100%!important;overflow-x:auto!important;overscroll-behavior-x:contain!important}
 #app .main section,#app .main .panel,#app .main .chat-layout{min-width:0;max-width:100%}
 #view-chat .fh9-chat-layout{display:flex!important;flex-direction:column!important;width:100%;gap:10px}
 #view-chat .fh9-chat-layout>.panel{box-sizing:border-box;width:100%;max-width:100%;min-width:0}
 #view-chat .fh9-chat-layout #messages{width:100%;min-width:0;overflow-x:hidden}
 #view-chat .fh9-chat-layout #messages .bubble{max-width:88%;min-width:0}
 #view-chat .fh9-chat-layout .chat-input{min-width:0;max-width:100%}
 #view-chat .fh9-chat-layout .chat-input textarea{width:100%;min-width:0}
}
.fh9-feed-presence{padding:9px 12px;text-align:right}
