* {
  box-sizing: border-box;
}

:root {
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #dce2eb;
  background: #0d1016;
  font-size: 13px;
  color-scheme: dark;
  --line: #282d37;
  --muted: #8d97a9;
  --panel: #151922;
  --accent: #9bb7f8;
}

body {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #1c222e;
  color: #dce2eb;
  padding: 9px 12px;
  transition: background 0.15s;
}

button:hover {
  background: #30394b;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid #9bb7f8;
  outline-offset: 2px;
}

input,
select,
textarea {
  border: 1px solid #303745;
  background: #10151e;
  color: #e5eaf2;
  padding: 10px;
  border-radius: 5px;
  width: 100%;
  min-width: 0;
}

header {
  height: 70px;
  display: flex;
  align-items: center;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  gap: 48px;
  background: #11151d;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  color: #edf1f9;
}

.brand b {
  letter-spacing: 2px;
  font-size: 14px;
}

.brand b > span {
  font-weight: 400;
  letter-spacing: 3px;
  display: block;
  font-size: 9px;
  margin-top: 3px;
  color: var(--muted);
}

.mark {
  background: #a9c0f9;
  color: #111b33;
  font-size: 24px;
  font-weight: 800;
  width: 35px;
  height: 35px;
  border-radius: 7px;
  text-align: center;
  line-height: 35px;
}

.mark > span {
  font-size: 17px;
  margin-left: -8px;
}

nav {
  display: flex;
  align-self: stretch;
  gap: 25px;
}

nav button {
  background: none;
  border: 0;
  border-radius: 0;
  color: var(--muted);
  padding: 0 4px;
}

nav .active {
  color: #c3d3fb;
  border-bottom: 2px solid #a9c0f9;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}

.status-dot {
  display: inline-block;
  border-radius: 50%;
  width: 6px;
  height: 6px;
  background: #69b69f;
}

.sessionbar {
  padding: 24px 26px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 2.2px;
  color: #91a4c5;
}

h1 {
  font-size: 23px;
  font-weight: 500;
  letter-spacing: -0.6px;
  margin: 7px 0 0;
}

h1 span {
  color: #6f7b90;
}

.session-actions {
  display: flex;
  align-items: center;
  gap: 22px;
}

.session-actions > span {
  color: var(--muted);
  font-size: 11px;
}

.primary {
  background: #adbef0;
  color: #10192f;
  border-color: #adbef0;
  font-weight: 650;
}

.primary:hover {
  background: #c1cef5;
}

.notice {
  margin: 0 26px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #473c27;
  background: #201e1a;
  color: #c5b68b;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 11px;
}

.notice button {
  margin-left: auto;
  padding: 3px 6px;
  color: #dac899;
  background: none;
  border: 0;
  white-space: nowrap;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: 16px;
  padding: 0 26px;
}

.chart-card {
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #141922;
  height: 590px;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 54px;
  padding: 10px 14px;
  flex-wrap: wrap;
}

.instrument {
  display: flex;
  align-items: center;
  gap: 8px;
}

.instrument > b {
  font-size: 15px;
}

.instrument > span:not(.badge):not(.flag) {
  color: var(--muted);
  font-size: 11px;
}

.flag {
  color: #d8b978;
}

.badge {
  font-size: 9px;
  letter-spacing: 0.6px;
  border-radius: 4px;
  padding: 5px 6px;
  background: #252b38;
  color: #9ca9bf;
  white-space: nowrap;
}

.tools {
  display: flex;
  gap: 5px;
  align-items: center;
}

.tools button,
.tools select {
  font-size: 10px;
  padding: 6px 8px;
  width: auto;
}

.selected {
  border-color: #627ca8 !important;
  color: #bbcff4;
}

.chart-meta {
  display: flex;
  gap: 16px;
  background: #7d7e7f;
  padding: 10px 15px 0;
  font-family: ui-monospace, monospace;
  font-size: 10px;
  color: #171b20;
}

.chart-meta > span:last-child {
  margin-left: auto;
}

.canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 240px;
  background: #7d7e7f;
}

