/*!*****************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[13].oneOf[12].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[13].oneOf[12].use[3]!./src/app/globals.css ***!
  \*****************************************************************************************************************************************************************************************************************************************************************/
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;1,6..72,400&display=swap');

*, ::before, ::after{
  --tw-border-spacing-x: 0;
  --tw-border-spacing-y: 0;
  --tw-translate-x: 0;
  --tw-translate-y: 0;
  --tw-rotate: 0;
  --tw-skew-x: 0;
  --tw-skew-y: 0;
  --tw-scale-x: 1;
  --tw-scale-y: 1;
  --tw-pan-x:  ;
  --tw-pan-y:  ;
  --tw-pinch-zoom:  ;
  --tw-scroll-snap-strictness: proximity;
  --tw-gradient-from-position:  ;
  --tw-gradient-via-position:  ;
  --tw-gradient-to-position:  ;
  --tw-ordinal:  ;
  --tw-slashed-zero:  ;
  --tw-numeric-figure:  ;
  --tw-numeric-spacing:  ;
  --tw-numeric-fraction:  ;
  --tw-ring-inset:  ;
  --tw-ring-offset-width: 0px;
  --tw-ring-offset-color: #fff;
  --tw-ring-color: rgb(59 130 246 / 0.5);
  --tw-ring-offset-shadow: 0 0 #0000;
  --tw-ring-shadow: 0 0 #0000;
  --tw-shadow: 0 0 #0000;
  --tw-shadow-colored: 0 0 #0000;
  --tw-blur:  ;
  --tw-brightness:  ;
  --tw-contrast:  ;
  --tw-grayscale:  ;
  --tw-hue-rotate:  ;
  --tw-invert:  ;
  --tw-saturate:  ;
  --tw-sepia:  ;
  --tw-drop-shadow:  ;
  --tw-backdrop-blur:  ;
  --tw-backdrop-brightness:  ;
  --tw-backdrop-contrast:  ;
  --tw-backdrop-grayscale:  ;
  --tw-backdrop-hue-rotate:  ;
  --tw-backdrop-invert:  ;
  --tw-backdrop-opacity:  ;
  --tw-backdrop-saturate:  ;
  --tw-backdrop-sepia:  ;
  --tw-contain-size:  ;
  --tw-contain-layout:  ;
  --tw-contain-paint:  ;
  --tw-contain-style:  ;
}

::backdrop{
  --tw-border-spacing-x: 0;
  --tw-border-spacing-y: 0;
  --tw-translate-x: 0;
  --tw-translate-y: 0;
  --tw-rotate: 0;
  --tw-skew-x: 0;
  --tw-skew-y: 0;
  --tw-scale-x: 1;
  --tw-scale-y: 1;
  --tw-pan-x:  ;
  --tw-pan-y:  ;
  --tw-pinch-zoom:  ;
  --tw-scroll-snap-strictness: proximity;
  --tw-gradient-from-position:  ;
  --tw-gradient-via-position:  ;
  --tw-gradient-to-position:  ;
  --tw-ordinal:  ;
  --tw-slashed-zero:  ;
  --tw-numeric-figure:  ;
  --tw-numeric-spacing:  ;
  --tw-numeric-fraction:  ;
  --tw-ring-inset:  ;
  --tw-ring-offset-width: 0px;
  --tw-ring-offset-color: #fff;
  --tw-ring-color: rgb(59 130 246 / 0.5);
  --tw-ring-offset-shadow: 0 0 #0000;
  --tw-ring-shadow: 0 0 #0000;
  --tw-shadow: 0 0 #0000;
  --tw-shadow-colored: 0 0 #0000;
  --tw-blur:  ;
  --tw-brightness:  ;
  --tw-contrast:  ;
  --tw-grayscale:  ;
  --tw-hue-rotate:  ;
  --tw-invert:  ;
  --tw-saturate:  ;
  --tw-sepia:  ;
  --tw-drop-shadow:  ;
  --tw-backdrop-blur:  ;
  --tw-backdrop-brightness:  ;
  --tw-backdrop-contrast:  ;
  --tw-backdrop-grayscale:  ;
  --tw-backdrop-hue-rotate:  ;
  --tw-backdrop-invert:  ;
  --tw-backdrop-opacity:  ;
  --tw-backdrop-saturate:  ;
  --tw-backdrop-sepia:  ;
  --tw-contain-size:  ;
  --tw-contain-layout:  ;
  --tw-contain-paint:  ;
  --tw-contain-style:  ;
}

/*
! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com
*/

/*
1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
*/

*,
::before,
::after {
  box-sizing: border-box; /* 1 */
  border-width: 0; /* 2 */
  border-style: solid; /* 2 */
  border-color: #e5e7eb; /* 2 */
}

::before,
::after {
  --tw-content: '';
}

/*
1. Use a consistent sensible line-height in all browsers.
2. Prevent adjustments of font size after orientation changes in iOS.
3. Use a more readable tab size.
4. Use the user's configured `sans` font-family by default.
5. Use the user's configured `sans` font-feature-settings by default.
6. Use the user's configured `sans` font-variation-settings by default.
7. Disable tap highlights on iOS
*/

html,
:host {
  line-height: 1.5; /* 1 */
  -webkit-text-size-adjust: 100%; /* 2 */
  -moz-tab-size: 4; /* 3 */
  tab-size: 4; /* 3 */
  font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; /* 4 */
  font-feature-settings: normal; /* 5 */
  font-variation-settings: normal; /* 6 */
  -webkit-tap-highlight-color: transparent; /* 7 */
}

/*
1. Remove the margin in all browsers.
2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.
*/

body {
  margin: 0; /* 1 */
  line-height: inherit; /* 2 */
}

/*
1. Add the correct height in Firefox.
2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
3. Ensure horizontal rules are visible by default.
*/

hr {
  height: 0; /* 1 */
  color: inherit; /* 2 */
  border-top-width: 1px; /* 3 */
}

/*
Add the correct text decoration in Chrome, Edge, and Safari.
*/

