/* ══════════════════════════════════════════════════════════════════
   FXT Copilot AI
   Stripe design language over the shadcn/ui token system.
   ══════════════════════════════════════════════════════════════════ */

:root {
  --background:          #ffffff;
  --foreground:          #0a2540;
  --card:                #ffffff;
  --card-foreground:     #0a2540;
  --primary:             #635bff;
  --primary-foreground:  #ffffff;
  --secondary:           #f6f9fc;
  --muted:               #f6f9fc;
  --muted-foreground:    #697386;
  --accent:              #f0f0ff;
  --accent-foreground:   #3d3ad4;
  --destructive:         #df1b41;
  --border:              #e6e9f0;
  --input:               #e6e9f0;
  --ring:                #635bff;
  --radius:              0.625rem;

  --body:      #425466;
  --hairline:  #eef1f6;

  --shadow-xs: 0 1px 1px rgba(50,50,93,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 2px 4px -1px rgba(50,50,93,.08), 0 1px 2px -1px rgba(0,0,0,.05);
  --shadow-md: 0 6px 14px -4px rgba(50,50,93,.12), 0 2px 6px -2px rgba(0,0,0,.06);

  --grad: linear-gradient(100deg, #635bff 0%, #4f7cff 42%, #00d4ff 100%);

  --bull: #0e9f6e;
  --bear: #df1b41;

  --c-signal:   #635bff;
  --c-position: #0e9f6e;
  --c-order:    #c77700;
  --c-broker:   #0ba5ec;
  --c-risk:     #df1b41;
  --c-news:     #5a6b84;
  --c-macro:    #c11574;
  --c-trend:    #0f766e;
  --c-system:   #8792a2;

  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
[hidden] { display: none !important; }

body {
  background: var(--background);
  color: var(--body);
  font: 400 14px/1.55 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
h1, h2, h3, h4 { color: var(--foreground); letter-spacing: -.021em; margin: 0; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d7dde7; border-radius: 8px; border: 2.5px solid #fff; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #c3ccda; background-clip: padding-box; }

/* ─────────────────────────────────────────────── primitives */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--radius); border: 1px solid transparent;
  font: 500 13px Inter, sans-serif; cursor: pointer; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .12s ease;
  padding: 8px 14px;
}
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 35%, transparent); }
.btn:disabled { opacity: .45; cursor: default; transform: none !important; }

.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-xs); }
.btn-primary:hover:not(:disabled) { background: #524bd8; transform: translateY(-1px); }
.btn-outline { background: #fff; border-color: var(--border); color: var(--foreground); box-shadow: var(--shadow-xs); }
.btn-outline:hover:not(:disabled) { background: var(--muted); }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--body); }
.btn-ghost:hover { background: var(--muted); color: var(--foreground); }
.btn-soft { background: var(--accent); border-color: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--accent-foreground); }
.btn-soft:hover { background: #e7e7ff; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--muted); color: var(--muted-foreground);
  padding: 3px 9px; font: 500 11px Inter, sans-serif; white-space: nowrap;
}
.badge-unread { background: var(--accent); border-color: color-mix(in srgb, var(--primary) 22%, transparent); color: var(--accent-foreground); font-weight: 600; }

/* ─────────────────────────────────────────────────── shell */

.shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 208px minmax(520px, 1fr) 452px;
}

/* ═══════════════════════════════════════════════════ rail */

