/* 360 identity layer for the workspace pages: site tokens, Inter, readable type */
:root {
  --desk-paper: #f8fafc;
  --desk-surface: #ffffff;
  --desk-ink: #111827;
  --desk-muted: #6b7280;
  --desk-line: rgba(15, 23, 42, .10);
  --desk-blue: #3b82f6;
  --desk-blue-soft: rgba(59, 130, 246, .12);
  --desk-orange: #0ea5e9;
  --desk-navy: #0b0f19;
  --desk-shadow: 0 10px 34px rgba(15, 23, 42, .08);
  --desk-radius: 14px;
}
body.dark {
  --desk-paper: #0b0f19;
  --desk-surface: #111827;
  --desk-ink: #f8fafc;
  --desk-muted: rgba(248, 250, 252, .55);
  --desk-line: rgba(248, 250, 252, .13);
  --desk-blue-soft: rgba(59, 130, 246, .18);
  --desk-navy: #070a12;
}
body.ai-page, body.desk-body {
  max-width: none; margin: 0; padding: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}
body.ai-page h2 { background: none; -webkit-text-fill-color: currentColor; margin-bottom: 0; }
.desk-mark span, .ai-welcome h2, .welcome-card strong, .welcome-card-icon, #ai-input,
.desk-topbar-heading h1, .desk-topbar-heading h2 { font-family: inherit; }
.desk-mark { background: var(--a, #3b82f6); box-shadow: 0 7px 18px rgba(59, 130, 246, .26); }
.desk-rail-link.active { background: var(--desk-surface); color: var(--a, #3b82f6); }
.desk-rail-link.active::after { background: var(--a, #3b82f6); }
.ai-welcome { padding: 15px 24px 25px; }
.ai-welcome h2 { color: var(--desk-ink); font-weight: 700; font-size: clamp(30px, 3.6vw, 44px); line-height: 1.12; letter-spacing: -.03em; }
.ai-welcome > p { color: var(--desk-muted); font-size: 15px; }
.welcome-card { border-color: var(--desk-line); background: var(--desk-surface); border-radius: 12px; }
.welcome-card:hover { border-color: var(--a, #3b82f6); box-shadow: 0 8px 22px rgba(59, 130, 246, .10); }
.build-card .welcome-card-icon, .learn-card .welcome-card-icon, .research-card .welcome-card-icon, .untangle-card .welcome-card-icon { background: var(--desk-blue-soft); color: var(--a, #3b82f6); }
.welcome-card strong { color: var(--desk-ink); font-size: 14px; font-weight: 600; }
.welcome-card small { color: var(--desk-muted); }
.welcome-spark { background: var(--desk-navy); color: #fff; }
.welcome-dot { background: var(--a, #3b82f6); }
.ai-shell { background: var(--desk-paper); }
.ai-shell::after { display: none; }
#ai-input { color: var(--desk-ink); font: 15px/1.6 Inter, system-ui, sans-serif; }
.ai-bubble.assistant .bubble-inner, .ai-bubble.user .bubble-inner { font-size: 15px; line-height: 1.7; color: var(--desk-ink); }
.ai-composer-card { border-color: var(--desk-line); background: var(--desk-surface); }
.ai-composer-card:focus-within { border-color: var(--a, #3b82f6); box-shadow: 0 0 0 3px rgba(59, 130, 246, .12); }
#ai-send-btn { background: var(--a, #3b82f6); }
.connector-trigger.active, .history-trigger:hover { border-color: var(--a, #3b82f6); background: var(--desk-blue-soft); color: var(--a, #3b82f6); }
.ai-status-pip { background: #3ecf8e; box-shadow: 0 0 0 3px rgba(62, 207, 142, .18); }
#admin-badge{font-size:11px}
.connector-trigger{font-size:12px}
.history-trigger{font-size:12px}
.ai-topbar-model{font-size:12px}
.ai-usage-meter{font-size:12px}
.conv-title-label{font-size:12px}
.title-bar-label{font-size:11px}
.welcome-micro{font-size:12px}
.welcome-card small{font-size:12px}
.welcome-bottom-line{font-size:12px}
.model-picker-chip, .research-toggle{font-size:12px}
.composer-key-hint{font-size:12px}
.ai-input-foot{font-size:11px}
.ai-file-preview{font-size:12px}
.mcp-context-bar{font-size:12px}
.ai-bubble.assistant .bubble-inner table{font-size:13px}
.ai-bubble .attached-file-link{font-size:12px}
.code-block-header{font-size:12px}
.code-copy-btn, .code-download-btn{font-size:12px}
.ai-thinking-toggle, .ai-tools-toggle{font-size:12px}
.drawer-overline{font-size:11px}
.new-thread-button{font-size:12px}
.new-thread-button kbd{font-size:12px}
.history-search-wrap input{font-size:12px}
.history-section-label{font-size:11px}
.conv-item{font-size:12px}
.conv-empty{font-size:12px}
.history-drawer-foot{font-size:12px}
.ai-settings-heading p{font-size:13px}
.ai-setting-model strong, .ai-setting-toggle strong{font-size:13px}
.ai-setting-model small, .ai-setting-toggle small{font-size:12px}
.ai-setting-model > span:last-child{font-size:12px}
.ai-settings-note{font-size:12px}
.ai-profile-menu .desk-menu-button{font-size:13px}
#model-search-row input{font-size:13px}
.model-tab{font-size:12px}
.model-row-name{font-size:13px}
.model-row-id{font-size:12px}
.model-empty{font-size:12px}
.ai-toast{font-size:12px}
.ai-confirm-msg{font-size:13px}
.ai-confirm-actions button{font-size:12px}
.stock-prompt-chip{font-size:12px}
.desk-rail-link span{font-size:12px}
.desk-rail-caption{font-size:11px}
.desk-breadcrumb{font-size:12px}
.desk-topbar-heading p{font-size:13px}
.desk-live{font-size:13px}
.desk-profile-copy strong{font-size:13px}
.desk-profile-copy small{font-size:12px}
.desk-profile-menu-head small{font-size:12px}
.module-overline{font-size:12px}
.quiet-footer{font-size:12px}
.section-eyebrow{font-size:12px}
.status-ribbon{font-size:13px}
.status-ribbon > span:last-child{font-size:12px}
.plugin-row p{font-size:13px}
.plugin-state{font-size:12px}
.tool-eyebrow{font-size:12px}
.tool-kicker{font-size:13px}
.tool-tab{font-size:13px}
.tool-button{font-size:13px}
.tool-pill{font-size:12px}
.tool-status{font-size:12px}
.tool-result-meta{font-size:12px}
.tool-result p{font-size:13px}
.tool-tag{font-size:12px}
.tool-empty{font-size:13px}
.tool-disclaimer{font-size:12px}
.library-private-mark small{font-size:12px}
.upload-copy p{font-size:13px}
.upload-copy small{font-size:12px}
.dropzone-action{font-size:12px}
.dropzone-caption{font-size:12px}
.quiet-button{font-size:12px}
.library-file-name{font-size:13px}
.library-file-meta{font-size:12px}
.library-file-actions button{font-size:12px}
.health-stamp span{font-size:11px}
.health-stamp small{font-size:12px}
.stock-change{font-size:13px}
.scholar-badge span{font-size:11px}
.scholar-badge small{font-size:12px}
body.desk-body .desk-topbar-heading p{font-size:13px}
.ai-bubble.assistant .bubble-inner table { font-size: 13px; }
@media (max-width: 760px) {
  .ai-input-foot, .research-toggle { font-size: 11px; }
  .ai-bubble.assistant .bubble-inner, .ai-bubble.user .bubble-inner { font-size: 15px; }
  .ai-welcome > p { font-size: 14px; }
  .welcome-card strong { font-size: 14px; }
  .welcome-card small { font-size: 12px; }
  .ai-settings-heading p { font-size: 12px; }
}

.ai-bubble, .ai-bubble.user, .ai-bubble.assistant { box-sizing: border-box; width: 100%; max-width: 820px; margin-left: auto; margin-right: auto; padding-top: 0; padding-bottom: 0; padding-right: 0; border-radius: 0; background: none; color: inherit; line-height: inherit; font-size: inherit; }
.ai-bubble.user { padding-left: 10%; margin-left: auto; }
.ai-bubble.assistant { padding-right: 2%; }
.ai-bubble.user .bubble-inner { background: var(--desk-blue-soft); border-color: rgba(59, 130, 246, .25); color: var(--desk-ink); border-radius: 16px 16px 4px 16px; }
#ai-input { border-radius: 0; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; }
#ai-output, body.dark #ai-output { background: transparent; }
.ai-output { padding-top: 60px; }
.ai-conv-title-bar { top: 16px; }
.ai-bubble.assistant .bubble-inner a { color: var(--a, #3b82f6); text-decoration-color: rgba(59, 130, 246, .4); }
.ai-bubble.assistant .bubble-inner h1, .ai-bubble.assistant .bubble-inner h2, .ai-bubble.assistant .bubble-inner h3 { font-family: inherit; color: var(--desk-ink); }

/* Light mode: light sidebar rail (dark rail only in dark mode) */
body.desk-body:not(.dark) .desk-rail { background: #fff; color: #5b6678; border-right: 1px solid var(--desk-line); box-shadow: 3px 0 18px rgba(16,32,52,.05); }
body.desk-body:not(.dark) .desk-rail-link:hover, body.desk-body:not(.dark) .desk-rail-home:hover { background: rgba(15,23,42,.06); color: var(--desk-ink); }
body.desk-body:not(.dark) .desk-rail-link.active { background: var(--desk-blue-soft); color: var(--a, #3b82f6); box-shadow: none; }
body.desk-body:not(.dark) .desk-rail-rule { background: var(--desk-line); }
body.desk-body:not(.dark) .desk-rail-caption { color: var(--desk-muted); }
body.desk-body:not(.dark) .desk-rail .desk-menu-trigger.sidebar-toggle { border-color: var(--desk-line); background: rgba(15,23,42,.04); color: var(--desk-ink); }
body.desk-body:not(.dark) .desk-rail .desk-menu-trigger:hover { background: rgba(15,23,42,.08); color: var(--desk-ink); }

/* ===== AI page v2: topbar layout, full-height chat, slim composer, glass ===== */
body.ai-page .ai-topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
body.ai-page .ai-topbar .history-trigger { justify-self: start; }
body.ai-page .ai-topbar .desk-topbar-heading { text-align: center; justify-self: center; min-width: 0; max-width: 46vw; }
body.ai-page .ai-topbar .desk-topbar-actions { justify-self: end; }
body.ai-page .ai-conv-title-bar { position: static; transform: none; max-width: 100%; justify-content: center; margin-top: 2px; opacity: 0; min-height: 15px; transition: opacity .18s; }
body.ai-page .ai-conv-title-bar.show { opacity: 1; transform: none; }
body.ai-page .conv-title-label { font-size: 12px; font-weight: 600; color: var(--desk-muted); }

/* chat stretches to the bottom; composer floats on top of it */
body.ai-page .ai-main { position: relative; }
body.ai-page .ai-output { position: absolute; inset: 0; padding-bottom: 130px; }
body.ai-page .ai-input-area { position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; padding: 0 0 10px; pointer-events: none; }
body.ai-page .ai-input-area > * { pointer-events: auto; }
body.ai-page .ai-input-foot { margin-top: 5px; justify-content: center; font-size: 11px; opacity: .75; }
body.ai-page #ai-input { min-height: 40px; padding: 12px 16px 2px; }
body.ai-page .composer-toolbar { padding: 3px 8px 8px; }
body.ai-page .composer-icon-btn { width: 30px; height: 30px; border-radius: 9px; }
body.ai-page .model-picker-chip, body.ai-page .research-toggle { min-height: 30px; padding: 5px 9px; }
body.ai-page .composer-key-hint { display: none; }
body.ai-page #ai-send-btn { width: 32px; height: 32px; border-radius: 50%; background: var(--a, var(--desk-blue)); box-shadow: 0 3px 10px rgba(59,130,246,.3); }
body.ai-page #ai-send-btn:hover { background: var(--a, var(--desk-blue)); filter: brightness(1.1); transform: scale(1.06); }
body.ai-page #ai-send-btn svg { width: 16px; height: 16px; }

/* loading logo: three dots swelling at different paces = wave */
.thinking { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 2px 0; }
.thinking span { display: block; width: 9px; height: 9px; border-radius: 50%; background: var(--a, #3b82f6); animation: dotWave 1s ease-in-out infinite; }
.thinking span:nth-child(1) { animation-duration: .8s; }
.thinking span:nth-child(2) { animation-duration: 1.1s; animation-delay: .15s; background: color-mix(in srgb, var(--a, #3b82f6) 75%, #0ea5e9); }
.thinking span:nth-child(3) { animation-duration: 1.4s; animation-delay: .3s; background: color-mix(in srgb, var(--a, #3b82f6) 55%, #0ea5e9); }
@keyframes dotWave { 0%,100% { transform: scale(.45) translateY(0); opacity: .45; } 50% { transform: scale(1.35) translateY(-4px); opacity: 1; } }

/* glass morphism (text stays dark/high-contrast in light mode, light in dark) */
body.ai-page { background-color: var(--desk-paper); background-image: radial-gradient(520px 420px at 12% 18%, rgba(59,130,246,.30), transparent 70%), radial-gradient(560px 460px at 88% 12%, rgba(14,165,233,.26), transparent 70%), radial-gradient(620px 520px at 70% 92%, rgba(168,85,247,.20), transparent 70%); background-attachment: fixed; background-size: cover; }
body.ai-page .ai-shell, body.dark.ai-page .ai-shell { background: transparent; }
body.desk-body:not(.dark) .desk-rail, body.desk-body:not(.dark) .sidebar, body.ai-page:not(.dark) .ai-topbar, body.ai-page:not(.dark) .ai-history-drawer, body.ai-page:not(.dark) .ai-composer-card, body.ai-page:not(.dark) .welcome-card, body.ai-page:not(.dark) .ai-bubble.assistant .bubble-inner pre {
  background: rgba(255,255,255,.28); -webkit-backdrop-filter: blur(26px) saturate(190%); backdrop-filter: blur(26px) saturate(190%); border-color: rgba(255,255,255,.65); box-shadow: 0 8px 32px rgba(31,45,90,.12), inset 0 1px 0 rgba(255,255,255,.75); }
body.dark.desk-body .desk-rail, body.dark.desk-body .sidebar, body.dark.ai-page .ai-topbar, body.dark.ai-page .ai-history-drawer, body.dark.ai-page .ai-composer-card, body.dark.ai-page .welcome-card {
  background: rgba(20,28,44,.38); -webkit-backdrop-filter: blur(26px) saturate(170%); backdrop-filter: blur(26px) saturate(170%); border-color: rgba(255,255,255,.14); box-shadow: 0 8px 32px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.10); }
body.ai-page:not(.dark) .ai-bubble.assistant .bubble-inner pre { box-shadow: none; }
body.ai-page:not(.dark) .ai-topbar { border-bottom: 1px solid rgba(255,255,255,.65); }
body.ai-page:not(.dark) .composer-icon-btn, body.ai-page:not(.dark) .model-picker-chip { background: rgba(255,255,255,.45); }
body.ai-page:not(.dark) .ai-bubble.user .bubble-inner { background: rgba(219,230,255,.6); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
body.ai-page:not(.dark) .desk-topbar-heading h1, body.ai-page:not(.dark) #ai-input { color: #101a2c; }
body.ai-page:not(.dark) #ai-input::placeholder { color: #55637a; }
@media (max-width: 760px) { body.ai-page .ai-output { padding-bottom: 120px; } body.ai-page .ai-topbar .desk-topbar-heading { max-width: 36vw; } }