abbr:where([title]) {
  text-decoration: underline dotted;
}

/*
Remove the default font size and weight for headings.
*/

h1,
h2,
h3,
h4,
h5,
h6 {
  font-size: inherit;
  font-weight: inherit;
}

/*
Reset links to optimize for opt-in styling instead of opt-out.
*/

a {
  color: inherit;
  text-decoration: inherit;
}

/*
Add the correct font weight in Edge and Safari.
*/

b,
strong {
  font-weight: bolder;
}

/*
1. Use the user's configured `mono` font-family by default.
2. Use the user's configured `mono` font-feature-settings by default.
3. Use the user's configured `mono` font-variation-settings by default.
4. Correct the odd `em` font sizing in all browsers.
*/

code,
kbd,
samp,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; /* 1 */
  font-feature-settings: normal; /* 2 */
  font-variation-settings: normal; /* 3 */
  font-size: 1em; /* 4 */
}

/*
Add the correct font size in all browsers.
*/

small {
  font-size: 80%;
}

/*
Prevent `sub` and `sup` elements from affecting the line height in all browsers.
*/

sub,
sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sub {
  bottom: -0.25em;
}

sup {
  top: -0.5em;
}

/*
1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
3. Remove gaps between table borders by default.
*/

table {
  text-indent: 0; /* 1 */
  border-color: inherit; /* 2 */
  border-collapse: collapse; /* 3 */
}

/*
1. Change the font styles in all browsers.
2. Remove the margin in Firefox and Safari.
3. Remove default padding in all browsers.
*/

button,
input,
optgroup,
select,
textarea {
  font-family: inherit; /* 1 */
  font-feature-settings: inherit; /* 1 */
  font-variation-settings: inherit; /* 1 */
  font-size: 100%; /* 1 */
  font-weight: inherit; /* 1 */
  line-height: inherit; /* 1 */
  letter-spacing: inherit; /* 1 */
  color: inherit; /* 1 */
  margin: 0; /* 2 */
  padding: 0; /* 3 */
}

/*
Remove the inheritance of text transform in Edge and Firefox.
*/

button,
select {
  text-transform: none;
}

/*
1. Correct the inability to style clickable types in iOS and Safari.
2. Remove default button styles.
*/

button,
input:where([type='button']),
input:where([type='reset']),
input:where([type='submit']) {
  -webkit-appearance: button; /* 1 */
  background-color: transparent; /* 2 */
  background-image: none; /* 2 */
}

/*
Use the modern Firefox focus style for all focusable elements.
*/

:-moz-focusring {
  outline: auto;
}

/*
Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)
*/

:-moz-ui-invalid {
  box-shadow: none;
}

/*
Add the correct vertical alignment in Chrome and Firefox.
*/

progress {
  vertical-align: baseline;
}

/*
Correct the cursor style of increment and decrement buttons in Safari.
*/

::-webkit-inner-spin-button,
::-webkit-outer-spin-button {
  height: auto;
}

/*
1. Correct the odd appearance in Chrome and Safari.
2. Correct the outline style in Safari.
*/

[type='search'] {
  -webkit-appearance: textfield; /* 1 */
  outline-offset: -2px; /* 2 */
}

/*
Remove the inner padding in Chrome and Safari on macOS.
*/

::-webkit-search-decoration {
  -webkit-appearance: none;
}

/*
1. Correct the inability to style clickable types in iOS and Safari.
2. Change font properties to `inherit` in Safari.
*/

::-webkit-file-upload-button {
  -webkit-appearance: button; /* 1 */
  font: inherit; /* 2 */
}

/*
Add the correct display in Chrome and Safari.
*/

summary {
  display: list-item;
}

/*
Removes the default spacing and border for appropriate elements.
*/

blockquote,
dl,
dd,
h1,
h2,
h3,
h4,
h5,
h6,
hr,
figure,
p,
pre {
  margin: 0;
}

fieldset {
  margin: 0;
  padding: 0;
}

legend {
  padding: 0;
}

ol,
ul,
menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

/*
Reset default styling for dialogs.
*/

dialog {
  padding: 0;
}

/*
Prevent resizing textareas horizontally by default.
*/

textarea {
  resize: vertical;
}

/*
1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)
2. Set the default placeholder color to the user's configured gray 400 color.
*/

input::placeholder,
textarea::placeholder {
  opacity: 1; /* 1 */
  color: #9ca3af; /* 2 */
}

/*
Set the default cursor for buttons.
*/

button,
[role="button"] {
  cursor: pointer;
}

/*
Make sure disabled buttons don't get the pointer cursor.
*/

:disabled {
  cursor: default;
}

/*
1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
   This can trigger a poorly considered lint error in some tools but is included by design.
*/

img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
  display: block; /* 1 */
  vertical-align: middle; /* 2 */
}

/*
Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)
*/

img,
video {
  max-width: 100%;
  height: auto;
}

/* Make elements with the HTML hidden attribute stay hidden by default */

[hidden]:where(:not([hidden="until-found"])) {
  display: none;
}
.visible{
  visibility: visible;
}
.absolute{
  position: absolute;
}
.relative{
  position: relative;
}
.mb-3{
  margin-bottom: 0.75rem;
}
.mt-1{
  margin-top: 0.25rem;
}
.mt-2{
  margin-top: 0.5rem;
}
.mt-3{
  margin-top: 0.75rem;
}
.block{
  display: block;
}
.inline-block{
  display: inline-block;
}
.inline{
  display: inline;
}
.flex{
  display: flex;
}
.table{
  display: table;
}
.grid{
  display: grid;
}
.hidden{
  display: none;
}
.resize{
  resize: both;
}
.items-center{
  align-items: center;
}
.gap-2{
  gap: 0.5rem;
}
.border{
  border-width: 1px;
}
.text-sm{
  font-size: 0.875rem;
  line-height: 1.25rem;
}
.text-xs{
  font-size: 0.75rem;
  line-height: 1rem;
}
.uppercase{
  text-transform: uppercase;
}
.filter{
  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
}

