/* CampTrick AI / OS visual alignment v1.
 * Source of truth: CampTrick-OS/public/css/camptrick-os-shell.css (Oct 2026).
 * Companion tokens only. No OS scripts, DB, or tenant styles are imported.
 * Scoped to the hosted AI frontend, avoiding Classic ERP cascade conflicts.
 */
:root {
  --ctos-bg:#0e0a17;
  --ctos-elev:#181126;
  --ctos-panel:#1b142b;
  --ctos-panel-alt:#231837;
  --ctos-line:#39274e;
  --ctos-muted:#aea0c0;
  --ctos-text:#efe9f6;
  --ctos-accent:#a973e3;
  --ctos-brand:#5a258f;
  --ctos-brand-2:#7d4bc3;
  --ctos-deep:#2c1247;
}
html{background:var(--ctos-bg);}
body{
  background:radial-gradient(ellipse at 46% 30%,#24163250,transparent 52%),var(--ctos-bg);
  color:var(--ctos-text);font-family:Inter,Poppins,'Noto Kufi Arabic','Segoe UI',system-ui,sans-serif;
}
[hidden]{display:none!important}
:where(button,a,input,textarea):focus-visible{outline:2px solid #d2c1dd;outline-offset:3px}
.shell{grid-template-columns:84px 264px minmax(0,1fr);min-width:0}
.osrail{
  background:#130e1f;border-right:1px solid #352546;display:flex;flex-direction:column;
  align-items:center;gap:12px;padding:18px 8px;min-height:0;overflow-y:auto;scrollbar-width:thin;
}
.osrail-logo{
  display:grid;place-items:center;width:50px;height:50px;position:relative;
  border:1px solid #6d4e8b;border-radius:13px;background:linear-gradient(135deg,#211c29,#120e18);
  color:#e7deed;font-size:26px;font-weight:900;letter-spacing:-.06em;text-decoration:none;
  box-shadow:0 0 23px #a361cd1e;
}
.osrail-logo small{position:absolute;right:6px;bottom:4px;font-size:8px;color:#b278d6;letter-spacing:.05em}
.osrail-rule{display:block;width:48px;height:1px;background:#4d3762;margin:6px 0 0}
.osrail-button,.osrail-link{
  width:66px;min-height:59px;display:flex;flex-direction:column;align-items:center;
  justify-content:center;gap:4px;border:1px solid transparent;border-radius:10px;
  background:transparent;color:#a770c9;text-decoration:none;cursor:pointer;
  transition:background-color .16s ease,border-color .16s ease;
}
.osrail-button .symbol,.osrail-link .symbol{font-size:22px;line-height:1}
.osrail-button small,.osrail-link small{font-size:10px;font-weight:700}
.osrail-button:is(:hover,.selected),.osrail-link:hover{background:#382048;color:#eed2ff;border-color:#76419b}
.osrail-bottom{margin-top:auto;display:grid;place-items:center;width:55px;height:48px;background:#221630;border:1px solid #49315d;border-radius:10px;color:#c1a0d5;font-size:11px;font-weight:700;letter-spacing:.06em}
aside{background:#14101f;border-color:#352546;min-width:0}
.brand{border-bottom:1px solid #352546;padding-bottom:22px}
.brand .logo{background:#21162f;box-shadow:none;border:1px solid #634582;border-radius:12px}
.navtitle{color:#a677c7}
.agent.active{background:#382048;border-color:#76419b;color:#f3e5ff}
.agent:hover{background:#231832}
.agent small{color:#bc9bd2}
.foot{border-color:#49325f;background:#1b142b}
main{background:transparent}
.os-masthead{
 display:flex;justify-content:space-between;align-items:center;gap:12px;
 padding:13px 30px;background:#150e24;border-bottom:1px solid #3e2857;
 font:700 10px/1.5 ui-monospace,Consolas,monospace;letter-spacing:.10em;color:#b68bd2
}
.os-masthead-left{display:flex;align-items:center;gap:12px;flex-wrap:wrap;min-width:0}
.os-live{display:inline-flex;gap:9px;align-items:center;color:#ccb3dc}
.os-live .os-dot{height:7px;width:7px;background:#ba7ae1;border-radius:50%;box-shadow:0 0 10px #a875db77}
.os-crumb{color:#816396}
.os-mode{border:1px solid #4f3965;background:#1d1529;padding:5px 8px;border-radius:5px;white-space:nowrap}
.top{padding:26px clamp(20px,4vw,55px);border-color:#39274e}
.top h1{font-size:clamp(21px,2vw,29px);font-weight:800;letter-spacing:-.03em}
.top p{color:#aa82c5}
.status{background:#251936;border-color:#594072;color:#d4b9e7}
.conversation{background:radial-gradient(ellipse at 50% 42%,#361c502b,transparent 65%),radial-gradient(#68478b30 .65px,transparent .9px);background-size:auto,19px 19px}
.welcome{margin-top:clamp(20px,6vh,85px)}
.welcome .mark{background:#21172d;border:1px solid #78549a;box-shadow:0 0 42px #7f43ba33;color:#cfb0ef}
.welcome h2{font-weight:800}
.welcome p{color:#ac9bb9}
.suggestions button,.bubble.assistant{background:linear-gradient(145deg,#1b142b,#18121f);border-color:#49365c}
.suggestions button:hover{background:#292037;border-color:#a67ac9}
.bubble.user{background:#432b60;border-color:#8559af}
.composercard{border-color:#63477f;background:#1e172b}
.composercard:focus-within{border-color:#ab77d3;box-shadow:0 0 0 2px #b17cdd22}
.send{background:linear-gradient(135deg,#7842b0,#5a258f)}
.send:hover:not(:disabled){background:linear-gradient(135deg,#9259cb,#6d349e)}
.notice{color:#a48db4}
.login{background:#1b142b;border-color:#704a8d}
.login input{background:#120d1c}
#authGate{background:#0e0a17eb}
.os-tag{border:1px solid #533c6a;color:#bea2d2;background:#21172f;padding:5px 9px;border-radius:6px;font:700 10px ui-monospace,monospace}
@media(max-width:1060px){.shell{grid-template-columns:72px 215px minmax(0,1fr)}.osrail{padding:13px 4px}.osrail-button,.osrail-link{width:61px}}
@media(max-width:800px){
 .shell{grid-template-columns:1fr;height:100dvh}
 .osrail{display:none}
 aside{min-height:auto}
 .brand{padding-bottom:4px;border:0}
 .os-masthead{padding:10px 15px}
 .os-masthead .os-crumb{display:none}
 .top{padding:13px 18px}
 .conversation{padding:20px 15px}
 .composer{width:calc(100% - 26px)}
}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{transition:none!important;animation:none!important;scroll-behavior:auto!important}}

/* Scalable specialist directory: search + progressive rendering.
   Never instantiate 232 model processes or one sidebar section per role. */
#agentSearch{
  margin:0 6px;min-height:39px;max-width:calc(100% - 12px);
  border:1px solid #503b64;border-radius:9px;
  background:#1a1424;color:#eadcf5;padding:8px 11px;font-size:12px;outline:none;
}
#agentSearch:focus{border-color:#9c76bc}
#agentSearch::placeholder{color:#9a7eac}
.load-agents{
  border:1px solid #624980;background:#251833;border-radius:9px;
  color:#d6b7eb;margin:0 6px;padding:8px 11px;font-size:11px;
}
.load-agents:hover{background:#382048}
@media(max-width:800px){
  #agentSearch{max-width:160px;flex:1 1 105px;font-size:11px;margin:0 3px}
  .load-agents{display:none}
  aside .agents{max-width:calc(100vw - 210px)}
}

.compose-actions{display:inline-flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:end}
.team-preview{
  border:1px solid #7854a0;border-radius:10px;padding:9px 12px;
  background:#271c39;color:#dabdec;font-size:12px;font-weight:700
}
.team-preview:hover:not(:disabled){background:#3a254e;border-color:#b587d1}
.team-preview:disabled{opacity:.55}

/* CT-AI Workspace v2: active tasks, brief gate, owner-only conversation history.
   Everything scoped to the standalone AI app; OS/ERP CSS unchanged. */
[hidden]{display:none!important}
.workspace-group{display:flex;flex-direction:column;gap:8px;max-height:31vh;min-height:92px;padding-bottom:12px;border-bottom:1px solid #45325e;overflow-y:auto;scrollbar-width:thin}
.workspace-primary,.workspace-explore{width:100%;min-height:37px;border:1px solid #7754a0;border-radius:9px;background:#33204a;color:#f3e0ff;padding:8px 11px;text-align:left;font-weight:750;font-size:12px}
.workspace-explore{background:#1c142a;border-color:#56406f}
.workspace-primary:hover,.workspace-explore:hover{background:#4c2e6e}
.workspace-list{display:flex;flex-direction:column;gap:4px;max-width:100%;min-width:0}
.workspace-entry{width:100%;border:1px solid transparent;border-radius:7px;background:transparent;color:#c3b2d3;padding:7px 10px;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px}
.workspace-entry:hover,.workspace-entry.current{background:#342348;border-color:#694c8b;color:#f8e8ff}
.workspace-task{font-size:11px;color:#baa6ca;white-space:normal;overflow-wrap:anywhere;padding:5px 8px;border-inline-start:2px solid #6e5287}
.workspace-task.running{color:#ecd4ff;border-inline-start-color:#d5a0ff}
.workspace-task.complete{color:#a3d6ba;border-inline-start-color:#6eba8a}
.workspace-task.failed{color:#f3abae;border-inline-start-color:#e5a1a6}
.workspace-hint{color:#9c83b3;font-size:10px;line-height:1.7}
.workspace-progress{padding:12px 17px;margin:8px 0;border:1px solid #8051ae;background:#322044;border-radius:11px;color:#e9d1fd;font-size:12px;animation:ctPulse 1.4s ease-in-out infinite}
@keyframes ctPulse{0%,100%{opacity:1}50%{opacity:.65}}
@media(prefers-reduced-motion:reduce){.workspace-progress{animation:none}}
@media(max-width:800px){.workspace-group{max-height:140px;min-height:70px}.workspace-list{flex-direction:row;overflow-x:auto}.workspace-entry{flex:0 0 170px}.workspace-task{flex:0 0 170px}}

.workspace-history-row{display:flex;align-items:center;gap:4px;min-width:0}
.workspace-history-row .workspace-entry{flex:1;min-width:0}
.workspace-delete{border:0;border-radius:7px;background:transparent;color:#ba9ace;padding:4px 8px;font-size:18px}
.workspace-delete:hover{background:#59344f;color:#ffe0e0}

/* Explicit recovery control for interrupted provider requests. */
.workspace-retry{border:1px solid #8255ab;border-radius:7px;background:#302043;color:#e5c8ff;padding:4px 8px;line-height:1.1;font-size:17px}
.workspace-retry:hover:not(:disabled){background:#553572}
.workspace-retry:focus-visible{outline:2px solid #dbb5fb;outline-offset:2px}

/* CT-AI-IL2 usage dashboard: compact, opt-in detail, no ERP/OS CSS. */
.usage-panel{padding:10px 28px;border-bottom:1px solid #3c2b4c;background:#170f23;color:#d8bee8}
.usage-header{display:flex;gap:10px;flex-wrap:wrap;align-items:center;justify-content:space-between;font-size:11px}
.usage-header strong{color:#e4d4f5;font-size:12px}
.usage-header span{color:#bcb0d0}
.usage-header button{font-size:11px;color:#edd8ff;border:1px solid #5e4775;border-radius:7px;background:#2c1a3b;padding:7px 10px}
.usage-header button:focus-visible{outline:2px solid #d9b6f4;outline-offset:2px}
.usage-caution{display:block;color:#9b86aa;font-size:10px;margin:7px 0 0}
.usage-models{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:10px 0;max-height:190px;overflow-y:auto}
.usage-row{display:flex;flex-direction:column;gap:5px;background:#261a34;border:1px solid #48325e;border-radius:9px;padding:10px;min-width:0;font-size:11px}
.usage-row strong{color:#e4d3fb;overflow-wrap:anywhere}
.usage-row small{color:#afa0c0;font-size:10px;line-height:1.4}
.usage-remaining{font-weight:700;color:#d3b8ea}
@media(max-width:850px){.usage-panel{padding:7px 12px}.usage-models{grid-template-columns:1fr;max-height:130px}.usage-header{gap:6px}}


/* Compact chat/layout regression patch: assistant Markdown + small laptop UI.
 * Does not change OS/ERP, backend persistence or authentication.
 */
main,.conversation,#thread,.bubble,.message-body,.message-rich{min-width:0}
.conversation{
 padding:clamp(14px,2.2vw,28px) clamp(12px,3vw,38px) 18px;
 overscroll-behavior:contain;
 scrollbar-width:thin
}
#thread{max-width:940px;width:100%;gap:14px}
.bubble{max-width:94%;line-height:1.65}
.bubble.assistant{max-width:100%;width:100%;white-space:normal}
.bubble.user{white-space:pre-wrap}
.message-body{overflow-wrap:anywhere}
.message-rich{font-size:clamp(13px,1vw,15px);line-height:1.85;unicode-bidi:plaintext}
.message-rich :is(h1,h2,h3,h4){font-weight:750;line-height:1.38;letter-spacing:0;margin:18px 0 10px;overflow-wrap:anywhere}
.message-rich h1{font-size:1.4em}
.message-rich h2{font-size:1.27em}
.message-rich h3{font-size:1.14em}
.message-rich h4{font-size:1.06em}
.message-rich :first-child{margin-top:0}
.message-rich :last-child{margin-bottom:0}
.message-rich p{margin:0 0 12px;white-space:pre-line}
.message-rich ul,.message-rich ol{margin:8px 0 16px;padding-inline-start:1.55em;line-height:1.9}
.message-rich li{padding-inline-start:3px;margin-bottom:5px}
.message-rich strong{font-weight:800;color:#faf1ff}
.message-rich code{font-family:ui-monospace,Consolas,monospace;font-size:.88em;background:#2c2239;border-radius:5px;padding:1px 4px;direction:ltr;unicode-bidi:isolate}
.message-rich pre{max-width:100%;overflow:auto;margin:12px 0;padding:14px;background:#110e1b;border:1px solid #463357;border-radius:10px;direction:ltr;text-align:left;white-space:pre;line-height:1.6}
.message-rich pre code{white-space:pre;background:transparent;padding:0}
.message-rich blockquote{margin:14px 0;padding:9px 14px;background:#241a32;border-inline-start:3px solid #aa79d8;line-height:1.8}
.message-rich hr{border:0;border-top:1px solid #4c3860;margin:18px 0}
.message-table-scroll{max-width:100%;overflow-x:auto;margin:14px 0;border:1px solid #513a68;border-radius:10px;overscroll-behavior-inline:contain}
.message-rich table{width:100%;border-collapse:collapse;table-layout:auto;font-size:.94em}
.message-rich th,.message-rich td{padding:10px 12px;min-width:95px;border-bottom:1px solid #443053;text-align:start;vertical-align:top;white-space:normal;overflow-wrap:anywhere}
.message-rich th{font-weight:750;background:#30203e}
.message-rich tbody tr:last-child td{border-bottom:0}
.message-rich tbody tr:nth-child(even){background:#241a30}
.composer{margin-bottom:clamp(8px,1.6vh,18px);width:min(940px,calc(100% - 32px))}
.composercard{padding:10px 14px}
.composercard textarea{min-height:36px;max-height:110px;line-height:1.55}
.composebottom{flex-wrap:wrap}
.composebottom small{min-width:0;line-height:1.45}
.top{gap:10px}
.top>div{min-width:0}
.top p{line-height:1.55}
.status{flex-shrink:0}
.workspace-toggle{display:none;flex:0 0 auto;border:1px solid #654b7b;background:#2a1c3c;color:#e8d4f4;border-radius:9px;min-height:39px;padding:8px 11px;font-size:12px;font-weight:700}
.workspace-backdrop{display:none}
@media (max-width:1280px){
 .shell{grid-template-columns:68px minmax(0,1fr)}
 .osrail{display:flex;padding:12px 3px}
 .osrail-button,.osrail-link{width:55px;min-height:53px}
 .osrail-logo{width:43px;height:43px}
 .osrail-rule{width:42px}
 .shell>aside{position:fixed;top:0;bottom:0;left:68px;width:min(280px,calc(100vw - 68px));z-index:31;box-shadow:15px 0 35px #0008;transform:translateX(calc(-100% - 80px));transition:transform .18s ease;overflow-y:auto}
 .workspace-open .shell>aside{transform:translateX(0)}
 .workspace-open .workspace-backdrop{display:block;position:fixed;inset:0;background:#08040bbb;border:0;z-index:30}
 .workspace-toggle{display:inline-flex;align-items:center;justify-content:center}
 .os-masthead{padding:9px 15px;justify-content:flex-start;gap:10px}
 .os-masthead-left{flex:1}
 .os-mode{margin-inline-start:auto}
 .top{padding:16px 20px}
 .usage-panel{padding:8px 17px}
 .workspace-group{max-height:40vh}
}
@media (max-width:800px){
 .shell{grid-template-columns:minmax(0,1fr)}
 .osrail{display:none}
 .shell>aside{left:0;width:min(300px,86vw);min-height:100dvh;flex-direction:column;align-items:stretch;padding:22px 16px}
 .shell>aside .brand small,.shell>aside .navtitle,.shell>aside .foot,.shell>aside .agent small{display:block}
 .shell>aside .brand{padding:8px 8px 16px;border-bottom:1px solid #352546}
 .shell>aside .agents{display:block;max-width:none;overflow:auto}
 .shell>aside .workspace-group{max-height:42vh;min-height:92px}
 .shell>aside .workspace-list{flex-direction:column;overflow:visible}
 .shell>aside .workspace-entry{flex:1}
 .shell>aside .workspace-task{flex:1}
 .shell>aside #agentSearch{max-width:calc(100% - 12px)}
 .shell>aside .load-agents{display:block}
 .os-crumb{display:none}
 .os-masthead{padding:8px 11px}
 .os-live{font-size:9px}
 .top{padding:12px 14px;align-items:flex-start;flex-wrap:wrap}
 .top h1{font-size:clamp(18px,4.5vw,24px)}
 .top .status{font-size:11px}
 .conversation{padding:12px 11px 16px}
 .bubble{max-width:100%;padding:13px 14px;border-radius:14px}
 .composer{width:calc(100% - 20px);margin-bottom:8px}
 .composercard{padding:9px 11px}
 .usage-header{gap:8px}
 .usage-caution{font-size:9px;line-height:1.4}
 .message-rich{font-size:14px}
}
@media (max-height:660px){
 .top{padding-block:11px}
 .usage-caution{display:none}
 .conversation{padding-top:12px}
 .composer{margin-bottom:6px}
 .notice{margin-top:5px}
}


/* Multi-model quota board: independent per-provider windows, not a pooled balance. */
.usage-models{display:flex;flex-direction:column;gap:8px;max-height:min(55vh,520px);overflow-y:auto;overscroll-behavior:contain}
.usage-provider,.usage-pending{border:1px solid #59406e;border-radius:10px;padding:10px 12px;background:#241a32;min-width:0;overflow-wrap:anywhere}
.usage-provider[open]{border-color:#8062a0}
.usage-provider-title{cursor:pointer;display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap}
.usage-provider-title strong{color:#f1d9ff;font-size:12px}
.usage-provider-title span{color:#c9b7dd;font-size:11px}
.usage-provider-stat{color:#ece0f6;font-size:12px;margin:11px 0 7px;line-height:1.6}
.usage-provider small,.usage-pending small{display:block;color:#b7a4c7;font-size:11px;line-height:1.65;margin:4px 0}
.usage-pending strong{color:#dfc5e9;font-size:12px}
.usage-track{height:6px;background:#392b49;border-radius:6px;overflow:hidden;margin:6px 0 10px}
.usage-fill{height:100%;border-radius:6px;background:#a575d0;max-width:100%}
.usage-model-entry{padding:8px 10px;margin:7px 0;border:1px solid #43314f;border-radius:8px;background:#1b1426;min-width:0}
.usage-model-entry strong{display:block;color:#ead6fa;font-size:11px;overflow-wrap:anywhere}
@media(max-width:800px){.usage-models{max-height:45vh}.usage-provider-title{align-items:start}}


.usage-catalog-button{margin:9px 0 6px;padding:7px 10px;border-radius:8px;background:#302041;border:1px solid #79569a;color:#ead6fd;font-size:11px;min-height:34px}
.usage-catalog-button:disabled{opacity:.6;cursor:wait}
.usage-catalog-list{max-height:240px;overflow-y:auto;overflow-wrap:anywhere;scrollbar-width:thin;font-size:11px}
.usage-catalog-list .usage-model-entry{padding:6px 9px}
