:root {
  --bg: #0d1218;
  --panel: #151c24;
  --panel-2: #1a232d;
  --line: rgba(172, 188, 205, 0.18);
  --line-strong: rgba(172, 188, 205, 0.32);
  --text: #e9eef6;
  --muted: #98a7b8;
  --soft: #c4ceda;
  --red: #ff6268;
  --green: #44d08a;
  --yellow: #f2bd4b;
  --blue: #64a6ff;
  --neutral: #768397;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
}

body.apply-page {
  min-height: 100%;
  overflow: auto;
  background:
    radial-gradient(circle at 18% 12%, rgba(100, 166, 255, 0.20), transparent 28rem),
    radial-gradient(circle at 88% 20%, rgba(68, 208, 138, 0.14), transparent 24rem),
    linear-gradient(145deg, #081018 0%, #111821 46%, #0b1016 100%);
}

button {
  font: inherit;
}

.noscript {
  padding: 12px 16px;
  background: #3a1e1e;
  color: #ffd0d0;
}

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

.apply-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vw, 54px);
}

.apply-card {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.1fr);
  gap: clamp(18px, 3vw, 34px);
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(21, 28, 36, 0.96), rgba(14, 20, 28, 0.92)),
    var(--panel);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.42);
  overflow: hidden;
}

.apply-copy,
.apply-form {
  padding: clamp(22px, 4vw, 40px);
}

.apply-copy {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(160deg, rgba(100, 166, 255, 0.10), transparent 46%),
    rgba(255, 255, 255, 0.018);
}

.apply-copy h1 {
  margin-top: 10px;
  font-size: clamp(2.1rem, 6vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: -0.07em;
}

.apply-lead {
  max-width: 28rem;
  margin: 18px 0 0;
  color: var(--soft);
  font-size: clamp(1rem, 2vw, 1.16rem);
}

.apply-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.apply-rules span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(172, 188, 205, 0.20);
  border-radius: 999px;
  color: var(--soft);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.78rem;
  font-weight: 800;
}

.apply-form {
  display: grid;
  gap: 16px;
}

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

.form-field {
  display: grid;
  gap: 7px;
  color: var(--soft);
  font-size: 0.82rem;
  font-weight: 800;
}

.form-field input,
.form-field textarea {
  width: 100%;
  border: 1px solid rgba(172, 188, 205, 0.22);
  border-radius: 12px;
  background: rgba(5, 9, 14, 0.62);
  color: var(--text);
  font: inherit;
  padding: 12px 13px;
  outline: none;
}

.form-field textarea {
  min-height: 116px;
  resize: vertical;
}

.form-field input:focus,
.form-field textarea:focus {
  border-color: rgba(100, 166, 255, 0.58);
  box-shadow: 0 0 0 3px rgba(100, 166, 255, 0.12);
}

.apply-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

.apply-consent input {
  margin-top: 2px;
}

.apply-trap,
.apply-submit-frame {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.apply-actions {
  display: grid;
  gap: 10px;
}

.apply-submit {
  min-height: 46px;
  border: 1px solid rgba(68, 208, 138, 0.48);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(68, 208, 138, 0.92), rgba(100, 166, 255, 0.88));
  color: #061018;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.apply-submit:disabled {
  border-color: rgba(172, 188, 205, 0.16);
  background: rgba(118, 131, 151, 0.16);
  color: var(--muted);
  cursor: not-allowed;
}

