:root {
  --ink: #251413;
  --muted: #7d6861;
  --paper: #fff4e7;
  --panel: rgba(255, 249, 239, 0.76);
  --line: rgba(84, 34, 28, 0.14);
  --green: #b91f1a;
  --amber: #c57925;
  --red: #c12a22;
  --blue: #8b4234;
  --rise: #c12a22;
  --fall: #1f7a4b;
  --shadow: 0 24px 70px rgba(116, 42, 30, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Aptos Display", "Noto Serif SC", "Songti SC", Georgia, serif;
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 190, 118, 0.34), transparent 28rem),
    radial-gradient(circle at 88% 0%, rgba(205, 59, 48, 0.24), transparent 24rem),
    linear-gradient(135deg, #f4dfcc 0%, #fff5e8 46%, #f3c8b4 100%);
}

.shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 34px 0;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 4px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.56);
  text-decoration: none;
  font: inherit;
  white-space: nowrap;
}

.button-link {
  cursor: pointer;
}

.eyebrow,
.section-title p {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.04em;
}

h1 {
  font-size: clamp(34px, 5.2vw, 62px);
  line-height: 0.9;
}

h2 {
  font-size: clamp(24px, 4vw, 40px);
}

.subcopy {
  max-width: 620px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
}

.freshness-item {
  color: var(--muted);
}

.freshness-item.stale {
  color: var(--rise);
  font-weight: 900;
}

.freshness-sep {
  color: rgba(125, 104, 97, 0.45);
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.top-board {
  display: grid;
  grid-template-columns: 1.62fr 1.04fr 0.58fr 0.58fr;
  grid-template-rows: repeat(2, minmax(106px, auto));
  grid-template-areas:
    "holdings nav regime exposure"
    "holdings nav live kline";
  gap: 16px;
  align-items: stretch;
}

.card,
.panel {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.card {
  min-height: 116px;
  padding: 22px;
}

.card span,
.metric-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.card strong {
  display: block;
  margin-top: 20px;
  font-size: clamp(28px, 4vw, 48px);
  letter-spacing: -0.04em;
}

.card small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
}

.nav-card {
  grid-area: nav;
  color: #fdf8ed;
  background: linear-gradient(135deg, #b3211f, #7f201c 48%, #3a1512);
}

.holdings-hero-card {
  grid-area: holdings;
  color: #fffaf0;
  background:
    radial-gradient(circle at 90% 0%, rgba(255, 220, 156, 0.30), transparent 18rem),
    linear-gradient(135deg, #8a321f, #b12c24 55%, #421512);
}

.regime-card {
  grid-area: regime;
}

.exposure-card {
  grid-area: exposure;
}

.live-card {
  grid-area: live;
}

.kline-card {
  grid-area: kline;
}

.compact-card {
  padding: 20px;
}

.compact-card strong {
  margin-top: 14px;
  font-size: clamp(24px, 2.8vw, 38px);
}

.nav-card span,
.nav-card small,
.holdings-hero-card span {
  color: rgba(255, 255, 255, 0.72);
}

.hero-holdings {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.hero-holding-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.hero-holding-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.hero-holding-row b,
.hero-empty {
  display: block;
  font-size: clamp(24px, 3vw, 42px);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.hero-holding-row span {
  display: block;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 15px;
  letter-spacing: 0.08em;
}

.hero-holding-row strong {
  font-size: clamp(26px, 3.4vw, 48px);
  line-height: 0.9;
  letter-spacing: -0.06em;
}

.hero-holding-value {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.hero-holding-value small {
  color: rgba(255, 255, 255, 0.68);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.panel {
  margin-top: 18px;
  padding: 26px;
}

.inline-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.inline-title small {
  color: var(--muted);
  line-height: 1.6;
  text-align: right;
}

.split {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 32px;
}

.holding-table {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.holding-row {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr 1fr;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.48);
}

.holding-row b {
  font-size: 20px;
}

.tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--blue);
  font-size: 12px;
}

.weight {
  font-size: 26px;
  font-weight: 900;
  text-align: right;
}

.metric-list,
.events,
.profile-grid,
.backtest-grid {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.profile-grid,
.backtest-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.45);
}

.profile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.profile-head span,
.profile-model {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.profile-head h3 {
  margin: 4px 0 0;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.profile-head b {
  padding: 7px 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--green);
  font-size: 12px;
}

.profile-metrics,
.profile-live {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.profile-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.profile-live {
  grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr);
  gap: 14px;
  align-items: stretch;
}

.profile-metrics div {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.44);
}

.profile-metrics small {
  display: block;
  color: var(--muted);
}

.profile-metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.profile-holdings {
  margin: 0;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.44);
  color: var(--ink);
  line-height: 1.7;
}

.profile-nav-block,
.rebalance-list {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.44);
}

.profile-nav-block small,
.rebalance-list small {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
}

.profile-nav-block strong {
  display: block;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.rebalance-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.rebalance-row {
  display: grid;
  gap: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.rebalance-row b {
  color: var(--muted);
  font-size: 12px;
}

.rebalance-row span,
.rebalance-row small,
.rebalance-empty {
  line-height: 1.55;
}

.rebalance-row small {
  color: var(--muted);
}

.metric-item,
.event-item {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.42);
}

.metric-value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 900;
}

.event-item h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.event-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.backtest-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.42);
}