canvas#chart {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.chart-watermark {
  position: absolute;
  right: 90px;
  top: 28px;
  color: #00000010;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 4px;
  pointer-events: none;
}

.chart-watermark span {
  display: block;
  font-size: 8px;
  letter-spacing: 3px;
  text-align: right;
}

#chartHint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  background: #15191edb;
  color: #b6bdca;
  border-radius: 20px;
  padding: 8px 13px;
  pointer-events: none;
  white-space: nowrap;
}

#loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #131923;
  color: #b5c5e2;
}

.replaybar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  min-height: 62px;
}

.replay-left {
  display: flex;
  gap: 5px;
}

.replay-left button {
  white-space: nowrap;
}

.replay-left select {
  width: auto;
  font-size: 11px;
}

kbd {
  font-size: 10px;
  color: #7b899f;
  margin-left: 10px;
}

.progress {
  flex: 1;
  max-width: 240px;
  font-size: 9px;
  letter-spacing: 1px;
  color: #8390a7;
}

.progress > div {
  height: 3px;
  background: #2b3240;
  margin-top: 7px;
}

.progress i {
  display: block;
  width: 0;
  height: 100%;
  background: #a3bbe8;
}

#reveal {
  margin-left: auto;
  font-size: 10px;
  background: none;
  padding: 5px 8px;
}

aside {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel {
  padding: 17px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 17px;
}

.panel-heading h2 {
  font-weight: 550;
  font-size: 13px;
  margin: 0;
}

.panel-heading > span:not(.badge) {
  color: #8d97a9;
  font-size: 10px;
}

.quote {
  margin-bottom: 18px;
}

.quote > span {
  display: block;
  font-size: 28px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
}

.quote small {
  color: #8390a7;
  font-size: 10px;
}

label {
  display: block;
  font-size: 10px;
  color: #99a5b9;
  margin-bottom: 12px;
}

label > input,
label > select,
label > textarea {
  display: block;
  margin-top: 7px;
  font-size: 12px;
}

.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.riskline {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
  margin: 0 0 17px;
}

.riskline b {
  display: block;
  margin-top: 5px;
  font-size: 13px;
  color: #c4cedd;
  font-weight: 500;
}

.trade-buttons button {
  text-align: left;
  font-weight: 650;
  font-size: 14px;
  padding: 12px;
}

.trade-buttons small {
  font-size: 10px;
  float: right;
  font-weight: 400;
  margin-top: 2px;
}

.buy {
  background: #20463f;
  border-color: #3b7061;
  color: #a0d9c8;
}

.sell {
  background: #462d32;
  border-color: #70424a;
  color: #e6a9b3;
}

.wide {
  width: 100%;
  margin-top: 9px;
  font-size: 11px;
  background: transparent;
}

.micro {
  font-size: 10px;
  color: #8590a3;
  line-height: 1.6;
  margin-bottom: 0;
}

.account-row {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  font-size: 11px;
  color: var(--muted);
}

.account-row b {
  font-weight: 500;
  color: #dce2eb;
  font-variant-numeric: tabular-nums;
}

.account-row.total {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  font-size: 13px;
}

.text-btn {
  background: none;
  border: 0;
  padding: 0;
  font-size: 10px;
  color: #9fb6e3;
}

.level-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 13px 0;
  font-size: 11px;
}

.level-row i {
  width: 16px;
  border-top: 1px dashed #b8c4d6;
}

.level-row span {
  color: #8793a7;
  font-size: 10px;
}

.level-row b {
  font-weight: 450;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.blotter {
  grid-column: 1;
  min-height: 180px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.blotter-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 0 16px;
}

.tab {
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--muted);
  padding: 14px 4px;
  margin-right: 18px;
  font-size: 11px;
}

.tab.active {
  border-bottom: 2px solid #acbee8;
  color: #d6e0f5;
}

.tab span {
  font-size: 10px;
  background: #2a3241;
  padding: 1px 5px;
  margin-left: 6px;
  border-radius: 3px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  font-size: 11px;
}

th {
  text-align: left;
  color: #7e8ba0;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.5px;
  padding: 12px;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid #252b36;
}