.apply-status {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.apply-status[data-tone="ok"] {
  color: #83f0b7;
}

.apply-status[data-tone="warn"] {
  color: #ffd577;
}

.apply-status[data-tone="danger"] {
  color: #ff9da0;
}

.shell {
  height: 100dvh;
  min-height: 100vh;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  padding: 10px;
}

.topbar,
.control-row,
.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.topbar {
  display: none;
}

.title-block {
  min-width: 180px;
}

.eyebrow,
.panel-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.title-block .eyebrow {
  display: none;
}

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

h1 {
  font-size: 0.98rem;
}

h2 {
  font-size: 0.98rem;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  max-width: 280px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(118, 131, 151, 0.16);
  color: var(--soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
  font-size: 0.8rem;
}

.badge.live {
  border-color: rgba(68, 208, 138, 0.42);
  background: rgba(68, 208, 138, 0.14);
  color: #83f0b7;
}

.badge.warn {
  border-color: rgba(242, 189, 75, 0.42);
  background: rgba(242, 189, 75, 0.14);
  color: #ffd577;
}

.badge.danger {
  border-color: rgba(255, 98, 104, 0.44);
  background: rgba(255, 98, 104, 0.14);
  color: #ff9da0;
}

.badge.neutral {
  color: var(--soft);
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  border-radius: 8px;
}

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.segment,
.refresh-button,
.tool-button {
  min-height: 28px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  cursor: pointer;
}

.segment.is-active,
.segment:focus-visible,
.refresh-button:focus-visible {
  border-color: rgba(100, 166, 255, 0.4);
  background: rgba(100, 166, 255, 0.16);
  color: var(--text);
  outline: none;
}

.refresh-button {
  background: rgba(255, 255, 255, 0.06);
  color: var(--soft);
  border-color: var(--line);
}

.layout {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(210px, 0.78fr) minmax(640px, 3.45fr) minmax(280px, 0.95fr);
  align-items: stretch;
  gap: 10px;
  overflow: hidden;
}

.panel {
  border-radius: 8px;
  overflow: hidden;
}

.head-actions {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.section-toggle {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--soft);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.section-toggle:hover,
.section-toggle:focus-visible {
  border-color: rgba(100, 166, 255, 0.5);
  background: rgba(100, 166, 255, 0.18);
  color: var(--text);
  outline: none;
}

.panel-head,
.chart-head {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.market-list,
.freshness-list,
.signal-panel,
.option-flow,
.brief-list,
.event-list,
.macro-list,
.orderbook-monitor,
.afterhours-list {
  padding: 10px;
}

.market-item,
.freshness-item,
.brief-item,
.event-item {
  display: grid;
  gap: 4px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}

.market-choice {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.market-choice:hover,
.market-choice:focus-visible,
.market-choice.is-active {
  border-color: rgba(100, 166, 255, 0.52);
  background: rgba(100, 166, 255, 0.12);
  outline: none;
}

.market-list,
.freshness-list,
.brief-list,
.event-list,
.macro-list,
.afterhours-list {
  display: grid;
  gap: 8px;
}

.monitor-block {
  border-top: 1px solid var(--line);
}

.monitor-head {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px 0;
}

.monitor-head h3 {
  margin: 0;
  font-size: 0.88rem;
  letter-spacing: 0;
}

.market-main,
.freshness-main {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 800;
}

.market-name {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.market-live-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid rgba(172, 188, 205, 0.26);
  background: rgba(118, 131, 151, 0.42);
}

.market-live-dot.is-live {
  border-color: rgba(255, 98, 104, 0.78);
  background: #ff363d;
  animation: live-breathe 1.45s ease-in-out infinite;
}

.market-meta,
.market-subline,
.freshness-meta,
.event-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.market-subline {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.status-text-live {
  color: #83f0b7;
}

.status-text-warn {
  color: #ffd577;
}

.status-text-danger {
  color: #ff9da0;
}

.status-text-neutral {
  color: var(--soft);
}

.up {
  color: var(--red);
}

.down {
  color: var(--green);
}

.flat {
  color: var(--soft);
}

.market-resonance.warn {
  color: #ffd577;
}

.market-resonance.up {
  color: #83f0b7;
}

.chart-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  height: 100%;
  grid-template-rows: auto auto minmax(0, 1fr) clamp(148px, 20dvh, 180px);
}

.chart-flags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.chart-head-main {
  min-width: 0;
}

.chart-head-status {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.live-indicator {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid rgba(172, 188, 205, 0.34);
  background: rgba(118, 131, 151, 0.38);
  box-shadow: none;
}

.live-indicator.is-live {
  border-color: rgba(255, 98, 104, 0.78);
  background: #ff363d;
  animation: live-breathe 1.45s ease-in-out infinite;
}

@keyframes live-breathe {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 54, 61, 0.26), 0 0 6px rgba(255, 54, 61, 0.42);
    transform: scale(0.92);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(255, 54, 61, 0), 0 0 14px rgba(255, 54, 61, 0.9);
    transform: scale(1.08);
  }
}

.chart-head-status .status-strip,
.chart-head-status .chart-flags {
  flex: 0 1 auto;
}

.chart-head-status .badge {
  min-height: 26px;
  max-width: 136px;
  padding: 0 9px;
}

.chart-tools {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 8px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
}

.chart-tool-cluster,
.indicator-toggle-group,
.chart-status-cluster {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.chart-tool-cluster {
  flex: 1 1 auto;
  overflow: hidden;
}

.indicator-toggle-group {
  flex-wrap: wrap;
}

.compact-segmented {
  flex: 0 0 auto;
}

.compact-segmented .segment {
  min-height: 24px;
  padding: 0 10px;
}

.compact-refresh-button {
  min-height: 24px;
  padding: 0 10px;
}

.chart-tools-status-only {
  justify-content: flex-end;
}

.indicator-toggle {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--soft);
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}

.indicator-toggle input {
  width: 13px;
  height: 13px;
  accent-color: #f08c5a;
}

.indicator-title-group {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.subchart-switch {
  display: inline-flex;
  gap: 3px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
}

.subchart-button {
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}

.subchart-button.is-active,
.subchart-button:focus-visible {
  border-color: rgba(100, 166, 255, 0.46);
  background: rgba(100, 166, 255, 0.16);
  color: var(--text);
  outline: none;
}

.indicator-help {
  position: relative;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.indicator-help summary {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  list-style: none;
}

.indicator-help summary::-webkit-details-marker {
  display: none;
}

.indicator-help[open] summary {
  border-color: rgba(242, 189, 75, 0.42);
  color: var(--text);
}

.indicator-help-body {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 12;
  width: min(360px, calc(100vw - 48px));
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid rgba(216, 221, 230, 0.28);
  border-radius: 6px;
  background: rgba(11, 16, 22, 0.96);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.38);
}

.indicator-help-body p {
  margin: 0;
  color: var(--soft);
  line-height: 1.45;
}

.indicator-help-body strong {
  color: #e9eef6;
}

.chart-tool-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tool-button {
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--soft);
  cursor: pointer;
}

.tool-button.is-active,
.tool-button:focus-visible {
  border-color: rgba(100, 166, 255, 0.46);
  background: rgba(100, 166, 255, 0.18);
  color: var(--text);
  outline: none;
}

.chart-tool-status {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.chart-frame {
  position: relative;
  min-height: 0;
  background: #0f151c;
  padding: 6px 8px;
}

#price-chart {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.tv-lightweight-charts {
  border-radius: 4px;
}

.chart-empty-state {
  min-height: 100%;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
}

.chart-hover-tooltip {
  position: absolute;
  z-index: 8;
  width: 208px;
  min-height: 72px;
  padding: 9px 12px;
  border: 1px solid rgba(216, 221, 230, 0.4);
  border-radius: 6px;
  background: rgba(11, 16, 22, 0.92);
  color: #e9eef6;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.55;
  pointer-events: none;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34);
}

.chart-gap-zone {
  position: absolute;
  z-index: 3;
  background: rgba(216, 221, 230, 0.20);
  pointer-events: none;
}

.chart-gap-arrow {
  position: absolute;
  z-index: 4;
  width: 0;
  height: 0;
  pointer-events: none;
}

.chart-gap-arrow.is-up {
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 11px solid rgba(229, 57, 53, 0.88);
}

.chart-gap-arrow.is-down {
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 11px solid rgba(229, 57, 53, 0.88);
}

.chart-stale-overlay {
  position: absolute;
  inset: 8px;
  z-index: 5;
  display: grid;
  place-content: center;
  gap: 8px;
  background: rgba(15, 21, 28, 0.62);
  pointer-events: none;
}

.stale-title {
  margin: 0;
  color: #ffd577;
  font-size: 24px;
  font-weight: 900;
}

.stale-subtitle {
  margin: 0;
  color: #d8dde6;
  font-size: 14px;
  font-weight: 700;
}

.indicator-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-top: 1px solid var(--line);
  background: #0f151c;
}

.indicator-head {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
}

.indicator-head h2 {
  font-size: 0.86rem;
}

#tower-summary {
  display: none;
}

#tower-chart {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.indicator-stale-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  background: rgba(15, 21, 28, 0.62);
  color: #f2bd4b;
  font-size: 0.8rem;
  font-weight: 900;
  pointer-events: none;
}

