:root {
  color-scheme: dark;
  --bg: #0c1016;
  --panel: #141a23;
  --raised: #1c2430;
  --line: #2a3442;
  --text: #edf3fa;
  --muted: #a5b1c2;
  --mint: #48dbbd;
  --red: #ff8b9a;
  font-family: "Segoe UI",Arial,sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

*,*::before,*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 300px;
}

button,input,select {
  font: inherit;
  color: inherit;
}

button,select {
  cursor: pointer;
}

button {
  border: 0;
}

button:disabled {
  cursor: not-allowed;
  opacity: .44;
}

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

button:not(:disabled):active {
  transform: translateY(1px);
}

[hidden] {
  display: none!important;
}

.symbol-defs,.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.topbar {
  height: 62px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 clamp(16px,2.5vw,44px);
  background: #10151d;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 19px;
  font-weight: 770;
  letter-spacing: .09em;
}

.brand svg {
  width: 27px;
  height: 27px;
  color: var(--mint);
}

.product,.server-name {
  font-size: 13px;
  color: var(--muted);
}

.product {
  border-left: 1px solid var(--line);
  padding-left: 18px;
}

.account-tools {
  margin-left: auto;
  display: flex;
  gap: 15px;
  align-items: center;
}

.account-chip,.symbol-label,.count {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 12px;
  color: var(--muted);
}

.account-chip b {
  color: var(--text);
  font-weight: 600;
}

.quiet {
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 6px 10px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
}

.quiet:hover {
  background: #283445;
}

.quiet svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
}

.login-screen {
  min-height: calc(100vh - 62px);
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background: radial-gradient(ellipse at 50% 30%,#192630 0%,var(--bg) 59%);
}

.login-card {
  width: min(100%,420px);
  padding: 35px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 80px #0004;
}

.login-mark {
  color: var(--mint);
  width: 38px;
  height: 38px;
}

.login-card h1 {
  margin: 16px 0 26px;
  font-size: 27px;
  font-weight: 650;
  letter-spacing: -.04em;
}

label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
}

.login-card label {
  margin: 17px 0 7px;
}

.login-card input,.login-card select {
  width: 100%;
  border: 1px solid #364251;
  background: #0f151d;
  border-radius: 5px;
  padding: 11px 12px;
  height: 44px;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 75px;
}

.password-wrap button {
  position: absolute;
  inset: 4px 4px 4px auto;
  background: none;
  color: var(--muted);
  font-size: 12px;
  padding: 0 10px;
}

.help {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  margin: 10px 0 22px;
}

.primary {
  width: 100%;
  padding: 12px 14px;
  border-radius: 5px;
  background: var(--mint);
  color: #082a24;
  font-weight: 700;
  text-align: left;
  display: flex;
  justify-content: space-between;
}

.primary:hover {
  background: #6fe6ce;
}

.primary span {
  font-size: 19px;
  line-height: 1;
}

.terminal {
  max-width: 1960px;
  margin: auto;
  padding: 16px clamp(12px,2vw,32px) 22px;
  display: grid;
  gap: 12px;
}

