/* CartIQ: the chat app.
   The look: a quiet frame with the conversation on one raised sheet. Small, calm type (Geist). Almost no colour:
   the logo's blues are saved for the message box's edge light, the send button and the one call to action.
   Two looks, light and dark, switched by data-theme on <html>. Every colour is a variable in the two blocks below. */
:root {
  --b1: #0A5FD6; --b2: #0C8FE8; --b3: #3FD8FF;            /* the logo's blues, deep to light */
  --at: #0A6FC2;                                           /* blue for words and links */
  --frame: #F3F4F6; --sheet: #FFFFFF; --raise: #F3F4F6; --float: #FFFFFF;
  --ink: #14171C; --ink2: #5D6773; --ink3: #8B95A1;
  --hair: rgba(20,23,28,.08); --hair2: rgba(20,23,28,.14);
  --hover: rgba(20,23,28,.05); --on: rgba(20,23,28,.08);
  --sheet-shadow: 0 0 0 1px rgba(20,23,28,.05), 0 1px 2px rgba(20,23,28,.04), 0 16px 44px -22px rgba(20,23,28,.16);
  --float-shadow: 0 0 0 1px rgba(20,23,28,.07), 0 2px 5px rgba(20,23,28,.04), 0 22px 48px -22px rgba(20,23,28,.22);
  --glow: rgba(12,143,232,.14); --aura: rgba(12,143,232,.10);
  --font: "Geist", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --at: #62C8FB;
  --frame: #08090B; --sheet: #101317; --raise: #1A1E25; --float: #171B21;
  --ink: #ECEFF3; --ink2: #9AA3AF; --ink3: #6E7783;
  --hair: rgba(255,255,255,.07); --hair2: rgba(255,255,255,.13);
  --hover: rgba(255,255,255,.06); --on: rgba(255,255,255,.09);
  --sheet-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 24px 60px -24px rgba(0,0,0,.8);
  --float-shadow: 0 0 0 1px rgba(255,255,255,.09), 0 22px 50px -18px rgba(0,0,0,.8);
  --glow: rgba(63,216,255,.14); --aura: rgba(12,143,232,.17);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { background: var(--frame); }
body.clai-body { font-family: var(--font); color: var(--ink); background: var(--frame); font-size: 15px; line-height: 1.55; overflow: hidden; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
::selection { background: rgba(12,143,232,.24); }
button { font-family: inherit; -webkit-tap-highlight-color: transparent; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--at); outline-offset: 2px; }
#clai { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
#clai * { scrollbar-width: thin; scrollbar-color: var(--hair2) transparent; }

/* ---- sidebar: sits on the frame, no box of its own */
.clai-side { flex: none; width: 264px; display: flex; flex-direction: column; padding: 10px 6px 10px 10px; transition: margin-left .24s cubic-bezier(.3,.7,.2,1); }
.clai-collapsed .clai-side { margin-left: -264px; }
.clai-side__top { flex: none; height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 2px 0 8px; margin-bottom: 12px; }
.clai-brand { display: flex; align-items: center; border-radius: 8px; }
.clai-brand img { display: block; height: 36px; width: auto; }
.clai-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--ink2); cursor: pointer; transition: background .12s, color .12s; }
.clai-icon:hover { background: var(--hover); color: var(--ink); }
.clai-row { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font-size: 14px; font-weight: 500; text-align: left; cursor: pointer; transition: background .12s; }
.clai-row:hover { background: var(--hover); }
.clai-row svg { color: var(--ink2); }
.clai-list { flex: 1; min-height: 0; overflow-y: auto; margin-top: 6px; padding-right: 4px; }
.clai-list__label { margin: 16px 10px 4px; font-size: 12px; font-weight: 500; color: var(--ink3); }
.clai-list__item { display: block; width: 100%; height: 34px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); font-size: 13.5px; font-weight: 400; text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background .12s; }
.clai-list__item:hover { background: var(--hover); }
.clai-list__item.is-on { background: var(--on); font-weight: 500; }
.clai-side__foot { flex: none; padding: 10px 10px 2px; }
.clai-by { font-size: 12px; color: var(--ink3); text-decoration: none; }
.clai-by:hover { color: var(--ink); }
.clai-shade { display: none; }