.right-rail {
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 8px;
  max-height: none;
  overflow: auto;
  padding-right: 2px;
}

.watch-panel {
  height: 100%;
  min-height: 0;
  overflow: auto;
}

.small-panel {
  min-height: 0;
}

.macro-row,
.afterhours-row {
  display: grid;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}

.macro-row {
  grid-template-columns: minmax(76px, 1fr) minmax(66px, auto) minmax(52px, auto);
  min-height: 34px;
  gap: 8px;
}

.afterhours-row div {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.afterhours-row small {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.25;
}

.macro-label,
.macro-last,
.afterhours-row strong {
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.macro-change,
.afterhours-row span {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.macro-last,
.macro-change {
  text-align: right;
  justify-self: end;
  font-variant-numeric: tabular-nums;
}

.macro-change.up {
  color: var(--red);
}

.macro-change.down {
  color: var(--green);
}

.macro-change.flat {
  color: var(--soft);
}

.orderbook-title,
.monitor-empty {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--soft);
  font-size: 0.78rem;
}

.monitor-empty {
  display: grid;
  justify-content: stretch;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: var(--panel-2);
}

.monitor-empty.compact-warning {
  padding: 7px 9px;
  border-color: rgba(242, 189, 75, 0.34);
  background: rgba(242, 189, 75, 0.10);
}

.monitor-empty span {
  color: var(--muted);
}

.orderbook-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  justify-self: end;
  color: var(--muted);
}

.orderbook-state.is-live {
  color: var(--soft);
}

.orderbook-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 4px 6px;
  align-items: center;
  padding: 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
  font-size: 0.72rem;
  color: var(--soft);
}