/* ============================================================
   Ivy — Design System
   Refined dark theme. Trading-grade information density.
   ============================================================ */

:root {
  /* Surfaces */
  --bg-app: #0A0D11;
  --bg-surface: #11151B;
  --bg-surface-2: #161B23;
  --bg-surface-hover: #1B212B;
  --bg-elevated: #1E2530;
  --bg-overlay: rgba(8, 10, 14, 0.7);

  /* Borders */
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.10);
  --border-active: rgba(93, 202, 165, 0.4);
  --border-focus: rgba(93, 202, 165, 0.6);

  /* Text */
  --text-primary: rgba(255, 255, 255, 0.92);
  --text-secondary: rgba(255, 255, 255, 0.62);
  --text-tertiary: rgba(255, 255, 255, 0.38);
  --text-quaternary: rgba(255, 255, 255, 0.40); /* bumped from 0.22 for WCAG-AA on faint labels */

  /* Accent — Mint/teal for primary actions, success, growth */
  --accent: #5DCAA5;
  --accent-hover: #6EDDB5;
  --accent-dim: rgba(93, 202, 165, 0.14);
  --accent-text: #9FE1CB;
  --accent-contrast: #0A0D11;

  /* Semantic */
  --success: #5DCAA5;
  --success-dim: rgba(93, 202, 165, 0.14);
  --danger: #F26464;
  --danger-dim: rgba(242, 100, 100, 0.14);
  --warning: #F2A93C;
  --warning-dim: rgba(242, 169, 60, 0.14);
  --info: #6FA8E5;
  --info-dim: rgba(111, 168, 229, 0.14);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --font-display: 'Newsreader', Georgia, serif;

  /* Radius */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-xl: 12px;
  --r-pill: 999px;

  /* Layout */
  --sidebar-w: 240px;
  --strategy-panel-w: 320px;
  --header-h: 52px;
}

/* Light theme overrides — keeps the toggle functional. */
.light {
  --bg-app: #F6F7F9;
  --bg-surface: #FFFFFF;
  --bg-surface-2: #F1F3F6;
  --bg-surface-hover: #ECEFF3;
  --bg-elevated: #FFFFFF;
  --bg-overlay: rgba(15, 18, 22, 0.4);

  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --border-active: rgba(29, 158, 117, 0.4);
  --border-focus: rgba(29, 158, 117, 0.55);

  --text-primary: rgba(15, 23, 42, 0.92);
  --text-secondary: rgba(15, 23, 42, 0.60);
  --text-tertiary: rgba(15, 23, 42, 0.42);
  --text-quaternary: rgba(15, 23, 42, 0.26);

  --accent: #1D9E75;
  --accent-hover: #178A65;
  --accent-dim: rgba(29, 158, 117, 0.12);
  --accent-text: #137a58;
  --accent-contrast: #FFFFFF;

  --success: #1D9E75;
  --success-dim: rgba(29, 158, 117, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; background: transparent; border: 0; outline: none; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(127,127,127,0.28); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(127,127,127,0.45); background-clip: padding-box; }
.custom-scrollbar { scrollbar-width: thin; scrollbar-color: rgba(127,127,127,0.28) transparent; }
::selection { background: rgba(93, 202, 165, 0.18); }

/* Keyboard focus ring — visible only for keyboard/AT users (not mouse clicks).
   Inputs reset `outline: none` above, so this restores an accessible indicator
   across every focusable element. */
:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; border-radius: 3px; }
/* Mouse users don't get the ring (handled by component hover/active states). */
:focus:not(:focus-visible) { outline: none; }

/* ============================================================
   App shell
   ============================================================ */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; overflow: hidden; }
.app--with-panel { grid-template-columns: var(--sidebar-w) 1fr var(--strategy-panel-w); }

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  background: var(--bg-app);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 12px;
  overflow-y: auto;
  height: 100vh;
}
.sidebar__brand { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 16px; }
.sidebar__brand-mark { font-family: var(--font-display); font-size: 22px; font-style: italic; color: var(--accent); letter-spacing: -0.02em; font-weight: 500; }
.sidebar__brand-icon { width: 28px; height: 28px; border-radius: var(--r-md); background: var(--bg-surface); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-secondary); }
.sidebar__brand-icon:hover { color: var(--text-primary); border-color: var(--border-strong); }

/* Collapsed icon rail (Copilot-style): the grid track is driven to ~60px via
   --sidebar-w; the rail centres a small stack of icon-only controls. */
.sidebar-rail {
  background: var(--bg-app);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 12px 0; height: 100vh; overflow: hidden;
}
.sidebar-rail__brand {
  font-family: var(--font-display); font-style: italic; font-weight: 500;
  font-size: 18px; color: var(--accent); margin-bottom: 6px;
}
.sidebar-rail__btn {
  width: 38px; height: 38px; border-radius: var(--r-md);
  display: grid; place-items: center; color: var(--text-secondary);
  background: transparent; border: 1px solid transparent;
}
.sidebar-rail__btn:hover { background: var(--bg-surface); color: var(--text-primary); }
.sidebar-rail__btn--active { background: var(--bg-surface); color: var(--text-primary); }
.sidebar-rail__sep { width: 24px; height: 1px; background: var(--border); margin: 6px 0; }
.sidebar-rail__spacer { flex: 1; }

.btn-newchat {
  width: 100%; padding: 9px 12px; background: var(--accent); color: var(--accent-contrast);
  font-weight: 500; border-radius: var(--r-md); display: flex; align-items: center; gap: 8px;
  font-size: 13px; transition: background 0.15s; justify-content: flex-start; transition: background 0.15s, transform 0.08s;
}
.btn-newchat:hover { background: var(--accent-hover); }
.btn-newchat:active { transform: scale(0.98); }

.sidebar__search { margin-top: 8px; padding: 7px 12px 7px 32px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-md); font-size: 13px; color: var(--text-secondary); width: 100%; }
.sidebar__search-wrap { position: relative; margin-top: 8px; }
.sidebar__search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-tertiary); pointer-events: none; }

