:root {
  color-scheme: dark;
  --bg: #0b0e11;
  --surface: #11161b;
  --surface-strong: #171d23;
  --surface-raised: #1c232a;
  --line: #29323a;
  --line-soft: #20272e;
  --text: #f3f5f7;
  --text-soft: #a6b0ba;
  --text-dim: #6f7a84;
  --bull: #f04452;
  --bull-soft: #35191e;
  --bull-line: #6c2831;
  --bear: #19b877;
  --bear-soft: #102d25;
  --bear-line: #1f6249;
  --gold: #efb84a;
  --cyan: #45c5d5;
  --focus: #84d7df;
  --danger: #ff6b73;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  --content-width: 1180px;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  max-width: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  max-width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui,
    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  height: 64px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(11, 14, 17, 0.94);
  backdrop-filter: blur(16px);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100% - 40px, var(--content-width));
  height: 100%;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.brand__mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid #47535d;
  border-radius: 6px;
  color: var(--gold);
  background: #14191e;
}

.brand__mark svg {
  width: 20px;
  height: 20px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  line-height: 1.25;
}

.brand small {
  margin-top: 2px;
  color: var(--text-dim);
  font-size: 9px;
  line-height: 1;
}

.market-clock {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.market-clock__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bear);
  box-shadow: 0 0 0 4px rgba(25, 184, 119, 0.11);
}

.command-band {
  border-bottom: 1px solid var(--line-soft);
  background: #0e1216;
}

.command-band__inner {
  width: min(100% - 40px, var(--content-width));
  margin: 0 auto;
  padding: 34px 0 30px;
}

.command-title {
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--gold);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.command-title h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.28;
}

.stock-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 154px;
  gap: 10px;
  max-width: 850px;
}

.stock-search:not(.has-selection) {
  grid-template-columns: minmax(0, 1fr);
}

.stock-search__field {
  position: relative;
  display: flex;
  align-items: center;
  height: 52px;
  border: 1px solid #3a444e;
  border-radius: 6px;
  background: var(--surface);
  transition:
    border-color 150ms ease,
    background-color 150ms ease;
}

.stock-search__field:focus-within {
  border-color: var(--cyan);
  background: #141a1f;
}

.stock-search__field > svg {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-left: 16px;
  color: var(--text-dim);
}

.stock-search input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 48px 0 12px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 16px;
}

.stock-search input::placeholder {
  color: #65717b;
}

