/* Web app styles. Midnight theme by default, light theme on request; one accent family (blue -> cyan).
   No external fonts or images: everything here works under the page's strict Content Security Policy. */

:root {
  --accent: #2469ad;                 /* brand accent (overridden from branding at runtime) */
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Text",
          system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Inter Display", "Segoe UI Variable Display", "Segoe UI", -apple-system, "SF Pro Display",
             system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  --radius: 10px;
  --radius-lg: 16px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

/* ---------- midnight (default) ---------- */
:root, [data-theme="dark"] {
  color-scheme: dark;
  --bg: #070b14;
  --bg-2: #0b1220;
  --panel: #0d1526;
  --surface: rgba(255, 255, 255, .035);
  --surface-2: rgba(255, 255, 255, .06);
  --surface-3: rgba(255, 255, 255, .09);
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .13);
  --ink: #e9eef6;
  --ink-2: #b6c2d3;
  --muted: #7f8ca1;
  --brand: #5aa2ff;
  --brand-2: #39d0f2;
  --brand-ink: #ffffff;
  --brand-soft: rgba(90, 162, 255, .14);
  --grad: linear-gradient(135deg, #4b8dff 0%, #39c6f0 100%);
  --grad-text: linear-gradient(100deg, #8cc4ff 0%, #58d7f7 55%, #a5b4ff 100%);
  --ok: #3ddc97;
  --ok-soft: rgba(61, 220, 151, .12);
  --warn: #f5c451;
  --warn-soft: rgba(245, 196, 81, .12);
  --bad: #ff8178;
  --bad-soft: rgba(255, 129, 120, .12);
  --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 12px 40px -12px rgba(0, 0, 0, .6);
  --shadow-sm: 0 6px 20px -10px rgba(0, 0, 0, .7);
  --glow: 0 0 0 1px rgba(90, 162, 255, .35), 0 0 32px -6px rgba(57, 208, 242, .45);
}

/* ---------- light ---------- */
[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fb;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --surface: rgba(13, 27, 42, .03);
  --surface-2: rgba(13, 27, 42, .055);
  --surface-3: rgba(13, 27, 42, .08);
  --line: rgba(13, 27, 42, .08);
  --line-2: rgba(13, 27, 42, .14);
  --ink: #0d1b2a;
  --ink-2: #33445a;
  --muted: #66758a;
  --brand: #1f63c9;
  --brand-2: #0aa6c9;
  --brand-ink: #ffffff;
  --brand-soft: rgba(31, 99, 201, .09);
  --grad: linear-gradient(135deg, #2a6fe0 0%, #12a9cf 100%);
  --grad-text: linear-gradient(100deg, #1f63c9 0%, #0b98c0 60%, #5b5bd6 100%);
  --ok: #138a59;
  --ok-soft: rgba(19, 138, 89, .1);
  --warn: #9a6400;
  --warn-soft: rgba(154, 100, 0, .1);
  --bad: #c2362c;
  --bad-soft: rgba(194, 54, 44, .08);
  --shadow: 0 1px 2px rgba(13, 27, 42, .05), 0 12px 32px -14px rgba(13, 27, 42, .22);
  --shadow-sm: 0 4px 14px -8px rgba(13, 27, 42, .25);
  --glow: 0 0 0 1px rgba(31, 99, 201, .3), 0 0 26px -8px rgba(10, 166, 201, .45);
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14.5px/1.6 var(--font); letter-spacing: -.003em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
button, input, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
::selection { background: rgba(90, 162, 255, .35); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 18px; height: 18px; flex: none; }
.icon.sm { width: 15px; height: 15px; }
.grad-text { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }

@media (prefers-reduced-motion: no-preference) {
  .rise { animation: rise .5s var(--ease) both; }
  .rise.d1 { animation-delay: .06s; } .rise.d2 { animation-delay: .12s; } .rise.d3 { animation-delay: .18s; }
  .rise.d4 { animation-delay: .24s; } .rise.d5 { animation-delay: .3s; }
  .fade { animation: fade .25s ease-out both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: var(--radius); border: 1px solid var(--line-2); background: var(--surface);
  font-weight: 560; text-decoration: none; color: var(--ink); white-space: nowrap;
  transition: background .15s, border-color .15s, transform .15s var(--ease), box-shadow .2s;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 8px 24px -10px rgba(57, 160, 240, .7); }
.btn.primary:hover { filter: brightness(1.08); box-shadow: 0 10px 30px -10px rgba(57, 190, 240, .85); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.lg { height: 48px; padding: 0 24px; font-size: 15.5px; border-radius: 12px; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 8px; gap: 6px; }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; filter: none; transform: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 0;
  background: transparent; color: var(--muted); transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.btn .arrow { transition: transform .2s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }

/* ---------- brand mark ---------- */
.mark {
  position: relative; width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: var(--grad); color: #fff; font: 700 15px/1 var(--display); letter-spacing: .02em;
  box-shadow: 0 6px 18px -6px rgba(57, 190, 240, .65), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.mark::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(120% 80% at 30% 0%, rgba(255, 255, 255, .35), transparent 55%);
}
.mark.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 24px; }
.mark.xl { width: 72px; height: 72px; border-radius: 20px; font-size: 30px; }
.mark img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.mark .ring {
  position: absolute; inset: -6px; border-radius: 22px; border: 1px solid rgba(90, 162, 255, .35);
  box-shadow: 0 0 40px -6px rgba(57, 208, 242, .55);
}

/* =====================================================================================
   HOME (welcome + sign-in). Always midnight, whatever the app theme.
   ===================================================================================== */
.home {
  --ink: #eef3fa; --ink-2: #b9c6d8; --muted: #8392a8; --line: rgba(255, 255, 255, .08); --line-2: rgba(255, 255, 255, .14);
  --surface: rgba(255, 255, 255, .04); --surface-2: rgba(255, 255, 255, .07); --brand: #6aaeff;
  position: relative; min-height: 100vh; overflow: hidden; background: #050913; color: var(--ink);
  display: flex; flex-direction: column; color-scheme: dark;
}
.home .bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
/* starfield drifting slowly down, and a perspective grid floor rolling toward the viewer */
.home .stars {
  position: absolute; left: 0; right: 0; top: -260px; bottom: 0; opacity: .6;
  background-image:
    radial-gradient(1px 1px at 22px 34px, rgba(255, 255, 255, .7), transparent 60%),
    radial-gradient(1px 1px at 118px 86px, rgba(255, 255, 255, .45), transparent 60%),
    radial-gradient(1.6px 1.6px at 196px 158px, rgba(140, 196, 255, .8), transparent 60%),
    radial-gradient(1px 1px at 262px 42px, rgba(255, 255, 255, .5), transparent 60%),
    radial-gradient(1.2px 1.2px at 318px 214px, rgba(165, 180, 255, .7), transparent 60%),
    radial-gradient(1px 1px at 72px 190px, rgba(255, 255, 255, .35), transparent 60%);
  background-size: 360px 260px;
  -webkit-mask-image: linear-gradient(#000 30%, transparent 85%); mask-image: linear-gradient(#000 30%, transparent 85%);
}
.home .floor {
  position: absolute; left: -50%; right: -50%; bottom: 0; height: 52%;
  transform-origin: 50% 100%; transform: perspective(480px) rotateX(66deg);
  background-image: linear-gradient(rgba(90, 162, 255, .26) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(90, 162, 255, .26) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: linear-gradient(to top, #000 0%, rgba(0, 0, 0, .55) 30%, transparent 78%);
  mask-image: linear-gradient(to top, #000 0%, rgba(0, 0, 0, .55) 30%, transparent 78%);
}
.home .floor::after {   /* glowing horizon line where the floor fades out */
  content: ""; position: absolute; left: 0; right: 0; top: 22%; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(57, 208, 242, .55), transparent);
  filter: blur(1px);
}
@media (prefers-reduced-motion: no-preference) {
  .home .stars { animation: stars 140s linear infinite; }
  .home .floor { animation: floor 3.2s linear infinite; }
}
@keyframes stars { to { transform: translate3d(0, 260px, 0); } }
@keyframes floor { to { background-position: 0 64px, 0 0; } }
.home .orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .55; }
.home .orb.a { width: 560px; height: 560px; left: -140px; top: -180px; background: #1e5fd6; }
.home .orb.b { width: 520px; height: 520px; right: -160px; top: 80px; background: #0ea5c6; opacity: .38; }
.home .orb.c { width: 640px; height: 420px; left: 30%; bottom: -260px; background: #4338ca; opacity: .32; }
@media (prefers-reduced-motion: no-preference) {
  .home .orb.a { animation: drift-a 22s ease-in-out infinite alternate; }
  .home .orb.b { animation: drift-b 26s ease-in-out infinite alternate; }
  .home .orb.c { animation: drift-c 30s ease-in-out infinite alternate; }
}
@keyframes drift-a { to { transform: translate(120px, 80px) scale(1.1); } }
@keyframes drift-b { to { transform: translate(-100px, 60px) scale(.92); } }
@keyframes drift-c { to { transform: translate(-80px, -60px) scale(1.08); } }

.home-nav {
  position: relative; z-index: 2; display: flex; align-items: center; gap: 12px;
  max-width: 1160px; width: 100%; margin: 0 auto; padding: 22px 24px;
}
.home-nav .name { font: 650 16px/1 var(--display); letter-spacing: .01em; }
.home-nav .spacer { flex: 1; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, .03); color: var(--ink-2); font-size: 12.5px; font-weight: 550;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: #3ddc97; box-shadow: 0 0 10px #3ddc97; }

.home-main {
  position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 24px 24px 40px; text-align: center;
}
.hero { max-width: 820px; display: grid; justify-items: center; gap: 22px; }
.home-main.welcome { justify-content: flex-start; padding-top: 8px; }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 12px;
  max-width: 1200px; width: 100%; margin: 0 auto;
}
.hero-grid .hero { justify-items: start; text-align: left; translate: calc(var(--px, 0) * -10px) calc(var(--py, 0) * -8px);
                   transition: translate .5s var(--ease); }
.hero-grid .hero .ctas, .hero-grid .hero .trust { justify-content: flex-start; }
.hero h1 .grad-text { filter: drop-shadow(0 0 26px rgba(57, 208, 242, .35)); }
.hero h1 {
  margin: 4px 0 0; font: 700 clamp(40px, 6.4vw, 72px)/1.04 var(--display); letter-spacing: -.035em;
}
.hero h1 .line { display: block; }
.hero p.lead { margin: 0; max-width: 620px; font-size: clamp(15.5px, 1.6vw, 18px); line-height: 1.6; color: var(--ink-2); }
.hero .ctas { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.hero .trust { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; color: var(--muted); font-size: 13px; }
.hero .trust span { display: inline-flex; align-items: center; gap: 7px; }
.hero .trust .icon { color: #6aaeff; }

.features {
  position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px;
  max-width: 1080px; width: 100%; margin: 56px auto 0; text-align: left;
}
.tilt-wrap { perspective: 1000px; }
.feature {
  position: relative; height: 100%; border: 1px solid rgba(255, 255, 255, .09); border-radius: 18px; padding: 22px 22px 24px;
  background: linear-gradient(160deg, rgba(30, 48, 84, .72), rgba(10, 17, 32, .82) 70%);
  box-shadow: 0 30px 60px -34px rgba(0, 0, 0, .9), 0 1px 0 rgba(255, 255, 255, .06) inset;
  transition: border-color .25s, box-shadow .3s;
}
.feature:hover { border-color: rgba(106, 174, 255, .4);
                 box-shadow: 0 40px 70px -30px rgba(0, 0, 0, .9), 0 0 40px -12px rgba(57, 208, 242, .35); }
.feature .fi {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(75, 141, 255, .35), rgba(57, 198, 240, .18)); color: #bfe0ff;
  border: 1px solid rgba(140, 196, 255, .35);
  box-shadow: 0 12px 24px -10px rgba(57, 160, 240, .7), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.feature .fn { position: absolute; top: 20px; right: 22px; font: 600 12px/1 var(--mono); color: rgba(140, 196, 255, .45); }
.feature h3 { margin: 0 0 6px; font: 620 16px/1.3 var(--display); }
.feature p { margin: 0; color: var(--ink-2); font-size: 13.5px; line-height: 1.55; }

/* 3D tilt (set from JS): the card turns toward the pointer; its contents sit at different depths */
.tilt {
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transform-style: preserve-3d;
  transition: transform .6s var(--ease), border-color .25s, box-shadow .3s;
}
.tilt.active { transition: transform .12s linear, border-color .25s, box-shadow .3s; }
.tilt::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(360px circle at var(--gx, 50%) var(--gy, 50%), rgba(140, 196, 255, .14), transparent 50%);
}
.tilt.active::before { opacity: 1; }
.feature.tilt .fi { transform: translateZ(40px); }
.feature.tilt h3 { transform: translateZ(26px); }
.feature.tilt p, .feature.tilt .fn { transform: translateZ(14px); }

/* the globe */
.globe-stage {
  position: relative; width: 100%; max-width: 640px; aspect-ratio: 1; justify-self: center;
  translate: calc(var(--px, 0) * 14px) calc(var(--py, 0) * 12px); transition: translate .5s var(--ease);
}
.globe { position: absolute; inset: 0; }
.globe-canvas { position: relative; display: block; width: 100%; height: 100%; cursor: grab; touch-action: pan-y; }
.globe-canvas.on-node { cursor: pointer; }
.globe-canvas.dragging { cursor: grabbing; }
.globe-glow {
  position: absolute; inset: 22%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(57, 160, 242, .32), rgba(67, 56, 202, .14) 48%, transparent 70%);
  filter: blur(18px);
}
@media (prefers-reduced-motion: no-preference) { .globe-glow { animation: breathe 6s ease-in-out infinite; } }
@keyframes breathe { 50% { transform: scale(1.12); opacity: .75; } }
.globe-chips { position: absolute; inset: 0; pointer-events: none; }
.gchip {
  position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 9px; padding: 7px 12px 7px 7px;
  border-radius: 12px; white-space: nowrap; text-align: left; opacity: 0; will-change: transform, opacity;
  background: rgba(12, 20, 38, .78); border: 1px solid rgba(106, 174, 255, .3);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: 0 14px 30px -14px rgba(0, 0, 0, .9), 0 0 24px -10px rgba(57, 208, 242, .5);
}
.gchip::after {   /* stem down to the node */
  content: ""; position: absolute; left: 50%; bottom: -13px; width: 1px; height: 12px;
  background: linear-gradient(rgba(106, 174, 255, .6), transparent);
}
.gchip .gi { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
             background: rgba(90, 162, 255, .18); color: #9fd0ff; }
.gchip b { display: block; font-size: 12px; line-height: 1.2; color: var(--ink); }
.gchip .s { display: block; font-size: 11px; line-height: 1.25; color: var(--muted); }
.globe-hint {
  position: absolute; left: 50%; bottom: 2%; transform: translateX(-50%); font-size: 11.5px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); pointer-events: none; transition: opacity .6s;
}
.globe-hint.gone { opacity: 0; }
.globe.bg-mode .globe-canvas { cursor: default; }
.globe.bg-mode .globe-hint, .globe.bg-mode .globe-chips { display: none; }
.home .globe-holder {
  position: absolute; left: 50%; top: 52%; width: min(1000px, 150vw); aspect-ratio: 1;
  transform: translate(-50%, -50%); opacity: .55;
}

/* the floating "ask" card */
.ask-demo {
  position: absolute; left: 0; bottom: 9%; width: min(330px, 74%); padding: 13px 15px 12px; border-radius: 16px;
  text-align: left; background: linear-gradient(180deg, rgba(24, 38, 66, .86), rgba(10, 17, 32, .9));
  border: 1px solid rgba(106, 174, 255, .28); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 30px 60px -26px rgba(0, 0, 0, .9), 0 0 36px -14px rgba(57, 160, 240, .55);
}
@media (prefers-reduced-motion: no-preference) { .ask-demo { animation: float 7s ease-in-out infinite; } }
@keyframes float { 50% { transform: translateY(-10px); } }
.ask-demo .row { display: flex; align-items: center; gap: 10px; min-height: 26px; font-size: 14.5px; font-weight: 520; color: var(--ink); }
.ask-demo .si { width: 26px; height: 26px; border-radius: 8px; flex: none; display: grid; place-items: center;
                background: var(--grad); color: #fff; box-shadow: 0 6px 16px -6px rgba(57, 190, 240, .8); }
.ask-demo .q { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ask-demo .caret { width: 2px; height: 17px; margin-left: -8px; background: #58d7f7; flex: none; }
@media (prefers-reduced-motion: no-preference) { .ask-demo .caret { animation: blink 1s steps(2) infinite; } }
.ask-demo .meta { display: flex; align-items: center; gap: 7px; margin-top: 9px; padding-top: 9px;
                  border-top: 1px solid rgba(255, 255, 255, .07); font-size: 12px; color: var(--muted); }
.ask-demo .meta .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); transition: background .3s, box-shadow .3s; }
.ask-demo .meta.busy .dot { background: #58d7f7; box-shadow: 0 0 10px #58d7f7; }
@media (prefers-reduced-motion: no-preference) { .ask-demo .meta.busy .dot { animation: blink .7s steps(2) infinite; } }
.ask-demo .meta.done { color: #8fe8c2; }
.ask-demo .meta.done .dot { background: #3ddc97; box-shadow: 0 0 10px #3ddc97; }

/* primary call to action: a light sweep every few seconds */
.btn.shine { position: relative; overflow: hidden; }
.btn.shine::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; transform: skewX(-20deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent);
}
@media (prefers-reduced-motion: no-preference) { .btn.shine::after { animation: shine 4.5s ease-in-out 1.2s infinite; } }
@keyframes shine { 0% { left: -60%; } 30%, 100% { left: 130%; } }

.home-foot { position: relative; z-index: 1; padding: 18px 24px 26px; text-align: center; color: var(--muted); font-size: 12.5px; }

/* sign-in step */
.auth-card {
  width: 100%; max-width: 440px; text-align: left; border-radius: 22px; padding: 30px 28px 26px;
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, rgba(20, 32, 56, .78), rgba(10, 17, 32, .82));
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8), 0 0 0 1px rgba(90, 162, 255, .08) inset;
}
.home-main.signin .tilt-wrap { width: 100%; max-width: 440px; }
.auth-card.tilt { box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .9), 0 0 60px -20px rgba(57, 160, 240, .35),
                               0 0 0 1px rgba(90, 162, 255, .1) inset; }
.auth-card { position: relative; }
.auth-card .head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.auth-card h2 { margin: 0; font: 680 23px/1.2 var(--display); letter-spacing: -.02em; }
.auth-card .sub { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; }
.auth-card form { display: grid; gap: 14px; margin-top: 4px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); letter-spacing: .01em; }
.input {
  height: 44px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--line-2); width: 100%;
  background: rgba(255, 255, 255, .04); transition: border-color .15s, box-shadow .2s, background .15s;
}
.input::placeholder { color: var(--muted); }
.input:focus { outline: none; border-color: rgba(106, 174, 255, .7); background: rgba(255, 255, 255, .06);
               box-shadow: 0 0 0 4px rgba(90, 162, 255, .16); }
.hint { font-size: 12px; color: var(--muted); }
.form-error { color: var(--bad); font-size: 13px; min-height: 1.2em; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 14px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; border: 0; background: none;
             color: var(--muted); font-size: 13px; padding: 4px 0; }
.back-link:hover { color: var(--ink); }

/* =====================================================================================
   CHAT
   ===================================================================================== */
.shell { height: 100%; display: grid; grid-template-columns: 276px minmax(0, 1fr) 340px; background: var(--bg); }
.shell.no-sources { grid-template-columns: 276px minmax(0, 1fr) 0; }

/* sidebar */
.sidebar {
  display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
}
.brand { display: flex; align-items: center; gap: 11px; padding: 18px 18px 14px; }
.brand .name { font: 680 16px/1.1 var(--display); letter-spacing: -.01em; }
.brand .sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.new-chat { margin: 4px 14px 14px; justify-content: flex-start; height: 40px; }
.new-chat .kbd { margin-left: auto; }
.kbd { font: 600 10.5px/1 var(--mono); color: var(--muted); border: 1px solid var(--line-2); border-radius: 5px; padding: 3px 5px; }
.conv-label { padding: 8px 20px 6px; font-size: 11px; font-weight: 650; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.conv-list { flex: 1; overflow-y: auto; padding: 0 10px 10px; }
.conv { display: flex; align-items: center; border-radius: 9px; padding: 0 4px 0 10px; color: var(--ink-2); position: relative; }
.conv:hover { background: var(--surface-2); color: var(--ink); }
.conv.active { background: var(--brand-soft); color: var(--ink); }
.conv.active::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--grad); }
.conv button.open {
  flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; padding: 9px 0; font-size: 13.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.conv .icon-btn { width: 28px; height: 28px; opacity: 0; }
.conv:hover .icon-btn, .conv.active .icon-btn, .conv .icon-btn:focus-visible { opacity: 1; }
.conv-empty { padding: 6px 20px; color: var(--muted); font-size: 13px; }
.sidebar-foot { border-top: 1px solid var(--line); padding: 10px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.sidebar-foot .btn { justify-content: flex-start; width: 100%; }
.sidebar-foot .btn .status { margin-left: auto; font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px 6px 4px 8px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #3a4f72, #22324d); color: #dce7f7; font-weight: 650; font-size: 12.5px;
  border: 1px solid var(--line-2);
}
[data-theme="light"] .avatar { background: linear-gradient(135deg, #dfe8f6, #c9d7ec); color: #1d3557; }
.me .who { flex: 1; min-width: 0; line-height: 1.25; }
.me .who b { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me .who span { display: block; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.warn { background: var(--warn); }

/* main column */
.main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.main::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 360px; pointer-events: none;
  background: radial-gradient(60% 100% at 50% 0%, rgba(75, 141, 255, .10), transparent 70%);
}
[data-theme="light"] .main::before { background: radial-gradient(60% 100% at 50% 0%, rgba(31, 99, 201, .07), transparent 70%); }
.topbar {
  position: relative; z-index: 2; display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.topbar .title { flex: 1; min-width: 0; font-weight: 620; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-btn, .sources-btn { display: none; }
.scope-chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 550; color: var(--ink-2);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 11px 4px 9px; background: var(--surface); white-space: nowrap;
}
.scope-chip .icon { width: 14px; height: 14px; color: var(--ok); }

.thread { position: relative; z-index: 1; flex: 1; overflow-y: auto; padding: 28px 20px 12px; scroll-behavior: smooth; }
.thread-inner { max-width: 800px; margin: 0 auto; display: grid; gap: 26px; }

/* empty state */
.empty { max-width: 760px; margin: 7vh auto 0; text-align: center; display: grid; gap: 14px; justify-items: center; }
.empty .hello { color: var(--muted); font-size: 14px; font-weight: 550; margin-top: 18px; }
.empty h2 { margin: 0; font: 700 clamp(28px, 3.6vw, 40px)/1.12 var(--display); letter-spacing: -.03em; }
.empty p { margin: 0; color: var(--ink-2); max-width: 520px; }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; width: 100%; margin-top: 18px; }
.suggestion {
  display: flex; align-items: flex-start; gap: 12px; text-align: left; border: 1px solid var(--line);
  background: var(--surface); border-radius: 14px; padding: 14px 16px; color: var(--ink);
  transition: border-color .15s, background .15s, transform .2s var(--ease), box-shadow .2s;
}
.suggestion:hover { border-color: rgba(90, 162, 255, .45); background: var(--surface-2); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.suggestion .si { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none;
                  background: var(--brand-soft); color: var(--brand); }
.suggestion b { display: block; font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.suggestion span { display: block; font-size: 12.5px; color: var(--muted); }
.callout {
  width: 100%; display: flex; gap: 16px; align-items: center; justify-content: space-between; text-align: left;
  border: 1px solid var(--line-2); background: var(--surface); border-radius: 16px; padding: 18px 20px; margin-top: 18px;
}
.callout strong { display: block; font-size: 15px; }
.callout span { color: var(--muted); font-size: 13px; }

/* messages */
.msg { display: flex; gap: 14px; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble {
  max-width: 78%; padding: 11px 16px; border-radius: 18px 18px 6px 18px; color: #fff;
  background: var(--grad); box-shadow: 0 10px 26px -14px rgba(57, 160, 240, .8);
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px;
}
.msg.assistant .mark { width: 30px; height: 30px; border-radius: 9px; font-size: 13px; margin-top: 2px; }
.msg.assistant .body { flex: 1; min-width: 0; }
.answer { overflow-wrap: anywhere; font-size: 15px; line-height: 1.7; color: var(--ink); }
.answer > :first-child { margin-top: 0; }
.answer > :last-child { margin-bottom: 0; }
.answer p, .answer ul, .answer ol { margin: 0 0 12px; }
.answer ul, .answer ol { padding-left: 22px; }
.answer li { margin: 4px 0; }
.answer li::marker { color: var(--muted); }
.answer strong { font-weight: 650; color: var(--ink); }
.answer h3, .answer h4 { margin: 18px 0 8px; font: 650 15.5px/1.35 var(--display); }
.answer code { font: 12.5px var(--mono); background: var(--surface-2); padding: 2px 6px; border-radius: 5px; }
.answer pre { background: var(--surface-2); border: 1px solid var(--line); padding: 12px 14px; border-radius: 10px; overflow-x: auto; }
.answer pre code { background: none; padding: 0; }
.cite {
  display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; margin: 0 2px;
  border-radius: 6px; border: 1px solid rgba(90, 162, 255, .3); vertical-align: 1px; font: 650 10.5px/1 var(--font);
  background: var(--brand-soft); color: var(--brand); transition: background .15s, color .15s;
}
button.cite:hover, .cite.on { background: var(--brand); color: #fff; border-color: transparent; }
.cite.more { padding: 0 7px; border-style: dashed; }
.msg-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-size: 12px; font-weight: 550;
}
button.chip:hover { background: var(--surface-2); color: var(--ink); }
.chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: var(--ok-soft); }
.chip .icon { width: 14px; height: 14px; }
.note { border-radius: 12px; padding: 11px 14px; font-size: 13.5px; border: 1px solid transparent; }
.note.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.note.bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }

/* live progress */
.steps { display: grid; gap: 7px; margin: 2px 0 12px; }
.step { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); }
.step .icon { width: 15px; height: 15px; color: var(--ok); }
.step.now { color: var(--ink-2); }
.spinner { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--brand-2); flex: none; }
@media (prefers-reduced-motion: no-preference) {
  .spinner { animation: spin .8s linear infinite; }
  .step.now .label {
    background: linear-gradient(90deg, var(--ink-2) 0%, var(--ink) 40%, var(--ink-2) 80%);
    background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: shimmer 1.6s linear infinite;
  }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.cursor::after { content: ""; display: inline-block; width: 7px; height: 16px; margin-left: 3px; vertical-align: -2px;
                 border-radius: 2px; background: var(--brand-2); }
@media (prefers-reduced-motion: no-preference) { .cursor::after { animation: blink 1s steps(2) infinite; } }
@keyframes blink { 50% { opacity: 0; } }

/* composer */
.composer-wrap { position: relative; z-index: 2; padding: 10px 20px 18px; }
.composer {
  max-width: 800px; margin: 0 auto; display: flex; align-items: flex-end; gap: 10px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px; padding: 10px 10px 10px 18px;
  box-shadow: var(--shadow); transition: border-color .2s, box-shadow .25s;
}
.composer:focus-within { border-color: rgba(90, 162, 255, .55); box-shadow: var(--shadow), var(--glow); }
.composer textarea {
  flex: 1; border: 0; outline: none; resize: none; background: transparent; padding: 8px 0;
  max-height: 200px; min-height: 26px; line-height: 1.55; font-size: 15px;
}
.composer textarea::placeholder { color: var(--muted); }
.composer .send { width: 40px; height: 40px; padding: 0; border-radius: 12px; }
.composer-meta { max-width: 800px; margin: 8px auto 0; display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; color: var(--muted); }
.composer-meta span { display: inline-flex; align-items: center; gap: 6px; }

/* sources panel */
.sources { border-left: 1px solid var(--line); background: var(--bg-2); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.sources-head { display: flex; align-items: center; gap: 8px; height: 60px; padding: 0 12px 0 20px; border-bottom: 1px solid var(--line); }
.sources-head .t { flex: 1; font-weight: 640; }
.sources-head .count { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 6px; }
.sources-list { flex: 1; overflow-y: auto; padding: 14px; display: grid; gap: 10px; align-content: start; }
.sources-empty { color: var(--muted); font-size: 13px; padding: 26px 10px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.sources-empty .icon { width: 28px; height: 28px; opacity: .6; }
.source-card {
  border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px; display: grid; gap: 8px; background: var(--surface);
  transition: border-color .2s, box-shadow .25s, background .2s;
}
.source-card:hover { border-color: var(--line-2); background: var(--surface-2); }
.source-card.on { border-color: rgba(90, 162, 255, .6); box-shadow: var(--glow); }
.source-top { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.source-n { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 7px; background: var(--grad); color: #fff; font-weight: 700; font-size: 11px; }
.badge { border-radius: 999px; padding: 1px 9px; font-size: 11px; font-weight: 650; border: 1px solid var(--line-2); color: var(--ink-2); }
.badge.pmtool { color: #b9a6ff; border-color: rgba(167, 139, 250, .35); background: rgba(167, 139, 250, .1); }
.badge.slack { color: #5fe0c0; border-color: rgba(52, 211, 153, .35); background: rgba(52, 211, 153, .1); }
[data-theme="light"] .badge.pmtool { color: #5b3fc4; background: rgba(91, 63, 196, .08); }
[data-theme="light"] .badge.slack { color: #0c7a5c; background: rgba(12, 122, 92, .08); }
.source-title { font-weight: 600; font-size: 13.5px; line-height: 1.4; overflow-wrap: anywhere; }
.source-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 11.5px; color: var(--muted); }
.source-meta .ok { display: inline-flex; align-items: center; gap: 4px; color: var(--ok); }
.source-meta .ok .icon { width: 13px; height: 13px; }
.source-meta a { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-weight: 600; text-decoration: none; }
.source-meta a .icon { width: 13px; height: 13px; }

/* dialog */
.overlay { position: fixed; inset: 0; background: rgba(3, 7, 15, .6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
           display: grid; place-items: center; padding: 16px; z-index: 40; }
.dialog { width: 100%; max-width: 540px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--panel);
          border: 1px solid var(--line-2); border-radius: 20px; box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .7); }
.dialog-head { display: flex; align-items: center; gap: 10px; padding: 20px 18px 6px 24px; }
.dialog-head h2 { flex: 1; font: 680 19px/1.2 var(--display); margin: 0; letter-spacing: -.01em; }
.dialog-body { padding: 4px 24px 24px; display: grid; gap: 12px; }
.dialog-body > p { margin: 0 0 4px; color: var(--ink-2); font-size: 13.5px; }
.conn { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 16px; display: grid; gap: 10px; }
.conn-top { display: flex; align-items: center; gap: 12px; }
.conn-logo { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 750; font-size: 14px; color: #fff; flex: none; }
.conn-logo.pmtool { background: linear-gradient(135deg, #7c5cff, #4f46e5); }
.conn-logo.slack { background: linear-gradient(135deg, #2bbf93, #0f8f74); }
.conn-top .meta { flex: 1; min-width: 0; }
.conn-top strong { display: block; font-size: 14.5px; }
.conn-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.conn form { display: grid; gap: 8px; }
.conn .row { display: flex; gap: 8px; }
.conn .row .input { flex: 1; height: 40px; background: var(--surface); }
[data-theme="light"] .input { background: #fff; }

/* toast */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: min(460px, calc(100vw - 32px)); }
.toast { background: #111b2e; color: #e9eef6; border: 1px solid rgba(255, 255, 255, .1); border-radius: 12px; padding: 11px 16px; box-shadow: 0 20px 40px -20px rgba(0, 0, 0, .7); font-size: 13.5px; }
.toast.bad { background: #3b1513; border-color: rgba(255, 129, 120, .35); color: #ffd9d5; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

/* ---------- small screens ---------- */
@media (max-width: 1180px) {
  .shell, .shell.no-sources { grid-template-columns: 260px minmax(0, 1fr); }
  .sources { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 92vw); z-index: 30; box-shadow: var(--shadow);
             transform: translateX(100%); transition: transform .25s var(--ease); }
  .shell.show-sources .sources { transform: none; }
  .sources-btn { display: inline-grid; }
}
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .hero-grid .globe-stage { order: -1; max-width: 440px; margin: -16px auto 8px; }
  .hero-grid .hero { justify-items: center; text-align: center; translate: none; }
  .hero-grid .hero .ctas, .hero-grid .hero .trust { justify-content: center; }
  .ask-demo { left: 50%; bottom: 0; translate: -50% 0; }
  .globe-hint { display: none; }
}
@media (max-width: 860px) {
  .features { grid-template-columns: minmax(0, 1fr); max-width: 520px; margin-top: 40px; }
  .suggestions { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 780px) {
  .shell, .shell.no-sources { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); z-index: 30; box-shadow: var(--shadow);
             transform: translateX(-100%); transition: transform .25s var(--ease); }
  .shell.show-menu .sidebar { transform: none; }
  .menu-btn { display: inline-grid; }
  .scope-chip { display: none; }
  .thread { padding: 18px 16px 8px; }
  .composer-wrap { padding: 8px 12px 12px; }
  .composer-meta .right { display: none; }
  .msg.user .bubble { max-width: 90%; }
  .home-nav .pill { display: none; }
  .gchip { display: none; }
  .ask-demo { width: min(300px, 86%); }
}
@media (prefers-reduced-motion: reduce) { .sources, .sidebar { transition: none; } }