.sidebar__nav { margin-top: 14px; display: flex; flex-direction: column; gap: 1px; }
.sidebar__nav-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--r-sm); color: var(--text-secondary); font-size: 13px; cursor: pointer; transition: background 0.1s, color 0.1s; width: 100%; text-align: left; }
.sidebar__nav-item:hover { background: var(--bg-surface); color: var(--text-primary); }
.sidebar__nav-item--active { background: var(--bg-surface); color: var(--text-primary); }
.sidebar__nav-item svg { color: var(--text-tertiary); flex-shrink: 0; }
.sidebar__nav-item-count { margin-left: auto; font-size: 11px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.sidebar__nav-item-pill { margin-left: auto; padding: 1px 7px; background: var(--warning-dim); color: var(--warning); border-radius: var(--r-pill); font-size: 10px; font-weight: 500; letter-spacing: 0.02em; text-transform: uppercase; }

.sidebar__section { margin-top: 18px; }
.sidebar__section-label { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 6px; font-size: 10px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-quaternary); }
.sidebar__section-label button { color: var(--text-tertiary); width: 16px; height: 16px; display: grid; place-items: center; border-radius: var(--r-sm); }
.sidebar__section-label button:hover { background: var(--bg-surface); color: var(--text-primary); }

.sidebar__item { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: var(--r-sm); color: var(--text-secondary); font-size: 13px; cursor: pointer; position: relative; }
.sidebar__item:hover { background: var(--bg-surface); color: var(--text-primary); }
.sidebar__item--active { background: var(--bg-surface); color: var(--text-primary); }
.sidebar__item .more { opacity: 0; margin-left: auto; color: var(--text-tertiary); padding: 2px; border-radius: var(--r-sm); }
.sidebar__item:hover .more { opacity: 1; }
.sidebar__item .more:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.sidebar__item-truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }

.sidebar__profile { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-md); cursor: pointer; position: relative; }
.sidebar__profile:hover { background: var(--bg-surface); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg, #5DCAA5, #1D9E75); display: grid; place-items: center; font-size: 11px; font-weight: 600; color: #0A0D11; flex-shrink: 0; }
.sidebar__profile-name { font-size: 13px; font-weight: 500; }
.sidebar__profile-email { font-size: 11px; color: var(--text-tertiary); }

/* ============================================================
   Main content area
   ============================================================ */
.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; height: 100vh; }
.topbar { height: var(--header-h); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 20px; gap: 12px; flex-shrink: 0; }
.topbar__title { font-size: 14px; font-weight: 500; }
.topbar__breadcrumb { font-size: 13px; color: var(--text-tertiary); }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.content { flex: 1; overflow-y: auto; }

/* ============================================================
   Buttons
   ============================================================ */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r-md); font-size: 13px; font-weight: 500; background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-primary); transition: background 0.1s, border-color 0.1s, transform 0.08s; white-space: nowrap; }
.btn:hover { background: var(--bg-surface-hover); border-color: var(--border-strong); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn--ghost:hover { background: var(--bg-surface); color: var(--text-primary); }
.btn--primary { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); font-weight: 600; }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--danger { background: transparent; color: var(--danger); border-color: rgba(242, 100, 100, 0.3); }
.btn--danger:hover { background: var(--danger-dim); }
.btn--sm { padding: 4px 9px; font-size: 12px; }
.btn--lg { padding: 9px 16px; font-size: 14px; }
.btn--icon { padding: 6px; }

/* ============================================================
   Badges / Pills / Chips
   ============================================================ */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: var(--r-pill); font-size: 11px; font-weight: 500; letter-spacing: 0.01em; white-space: nowrap; }
.badge--success { background: var(--success-dim); color: var(--success); }
.badge--running { background: var(--warning-dim); color: var(--warning); }
.badge--danger  { background: var(--danger-dim); color: var(--danger); }
.badge--neutral { background: rgba(127,127,127,0.12); color: var(--text-secondary); }
.badge--info    { background: var(--info-dim); color: var(--info); }
.badge--dot::before { content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge--pulsing::before { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(1.2); } }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-pill); background: var(--bg-surface); border: 1px solid var(--border); font-size: 12px; color: var(--text-secondary); cursor: pointer; transition: background 0.1s, border-color 0.1s; }
.chip:hover { background: var(--bg-surface-hover); border-color: var(--border-strong); color: var(--text-primary); }
.chip:active { transform: scale(0.97); }
.chip--active { background: var(--accent-dim); border-color: var(--border-active); color: var(--accent); }
.chip--mono { font-family: var(--font-mono); font-size: 11.5px; }

/* ============================================================
   Cards / Metrics
   ============================================================ */
.card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; }
.card--hover:hover { background: var(--bg-surface-hover); border-color: var(--border-strong); }

.metric { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.metric__label { font-size: 11px; font-weight: 500; color: var(--text-tertiary); letter-spacing: 0.06em; text-transform: uppercase; }
.metric__value { font-family: var(--font-mono); font-size: 22px; font-weight: 500; letter-spacing: -0.02em; color: var(--text-primary); }
.metric__value--success { color: var(--success); }
.metric__value--danger { color: var(--danger); }
.metric__sub { font-size: 11px; color: var(--text-tertiary); font-family: var(--font-mono); }

/* ============================================================
   Chat
   ============================================================ */
.chat { position: relative; display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; }
/* Floating "jump to latest" button — shown when the user scrolls up. */
.scroll-down-btn {
  position: absolute; bottom: 104px; left: 50%; transform: translateX(-50%);
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg-surface); border: 1px solid var(--border-strong); color: var(--text-secondary);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22); cursor: pointer; z-index: 20;
  transition: background 0.12s, color 0.12s, transform 0.12s;
}
.scroll-down-btn:hover { background: var(--bg-surface-hover); color: var(--text-primary); transform: translateX(-50%) translateY(-1px); }
/* Inline banner shown when session data fails to load. */
.load-error { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; margin-bottom: 4px; background: var(--danger-dim); border: 1px solid rgba(242, 100, 100, 0.3); border-radius: var(--r-md); color: var(--danger); font-size: 13px; }
.load-error button { flex-shrink: 0; }
.chat__messages { flex: 1; overflow-y: auto; padding: 32px 0 8px; }
.chat__inner { max-width: 720px; margin: 0 auto; padding: 0 24px; display: flex; flex-direction: column; gap: 20px; }

