/* ORZENO demo kit — Forex Pro margin terminal (mt.js). Colours, fonts and radii come from --d-* tokens only. */

.mt {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) 304px;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    'c r'
    'c l';
  align-items: start;
}
.mt [hidden] {
  display: none !important;
}
.mt :focus-visible {
  outline: 2px solid var(--d-accent);
  outline-offset: 2px;
}
.mt-l,
.mt-c,
.mt-r {
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
}
.mt-l {
  grid-area: l;
}
.mt-c {
  grid-area: c;
}
.mt-r {
  grid-area: r;
}
.mt-vh {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.mt-hmeta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--d-muted);
}

/* ---------- market watch ---------- */
.mt-search {
  padding: 10px 12px 8px;
}
.mt-search input {
  text-align: left;
}
.mt-wh,
.mt-row {
  display: grid;
  grid-template-columns: minmax(64px, 1fr) 62px 62px 30px;
  gap: 8px;
  align-items: center;
}
.mt-wh {
  padding: 6px 12px;
  border-top: 1px solid var(--d-line-2);
  border-bottom: 1px solid var(--d-line-2);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--d-muted);
}
.mt-wh span:not(:first-child),
.mt-row > span:not(:first-child) {
  text-align: right;
}
.mt-row {
  width: 100%;
  min-height: 46px;
  padding: 4px 12px;
  border: 0;
  border-bottom: 1px solid var(--d-line-2);
  border-left: 2px solid transparent;
  background: none;
  color: inherit;
  font: inherit;
  font-family: var(--d-font-mono);
  font-size: 0.78rem;
  text-align: left;
  cursor: pointer;
}
.mt-row:last-child {
  border-bottom: 0;
}
.mt-row:hover {
  background: var(--d-line-2);
}
.mt-row.is-on {
  border-left-color: var(--d-accent);
  background: color-mix(in srgb, var(--d-accent) 12%, transparent);
}
.mt-rs {
  display: grid;
  gap: 1px;
  min-width: 0;
}
.mt-rs b {
  font-family: var(--d-font-body);
  font-size: 0.86rem;
  font-weight: 600;
}
.mt-rs small {
  font-size: 0.68rem;
}
.mt-tickup {
  color: var(--d-up);
  animation: mt-flash-up 0.7s var(--d-ease);
}
.mt-tickdn {
  color: var(--d-down);
  animation: mt-flash-dn 0.7s var(--d-ease);
}
@keyframes mt-flash-up {
  from {
    background: color-mix(in srgb, var(--d-up) 30%, transparent);
  }
  to {
    background: transparent;
  }
}
@keyframes mt-flash-dn {
  from {
    background: color-mix(in srgb, var(--d-down) 30%, transparent);
  }
  to {
    background: transparent;
  }
}

/* ---------- navigator ---------- */
.mt-navb {
  display: grid;
  gap: 10px;
}
.mt-navkv dd {
  font-size: 0.82rem;
}
.mt-navh {
  margin-top: 4px;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--d-muted);
}
.mt-checks {
  display: grid;
  list-style: none;
  margin: 0;
  padding: 0;
}
.mt-checks label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  font-size: 0.86rem;
  cursor: pointer;
}
.mt-checks input {
  width: 18px;
  height: 18px;
  accent-color: var(--d-accent);
}
.mt-ea {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--d-line);
  border-radius: var(--d-radius-sm);
  color: var(--d-text);
  font-size: 0.86rem;
  text-decoration: none;
}
.mt-ea span {
  flex: 1;
}
.mt-ea:hover {
  border-color: var(--d-accent);
  color: var(--d-accent);
}

/* ---------- account bar ---------- */
.mt-acctrow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}
.mt-acctrow > div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 10px 14px;
  border-right: 1px solid var(--d-line-2);
  border-bottom: 1px solid var(--d-line-2);
}
.mt-acctrow dt {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--d-muted);
}
.mt-acctrow dd {
  margin: 0;
  font-family: var(--d-font-mono);
  font-size: 0.98rem;
  white-space: nowrap;
}

