/* AZRA Phase 6 — cross-page token bridge and restrained shared chrome */
:root{--ink:var(--az-bg);--bg:var(--az-bg);--panel:var(--az-surface);--surface:var(--az-surface);--surface2:var(--az-surface-2);--surface-2:var(--az-surface-2);--surface-3:var(--az-surface-3);--raise:var(--az-surface-2);--raise2:var(--az-surface-3);--line:var(--az-line);--line2:var(--az-line-strong);--text:var(--az-text);--mut:var(--az-mut);--muted:var(--az-mut);--muted2:var(--az-dim);--dim:var(--az-dim);--y:var(--az-primary);--y2:var(--az-primary-hover);--yellow:var(--az-primary);--yellow2:var(--az-primary-hover);--gold:var(--az-primary);--gold2:var(--az-primary-hover);--accent:var(--az-primary);--accent-gold:var(--az-primary);--border-gold-hover:var(--az-primary-line);--y-line:var(--az-primary-line);--good:var(--az-green);--green:var(--az-green);--bad:var(--az-red);--red:var(--az-red);--radius:var(--az-radius-lg);--font:var(--az-font-ui);}
html{background:var(--az-bg);color:var(--az-text);color-scheme:dark;scrollbar-color:var(--az-scroll-thumb) transparent}
html[ data-theme="light" ]{color-scheme:light}
body{font-family:var(--az-font-ui,var(--font,system-ui));}
:where(button,a,input,select,textarea,[tabindex]):focus-visible{outline:2px solid var(--az-focus,#FFD500);outline-offset:3px}
:where(button,a){-webkit-tap-highlight-color:transparent}
html[data-motion="reduce"] *,html[data-motion="reduce"] *::before,html[data-motion="reduce"] *::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
/* Legacy standalone language pickers are intentionally hidden: account language is changed in Settings. */
.azra-legacy-lang,.lang-switch,.language-switch,.ai-lang,.az-lang{display:none!important}


/* Cross-product theme bridge: legacy page variables resolve through AZRA tokens. */
html[data-theme="light"]{color-scheme:light}
html[data-theme="light"] body{background:var(--az-bg)!important;color:var(--az-text)!important}
html[data-theme="light"] :where(.ws-top,.ws-card,.ws-panel,.ws-section,.ws-modal,.ws-dialog,.ws-side,.ws-nav,.ws-toolbar,.ws-empty,.ws-stat,.ws-widget,.ws-project-card,.ws-file-card,.ws-table-wrap,.ws-search,.ws-filter){background-color:var(--az-surface)!important;color:var(--az-text)!important;border-color:var(--az-line)!important;box-shadow:var(--az-shadow-1)}
html[data-theme="light"] :where(.ws-backdrop,.ambient,.ambient-one,.ambient-two,.grain){opacity:.12}
html[data-theme="light"] :where(.ws-muted,.muted,.ws-subtitle,.ws-help,.ws-meta,.ai-subtitle,.ai-muted,.section-description){color:var(--az-mut)!important}
html[data-theme="light"] :where(.topbar,.top,.ai-header,.azn-header,.page-header){background:rgba(255,255,255,.88)!important;color:var(--az-text)!important;border-color:var(--az-line)!important;backdrop-filter:blur(18px)}
html[data-theme="light"] :where(.panel,.card,.ai-panel,.section-panel,.membership-state,.orders-list,.domain-summary,.faq-list details,.checkout-drawer,.drawer-body,.help-strip,.key-card,.stat,.notice,.status-card){background:var(--az-surface)!important;color:var(--az-text)!important;border-color:var(--az-line)!important;box-shadow:var(--az-shadow-1)}
html[data-theme="light"] :where(input,select,textarea,.field-input,.form-control){background:var(--az-surface-2)!important;color:var(--az-text)!important;border-color:var(--az-line-strong)!important}
html[data-theme="light"] :where(input,select,textarea)::placeholder{color:var(--az-dim)!important}
html[data-theme="light"] :where(.primary,.submit-btn,.ai-primary-link,.ai-send,.ws-primary){color:#111!important}
html[data-theme="light"] :where(.ai-app,.ai-main,.ai-side,.ai-scroll,.ai-composer-wrap,.ai-composer,.ai-top,.ai-thread){background:var(--az-bg)!important;color:var(--az-text)!important}
html[data-theme="light"] .ai-side{border-color:var(--az-line)!important}
html[data-theme="light"] :where(.ai-history button,.ai-new,.ai-icon,.ai-pill,.ai-modes button,.ai-tile,.ai-modal-card,.ai-gate-card,.ai-message.ai-assistant .ai-body,.ai-avatar){background:var(--az-surface)!important;color:var(--az-text)!important;border-color:var(--az-line)!important}
html[data-theme="light"] .ai-message.ai-user .ai-body{background:var(--az-primary)!important;color:#111!important}
html[data-theme="light"] .ai-box{background:var(--az-surface)!important;border-color:var(--az-line-strong)!important}
html[data-theme="light"] .ai-box textarea{background:transparent!important;color:var(--az-text)!important}
html[data-theme="light"] .ai-foot{color:var(--az-mut)!important}
html[data-theme="light"] .ai-code{background:var(--az-code-bg)!important;border-color:var(--az-line)!important}
html[data-theme="light"] :where(.ai-top-title,.ai-side-foot a,.ai-history button:hover){color:var(--az-text)!important}
html[data-theme="light"] :where(.ai-empty p,.ai-modal-sub,.ai-quota){color:var(--az-mut)!important}

/* Mobile AI navigation: compact floating capsule above the safe area. */
.ai-phase6-dock{position:fixed;z-index:80;inset-inline-end:24px;bottom:22px;display:flex;align-items:center;justify-content:center;gap:4px;width:max-content;max-width:calc(100vw - 24px);padding:6px;border:1px solid var(--az-line-strong);border-radius:999px;background:var(--az-dock-bg);color:var(--az-text);box-shadow:var(--az-shadow-3);backdrop-filter:blur(22px) saturate(1.3);-webkit-backdrop-filter:blur(22px) saturate(1.3)}
@media(max-width:760px){
  .ai-phase6-dock{left:50%;right:auto;inset-inline-end:auto;bottom:calc(10px + env(safe-area-inset-bottom,0px));transform:translateX(-50%)}
  .ai-phase6-dock a{display:flex;align-items:center;justify-content:center;gap:7px;min-width:42px;height:42px;padding:0 12px;border-radius:999px;color:var(--az-mut);font:600 11px/1 var(--az-font-ui);white-space:nowrap;transition:background var(--az-dur-2) var(--az-spring),color var(--az-dur-2),transform var(--az-dur-1)}
  .ai-phase6-dock a svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex:none}
  .ai-phase6-dock a[aria-current="page"]{background:var(--az-dock-active-bg);color:var(--az-dock-active-fg);box-shadow:var(--az-shadow-1)}
  .ai-phase6-dock a:active{transform:scale(.94)}
  .ai-app{padding-bottom:calc(58px + env(safe-area-inset-bottom,0px))}
  .ai-composer-wrap{padding-bottom:calc(68px + env(safe-area-inset-bottom,0px))!important}
}
@media(max-width:380px){.ai-phase6-dock a{min-width:38px;padding-inline:9px}.ai-phase6-dock a span{font-size:10px}}
@media(prefers-reduced-motion:reduce){.ai-phase6-dock a{transition:none!important}}

/* Room and Auth surfaces inherit the same canvas without altering their content. */
html[data-theme="light"] #loader,
html[data-theme="light"] .auth-shell,
html[data-theme="light"] .auth-card,
html[data-theme="light"] .auth-panel,
html[data-theme="light"] .auth-form-card,
html[data-theme="light"] .auth-side-card{background:var(--az-surface)!important;color:var(--az-text)!important;border-color:var(--az-line)!important}
html[data-theme="light"] #scene-canvas{filter:saturate(.82)}
html[data-theme="light"] :where(.hud,.room-panel,.room-card,.room-modal,.room-drawer){color:var(--az-text)}
html[data-theme="light"] :where(.auth-page,.auth-main,.auth-wrap){background:var(--az-bg)!important;color:var(--az-text)!important}
html[data-theme="light"] :where(.auth-input,.auth-form input,.auth-form select,.auth-form textarea){background:var(--az-surface-2)!important;color:var(--az-text)!important;border-color:var(--az-line-strong)!important}

/* Keep the dock clear of the keyboard, composer and browser safe area. */
@supports (padding:max(0px)) {
  .ai-phase6-dock{bottom:max(10px,env(safe-area-inset-bottom))}
}

/* AI chat visual system: distinct speaker bubbles, readable evidence and controls. */
.ai-q-bubble{background:var(--az-primary)!important;color:#111!important;border-color:var(--az-primary-line)!important;font-weight:600}
.ai-a-body{padding:18px 20px;border:1px solid var(--az-line);border-radius:20px;border-start-start-radius:7px;background:var(--az-surface);box-shadow:var(--az-shadow-1)}
.ai-avatar{background:var(--az-surface-2)!important;border-color:var(--az-primary-line)!important}
.ai-jump{background:var(--az-surface)!important;color:var(--az-text)!important;border-color:var(--az-line-strong)!important}
.ai-composer-wrap{background:linear-gradient(180deg,transparent,var(--az-bg) 28%)!important}
.ai-box{background:var(--az-surface)!important;border-color:var(--az-line-strong)!important;box-shadow:var(--az-shadow-2),inset 0 1px 0 rgba(255,255,255,.035)!important}
.ai-box textarea{color:var(--az-text)!important}
.ai-mode[aria-pressed=true],.ai-send,.ai-new,.ai-btn:not(.ai-btn-ghost){background:var(--az-primary)!important;color:#111!important}
.ai-mode[aria-pressed=true]{border-color:var(--az-primary)!important}
.ai-think-bars i{background:linear-gradient(90deg,var(--az-skeleton-a) 25%,var(--az-skeleton-b) 45%,var(--az-skeleton-a) 65%)!important}
html[data-theme="light"] .ai-a-body{background:#fff!important;border-color:var(--az-line)!important;color:var(--az-text)!important}
html[data-theme="light"] .ai-ai-message,html[data-theme="light"] .ai-a-body :where(p,li,blockquote){color:var(--az-text)!important}
html[data-theme="light"] .ai-history .ai-hitem[aria-current=true]{background:var(--az-primary-soft)!important;color:var(--az-text)!important}
html[data-theme="light"] .ai-composer-wrap{background:linear-gradient(180deg,transparent,var(--az-bg) 28%)!important}
html[data-theme="light"] .ai-jump{background:#fff!important;color:var(--az-text)!important}

@media(max-width:760px){.us-shell{padding-bottom:calc(82px + env(safe-area-inset-bottom,0px))}}
.ai-phase6-dock a span{display:none}
.ai-phase6-dock a[aria-current="page"] span{display:inline}