.msg { display: flex; flex-direction: column; gap: 6px; }
.msg--user { align-items: flex-end; }
.msg--agent { align-items: flex-start; }
.msg__body { max-width: 88%; padding: 10px 14px; border-radius: var(--r-lg); font-size: 14px; line-height: 1.55; }
.msg--user .msg__body { background: var(--bg-surface); border: 1px solid var(--border); }
.msg--agent .msg__body { color: var(--text-primary); padding: 4px 0; max-width: 100%; }
.msg__body p { margin: 0; }
.msg__meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-tertiary); padding: 0 4px; opacity: 0; transition: opacity 0.15s; }
.msg:hover .msg__meta { opacity: 1; }
.msg__meta button { display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: var(--r-sm); color: var(--text-tertiary); }
.msg__meta button:hover { background: var(--bg-surface); color: var(--text-primary); }

.suggestion-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.suggestion { padding: 5px 11px; border-radius: var(--r-pill); background: var(--bg-surface); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-secondary); cursor: pointer; transition: background 0.1s, color 0.1s, border-color 0.1s, transform 0.08s; }
.suggestion:hover { background: var(--bg-surface-hover); color: var(--text-primary); border-color: var(--border-strong); }
.suggestion:active { transform: scale(0.97); }

.thread-card { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg-surface); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.thread-card--clickable { cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.thread-card--clickable:hover { border-color: var(--border-strong); background: var(--bg-surface-hover); }
.thread-card--selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.thread-card__head { display: flex; align-items: center; gap: 10px; }
.thread-card__icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: var(--r-md); background: var(--bg-surface-2); color: var(--text-tertiary); flex-shrink: 0; }
.thread-card__title { font-size: 13.5px; font-weight: 500; }
.thread-card__sub { font-size: 12px; color: var(--text-tertiary); }
.thread-card__actions { margin-left: auto; display: flex; gap: 6px; }

.progress { width: 100%; height: 4px; border-radius: var(--r-pill); background: rgba(127,127,127,0.18); overflow: hidden; }
.progress__bar { height: 100%; background: var(--warning); border-radius: var(--r-pill); transition: width 0.3s; }
.progress__bar--success { background: var(--success); }
.progress__bar--indeterminate { width: 40%; background: var(--warning); animation: indeterminate 1.4s ease-in-out infinite; }
@keyframes indeterminate { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }

/* Inline thread chips grid (strategy spec card) */
.thread-spec { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; font-size: 12.5px; }
.thread-spec > div { min-width: 0; }

.composer { border-top: 1px solid var(--border); padding: 16px 24px 20px; flex-shrink: 0; }
.composer__inner { max-width: 720px; margin: 0 auto; background: var(--bg-surface); border: 1px solid var(--border-strong); border-radius: var(--r-xl); padding: 10px 12px 8px; transition: border-color 0.15s; }
.composer__inner:focus-within { border-color: var(--border-focus); }
.composer__textarea { width: 100%; resize: none; font-size: 14px; line-height: 1.5; color: var(--text-primary); font-family: inherit; background: transparent; outline: none; border: 0; min-height: 48px; max-height: 200px; overflow-y: auto; padding: 4px 0; }
.composer__textarea::placeholder { color: var(--text-tertiary); }
.composer__tools { display: flex; align-items: center; gap: 4px; margin-top: 4px; }

/* ── Composer attachments ──────────────────────────────────────────────── */
.attach-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.attach-chip { display: inline-flex; align-items: center; gap: 7px; max-width: 240px; padding: 5px 8px 5px 10px; background: var(--bg-surface-2); border: 1px solid var(--border); border-radius: var(--r-md); font-size: 12px; color: var(--text-secondary); }
.attach-chip--error { border-color: var(--danger); color: var(--danger); }
.attach-chip__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); }
.attach-chip--error .attach-chip__name { color: var(--danger); }
.attach-chip__size { color: var(--text-tertiary); flex-shrink: 0; }
.attach-chip__remove { display: grid; place-items: center; width: 18px; height: 18px; border-radius: var(--r-sm); color: var(--text-tertiary); flex-shrink: 0; }
.attach-chip__remove:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.composer__tool { width: 28px; height: 28px; border-radius: var(--r-md); display: grid; place-items: center; color: var(--text-tertiary); cursor: pointer; transition: background 0.1s, color 0.1s; }
.composer__tool:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.composer__tool:active { transform: scale(0.92); }
.composer__tool--active { color: var(--accent); background: var(--accent-dim); }
.composer__send { margin-left: auto; width: 28px; height: 28px; border-radius: var(--r-md); background: var(--accent); color: var(--accent-contrast); display: grid; place-items: center; cursor: pointer; transition: background 0.1s, transform 0.08s; }
.composer__send:hover { background: var(--accent-hover); }
.composer__send:active:not(.composer__send--disabled) { transform: scale(0.92); }
.composer__send--disabled { background: var(--bg-surface-2); color: var(--text-tertiary); cursor: not-allowed; }

/* ============================================================
   Strategy panel (right column)
   ============================================================ */
