/* Anything.ng polish pass: readable typography, clear states, chat-first ergonomics. */
:root{
  --body-font:'Manrope',system-ui,-apple-system,sans-serif;
  --display-font:'Outfit','Manrope',system-ui,sans-serif;
  --text:#182c22;--muted:#53695e;--border:#d5e2d8;--green:#067b51;
  --panel:#fff;--surface:#fff;--surface2:#f2f7f3;
}
html,body,button,input,textarea,select{font-family:var(--body-font)!important;letter-spacing:-.012em}
h1,h2,h3,h4,.logo,.wallet-card strong,.metric strong,.dashboard-stats strong{font-family:var(--display-font)!important;letter-spacing:-.045em}
h1 em,h2 em,.auth-aside em,.editorial-band em{font-family:'Instrument Serif',Georgia,serif!important;letter-spacing:-.025em}
button,a,input,select,textarea{touch-action:manipulation}
button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible{outline:3px solid #37a777;outline-offset:3px}
/* Closing a modal must be discoverable on both themes. */
.modal-close{display:grid!important;place-items:center!important;width:43px!important;height:43px!important;min-width:43px!important;min-height:43px!important;background:#eff4ef!important;border:2px solid #b9cfc0!important;color:#1a3828!important;font-size:28px!important;font-weight:500!important;line-height:1!important;opacity:1!important;z-index:3!important;box-shadow:0 2px 10px #153b2111}
.modal-close:hover{background:#dfeee3!important;border-color:#4e946d!important}
.modal-card{padding-top:max(30px,2.2rem)}
.toast{z-index:2147483647!important}
.logout-form{display:inline-flex;flex:0 0 auto;margin:0}
.logout-button{color:#275942;background:#eaf4ed;border:1px solid #b9d5c3;border-radius:10px;min-height:39px;padding:0 12px;font-weight:800;font-size:.71rem;white-space:nowrap}
.logout-button:hover{background:#d8eee0;color:#0f5132}
.support-float{width:45px;height:45px;min-height:45px;padding:0!important;border-radius:50%!important;display:grid!important;place-items:center!important;bottom:24px!important;right:17px!important;border:2px solid #e6f5e9!important;background:#097b52!important;color:white!important;z-index:110!important;box-shadow:0 9px 24px #163c2950!important}
.support-float span:first-child{font-size:22px!important;line-height:1}
.support-float span:last-child{display:none!important}
body:has(.inbox-page) .support-float{display:none!important}
.refined-dashboard{max-width:1160px}
.refined-dashboard .welcome{margin-bottom:23px;align-items:center;gap:14px}
.refined-dashboard .welcome h1{font-size:clamp(2rem,4vw,3.25rem);margin-bottom:6px}
.refined-dashboard .welcome p{max-width:570px;font-size:.92rem}
.refined-dashboard .dashboard-quick{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:11px;margin:22px 0 24px}
.dashboard-quick a{display:flex;flex-direction:column;align-items:flex-start;gap:6px;padding:21px 18px;border:1px solid var(--border);border-radius:17px;background:var(--panel);min-height:160px;transition:transform .14s,border-color .14s,box-shadow .14s}
.dashboard-quick a:hover{transform:translateY(-2px);border-color:#73b78e;box-shadow:0 7px 25px #153d2410}
.dashboard-quick a>span{display:grid;place-items:center;width:36px;height:36px;border-radius:11px;background:var(--surface2);color:var(--green);font-size:22px}
.dashboard-quick strong{font-family:var(--display-font);font-size:1rem;letter-spacing:-.035em;color:var(--text)}
.dashboard-quick small{font-size:.72rem;line-height:1.5;color:var(--muted)}
.refined-dashboard .dashboard-stats{gap:12px}
.refined-dashboard .dashboard-stats>div{border:1px solid var(--border);background:var(--panel);border-radius:18px}
.refined-dashboard .panel{border:1px solid var(--border)}
/* Messaging: only the message scroller scrolls, never the header or composer. */
.inbox-page{padding-top:14px;padding-bottom:14px}
.inbox-layout{height:min(82dvh,880px);min-height:490px;border-radius:19px}
.chat-main,.chat-list{min-height:0;overflow:hidden}
.chat-header{position:relative;z-index:2;flex:none;min-height:68px;background:var(--panel)!important;border-bottom:1px solid var(--border);gap:10px}
.chat-header .room-avatar{flex:none}
.chat-header>div{min-width:0;flex:1}
.chat-header>div strong{font-size:.91rem}
.chat-header>div small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-compose{position:relative;z-index:3;flex:none;min-height:67px;display:flex;align-items:end;gap:8px;background:var(--panel)!important;padding:10px 14px calc(10px + env(safe-area-inset-bottom,0px));border-top:1px solid var(--border)}
.chat-compose textarea{flex:1;min-width:0;max-height:140px;background:var(--surface2);color:var(--text);border:1px solid var(--border);line-height:1.5}
.message-scroller{position:relative;flex:1 1 auto;min-height:0;overscroll-behavior:contain;scrollbar-gutter:stable}
.chat-list-head{flex:none}
.chat-rooms{min-height:0;overflow-y:auto}
.chat-room{min-height:70px;align-items:center}
.chat-room .room-avatar{flex:none}
.chat-room-copy{display:flex;flex-direction:column;gap:3px;flex:1;text-align:left;min-width:0}
.support-list-entry{appearance:none;width:100%;border:0;border-bottom:1px solid var(--border);background:var(--panel);color:var(--text);font:inherit;text-align:left;display:flex;gap:12px;cursor:pointer;padding:12px 15px}
.support-list-entry:hover{background:var(--surface2)}
.support-avatar{color:#fff!important;background:#087a55!important;font-size:19px!important}
.support-online-dot{width:9px;height:9px;border-radius:50%;background:#19835a;flex:none}
.voice-state{color:#a52733;font-size:.73rem;font-weight:800;white-space:nowrap;align-self:center}
.voice-cancel,.voice-retry{font-size:.73rem;font-weight:800;flex:none;color:#96303b!important;background:#fff0f0!important;border:1px solid #e4a3a9!important;border-radius:9px;padding:9px!important;width:auto!important;min-width:0!important;height:auto!important}
.voice-retry{color:#145e3b!important;background:#e7f3e9!important;border-color:#8dc1a2!important}
.mic-button.recording{background:#9f1e2f!important;color:#fff!important;box-shadow:0 0 0 4px #c6444b38}
.chat-compose:has(.mic-button.recording) textarea{opacity:.6}
.message-actions{opacity:1!important}
.message-actions button{color:#12623d!important;background:#eaf5ee!important;border:1px solid #a1cdb1!important;font-weight:750}
/* Integration credentials: no existing token value is echoed to HTML. */
.integration-settings{border-top:1px solid var(--border);margin-top:25px;padding-top:24px}
.integration-settings h2{font-size:1.5rem}
.integration-row{display:grid;grid-template-columns:minmax(150px,1.25fr) minmax(160px,1.7fr) minmax(140px,1.15fr) auto;gap:9px;align-items:center;padding:11px 0;border-bottom:1px solid var(--border)}
.integration-row>div{min-width:0}.integration-row strong{display:block;font-size:.73rem;overflow-wrap:anywhere}.integration-row small{display:block;color:var(--muted);font-size:.66rem;margin-top:4px}
.integration-row input,.integration-row select{width:100%;min-width:0;min-height:42px;border:1px solid var(--border);border-radius:10px;background:var(--panel);color:var(--text);padding:9px 10px;font-size:.78rem}
/* Dark palette: no low contrast grey-on-grey, white-background overrides or invisible close icons. */
html[data-theme='dark']{
 color-scheme:dark;--text:#f1f7f2;--muted:#c1d0c5;--green:#91eab0;--border:#445d4c;--panel:#17251e;--surface:#17251e;--surface2:#23382b;--light:#0c1611;--mint:#1b422d;--deep:#d9f5e4;--forest:#113c2a;
}
html[data-theme='dark'] body,html[data-theme='dark'] #page-content,html[data-theme='dark'] .inbox-page{background:#0c1611;color:#f1f7f2}
html[data-theme='dark'] :is(.panel,.dashboard-quick a,.dashboard-stats>div,.auth-form-shell,.admin-page .admin-content,.admin-nav,.chat-room,.chat-list,.chat-main,.chat-header,.chat-compose,.support-list-entry,.modal-card,.filterbar,.big-form,.post-choice,.request-card,.community-card,.community-article,.blog-card,.blog-article,.article-body,.listing-card,.activity-row,.chat-empty,.wallet-usd,.inbox-layout,.table-scroller,.setting-row,.integration-settings,.footer,.topbar,.theme-toggle,.notification-row,.profile-cover){background-color:#17251e!important;color:#f1f7f2!important;border-color:#445d4c!important}
html[data-theme='dark'] :is(.chat-room.active,.chat-room:hover,.support-list-entry:hover,.dashboard-quick a:hover,.post-choice:hover){background-color:#254634!important}
html[data-theme='dark'] :is(.message-scroller,.chat-rooms){background-color:#111f17!important;background-image:none!important}
html[data-theme='dark'] :is(h1,h2,h3,h4,strong,label,th,td,.card-bottom strong,.metric strong,.dashboard-quick strong,.card-title,.form-heading h1,.listing-intro h1,.blog-article h1,.btn-ghost,.modal-card h2){color:#f1f7f2!important}
html[data-theme='dark'] :is(p,small,.subtle,.muted,.mini-hint,.chat-room small,.card-meta,.detail-meta,.request-card p,.activity-row small,.editorial-band p,.auth-helper,.integration-row small){color:#c1d0c5!important}
html[data-theme='dark'] :is(input:not([type='checkbox']):not([type='radio']),textarea,select,.rich-editor,.editor-tools button,.chat-compose textarea){background:#21342a!important;color:#f1f7f2!important;border-color:#63796b!important}
html[data-theme='dark'] :is(input,textarea)::placeholder{color:#c1d0c5!important;opacity:1}
html[data-theme='dark'] :is(.bubble,.bubble:not(.mine)){background:#243b2e!important;border-color:#506c59!important;color:#f1f7f2!important}
html[data-theme='dark'] .bubble.mine{background:#1b6746!important;border-color:#498a69!important;color:#fff!important}
html[data-theme='dark'] .bubble p,html[data-theme='dark'] .bubble .quoted,html[data-theme='dark'] .bubble small{color:#f1f7f2!important}
html[data-theme='dark'] .bubble .quoted,html[data-theme='dark'] .reply-preview{background:#31513c!important;border-color:#8ee2ae!important;color:#f0fff3!important}
html[data-theme='dark'] :is(.btn:not(.btn-ghost),.send-control,.discovery-enter,.mobile-primary){background:#91eab0!important;color:#082919!important;border-color:transparent!important}
html[data-theme='dark'] :is(.btn-ghost,.discovery-pill,.theme-toggle,.logout-button){background:#254432!important;color:#eefcf2!important;border:1px solid #759a7e!important}
html[data-theme='dark'] .btn-ghost:hover,html[data-theme='dark'] .logout-button:hover{background:#315b42!important}
html[data-theme='dark'] .modal-close{background:#345442!important;color:#fff!important;border-color:#9acaac!important;box-shadow:0 0 0 2px #163d25!important}
html[data-theme='dark'] .modal-close:hover{background:#47694f!important;border-color:#d5fbe0!important}
html[data-theme='dark'] :is(.pill.neutral,.notice-banner,.otp-notice,.modal-graphic,.emotion-graphic,.dashboard-quick a>span,.wallet-action,.review-reminder,.table-scroller th,.choice-card,.validation-progress){background:#243c2c!important;color:#effbf2!important;border-color:#55745d!important}
html[data-theme='dark'] .pill.success{background:#16462d!important;color:#b3f2c7!important;border-color:#3c8055!important}
html[data-theme='dark'] .pill.danger,html[data-theme='dark'] .danger-text{color:#ffc4c4!important}
html[data-theme='dark'] :is(.staff-switch,.theme-toggle,.nav-login,.logo,.mainnav a,.footer a,.chat-back){color:#eff9f2!important}
html[data-theme='dark'] :is(.topbar,.footer,.mobile-nav){background:#14251b!important;border-color:#445d4c!important}
html[data-theme='dark'] .mobile-nav a{color:#d5e7d9!important}
html[data-theme='dark'] .mobile-nav .mobile-primary{color:#aaf0bf!important;background:transparent!important}
html[data-theme='dark'] .support-float{background:#1a875a!important;color:#fff!important;border-color:#9be4b5!important}
html[data-theme='dark'] a:focus-visible,html[data-theme='dark'] button:focus-visible,html[data-theme='dark'] input:focus-visible,html[data-theme='dark'] textarea:focus-visible{outline:3px solid #a8ffcb!important;outline-offset:3px}
html[data-theme='dark'] .voice-state{color:#ffb6bf!important}
html[data-theme='dark'] .voice-cancel{background:#5f2931!important;color:#fff!important;border-color:#ec939f!important}
html[data-theme='dark'] :is(.editorial-band,.community-hero){background:#153b28!important}
html[data-theme='dark'] :is(.editorial-band h2,.community-hero h1){color:#f1fff3!important}
@media(max-width:900px){.integration-row{grid-template-columns:1fr 1fr}.integration-row>div{grid-column:1/-1}.integration-row button{grid-column:2;justify-self:end}.dashboard-quick{grid-template-columns:repeat(2,minmax(0,1fr))!important}}
@media(max-width:730px){
 .topbar .nav-actions{gap:4px}.logout-button{min-height:34px;padding:0 8px;font-size:.64rem}
 .refined-dashboard .welcome{align-items:flex-start;flex-direction:column}.refined-dashboard .dashboard-quick{gap:9px;margin:13px 0 20px}
 .dashboard-quick a{min-height:138px;padding:14px 12px}.dashboard-quick strong{font-size:.89rem}.dashboard-quick small{font-size:.66rem}
 .inbox-page{width:100%!important;margin:0!important;padding:0!important}
 .inbox-layout{height:calc(100dvh - 65px - 64px - env(safe-area-inset-bottom,0px))!important;min-height:250px!important;border-radius:0!important;border:0!important}
 .chat-main,.chat-list{height:100%;min-height:0}.chat-header{min-height:57px;flex:none;padding:8px 12px}
 .chat-compose{padding:7px 9px 7px;gap:5px;flex:none;min-height:58px}
 .chat-compose textarea{min-height:42px;max-height:105px;padding:10px 11px}
 .chat-compose .attach-control,.chat-compose .mic-button,.chat-compose .send-control{width:39px;height:39px;flex:none}
 .voice-state{position:absolute;bottom:calc(100% + 6px);right:9px;background:#fff4f3;padding:7px 10px;border-radius:7px;box-shadow:0 5px 10px #0002}
 html[data-theme='dark'] .voice-state{background:#5d2730;color:#fff!important}
 .voice-cancel{padding:7px!important;font-size:.67rem}
 .support-float{bottom:78px!important;right:11px!important;width:43px;height:43px}
 .modal-close{width:42px!important;height:42px!important}
 .chat-room{min-height:66px}
}
@media(max-width:410px){.topbar .nav-actions .avatar{display:none}.topbar .logout-button{font-size:0;padding:0 9px}.topbar .logout-button:after{content:'Exit';font-size:.68rem}}
@media(prefers-reduced-motion:reduce){.dashboard-quick a{transition:none!important;transform:none!important}}

.welcome-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap}
@media(max-width:730px){.welcome-actions{width:100%;justify-content:space-between}.welcome-actions .btn{flex:1}}
