:root {
  color-scheme: light;
  --bg: #f5f4ef;
  --panel: #ffffff;
  --panel-2: #f0f5f1;
  --text: #1d2522;
  --muted: #69736f;
  --line: #d8ddd5;
  --green: #156f55;
  --red: #b9423b;
  --amber: #be7d19;
  --ink: #111816;
  --blue: #256785;
  --shadow: 0 18px 60px rgba(21, 28, 25, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(21, 111, 85, 0.08), transparent 38%),
    linear-gradient(320deg, rgba(190, 125, 25, 0.09), transparent 42%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
  max-width: 100vw;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.topbar,
.control-strip,
.summary-grid,
.chart-grid,
.research-grid {
  width: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.guide-link,
.guide-back {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  padding: 9px 12px;
  font-size: 0.77rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.guide-link:hover,
.guide-back:hover {
  border-color: rgba(21, 111, 85, 0.3);
  color: var(--green);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  color: var(--ink);
  font-size: clamp(1.75rem, 3vw, 3.15rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.status-pill,
.mini-badge,
.lane {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 750;
  white-space: nowrap;
}

.status-pill {
  padding: 9px 12px;
}

.mini-badge,
.lane {
  padding: 6px 9px;
}

.lane {
  cursor: pointer;
  font-family: inherit;
}

.lane:hover,
.lane.active {
  border-color: rgba(21, 111, 85, 0.42);
  color: var(--green);
}

.lane.active {
  box-shadow: inset 0 0 0 1px rgba(21, 111, 85, 0.18);
}

.lane.pass,
.mini-badge.pass {
  border-color: rgba(21, 111, 85, 0.28);
  background: rgba(21, 111, 85, 0.1);
  color: var(--green);
}

.lane.fail,
.mini-badge.fail {
  border-color: rgba(185, 66, 59, 0.25);
  background: rgba(185, 66, 59, 0.1);
  color: var(--red);
}

.control-strip {
  display: grid;
  grid-template-columns: minmax(150px, 1.6fr) repeat(4, minmax(92px, 0.75fr)) minmax(110px, 0.7fr);
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 36px rgba(21, 28, 25, 0.08);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 760;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd2ca;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 9px 10px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(21, 111, 85, 0.14);
}

.symbol-box input {
  font-size: 1.2rem;
  font-weight: 850;
  text-transform: uppercase;
}

.primary,
.secondary,
.ghost,
.upload-label {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 10px 13px;
  font-weight: 820;
}

.primary {
  background: var(--ink);
  color: #fff;
}

.primary:hover {
  background: #24312d;
}

.secondary,
.upload-label {
  background: #eef5f1;
  border-color: #cad9d1;
  color: var(--green);
}

.ghost {
  min-height: 34px;
  background: transparent;
  border-color: var(--line);
  color: var(--text);
  padding: 7px 10px;
}

.full {
  width: 100%;
}

.summary-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.7fr) repeat(3, minmax(160px, 1fr));
  gap: 12px;
}

.verdict-panel,
.metric,
.chart-panel,
.check-panel,
.panel,
.screen-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.verdict-panel,
.metric,
.panel,
.check-panel,
.screen-panel {
  padding: 16px;
}

.verdict-kicker,
.metric span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 820;
  text-transform: uppercase;
}

.verdict {
  margin-top: 8px;
  color: var(--ink);
  font-size: 2.05rem;
  font-weight: 900;
  letter-spacing: 0;
}

.verdict.qualifies {
  color: var(--green);
}

.verdict.watchlist {
  color: var(--amber);
}

.verdict.reject {
  color: var(--red);
}

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

.metric {
  display: grid;
  align-content: space-between;
  min-height: 132px;
}

.metric strong {
  margin-top: 12px;
  color: var(--ink);
  font-size: 1.72rem;
  letter-spacing: 0;
}

.metric small {
  color: var(--muted);
  font-size: 0.82rem;
}

.chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 12px;
  min-height: 455px;
}

.risk-panel {
  display: grid;
  gap: 12px;
}

.risk-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.risk-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 12px;
}

.risk-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(96px, 1fr));
  gap: 9px;
}

.risk-form label {
  min-width: 0;
}

.risk-form input,
.risk-form select {
  min-height: 40px;
}

.risk-form .r-multiple-field input {
  border-color: rgba(190, 125, 25, 0.45);
  background: #f8a91f;
  color: #111816;
  font-weight: 900;
  text-align: center;
}

.risk-output-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(112px, 1fr));
  gap: 8px;
}

.risk-output-grid article {
  display: grid;
  gap: 6px;
  min-height: 76px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.risk-output-grid span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 820;
  text-transform: uppercase;
}