.backtest-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.backtest-head b {
  display: block;
  margin-top: 5px;
  font-size: 13px;
}

.backtest-status {
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.backtest-status.current {
  color: #fff;
  background: var(--rise);
}

.backtest-status.stale {
  color: var(--muted);
  background: rgba(125, 104, 97, 0.12);
}

.backtest-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.backtest-metrics div {
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.45);
}

.backtest-metrics small {
  display: block;
  color: var(--muted);
}

.backtest-metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.backtest-card p {
  margin: 14px 0 0;
  color: var(--muted);
}

.risk-on {
  color: var(--rise);
}

.risk-off {
  color: var(--fall);
}

.chart-scroll {
  width: 100%;
  height: 190px;
  margin-top: 18px;
  overflow: hidden;
}

canvas {
  display: block;
  width: 100%;
  height: 190px;
}

.range-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.range-tabs button {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.42);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.range-tabs button.active {
  color: #fffaf0;
  background: var(--green);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.candidate-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.candidate-table-wrap {
  width: 100%;
  margin-top: 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.34);
}

.candidate-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
}

.candidate-table th,
.candidate-table td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(84, 34, 28, 0.09);
  text-align: left;
  vertical-align: middle;
}

.candidate-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.34);
  white-space: nowrap;
}

.candidate-table tr:last-child td {
  border-bottom: 0;
}

.candidate-table b,
.candidate-table strong {
  display: block;
  font-size: 15px;
}

.candidate-table small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.candidate-row.selected {
  background: rgba(185, 31, 26, 0.10);
}

.candidate-row.visible {
  background: rgba(216, 63, 103, 0.08);
}

.candidate-row.candidate {
  background: rgba(197, 121, 37, 0.10);
}

.candidate-row.warning {
  background: rgba(217, 154, 23, 0.13);
}

.candidate-row.blocked {
  color: rgba(37, 20, 19, 0.66);
  background: rgba(125, 104, 97, 0.06);
}

.candidate-row.neutral {
  color: rgba(37, 20, 19, 0.58);
}

.candidate-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 9px;
  border-radius: 999px;
  color: #fffaf0;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.candidate-chip.selected {
  background: #b91f1a;
}

.candidate-chip.visible {
  background: #d83f67;
}

.candidate-chip.candidate {
  background: #c57925;
}

.candidate-chip.warning {
  color: #3b241b;
  background: #f0bd4f;
}

.candidate-chip.blocked {
  background: #8b756b;
}

.candidate-chip.neutral {
  background: #9c9088;
}

.copilot-body {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 0% 0%, rgba(185, 31, 26, 0.22), transparent 28rem),
    radial-gradient(circle at 98% 12%, rgba(197, 121, 37, 0.18), transparent 24rem),
    linear-gradient(135deg, #f2d9c2 0%, #fff7ed 50%, #f4ccb9 100%);
}

.copilot-shell {
  width: min(1280px, calc(100% - 28px));
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  padding: 18px 0;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 16px;
  overflow: hidden;
}

.copilot-backdrop {
  display: none;
}

.copilot-title-card,
.copilot-side-card,
.chat-panel {
  border: 1px solid rgba(84, 34, 28, 0.13);
  background: linear-gradient(180deg, rgba(255, 250, 242, 0.9), rgba(255, 244, 231, 0.74));
  box-shadow: 0 24px 70px rgba(116, 42, 30, 0.14);
  backdrop-filter: blur(18px);
}

.copilot-sidebar {
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 18px;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  overflow: hidden;
}

.copilot-sidebar > .copilot-title-card,
.copilot-sidebar > .copilot-side-card {
  margin-bottom: 16px;
}

.copilot-sidebar summary {
  display: none;
}

.copilot-title-card {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border-radius: 24px;
  box-shadow: none;
}

.copilot-title-card::after {
  content: "";
  position: absolute;
  right: -84px;
  top: -86px;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(185, 31, 26, 0.18), transparent 68%);
  pointer-events: none;
}

.copilot-title-card h1 {
  margin: 0;
  font-size: clamp(30px, 3vw, 42px);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.copilot-title-card .subcopy {
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.75;
}

.copilot-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}