.stock-search input::-webkit-search-cancel-button {
  display: none;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

.icon-button:hover {
  background: var(--surface-raised);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.stock-search__clear {
  position: absolute;
  right: 8px;
  color: var(--text-dim);
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

.primary-button {
  height: 52px;
  border: 1px solid #f05561;
  background: var(--bull);
  color: #fff;
  box-shadow: 0 10px 28px rgba(240, 68, 82, 0.17);
}

.primary-button:hover:not(:disabled) {
  background: #ff5663;
  transform: translateY(-1px);
}

.secondary-button {
  border: 1px solid #3b4650;
  background: #151b20;
  color: var(--text-soft);
}

.secondary-button:hover:not(:disabled) {
  border-color: #606c76;
  color: var(--text);
  background: #1a2127;
}

.primary-button svg,
.secondary-button svg {
  width: 17px;
  height: 17px;
}

.search-note {
  min-height: 20px;
  margin: 7px 0 0;
  color: var(--text-dim);
  font-size: 12px;
}

.suggestions {
  position: absolute;
  z-index: 40;
  top: calc(100% + 7px);
  right: 0;
  left: 0;
  overflow: hidden;
  border: 1px solid #3b4650;
  border-radius: 6px;
  background: #14191e;
  box-shadow: var(--shadow);
}

.selection-bar {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 8px 10px 8px 12px;
  border: 1px solid #3a6555;
  border-radius: 6px;
  background: #101d19;
}

.selection-bar__check {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 4px;
  color: #50d8a0;
  background: #15352a;
}

.selection-bar__check svg {
  width: 18px;
  height: 18px;
}

.selection-bar__content {
  min-width: 0;
}

.selection-bar__content small,
.selection-bar__content strong {
  display: block;
}

.selection-bar__content small {
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1.2;
}

.selection-bar__content strong {
  overflow: hidden;
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-bar__code,
.selection-bar__market {
  color: var(--text-soft);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.selection-bar__market {
  color: var(--gold);
}

.suggestion-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  width: 100%;
  padding: 11px 14px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.suggestion-item:last-child {
  border-bottom: 0;
}

.suggestion-item:hover,
.suggestion-item[aria-selected="true"] {
  background: var(--surface-raised);
}

.suggestion-item strong,
.suggestion-item small {
  display: block;
}

.suggestion-item strong {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion-item small,
.suggestion-item__market {
  color: var(--text-dim);
  font-size: 12px;
}

.suggestion-empty {
  padding: 13px 14px;
  color: var(--text-dim);
  font-size: 13px;
}

.workspace {
  width: min(100% - 40px, var(--content-width));
  margin: 0 auto;
  padding: 34px 0 72px;
}

.idle-state {
  display: grid;
  min-height: 390px;
  place-items: center;
  align-content: center;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.idle-state__symbol {
  display: flex;
  align-items: center;
  gap: 17px;
  margin-bottom: 20px;
}

.idle-state__symbol > span {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border: 1px solid;
  border-radius: 6px;
  font-size: 22px;
  font-weight: 800;
}

.idle-state__symbol svg {
  width: 23px;
  color: var(--gold);
}

.idle-state__bull {
  border-color: var(--bull-line) !important;
  color: var(--bull);
  background: var(--bull-soft);
}

.idle-state__bear {
  border-color: var(--bear-line) !important;
  color: var(--bear);
  background: var(--bear-soft);
}

.idle-state h2,
.idle-state p {
  margin: 0;
}

.idle-state h2 {
  font-size: 18px;
}

.idle-state p {
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 13px;
}

.loading-state,
.error-state {
  max-width: 760px;
  min-height: 300px;
  margin: 42px auto;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.loading-state__topline {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.loading-state h2 {
  margin: 0;
  font-size: 20px;
}

.loading-percent {
  color: var(--cyan);
  font-size: 27px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.progress-track {
  overflow: hidden;
  width: 100%;
  height: 7px;
  margin: 30px 0 13px;
  border-radius: 3px;
  background: #252d34;
}

.progress-track span {
  display: block;
  width: 4%;
  height: 100%;
  border-radius: inherit;
  background: var(--cyan);
  transition: width 500ms ease;
}

.loading-state__footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--text-dim);
  font-size: 12px;
}

.loading-state > .secondary-button {
  margin-top: 32px;
}

.error-state {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-height: 190px;
  gap: 18px;
}

.error-state__icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--bull-line);
  border-radius: 6px;
  color: var(--danger);
  background: var(--bull-soft);
}

.error-state h2,
.error-state p {
  margin: 0;
}

.error-state h2 {
  font-size: 17px;
}

.error-state p {
  margin-top: 3px;
  color: var(--text-soft);
  font-size: 13px;
}

.result-view {
  scroll-margin-top: 74px;
  display: block;
}

.quote-band {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(160px, 0.58fr) minmax(480px, 2fr);
  align-items: center;
  min-height: 136px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.quote-band__identity {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stock-code,
.quote-time {
  color: var(--text-dim);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.quote-band__identity h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.quote-band__price {
  padding: 0 28px;
  border-right: 1px solid var(--line-soft);
  border-left: 1px solid var(--line-soft);
}

.quote-band__price strong,
.quote-band__price span {
  display: block;
  font-variant-numeric: tabular-nums;
}

.quote-band__price strong {
  font-size: 32px;
  line-height: 1.1;
}

.quote-band__price span {
  margin-top: 7px;
  font-size: 13px;
  font-weight: 700;
}

.quote-band__price.is-up,
.quote-band__price.is-up strong,
.quote-band__price.is-up span {
  color: var(--bull);
}

.quote-band__price.is-down,
.quote-band__price.is-down strong,
.quote-band__price.is-down span {
  color: var(--bear);
}

.quote-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 24px;
  margin: 0;
  padding-left: 30px;
}

.quote-metrics div {
  min-width: 0;
}

.quote-metrics dt,
.quote-metrics dd {
  margin: 0;
  font-size: 12px;
}

.quote-metrics dt {
  color: var(--text-dim);
}

.quote-metrics dd {
  overflow: hidden;
  margin-top: 2px;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-summary,
.debate-section,
.debate-summary,
.sources-section {
  padding: 44px 0;
  border-bottom: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.section-heading h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.3;
}

.market-summary__layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.82fr) minmax(0, 1.35fr);
  align-items: start;
  gap: 32px;
}

.market-summary__layout > * {
  min-width: 0;
}

.market-summary--chart-only .kline-panel {
  grid-column: 1 / -1;
}

.market-summary__content {
  max-width: none;
  color: #cad0d5;
  font-size: 14px;
}

.market-summary__content p {
  margin: 0 0 10px;
}

.market-summary__content p:last-child {
  margin-bottom: 0;
}

.market-summary__content .market-summary__warning {
  color: var(--gold);
}

.kline-panel {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #0e1216;
}

.kline-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 11px;
}

.kline-panel__header > div:first-child {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 9px;
}

.kline-panel__header h3 {
  margin: 0;
  font-size: 14px;
  line-height: 28px;
}

.kline-panel__adjustment {
  color: var(--text-dim);
  font-size: 10px;
  white-space: nowrap;
}

.kline-periods {
  display: inline-flex;
  flex: 0 0 auto;
  overflow: hidden;
  min-height: 30px;
  border: 1px solid #35404a;
  border-radius: 4px;
  background: #11161b;
}

.kline-period {
  min-width: 48px;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-right: 1px solid #35404a;
  color: var(--text-dim);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.kline-period:last-child {
  border-right: 0;
}

.kline-period:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-raised);
}

.kline-period.is-active {
  color: #101419;
  background: var(--gold);
  font-weight: 700;
}

.kline-period:disabled {
  opacity: 0.38;
}

.kline-readout {
  display: grid;
  grid-template-columns: 1.35fr repeat(5, minmax(0, 1fr)) 1.2fr;
  gap: 6px;
  min-height: 46px;
  margin-bottom: 7px;
  padding: 6px 8px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background: #0b0f13;
  font-variant-numeric: tabular-nums;
}

.kline-readout span,
.kline-readout small,
.kline-readout strong {
  display: block;
  min-width: 0;
}

.kline-readout small {
  color: var(--text-dim);
  font-size: 9px;
  line-height: 1.2;
}

.kline-readout strong {
  overflow: hidden;
  margin-top: 2px;
  color: #dce2e7;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kline-readout strong.is-up {
  color: var(--bull);
}

.kline-readout strong.is-down {
  color: var(--bear);
}

.kline-legend {
  display: flex;
  align-items: center;
  min-height: 18px;
  gap: 12px;
  color: var(--text-dim);
  font-size: 9px;
  line-height: 1;
}

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

.kline-legend__swatch {
  width: 12px;
  height: 2px;
  background: #8294a5;
}

.kline-legend__swatch--ma5 {
  background: #efb84a;
}

.kline-legend__swatch--ma10 {
  background: #45c5d5;
}

.kline-legend__swatch--ma20 {
  background: #b58ae8;
}

.kline-legend__swatch--volume {
  height: 7px;
  background: #56636e;
}

.kline-chart-shell {
  position: relative;
  width: 100%;
  height: 300px;
  min-height: 300px;
  overflow: hidden;
}

.kline-chart {
  width: 100%;
  height: 100%;
}

.kline-empty {
  position: absolute;
  inset: 0;
  display: grid;
  margin: 0;
  place-items: center;
  color: var(--text-dim);
  background: #0e1216;
  font-size: 12px;
}

.section-heading--debate {
  margin-bottom: 18px;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.message-count {
  color: var(--text-dim);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.avatar {
  display: grid;
  flex: 0 0 auto;
  width: 39px;
  height: 39px;
  place-items: center;
  border: 1px solid;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 800;
}

.avatar--bull {
  border-color: var(--bull-line);
  color: var(--bull);
  background: var(--bull-soft);
}

.avatar--bear {
  border-color: var(--bear-line);
  color: var(--bear);
  background: var(--bear-soft);
}

.debate-stream {
  position: relative;
  display: grid;
  gap: 18px;
  max-width: 1000px;
  margin: 0 auto;
}

.debate-stream::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: var(--line-soft);
  content: "";
}

.debate-summary {
  border-top: 1px solid var(--line-soft);
}

.debate-summary__text {
  max-width: 1000px;
  margin: 0 auto;
  color: #d9dee2;
  font-size: 15px;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

.debate-summary__meta {
  margin: 7px 0 0;
  color: var(--text-dim);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.debate-summary__text p {
  margin: 0 0 12px;
}

.debate-summary__text p:last-child {
  margin-bottom: 0;
}

.debate-summary__text strong {
  color: #f2f5f7;
}

.message {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: min(76%, 720px);
}

.message--bull {
  justify-self: start;
}

.message--bear {
  flex-direction: row-reverse;
  justify-self: end;
}

.message__body {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid;
  border-radius: 6px;
}

.message--bull .message__body {
  border-color: #4f272e;
  background: #1d1417;
}

.message--bear .message__body {
  border-color: #194b39;
  background: #101f1a;
}

.message__text {
  margin: 0;
  color: #e1e5e8;
  font-size: 14px;
  line-height: 1.78;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.market-summary__content,
.market-summary__content p,
.quote-band,
.quote-band__identity,
.quote-metrics,
.debate-section,
.debate-summary,
.sources-section {
  min-width: 0;
}

.market-summary__content p {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message--bear .message__text {
  text-align: left;
}

.generated-time {
  color: var(--text-dim);
  font-size: 12px;
}

.source-warning {
  margin: -8px 0 19px;
  color: var(--text-dim);
  font-size: 12px;
}

.source-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 26px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: source;
}

.source-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 72px;
  border-top: 1px solid var(--line-soft);
  counter-increment: source;
}

.source-item::before {
  color: var(--gold);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  content: attr(data-source-id);
}

.source-item a {
  min-width: 0;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 13px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-item a:hover {
  color: var(--text);
  text-decoration: underline;
}

.source-item__meta {
  margin-left: 12px;
  color: var(--text-dim);
  font-size: 10px;
  white-space: nowrap;
}

.source-list__empty {
  grid-column: 1 / -1;
  padding: 20px 0;
  border-top: 1px solid var(--line-soft);
  color: var(--text-dim);
  font-size: 13px;
}

.source-item:target {
  background: rgba(239, 184, 74, 0.07);
}

.risk-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 26px 0 0;
  color: var(--text-dim);
}

.risk-notice svg {
  flex: 0 0 auto;
  width: 18px;
  margin-top: 2px;
  color: var(--gold);
}

.risk-notice p {
  min-width: 0;
  margin: 0;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  z-index: 80;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100vw - 40px));
  padding: 11px 14px;
  border: 1px solid #48545e;
  border-radius: 6px;
  color: var(--text);
  background: #1b2228;
  box-shadow: var(--shadow);
  font-size: 13px;
}

@media (max-width: 900px) {
  .market-summary__layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 30px;
  }

  .market-summary--chart-only .kline-panel {
    grid-column: auto;
  }

  .quote-band {
    grid-template-columns: 1fr 1fr;
    padding: 24px 0;
  }

  .quote-band__price {
    border-right: 0;
  }

  .quote-metrics {
    grid-column: 1 / -1;
    margin-top: 24px;
    padding: 20px 0 0;
    border-top: 1px solid var(--line-soft);
  }

  .message {
    width: 86%;
  }

  .source-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    height: 58px;
  }

  .topbar__inner,
  .command-band__inner,
  .workspace {
    width: min(100% - 28px, var(--content-width));
  }

  .brand__mark {
    width: 32px;
    height: 32px;
  }

  .brand small {
    display: none;
  }

  .market-clock {
    font-size: 11px;
  }

  .command-band__inner {
    padding: 24px 0 20px;
  }

  .command-title h1 {
    font-size: 23px;
  }

  .stock-search {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .stock-search__field,
  .stock-search__field input {
    min-width: 0;
    max-width: 100%;
  }

  .stock-search.has-selection {
    grid-template-columns: 1fr;
  }

  .primary-button {
    width: 100%;
  }

  .selection-bar {
    grid-row: 2;
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .selection-bar__market {
    grid-column: 2;
  }

  .selection-bar > .icon-button {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .stock-search .primary-button {
    grid-row: 3;
  }

  .workspace {
    padding-top: 24px;
  }

  .idle-state {
    min-height: 320px;
  }

  .loading-state,
  .error-state {
    margin: 18px auto;
    padding: 22px 18px;
  }

  .loading-state__topline {
    align-items: center;
  }

  .loading-state h2 {
    font-size: 17px;
  }

  .loading-percent {
    font-size: 21px;
  }

  .loading-state__footer {
    flex-direction: column;
    gap: 2px;
  }

  .error-state {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .error-state .secondary-button {
    grid-column: 1 / -1;
    width: 100%;
  }

  .quote-band {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-height: 0;
  }

  .quote-band__identity h2 {
    font-size: 20px;
    overflow-wrap: anywhere;
  }

  .quote-band__price {
    padding: 0 0 0 20px;
  }

  .quote-band__price strong {
    font-size: 27px;
  }

  .quote-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 13px 12px;
  }

  .quote-metrics dd,
  .quote-metrics dt {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .market-summary,
  .debate-section,
  .debate-summary,
  .sources-section {
    padding: 34px 0;
  }

  .kline-panel {
    padding: 12px;
  }

  .kline-chart-shell {
    height: 280px;
    min-height: 280px;
  }

  .kline-readout {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-height: 76px;
  }

  .section-heading {
    align-items: flex-start;
  }

  .section-heading--debate {
    flex-direction: column;
  }

  .section-actions {
    width: 100%;
    justify-content: space-between;
  }

  .avatar {
    width: 34px;
    height: 34px;
  }

  .debate-stream {
    gap: 14px;
  }

  .debate-stream::before {
    display: none;
  }

  .message {
    width: 96%;
    gap: 8px;
  }

  .message__body {
    padding: 12px 13px 11px;
  }

  .message__text {
    font-size: 13px;
    line-height: 1.72;
  }

  .generated-time {
    max-width: 130px;
    text-align: right;
  }

  .source-item {
    grid-template-columns: 37px minmax(0, 1fr);
    padding: 10px 0;
  }

  .source-item__meta {
    grid-column: 2;
    margin: 2px 0 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .source-item a {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .toast {
    right: 10px;
    left: 10px;
    max-width: none;
  }
}

@media (max-width: 360px) {
  .topbar__inner,
  .command-band__inner,
  .workspace {
    width: calc(100% - 20px);
  }

  .market-clock {
    display: none;
  }

  .selection-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 8px;
  }

  .selection-bar__check {
    display: none;
  }

  .selection-bar__content {
    grid-column: 1;
    grid-row: 1;
  }

  .selection-bar__code {
    grid-column: 1;
    grid-row: 2;
  }

  .selection-bar__market {
    grid-column: 1;
    grid-row: 3;
  }

  .selection-bar > .icon-button {
    grid-column: 2;
    grid-row: 1 / span 3;
  }

  .quote-band {
    grid-template-columns: minmax(0, 1fr);
  }

  .quote-band__identity h2 {
    font-size: 18px;
    overflow-wrap: anywhere;
  }

  .quote-band__price strong {
    font-size: 24px;
  }

  .quote-band__price {
    margin-top: 18px;
    padding: 18px 0 0;
    border-top: 1px solid var(--line-soft);
    border-right: 0;
    border-left: 0;
  }

  .quote-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px 8px;
  }

  .message {
    width: 100%;
  }

  .message__body {
    padding: 10px 11px;
  }

  .kline-panel__header {
    flex-direction: column;
    gap: 8px;
  }

  .kline-periods {
    width: 100%;
  }

  .kline-period {
    flex: 1 1 0;
    min-width: 0;
  }

  .kline-chart-shell {
    height: 250px;
    min-height: 250px;
  }

  .sources-section .section-heading {
    flex-direction: column;
  }

  .generated-time {
    max-width: none;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 640px) {
  .primary-button,
  .secondary-button,
  .kline-period,
  .icon-button {
    min-height: 42px;
  }

  .message {
    max-width: 100%;
  }

  .source-item a {
    word-break: break-word;
  }
}