.risk-output-grid strong {
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.risk-narrative {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.scenario-wrap {
  overflow-x: auto;
}

.scenario-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.scenario-table th,
.scenario-table td {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.scenario-table th:first-child,
.scenario-table td:first-child {
  text-align: center;
}

.scenario-table th {
  background: #10231d;
  color: #fff;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.scenario-table td {
  color: var(--text);
  font-size: 0.88rem;
}

.scenario-table tr.active td {
  background: rgba(248, 169, 31, 0.22);
  font-weight: 850;
}

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

.chart-panel {
  min-width: 0;
  padding: 14px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head.tight {
  margin-bottom: 10px;
}

.panel-head p {
  margin-bottom: 0;
  font-size: 0.84rem;
}

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

.chart-view-toggle,
.chart-timeframe-toggle,
.chart-session-toggle,
.chart-zoom-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
}

.chart-view-button,
.chart-timeframe-button,
.chart-session-button,
.chart-zoom-button {
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 5px 9px;
  font-size: 0.77rem;
  font-weight: 850;
  white-space: nowrap;
}

.chart-view-button.active,
.chart-timeframe-button.active,
.chart-session-button.active {
  background: var(--ink);
  color: #ffffff;
}

.chart-zoom-label {
  min-width: 58px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-align: center;
  white-space: nowrap;
}

.stream-toggle {
  white-space: nowrap;
}

.lane-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

canvas {
  display: block;
}

#priceCanvas {
  width: 100%;
  height: 360px;
  border: 1px solid #e2e5df;
  border-radius: 7px;
  background: #fbfcfa;
}

.copilot-panel {
  margin-top: 18px;
}

.copilot-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.05fr) minmax(260px, 1fr);
  gap: 14px;
}

.copilot-voice,
.pattern-board,
.teaching-board,
.trade-plan-board {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.copilot-actions,
.paper-actions,
.pattern-board-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.voice-transcript {
  min-height: 112px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #d9e4dd;
  border-radius: 8px;
  background: #f8faf8;
  color: var(--ink);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

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

.pattern-card {
  border: 1px solid #e2e5df;
  border-left: 4px solid var(--green);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfa;
}

.pattern-card.short {
  border-left-color: var(--red);
}

.pattern-card button {
  margin-top: 8px;
}

.pattern-card h4,
.teaching-board h3,
.trade-plan-board h3,
.pattern-board h3 {
  margin: 0;
}

.pattern-card p,
.pattern-lesson p,
.trade-plan-output p,
.paper-order-output p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.pattern-card small,
.pattern-lesson small,
.trade-plan-output small,
.paper-order-output small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.pattern-lesson,
.trade-plan-output,
.paper-order-output {
  margin-top: 10px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.trade-plan-output {
  min-height: 112px;
}

.paper-actions {
  margin-top: 12px;
}

.paper-actions input {
  min-width: min(100%, 260px);
  flex: 1;
  height: 40px;
  border: 1px solid #cbd2ca;
  border-radius: 7px;
  padding: 0 10px;
  font: inherit;
}

.overlay-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.overlay-chip {
  border: 1px solid #cad9d1;
  border-radius: 999px;
  background: #f8faf8;
  color: var(--ink);
  padding: 5px 9px;
  font-size: 0.82rem;
}

.criteria-list {
  display: grid;
  gap: 9px;
}

.criterion {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 8px;
  background: #fbfcfa;
}

.criterion.pass {
  border-left-color: var(--green);
}

.criterion.fail {
  border-left-color: var(--red);
}

.criterion .row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.criterion strong {
  font-size: 0.9rem;
}

.criterion span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
  text-align: right;
}

.criterion p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.research-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 12px;
}

.news-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.research-detail {
  display: grid;
  gap: 9px;
  margin-bottom: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.42;
}

.research-detail p {
  margin: 0;
  color: var(--muted);
}

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

.detail-grid div {
  display: grid;
  gap: 3px;
}

.detail-grid span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 820;
  text-transform: uppercase;
}

.detail-grid strong {
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1.25;
}

