:root {
  color-scheme: dark;
  --bg: #101112;
  --panel: #17191b;
  --panel-2: #202327;
  --line: #30343a;
  --text: #f4f1ea;
  --muted: #a7aaa8;
  --soft: #d8d0c2;
  --green: #22c55e;
  --cyan: #38bdf8;
  --gold: #eab308;
  --red: #ef4444;
  --purple: #a78bfa;
  --blue: #2563eb;
  --blue-2: #2a7fff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(42, 127, 255, 0.08) 0%, transparent 34%),
    linear-gradient(180deg, #0c0d0f 0%, #141518 48%, #0f1012 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent 72%);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.gate-view,
.quan-view {
  display: none;
}

.gate-view.is-active,
.quan-view.is-active {
  display: flex;
}

.gate-view {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card,
.restricted-card {
  width: min(460px, 100%);
  background: rgba(23, 25, 27, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.restricted-card {
  text-align: center;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-row.compact {
  margin-bottom: 0;
}

.brand-row span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.brand-row strong {
  display: block;
  color: var(--text);
  font-size: 1.05rem;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: #e8ece6;
  color: #101112;
  font-weight: 900;
}

.brand-mark.locked {
  margin: 0 auto 14px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.42);
  color: #fecaca;
}

h1,
h2,
p {
  margin-top: 0;
}

.auth-card h1,
.restricted-card h1 {
  margin-bottom: 10px;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  line-height: 1.02;
}

.auth-card p,
.restricted-card p {
  color: var(--muted);
  line-height: 1.55;
}

.oauth-btn,
.primary-btn,
.secondary-btn,
.new-chat-btn,
.prompt-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-2);
}

.oauth-btn,
.primary-btn,
.new-chat-btn {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 800;
}

.primary-btn,
.new-chat-btn {
  background: #e8ece6;
  color: #111;
  border-color: transparent;
}

.oauth-btn:hover,
.secondary-btn:hover,
.prompt-card:hover {
  border-color: rgba(56, 189, 248, 0.7);
}

.icon-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #111;
  background: var(--text);
  font-size: 0.8rem;
  font-weight: 900;
}

.divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.divider span {
  height: 1px;
  background: var(--line);
}

.field-label,
.control-label {
  display: block;
  color: var(--soft);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.field-label {
  margin-bottom: 14px;
}

.text-input,
.select-input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #0d0e0f;
  outline: none;
}

.text-input,
.select-input {
  height: 44px;
  margin-top: 7px;
  padding: 0 12px;
}

.text-input:focus,
.select-input:focus,
textarea:focus {
  border-color: var(--cyan);
}

.text-input.small {
  height: 38px;
  margin-top: 0;
}

.check-row {
  display: none;
  align-items: flex-start;
  gap: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
  margin: 4px 0 16px;
}

.check-row.is-active {
  display: flex;
}

.inline-error {
  min-height: 20px;
  color: #fecaca;
  font-size: 0.86rem;
  margin-bottom: 12px;
}

.text-btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  border: 0;
  background: transparent;
  color: var(--cyan);
  font-weight: 800;
}

.restricted-card code {
  color: var(--gold);
}

.restricted-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 22px;
}

.primary-link,
.secondary-btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 800;
}

.primary-link {
  color: #111;
  background: #e8ece6;
}

.secondary-btn {
  background: transparent;
}

.secondary-btn.slim {
  min-height: 38px;
  padding: 0 12px;
}

.quan-view {
  min-height: 100vh;
  align-items: stretch;
}

.side-panel {
  position: sticky;
  top: 0;
  width: 300px;
  flex: 0 0 300px;
  min-height: 100vh;
  padding: 18px 18px 76px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(20, 23, 27, 0.98), rgba(12, 14, 17, 0.98)),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.025) 0, rgba(255,255,255,0.025) 1px, transparent 1px, transparent 18px);
  overflow-y: auto;
}

.side-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
}

.icon-btn svg,
.settings-corner-btn svg,
.send-btn svg,
.new-chat-btn svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-corner-btn {
  position: absolute;
  left: 18px;
  bottom: 18px;
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: 8px;
  background: rgba(10, 15, 24, 0.9);
  color: #9fb8dc;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255,255,255,0.04);
}

.settings-corner-btn:hover,
.settings-corner-btn.is-active {
  color: #e0f2fe;
  border-color: rgba(42, 127, 255, 0.64);
  background: linear-gradient(135deg, rgba(18, 31, 48, 0.98), rgba(16, 24, 38, 0.98));
  box-shadow: 0 0 0 3px rgba(42, 127, 255, 0.1), 0 14px 30px rgba(0, 0, 0, 0.3);
}

.panel-block {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.version-dropdown-container {
  position: relative;
  margin-top: 9px;
  z-index: 8;
}

.version-btn {
  width: 100%;
  min-height: 44px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(21, 28, 44, 0.96));
  border: 1px solid rgba(96, 165, 250, 0.28);
  color: white;
  padding: 7px 11px 7px 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 850;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  box-shadow: 0 10px 24px rgba(0,0,0,0.28);
}

.version-btn:hover {
  background: linear-gradient(135deg, rgba(17, 24, 39, 1), rgba(30, 41, 59, 1));
  border-color: rgba(42, 127, 255, 0.74);
  box-shadow: 0 0 0 3px rgba(42,127,255,0.12), 0 14px 30px rgba(0,0,0,0.34);
}

.version-chip-icon {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  flex: 0 0 22px;
  display: block;
  object-fit: cover;
  background: rgba(42, 127, 255, 0.1);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 0 0 2px rgba(42,127,255,0.08);
}

.version-btn span {
  flex: 1;
  text-align: left;
}

.version-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: 268px;
  max-height: min(430px, calc(100vh - 190px));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(96, 165, 250, 0.7) rgba(8, 13, 22, 0.98);
  background: rgba(8, 13, 22, 0.98);
  border: 1px solid rgba(42, 127, 255, 0.28);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.72), 0 0 0 1px rgba(255,255,255,0.04);
  backdrop-filter: blur(18px);
}

.version-dropdown-menu::-webkit-scrollbar {
  width: 7px;
}

.version-dropdown-menu::-webkit-scrollbar-track {
  background: rgba(8, 13, 22, 0.98);
}

.version-dropdown-menu::-webkit-scrollbar-thumb {
  background: rgba(96, 165, 250, 0.64);
  border-radius: 999px;
}

.version-dropdown-menu.show {
  display: block;
  animation: quanMenuIn 0.14s ease-out;
}

.version-option {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 0;
  border-bottom: 1px solid rgba(31, 41, 55, 0.9);
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: background 0.16s ease;
}

.version-option:last-child {
  border-bottom: none;
}

.version-option:hover {
  background: linear-gradient(90deg, rgba(42, 127, 255, 0.16), rgba(109, 40, 217, 0.12));
}

.version-option-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex: 0 0 32px;
  display: block;
  object-fit: cover;
  background: rgba(42, 127, 255, 0.13);
  border: 1px solid rgba(42, 127, 255, 0.28);
}

.version-option-mark.pro {
  background: rgba(124, 58, 237, 0.16);
  border-color: rgba(192, 132, 252, 0.28);
}

.version-option-mark.research {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(251, 191, 36, 0.3);
}

.version-chip-icon.g,
.version-option-mark.g {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.16);
}

.version-chip-icon.c,
.version-option-mark.c {
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.16);
}

.version-option span {
  display: grid;
  gap: 3px;
}

.version-option strong {
  color: #f8fafc;
  font-size: 0.92rem;
}

.version-option em {
  color: #9ca3af;
  font-size: 0.72rem;
  font-style: normal;
  line-height: 1.25;
}

.pro-text {
  color: #c084fc !important;
}

.research-text {
  color: #fbbf24 !important;
}

.model-badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 6px;
  border-radius: 5px;
  margin-left: 5px;
  font-size: 0.62rem;
  font-weight: 900;
  vertical-align: 1px;
}

.model-badge.muted {
  background: #374151;
  color: #d1d5db;
}

.model-badge.pro {
  background: #10b981;
  color: #000;
}

.model-badge.g {
  background: #6b4b08;
  color: #fde68a;
}

.model-badge.c {
  background: #3f2a12;
  color: #fcd34d;
}

@keyframes quanMenuIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.micro-note {
  min-height: 18px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.sync-block {
  display: grid;
  gap: 10px;
}

.sync-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(96, 165, 250, 0.26);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(42, 127, 255, 0.18), transparent 46%),
    linear-gradient(180deg, rgba(24, 28, 34, 0.78), rgba(12, 14, 17, 0.82));
  color: #f8fafc;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.sync-toggle:hover {
  border-color: rgba(96, 165, 250, 0.46);
  background:
    linear-gradient(90deg, rgba(42, 127, 255, 0.24), transparent 48%),
    linear-gradient(180deg, rgba(28, 33, 40, 0.9), rgba(12, 14, 17, 0.88));
}

.sync-toggle span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.sync-card {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(16, 185, 129, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(24, 28, 34, 0.72), rgba(12, 14, 17, 0.78));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.sync-toggle em,
.sync-card span {
  color: #93a4bb;
  font-size: 0.72rem;
  font-weight: 900;
  font-style: normal;
  text-transform: uppercase;
}

.sync-toggle strong,
.sync-card strong {
  color: #f8fafc;
  font-size: 0.86rem;
  line-height: 1.25;
}

.sync-toggle svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: #60a5fa;
  transition: transform 0.16s ease;
}

