/* Mission 006: existing community application, responsive navigation and themes. */
:root{--surface:#fff;--canvas:#f4f7fb;--ink:#142d45;--soft:#edf3f9;--accent:#9a6c13}
body{background:var(--canvas);color:var(--ink)}
.theme-toggle{width:44px;height:44px;min-width:44px;padding:0;border:1px solid var(--line);border-radius:50%;background:var(--surface);color:var(--ink);display:grid;place-items:center;font-size:1.2rem;user-select:none}
.home-welcome{display:flex;align-items:center;gap:1rem;margin-bottom:1.1rem}.home-welcome img{width:54px;height:54px;object-fit:contain;border-radius:50%}.home-welcome p{margin:0;color:var(--muted);font-size:.85rem}.home-welcome h1{font-size:1.35rem;margin:.2rem 0 0;overflow-wrap:anywhere}
.home-intro{background:linear-gradient(130deg,#09233c,#123f5b);padding:1.8rem;border-radius:1.25rem;color:white;margin-bottom:1.3rem;border:1px solid #315976;position:relative;overflow:hidden}.home-intro h2{font-size:clamp(1.6rem,4vw,2.2rem);max-width:22ch;color:#fff;text-wrap:balance}.home-intro p{color:#d6e4f0;margin-bottom:1.2rem}.home-intro .btn{width:100%;max-width:24rem}.home-intro svg{width:22px;height:22px}
.home-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.8rem}.home-card{min-width:0;background:var(--surface);color:var(--ink);border:1px solid var(--line);border-radius:1rem;padding:1.1rem;display:flex;flex-direction:column;align-items:flex-start;gap:.5rem;text-align:start;box-shadow:var(--shadow);min-height:150px}.home-card:hover{border-color:#a3b8ca;transform:translateY(-1px)}.home-card svg{width:25px;height:25px;color:var(--teal)}.home-card strong{font-size:1rem;line-height:1.3}.home-card p{font-size:.84rem;color:var(--muted);margin:0;line-height:1.5}.home-card.future{box-shadow:none;background:var(--soft);cursor:default}.home-card.future:hover{transform:none}.home-card .badge{font-size:.7rem;padding:.15rem .45rem}
.community-details{margin-top:1.2rem;border:1px solid var(--line);border-radius:1rem;padding:1rem;background:var(--surface)}.community-details summary,.message-privacy summary{cursor:pointer;min-height:44px;display:flex;align-items:center;font-weight:650;user-select:none}.community-details .panel{box-shadow:none;border:0;padding:.7rem 0 0;margin:0}.community-details .onboarding ol{grid-template-columns:1fr;gap:.2rem}.community-details .onboarding h2{display:none}.page>footer{font-size:.78rem;margin-top:1.6rem}.page>footer .small{font-size:.75rem}
.communications-switch{padding:.3rem;background:var(--soft);border-radius:.9rem;margin-bottom:1rem;display:grid;grid-template-columns:1fr 1fr;gap:.3rem}.communications-switch .btn{border:0;min-width:0;font-size:.85rem;border-radius:.65rem}.communications-switch .btn.primary{background:var(--surface);color:var(--ink);box-shadow:0 2px 8px #09233c12}.communications-switch .btn.secondary{background:transparent;color:var(--muted)}
.private-messages{padding:1.1rem}.private-messages>.section-head{margin:0 0 .5rem}.private-messages h2{font-size:1.3rem}.message-privacy{background:var(--soft);border-radius:.7rem;padding:.1rem .75rem;margin-bottom:.7rem}.message-privacy p{font-size:.83rem;margin:.5rem 0}.message-optin{font-size:.85rem;min-height:48px}.conversation-layout{display:grid;grid-template-columns:minmax(190px,260px) minmax(0,1fr);gap:1rem}.conversation-directory,.conversation-thread{min-width:0}.conversation-search{font-size:.85rem}.conversation-buttons{display:grid;gap:.45rem;margin-top:.65rem}.conversation-row{display:flex;align-items:center;gap:.65rem;width:100%;text-align:start;padding:.75rem;border:1px solid var(--line);border-radius:.8rem;background:var(--surface);color:var(--ink);min-height:68px}.conversation-row[aria-pressed=true]{background:var(--soft);border-color:#668da4}.conversation-row .person-icon{width:38px;height:38px;font-size:1rem}.conversation-row strong{display:block;overflow-wrap:anywhere;font-size:.9rem}.conversation-row small{font-size:.74rem;color:var(--muted)}.conversation-row .unread-dot{width:9px;height:9px;border-radius:50%;background:#007c71;margin-inline-start:auto;flex:none}.conversation-back{margin-bottom:.6rem}.message-peer-control{font-size:.84rem}.message-peer-control select{font-weight:650}.message-list{max-height:45dvh;min-height:10rem;background:var(--canvas);border-radius:.8rem;padding:.25rem .65rem}.message-item{max-width:90%;padding:.8rem;margin:.65rem 0;background:var(--surface);border-color:var(--line)}.message-item.own{background:var(--soft)}.message-item p{font-size:.87rem;line-height:1.55;margin-bottom:.5rem}.message-item .small{font-size:.71rem}.message-item .btn{font-size:.73rem;min-height:36px;padding:.3rem .5rem}.message-compose{border-top:1px solid var(--line);padding-top:.8rem}.message-compose textarea{min-height:82px;max-height:160px;resize:vertical}.message-compose .actions{margin:.5rem 0}.message-compose [data-message-send]{flex:1;min-height:48px}.message-compose #message-draft-state{font-size:.78rem;color:var(--muted);margin:.45rem 0}.message-tools{margin-top:.5rem}.message-tools summary{min-height:40px;font-size:.8rem;cursor:pointer}.message-tools .actions .btn{font-size:.76rem}.private-messages #message-permission{font-size:.75rem;line-height:1.5;margin:.4rem 0 .6rem;padding:.55rem .7rem}.message-thread-empty{display:grid;place-content:center;min-height:18rem;text-align:center;color:var(--muted);padding:1rem}.conversation-thread[data-selected=false] .message-thread-content{display:none}.conversation-thread[data-selected=true] .message-thread-empty{display:none}
[data-theme=dark]{--surface:#132a3b;--canvas:#091723;--ink:#e7eff6;--soft:#1e394d;--line:#365268;--muted:#b5c7d8;--teal:#75d5cc;--navy:#102d43;--gold:#d7b463;--accent:#f3d48c;--danger:#ffb5bf;--shadow:0 10px 30px #0002;color:var(--ink);background:var(--canvas)}
[data-theme=dark] .topbar,[data-theme=dark] .panel,[data-theme=dark] .card,[data-theme=dark] dialog,[data-theme=dark] .dialog-head{background:var(--surface);color:var(--ink);border-color:var(--line)}
[data-theme=dark] input,[data-theme=dark] textarea,[data-theme=dark] select{background-color:#0e2232;color:var(--ink);border-color:#57748b}[data-theme=dark] label{color:var(--ink)}[data-theme=dark] a{color:#a5d6f7}[data-theme=dark] .btn.secondary,[data-theme=dark] .btn.quiet,[data-theme=dark] .dialog-close{color:var(--ink);background:var(--surface);border-color:var(--line)}[data-theme=dark] .btn.primary{color:#142d45;background:var(--gold);border-color:var(--gold)}[data-theme=dark] .badge,[data-theme=dark] .person-icon,[data-theme=dark] .password-toggle{background:var(--soft);color:var(--ink);border-color:var(--line)}[data-theme=dark] .notice,[data-theme=dark] .install-panel{background:#372d19;color:#f3d7a1;border-color:#7c6537}[data-theme=dark] .notice.info{background:#183b51;color:#d2e9f8;border-color:#567a91}[data-theme=dark] .form-error,[data-theme=dark] .notice.error{background:#44232d;color:#ffc3cd}[data-theme=dark] .eyebrow{color:#ecd095}[data-theme=dark] .empty{background:var(--surface);color:var(--muted)}[data-theme=dark] .avatar{color:var(--ink);background:var(--soft)}[data-theme=dark] .nav-item{color:var(--muted)}[data-theme=dark] .nav-item[aria-current=page]{color:#f3d48c;background:var(--soft)}[data-theme=dark] .onboarding li.complete{color:#8ad8cb}[data-theme=dark] .connection{color:#8ad8cb}[data-theme=dark] .connection.offline{color:#f3d48c}[data-theme=dark] .btn.danger{background:#352330;color:#ffbdc7;border-color:#97546a}
@media(max-width:760px){
 .shell .sidebar,[dir=rtl] .shell .sidebar{position:fixed;inset:auto 0 0!important;top:auto!important;bottom:0!important;width:100%;background:var(--surface);border-top:1px solid var(--line);border-bottom:0;box-shadow:0 -4px 20px #09233c0a;padding-bottom:env(safe-area-inset-bottom,0px);z-index:10}
 .sidebar nav{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));overflow:visible;padding:.25rem .25rem .15rem;gap:0;min-height:66px}
 .sidebar .nav-item{min-width:0;min-height:62px;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:4px;padding:.3rem .15rem;font-size:.64rem;line-height:1.15;text-align:center;white-space:normal;border-radius:.65rem;background:transparent;color:var(--muted);box-shadow:none}
 .sidebar .nav-item svg{width:22px;height:22px}.sidebar .nav-item span{max-width:100%;overflow-wrap:anywhere}.sidebar .nav-item[aria-current=page]{background:var(--soft);color:var(--ink);box-shadow:none}.sidebar .nav-item[data-nav=communications]{color:var(--accent)}
 .sidebar .nav-item[data-nav=proposals],.sidebar .nav-item[data-nav=admin]{display:none}
 .topbar{flex-wrap:nowrap;min-height:64px;padding:.5rem .75rem;background:var(--surface);gap:.5rem}.top-actions{gap:.4rem;flex-wrap:nowrap}.mobile-brand{width:104px;max-width:30vw;object-fit:contain}.language{width:96px;max-width:96px;font-size:.73rem;min-height:40px;padding-inline-start:.4rem;padding-inline-end:22px;background-position:right 6px center}.connection{font-size:.68rem;white-space:nowrap}.connection:before{display:none}.theme-toggle{width:40px;height:40px;min-width:40px}.topbar .avatar{display:none}
 .content,.sidebar+.content{padding-top:var(--header-height,64px)}.shell .page{padding:1.15rem .9rem calc(92px + env(safe-area-inset-bottom,0px))!important}.shell .alert-bar{margin-top:0}.shell .alert-bar+.page{padding-top:1rem!important}
 .home-welcome{gap:.75rem;margin-bottom:1rem}.home-welcome img{width:46px;height:46px}.home-welcome h1{font-size:1.15rem}.home-intro{padding:1.3rem;border-radius:1.1rem}.home-intro h2{font-size:1.75rem;max-width:18ch}.home-intro p{font-size:.88rem;line-height:1.55}.home-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:.65rem}.home-card{padding:.95rem;min-height:145px}.home-card p{font-size:.77rem}.home-card strong{font-size:.88rem}.home-card svg{width:24px;height:24px}
 .conversation-layout{grid-template-columns:minmax(0,1fr)}.conversation-layout.has-peer .conversation-directory{display:none}.conversation-thread[data-selected=false]{display:none}.private-messages{padding:.85rem}.private-messages>.section-head{flex-wrap:nowrap}.private-messages>.section-head h2{font-size:1.2rem}.private-messages>.section-head .btn{font-size:.72rem;padding:.45rem .6rem}.message-list{max-height:43dvh;min-height:12rem}.message-item{max-width:94%}.message-privacy summary{font-size:.8rem}.message-optin{font-size:.8rem}.message-compose textarea{font-size:16px}.message-contact-actions .btn{min-height:40px;font-size:.76rem}.conversation-back{min-height:40px;font-size:.8rem}.communications-switch .btn{font-size:.78rem;padding:.65rem .4rem}
 #toast{bottom:calc(85px + env(safe-area-inset-bottom,0px))}#call-tray{bottom:calc(85px + env(safe-area-inset-bottom,0px))}html{scroll-padding-block:80px 100px}a,button,input,select,textarea{scroll-margin-block:80px 100px}
}
@media(max-width:350px){.topbar{padding-inline:.55rem;gap:.25rem}.mobile-brand{width:84px}.language{width:85px;max-width:85px}.top-actions{gap:.25rem}.theme-toggle{width:36px;height:40px;min-width:36px}.connection{font-size:.6rem}.home-intro h2{font-size:1.55rem}.home-card{padding:.8rem}.home-card strong{font-size:.82rem}}
@media(prefers-reduced-motion:no-preference){.home-card,.btn,.nav-item{transition:background-color .16s ease,border-color .16s ease,transform .16s ease}}

.home-welcome>div{flex:1;min-width:0}.home-profile{flex:none;color:var(--ink)}.home-profile svg{width:22px;height:22px}
@media(max-width:760px){.sidebar .nav-item[data-nav=home]{order:1}.sidebar .nav-item[data-nav=directory]{order:2}.sidebar .nav-item[data-nav=communications]{order:3}.sidebar .nav-item[data-nav=knowledge]{order:4}.sidebar .nav-item[data-nav=space]{order:5}.home-welcome .home-profile{display:grid}}

/* Minimum touch targets, including narrow screens and dark navigation. */
.theme-toggle,.message-item .btn,.message-contact-actions .btn,.conversation-back,.message-tools summary{min-height:44px}.theme-toggle{width:44px;min-width:44px}@media(max-width:760px){.theme-toggle{width:44px;height:44px;min-width:44px}.language{min-height:44px}}

[data-theme=dark] .auth-tab[aria-pressed=true],[data-theme=dark] .auth-tab[aria-selected=true]{color:#f3d48c;border-color:#d7b463}

/* The thread keeps writing and messages close together; privacy remains in the list and thread tools. */
@media(max-width:760px){.private-messages:has(.conversation-layout.has-peer)>.message-privacy,.private-messages:has(.conversation-layout.has-peer)>.message-optin{display:none}.conversation-layout.has-peer .message-peer-control{position:absolute;clip-path:inset(50%);height:1px;width:1px;overflow:hidden}.conversation-layout.has-peer .message-list{max-height:34dvh;margin-block:.65rem}.conversation-back{margin-bottom:.3rem}.private-messages #message-permission{padding:.4rem .6rem;margin:.35rem 0;font-size:.71rem}}

.auth-layout{gap:clamp(1rem,3vw,2rem)}
.auth-layout .hero{
 min-height:0;padding:clamp(1.4rem,3.5vw,3rem);
 background:linear-gradient(142deg,#09233c,#103550);
}
.auth-layout .hero h1{
 max-width:25ch;font-size:clamp(1.8rem,3.55vw,3.45rem);
 line-height:1.13;letter-spacing:-.035em;text-wrap:balance;
}
.auth-layout .hero .subline{margin-top:.3em}
.auth-layout .hero p{max-width:43ch;font-size:1rem;line-height:1.65}
.auth-card{min-width:0;padding:clamp(1.1rem,3vw,2rem)}
.auth-card h2{margin:0 0 1rem;line-height:1.23}
.auth-card .auth-intro{margin:-.25rem 0 1rem}
.auth-card form .field{margin-bottom:.85rem}
.auth-card form input:not([type=checkbox]){min-height:48px;font-size:1rem}
.auth-card form .primary{width:100%;min-height:50px}
.auth-card form .field small{display:block;line-height:1.45;margin-top:.25rem}
.auth-card .auth-foot{display:flex;flex-wrap:wrap;gap:.15rem .6rem;padding-top:.65rem}
.auth-card .auth-foot .btn.quiet{justify-content:flex-start;text-align:start;padding-inline:.25rem}
.auth-card .password-toggle{min-width:44px}
.shell--welcome .sidebar .brand{max-width:100%;object-fit:contain}
.language{max-width:210px}

@media(max-width:760px){
 .shell--welcome .sidebar{display:none}
 .shell--welcome .page{padding-bottom:calc(1.25rem + env(safe-area-inset-bottom,0px))!important}
 .auth-layout .hero{padding:1.35rem;border-radius:1rem}
 .auth-layout .hero h1{font-size:clamp(1.75rem,6.4vw,2.35rem)}
 .auth-layout .hero p{margin-block:.65rem;font-size:.95rem;line-height:1.5}
 .auth-card{padding:1.15rem}
 .auth-card .auth-foot{display:grid;gap:0}
 .auth-card .auth-foot .btn.quiet{width:100%;padding-inline:.25rem;margin:0;min-height:44px}
 .auth-card form input:not([type=checkbox]){font-size:max(16px,1rem)}
 .mobile-brand{width:112px;max-width:35vw}
 .sidebar .nav-item{font-size:clamp(.66rem,2.7vw,.78rem);line-height:1.2}
}
@media(max-width:420px){
 .topbar .connection{font-size:0;flex:none}
 .topbar .connection::before{display:inline-block;width:8px;height:8px;margin:0}
 .language{width:132px;max-width:132px}
}
@media(max-width:350px){.mobile-brand{width:88px}}

.status-control{display:inline-flex;align-items:center;min-height:44px;padding:.45rem .6rem;border:1px solid var(--line);border-radius:.75rem;background:var(--surface);text-align:start}
.topbar .status-control .connection{font-size:.78rem;white-space:normal}
.interface-version{color:var(--muted)}
.sidebar .nav-more{display:none}
@media(max-width:760px){
 .topbar{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:.3rem .65rem}
 .top-actions{display:contents}
 .topbar .status-control{grid-row:1;grid-column:2;justify-self:end;max-width:100%}
 .topbar .status-control .connection:before{flex:none}
 .topbar .theme-toggle{grid-row:1;grid-column:3}
 .topbar .language{grid-row:2;grid-column:1/-1;width:100%;max-width:none;font-size:.89rem;min-height:44px}
 .sidebar nav{grid-template-columns:repeat(6,minmax(0,1fr))}
 .sidebar .nav-more{display:flex;order:6}
 .sidebar .nav-item{font-size:clamp(.64rem,2.2vw,.76rem)}
}
[data-action=retry-service][hidden]{display:none}
@media(max-width:760px){.auth-layout--vault .auth-card{order:-1}}