.panel { position: relative; background: var(--bg-app); border-left: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; height: 100vh; }
/* Draggable divider on the panel's left edge — resizes the chat area. */
.panel-resizer { position: absolute; left: 0; top: 0; width: 7px; height: 100%; cursor: col-resize; z-index: 10; }
.panel-resizer::after { content: ''; position: absolute; left: 0; top: 0; width: 2px; height: 100%; background: transparent; transition: background 0.12s; }
.panel-resizer:hover::after, .panel-resizer:active::after { background: var(--accent); }
.panel__head { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.panel__title { font-size: 13px; font-weight: 500; }
.panel__body { flex: 1; overflow-y: auto; padding: 16px 20px; }
.spec-field { padding: 10px 0; border-bottom: 1px solid var(--border); }
.spec-field:last-child { border-bottom: 0; }
.spec-field__label { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--text-tertiary); font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 6px; }
.spec-field__value { font-size: 13px; color: var(--text-primary); line-height: 1.55; }
.spec-field__value-secondary { font-size: 12.5px; color: var(--text-secondary); }
.spec-field__params { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.panel__footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }

/* ============================================================
   Tables
   ============================================================ */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 500; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-tertiary); padding: 10px 16px; border-bottom: 1px solid var(--border); }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { cursor: pointer; transition: background 0.1s; }
.table tbody tr:hover { background: var(--bg-surface); }
.table tbody tr.selected { background: rgba(93, 202, 165, 0.06); }
.table__primary { font-weight: 500; font-size: 13.5px; }
.table__secondary { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.table__num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.table__num--pos { color: var(--success); }
.table__num--neg { color: var(--danger); }

.checkbox { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--border-strong); background: var(--bg-surface); display: inline-grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.checkbox--checked { background: var(--accent); border-color: var(--accent); }
.checkbox--checked::after { content: ''; width: 8px; height: 4px; border-left: 2px solid var(--accent-contrast); border-bottom: 2px solid var(--accent-contrast); transform: rotate(-45deg) translateY(-1px); }

/* Tabs */
.tabs { display: flex; align-items: center; border-bottom: 1px solid var(--border); padding: 0 32px; gap: 24px; flex-shrink: 0; }
.tab { padding: 14px 0; font-size: 13px; color: var(--text-tertiary); font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color 0.1s; }
.tab:hover { color: var(--text-primary); }
.tab--active { color: var(--text-primary); border-bottom-color: var(--accent); }
.tab__count { display: inline-block; margin-left: 6px; font-size: 11px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; font-weight: 500; }

/* Section heading */
.section-heading { font-size: 13px; font-weight: 500; color: var(--text-primary); margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.section-heading__sub { font-size: 12px; color: var(--accent); font-weight: 400; cursor: pointer; background: none; }

/* Inputs */
.input { padding: 7px 12px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-md); font-size: 13px; color: var(--text-primary); width: 100%; transition: border-color 0.15s; }
.input:focus { border-color: var(--border-focus); }
.input::placeholder { color: var(--text-tertiary); }
.label { font-size: 12px; color: var(--text-secondary); font-weight: 500; display: block; margin-bottom: 6px; }

/* Modals & overlays */
.overlay { position: fixed; inset: 0; background: var(--bg-overlay); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 40px 20px; z-index: 100; }
.modal { background: var(--bg-surface); border: 1px solid var(--border-strong); border-radius: var(--r-xl); width: 100%; max-width: 560px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; }
.modal__head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal__title { font-size: 15px; font-weight: 500; }
.modal__close { color: var(--text-tertiary); padding: 4px; border-radius: var(--r-sm); }
.modal__close:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.modal__body { padding: 20px; overflow-y: auto; }
.modal__footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* Code block */
.code { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; white-space: pre; overflow-x: auto; color: var(--text-secondary); }

/* ============================================================
   Welcome page
   ============================================================ */
.welcome { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; }
.welcome__main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; overflow-y: auto; }
.welcome__hero { max-width: 720px; width: 100%; text-align: center; }
.welcome__brand { font-family: var(--font-display); font-style: italic; font-size: 56px; font-weight: 500; color: var(--accent); letter-spacing: -0.04em; line-height: 1; }
.welcome__tagline { margin-top: 18px; font-size: 19px; color: var(--text-primary); font-weight: 500; letter-spacing: -0.02em; }
.welcome__sub { margin-top: 10px; font-size: 14px; color: var(--text-secondary); max-width: 480px; margin-left: auto; margin-right: auto; line-height: 1.6; }
.welcome__prompts { margin-top: 40px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.prompt-card { text-align: left; padding: 20px 22px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-lg); cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.15s; }
.prompt-card:hover { background: var(--bg-surface-hover); border-color: var(--border-strong); transform: translateY(-1px); }
.prompt-card__icon { width: 32px; height: 32px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--accent-dim); color: var(--accent); margin-bottom: 14px; }
.prompt-card__title { font-size: 14px; font-weight: 500; color: var(--text-primary); margin-bottom: 6px; }
.prompt-card__body { font-size: 13px; color: var(--text-secondary); line-height: 1.55; }
.welcome__input { margin-top: 28px; max-width: 720px; margin-left: auto; margin-right: auto; }
.welcome__input .composer__inner { background: var(--bg-surface); border: 1px solid var(--border-strong); }
.welcome__links { margin-top: 24px; display: flex; justify-content: center; align-items: center; gap: 24px; font-size: 12.5px; color: var(--text-tertiary); }
.welcome__links a { color: var(--text-secondary); transition: color 0.1s; cursor: pointer; }
.welcome__links a:hover { color: var(--text-primary); }
.welcome__links .sep { width: 2px; height: 2px; background: var(--text-quaternary); border-radius: 50%; }

/* ============================================================
   Strategy spec page
   ============================================================ */