.orderbook-grid span {
  min-width: 0;
  text-align: right;
}

.orderbook-grid span:nth-child(4n + 1) {
  text-align: left;
}

.orderbook-grid.is-empty {
  color: var(--muted);
}

.afterhours-row {
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.afterhours-row:hover,
.afterhours-row:focus-visible {
  border-color: rgba(100, 166, 255, 0.52);
  background: rgba(100, 166, 255, 0.12);
  outline: none;
}

.signal-blocked,
.signal-open,
.option-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: var(--panel-2);
}

.signal-blocked {
  border-color: rgba(242, 189, 75, 0.38);
  background: rgba(242, 189, 75, 0.12);
}

.signal-title,
.option-value {
  margin: 0;
  font-size: 1rem;
  font-weight: 900;
}

.signal-text,
.option-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.option-metric {
  padding: 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.045);
}

.option-label {
  color: var(--muted);
  font-size: 0.72rem;
}

.ladder {
  display: grid;
  gap: 5px;
  margin-top: 10px;
}

.ladder-row {
  display: grid;
  grid-template-columns: 64px 1fr 1fr;
  gap: 8px;
  align-items: center;
  font-size: 0.76rem;
  color: var(--soft);
}

.bar-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
}

.event-panel {
  min-height: 220px;
}

.event-list {
  max-height: 100%;
  overflow: auto;
}

.event-item {
  align-content: start;
}

.brief-title {
  margin: 0;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 900;
}

.brief-impact {
  margin: 0;
  color: #ffd577;
  font-size: 0.78rem;
  font-weight: 800;
}

.event-text {
  margin: 0;
  color: var(--soft);
  font-size: 0.82rem;
}

.empty-state {
  padding: 14px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
}

.placeholder {
  margin: 0;
  padding: 12px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
}

.detail-dialog {
  width: min(440px, calc(100vw - 28px));
  max-height: min(620px, calc(100vh - 40px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.58);
}

.detail-dialog::backdrop {
  background: rgba(3, 8, 15, 0.66);
}

.detail-dialog-panel {
  display: grid;
  min-height: 0;
}

.detail-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.detail-dialog-head h2 {
  margin: 4px 0 0;
  font-size: 1.05rem;
}

.dialog-close-button {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--soft);
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.dialog-close-button:hover,
.dialog-close-button:focus-visible {
  border-color: rgba(100, 166, 255, 0.55);
  background: rgba(100, 166, 255, 0.16);
  color: var(--text);
  outline: none;
}

.detail-dialog-body {
  display: grid;
  gap: 14px;
  padding: 14px 16px 16px;
}

.afterhours-detail-score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
}

.afterhours-detail-score span {
  color: var(--muted);
  font-size: 0.8rem;
}

.afterhours-detail-score strong {
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.afterhours-detail-section {
  display: grid;
  gap: 10px;
}

.afterhours-detail-section h3 {
  margin: 0;
  color: var(--soft);
  font-size: 0.9rem;
}

.symbol-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tw-chain-grid {
  display: grid;
  gap: 9px;
}

.tw-chain-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
}

.tw-chain-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.tw-chain-card-head strong {
  color: var(--text);
  font-size: 0.86rem;
}

.tw-chain-card-head span,
.tw-chain-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.symbol-chip,
.dialog-empty-text {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--soft);
  font-size: 0.8rem;
}

.tw-stock-chip {
  border-color: rgba(100, 166, 255, 0.34);
  background: rgba(100, 166, 255, 0.09);
  color: var(--text);
}

.dialog-empty-text {
  color: var(--muted);
}

@media (max-width: 1180px) {
  html,
  body {
    height: auto;
    overflow: auto;
  }

  .shell {
    height: auto;
    min-height: 100dvh;
  }

  .layout {
    height: auto;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .right-rail {
    height: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto;
  }
}

@media (max-width: 760px) {
  .apply-card {
    grid-template-columns: 1fr;
  }

  .apply-copy {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .shell {
    padding: 8px;
  }

  .topbar,
  .control-row {
    align-items: stretch;
    flex-direction: column;
  }

  .status-strip {
    justify-content: flex-start;
  }

  .segmented {
    width: 100%;
    overflow-x: auto;
  }

  .segment {
    flex: 1 0 auto;
  }

  .right-rail {
    grid-template-columns: 1fr;
  }

  .chart-panel {
    height: auto;
    grid-template-rows: auto auto minmax(360px, 1fr) 156px;
  }

  .chart-frame,
  #price-chart {
    min-height: 320px;
  }
}