.sync-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.sync-holdings-panel {
  margin-top: -4px;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 8px;
  background: rgba(5, 8, 13, 0.46);
}

.sync-holdings-list {
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 2px;
}

.sync-holding-row {
  display: grid;
  grid-template-columns: minmax(46px, auto) 1fr;
  gap: 2px 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
}

.sync-holding-symbol {
  color: #eaf2ff;
  font-size: 0.82rem;
  font-weight: 950;
}

.sync-holding-meta {
  min-width: 0;
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 800;
  text-align: right;
}

.sync-holding-row em,
.sync-holding-row b {
  color: #708196;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 850;
  line-height: 1.2;
}

.sync-holding-row b {
  text-align: right;
}

.sync-empty {
  display: grid;
  gap: 4px;
  padding: 10px;
  color: #94a3b8;
  font-size: 0.76rem;
  line-height: 1.35;
}

.sync-empty strong {
  color: #dbeafe;
  font-size: 0.8rem;
}

.sync-more {
  padding: 4px 2px 0;
  color: #60a5fa;
  font-size: 0.72rem;
  font-weight: 850;
  text-align: center;
}

.chat-shell {
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
}

.chat-header {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 17, 18, 0.72);
  backdrop-filter: blur(18px);
}

.chat-header h1,
.quan-model-title {
  margin: 0;
  color: var(--blue);
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
}

.quan-model-title {
  display: block;
}

.title-version {
  color: #fff;
}

.title-pro {
  color: #c084fc;
}

.title-research {
  color: #fbbf24;
}

.title-beginner {
  color: #7dd3fc;
}

.title-g {
  color: #facc15;
}

.title-c {
  color: #fbbf24;
}

.title-dot {
  color: #fff;
}

.return-link {
  color: var(--cyan);
  text-decoration: none;
  font-weight: 850;
}

.stockup-wordmark {
  color: #f8fafc;
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: bold;
  letter-spacing: 0;
  line-height: 1;
}

.stockup-wordmark span {
  color: var(--blue);
}

.chat-area {
  overflow-y: auto;
  padding: 24px 0;
}

.welcome-block {
  max-width: 840px;
  margin: 8vh auto 0;
  text-align: center;
}

.welcome-block span {
  color: var(--cyan);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.welcome-block h2 {
  margin: 10px auto 18px;
  max-width: 520px;
  font-size: clamp(1.22rem, 1.9vw, 1.95rem);
  line-height: 1.16;
  font-weight: 800;
  color: #e6edf6;
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 430px;
  margin: 0 auto;
}

.prompt-card {
  min-height: 38px;
  padding: 0 11px;
  color: #dbeafe;
  text-align: center;
  font-weight: 850;
  font-size: 0.82rem;
  background: linear-gradient(180deg, rgba(18, 31, 48, 0.9), rgba(15, 18, 22, 0.95));
  border-color: rgba(96, 165, 250, 0.24);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 10px 24px rgba(0,0,0,0.18);
}

.prompt-card:hover {
  color: #fff;
  background: linear-gradient(180deg, rgba(30, 64, 100, 0.88), rgba(17, 24, 39, 0.95));
}

.settings-area {
  grid-row: 2 / -1;
  overflow-y: auto;
  padding: 28px 24px 0;
  position: relative;
}

.chat-shell.settings-open .attachment-chip,
.chat-shell.settings-open .composer-wrap {
  display: none;
}

.settings-shell {
  width: min(960px, 100%);
  min-height: calc(100vh - 78px);
  margin: 0 auto;
  padding-bottom: 128px;
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.settings-head span {
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.settings-head h2 {
  margin: 6px 0 0;
  color: #f8fafc;
  font-size: 1.55rem;
  line-height: 1;
}

.settings-section {
  display: grid;
  grid-template-columns: minmax(180px, 260px) 1fr;
  gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.settings-copy h3 {
  margin: 0 0 7px;
  color: #f8fafc;
  font-size: 1rem;
}

.settings-copy p {
  margin: 0;
  color: #8fa1b8;
  font-size: 0.88rem;
  line-height: 1.45;
}

.settings-model-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.settings-model-option {
  width: 100%;
  min-height: 66px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(20, 24, 31, 0.78), rgba(11, 14, 19, 0.86));
  color: var(--text);
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.035);
}

.settings-model-option:hover,
.settings-model-option.is-selected {
  border-color: rgba(42, 127, 255, 0.58);
  background:
    linear-gradient(90deg, rgba(42, 127, 255, 0.18), transparent 48%),
    linear-gradient(180deg, rgba(22, 28, 38, 0.94), rgba(11, 14, 19, 0.92));
}

.settings-model-option.is-selected {
  box-shadow: 0 0 0 3px rgba(42, 127, 255, 0.1), inset 0 1px 0 rgba(255,255,255,0.05);
}

.settings-model-option img {
  width: 32px;
  height: 32px;
}

.settings-model-option span {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.settings-model-option strong {
  color: #f8fafc;
  font-size: 0.9rem;
  line-height: 1.2;
}

.settings-model-option em {
  color: #8fa1b8;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 850;
}

.settings-saved-badge {
  display: inline-flex;
  margin-left: 5px;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(16, 185, 129, 0.14);
  color: #6ee7b7;
  font-size: 0.62rem;
  vertical-align: 1px;
}

.settings-save-status {
  min-height: 22px;
  margin-top: 16px;
  color: #93a4bb;
  font-size: 0.84rem;
  font-weight: 800;
}

.settings-save-status.success {
  color: #6ee7b7;
}

.settings-save-status.error {
  color: #fecaca;
}

.settings-apply-bar {
  position: sticky;
  left: 0;
  right: 0;
  bottom: 0;
  width: min(960px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 auto;
  padding: 14px;
  border: 1px solid rgba(96, 165, 250, 0.22);
  border-radius: 8px 8px 0 0;
  background: rgba(8, 13, 22, 0.96);
  box-shadow: 0 -22px 54px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255,255,255,0.05);
  backdrop-filter: blur(18px);
  z-index: 15;
}

.settings-apply-bar strong {
  display: block;
  color: #f8fafc;
  font-size: 0.9rem;
}

.settings-apply-bar span {
  display: block;
  margin-top: 2px;
  color: #8fa1b8;
  font-size: 0.8rem;
}

.settings-apply-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
}

.settings-apply-btn {
  border: 0;
}

.settings-apply-btn:disabled,
.settings-apply-actions button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.message {
  width: 100%;
  max-width: none;
  margin: 0 0 18px;
  display: block;
}

.message.user {
  justify-content: flex-start;
}

.bubble {
  width: 100%;
  max-width: 100%;
  border: 0;
  border-radius: 0;
  padding: 16px 28px;
  background: rgba(15, 21, 32, 0.55);
  border-top: 1px solid #111827;
  border-bottom: 1px solid #111827;
  border-left: 2px solid #1e2840;
  line-height: 1.65;
  white-space: pre-wrap;
  box-shadow: none;
}

.message.user .bubble {
  color: #93afd4;
  background: transparent;
  border-top: 0;
  border-bottom: 1px solid #0f1520;
  border-left-color: var(--blue);
  font-size: 0.9rem;
}

.message.system .bubble {
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-left: 2px solid rgba(239, 68, 68, 0.6);
  background: rgba(239, 68, 68, 0.08);
}

.bubble strong {
  color: #f59e0b;
}

.message.user .bubble strong {
  color: #dbeafe;
}

.bubble.thinking {
  padding: 6px 28px;
  background:
    linear-gradient(90deg, rgba(42, 127, 255, 0.06), transparent 48%),
    rgba(9, 13, 21, 0.38);
  border-left-color: rgba(96, 165, 250, 0.64);
}

.thinking-panel {
  width: min(520px, 100%);
  display: grid;
  gap: 3px;
  color: #a7b7d6;
  white-space: normal;
}

.thinking-head {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 3px 0 2px;
}

.thinking-orb {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.thinking-orb span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(96, 165, 250, 0.2);
  border-top-color: #60a5fa;
  background: transparent;
  animation: quanSpin 0.82s linear infinite;
}

.thinking-copy {
  min-width: 0;
  display: grid;
  gap: 0;
}

.thinking-copy span {
  color: #60a5fa;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.thinking-copy strong {
  color: #e8f2ff;
  font-size: 0.8rem;
  font-weight: 850;
  line-height: 1.25;
}

.thinking-foot {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.thinking-steps {
  display: none;
  gap: 0;
  padding: 2px 0 0 16px;
}

.thinking-steps.is-expanded {
  display: grid;
}

.thinking-toggle {
  width: auto;
  min-height: 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #93c5fd;
  font-size: 0.68rem;
  font-weight: 850;
}

.thinking-toggle:hover {
  color: #e0f2fe;
}

.thinking-toggle svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.16s ease;
}

.thinking-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.thinking-step {
  position: relative;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 10px;
  color: #7b8ca3;
  font-size: 0.82rem;
  line-height: 1.35;
}

.thinking-step:not(:last-child) {
  padding-bottom: 9px;
}

.thinking-step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 14px;
  bottom: -2px;
  width: 1px;
  background: rgba(96, 165, 250, 0.14);
}

.thinking-step span {
  width: 11px;
  height: 11px;
  margin-top: 3px;
  border-radius: 50%;
  background: #263244;
  border: 1px solid rgba(148, 163, 184, 0.18);
  flex: 0 0 11px;
}

.thinking-step p {
  margin: 0;
}

.thinking-step.is-active {
  color: #cfe5ff;
}

.thinking-step.is-active span {
  background: #60a5fa;
  border-color: rgba(96, 165, 250, 0.82);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.12);
}