/* ---------- chart ---------- */
.mt-sym {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.mt-sym small {
  font-size: 0.74rem;
  font-weight: 400;
}
.mt-quotes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  font-family: var(--d-font-mono);
  font-size: 0.86rem;
}
.mt-quotes > span {
  display: grid;
  gap: 1px;
}
.mt-quotes small {
  font-family: var(--d-font-body);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--d-muted);
}
.mt-quotes b {
  font-weight: 500;
}
.mt-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--d-line-2);
}
.mt-tools .seg,
.mt-hseg {
  grid-auto-columns: auto;
  max-width: 100%;
}
.mt-inds {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mt-inds .btn[aria-pressed='true'] {
  background: color-mix(in srgb, var(--d-accent) 14%, transparent);
}
.mt-plotwrap {
  position: relative;
  min-width: 0;
}
.mt-plot {
  height: clamp(320px, 48vh, 540px);
  overflow: hidden;
  touch-action: pan-y;
}
.mt-svg {
  display: block;
}
.mt-svg text {
  font-family: var(--d-font-mono);
  font-size: 10px;
}
.mt-line {
  fill: none;
  stroke: var(--d-accent);
  stroke-width: 1.6;
}
.mt-area {
  fill: color-mix(in srgb, var(--d-accent) 14%, transparent);
  stroke: none;
}
.mt-ma20,
.mt-ma50,
.mt-rsi,
.mt-bbl,
.mt-bbm,
.mt-sep,
.mt-rsig {
  fill: none;
}
.mt-ma20 {
  stroke: var(--d-accent-2);
  stroke-width: 1.4;
}
.mt-ma50 {
  stroke: var(--d-warn);
  stroke-width: 1.4;
}
.mt-bbl {
  stroke: color-mix(in srgb, var(--d-text) 50%, transparent);
  stroke-dasharray: 2 3;
}
.mt-bbm {
  stroke: color-mix(in srgb, var(--d-text) 26%, transparent);
}
.mt-rsi {
  stroke: var(--d-accent-2);
  stroke-width: 1.3;
}
.mt-rsig {
  stroke: var(--d-line);
  stroke-dasharray: 2 4;
}
.mt-sep {
  stroke: var(--d-line);
}
.mt-lv path {
  fill: none;
  stroke-width: 1;
  stroke-dasharray: 6 4;
}
.mt-lv--buy path,
.mt-lv--tp path {
  stroke: var(--d-up);
}
.mt-lv--buy text,
.mt-lv--tp text {
  fill: var(--d-up);
}
.mt-lv--sell path,
.mt-lv--sl path {
  stroke: var(--d-down);
}
.mt-lv--sell text,
.mt-lv--sl text {
  fill: var(--d-down);
}
.mt-lv--sl path,
.mt-lv--tp path {
  stroke-dasharray: 2 4;
}
.mt-lv--pend path {
  stroke: var(--d-warn);
}
.mt-lv--pend text {
  fill: var(--d-warn);
}
.mt-lv--bid path,
.mt-lv--ask path {
  stroke-dasharray: none;
  stroke-opacity: 0.55;
}
.mt-lv--bid path {
  stroke: var(--d-down);
}
.mt-lv--ask path {
  stroke: var(--d-up);
}
.mt-lv--bid rect {
  fill: var(--d-down);
}
.mt-lv--ask rect {
  fill: var(--d-up);
}
.mt-lv .mt-lvt {
  fill: var(--d-bg);
  font-weight: 600;
}
.mt-cross path {
  fill: none;
  stroke: var(--d-muted);
  stroke-dasharray: 3 3;
}
.mt-cross rect {
  fill: var(--d-text);
}
.mt-cross text {
  fill: var(--d-bg);
}
.mt-read {
  position: absolute;
  top: 12px;
  right: 80px;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 2px 12px;
  max-width: calc(100% - 330px);
  margin: 0;
  font-family: var(--d-font-mono);
  font-size: 0.74rem;
  color: var(--d-muted);
  pointer-events: none;
}
.mt-read b {
  font-weight: 500;
  color: var(--d-text);
}
.mt-read b.up {
  color: var(--d-up);
}
.mt-read b.down {
  color: var(--d-down);
}

/* one-click panel over the chart */
.mt-oc {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: flex;
  align-items: stretch;
  border: 1px solid var(--d-line);
  border-radius: var(--d-radius-sm);
  background: color-mix(in srgb, var(--d-panel) 92%, transparent);
  overflow: hidden;
}
.mt-ocb {
  display: grid;
  gap: 1px;
  justify-items: center;
  align-content: center;
  min-width: 84px;
  min-height: 46px;
  padding: 4px 10px;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}
.mt-ocb small {
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.mt-ocb b {
  font-family: var(--d-font-mono);
  font-size: 0.86rem;
  font-weight: 600;
}
.mt-ocb--sell {
  color: var(--d-down);
}
.mt-ocb--buy {
  color: var(--d-up);
}
.mt-ocb--sell:hover {
  background: color-mix(in srgb, var(--d-down) 16%, transparent);
}
.mt-ocb--buy:hover {
  background: color-mix(in srgb, var(--d-up) 16%, transparent);
}
.mt-oc.is-armed .mt-ocb--sell {
  background: var(--d-down);
  color: var(--d-bg);
}
.mt-oc.is-armed .mt-ocb--buy {
  background: var(--d-up);
  color: var(--d-bg);
}
.mt-ocl {
  display: flex;
  border-left: 1px solid var(--d-line);
  border-right: 1px solid var(--d-line);
}
.mt-ocl input {
  width: 66px;
  min-height: 44px;
  padding: 0 6px;
  border: 0;
  background: var(--d-inset);
  color: var(--d-text);
  font-family: var(--d-font-mono);
  font-size: 0.86rem;
  text-align: center;
}

/* ---------- toolbox ---------- */
.mt-tabs {
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 4px 8px 0;
  border-bottom: 1px solid var(--d-line-2);
  overflow-x: auto;
}
.mt-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--d-muted);
  font: inherit;
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}
.mt-tabs button:hover {
  color: var(--d-text);
}
.mt-tabs button[aria-selected='true'] {
  border-bottom-color: var(--d-accent);
  color: var(--d-text);
}
.mt-tabs .tag {
  min-height: 18px;
  padding: 0 6px;
}
.mt-tabsim {
  display: inline-flex;
  align-items: center;
  flex: none;
  margin-left: auto;
  padding: 0 6px;
}
.mt-tabbody {
  min-height: 190px;
}
.mt-tabbody .tbl-wrap {
  max-height: 340px;
  overflow: auto;
}
.mt-tbl th:first-child {
  text-align: left;
}
.mt-tbl thead th {
  position: sticky;
  top: 0;
  background: var(--d-panel);
}
.mt-tbl thead .btn {
  min-height: 30px;
  letter-spacing: 0;
  text-transform: none;
}
.mt-tbl tfoot td {
  padding: 10px 12px;
  border-top: 1px solid var(--d-line-2);
  font-family: var(--d-font-body);
  font-size: 0.8rem;
  text-align: left;
  white-space: normal;
  color: var(--d-muted);
}
.mt-tbl tfoot b {
  font-family: var(--d-font-mono);
  font-weight: 500;
  color: var(--d-text);
}
.mt-tbl tfoot b.up {
  color: var(--d-up);
}
.mt-tbl tfoot b.down {
  color: var(--d-down);
}
.mt-acts .btn + .btn {
  margin-left: 6px;
}
.mt-hbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--d-line-2);
}
.mt-pad {
  padding: 10px 14px;
}
.mt-journal {
  max-height: 340px;
  margin: 0;
  padding: 4px 14px;
  list-style: none;
  overflow: auto;
}
.mt-journal li {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--d-line-2);
  font-size: 0.84rem;
}
.mt-journal li:last-child {
  border-bottom: 0;
}
.mt-journal .num {
  font-family: var(--d-font-mono);
  color: var(--d-muted);
}