td button {
  font-size: 9px;
  padding: 4px 6px;
  margin-right: 4px;
}

#emptyState {
  text-align: center;
  color: #9aa6b8;
  padding: 28px;
  font-size: 12px;
}

#emptyState > span {
  display: block;
  color: #647188;
  font-size: 10px;
  margin-top: 8px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 17px 26px;
  color: #637088;
  font-size: 10px;
}

footer .status-dot {
  margin-right: 6px;
}

.positive {
  color: #8fc9b7 !important;
}

.negative {
  color: #e5a2ad !important;
}

dialog {
  border: 1px solid #353d4d;
  border-radius: 12px;
  background: #171c26;
  color: #dce2eb;
  width: min(760px, 94vw);
  max-height: 90vh;
  padding: 24px;
  box-shadow: 0 30px 120px #0008;
}

dialog::backdrop {
  background: #060a11bb;
  backdrop-filter: blur(4px);
}

.modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-top h2 {
  font-size: 22px;
  letter-spacing: -0.5px;
  font-weight: 550;
  margin: 0;
}

.modal-top button {
  font-size: 22px;
  background: none;
  border: 0;
  padding: 0 4px;
}

.modal-intro {
  color: #97a5bd;
  line-height: 1.7;
  font-size: 12px;
  margin: 0 0 22px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 22px;
}

.settings-grid label {
  font-size: 11px;
}

.check {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  margin: 12px 0;
}

.check input {
  width: auto;
  margin: 0;
}

.section-title {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: #9cb2d4;
  border-top: 1px solid #303744;
  padding-top: 20px;
  margin-top: 22px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat {
  background: #10151e;
  border-radius: 7px;
  padding: 17px;
  text-align: center;
}

.stat b {
  font-size: 22px;
  font-weight: 550;
  display: block;
}

.stat small {
  display: block;
  font-size: 9px;
  color: #8b98ad;
  text-transform: uppercase;
  margin-top: 7px;
  letter-spacing: 0.6px;
}

.equity-chart {
  background: #10151e;
  border-radius: 7px;
  height: 150px;
  width: 100%;
  margin-top: 12px;
}

.data-box {
  border: 1px dashed #4e5f7d;
  border-radius: 8px;
  padding: 24px;
  margin: 14px 0;
  background: #131a25;
}

.data-box input {
  margin-top: 15px;
}

.data-note {
  padding: 12px;
  background: #232a37;
  color: #acbad1;
  line-height: 1.7;
  font-size: 11px;
  border-radius: 6px;
}

.guide-table td {
  white-space: normal;
  line-height: 1.6;
  font-size: 12px;
}

.guide-table th {
  font-size: 11px;
}

#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  padding: 13px 20px;
  background: #25334c;
  color: #d9e5fc;
  border: 1px solid #60789c;
  border-radius: 8px;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  max-width: 90vw;
  transition: opacity 0.15s;
}

.journal-notes {
  margin-top: 20px;
}

.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 15px;
}

.filters button.active {
  background: #34425c;
}

.dark-chart .canvas-wrap,
.dark-chart .chart-meta {
  background: #0e1219;
  color: #aab5c8;
}

.dark-chart .chart-watermark {
  color: #ffffff08;
}

@media (min-width: 1600px) {
  .chart-card {
    height: 650px;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr) 310px;
  }

  .sessionbar {
    padding-top: 28px;
    padding-bottom: 24px;
  }
}

@media (max-width: 1100px) {
  header {
    gap: 20px;
    padding: 0 16px;
  }

  .header-right > span {
    display: none;
  }

  .layout {
    padding: 0 16px;
    grid-template-columns: minmax(0, 1fr) 260px;
  }

  .sessionbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .session-actions > span {
    display: none;
  }

  .notice {
    margin-left: 16px;
    margin-right: 16px;
  }

  .instrument > span:not(.badge):not(.flag) {
    display: none;
  }

  .chart-card {
    height: 620px;
  }

  .tools {
    flex-wrap: wrap;
  }

  .replaybar {
    flex-wrap: wrap;
  }

  .replaybar .badge {
    display: none;
  }

  h1 {
    font-size: 19px;
  }
}