.news-item {
  display: grid;
  gap: 6px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.news-item a {
  color: var(--ink);
  font-weight: 820;
  line-height: 1.28;
  text-decoration: none;
}

.news-item a:hover {
  color: var(--green);
}

.news-item small,
.term-row {
  color: var(--muted);
  font-size: 0.78rem;
}

.term-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.term {
  border-radius: 999px;
  background: rgba(190, 125, 25, 0.13);
  color: #8a5b14;
  padding: 3px 7px;
  font-weight: 750;
}

.reasoning {
  color: var(--text);
  line-height: 1.48;
}

.news-digest {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.news-digest-panel,
.news-digest-empty {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.news-digest-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.news-digest h3 {
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
}

.news-digest-head span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 760;
  text-align: right;
}

.news-digest-panel > p,
.news-digest-empty p {
  margin-bottom: 0;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.42;
}

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

.news-signal-grid div {
  display: grid;
  gap: 5px;
  padding: 9px;
  border: 1px solid #e2e5df;
  border-radius: 8px;
  background: #ffffff;
}

.news-signal-grid span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 820;
  text-transform: uppercase;
}

.news-signal-grid strong {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 760;
  line-height: 1.34;
}

.digest-headlines,
.reasoning-check-list {
  display: grid;
  gap: 8px;
}

.digest-headlines h4 {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.digest-headline,
.reasoning-check-list div {
  display: grid;
  gap: 5px;
  padding: 9px;
  border: 1px solid #e2e5df;
  border-radius: 8px;
  background: #ffffff;
}

.digest-headline a,
.digest-headline strong {
  color: var(--ink);
  font-weight: 820;
  line-height: 1.25;
  text-decoration: none;
}

.digest-headline a:hover {
  color: var(--green);
}

.digest-headline small,
.digest-headline p,
.reasoning-check-list p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.34;
}

.reasoning-check-list span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 820;
  text-transform: uppercase;
}

.reasoning-check-list strong {
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.3;
}

.reasoning-check-list .pass {
  border-left: 4px solid var(--green);
}

.reasoning-check-list .fail {
  border-left: 4px solid var(--red);
}

.next-checks {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.88rem;
}

.screen-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  max-height: calc(100vh - 36px);
  position: sticky;
  top: 18px;
}

.screen-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.vision-key-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid #d9e4dd;
  border-radius: 8px;
  background: #f7fbf8;
}

.vision-key-form label {
  min-width: 0;
}

.vision-key-form input {
  min-height: 38px;
}

.vision-key-form button {
  min-height: 38px;
  padding: 8px 10px;
  white-space: nowrap;
}

.vision-key-form small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.78rem;
}

.vision-key-form small.key-error {
  color: var(--red);
  font-weight: 760;
}

.upload-label {
  display: grid;
  place-items: center;
  min-height: 42px;
  text-align: center;
  text-transform: none;
}

.upload-label input {
  display: none;
}

.drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 210px;
  border: 1px dashed #b8c4bd;
  border-radius: 8px;
  background: #fbfcfa;
  overflow: hidden;
}

#screenCanvas {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #edf0ec;
}

#screenEmpty {
  position: absolute;
  inset: auto 16px 16px;
  margin-bottom: 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.85rem;
}

.vision-output {
  flex: 1;
  min-height: 170px;
  max-height: 430px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101816;
  color: #d8f3e5;
  padding: 12px;
  white-space: pre-wrap;
  line-height: 1.45;
  font-size: 0.82rem;
}

.guide-shell {
  width: min(980px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 42px;
}

.guide-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.guide-page {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 42px);
}

.guide-page h1 {
  margin-bottom: 10px;
}

.guide-page h2 {
  margin: 28px 0 10px;
  font-size: 1.28rem;
}

.guide-page p,
.guide-page li,
.guide-page dd {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.58;
}

.guide-lede {
  max-width: 740px;
  color: var(--muted);
  font-size: 1.12rem;
}

.guide-callout {
  border-left: 5px solid var(--amber);
  border-radius: 8px;
  background: rgba(190, 125, 25, 0.1);
  padding: 12px 14px;
  font-weight: 760;
}

.guide-definitions {
  display: grid;
  grid-template-columns: minmax(130px, 0.32fr) minmax(0, 1fr);
  gap: 10px 16px;
  margin: 0;
}

.guide-definitions dt {
  color: var(--ink);
  font-weight: 900;
}

.guide-definitions dd {
  margin: 0;
  color: var(--muted);
}

.guide-page ol,
.guide-page ul {
  display: grid;
  gap: 8px;
  margin-bottom: 0;
  padding-left: 22px;
}

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .screen-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 1480px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .screen-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 860px) {
  .shell {
    padding: 12px;
  }

  .topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .control-strip,
  .summary-grid,
  .chart-grid,
  .copilot-grid,
  .research-grid,
  .risk-workbench {
    grid-template-columns: 1fr;
  }

  .risk-form,
  .risk-output-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    min-height: 108px;
  }

  .screen-actions {
    grid-template-columns: 1fr;
  }

  .detail-grid,
  .news-signal-grid {
    grid-template-columns: 1fr;
  }

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

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

  .chart-actions,
  .chart-view-toggle,
  .chart-timeframe-toggle,
  .chart-session-toggle,
  .chart-zoom-toggle {
    width: 100%;
  }

  .chart-view-button,
  .chart-timeframe-button,
  .chart-session-button,
  .chart-zoom-button {
    flex: 1;
  }

  .guide-definitions {
    grid-template-columns: 1fr;
  }

  .guide-definitions dt {
    margin-top: 8px;
  }
}