.response-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  white-space: normal;
  user-select: none;
}

.response-action-btn {
  width: 31px;
  height: 31px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: #94a3b8;
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.response-action-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(96, 165, 250, 0.38);
  background: rgba(96, 165, 250, 0.11);
  color: #dbeafe;
}

.response-action-btn.is-active {
  border-color: rgba(42, 127, 255, 0.54);
  background: rgba(42, 127, 255, 0.18);
  color: #93c5fd;
}

.response-action-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quan-source-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  margin: 0 3px;
  padding: 3px 8px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.25;
  text-decoration: none;
  vertical-align: 0.08em;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.quan-source-pill:hover {
  background: rgba(96, 165, 250, 0.18);
  border-color: rgba(96, 165, 250, 0.5);
  color: #eff6ff;
  transform: translateY(-1px);
}

.quan-source-pill-disabled {
  cursor: default;
  opacity: 0.72;
}

.quan-source-pill-broad {
  border-color: rgba(245, 158, 11, 0.36);
  color: #fcd34d;
}

.quan-source-pill-broad .quan-source-dot {
  background: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.65);
}

.quan-source-pill-disabled:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(148, 163, 184, 0.22);
  color: #cbd5e1;
}

.quan-source-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: #60a5fa;
  box-shadow: 0 0 10px rgba(96, 165, 250, 0.65);
}

.quan-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  margin: 14px 0;
  border: 1px solid rgba(154, 168, 186, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(14, 18, 25, 0.92), rgba(8, 11, 16, 0.96));
  white-space: normal;
}

.quan-markdown-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  color: #dce8f6;
  font-size: 0.82rem;
  line-height: 1.42;
}

.quan-markdown-table th,
.quan-markdown-table td {
  padding: 10px 11px;
  border-bottom: 1px solid rgba(154, 168, 186, 0.1);
  border-right: 1px solid rgba(154, 168, 186, 0.08);
  text-align: left;
  vertical-align: top;
}

.quan-markdown-table th:last-child,
.quan-markdown-table td:last-child {
  border-right: 0;
}

.quan-markdown-table thead th {
  color: #75bfff;
  background: rgba(43, 142, 245, 0.08);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.quan-markdown-table tbody tr:last-child td {
  border-bottom: 0;
}

.quan-markdown-table tbody tr:hover td {
  background: rgba(43, 142, 245, 0.045);
}

.quan-highlight {
  display: inline;
  padding: 0.08em 0.28em;
  border-radius: 6px;
  background:
    linear-gradient(90deg, rgba(43, 142, 245, 0.2), rgba(251, 191, 36, 0.16));
  color: #f7fbff;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  font-weight: 850;
  box-shadow: inset 0 -1px 0 rgba(251, 191, 36, 0.28);
}

.quan-visual-stack {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  white-space: normal;
}

.quan-visual-card {
  overflow: hidden;
  border: 1px solid rgba(96, 165, 250, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(17, 24, 39, 0.82), rgba(7, 10, 16, 0.88));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.quan-visual-card.portfolio_exposure,
.quan-visual-card.portfolio_concentration,
.quan-visual-card.portfolio_action_plan,
.quan-visual-card.portfolio_update {
  border-color: rgba(43, 142, 245, 0.28);
  background:
    radial-gradient(circle at 92% 0%, rgba(53, 214, 159, 0.12), transparent 16rem),
    linear-gradient(135deg, rgba(43, 142, 245, 0.11), transparent 38%),
    linear-gradient(180deg, rgba(13, 18, 27, 0.96), rgba(7, 10, 16, 0.94));
  box-shadow:
    0 18px 38px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255,255,255,0.05);
}

.quan-visual-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.quan-visual-card.portfolio_exposure .quan-visual-header,
.quan-visual-card.portfolio_concentration .quan-visual-header,
.quan-visual-card.portfolio_action_plan .quan-visual-header {
  border-bottom-color: rgba(96, 165, 250, 0.16);
  background: linear-gradient(90deg, rgba(43, 142, 245, 0.12), transparent);
}

.quan-visual-card.portfolio_exposure .quan-visual-header span,
.quan-visual-card.portfolio_concentration .quan-visual-header span,
.quan-visual-card.portfolio_action_plan .quan-visual-header span {
  color: #8fd0ff;
}

.quan-visual-header div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.quan-visual-header span {
  color: #60a5fa;
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
}

.quan-visual-header strong {
  color: #f8fafc;
  font-size: 0.9rem;
  line-height: 1.2;
}

.quan-visual-body {
  padding: 12px;
}

.quan-visual-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.quan-mini-card,
.quan-level-mini,
.quan-portfolio-row {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 8px;
  background: rgba(255,255,255,0.035);
}

.quan-mini-card.pos,
.quan-visual-event.pos {
  border-color: rgba(16, 185, 129, 0.28);
}

.quan-mini-card.neg,
.quan-visual-event.neg {
  border-color: rgba(248, 113, 113, 0.28);
}

.quan-mini-card.warn {
  border-color: rgba(251, 191, 36, 0.28);
}

.quan-mini-card span,
.quan-level-mini span,
.quan-move-visual span,
.quan-portfolio-row span,
.quan-band-visual span,
.quan-split-head span {
  color: #93a4bb;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.quan-mini-card strong,
.quan-level-mini strong,
.quan-move-visual strong,
.quan-portfolio-row strong,
.quan-band-visual strong,
.quan-split-head strong {
  color: #f8fafc;
  font-size: 0.96rem;
}

.quan-mini-card em,
.quan-level-mini em,
.quan-portfolio-row em {
  color: #9ca3af;
  font-size: 0.72rem;
  font-style: normal;
}

.quan-mini-card p,
.quan-mini-card li,
.quan-move-visual p,
.quan-band-visual p,
.quan-portfolio-visual p,
.quan-visual-event p,
.quan-risk-mini p {
  margin: 0;
  color: #aab7ca;
  font-size: 0.78rem;
  line-height: 1.4;
}

.quan-mini-card ul {
  margin: 0;
  padding-left: 16px;
}

.quan-visual-timeline,
.quan-risk-list,
.quan-level-list,
.quan-portfolio-visual {
  display: grid;
  gap: 8px;
}

.quan-portfolio-visual {
  gap: 9px;
}

.quan-portfolio-summary {
  margin: 0 0 2px;
  padding: 10px 11px;
  border: 1px solid rgba(96, 165, 250, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(43, 142, 245, 0.09), transparent 66%),
    rgba(255, 255, 255, 0.026);
  color: #c6d7ed !important;
}

.quan-portfolio-row {
  display: grid;
  gap: 7px;
  padding: 11px 12px;
  border-color: rgba(96, 165, 250, 0.14);
  background:
    linear-gradient(180deg, rgba(17, 24, 39, 0.68), rgba(8, 12, 18, 0.72));
}

.quan-portfolio-row.pos {
  border-color: rgba(53, 214, 159, 0.24);
}

.quan-portfolio-row.neg {
  border-color: rgba(248, 113, 113, 0.24);
}

.quan-portfolio-row.warn {
  border-color: rgba(251, 191, 36, 0.25);
}

.quan-portfolio-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quan-portfolio-row-main span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #dbeafe;
  font-size: 0.78rem;
  letter-spacing: 0;
  text-transform: none;
}

.quan-portfolio-row-main strong {
  flex: 0 0 auto;
  color: #f8fafc;
  font-family: var(--mono);
  font-size: 0.84rem;
}

.quan-portfolio-bar {
  position: relative;
  display: block;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(51, 65, 85, 0.7);
}

.quan-portfolio-bar b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2b8ef5, #35d69f);
}