.account-summary {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  padding: 15px 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.account-summary>div {
  padding: 0 clamp(12px,2vw,30px);
  min-width: 0;
}

.account-summary>div+div {
  border-left: 1px solid var(--line);
}

.account-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.account-summary strong {
  font-size: clamp(15px,1.55vw,23px);
  font-weight: 620;
  letter-spacing: -.02em;
  white-space: nowrap;
}

#guest-actions {margin-left:auto;display:flex;align-items:center;gap:12px;font-size:11px}
#guest-actions[hidden],#guest-dismiss[hidden] {display:none}
#guest-login,#guest-dismiss {min-height:24px;padding:2px 10px}
#guest-dismiss {position:fixed;top:8px;right:10px;z-index:5}
#terminal[data-guest=true] .account-summary {visibility:hidden}
#terminal .ticket #guest-estimate-basis {grid-column:1/-1;color:var(--dim);font-size:10px}
#terminal[data-guest=true] .account-summary * {visibility:hidden}
#terminal[data-guest=true] .positions-toolbar {visibility:hidden}
.account-summary strong,.watch td,.positions-table td,.trade-actions strong,.spread,.lot-control,.table-wrap,.account-chip {
  font-variant-numeric: tabular-nums;
}

.desk {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(238px,286px);
  gap: 12px;
  align-items: stretch;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  min-width: 0;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
}

h1,h2,p {
  margin: 0;
}

.panel-head h2 {
  font-size: 14px;
  font-weight: 630;
  letter-spacing: -.01em;
}

.chart-panel {
  display: flex;
  flex-direction: column;
  min-height: 400px;
  height: clamp(410px,57vh,780px);
}

.chart-head {
  justify-content: space-between;
}

.instrument-name {
  display: flex;
  gap: 12px;
  align-items: baseline;
}

.instrument-name h1 {
  font-size: 19px;
  letter-spacing: -.04em;
}

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

.quote-status {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.quote-status:before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.quote-status.fresh {
  color: var(--mint);
}

#price-chart {
  display: block;
  width: 100%;
  flex: 1;
  min-height: 0;
  border: 0;
  background: var(--panel);
}

.side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.order-panel {
  flex: 1;
}

.order-panel .panel-head {
  justify-content: space-between;
}

.ticket {
  padding: 17px 14px;
}

.lot-control {
  display: flex;
  align-items: center;
  margin: 8px 0 16px;
  border: 1px solid #384658;
  background: #0e141c;
  border-radius: 5px;
  overflow: hidden;
}

.lot-control input {
  width: 100%;
  min-width: 0;
  border: none;
  background: none;
  font-size: 15px;
  font-weight: 600;
  text-align: right;
  padding: 9px 5px;
}

.lot-control span {
  font: 12px "Segoe UI",sans-serif;
  color: var(--muted);
  padding-right: 12px;
}

.lot-control button {
  width: 31px;
  flex: none;
  align-self: stretch;
  background: var(--raised);
  color: var(--muted);
  font-size: 18px;
}

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

.trade-actions button {
  border-radius: 5px;
  padding: 11px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  min-height: 62px;
}

.sell {
  background: #6d273a;
  color: #ffdae0;
}

.buy {
  background: #086351;
  color: #d7fff5;
}

.sell:not(:disabled):hover {
  background: #803047;
}

.buy:not(:disabled):hover {
  background: #08765f;
}

.trade-actions span {
  font-size: 12px;
  font-weight: 650;
}

.trade-actions strong {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -.025em;
}

.spread {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 1px;
  color: var(--muted);
  font-size: 12px;
}

.spread strong {
  font-weight: 500;
  color: var(--text);
}

.message {
  padding: 9px 11px;
  border-left: 2px solid var(--mint);
  background: #182d2b;
  color: #cdeee5;
  font-size: 12px;
  line-height: 1.5;
  margin: 6px 0;
}

.message.error {
  border-color: var(--red);
  color: #ffd2dc;
  background: #35202a;
}

.positions-panel {
  min-height: 119px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 550;
  white-space: nowrap;
  background: #10161e;
}

th,td {
  padding: 8px 15px;
  white-space: nowrap;
}

tbody tr+tr {
  border-top: 1px solid var(--line);
}

.watch th,.watch td {
  padding: 8px 10px;
  text-align: right;
}

.watch th:first-child,.watch td:first-child {
  text-align: left;
  padding-left: 14px;
}

.watch td {
  font-weight: 600;
  font-size: 13px;
}

.watch tbody tr {
  box-shadow: inset 2px 0 var(--mint);
  background: #17212a;
}

.positive {
  color: var(--mint);
}

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

.empty {
  text-align: center;
  padding: 18px;
  color: var(--muted);
  font-size: 13px;
}

.count {
  padding: 1px 6px;
  color: var(--text);
}

.positions-table td:last-child {
  text-align: right;
}

.positions-table td:first-child {
  font-weight: 650;
}

.login-card .quiet {
  margin-bottom: 12px;
}

@media(max-width:850px) {
  .terminal {
    padding: 10px;
    gap: 8px;
  }
  .desk {
    grid-template-columns: minmax(0,1fr) 235px;
    gap: 8px;
  }
  .side {
    gap: 8px;
  }
  .topbar {
    padding: 0 12px;
    gap: 10px;
  }
  .product {
    padding-left: 10px;
  }
  .instrument-name span {
    display: none;
  }
  .account-tools {
    gap: 8px;
  }
  .chart-panel {
    height: 430px;
  }
  .trade-actions strong {
    font-size: 16px;
  }
}

@media(max-width:650px) {
  .product,.server-name {
    display: none;
  }
  .topbar {
    height: 52px;
  }
  .account-summary {
    grid-template-columns: repeat(2,minmax(0,1fr));
    row-gap: 13px;
    padding: 12px 0;
  }
  .account-summary>div:nth-child(3) {
    border: 0;
  }
  .desk {
    display: flex;
    flex-direction: column;
  }
  .chart-panel {
    height: 375px;
    min-height: 330px;
  }
  .side {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    align-items: start;
  }
  .panel-head {
    padding: 10px;
    gap: 6px;
  }
  .ticket {
    padding: 12px 8px;
  }
  .watch td,.watch th {
    padding: 6px 3px;
    font-size: 11px;
  }
  .watch td:first-child,.watch th:first-child {
    padding-left: 5px;
  }
  .symbol-label {
    display: none;
  }
  .trade-actions {
    gap: 5px;
  }
  .trade-actions strong {
    font-size: 14px;
  }
  .login-card {
    padding: 26px;
  }
  .login-screen {
    min-height: calc(100vh - 52px);
  }
}

@media(max-width:470px) {
  .side {
    display: flex;
  }
  .chart-panel {
    height: 340px;
  }
  .watch td,.watch th {
    padding: 6px 12px;
  }
  .trade-actions button {
    min-height: 50px;
  }
  .account-tools {
    gap: 6px;
  }
  .brand {
    font-size: 16px;
  }
}

#demo-fill {
  margin: 12px 0 17px;
}