@media (max-width: 780px) {
  header {
    gap: 15px;
  }

  .brand b {
    font-size: 11px;
  }

  nav {
    display: none;
  }

  .sessionbar {
    align-items: flex-start;
  }

  .sessionbar h1 span {
    display: none;
  }

  .session-actions button {
    font-size: 10px;
  }

  .layout {
    display: flex;
    flex-direction: column;
  }

  aside {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .order {
    grid-row: span 2;
  }

  .chart-card {
    height: 530px;
  }

  .header-right button {
    font-size: 10px;
  }

  .notice {
    line-height: 1.6;
  }

  .notice > span:first-child {
    display: none;
  }

  footer > span:nth-child(2) {
    display: none;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .chart-meta {
    gap: 6px;
    font-size: 9px;
  }

  #ohlc {
    display: none;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .progress {
    min-width: 50px;
  }

  #chartHint {
    font-size: 8px;
  }
}

@media (max-width: 480px) {
  aside {
    display: flex;
  }

  .header-right button {
    padding: 7px;
  }

  .chart-toolbar {
    padding: 8px;
  }

  .badge {
    display: none;
  }

  .sessionbar h1 {
    font-size: 16px;
  }

  .eyebrow {
    font-size: 8px;
  }

  .chart-card {
    height: 480px;
  }

  .replaybar {
    gap: 6px;
    padding: 8px;
  }

  .progress {
    display: none;
  }
}

@media (min-width: 781px) {
  .layout {
    grid-template-rows: 590px auto;
    align-items: start;
  }
}

@media (min-width: 1600px) {
  .layout {
    grid-template-rows: 650px auto;
  }
}

@media (min-width: 781px) and (max-width: 1100px) {
  .layout {
    grid-template-rows: 620px auto;
  }
}

body:not(.dark-chart) .canvas-wrap,
body:not(.dark-chart) .chart-meta {
  background: #fff;
  color: #273244;
}

.third-toggle {
  display: flex;
  align-items: center;
  margin: 0;
  gap: 4px;
}

.third-toggle input {
  width: auto;
  margin: 0;
}

.mini-trade {
  display: flex;
  gap: 5px;
}

.chart-full .chart-card {
  position: fixed;
  inset: 0;
  z-index: 10;
  width: 100vw;
  height: 100dvh;
  border-radius: 0;
}

.chart-full {
  overflow: hidden;
}

.entry-choices {
  display: grid;
  gap: 12px;
}

.entry-choices button {
  text-align: left;
  font-size: 17px;
  padding: 18px;
}

.entry-choices small {
  display: block;
  font-size: 12px;
  color: #9aa8bf;
  margin-top: 7px;
}

body:not(.dark-chart) .chart-watermark {
  color: #00000008;
}

#notice {
  display: none;
}

body:not(.dark-chart) .canvas-wrap,
body:not(.dark-chart) .chart-meta {
  background: #e7e8e9;
}

#quickMenu {
  position: fixed;
  z-index: 30;
  width: 245px;
  padding: 14px;
  background: #1b2330;
  border: 1px solid #46536a;
  border-radius: 9px;
  box-shadow: 0 8px 30px #0005;
}

#quickMenu[hidden] {
  display: none;
}

.quick-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.quick-heading button {
  padding: 0 6px;
  border: 0;
  background: none;
  font-size: 20px;
}

#quickMenu .entry-choices {
  gap: 6px;
}

#quickMenu .entry-choices button {
  padding: 10px;
  font-size: 12px;
}

#quickMenu label {
  margin-bottom: 12px;
}

#symbolLabel {
  width: 140px;
  font-weight: 650;
  padding: 6px;
}

.brand-logo {
  width: 46px;
  height: 42px;
  object-fit: contain;
}

.tools {
  flex-wrap: wrap;
}

#fullWindow {
  min-width: 34px;
  padding: 5px 8px;
  font-size: 20px;
  line-height: 1;
}

#nextChart {
  white-space: nowrap;
}