.quan-portfolio-row.warn .quan-portfolio-bar b {
  background: linear-gradient(90deg, #2b8ef5, #fbbf24);
}

.quan-portfolio-row.neg .quan-portfolio-bar b {
  background: linear-gradient(90deg, #fbbf24, #f87171);
}

.quan-portfolio-row em {
  color: #94a3b8;
  font-size: 0.72rem;
  line-height: 1.35;
}

.quan-visual-event {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
}

.quan-visual-event i {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: #60a5fa;
}

.quan-risk-mini {
  display: grid;
  gap: 5px;
}

.quan-risk-mini div,
.quan-target-row,
.quan-split-head,
.quan-band-visual div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.quan-risk-mini i,
.quan-band-visual > i {
  position: relative;
  display: block;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(51, 65, 85, 0.68);
}

.quan-risk-mini i b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2a7fff, #fbbf24);
}

.quan-band-visual > i b {
  position: absolute;
  top: -4px;
  width: 3px;
  height: 15px;
  border-radius: 999px;
  background: #fbbf24;
}

.quan-move-visual,
.quan-band-visual,
.quan-split-visual {
  display: grid;
  gap: 8px;
}

.quan-portfolio-update {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(53, 214, 159, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(53, 214, 159, 0.12), transparent 56%),
    rgba(255, 255, 255, 0.03);
}

.quan-portfolio-update.neg {
  border-color: rgba(248, 113, 113, 0.24);
  background:
    linear-gradient(90deg, rgba(248, 113, 113, 0.11), transparent 56%),
    rgba(255, 255, 255, 0.03);
}

.quan-portfolio-update span {
  color: #8fd0ff;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
}

.quan-portfolio-update strong {
  color: #f8fafc;
  font-size: 1.18rem;
}

.quan-portfolio-update div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quan-portfolio-update em {
  border: 1px solid rgba(154, 168, 186, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: #c9d7eb;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 800;
  padding: 4px 8px;
}

.quan-portfolio-update p {
  margin: 0;
  color: #aab7ca;
  font-size: 0.78rem;
  line-height: 1.4;
}

.quan-target-row {
  color: #9ca3af;
  font-size: 0.75rem;
}

@keyframes quanSpin {
  to { transform: rotate(360deg); }
}

@keyframes quanPulse {
  0% { transform: scale(0.72); box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.38); opacity: 0.72; }
  55% { transform: scale(1); box-shadow: 0 0 0 8px rgba(96, 165, 250, 0); opacity: 1; }
  100% { transform: scale(0.72); box-shadow: 0 0 0 0 rgba(96, 165, 250, 0); opacity: 0.72; }
}

.message.stock-visual {
  justify-content: flex-start;
  margin-top: -6px;
}

.stock-context-card {
  width: min(560px, 100%);
  min-height: 82px;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 132px auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.12), transparent 52%),
    linear-gradient(180deg, rgba(18, 24, 32, 0.94), rgba(12, 14, 17, 0.96));
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255,255,255,0.04);
}

.stock-context-card.is-up {
  border-color: rgba(16, 185, 129, 0.26);
}

.stock-context-card.is-down {
  border-color: rgba(239, 68, 68, 0.26);
}

.stock-card-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.stock-card-logo {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  border: 1px solid rgba(255,255,255,0.14);
  font-size: 0.72rem;
  font-weight: 950;
}

.stock-card-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.stock-card-logo span {
  display: none;
  width: 100%;
  height: 100%;
  place-items: center;
  background: #e8ece6;
}