.strat-layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; overflow: hidden; }
.strat-detail { padding: 32px; max-width: 1100px; margin: 0 auto; }
.spec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
/* Compact spec cards for the chat thread (smaller padding + type). */
.spec-grid--compact { gap: 8px; }
.spec-grid--compact .spec-card-lg { padding: 9px 11px; border-radius: var(--r-md); }
.spec-grid--compact .spec-card-lg__title { margin-bottom: 5px; font-size: 10px; }
.spec-grid--compact .spec-card-lg__body { font-size: 12px; line-height: 1.5; }
.spec-grid--compact .spec-card-lg__body ul { padding-left: 16px; margin: 0; }
.spec-card-lg { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px 18px; }
.spec-card-lg__title { font-size: 12px; font-weight: 500; color: var(--text-tertiary); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.spec-card-lg__body { font-size: 13.5px; line-height: 1.7; color: var(--text-primary); }
.spec-card-lg__body code { font-family: var(--font-mono); font-size: 12.5px; padding: 1px 5px; background: var(--bg-surface-2); border-radius: var(--r-sm); color: var(--accent-text); }
.run-row { display: grid; grid-template-columns: 1fr auto auto auto auto auto; gap: 24px; padding: 14px 16px; border-bottom: 1px solid var(--border); align-items: center; cursor: pointer; }
.run-row:hover { background: var(--bg-surface); }
.run-row:last-child { border-bottom: 0; }

/* ============================================================
   Strategies library
   ============================================================ */
.lib-layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; overflow: hidden; }
.strategies-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 24px 32px 40px; }
.strat-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px; cursor: pointer; transition: background 0.1s, border-color 0.1s; display: flex; flex-direction: column; gap: 14px; min-height: 220px; }
.strat-card:hover { background: var(--bg-surface-hover); border-color: var(--border-strong); }
.strat-card__head { display: flex; align-items: flex-start; justify-content: space-between; }
.strat-card__title-block { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.strat-card__title { font-size: 14.5px; font-weight: 500; letter-spacing: -0.01em; }
.strat-card__sub { font-size: 12px; color: var(--text-tertiary); }
.strat-card__meta { display: flex; gap: 8px; align-items: center; font-size: 11px; color: var(--text-tertiary); flex-wrap: wrap; }
.strat-card__metrics { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; padding: 12px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.strat-card__metric-label { font-size: 10px; color: var(--text-tertiary); letter-spacing: 0.04em; text-transform: uppercase; }
.strat-card__metric-value { font-family: var(--font-mono); font-size: 14px; font-weight: 500; margin-top: 2px; }
.strat-card__footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.strat-card--draft { border-style: dashed; }
.strat-card--template { background: transparent; border-style: dashed; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--text-tertiary); }
.strat-card--template:hover { background: var(--bg-surface); }

/* ============================================================
   Backtests library
   ============================================================ */
.bt-layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; overflow: hidden; }
.bt-table th, .bt-table td { padding: 12px 16px; }
.bt-table th:first-child, .bt-table td:first-child { padding-left: 28px; width: 36px; }
.bt-table th:last-child, .bt-table td:last-child { padding-right: 28px; }
.bt-row-name { display: flex; flex-direction: column; min-width: 0; }
.metric-inline { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 500; }
.compare-bar { position: sticky; bottom: 0; background: var(--bg-surface); border-top: 1px solid var(--border-strong); padding: 14px 32px; display: flex; align-items: center; gap: 12px; }

/* ============================================================
   Backtest detail
   ============================================================ */
.detail-layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; overflow: hidden; }
.metrics-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.metrics-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.chart-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px 20px; position: relative; }
.chart-area { height: 200px; margin-top: 12px; position: relative; }
.sanity-banner { background: var(--success-dim); border: 1px solid rgba(93, 202, 165, 0.25); border-radius: var(--r-md); padding: 11px 14px; display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.detail-content { padding: 24px 32px 60px; max-width: 1200px; margin: 0 auto; }

/* ============================================================
   Utilities
   ============================================================ */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-quaternary { color: var(--text-quaternary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-accent { color: var(--accent); }
.mono { font-family: var(--font-mono); }
.tnum { font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: 0.5; }
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 13px; height: 13px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
.stream-caret { display: inline-block; width: 7px; color: var(--accent); animation: blink 1s step-start infinite; }
@keyframes blink { 50% { opacity: 0; } }
.tool-stream { font-family: var(--font-mono); font-size: 12px; line-height: 1.55; color: var(--text-secondary); white-space: pre-wrap; max-height: 220px; overflow-y: auto; background: var(--bg-surface-2); border-radius: var(--r-md); padding: 10px 12px; }

/* ── Staged tool progress indicator ────────────────────────────────────── */
.spinner--xs { width: 11px; height: 11px; border-width: 2px; }
/* Borderless, one-step-at-a-time flow (no card box) shown in the chat thread. */
.tool-flow { display: flex; flex-direction: column; gap: 7px; padding: 2px 0; }
.tool-steps { display: flex; flex-direction: column; gap: 6px; padding: 4px 0 2px 38px; }
.tool-step { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-tertiary); }
.tool-step__mark { width: 14px; height: 14px; display: grid; place-items: center; flex-shrink: 0; }
.tool-step__dot { width: 5px; height: 5px; border-radius: 50%; background: var(--text-quaternary); }
.tool-step--done { color: var(--text-secondary); }
.tool-step--done .tool-step__mark { color: var(--success); }
.tool-step--active { color: var(--text-primary); font-weight: 500; }

/* ── Per-version backtest run history (chat spec card) ─────────────────── */
.version-runs { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--border); padding-top: 10px; }
.version-runs__label { font-size: 11px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-tertiary); margin-bottom: 2px; }
.version-runs__item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 6px 8px; border-radius: var(--r-md); transition: background 0.12s; }
.version-runs__item:hover { background: var(--bg-surface-hover); }
.version-runs__meta { font-size: 12px; color: var(--text-secondary); }

