:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #f2f4f3;
  --text: #11181d;
  --muted: #69747b;
  --border: #dfe4e1;
  --grid: #edf0ee;
  --green: #24a83d;
  --green-dark: #0f8f2c;
  --red: #bd3d32;
  --blue: #255f91;
  --shadow: 0 16px 40px rgba(27, 39, 45, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.topbar {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  object-fit: contain;
}

.eyebrow {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 27px;
  line-height: 1.12;
}

h2 {
  font-size: 15px;
  line-height: 1.3;
}

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

.language-switch {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.lang-button {
  min-width: 34px;
  height: 26px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: inherit;
  text-decoration: none;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
}

.lang-button.active {
  background: #fff;
  box-shadow: 0 1px 4px rgba(24, 31, 36, 0.14);
}

.metric {
  min-width: 126px;
  padding: 9px 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.metric strong {
  display: block;
  margin-top: 2px;
  font-size: 14px;
}

.workspace {
  flex: 1 1 0;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(620px, 3fr);
  height: auto;
  min-height: 0;
}

.research-panel {
  background: #fbfcfb;
  border-right: 1px solid var(--border);
  overflow: auto;
}

.panel-section {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.hero-section {
  padding-top: 20px;
}

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

.section-head span {
  color: var(--muted);
  font-size: 12px;
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
  color: #243039;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
}

.summary-text,
.patch-list {
  color: #27343b;
  font-size: 13px;
  line-height: 1.45;
}

.trade-section {
  background: #fff;
}

.trade-decision {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.trade-decision.enter {
  color: var(--green-dark);
}

.trade-decision.wait {
  color: var(--blue);
}

.trade-decision.skip {
  color: var(--red);
}

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

.trade-plan {
  display: grid;
  gap: 7px;
}

.trade-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  color: #27343b;
  font-size: 12px;
  line-height: 1.35;
}

.trade-row span {
  color: var(--muted);
}

.trade-row strong {
  min-width: 0;
  color: #172026;
  font-size: 12px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.patch {
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.patch:first-child {
  border-top: 0;
  padding-top: 0;
}

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

.market-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  overflow: hidden;
}

.market-card {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px 20px 10px;
}

.market-head {
  display: grid;
  grid-template-columns: minmax(170px, auto) minmax(360px, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.asset-block {
  min-width: 0;
}

.asset-name {
  font-size: 13px;
  color: #1f282e;
  margin-bottom: 10px;
}

.asset-price {
  font-size: 32px;
  line-height: 1;
  font-weight: 700;
}

.asset-change {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

.asset-change.positive {
  color: var(--green-dark);
}

.asset-change.negative {
  color: var(--red);
}

.range-tabs {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 4px;
  padding: 4px;
  background: #f0f0f2;
  border-radius: 8px;
  flex-wrap: wrap;
}

.range-tabs button {
  min-width: 38px;
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #7d858a;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.range-tabs button.active {
  background: #fff;
  color: #11181d;
  box-shadow: 0 1px 4px rgba(24, 31, 36, 0.16);
}

.chart-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  min-height: 18px;
}

.canvas-wrap {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 6px;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.technical-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  min-width: 0;
  align-self: center;
}

.technical-strip[hidden] {
  display: none;
}

.technical-card {
  min-width: 0;
  padding: 7px 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.technical-card-top,
.technical-counts,
.technical-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.technical-card-top span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.technical-card-top strong {
  font-size: 11px;
  line-height: 1.2;
}

.technical-card.buy .technical-card-top strong,
.technical-row strong.buy {
  color: var(--green-dark);
}

.technical-card.sell .technical-card-top strong,
.technical-row strong.sell {
  color: var(--red);
}

.technical-card.neutral .technical-card-top strong,
.technical-row strong.neutral {
  color: var(--blue);
}

.technical-meter {
  position: relative;
  height: 3px;
  margin: 6px 0 5px;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--red), #c9cdd0 50%, var(--green));
}

.technical-meter i {
  position: absolute;
  top: -2px;
  width: 2px;
  height: 7px;
  transform: translateX(-1px);
  background: #11181d;
  border-radius: 999px;
}

.technical-counts {
  justify-content: flex-start;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}

.technical-rows {
  display: grid;
  gap: 1px;
  margin-top: 5px;
}

.technical-row span,
.technical-row strong {
  min-width: 0;
  font-size: 10px;
  line-height: 1.2;
}

.technical-row span {
  overflow: hidden;
  color: #344047;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.technical-row strong {
  flex: 0 0 auto;
  font-weight: 700;
  white-space: nowrap;
}

.forecast-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
  gap: 10px;
  margin-top: 0;
}

.forecast-card {
  min-height: 0;
  padding: 9px 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: visible;
}

.forecast-card-top {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 3px 5px;
  margin-bottom: 5px;
  min-width: 0;
}

.forecast-card-top strong {
  color: var(--text);
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
}

.forecast-card-top span,
.forecast-card p {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
}

.forecast-card p {
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  body {
    display: block;
    overflow: auto;
    overflow-x: hidden;
  }

  .workspace {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100vw;
    height: auto;
    min-height: calc(100vh - 79px);
  }

  .research-panel {
    width: 100%;
    max-width: 100vw;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    max-height: 54vh;
  }

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

  .market-head {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 10px;
  }

  .range-tabs {
    justify-self: start;
  }

  .technical-strip {
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .technical-card {
    min-width: 220px;
  }

  .market-panel {
    width: 100%;
    max-width: 100vw;
    overflow: visible;
  }

  .market-card {
    max-width: 100%;
    overflow: hidden;
  }

  .canvas-wrap {
    aspect-ratio: 1.7 / 1;
    min-height: 300px;
  }
}

@media (max-width: 1280px) and (min-width: 981px) {
  .market-head {
    grid-template-columns: minmax(170px, 1fr) auto;
  }

  .technical-strip {
    grid-column: 1 / -1;
    order: 3;
  }
}

@media (max-width: 720px) {
  .topbar,
  .chart-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .market-head {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 10px;
  }

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

  .brand-logo {
    width: 40px;
    height: 40px;
  }

  .market-panel {
    padding: 10px;
  }

  .market-card {
    padding: 14px 12px 10px;
  }

  .asset-price {
    font-size: 31px;
  }

  .canvas-wrap {
    min-height: 300px;
  }

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

  .technical-card {
    min-width: 215px;
    padding: 8px 9px;
  }

  .forecast-card {
    height: auto;
  }
}