/* ---- the sheet */
.clai-main { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; margin: 8px 8px 8px 0; border-radius: 18px; background: var(--sheet); box-shadow: var(--sheet-shadow); overflow: hidden; transition: margin-left .24s cubic-bezier(.3,.7,.2,1); }
.clai-collapsed .clai-main { margin-left: 8px; }
/* a soft wash of the logo's blue behind the greeting; it leaves once a conversation starts */
.clai-main::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 66%; pointer-events: none; opacity: 0; transition: opacity .5s; background: radial-gradient(52% 60% at 50% 42%, var(--aura) 0%, color-mix(in srgb, var(--aura) 58%, transparent) 28%, color-mix(in srgb, var(--aura) 22%, transparent) 54%, transparent 82%); }
.clai-empty .clai-main::before { opacity: 1; }
.clai-top { position: relative; flex: none; height: 56px; display: flex; align-items: center; gap: 4px; padding: 0 12px 0 10px; }
.clai-top__open, .clai-top__new, .clai-top__logo { display: none; }
.clai-collapsed .clai-top__open, .clai-collapsed .clai-top__new { display: inline-flex; }
.clai-top__logo { border-radius: 8px; margin-left: 4px; }
.clai-top__logo img { display: block; height: 28px; width: auto; }
.clai-top__gap { flex: 1; }
.clai-cta { display: inline-flex; align-items: center; height: 36px; padding: 0 15px; margin-left: 6px; border-radius: 999px; font-size: 13.5px; font-weight: 600; letter-spacing: -.005em; color: #fff; text-decoration: none; white-space: nowrap; background: linear-gradient(135deg, var(--b1), var(--b2)); box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 8px 18px -10px rgba(10,95,214,.85); transition: filter .15s, transform .15s; }
.clai-cta:hover { filter: brightness(1.08); }
.clai-cta:active { transform: scale(.98); }

.clai-stage { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.clai-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.clai-thread { width: min(100%, 768px); margin: 0 auto; padding: 12px 24px 28px; display: flex; flex-direction: column; gap: 26px; }

/* ---- nothing said yet: greeting, the message box right under it, a few ways to start */
.clai-empty .clai-stage { justify-content: center; padding-bottom: 9vh; }
.clai-empty .clai-scroll { flex: none; overflow: visible; }
.clai-empty .clai-thread { padding-bottom: 26px; }
.clai-welcome { text-align: center; }
.clai-welcome__logo { display: block; width: auto; height: 60px; margin: 0 auto 22px; filter: drop-shadow(0 10px 22px var(--glow)); }
.clai-welcome h1 { margin: 0; font-size: clamp(25px, 2.5vw, 31px); font-weight: 500; letter-spacing: -.025em; line-height: 1.2; }
.clai-welcome p { margin: 10px auto 0; max-width: 460px; color: var(--ink2); font-size: 15px; line-height: 1.5; }
.clai-starters { display: none; flex-wrap: wrap; justify-content: center; gap: 8px; width: min(100%, 768px); margin: 18px auto 0; padding: 0 24px; }
.clai-empty .clai-starters { display: flex; }
.clai-chip { display: inline-flex; align-items: center; gap: 8px; flex: none; height: 36px; padding: 0 14px 0 12px; border: 1px solid var(--hair2); border-radius: 999px; background: transparent; color: var(--ink2); font-size: 13.5px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .12s, color .12s; }
.clai-chip svg { width: 16px; height: 16px; }
.clai-chip:hover { background: var(--hover); color: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .clai-empty .clai-welcome, .clai-empty .clai-form, .clai-empty .clai-starters { animation: clai-rise .5s cubic-bezier(.2,.7,.2,1) both; }
  .clai-empty .clai-form { animation-delay: .06s; }
  .clai-empty .clai-starters { animation-delay: .12s; }
  .clai-msg { animation: clai-rise .28s cubic-bezier(.2,.7,.2,1) both; }
  .clai-card { animation: clai-rise .32s cubic-bezier(.2,.7,.2,1) both; }
}
@keyframes clai-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- messages */
.clai-msg { display: flex; flex-direction: column; gap: 12px; }
.clai-msg--user { align-items: flex-end; }
.clai-msg--user .clai-text { max-width: 78%; background: var(--raise); border-radius: 20px 20px 6px 20px; padding: 10px 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.clai-msg--ai .clai-text { font-size: 15.5px; line-height: 1.7; overflow-wrap: anywhere; }
.clai-text p { margin: 0 0 .8em; }
.clai-text p:last-child, .clai-text ul:last-child, .clai-text ol:last-child { margin-bottom: 0; }
.clai-text ul, .clai-text ol { margin: 0 0 .8em; padding-left: 1.3em; }
.clai-text li { margin: .3em 0; }
.clai-text strong { font-weight: 600; }
.clai-acts { display: flex; gap: 2px; margin: -4px 0 0 -7px; }
.clai-act { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--ink3); cursor: pointer; transition: background .12s, color .12s; }
.clai-act svg { width: 16px; height: 16px; }
.clai-act:hover { background: var(--hover); color: var(--ink); }
.clai-act.is-done { color: var(--at); }
.clai-thinking { display: inline-flex; align-items: center; gap: 10px; color: var(--ink2); font-size: 14.5px; }
.clai-thinking img { display: block; height: 22px; width: auto; }
@media (prefers-reduced-motion: no-preference) {
  .clai-thinking img { animation: clai-breathe 1.5s ease-in-out infinite; }
  .clai-thinking span { background: linear-gradient(90deg, var(--ink3) 0%, var(--ink) 45%, var(--ink3) 90%) 0 0 / 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: clai-sheen 1.7s linear infinite; }
}
@keyframes clai-breathe { 0%, 100% { opacity: .55; transform: scale(.94); } 50% { opacity: 1; transform: scale(1); } }
@keyframes clai-sheen { from { background-position: 120% 0; } to { background-position: -100% 0; } }

/* ---- cards the skills put in the conversation */
.clai-card { width: min(100%, 460px); border: 1px solid var(--hair2); border-radius: 16px; background: var(--float); padding: 18px; }
.clai-k { margin: 0 0 14px; font-size: 13px; font-weight: 500; color: var(--ink2); }
.clai-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding-bottom: 16px; margin-bottom: 8px; border-bottom: 1px solid var(--hair); }
.clai-stats b { display: block; font-size: 27px; font-weight: 600; letter-spacing: -.035em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.clai-stats span { display: block; margin-top: 4px; font-size: 12.5px; color: var(--ink2); line-height: 1.3; }
.clai-line { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.clai-line span { color: var(--ink2); }
.clai-line b { font-weight: 500; }
.clai-link { display: inline-block; margin-top: 12px; font-size: 14px; font-weight: 500; color: var(--at); text-decoration: none; }
.clai-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.clai-fine { margin: 10px 0 0; font-size: 12px; line-height: 1.45; color: var(--ink2); }
.clai-card--book { width: min(100%, 640px); padding: 18px 0 0; overflow: hidden; }
.clai-card--book .clai-k { padding: 0 18px; }
.clai-card--book iframe { display: block; width: 100%; height: 660px; border: 0; background: #fff; color-scheme: light; }
.clai-card--link { border: 0; padding: 0; background: transparent; }
.clai-btn { display: inline-flex; align-items: center; height: 40px; padding: 0 18px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--sheet); background: var(--ink); text-decoration: none; transition: transform .15s, opacity .15s; }
.clai-btn:hover { opacity: .88; }
.clai-btn:active { transform: scale(.98); }

/* ---- the message box. Its edge carries the logo's blues: faint at rest, lit while you type. */
.clai-dock { position: relative; flex: none; padding: 0 24px; }
.clai-dock::before { content: ""; position: absolute; left: 0; right: 12px; bottom: 100%; height: 28px; pointer-events: none; background: linear-gradient(to top, var(--sheet), transparent); }
.clai-empty .clai-dock::before { display: none; }
.clai-form { position: relative; width: min(100%, 720px); margin: 0 auto; display: flex; align-items: flex-end; gap: 8px; min-height: 56px; padding: 9px 9px 9px 22px; border-radius: 28px; background: var(--float); box-shadow: var(--float-shadow); transition: box-shadow .2s; }
.clai-form::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; opacity: .5; transition: opacity .2s; background: linear-gradient(115deg, var(--b1), var(--b2) 45%, var(--b3)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.clai-form:focus-within { box-shadow: var(--float-shadow), 0 0 0 4px var(--glow), 0 18px 46px -20px rgba(12,143,232,.55); }
.clai-form:focus-within::before { opacity: 1; }
.clai-box { flex: 1; min-width: 0; resize: none; border: 0; outline: 0; background: transparent; font: inherit; font-size: 16px; line-height: 1.5; color: var(--ink); padding: 7px 0; max-height: 200px; }
.clai-box::placeholder { color: var(--ink3); }
.clai-send { flex: none; width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; color: #fff; cursor: pointer; background: linear-gradient(135deg, var(--b1), var(--b2)); box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 8px 16px -8px rgba(10,95,214,.9); transition: transform .15s, filter .15s; }
.clai-send svg { stroke-width: 2.1; }
.clai-send:hover { filter: brightness(1.1); }
.clai-send:active { transform: scale(.94); }
.clai-send:disabled { background: var(--on); color: var(--ink3); box-shadow: none; cursor: default; filter: none; transform: none; }
.clai-note { flex: none; margin: 0; padding: 10px 24px 12px; text-align: center; font-size: 12px; line-height: 1.4; color: var(--ink3); }
.clai-note b { font-weight: 500; color: var(--ink2); }

/* ---- embedded in another site: just the sheet, edge to edge */
.is-embed .clai-side, .is-embed .clai-shade, .is-embed .clai-top__open, .is-embed .clai-top__theme { display: none !important; }
.is-embed .clai-main { margin: 0; border-radius: 0; box-shadow: none; }
.is-embed .clai-top { padding-left: 12px; }
.is-embed .clai-top__logo, .is-embed .clai-top__new { display: inline-flex; }

/* ---- phones and small tablets: the sidebar is a drawer, the message box stays at the bottom */
@media (max-width: 900px) {
  .clai-main, .clai-collapsed .clai-main { margin: 0; border-radius: 0; box-shadow: none; }
  .clai-side, .clai-collapsed .clai-side { position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; width: min(84vw, 300px); margin-left: 0; padding: 10px; background: var(--frame); transform: translateX(-104%); transition: transform .24s cubic-bezier(.3,.7,.2,1); }
  .clai-drawer .clai-side { transform: none; box-shadow: 0 0 70px rgba(0,0,0,.35); }
  .clai-drawer .clai-shade { display: block; position: fixed; inset: 0; z-index: 20; background: rgba(6,8,11,.5); }
  .clai-top { height: 52px; padding: 0 10px 0 6px; }
  .clai-top__open, .clai-top__logo { display: inline-flex; }
  .clai-top__new, .clai-collapsed .clai-top__new { display: none; }
  .is-embed .clai-top__new { display: inline-flex; }
  .clai-top__logo { margin-left: 2px; }
  .clai-top__logo img { height: 26px; }
  .clai-cta { height: 34px; padding: 0 13px; font-size: 13px; }
  .clai-thread { padding: 8px 16px 22px; gap: 22px; }
  .clai-empty .clai-stage { justify-content: flex-start; padding-bottom: 0; }
  .clai-empty .clai-scroll { flex: 1; display: flex; overflow-y: auto; }
  .clai-empty .clai-thread { margin: auto; padding-bottom: 12px; }
  .clai-welcome__logo { height: 52px; margin-bottom: 18px; }
  .clai-starters { order: 1; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; margin: 0 0 12px; padding: 0 16px; scrollbar-width: none; }
  .clai-starters::-webkit-scrollbar { display: none; }
  .clai-dock { order: 2; padding: 0 12px; }
  .clai-form { min-height: 52px; padding: 7px 7px 7px 18px; border-radius: 26px; }
  .clai-msg--user .clai-text { max-width: 88%; }
  .clai-card--book iframe { height: 620px; }
  .clai-note { padding: 8px 14px calc(10px + env(safe-area-inset-bottom)); font-size: 11px; }
  .clai-stats b { font-size: 23px; }
}
@media (prefers-reduced-motion: reduce) { .clai-side, .clai-main { transition: none; } }
