/* QkeerAI: one conversation canvas with a supporting session rail. */
body:has(.workspace-page-qkeer-ai)>footer{display:none}
.qai-layout{height:calc(100dvh - 112px);display:grid;grid-template-columns:minmax(0,1fr) 280px;overflow:hidden;background:var(--q-surface,#fff);border:1px solid var(--q-line,#E3E7EE);border-radius:8px}
.qai-workspace{display:flex;flex-direction:column;min-height:0;min-width:0}
.qai-chatbar{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:56px;padding:8px 24px;border-bottom:1px solid var(--q-line,#E3E7EE);box-sizing:border-box}
#qai-chat-title{font-size:14px;font-weight:500;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;min-width:0}
#qai-open-sessions,#qai-close-sessions{display:none}
.qai-timeline{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:24px;scrollbar-gutter:stable;scrollbar-color:var(--q-line,#E3E7EE) transparent}
.qai-history-control{display:flex;justify-content:center;gap:8px;max-width:760px;margin:0 auto}
.qai-history-control:has(button:not([hidden])){margin-bottom:24px}
.qai-result{display:flex;flex-direction:column;gap:32px;max-width:760px;margin:0 auto}
.qai-turn{display:flex;flex-direction:column;gap:20px;min-width:0}
.qai-result[hidden],.qai-welcome[hidden],.qai-journal[hidden],.qai-journal [hidden],.qai-tools[hidden],.qai-composer[hidden],.qai-data-query[hidden],.qai-data-query [hidden],.qai-record-body[hidden]{display:none!important}
.qai-welcome{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:100%;box-sizing:border-box;padding:24px 0 64px;text-align:center}
.qai-welcome h1{font-size:24px;line-height:36px;font-weight:500;margin:0 0 8px}
.qai-welcome>p{font-size:14px;line-height:24px;color:var(--q-muted,#626875);margin:0}
.qai-prompts{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:24px}
.data-workspace .qai-prompts button{background:var(--q-canvas,#F6F8FC);font-weight:400}
.qai-composer{padding:16px 24px 20px;background:var(--q-surface,#fff)}
.qai-inputbox{max-width:760px;margin:0 auto;border:1px solid var(--q-line,#E3E7EE);border-radius:8px;background:var(--q-canvas,#F6F8FC);padding:8px 12px}
.qai-inputbox:focus-within{border-color:var(--q-brand,#203EEC)}
.data-workspace .qai-composer textarea{display:block;width:100%;height:48px;min-height:48px;max-height:160px;box-sizing:border-box;resize:none;overflow-y:auto;border:0;background:transparent;border-radius:0;padding:12px 4px;margin:0;font:inherit;font-size:14px;line-height:24px;box-shadow:none;caret-color:var(--q-brand,#203EEC)}
.data-workspace .qai-composer textarea:focus{outline:none}
.qai-composer textarea::placeholder{color:var(--q-muted,#626875);opacity:1}
.qai-input-actions{display:flex;align-items:center;gap:12px}
.data-workspace #qai-open-tools{background:transparent;border:0;color:var(--q-muted,#626875);padding:8px 4px;font-size:12px}
#qai-send{margin-left:auto;flex-shrink:0}
.qai-key-hint{font-size:12px;color:var(--q-muted,#626875)}
.qai-feedback{max-width:760px;margin:8px auto 0;font-size:12px;line-height:20px;color:var(--q-muted,#626875)}
.qai-feedback:empty{display:none}
.qai-feedback[role=alert],#qai-live-reply[role=alert],.qai-read-error{color:var(--q-danger,#BC3541)}
.qai-message{display:flex;flex-direction:column;gap:6px;min-width:0;max-width:94%}
.qai-message-user{align-self:flex-end;align-items:flex-end;max-width:80%}
.qai-message-assistant{align-self:flex-start;align-items:flex-start}
.qai-message-role{font-size:12px;line-height:20px;color:var(--q-muted,#626875)}
.qai-bubble{min-width:0;max-width:100%;box-sizing:border-box;overflow-wrap:anywhere}
.qai-message-user .qai-bubble{background:var(--q-selected,#EDF1FF);color:var(--q-ink,#191C22);border-radius:8px;padding:12px 16px}
.qai-message-assistant .qai-bubble{padding:4px 0;background:transparent;color:var(--q-ink,#191C22)}
.qai-message-user p,.qai-chat-message{white-space:pre-wrap;line-height:26px;margin:0;max-width:70ch;font-size:14px}
.qai-chat-message+.qai-chat-message{margin-top:12px}
#qai-live-reply{font-size:12px;line-height:20px;color:var(--q-muted,#626875);margin:8px 0 0}
.qai-result h2{font-size:16px;line-height:24px;font-weight:500;margin:24px 0 12px}
.qai-bubble>h2:first-child{margin-top:0}
.qai-conclusion{padding:0 0 16px;margin:0 0 16px;border-bottom:1px solid var(--q-line,#E3E7EE)}
.qai-conclusion h3,.qai-limitations h3{font-size:14px;line-height:24px;font-weight:500;margin:0 0 8px}
.qai-conclusion p{font-size:14px;line-height:26px;margin:8px 0;white-space:pre-line;max-width:70ch}
.qai-result-meta,.qai-review,.qai-limitations,.qai-used-memory,.qai-unavailable{font-size:12px;line-height:20px;color:var(--q-muted,#626875)}
.qai-result-meta{margin:16px 0 0}
.qai-limitations{margin-top:16px}.qai-limitations ul{padding-left:20px}
.qai-used-memory>summary{padding:12px 0;cursor:pointer}
.qai-sidebar{display:flex;flex-direction:column;min-width:0;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:20px 16px;background:var(--q-canvas,#F6F8FC);border-left:1px solid var(--q-line,#E3E7EE);box-sizing:border-box;scrollbar-color:var(--q-line,#E3E7EE) transparent}
.qai-sidebar-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}
.qai-sidebar-heading h2{font-size:16px;font-weight:500;line-height:24px;margin:0}
.qai-session-user{display:flex;align-items:center;gap:8px;justify-content:space-between}
.qai-session-user>span{min-width:0;overflow-wrap:anywhere;font-size:12px;line-height:20px}
.data-workspace .qai-session-user>button{flex-shrink:0;min-height:32px;padding:4px 8px;font-size:12px;background:transparent}
.qai-status,.qai-label,.qai-connection-note,.qai-journal-note,.qai-list-empty{font-size:12px;line-height:20px;color:var(--q-muted,#626875)}
.qai-status{margin:8px 0 16px}
#qai-new{width:100%;margin-bottom:8px}
.qai-sidebar details{margin:0;padding:0;border:0;border-top:1px solid var(--q-line,#E3E7EE);border-radius:0;background:transparent}
.qai-sidebar summary{font-size:14px;line-height:22px;cursor:pointer;padding:16px 0}
.qai-space-settings{border-top:0!important}
.qai-space-settings>summary{font-size:12px;padding:8px 0 12px}
.qai-journal label,.qai-data-query label{display:grid;gap:6px;margin:0;min-width:0;font-size:12px;line-height:20px;color:var(--q-muted,#626875);font-weight:400}
.qai-journal select,.qai-journal input,.qai-data-query select,.qai-data-query input{width:100%;min-width:0;max-width:100%;box-sizing:border-box}
#qai-thread-list{display:flex;flex-direction:column;gap:4px;margin:0 0 12px;flex:1;min-height:80px;overflow-y:auto;scrollbar-color:var(--q-line,#E3E7EE) transparent}
.qai-journal{display:flex;flex-direction:column;flex:1;min-height:120px}
.qai-sidebar-heading,.qai-session-user,.qai-status,.qai-sidebar details,#qai-new,#qai-morethreads{flex-shrink:0}
.data-workspace .qai-thread{flex-shrink:0;display:flex;align-items:center;gap:8px;width:100%;padding:12px 10px;border:0;border-radius:8px;background:transparent;color:var(--q-ink,#191C22);text-align:left;font-weight:400;white-space:normal}
.qai-thread>span{flex:1;min-width:0;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow-wrap:anywhere;line-height:22px;font-size:14px}
.qai-thread>time{font-size:12px;color:var(--q-muted,#626875);flex-shrink:0}
.data-workspace .qai-thread[aria-current=true]{background:var(--q-selected,#EDF1FF);color:var(--q-brand,#203EEC)}
.data-workspace .qai-thread:hover:not(:disabled){background:var(--q-line,#E3E7EE)}
.qai-journal form{display:grid;gap:12px;margin:12px 0 16px}
#qai-memory-list{list-style:none;padding:0;margin:0;font-size:12px;line-height:20px}
#qai-memory-list li{display:grid;gap:6px;overflow-wrap:anywhere;padding:0 0 12px}
#qai-memory-list button{justify-self:start}
.qai-journal-note:empty{display:none}
.qai-journal-note{margin:0 0 12px}
.qai-data-query{display:grid;gap:12px;padding:0 0 16px;margin:0}
.qai-query-feedback{font-size:12px;color:var(--q-muted,#626875);margin:0}
.qai-query-feedback:empty{display:none}
.qai-evidence-links{display:flex;gap:8px;flex-wrap:wrap;margin:16px 0}
.qai-read-state{font-size:14px;line-height:22px;margin:0 0 12px}
.qai-snapshot-note{font-size:12px;line-height:20px;color:var(--q-muted,#626875)}
.qai-mobile-drawer{inset:0 0 0 auto;margin:0;width:min(360px,calc(100vw - 24px));height:100dvh;max-height:none;max-width:none;border:0;border-radius:0;padding:0;background:var(--q-canvas,#F6F8FC)}
.qai-mobile-drawer:not([open]){display:none}
.qai-mobile-drawer::backdrop{background:#191c2255}
.qai-mobile-drawer>.qai-sidebar{height:100%;border:0}
.qai-visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
.workspace-page-qkeer-ai ::selection{background:var(--q-selected,#EDF1FF);color:var(--q-ink,#191C22)}
@media(max-width:1100px){.qai-layout{grid-template-columns:minmax(0,1fr) 256px}.qai-timeline{padding:20px}.qai-composer{padding:12px 20px 16px}.qai-key-hint{display:none}}
@media(max-width:900px){.qai-layout{grid-template-columns:minmax(0,1fr)}#qai-open-sessions,#qai-close-sessions{display:block}.qai-chatbar{padding:8px 16px}.qai-message{max-width:96%}.qai-message-user{max-width:88%}}
@media(max-width:760px){.qai-layout{height:calc(100dvh - 96px)}.qai-timeline{padding:16px}.qai-composer{padding:8px 12px 12px}.qai-welcome{padding-bottom:32px}.qai-welcome h1{font-size:22px;line-height:32px}.qai-prompts{flex-direction:column;gap:8px}.qai-message-user .qai-bubble{padding:10px 12px}.qai-result{gap:28px}.qai-sidebar{padding:16px}}

.qai-facts{margin:16px 0}
.qai-facts>div{display:flex;justify-content:space-between;gap:12px;padding:7px 0}
.qai-facts dt{font-size:14px;color:var(--q-muted,#626875)}
.qai-facts dd{margin:0;font-size:14px;font-variant-numeric:tabular-nums}
.qai-date-range{padding-top:16px;border-top:1px solid var(--q-line,#E3E7EE);font-size:12px;line-height:22px;color:var(--q-muted,#626875)}
.qai-source-details{margin-top:16px}
.qai-source-details summary{font-size:14px;cursor:pointer;line-height:24px;padding:6px 0;color:var(--q-brand,#203EEC)}
.qai-source-details ul{list-style:none;padding:0;margin:6px 0}
.qai-source-details li{padding:10px 0;border-bottom:1px solid var(--q-line,#E3E7EE);overflow-wrap:anywhere}
.qai-source-details strong,.qai-source-details span{display:block;font-size:12px;line-height:20px}
.qai-source-details strong{font-weight:500}
.qai-source-details span{color:var(--q-muted,#626875)}
.qai-citations>summary{padding:10px 0;cursor:pointer;color:var(--q-brand,#203EEC);font-size:14px;line-height:22px}
.qai-citation{padding:12px 0;overflow-wrap:anywhere}
.qai-citation h4{font-size:14px;line-height:22px;font-weight:500;margin:0 0 8px}
.qai-citation p,.qai-citation li{font-size:12px;line-height:20px;color:var(--q-muted,#626875)}
.qai-citation .qai-facts>div{align-items:flex-start}
.qai-citation .qai-facts dd{text-align:right;max-width:65%;overflow-wrap:anywhere}
.qai-records{list-style:none;padding:0;margin:12px 0}
.qai-records>li{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;padding:12px 0;border-top:1px solid var(--q-line,#E3E7EE)}
.qai-records strong,.qai-records span{display:block;overflow-wrap:anywhere}
.qai-records strong{font-weight:500;color:var(--q-ink,#191C22)}
.qai-record-body{width:100%;min-width:0}
.qai-record-body pre{max-height:320px;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;padding:12px;background:var(--q-canvas,#F6F8FC);font-size:12px;line-height:20px}
.qai-citation pre {white-space:pre-wrap;overflow-wrap:anywhere}
.qai-window-table{overflow-x:auto;margin:12px 0}
.qai-window-table table{border-collapse:collapse;width:100%;font-size:13px;font-variant-numeric:tabular-nums}
.qai-window-table caption{text-align:left;font-weight:600;margin-bottom:6px}
.qai-window-table td,.qai-window-table th{text-align:left;padding:6px 8px;border-bottom:1px solid var(--q-line,#E3E7EE)}
.qai-window-table th small{display:block;color:var(--q-muted,#626875);font-weight:400}
.qai-catalog-items{list-style:none;padding:0;margin:12px 0}
.qai-catalog-items li{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:5px 0;border-bottom:1px solid var(--q-line,#E3E7EE)}
.qai-catalog-items li span{min-width:0;overflow-wrap:anywhere}
.qai-catalog-items button{flex:none}
.qai-citation [data-qai-lookup][hidden],.qai-citation [data-qai-next][hidden]{display:none}
.qai-timeline-note{max-width:760px;margin:0 auto 16px;font-size:12px;line-height:20px;color:var(--q-muted,#626875)}
.qai-timeline-note:empty{display:none}

/* Domain entries remain visible while the session rail collapses on narrow screens. */
.qai-domains{display:flex;gap:4px;padding:12px 20px 0;flex-shrink:0}
.data-workspace .qai-domains button{flex:1;min-width:0;min-height:44px;background:transparent;border:0;color:var(--q-muted,#626875);font-size:14px;padding:8px 4px;white-space:nowrap}
.data-workspace .qai-domains button[aria-pressed=true]{background:var(--q-selected,#EDF1FF);color:var(--q-brand,#203EEC);font-weight:500}
.data-workspace .qai-domains button:hover:not(:disabled){background:var(--q-selected,#EDF1FF)}
.qai-welcome .qai-domain-coverage{max-width:48ch;font-size:12px;line-height:20px;margin-top:12px}
.qai-history-filter{margin:4px 0 12px!important;flex-shrink:0}
@media(max-width:600px){.qai-domains{padding:8px 8px 0;gap:0}.data-workspace .qai-domains button{font-size:12px}.qai-welcome h1{font-size:22px}.qai-welcome{padding-bottom:24px}}

/* Evidence-backed sleep figures stay inside their own conversation turn. */
.qai-message-assistant:has(.qai-sleep-chart),.qai-message-assistant:has(.qai-sleep-chart)>.qai-bubble{width:100%}
.qai-sleep-chart{margin:8px 0 24px;padding:20px 0;border-block:1px solid var(--q-line);font-variant-numeric:tabular-nums;max-width:100%;min-width:0}
.qai-sleep-chart figcaption{display:flex;align-items:baseline;justify-content:space-between;gap:8px;flex-wrap:wrap;margin-bottom:20px}
.qai-sleep-chart h3{font-size:16px;line-height:24px;font-weight:500;margin:0}
.qai-sleep-chart figcaption>span,.qai-chart-note{font-size:12px;line-height:20px;color:var(--q-muted)}
.qai-plot{display:flex;gap:8px;min-width:0}
.qai-axis{width:44px;flex-shrink:0;height:160px;display:flex;flex-direction:column;justify-content:space-between;font-size:12px;line-height:18px;color:var(--q-muted)}
.qai-bars{display:flex;flex:1;min-width:0;gap:4px;background:linear-gradient(to bottom,transparent calc(50% - 1px),var(--q-line) 50%,transparent calc(50% + 1px));background-size:100% 160px;background-repeat:no-repeat}
.data-workspace .qai-day{display:flex;flex-direction:column;align-items:stretch;flex:1;min-width:0;padding:0;border:0;border-radius:4px;background:transparent;color:var(--q-ink);font-size:12px;font-weight:400;line-height:20px}
.qai-bar-track{height:160px;display:flex;align-items:flex-end;justify-content:center;border-bottom:1px solid var(--q-line)}
.qai-bar{display:block;width:58%;max-width:36px;height:100%;fill:var(--q-brand);overflow:visible}
.qai-bar-missing{font-size:12px;color:var(--q-muted);padding-bottom:8px}
.qai-day-label{padding:8px 0;white-space:nowrap}
.data-workspace .qai-day:hover,.data-workspace .qai-day[aria-pressed=true]{background:var(--q-selected);color:var(--q-brand)}
.data-workspace .qai-day:focus-visible{outline:2px solid var(--q-brand);outline-offset:2px}
.qai-day-detail{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;min-height:44px;margin-top:8px}
.qai-day-detail p{font-size:14px;line-height:22px;margin:0}
.data-workspace [data-qai-day-proof]{font-size:12px;min-height:44px;background:transparent;border:0;color:var(--q-brand);padding:8px 0}
.qai-chart-comparison{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin:16px 0;padding-top:16px;border-top:1px solid var(--q-line)}
.qai-chart-comparison dt{font-size:14px;line-height:22px}
.qai-chart-comparison dt span,.qai-chart-comparison small{display:block;font-size:12px;line-height:20px;color:var(--q-muted);font-weight:400}
.qai-chart-comparison dd{margin:8px 0 0;font-size:24px;line-height:32px;font-weight:500}
.qai-chart-status{font-size:14px;line-height:24px;margin:12px 0 8px}
.qai-chart-note{margin:8px 0}
.qai-chart-evidence>summary{font-size:12px;line-height:20px;color:var(--q-brand);cursor:pointer;padding:12px 0}
@media(max-width:600px){.qai-chart-comparison{grid-template-columns:1fr;gap:12px}.qai-chart-comparison>div{display:flex;justify-content:space-between;gap:12px}.qai-chart-comparison dd{text-align:right;font-size:16px;line-height:24px;margin:0}.qai-chart-comparison dt{font-size:12px}.qai-chart-comparison small{max-width:130px}.qai-axis{width:36px}.qai-bars{gap:2px}.qai-message-assistant:has(.qai-sleep-chart){max-width:100%}}