/* ---------- order ticket ---------- */
.mt-ticket,
.mt-mod {
  display: grid;
  gap: 12px;
}
.mt-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 0.74rem;
  color: var(--d-muted);
  cursor: pointer;
}
.mt-switch input {
  appearance: none;
  position: relative;
  flex: none;
  width: 40px;
  height: 22px;
  margin: 0;
  border: 1px solid var(--d-line);
  border-radius: var(--d-radius);
  background: var(--d-inset);
  cursor: pointer;
  transition: background 0.2s var(--d-ease);
}
.mt-switch input::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: var(--d-radius-sm);
  background: var(--d-muted);
  transition: transform 0.2s var(--d-ease);
}
.mt-switch input:checked {
  border-color: var(--d-accent);
  background: color-mix(in srgb, var(--d-accent) 30%, transparent);
}
.mt-switch input:checked::after {
  background: var(--d-accent);
  transform: translateX(18px);
}
.mt-switch input:checked + span {
  color: var(--d-text);
}
.mt-step {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 6px;
}
.mt-step .btn {
  padding: 0;
  font-size: 1.1rem;
}
.mt-step input {
  text-align: center;
}
.mt-quick {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
}
.mt-quick .btn {
  padding: 0;
  font-family: var(--d-font-mono);
}
.mt-stops .note {
  font-size: 0.7rem;
}
.mt-alert {
  margin: 0;
  font-size: 0.84rem;
  color: var(--d-down);
}
.mt-alert:empty {
  display: none;
}
.mt-sides {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.mt-side {
  display: grid;
  gap: 3px;
  justify-items: center;
  align-content: center;
  min-height: 68px;
  padding: 8px;
  border: 1px solid;
  border-radius: var(--d-radius-sm);
  font: inherit;
  cursor: pointer;
  transition: background 0.2s var(--d-ease);
}
.mt-side small {
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.mt-side b {
  font-family: var(--d-font-mono);
  font-size: 1.14rem;
  font-weight: 600;
}
.mt-side--sell {
  border-color: color-mix(in srgb, var(--d-down) 70%, transparent);
  background: color-mix(in srgb, var(--d-down) 14%, transparent);
  color: var(--d-down);
}
.mt-side--buy {
  border-color: color-mix(in srgb, var(--d-up) 70%, transparent);
  background: color-mix(in srgb, var(--d-up) 14%, transparent);
  color: var(--d-up);
}
.mt-side--sell:hover {
  background: color-mix(in srgb, var(--d-down) 26%, transparent);
}
.mt-side--buy:hover {
  background: color-mix(in srgb, var(--d-up) 26%, transparent);
}
.mt-side:active,
.mt-ocb:active {
  transform: translateY(1px);
}
.mt-risk {
  margin-top: 14px;
}

/* ---------- desktop: watch | chart | ticket ---------- */
@media (min-width: 1320px) {
  .mt {
    grid-template-columns: 276px minmax(0, 1fr) 316px;
    grid-template-rows: auto;
    grid-template-areas: 'l c r';
  }
}
@media (min-width: 1760px) {
  .mt-acctrow {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .mt-acctrow > div {
    border-bottom: 0;
  }
  .mt-acctrow > div:last-child {
    border-right: 0;
  }
}
@media (max-width: 1759px) {
  .mt-acctrow > div:nth-child(3n) {
    border-right: 0;
  }
  .mt-acctrow > div:nth-last-child(-n + 3) {
    border-bottom: 0;
  }
}

/* ---------- phone: chart, ticket, market watch, toolbox ---------- */
@media (max-width: 760px) {
  .mt {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .mt-l,
  .mt-c,
  .mt-r {
    display: contents;
  }
  .mt-acct {
    order: 1;
  }
  .mt-chartp {
    order: 2;
  }
  .mt-ticketp {
    order: 3;
  }
  .mt-watch {
    order: 4;
  }
  .mt-box {
    order: 5;
  }
  .mt-nav {
    order: 6;
  }
  .mt-acctrow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mt-acctrow > div:nth-child(3n) {
    border-right: 1px solid var(--d-line-2);
  }
  .mt-acctrow > div:nth-child(2n) {
    border-right: 0;
  }
  .mt-acctrow > div:nth-last-child(-n + 3) {
    border-bottom: 1px solid var(--d-line-2);
  }
  .mt-acctrow > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
  .mt-acctrow dd {
    font-size: 0.9rem;
  }
  .mt .btn--sm,
  .mt .seg button,
  .mt-tbl thead .btn {
    min-height: 44px;
  }
  .mt-checks label {
    min-height: 44px;
  }
  .mt-oc,
  .mt-read {
    position: static;
  }
  .mt-oc {
    width: max-content;
    max-width: calc(100% - 20px);
    margin: 10px 10px 0;
  }
  .mt-ocb {
    min-width: 76px;
  }
  .mt-read {
    justify-content: flex-start;
    max-width: none;
    padding: 8px 12px 0;
  }
  .mt-plot {
    height: 300px;
  }
  .mt-tabbody .tbl-wrap,
  .mt-journal {
    max-height: 380px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mt-tickup,
  .mt-tickdn {
    animation: none;
  }
  .mt-switch input,
  .mt-switch input::after,
  .mt-side {
    transition: none;
  }
}