.stock-card-name {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.stock-card-name strong {
  color: #f8fafc;
  font-size: 1rem;
  line-height: 1;
}

.stock-card-name em {
  color: #9ca3af;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  font-style: normal;
}

.stock-card-chart-wrap {
  width: 132px;
  height: 44px;
  display: grid;
  place-items: center;
}

.stock-card-chart {
  width: 132px;
  height: 44px;
  overflow: visible;
}

.stock-card-line,
.stock-card-area {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stock-card-line {
  stroke-width: 2.4;
}

.stock-card-area {
  opacity: 0.14;
  stroke: none;
}

.stock-card-chart.pos .stock-card-line {
  stroke: #10b981;
}

.stock-card-chart.neg .stock-card-line {
  stroke: #ef4444;
}

.stock-card-chart.pos .stock-card-area {
  fill: #10b981;
}

.stock-card-chart.neg .stock-card-area {
  fill: #ef4444;
}

.stock-card-chart-empty {
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stock-card-price {
  min-width: 96px;
  display: grid;
  justify-items: end;
  gap: 4px;
}

.stock-card-price strong {
  color: #f8fafc;
  font-size: 1rem;
  line-height: 1;
}

.stock-card-price span {
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.stock-context-card.is-up .stock-card-price span {
  color: #34d399;
}

.stock-context-card.is-down .stock-card-price span {
  color: #f87171;
}

.attachment-chip {
  display: none;
  max-width: 860px;
  margin: 0 auto 8px;
  padding: 0 24px;
  color: var(--muted);
  font-size: 0.82rem;
}

.attachment-chip.is-active {
  display: block;
}

.composer-wrap {
  width: min(920px, calc(100% - 32px));
  position: relative;
  margin: 0 auto 18px;
}

.composer {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: end;
  margin: 0;
  padding: 10px;
  border: 1px solid rgba(96, 165, 250, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(23, 25, 27, 0.98), rgba(15, 17, 20, 0.98));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255,255,255,0.04);
}

.composer textarea {
  min-height: 42px;
  max-height: 180px;
  resize: none;
  padding: 10px 0;
  border: 0;
  background: transparent;
}

.composer-icon {
  margin-bottom: 1px;
}

.send-btn {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: #e8ece6;
  color: #111;
}

.ticker-suggest {
  display: none;
  position: absolute;
  left: 50%;
  width: min(520px, calc(100% - 108px));
  transform: translateX(-50%);
  bottom: calc(100% + 10px);
  z-index: 20;
  max-height: 218px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid rgba(96, 165, 250, 0.28);
  border-radius: 8px;
  background: rgba(8, 13, 22, 0.98);
  box-shadow: 0 24px 60px rgba(0,0,0,0.58), inset 0 1px 0 rgba(255,255,255,0.04);
  backdrop-filter: blur(18px);
}

.ticker-suggest.show {
  display: grid;
  gap: 3px;
}

.ticker-option {
  width: 100%;
  min-height: 40px;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.ticker-option:hover,
.ticker-option.is-active {
  background: linear-gradient(90deg, rgba(42, 127, 255, 0.18), rgba(56, 189, 248, 0.08));
}

.ticker-logo {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 7px;
  background: #fff;
  color: #111827;
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 0.62rem;
  font-weight: 950;
}

.ticker-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ticker-logo-fallback {
  display: none;
  width: 100%;
  height: 100%;
  place-items: center;
  background: #e8ece6;
}

.ticker-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.ticker-main strong {
  color: #f8fafc;
  font-size: 0.84rem;
}

.ticker-main span {
  color: #9ca3af;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
}

.ticker-exchange {
  color: #7dd3fc;
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
}

.thinking {
  color: var(--cyan);
}

@media (max-width: 860px) {
  .quan-view.is-active {
    display: block;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .side-panel {
    position: relative;
    width: 100%;
    height: auto;
    min-height: auto;
    padding-bottom: 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .settings-corner-btn {
    position: static;
    margin-top: 14px;
  }

  .chat-shell {
    min-height: calc(100vh - 430px);
  }

  .prompt-grid {
    grid-template-columns: 1fr;
    max-width: 320px;
  }

  .welcome-block {
    margin-top: 24px;
  }

  .chat-header {
    padding: 14px 16px;
  }

  .chat-area {
    padding: 16px 0;
  }

  .settings-area {
    padding: 18px 14px 0;
  }

  .settings-shell {
    min-height: calc(100vh - 360px);
    padding-bottom: 150px;
  }

  .settings-section {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .settings-model-grid {
    grid-template-columns: 1fr;
  }

  .quan-visual-grid {
    grid-template-columns: 1fr;
  }

  .settings-apply-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-apply-actions {
    width: 100%;
  }

  .settings-apply-actions button {
    flex: 1;
  }

  .stock-context-card {
    grid-template-columns: 1fr auto;
    gap: 10px;
  }

  .stock-card-chart-wrap {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: stretch;
  }

  .stock-card-chart {
    width: 100%;
  }

  .composer-wrap {
    width: min(100% - 24px, 920px);
  }

  .ticker-suggest {
    left: 0;
    right: 0;
    width: 100%;
    transform: none;
    max-height: 204px;
  }
}

/* Mockup-inspired premium redesign. Kept as an override layer so the
   existing Quan IDs and JavaScript hooks continue to behave unchanged. */
:root {
  color-scheme: dark;
  --bg: #07090c;
  --panel: #090b0f;
  --panel-2: #0e1117;
  --panel-3: #10151d;
  --line: rgba(154, 168, 186, 0.14);
  --line-strong: rgba(154, 168, 186, 0.24);
  --text: #f3f7fb;
  --muted: #8793a5;
  --soft: #bac6d6;
  --green: #35d69f;
  --cyan: #62b6ff;
  --gold: #f2bd48;
  --red: #ff6b6b;
  --purple: #b995ff;
  --blue: #2b8ef5;
  --blue-2: #66b7ff;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.48);
  --mono: "SFMono-Regular", "Cascadia Mono", "Consolas", ui-monospace, monospace;
}

html,
body {
  min-height: 100%;
  background: var(--bg);
}

body {
  background:
    radial-gradient(circle at 72% 10%, rgba(43, 142, 245, 0.15), transparent 31rem),
    radial-gradient(circle at 9% 92%, rgba(53, 214, 159, 0.07), transparent 24rem),
    linear-gradient(180deg, #07090c 0%, #090b0f 47%, #06080b 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body::before {
  z-index: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.024) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 34px 34px;
  opacity: 0.42;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.68), transparent 76%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.09) 1px, transparent 0);
  background-size: 24px 24px;
  opacity: 0.09;
}

button,
input,
textarea,
select,
a {
  letter-spacing: 0;
}

.app-shell,
.gate-view,
.quan-view {
  position: relative;
  z-index: 1;
}

.gate-view {
  background:
    radial-gradient(circle at 50% 0%, rgba(43, 142, 245, 0.16), transparent 30rem),
    rgba(7, 9, 12, 0.86);
}

.auth-card,
.restricted-card {
  border-color: var(--line-strong);
  background:
    linear-gradient(180deg, rgba(14, 17, 23, 0.96), rgba(8, 11, 16, 0.98));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.brand-mark {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(43, 142, 245, 0.42);
  border-radius: 10px;
  background:
    linear-gradient(145deg, rgba(43, 142, 245, 0.92), rgba(102, 183, 255, 0.68)),
    #0b1220;
  color: #f7fbff;
  box-shadow: 0 14px 30px rgba(43, 142, 245, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.brand-row span {
  color: #7c8798;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.brand-row strong {
  color: #eef5ff;
  font-size: 1rem;
  line-height: 1.1;
}

.oauth-btn,
.primary-btn,
.secondary-btn,
.new-chat-btn,
.prompt-card,
.primary-link {
  border-radius: 8px;
}

.primary-btn,
.primary-link {
  border: 1px solid rgba(43, 142, 245, 0.58);
  background: linear-gradient(180deg, #66b7ff, #2b8ef5);
  color: #03111f;
  box-shadow: 0 16px 34px rgba(43, 142, 245, 0.22);
}

.oauth-btn,
.secondary-btn {
  background: rgba(255, 255, 255, 0.025);
  border-color: var(--line);
  color: #dce7f6;
}

.text-input,
.select-input,
textarea {
  border-color: var(--line);
  background: rgba(5, 8, 12, 0.86);
  color: var(--text);
}

.text-input:focus,
.select-input:focus,
textarea:focus {
  border-color: rgba(43, 142, 245, 0.78);
  box-shadow: 0 0 0 3px rgba(43, 142, 245, 0.1);
}

.quan-view.is-active {
  display: flex;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 80% 8%, rgba(43, 142, 245, 0.12), transparent 28rem),
    linear-gradient(180deg, rgba(7, 9, 12, 0.98), rgba(8, 10, 14, 0.98));
}

.side-panel {
  width: 262px;
  flex: 0 0 262px;
  height: 100vh;
  min-height: 0;
  padding: 15px 14px 86px;
  border-right: 1px solid rgba(154, 168, 186, 0.12);
  background:
    linear-gradient(180deg, rgba(9, 11, 15, 0.98), rgba(6, 8, 11, 0.98)),
    linear-gradient(90deg, rgba(43, 142, 245, 0.1), transparent 18%);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.025);
  scrollbar-width: thin;
  scrollbar-color: rgba(84, 114, 149, 0.68) transparent;
}

.side-panel::before {
  content: "";
  position: absolute;
  top: 0;
  right: -1px;
  width: 1px;
  height: 156px;
  background: linear-gradient(180deg, rgba(43, 142, 245, 0.88), transparent);
}

.side-panel::-webkit-scrollbar,
.chat-area::-webkit-scrollbar,
.settings-area::-webkit-scrollbar {
  width: 8px;
}

.side-panel::-webkit-scrollbar-thumb,
.chat-area::-webkit-scrollbar-thumb,
.settings-area::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(84, 114, 149, 0.52);
}

.side-top {
  margin-bottom: 16px;
}

.brand-row.compact {
  gap: 10px;
}

.side-top .icon-btn,
.icon-btn {
  width: 36px;
  height: 36px;
  border-color: rgba(154, 168, 186, 0.14);
  background: rgba(255, 255, 255, 0.028);
  color: #aebbd0;
}

.icon-btn:hover {
  border-color: rgba(43, 142, 245, 0.46);
  color: #e7f3ff;
  background: rgba(43, 142, 245, 0.1);
}

.new-chat-btn {
  justify-content: flex-start;
  min-height: 42px;
  padding: 0 12px;
  background:
    linear-gradient(90deg, rgba(43, 142, 245, 0.22), rgba(43, 142, 245, 0.06)),
    rgba(14, 17, 23, 0.92);
  border: 1px solid rgba(43, 142, 245, 0.28);
  color: #eef7ff;
  font-size: 0.88rem;
  font-weight: 850;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.new-chat-btn:hover {
  border-color: rgba(43, 142, 245, 0.68);
  background:
    linear-gradient(90deg, rgba(43, 142, 245, 0.32), rgba(43, 142, 245, 0.09)),
    rgba(17, 22, 30, 0.96);
}

.saved-chats-panel {
  margin-top: 14px;
  padding: 12px 0 14px;
  border-bottom: 1px solid rgba(154, 168, 186, 0.1);
}

.saved-chats-head {
  display: flex;
  min-height: 18px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chat-save-status {
  color: #8fcfff;
  font-family: var(--mono);
  font-size: 0.58rem;
  line-height: 1.2;
  text-align: right;
}

.chat-save-status.error {
  color: #ffaaa8;
}

.chat-save-status.success {
  color: #95f0ca;
}

.saved-chat-list {
  display: grid;
  max-height: 292px;
  margin-top: 8px;
  gap: 4px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(84, 114, 149, 0.46) transparent;
}

.saved-chat-list::-webkit-scrollbar {
  width: 6px;
}

.saved-chat-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(84, 114, 149, 0.46);
}

.saved-chat-item {
  position: relative;
  width: 100%;
  min-height: 38px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(154, 168, 186, 0.1);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(14, 18, 25, 0.78), rgba(7, 10, 14, 0.88));
  color: #dce8f7;
  padding: 0;
}

.saved-chat-item:has(.saved-chat-menu) {
  grid-template-columns: minmax(0, 1fr) auto;
  padding-bottom: 5px;
}

.saved-chat-item:disabled,
.saved-chat-empty {
  display: grid;
  gap: 3px;
  min-height: 38px;
  padding: 9px;
  border: 1px dashed rgba(154, 168, 186, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.018);
  color: #7d899a;
  text-align: left;
}

.saved-chat-empty strong {
  color: #b8c6d8;
  font-size: 0.76rem;
}

.saved-chat-empty span,
.saved-chat-item em {
  color: #748197;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-style: normal;
  line-height: 1.25;
}

.saved-chat-skeleton {
  height: 38px;
  overflow: hidden;
  border: 1px solid rgba(154, 168, 186, 0.1);
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.075), transparent),
    rgba(255, 255, 255, 0.026);
  background-size: 180% 100%, auto;
  animation: saved-chat-sheen 1.25s ease-in-out infinite;
}

.saved-chat-skeleton.short {
  width: 82%;
}

@keyframes saved-chat-sheen {
  from { background-position: 140% 0, 0 0; }
  to { background-position: -80% 0, 0 0; }
}

.saved-chat-item.is-active {
  border-color: rgba(43, 142, 245, 0.48);
  background:
    linear-gradient(90deg, rgba(43, 142, 245, 0.16), transparent 62%),
    linear-gradient(180deg, rgba(16, 22, 31, 0.94), rgba(8, 11, 16, 0.98));
  box-shadow: inset 2px 0 0 rgba(43, 142, 245, 0.82);
}

.saved-chat-open {
  min-width: 0;
  display: grid;
  gap: 0;
  padding: 9px 7px 9px 10px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.saved-chat-title {
  overflow: hidden;
  color: #edf6ff;
  font-size: 0.74rem;
  font-weight: 850;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-chat-edit {
  width: 27px;
  height: 27px;
  display: inline-grid;
  place-items: center;
  margin-right: 5px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #79869a;
}

.saved-chat-edit svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.saved-chat-item:hover .saved-chat-edit,
.saved-chat-edit:hover,
.saved-chat-edit[aria-expanded="true"] {
  border-color: rgba(43, 142, 245, 0.3);
  color: #bddfff;
  background: rgba(43, 142, 245, 0.1);
}

.saved-chat-menu {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: 0 6px 0 10px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
}

.saved-chat-menu button {
  min-height: 28px;
  border: 1px solid rgba(154, 168, 186, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.026);
  color: #dbe8f8;
  font-size: 0.68rem;
  font-weight: 800;
  text-align: center;
  padding: 0 8px;
}

.saved-chat-menu button:hover {
  background: rgba(43, 142, 245, 0.12);
  color: #ffffff;
}

.saved-chat-menu button.danger {
  color: #ffaaa8;
}

.saved-chat-menu button.danger:hover {
  background: rgba(255, 107, 107, 0.12);
}

.saved-chat-item.is-editing {
  grid-template-columns: 1fr;
  padding: 8px;
}

.saved-chat-title-input {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(43, 142, 245, 0.5);
  border-radius: 7px;
  background: rgba(5, 8, 12, 0.92);
  color: #f3f8ff;
  font-size: 0.76rem;
  font-weight: 850;
  outline: none;
  padding: 7px 8px;
}

.chat-loading-state {
  width: min(420px, calc(100% - 36px));
  margin: 44px auto;
  border: 1px solid rgba(154, 168, 186, 0.12);
  border-radius: 8px;
  background: rgba(8, 11, 16, 0.72);
  color: #8ea0b8;
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 14px;
  text-align: center;
}

.panel-block {
  margin-top: 14px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(154, 168, 186, 0.1);
}

.control-label,
.field-label {
  color: #758296;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.version-dropdown-container {
  margin-top: 8px;
  z-index: 40;
}

.version-btn {
  min-height: 43px;
  padding: 7px 10px 7px 8px;
  border-color: rgba(154, 168, 186, 0.16);
  background:
    linear-gradient(180deg, rgba(18, 23, 31, 0.94), rgba(10, 13, 18, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.version-btn:hover,
.version-btn[aria-expanded="true"] {
  border-color: rgba(43, 142, 245, 0.62);
  background:
    linear-gradient(180deg, rgba(20, 28, 39, 0.98), rgba(10, 13, 18, 0.98));
  box-shadow: 0 0 0 3px rgba(43, 142, 245, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.version-chip-icon {
  border-radius: 8px;
  background: rgba(43, 142, 245, 0.12);
}

.version-chip-fallback {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(43, 142, 245, 0.34);
  border-radius: 7px;
  background:
    linear-gradient(145deg, rgba(43, 142, 245, 0.22), rgba(53, 214, 159, 0.08)),
    rgba(8, 11, 16, 0.98);
  color: #dff1ff;
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 950;
}

.version-chip-fallback[hidden] {
  display: none;
}

.version-dropdown-menu {
  left: 0;
  right: 0;
  width: 100%;
  max-height: min(360px, calc(100vh - 178px));
  padding: 5px;
  border-color: rgba(154, 168, 186, 0.16);
  border-radius: 10px;
  background: rgba(8, 11, 16, 0.98);
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(255, 255, 255, 0.035);
}

.version-option {
  min-height: 52px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  padding: 9px;
  border-bottom: 0;
  border-radius: 8px;
}

.version-option[hidden],
[data-model][hidden] {
  display: none !important;
}

.version-option:hover {
  background:
    linear-gradient(90deg, rgba(43, 142, 245, 0.16), rgba(53, 214, 159, 0.045)),
    rgba(255, 255, 255, 0.018);
}

.version-option strong {
  display: block;
  color: #f2f7ff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.84rem;
  line-height: 1.18;
}

.version-option em {
  display: block;
  color: #8390a4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.68rem;
  line-height: 1.25;
}

.version-option span {
  min-width: 0;
  gap: 3px;
}

.version-option-mark {
  width: 32px;
  height: 32px;
}

.exclusive-mark,
.settings-model-initials {
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(43, 142, 245, 0.38);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(43, 142, 245, 0.24), rgba(53, 214, 159, 0.1)),
    rgba(8, 11, 16, 0.98);
  color: #dff1ff;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 950;
}

.model-badge {
  max-width: max-content;
  padding: 1px 5px;
  border-radius: 999px;
  font-size: 0.58rem;
}

.model-badge.muted {
  background: rgba(154, 168, 186, 0.13);
  color: #c3cedb;
}

.model-badge.pro {
  background: rgba(53, 214, 159, 0.16);
  color: #89f3c8;
}

.model-badge.g {
  background: rgba(242, 189, 72, 0.16);
  color: #ffe08a;
}

.model-badge.c {
  background: rgba(251, 191, 36, 0.12);
  color: #ffd98a;
}

.model-badge.exclusive {
  background: rgba(43, 142, 245, 0.16);
  color: #9ed4ff;
}

.micro-note {
  color: #6f7b8d;
  font-family: var(--mono);
  font-size: 0.68rem;
}

.sync-block {
  gap: 8px;
}

.settings-section[hidden] {
  display: none !important;
}

.settings-side-topic-panel {
  display: none;
  margin-top: 14px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(154, 168, 186, 0.1);
}

.quan-view.settings-mode .side-panel .panel-block {
  display: none;
}

.quan-view.settings-mode .saved-chats-panel {
  display: none;
}

.quan-view.settings-mode .settings-side-topic-panel {
  display: grid;
  gap: 8px;
}

.sync-toggle,
.sync-card,
.sync-holdings-panel {
  border-color: rgba(154, 168, 186, 0.13);
  background:
    linear-gradient(180deg, rgba(16, 21, 29, 0.92), rgba(8, 11, 16, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.settings-sync-panel {
  display: grid;
  gap: 10px;
}

.portfolio-access-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid rgba(154, 168, 186, 0.13);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(16, 21, 29, 0.92), rgba(8, 11, 16, 0.96));
}

.portfolio-access-toggle span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.portfolio-access-toggle strong {
  color: #e8f1fb;
  font-size: 0.84rem;
}

.portfolio-access-toggle em,
.portfolio-holding-form label span {
  color: #768397;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.portfolio-access-toggle input {
  width: 42px;
  height: 24px;
  flex: 0 0 42px;
  appearance: none;
  border: 1px solid rgba(154, 168, 186, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  position: relative;
  transition: 0.16s ease;
}

.portfolio-access-toggle input::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #8390a4;
  transition: 0.16s ease;
}

.portfolio-access-toggle input:checked {
  border-color: rgba(43, 142, 245, 0.6);
  background: rgba(43, 142, 245, 0.28);
}

.portfolio-access-toggle input:checked::before {
  transform: translateX(18px);
  background: #8fd0ff;
}

.portfolio-holding-form {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(154, 168, 186, 0.13);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(16, 21, 29, 0.88), rgba(8, 11, 16, 0.94));
}

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

.portfolio-holding-form label {
  display: grid;
  gap: 5px;
}

.portfolio-holding-form .text-input {
  min-height: 38px;
  padding: 8px 9px;
}

.portfolio-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.portfolio-form-actions button {
  width: auto;
  min-height: 36px;
}

.settings-sync-panel .sync-toggle {
  width: 100%;
}

.settings-sync-panel .sync-holdings-panel {
  max-height: min(46vh, 420px);
  overflow-y: auto;
}

.sync-toggle {
  padding: 11px;
}

.sync-toggle:hover {
  border-color: rgba(43, 142, 245, 0.44);
  background:
    linear-gradient(90deg, rgba(43, 142, 245, 0.12), transparent 56%),
    linear-gradient(180deg, rgba(17, 23, 31, 0.96), rgba(8, 11, 16, 0.98));
}

.sync-toggle em,
.sync-card span {
  color: #768397;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0;
}

.sync-toggle strong,
.sync-card strong {
  color: #e8f1fb;
  font-size: 0.82rem;
}

.sync-holdings-panel {
  background: rgba(5, 8, 12, 0.72);
}

.sync-holding-row {
  border-color: rgba(154, 168, 186, 0.12);
  background: rgba(255, 255, 255, 0.026);
}

.settings-sync-panel .sync-holding-row {
  grid-template-columns: minmax(54px, auto) minmax(0, 1fr) auto;
}

.sync-holding-actions {
  grid-row: 1 / span 2;
  grid-column: 3;
  display: flex;
  gap: 5px;
  justify-content: flex-end;
}

.sync-holding-actions button {
  min-height: 27px;
  border: 1px solid rgba(154, 168, 186, 0.13);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.026);
  color: #b8c7dc;
  font-size: 0.66rem;
  font-weight: 850;
  padding: 0 8px;
}

.sync-holding-actions button:hover {
  border-color: rgba(43, 142, 245, 0.42);
  color: #e3f2ff;
  background: rgba(43, 142, 245, 0.1);
}

.sync-holding-actions button.danger {
  color: #ffaaa8;
}

.sync-holding-actions button.danger:hover {
  border-color: rgba(255, 107, 107, 0.36);
  background: rgba(255, 107, 107, 0.1);
}

.settings-corner-btn {
  left: 14px;
  bottom: 15px;
  width: 36px;
  height: 36px;
  border-color: rgba(154, 168, 186, 0.15);
  background:
    linear-gradient(180deg, rgba(18, 23, 31, 0.96), rgba(8, 11, 16, 0.98));
  color: #92a0b5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.settings-corner-btn:hover,
.settings-corner-btn.is-active {
  border-color: rgba(43, 142, 245, 0.58);
  background:
    linear-gradient(180deg, rgba(20, 30, 42, 0.98), rgba(8, 11, 16, 0.98));
  color: #e4f2ff;
  box-shadow: 0 0 0 3px rgba(43, 142, 245, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.chat-shell {
  position: relative;
  height: 100vh;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  background:
    radial-gradient(circle at 50% 0%, rgba(43, 142, 245, 0.08), transparent 34rem),
    linear-gradient(180deg, rgba(8, 10, 14, 0.98), rgba(7, 9, 12, 0.98));
  overflow: hidden;
}

.chat-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px);
  background-size: 38px 38px;
  opacity: 0.52;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.62), transparent 70%);
}

.chat-header,
.chat-area,
.settings-area,
.attachment-chip,
.composer-wrap {
  position: relative;
  z-index: 1;
}

.chat-header {
  min-height: 66px;
  padding: 14px 22px 13px;
  border-bottom: 1px solid rgba(154, 168, 186, 0.12);
  background: rgba(7, 9, 12, 0.76);
  backdrop-filter: blur(18px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
}

.chat-header h1,
.quan-model-title {
  color: var(--blue);
  font-size: clamp(1.12rem, 1.4vw, 1.42rem);
  font-weight: 950;
}

.title-version,
.title-dot {
  color: #ffffff;
}

.title-pro {
  color: #c89bff;
}

.title-research {
  color: #f0af36;
}

.title-beginner {
  color: #8fcfff;
}

.title-g {
  color: #ffe08a;
}

.title-c {
  color: #ffd27d;
}

.stockup-wordmark {
  color: #f8fbff;
  font-size: 1.38rem;
  font-weight: 900;
}

.stockup-wordmark span {
  color: var(--blue);
}

.chat-area {
  overflow-y: auto;
  min-height: 0;
  overscroll-behavior: contain;
  padding: 22px 0 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(84, 114, 149, 0.68) transparent;
}

.welcome-block {
  width: min(760px, calc(100% - 40px));
  max-width: 760px;
  margin: clamp(56px, 12vh, 132px) auto 0;
  text-align: center;
}

.welcome-block > span {
  display: none;
}

.welcome-block::before {
  content: none;
  display: none;
}

.welcome-block h2 {
  max-width: 760px;
  margin: 0 auto 22px;
  color: #eff6ff;
  font-size: clamp(1.72rem, 3.2vw, 3.15rem);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: 0;
  text-wrap: balance;
}

.welcome-block .welcome-gradient {
  display: inline;
  background: linear-gradient(90deg, #2b8ef5 0%, #69c4ff 52%, #dff4ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  text-transform: none;
  text-shadow: 0 18px 56px rgba(43, 142, 245, 0.22);
}

.prompt-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 560px;
}

.prompt-card {
  min-height: 56px;
  padding: 11px 12px;
  border: 1px solid rgba(154, 168, 186, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(16, 21, 29, 0.94), rgba(8, 11, 16, 0.98));
  color: #d9e8fb;
  font-size: 0.82rem;
  font-weight: 850;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.prompt-card svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.05;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: #75bfff;
}

.prompt-card:hover {
  border-color: rgba(43, 142, 245, 0.54);
  background:
    linear-gradient(180deg, rgba(20, 30, 42, 0.98), rgba(8, 11, 16, 0.98));
  color: #ffffff;
  transform: translateY(-1px);
}

.message {
  margin: 0;
}

.bubble {
  padding: 18px clamp(24px, 3.7vw, 58px);
  border-top: 1px solid rgba(154, 168, 186, 0.08);
  border-bottom: 1px solid rgba(154, 168, 186, 0.08);
  border-left: 2px solid rgba(43, 142, 245, 0.2);
  background: rgba(12, 16, 22, 0.58);
  color: #d9e3f1;
  line-height: 1.68;
  overflow-wrap: anywhere;
}

.message.user .bubble {
  border-left-color: rgba(43, 142, 245, 0.78);
  border-bottom-color: rgba(154, 168, 186, 0.06);
  background:
    linear-gradient(90deg, rgba(43, 142, 245, 0.08), transparent 40%),
    rgba(7, 9, 12, 0.34);
  color: #9eb9dc;
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.55;
}

.message.system .bubble {
  border-color: rgba(255, 107, 107, 0.28);
  border-left-color: rgba(255, 107, 107, 0.74);
  background: rgba(255, 107, 107, 0.07);
}

.bubble strong {
  color: #f5be59;
}

.bubble.thinking {
  padding: 8px clamp(24px, 3.7vw, 58px);
  background:
    linear-gradient(90deg, rgba(43, 142, 245, 0.08), transparent 42%),
    rgba(8, 11, 16, 0.54);
  border-left-color: rgba(98, 182, 255, 0.78);
}

.thinking-panel {
  width: min(560px, 100%);
  gap: 2px;
}

.thinking-head {
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  padding: 2px 0;
}

.thinking-orb {
  width: 17px;
  height: 17px;
}

.thinking-orb span {
  width: 13px;
  height: 13px;
  border-color: rgba(98, 182, 255, 0.22);
  border-top-color: var(--blue-2);
}

.thinking-copy span {
  color: #70bbff;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0;
}

.thinking-copy strong {
  color: #eaf5ff;
  font-size: 0.78rem;
}

.thinking-toggle {
  color: #8fcfff;
  font-size: 0.66rem;
}

.thinking-step {
  color: #7c8798;
  font-size: 0.78rem;
}

.response-actions {
  margin-top: 12px;
  padding-top: 10px;
  border-top-color: rgba(154, 168, 186, 0.1);
}

.response-action-btn {
  width: 30px;
  height: 30px;
  border-color: rgba(154, 168, 186, 0.13);
  background: rgba(255, 255, 255, 0.026);
  color: #8793a5;
}

.response-action-btn:hover,
.response-action-btn.is-active {
  border-color: rgba(43, 142, 245, 0.48);
  background: rgba(43, 142, 245, 0.11);
  color: #d7ecff;
}

.quan-source-pill {
  border-color: rgba(43, 142, 245, 0.26);
  background:
    linear-gradient(180deg, rgba(43, 142, 245, 0.13), rgba(43, 142, 245, 0.055));
  color: #d6ebff;
}

.quan-source-dot {
  background: var(--blue-2);
}

.quan-visual-card,
.stock-context-card {
  border-color: rgba(154, 168, 186, 0.13);
  background:
    linear-gradient(180deg, rgba(14, 18, 25, 0.96), rgba(8, 11, 16, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.quan-visual-header {
  border-bottom-color: rgba(154, 168, 186, 0.1);
}

.quan-visual-header span,
.quan-mini-card span,
.quan-level-mini span,
.quan-move-visual span,
.quan-portfolio-row span,
.quan-band-visual span,
.quan-split-head span {
  color: #75bfff;
  font-family: var(--mono);
  letter-spacing: 0;
}

.quan-mini-card,
.quan-level-mini,
.quan-portfolio-row,
.quan-visual-event {
  border-color: rgba(154, 168, 186, 0.12);
  background: rgba(255, 255, 255, 0.026);
}

.quan-visual-card.portfolio_exposure,
.quan-visual-card.portfolio_concentration,
.quan-visual-card.portfolio_action_plan {
  border-color: rgba(43, 142, 245, 0.28);
  background:
    radial-gradient(circle at 92% 0%, rgba(53, 214, 159, 0.12), transparent 16rem),
    linear-gradient(135deg, rgba(43, 142, 245, 0.11), transparent 38%),
    linear-gradient(180deg, rgba(13, 18, 27, 0.96), rgba(7, 10, 16, 0.94));
}

.quan-visual-card.portfolio_exposure .quan-visual-header,
.quan-visual-card.portfolio_concentration .quan-visual-header,
.quan-visual-card.portfolio_action_plan .quan-visual-header,
.quan-visual-card.portfolio_update .quan-visual-header {
  background: linear-gradient(90deg, rgba(43, 142, 245, 0.12), transparent);
}

.quan-portfolio-row {
  display: grid;
  border-color: rgba(96, 165, 250, 0.14);
  background:
    linear-gradient(180deg, rgba(17, 24, 39, 0.68), rgba(8, 12, 18, 0.72));
}

.quan-portfolio-row-main span {
  color: #dbeafe;
  font-family: inherit;
  letter-spacing: 0;
  text-transform: none;
}

.message.stock-visual {
  margin: 0;
}

.stock-context-card {
  width: min(610px, calc(100% - 48px));
  margin-left: clamp(24px, 3.7vw, 58px);
}

.stock-card-logo {
  border-radius: 10px;
}

.attachment-chip {
  max-width: 980px;
  margin-bottom: 8px;
  color: #8895a8;
}

.composer-wrap {
  width: min(980px, calc(100% - 44px));
  margin-bottom: 18px;
}

.composer {
  padding: 9px;
  border-color: rgba(154, 168, 186, 0.16);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(15, 19, 26, 0.98), rgba(8, 11, 16, 0.99));
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.composer textarea {
  color: #eff6ff;
}

.composer textarea::placeholder {
  color: #68758a;
}

.composer-icon {
  border-color: rgba(154, 168, 186, 0.12);
  background: rgba(255, 255, 255, 0.024);
}

.send-btn {
  border: 1px solid rgba(43, 142, 245, 0.52);
  background: linear-gradient(180deg, #66b7ff, #2b8ef5);
  color: #06111d;
  box-shadow: 0 14px 28px rgba(43, 142, 245, 0.2);
}

.send-btn:hover {
  background: linear-gradient(180deg, #8ac8ff, #3d99fa);
}

.ticker-suggest {
  width: min(480px, calc(100% - 108px));
  max-height: 204px;
  border-color: rgba(154, 168, 186, 0.16);
  background: rgba(8, 11, 16, 0.98);
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.64), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.ticker-option {
  min-height: 38px;
}

.ticker-option:hover,
.ticker-option.is-active {
  background:
    linear-gradient(90deg, rgba(43, 142, 245, 0.16), rgba(53, 214, 159, 0.045)),
    rgba(255, 255, 255, 0.018);
}

.ticker-exchange {
  color: #75bfff;
  font-family: var(--mono);
  letter-spacing: 0;
}

.settings-area {
  grid-row: 2 / -1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 26px 26px 0;
  background:
    radial-gradient(circle at 70% 0%, rgba(43, 142, 245, 0.08), transparent 28rem),
    rgba(7, 9, 12, 0.5);
}

.settings-shell {
  width: min(1040px, 100%);
  min-height: 0;
  padding-bottom: 112px;
}

.settings-head {
  border-bottom-color: rgba(154, 168, 186, 0.11);
}

.settings-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-back-btn,
.settings-bottom-back-btn,
.settings-signout-btn {
  gap: 8px;
}

.settings-back-btn svg,
.settings-bottom-back-btn svg,
.settings-signout-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.danger-btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid rgba(255, 107, 107, 0.32);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(127, 29, 29, 0.28), rgba(69, 10, 10, 0.26));
  color: #ffb4b4;
  font-weight: 850;
}

.danger-btn:hover {
  border-color: rgba(255, 107, 107, 0.58);
  background:
    linear-gradient(180deg, rgba(153, 27, 27, 0.38), rgba(69, 10, 10, 0.32));
  color: #ffe4e4;
}

.settings-head span {
  color: #75bfff;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0;
}

.settings-head h2 {
  color: #f2f7ff;
}

.settings-section {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  border-bottom-color: rgba(154, 168, 186, 0.1);
}

.settings-topic {
  width: 100%;
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(154, 168, 186, 0.13);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(14, 18, 25, 0.9), rgba(8, 11, 16, 0.96));
  color: #dce8f6;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.settings-topic.is-active {
  border-color: rgba(43, 142, 245, 0.5);
  background:
    linear-gradient(90deg, rgba(43, 142, 245, 0.16), transparent 68%),
    linear-gradient(180deg, rgba(17, 23, 31, 0.98), rgba(8, 11, 16, 0.98));
}

.settings-topic span {
  color: #75bfff;
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: uppercase;
}

.settings-topic strong {
  color: #f3f8ff;
  font-size: 0.9rem;
}

.settings-content-panel {
  display: grid;
  gap: 16px;
  min-height: 0;
}

.settings-bottom-back-btn {
  width: max-content;
  margin-top: 18px;
  background: rgba(255, 255, 255, 0.026);
}

.settings-model-initials {
  width: 32px;
  height: 32px;
}

.settings-subsection-copy {
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid rgba(154, 168, 186, 0.1);
}

.settings-visibility-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.settings-visibility-option {
  min-width: 0;
  min-height: 58px;
  display: grid;
  grid-template-columns: auto 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(154, 168, 186, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(14, 18, 25, 0.86), rgba(8, 11, 16, 0.94));
  color: #dce8f6;
}

.settings-visibility-option.is-selected {
  border-color: rgba(43, 142, 245, 0.42);
  background:
    linear-gradient(90deg, rgba(43, 142, 245, 0.11), transparent 58%),
    linear-gradient(180deg, rgba(14, 18, 25, 0.94), rgba(8, 11, 16, 0.98));
}

.settings-visibility-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.settings-visibility-option input:disabled {
  cursor: not-allowed;
}

.settings-visibility-option span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.settings-visibility-option strong {
  color: #f4f8ff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.84rem;
}

.settings-visibility-option em {
  color: #8490a2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.7rem;
  font-style: normal;
}

.settings-empty-state {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px dashed rgba(154, 168, 186, 0.18);
  border-radius: 8px;
  color: #8490a2;
  background: rgba(255, 255, 255, 0.018);
}

.settings-empty-state strong {
  color: #dce8f6;
  font-size: 0.88rem;
}

.settings-empty-state span {
  font-size: 0.78rem;
}

.show-more-models-btn {
  width: max-content;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 1px solid rgba(154, 168, 186, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(14, 18, 25, 0.94), rgba(8, 11, 16, 0.98));
  color: #d9e8fb;
  font-size: 0.78rem;
  font-weight: 850;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.show-more-models-btn:hover {
  border-color: rgba(43, 142, 245, 0.5);
  color: #ffffff;
}

.import-model-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(260px, 1.05fr);
  gap: 14px;
  margin-top: 4px;
  padding: 16px;
  border: 1px solid rgba(154, 168, 186, 0.12);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(14, 18, 25, 0.9), rgba(8, 11, 16, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.import-model-code-pane,
.import-model-preview-pane {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 12px;
}

.import-model-preview-pane {
  min-height: 150px;
  padding: 12px;
  border: 1px dashed rgba(154, 168, 186, 0.14);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.018);
}

.import-model-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.import-model-row .text-input {
  height: 40px;
  margin-top: 0;
}

.settings-import-status {
  min-height: 18px;
  color: #8490a2;
  font-size: 0.78rem;
  font-weight: 800;
}

.settings-import-status.error {
  color: #ff9a9a;
}

.settings-import-status.success {
  color: #93e8c3;
}

.import-model-preview {
  display: block;
}

.import-model-preview[hidden] {
  display: none;
}

.import-model-empty {
  min-height: 124px;
  display: grid;
  place-content: center;
  gap: 5px;
  color: #8490a2;
  text-align: center;
}

.import-model-empty[hidden] {
  display: none;
}

.import-model-empty strong {
  color: #dce8f6;
  font-size: 0.88rem;
}

.import-model-empty span {
  max-width: 260px;
  color: #7b8799;
  font-size: 0.78rem;
  line-height: 1.35;
}

.import-model-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 11px;
  border: 1px solid rgba(43, 142, 245, 0.24);
  border-radius: 9px;
  background:
    linear-gradient(90deg, rgba(43, 142, 245, 0.1), transparent 58%),
    rgba(255, 255, 255, 0.024);
}

.import-model-card .import-add-btn {
  grid-column: 1 / -1;
  justify-self: start;
}

.import-model-card .settings-model-initials {
  width: 38px;
  height: 38px;
}

.import-model-card div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.import-model-card strong {
  color: #f4f8ff;
  font-size: 0.92rem;
}

.import-model-card em {
  color: #8490a2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.76rem;
  font-style: normal;
}

.import-add-btn {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  font-size: 0.76rem;
}

.import-add-btn:disabled {
  cursor: default;
  opacity: 0.62;
}

.settings-copy p,
.settings-model-option em,
.settings-save-status,
.settings-apply-bar span {
  color: #8490a2;
}

.settings-model-option {
  border-color: rgba(154, 168, 186, 0.13);
  background:
    linear-gradient(180deg, rgba(14, 18, 25, 0.96), rgba(8, 11, 16, 0.98));
}

.settings-model-option:hover,
.settings-model-option.is-selected {
  border-color: rgba(43, 142, 245, 0.52);
  background:
    linear-gradient(90deg, rgba(43, 142, 245, 0.12), transparent 48%),
    linear-gradient(180deg, rgba(17, 23, 31, 0.98), rgba(8, 11, 16, 0.98));
}

.settings-model-option.is-selected {
  box-shadow: 0 0 0 3px rgba(43, 142, 245, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.settings-saved-badge {
  border-radius: 999px;
  background: rgba(53, 214, 159, 0.14);
  color: #95f0ca;
}

.settings-apply-bar {
  bottom: 0;
  border-color: rgba(154, 168, 186, 0.16);
  background: rgba(8, 11, 16, 0.96);
  box-shadow: 0 -24px 62px rgba(0, 0, 0, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.settings-apply-bar[hidden] {
  display: none !important;
}

@media (max-width: 860px) {
  .quan-view.is-active {
    display: block;
  }

  .side-panel {
    position: relative;
    width: 100%;
    min-height: auto;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid rgba(154, 168, 186, 0.12);
  }

  .side-panel::before {
    width: 120px;
    height: 1px;
    right: auto;
    left: 14px;
    background: linear-gradient(90deg, rgba(43, 142, 245, 0.88), transparent);
  }

  .settings-corner-btn {
    position: static;
    margin-top: 12px;
  }

  .chat-shell {
    height: auto;
    min-height: calc(100vh - 386px);
  }

  .chat-header {
    min-height: 60px;
    padding: 13px 16px;
  }

  .stockup-wordmark {
    font-size: 1.12rem;
  }

  .welcome-block {
    width: min(100% - 28px, 620px);
    margin-top: 34px;
  }

  .prompt-grid {
    grid-template-columns: 1fr;
    max-width: 340px;
  }

  .prompt-card {
    min-height: 48px;
  }

  .bubble {
    padding: 16px 18px;
  }

  .bubble.thinking {
    padding: 8px 18px;
  }

  .stock-context-card {
    width: calc(100% - 28px);
    margin-left: 14px;
  }

  .settings-area {
    padding: 18px 14px 0;
  }

  .settings-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .settings-head-actions {
    width: 100%;
    justify-content: stretch;
  }

  .settings-head-actions button {
    flex: 1;
  }

  .settings-section {
    grid-template-columns: 1fr;
  }

  .settings-visibility-grid {
    grid-template-columns: 1fr;
  }

  .import-model-panel,
  .import-model-card {
    grid-template-columns: 1fr;
  }

  .portfolio-form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .settings-sync-panel .sync-holding-row {
    grid-template-columns: minmax(54px, auto) minmax(0, 1fr);
  }

  .sync-holding-actions {
    grid-column: 1 / -1;
    grid-row: auto;
    justify-content: stretch;
  }

  .sync-holding-actions button {
    flex: 1;
  }

  .import-model-card .settings-model-initials {
    width: 34px;
    height: 34px;
  }

  .composer-wrap {
    width: calc(100% - 24px);
    margin-bottom: 12px;
  }

  .ticker-suggest {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .side-top {
    gap: 10px;
  }

  .chat-header {
    gap: 12px;
  }

  .quan-model-title {
    font-size: 1.02rem;
  }

  .welcome-block h2 {
    font-size: 1.08rem;
  }

  .composer {
    grid-template-columns: auto 1fr auto;
    gap: 7px;
    padding: 8px;
  }

  .composer textarea {
    min-height: 40px;
    padding: 9px 0;
  }
}