/* ── Rendered markdown (assistant + tool output) ───────────────────────── */
.markdown { font-size: 14px; line-height: 1.6; color: var(--text-primary); }
.markdown.tool-stream { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); white-space: normal; }
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown p { margin: 0 0 10px; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { margin: 18px 0 8px; line-height: 1.3; font-weight: 600; color: var(--text-primary); }
.markdown h1 { font-size: 1.4em; }
.markdown h2 { font-size: 1.25em; }
.markdown h3 { font-size: 1.1em; }
.markdown h4 { font-size: 1em; }
.markdown strong { font-weight: 600; color: var(--text-primary); }
.markdown em { font-style: italic; }
.markdown ul, .markdown ol { margin: 0 0 10px; padding-left: 22px; }
.markdown li { margin: 3px 0; }
.markdown li > p { margin: 0; }
.markdown a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
.markdown a:hover { color: var(--accent); }
.markdown blockquote { margin: 0 0 10px; padding: 2px 14px; border-left: 3px solid var(--border-strong); color: var(--text-secondary); }
.markdown hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.markdown code { font-family: var(--font-mono); font-size: 0.875em; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 1px 5px; }
.markdown pre { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 14px; overflow-x: auto; margin: 0 0 10px; }
.markdown pre code { background: none; border: none; padding: 0; font-size: 12.5px; line-height: 1.6; color: var(--text-secondary); }
.markdown__table-wrap { overflow-x: auto; margin: 0 0 10px; }
.markdown table { border-collapse: collapse; width: 100%; font-size: 13px; }
.markdown th, .markdown td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.markdown th { background: var(--bg-surface); font-weight: 600; color: var(--text-primary); }

/* ============================================================
   Dropdown / popover animation
   ============================================================ */
@keyframes menuIn {
  from { opacity: 0; transform: translateY(4px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.menu-pop { animation: menuIn 0.12s ease-out; transform-origin: bottom center; }
/* Invisible full-screen layer that closes the menu on an outside click. */
.menu-backdrop { position: fixed; inset: 0; z-index: 29; }

/* ============================================================
   Loading skeletons
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-surface-hover) 37%, var(--bg-surface) 63%);
  background-size: 400% 100%;
  border-radius: var(--r-sm);
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.skeleton--text { height: 11px; margin: 7px 0; }
.skeleton--row { height: 30px; margin: 4px 0; border-radius: var(--r-md); }

/* ============================================================
   Touch & coarse-pointer affordances
   On devices without hover, reveal hover-only controls and enlarge tap targets.
   ============================================================ */
@media (hover: none) {
  .msg__meta { opacity: 0.7; }
  .sidebar__item .more { opacity: 0.7; }
  .composer__tool, .composer__send { width: 36px; height: 36px; }
  .attach-chip__remove { width: 28px; height: 28px; }
  .msg__meta button { padding: 6px 8px; }
}

/* ============================================================
   Responsive — tablet & mobile (off-canvas sidebar drawer)
   ============================================================ */
.mobile-menu-btn { display: none; }

@media (max-width: 860px) {
  /* Every app grid collapses to a single content column. */
  .app, .app--with-panel, .welcome, .strat-layout, .lib-layout, .bt-layout, .detail-layout {
    grid-template-columns: 1fr !important;
  }
  /* The secondary strategy panel is hidden on small screens to avoid overflow. */
  .app--with-panel .panel { display: none; }

  /* Floating hamburger that opens the drawer. */
  .mobile-menu-btn {
    position: fixed; top: 9px; left: 10px; z-index: 45;
    width: 38px; height: 38px; border-radius: var(--r-md);
    display: grid; place-items: center;
    background: var(--bg-surface); border: 1px solid var(--border-strong);
    color: var(--text-secondary); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  }
  .mobile-menu-btn:hover { color: var(--text-primary); }
  .mobile-menu-btn:active { transform: scale(0.94); }

  /* Reserve space for the hamburger in page headers. */
  .topbar, .tabs { padding-left: 58px; }

  /* Sidebar + collapsed rail become an off-canvas drawer. */
  .sidebar, .sidebar-rail {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
    width: 264px; max-width: 84vw; height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.45);
  }
  .sidebar-rail { width: 72px; }
  .sidebar.sidebar--open, .sidebar-rail.sidebar--open { transform: translateX(0); }

  .sidebar-backdrop {
    position: fixed; inset: 0; z-index: 55;
    background: var(--bg-overlay); backdrop-filter: blur(2px);
  }

  /* Tighten dense desktop grids/padding for narrow viewports. */
  .strategies-grid { grid-template-columns: 1fr; padding-left: 16px; padding-right: 16px; }
  .metrics-grid, .metrics-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .welcome__prompts, .spec-grid, .thread-spec { grid-template-columns: 1fr; }
  .detail-content, .strat-detail { padding-left: 16px; padding-right: 16px; }
  .chat__inner, .composer { padding-left: 16px; padding-right: 16px; }
  .tabs { gap: 16px; }
}

/* ============================================================
   Reduced motion — honor the OS-level preference
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/*!********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[13].oneOf[2].use[1]!./node_modules/next/dist/build/webpack/loaders/next-font-loader/index.js??ruleSet[1].rules[13].oneOf[2].use[2]!./node_modules/next/font/google/target.css?{"path":"src/app/layout.tsx","import":"Inter","arguments":[{"subsets":["latin"]}],"variableName":"inter"} ***!
  \********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/* cyrillic-ext */
@font-face {
  font-family: '__Inter_f367f3';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/_next/static/media/ba9851c3c22cd980-s.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
  font-family: '__Inter_f367f3';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/_next/static/media/21350d82a1f187e9-s.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
  font-family: '__Inter_f367f3';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/_next/static/media/c5fe6dc8356a8c31-s.woff2) format('woff2');
  unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
  font-family: '__Inter_f367f3';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/_next/static/media/19cfc7226ec3afaa-s.woff2) format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* vietnamese */
@font-face {
  font-family: '__Inter_f367f3';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/_next/static/media/df0a9ae256c0569c-s.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: '__Inter_f367f3';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/_next/static/media/8e9860b6e62d6359-s.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: '__Inter_f367f3';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/_next/static/media/e4af272ccee01ff0-s.p.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}@font-face {font-family: '__Inter_Fallback_f367f3';src: local("Arial");ascent-override: 90.49%;descent-override: 22.56%;line-gap-override: 0.00%;size-adjust: 107.06%
}.__className_f367f3 {font-family: '__Inter_f367f3', '__Inter_Fallback_f367f3';font-style: normal
}