.copilot-actions .nav-link {
  min-height: 42px;
  padding-inline: 12px;
}

.copilot-side-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-content: start;
  align-items: start;
  gap: 16px;
  padding: 18px;
  border-radius: 24px;
  box-shadow: none;
}

.copilot-status-dot {
  width: 13px;
  height: 13px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 8px rgba(185, 31, 26, 0.1);
}

.copilot-side-card .token-box {
  grid-column: 1 / -1;
}

.copilot-side-card b,
.copilot-side-card span {
  display: block;
}

.copilot-side-card b {
  font-size: 18px;
  letter-spacing: -0.02em;
}

.copilot-side-card span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.copilot-note {
  align-self: end;
  margin: 0;
  padding: 14px 16px;
  border: 1px dashed rgba(84, 34, 28, 0.18);
  border-radius: 20px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.34);
  font-size: 13px;
  line-height: 1.6;
}

.token-box {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.token-box input,
.chat-form textarea {
  width: 100%;
  border: 1px solid rgba(84, 34, 28, 0.14);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font: inherit;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.token-box input {
  padding: 11px 13px;
  text-transform: none;
  letter-spacing: 0;
}

.token-box input:focus,
.chat-form textarea:focus {
  border-color: rgba(185, 31, 26, 0.34);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 4px rgba(185, 31, 26, 0.08);
}

.chat-panel {
  height: 100%;
  min-height: 0;
  padding: 14px;
  border-radius: 32px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 16px;
  overflow: hidden;
}

.chat-log {
  display: grid;
  align-content: start;
  gap: 16px;
  margin: -14px;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding: 14px;
  scrollbar-color: rgba(185, 31, 26, 0.32) transparent;
}

.chat-message {
  max-width: min(78%, 760px);
  padding: 14px 16px;
  border: 1px solid rgba(84, 34, 28, 0.12);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 12px 34px rgba(116, 42, 30, 0.08);
}

.chat-message.user {
  justify-self: end;
  color: #fffaf4;
  border-color: rgba(185, 31, 26, 0.18);
  background: linear-gradient(135deg, #b91f1a, #d64936);
  box-shadow: 0 18px 44px rgba(185, 31, 26, 0.2);
}

.chat-message.assistant {
  justify-self: start;
}

.chat-message.pending .chat-markdown {
  color: var(--muted);
}

.chat-role {
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.chat-message.user .chat-role {
  color: rgba(255, 250, 244, 0.78);
}

.chat-message small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.chat-message.user small {
  color: rgba(255, 250, 244, 0.72);
}

.chat-markdown {
  word-break: break-word;
  font: 15px/1.74 "LXGW WenKai", "Noto Serif SC", serif;
}

.chat-markdown > :first-child {
  margin-top: 0;
}

.chat-markdown > :last-child {
  margin-bottom: 0;
}

.chat-markdown p {
  margin: 0 0 10px;
}

.chat-markdown h1,
.chat-markdown h2,
.chat-markdown h3,
.chat-markdown h4 {
  margin: 12px 0 8px;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.chat-markdown h1 {
  font-size: 22px;
}

.chat-markdown h2 {
  font-size: 20px;
}

.chat-markdown h3 {
  font-size: 18px;
}

.chat-markdown h4 {
  font-size: 16px;
}

.chat-markdown ul,
.chat-markdown ol {
  margin: 6px 0 12px 1.25em;
  padding: 0;
}

.chat-markdown li {
  margin: 4px 0;
}

.chat-markdown blockquote {
  margin: 10px 0;
  padding: 8px 12px;
  border-left: 3px solid rgba(185, 31, 26, 0.35);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.36);
  color: var(--muted);
}

.chat-markdown code {
  padding: 2px 5px;
  border-radius: 7px;
  background: rgba(84, 34, 28, 0.08);
  font: 0.92em/1.45 "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

.chat-markdown pre {
  margin: 10px 0;
  padding: 12px;
  overflow-x: auto;
  border-radius: 16px;
  background: rgba(37, 20, 19, 0.88);
  color: #fff7ec;
}

.chat-markdown pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  white-space: pre;
}

.chat-markdown a {
  color: var(--green);
  font-weight: 800;
  text-decoration: none;
  border-bottom: 1px solid rgba(185, 31, 26, 0.25);
}

.chat-message.user .chat-markdown a,
.chat-message.user .chat-markdown blockquote {
  color: rgba(255, 250, 244, 0.88);
}

.chat-message.user .chat-markdown code {
  background: rgba(255, 250, 244, 0.18);
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 12px;
  align-items: end;
  padding-top: 4px;
}

.chat-form textarea {
  height: auto;
  min-height: 52px;
  max-height: 168px;
  resize: none;
  overflow-y: auto;
  padding: 14px 16px;
  line-height: 1.55;
}

.chat-form button {
  min-height: 52px;
  border: 0;
  border-radius: 22px;
  color: #fff;
  background: linear-gradient(135deg, #b91f1a, #d64936);
  box-shadow: 0 18px 38px rgba(185, 31, 26, 0.22);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.chat-form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 22px 44px rgba(185, 31, 26, 0.28);
}

@media (max-width: 860px) {
  .hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-actions {
    width: 100%;
    align-items: center;
    justify-content: space-between;
    flex-direction: row;
    flex-wrap: nowrap;
  }

  .hero-actions .nav-link {
    flex: 0 0 auto;
  }

  .status-pill {
    flex: 1;
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    font-size: 12px;
  }

  .status-pill::-webkit-scrollbar {
    display: none;
  }

  .status-pill > * {
    flex: 0 0 auto;
  }

  .chat-topbar,
  .chat-form {
    width: 100%;
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .copilot-shell {
    width: 100%;
    height: 100dvh;
    padding: 0;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
    gap: 0;
    position: relative;
  }

  .copilot-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: none;
    background: rgba(37, 20, 19, 0.18);
    backdrop-filter: blur(4px);
  }

  .copilot-menu-open .copilot-backdrop {
    display: block;
  }

  .copilot-sidebar {
    position: fixed;
    z-index: 30;
    top: 0;
    left: 0;
    right: 0;
    height: auto;
    max-height: 58px;
    padding: 0 12px;
    border: 0;
    border-radius: 0;
    display: block;
    overflow: hidden;
    background: rgba(255, 248, 238, 0.92);
    box-shadow: 0 10px 34px rgba(74, 24, 20, 0.12);
    backdrop-filter: blur(18px);
  }

  .copilot-sidebar summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 58px;
    padding: 0 4px;
    cursor: pointer;
    list-style: none;
  }

  .copilot-sidebar summary::-webkit-details-marker {
    display: none;
  }

  .copilot-sidebar summary span {
    color: var(--green);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .copilot-sidebar summary b {
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.56);
    font-size: 13px;
  }

  .copilot-sidebar[open] summary {
    margin-bottom: 10px;
  }

  .copilot-sidebar[open] {
    top: 12px;
    left: 12px;
    right: 12px;
    max-height: min(70vh, 520px);
    padding: 10px;
    border: 1px solid rgba(84, 34, 28, 0.13);
    border-radius: 24px;
    overflow: auto;
    background: linear-gradient(180deg, rgba(255, 250, 242, 0.96), rgba(255, 244, 231, 0.88));
    box-shadow: 0 28px 90px rgba(74, 24, 20, 0.28);
  }

  .copilot-sidebar:not([open]) {
    width: 100%;
  }

  .copilot-sidebar:not([open]) .copilot-title-card,
  .copilot-sidebar:not([open]) .copilot-side-card,
  .copilot-sidebar:not([open]) .copilot-note {
    display: none;
  }

  .copilot-title-card,
  .copilot-side-card,
  .chat-panel {
    border-radius: 24px;
  }

  .copilot-title-card {
    padding: 22px;
  }

  .copilot-title-card h1 {
    font-size: clamp(30px, 9vw, 42px);
  }

  .copilot-actions {
    margin-top: 18px;
    grid-template-columns: 1fr 1fr;
  }

  .copilot-actions .nav-link {
    width: 100%;
  }

  .copilot-side-card {
    margin-top: 10px;
    padding: 16px;
  }

  .copilot-note {
    display: none;
  }

  .chat-panel {
    height: 100%;
    min-height: 0;
    padding: 70px 10px 10px;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .chat-log {
    min-height: 0;
    max-height: none;
  }

  .grid,
  .top-board,
  .split,
  .profile-grid,
  .backtest-grid,
  .profile-live,
  .profile-metrics {
    grid-template-columns: 1fr;
  }

  .backtest-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .top-board {
    grid-template-areas:
      "holdings"
      "nav"
      "regime"
      "exposure"
      "live"
      "kline";
    grid-template-rows: auto;
  }

  .holdings-hero-card {
    grid-row: auto;
  }

  .hero-holding-row b,
  .hero-empty {
    font-size: clamp(24px, 7.4vw, 42px);
  }

  .hero-holding-row strong {
    font-size: clamp(26px, 8vw, 46px);
  }

  .inline-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .inline-title small {
    text-align: left;
  }

  .holding-row {
    grid-template-columns: 1fr;
  }

  .weight {
    text-align: left;
  }

  .chat-message {
    max-width: 100%;
  }

  .chat-form {
    grid-template-columns: 1fr 86px;
    gap: 10px;
  }

  .chat-form button {
    min-height: 54px;
    border-radius: 20px;
  }

  .chart-scroll {
    padding-bottom: 6px;
  }
}