.rail { display: grid; grid-template-rows: auto minmax(0,1fr) auto; background: var(--muted); border-right: 1px solid var(--border); min-height: 0; }
.rail-brand { display: flex; align-items: center; gap: 10px; padding: 15px 14px 13px; }
.logo { width: 32px; height: 32px; border-radius: 9px; color: #fff; background: var(--grad); display: grid; place-items: center; box-shadow: 0 4px 10px -2px rgba(99,91,255,.45); }
.logo svg { width: 18px; height: 18px; }
.rail-brand-txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.rail-brand-txt strong { font-size: 13.5px; font-weight: 650; color: var(--foreground); letter-spacing: -.03em; }
.rail-brand-txt .ai { font-size: 8.5px; font-weight: 700; letter-spacing: .06em; vertical-align: super; margin-left: 3px; padding: 1px 4px; border-radius: 4px; background: var(--grad); color: #fff; }
.rail-brand-txt span { font-size: 10.5px; color: var(--muted-foreground); }

.rail-scroll { overflow-y: auto; padding: 2px 9px 12px; }
.rail-group { margin-bottom: 16px; }
.rail-label { display: flex; align-items: center; gap: 6px; font: 600 9.5px Inter, sans-serif; letter-spacing: .07em; text-transform: uppercase; color: #8792a2; padding: 6px 8px; }
.rail-count { margin-left: auto; background: var(--primary); color: #fff; border-radius: 999px; padding: 1px 6px; font-size: 10px; letter-spacing: 0; }
.rail-count:empty { display: none; }

.thread-list { display: flex; flex-direction: column; gap: 2px; }
.thread-item { display: grid; grid-template-columns: 28px minmax(0,1fr) auto; align-items: center; gap: 8px; width: 100%; text-align: left; cursor: pointer; padding: 7px 8px; border-radius: 9px; border: 1px solid transparent; background: transparent; font-family: inherit; transition: background .14s ease; }
.thread-item:hover { background: #edf1f7; }
.thread-item.is-active { background: #fff; border-color: var(--border); box-shadow: var(--shadow-xs); }
.thread-item.is-active .ti-sym { color: var(--foreground); }
.ti-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font: 600 9.5px var(--mono); background: #e4e9f2; color: #56637a; }
.thread-item.is-active .ti-ico { background: var(--grad); color: #fff; }
.ti-body { min-width: 0; }
.ti-sym { display: block; font: 600 12px Inter, sans-serif; color: #3c4a60; }
.ti-prev { display: block; font-size: 10.5px; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ti-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.ti-chg { font: 500 10px var(--mono); }
.ti-chg.up { color: var(--bull); } .ti-chg.down { color: var(--bear); }
.ti-badge { background: var(--primary); color: #fff; border-radius: 999px; min-width: 16px; height: 16px; padding: 0 5px; display: grid; place-items: center; font: 600 9.5px Inter, sans-serif; }
.ti-badge.is-live { background: var(--grad); }

.rail-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 8px; border-radius: 9px; border: none; background: transparent; font: 450 12px Inter, sans-serif; color: #56637a; cursor: pointer; text-align: left; }
.rail-item:hover { background: #edf1f7; }
.ri-ico { width: 15px; text-align: center; color: #8792a2; font-size: 11.5px; }
.ri-meta { margin-left: auto; font: 500 10px var(--mono); color: #8792a2; }

.rail-foot { display: flex; align-items: center; gap: 9px; padding: 10px 13px; border-top: 1px solid var(--border); background: #fff; }
.avatar-sm { width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center; background: var(--grad); color: #fff; font: 600 10.5px Inter, sans-serif; }
.rail-user { display: flex; flex-direction: column; line-height: 1.3; }
.rail-user strong { font-size: 12px; font-weight: 600; color: var(--foreground); }
.rail-user span { font-size: 10px; color: var(--muted-foreground); }

/* ══════════════════════════════════════════════ workspace */

/* Supporting panel on the right: chart on top, price control beneath. */
.workspace {
  display: grid; grid-template-rows: minmax(280px, 1fr) auto;
  min-height: 0; gap: 11px; padding: 11px;
  background: var(--muted); border-left: 1px solid var(--border);
  overflow-y: auto;
}

.chart-card {
  display: grid; grid-template-rows: auto minmax(0,1fr) auto;
  min-height: 0; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-xs); overflow: hidden;
}

.chart-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--hairline); }
.ch-id { display: flex; align-items: center; gap: 10px; }
.ch-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(140deg, #f7d774, #d9a441); color: #4a3608; font: 700 12px Inter, sans-serif; }
.ch-id h1 { font-size: 13.5px; font-weight: 650; display: flex; align-items: baseline; gap: 7px; }
.ch-id h1 span { font-size: 11.5px; font-weight: 450; color: var(--muted-foreground); letter-spacing: 0; }
.ch-id p { margin: 1px 0 0; font-size: 11px; color: var(--muted-foreground); }

.ch-quote { display: flex; flex-direction: column; line-height: 1.2; }
.chq-px { font: 600 18px var(--mono); color: var(--foreground); font-variant-numeric: tabular-nums; transition: color .3s ease; }
.chq-px.up { color: var(--bull); } .chq-px.down { color: var(--bear); }
.chq-chg { font: 500 11px var(--mono); color: var(--muted-foreground); }
.chq-chg.up { color: var(--bull); } .chq-chg.down { color: var(--bear); }

.ch-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--muted); border: 1px solid var(--border); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button { font: 500 11px Inter, sans-serif; padding: 4px 9px; border-radius: 7px; border: none; background: transparent; color: var(--muted-foreground); cursor: pointer; transition: all .14s ease; }
.seg button:hover { color: var(--foreground); }
.seg button.is-on { background: #fff; color: var(--foreground); box-shadow: var(--shadow-xs); font-weight: 600; }
.clock { font: 500 10px var(--mono); color: var(--muted-foreground); background: var(--muted); border: 1px solid var(--border); padding: 5px 10px; border-radius: 8px; }

.chart-body { position: relative; min-height: 0; }
#chart { display: block; width: 100%; height: 100%; }

.chart-tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: #fff; border: 1px solid var(--border); border-radius: 9px;
  box-shadow: var(--shadow-md); padding: 8px 10px;
  font: 500 11px var(--mono); color: var(--foreground); white-space: nowrap;
}
.chart-tip b { display: block; font: 600 10px Inter, sans-serif; color: var(--muted-foreground); margin-bottom: 3px; letter-spacing: .04em; text-transform: uppercase; }
.chart-tip .r { color: var(--bear); } .chart-tip .g { color: var(--bull); }

.chart-legend { display: flex; flex-wrap: wrap; gap: 5px 12px; padding: 8px 15px; border-top: 1px solid var(--hairline); background: #fcfdff; }
.lg { display: inline-flex; align-items: center; gap: 6px; font: 450 10.5px Inter, sans-serif; color: var(--muted-foreground); }
.lg i { width: 14px; height: 0; border-top-width: 2px; border-top-style: solid; display: inline-block; }
.lg i.dash { border-top-style: dashed; }
.lg b { font-weight: 600; color: var(--body); font-family: var(--mono); font-size: 10px; }

/* control card */
.control-card {
  display: grid; grid-template-columns: 1fr; gap: 10px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 13px; box-shadow: var(--shadow-xs);
}
.ctl-label { font: 600 10px Inter, sans-serif; letter-spacing: .07em; text-transform: uppercase; color: var(--muted-foreground); display: flex; align-items: center; gap: 7px; }
.ctl-label .hint { font-size: 9px; letter-spacing: .04em; background: var(--accent); color: var(--accent-foreground); border-radius: 4px; padding: 1.5px 5px; font-weight: 600; }
.ctl-readout { display: flex; align-items: baseline; gap: 9px; margin: 5px 0 9px; }
.ctl-px { font: 600 23px var(--mono); color: var(--foreground); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ctl-px.up { color: var(--bull); } .ctl-px.down { color: var(--bear); }
.ctl-chg { font: 500 12px var(--mono); color: var(--muted-foreground); }
.ctl-chg.up { color: var(--bull); } .ctl-chg.down { color: var(--bear); }

.sim-controls { display: flex; align-items: center; gap: 7px; }
.sim-state { font: 600 10.5px Inter, sans-serif; padding: 4px 9px; border-radius: 999px; background: #e7f8f1; border: 1px solid #b9ead8; color: #06724f; }
.sim-state.paused { background: var(--muted); border-color: var(--border); color: var(--muted-foreground); }

.ctl-right { display: flex; flex-direction: column; justify-content: center; }
#slider { -webkit-appearance: none; appearance: none; width: 100%; height: 5px; border-radius: 999px; outline: none; background: #e3e8f0; }
#slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 999px; cursor: grab; background: #fff; border: 1px solid #d3d8e2; box-shadow: 0 1px 3px rgba(50,50,93,.25), 0 0 0 3px rgba(99,91,255,.13); }
#slider::-webkit-slider-thumb:active { cursor: grabbing; }
#slider::-moz-range-thumb { width: 16px; height: 16px; border-radius: 999px; background: #fff; border: 1px solid #d3d8e2; }
.slider-marks { position: relative; height: 11px; margin: 3px 0 8px; }
.smark { position: absolute; top: 0; width: 1px; height: 6px; background: #d3d9e3; }
.smark.k5 { height: 10px; }
.smark.res { background: #f4a8b8; } .smark.sup { background: #9fdcc4; }

.ctl-row { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.ctl-row .btn { padding: 6px 9px; font-family: var(--mono); font-size: 11px; }
.ctl-row .btn-soft { font-family: Inter, sans-serif; font-size: 11.5px; }
#priceInput { width: 92px; text-align: center; font: 600 12.5px var(--mono); color: var(--foreground); border: 1px solid var(--border); border-radius: 8px; padding: 6px 4px; outline: none; background: #fff; }
#priceInput:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,91,255,.14); }
#priceInput::-webkit-outer-spin-button, #priceInput::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ═════════════════════════════════════════════════ thread */

.thread {
  display: grid; grid-template-rows: auto auto minmax(0,1fr) auto;
  min-height: 0; background: #fff;
}

.thread-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--border); position: relative; }
.thread-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--grad); }
.thread-head h2 { font-size: 14.5px; font-weight: 650; display: flex; align-items: baseline; gap: 7px; }
.th-sub { font-size: 11.5px; font-weight: 450; color: var(--muted-foreground); letter-spacing: 0; }
.thread-head p { margin: 2px 0 0; font-size: 11px; color: var(--muted-foreground); display: flex; align-items: center; gap: 6px; }
.typing-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--primary); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .3 } }
.th-actions { display: flex; align-items: center; gap: 8px; }

.thread-toolbar { padding: 8px 16px; border-bottom: 1px solid var(--hairline); background: #fcfdff; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; font: 450 11px Inter, sans-serif; padding: 4px 9px; border-radius: 999px; background: #fff; border: 1px solid var(--border); color: var(--body); cursor: pointer; transition: all .14s ease; }
.chip:hover { background: var(--muted); }
.chip.is-on { background: var(--foreground); border-color: var(--foreground); color: #fff; }
.sw { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }
.c-signal { background: var(--c-signal); } .c-position { background: var(--c-position); }
.c-order { background: var(--c-order); } .c-broker { background: var(--c-broker); }
.c-risk { background: var(--c-risk); } .c-news { background: var(--c-news); }
.c-macro { background: var(--c-macro); } .c-trend { background: var(--c-trend); }

.thread-scroll { overflow-y: auto; padding: 14px 16px 8px; scroll-behavior: smooth; }
.feed { display: flex; flex-direction: column; gap: 4px; }

.day-rule { display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; }
.day-rule::before, .day-rule::after { content: ""; height: 1px; flex: 1; background: var(--hairline); }
.day-rule span { font: 600 9.5px Inter, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: #8792a2; }

.unread-rule { display: flex; align-items: center; gap: 10px; margin: 12px 0 10px; }
.unread-rule::before, .unread-rule::after { content: ""; height: 1px; flex: 1; background: color-mix(in srgb, var(--primary) 30%, transparent); }
.unread-rule span { font: 600 10px Inter, sans-serif; letter-spacing: .05em; text-transform: uppercase; color: var(--primary); background: var(--accent); border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent); padding: 3px 10px; border-radius: 999px; }

/* message */
.msg { display: grid; grid-template-columns: 30px minmax(0,1fr); gap: 10px; padding: 8px 8px 9px; border-radius: 11px; margin: 0 -8px; position: relative; animation: pop .45s cubic-bezier(.2,.9,.25,1) both; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
.msg.is-unread { background: linear-gradient(90deg, rgba(99,91,255,.055), rgba(99,91,255,.01) 65%, transparent); }
.msg.is-unread::before { content: ""; position: absolute; left: 1px; top: 13px; width: 4px; height: 4px; border-radius: 999px; background: var(--primary); }

.msg-avatar { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 12.5px; color: #fff; box-shadow: var(--shadow-xs); }
.msg-body { min-width: 0; }
.msg-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 3px; }
.msg-from { font: 600 11.5px Inter, sans-serif; color: var(--foreground); }
.msg-pill { font: 600 9px Inter, sans-serif; letter-spacing: .05em; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; border: 1px solid; }
.msg-when { margin-left: auto; font: 450 10px var(--mono); color: #98a2b3; white-space: nowrap; }
.msg-px { font: 500 10px var(--mono); color: var(--body); background: var(--muted); border: 1px solid var(--border); padding: 1px 5px; border-radius: 4px; }

.msg-title { font-size: 13.2px; font-weight: 600; line-height: 1.42; margin: 0 0 3px; color: var(--foreground); }
.msg-text { font-size: 12.3px; line-height: 1.6; color: var(--body); margin: 0; }
.msg-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.tag { font: 500 9.5px Inter, sans-serif; padding: 2px 6px; border-radius: 4px; background: var(--muted); border: 1px solid var(--border); color: var(--muted-foreground); }
.tag.tf { background: var(--accent); border-color: color-mix(in srgb, var(--primary) 20%, transparent); color: var(--accent-foreground); font-family: var(--mono); }

.msg-plan { margin-top: 8px; padding: 8px 11px; border-radius: 8px; background: var(--muted); border: 1px solid var(--border); border-left: 3px solid var(--primary); font-size: 11.8px; line-height: 1.55; }
.msg-plan b { display: block; font: 600 9px Inter, sans-serif; letter-spacing: .07em; text-transform: uppercase; color: var(--primary); margin-bottom: 2px; }

.msg[data-cat="signal"]   .msg-avatar { background: var(--c-signal); }
.msg[data-cat="position"] .msg-avatar { background: var(--c-position); }
.msg[data-cat="order"]    .msg-avatar { background: var(--c-order); }
.msg[data-cat="broker"]   .msg-avatar { background: var(--c-broker); }
.msg[data-cat="risk"]     .msg-avatar { background: var(--c-risk); }
.msg[data-cat="news"]     .msg-avatar { background: var(--c-news); }
.msg[data-cat="macro"]    .msg-avatar { background: var(--c-macro); }
.msg[data-cat="trend"]    .msg-avatar { background: var(--c-trend); }
.msg[data-cat="system"]   .msg-avatar { background: var(--c-system); }
.msg[data-cat="copilot"]  .msg-avatar { background: var(--grad); }
.msg[data-cat="you"]      .msg-avatar { background: #0a2540; font: 600 9.5px Inter, sans-serif; }

.msg[data-cat="signal"]   .msg-pill { color: #4c46c9; background: #f0f0ff; border-color: #d9d7ff; }
.msg[data-cat="position"] .msg-pill { color: #06724f; background: #e7f8f1; border-color: #b9ead8; }
.msg[data-cat="order"]    .msg-pill { color: #9a5b00; background: #fef4e5; border-color: #fadeb0; }
.msg[data-cat="broker"]   .msg-pill { color: #0369a1; background: #e6f6fe; border-color: #bae6fd; }
.msg[data-cat="risk"]     .msg-pill { color: #b3123a; background: #fdeaee; border-color: #f8c8d3; }
.msg[data-cat="news"]     .msg-pill { color: #3f4d63; background: #f1f4f8; border-color: #dde3ec; }
.msg[data-cat="macro"]    .msg-pill { color: #a01055; background: #fdeaf4; border-color: #f9c9e2; }
.msg[data-cat="trend"]    .msg-pill { color: #0b5f59; background: #e5f6f4; border-color: #b6e3de; }
.msg[data-cat="system"]   .msg-pill { color: #56637a; background: #f1f4f8; border-color: #dde3ec; }
.msg[data-cat="copilot"]  .msg-pill { color: #4c46c9; background: #f0f0ff; border-color: #d9d7ff; }

.msg[data-cat="risk"] .msg-body { border: 1px solid #f8c8d3; background: #fff7f9; border-radius: 9px; padding: 10px 12px; margin-top: -2px; }
.msg[data-cat="broker"] .msg-body { border: 1px solid #d6ecfa; background: #fbfeff; border-radius: 9px; padding: 10px 12px; margin-top: -2px; }

.msg[data-cat="ad"] .msg-avatar { background: var(--grad); }
.msg[data-cat="ad"] .msg-body { border: 1px solid #ded9ff; border-radius: 11px; padding: 12px 14px; margin-top: -3px; background: radial-gradient(360px 110px at 100% 0%, rgba(0,212,255,.10), transparent 70%), radial-gradient(360px 120px at 0% 100%, rgba(122,90,248,.10), transparent 70%), #fdfdff; box-shadow: var(--shadow-sm); }
.ad-pill { font: 600 9px Inter, sans-serif; letter-spacing: .09em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; color: #fff; background: var(--grad); }
.ad-cta { margin-top: 10px; padding: 7px 14px; border-radius: 8px; border: none; cursor: pointer; background: var(--grad); color: #fff; font: 600 12px Inter, sans-serif; box-shadow: 0 4px 12px -3px rgba(99,91,255,.5); }
.ad-cta:hover { transform: translateY(-1px); }
.ad-cta:disabled { background: var(--muted); color: var(--muted-foreground); box-shadow: none; transform: none; cursor: default; }

.msg[data-cat="you"] { grid-template-columns: minmax(0,1fr) 30px; }
.msg[data-cat="you"] .msg-avatar { order: 2; }
.msg[data-cat="you"] .msg-body { order: 1; justify-self: end; max-width: 82%; }
.msg[data-cat="you"] .msg-head { justify-content: flex-end; }
.msg[data-cat="you"] .msg-when { margin-left: 0; }
.msg[data-cat="you"] .msg-title { background: var(--primary); color: #fff; margin: 0; padding: 8px 13px; border-radius: 11px 4px 11px 11px; font-weight: 500; font-size: 12.6px; }
.msg[data-cat="you"] .msg-text, .msg[data-cat="you"] .msg-pill { display: none; }

.typing { display: grid; grid-template-columns: 30px minmax(0,1fr); gap: 10px; padding: 8px; }
.typing-bubble { display: inline-flex; align-items: center; gap: 4px; align-self: center; padding: 8px 12px; border-radius: 11px; background: var(--muted); border: 1px solid var(--border); width: fit-content; }
.typing-bubble i { width: 5px; height: 5px; border-radius: 999px; background: #a9b4c6; animation: bounce 1.3s infinite; }
.typing-bubble i:nth-child(2) { animation-delay: .17s; }
.typing-bubble i:nth-child(3) { animation-delay: .34s; }
@keyframes bounce { 0%,60%,100% { transform: translateY(0); opacity: .5 } 30% { transform: translateY(-4px); opacity: 1 } }

.composer { border-top: 1px solid var(--border); padding: 10px 16px 12px; background: #fcfdff; }
.composer-chips { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.composer-chips button { font: 450 11px Inter, sans-serif; padding: 4px 10px; border-radius: 999px; background: #fff; border: 1px solid var(--border); color: var(--body); cursor: pointer; }
.composer-chips button:hover { border-color: color-mix(in srgb, var(--primary) 40%, transparent); color: var(--accent-foreground); background: var(--accent); }
.composer-box { display: flex; gap: 7px; align-items: center; }
.composer-box input { flex: 1; min-width: 0; font: 400 12.5px Inter, sans-serif; color: var(--foreground); background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 12px; outline: none; box-shadow: var(--shadow-xs); }
.composer-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,91,255,.14); }

.disclaimer { font-size: 9.5px; line-height: 1.5; color: #98a2b3; margin: 8px 0 0; }

@media (max-width: 1400px) { .shell { grid-template-columns: 190px minmax(420px,1fr) 384px; } }
@media (max-width: 1180px) {
  body { overflow: auto; }
  .shell { height: auto; grid-template-columns: 1fr; }
  .rail { grid-template-rows: auto auto auto; border-right: none; border-bottom: 1px solid var(--border); }
  .rail-scroll { max-height: 190px; }
  .workspace { border-right: none; height: 70vh; }
  .thread-scroll { max-height: 60vh; }
}


/* ── TradingView-style mini chart inside a signal message ─────────── */
.msg-chart {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fcfdff;
  overflow: hidden;
}
.msg-chart svg { display: block; width: 100%; height: 132px; }
.mc-legend {
  display: flex; flex-wrap: wrap; gap: 4px 11px;
  padding: 6px 10px 7px;
  border-top: 1px solid var(--hairline);
  background: #fff;
}
.mc-legend span {
  display: inline-flex; align-items: center; gap: 5px;
  font: 450 10px Inter, sans-serif; color: var(--muted-foreground);
}
.mc-legend i { width: 13px; height: 0; border-top-width: 2px; display: inline-block; }
.mc-legend b { font-family: var(--mono); font-size: 10px; font-weight: 600; color: var(--body); }

/* wider messages now that the feed owns the main half */
.feed { max-width: 780px; }
