/* ============================================================
   Azimuth Terminal · full-screen demo trading app
   Dark ledger theme derived from the site's terminal panel
   ============================================================ */

:root {
  --bg: #04231B;
  --panel: #052A20;
  --panel-2: #073B2C;
  --line: rgba(234, 243, 238, 0.09);
  --line-2: rgba(234, 243, 238, 0.16);
  --text: #EAF3EE;
  --text-hi: #F7FBF8;
  --muted: #8FB3A2;
  --muted-2: #6E9484;
  --up: #19C285;
  --up-soft: #8FE0BE;
  --down: #E2574C;
  --down-soft: #F0A9A2;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "SF Mono", Consolas, monospace;
  --ease: cubic-bezier(.22, .8, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background:
    radial-gradient(60% 40% at 50% 0%, rgba(25, 194, 133, .07), transparent 70%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font: inherit; }
.pos { color: var(--up-soft); }
.neg { color: var(--down-soft); }

/* ---------- header ---------- */
.ah {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  height: 54px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 42, 32, .75);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.ah__brand { display: inline-flex; align-items: center; gap: 10px; }
.ah__mark { width: 26px; height: 26px; }
.ah__mark svg { width: 100%; height: 100%; display: block; border-radius: 7px; }
.ah__name { font-size: 16px; font-weight: 620; letter-spacing: -0.02em; color: var(--text-hi); }
.ah__tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--line-2);
  border-radius: 5px;
  padding: 3px 7px;
}
.ah__right { display: flex; align-items: center; gap: 18px; }
.ah__net {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}
.ah__net i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--up);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(25,194,133,.35); }
  50% { box-shadow: 0 0 0 5px rgba(25,194,133,0); }
}
.ah__clock { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.ah__cash { font-size: 12.5px; color: var(--muted); }
.ah__cash b { font-family: var(--mono); font-weight: 500; color: var(--text-hi); margin-left: 5px; }
.ah__exit {
  font-size: 13px;
  font-weight: 550;
  color: var(--muted);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 6px 14px;
  transition: color .2s, border-color .2s;
}
.ah__exit:hover { color: var(--text-hi); border-color: var(--muted); }
.ah__wallet {
  font-size: 13px;
  font-weight: 600;
  color: #04231B;
  background: var(--up);
  border-radius: 999px;
  padding: 7px 15px;
  transition: filter .2s, transform .2s;
}
.ah__wallet:hover { filter: brightness(1.08); transform: translateY(-1px); }
.ah__wallet.is-connected {
  background: transparent;
  color: var(--up-soft);
  border: 1px solid rgba(25, 194, 133, .4);
  font-family: var(--mono);
  font-weight: 500;
  font-size: 12px;
}

/* ticket gate */
.ticket__gate { padding: 18px 16px 14px; }
.gate__title { font-size: 15px; font-weight: 620; color: var(--text-hi); margin-bottom: 7px; }
.gate__text { font-size: 12.5px; line-height: 1.6; color: var(--muted); margin-bottom: 14px; }
.gate__text a { color: var(--up-soft); font-weight: 550; border-bottom: 1px solid rgba(25,194,133,.35); }
.gate__text b { font-family: var(--mono); font-weight: 500; color: var(--text); }
.ticket__gate .ticket__submit { margin-left: 0; margin-right: 0; width: 100%; }
.ticket__gate .ticket__note { padding: 8px 0 0; }

/* ---------- layout ---------- */
.app__grid {
  flex: 1;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 300px;
  gap: 10px;
  padding: 10px;
  align-items: start;
  min-height: 0;
}
.pane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.pane__label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 11px 14px 9px;
  border-bottom: 1px solid var(--line);
}

/* ---------- markets list ---------- */
.mkts { position: sticky; top: 64px; }
.mkts__list { max-height: calc(100vh - 140px); overflow-y: auto; }
.mkt-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  transition: background .2s;
}
.mkt-row:last-child { border-bottom: none; }
.mkt-row:hover { background: rgba(234, 243, 238, .04); }
.mkt-row.is-active { background: rgba(25, 194, 133, .10); box-shadow: inset 2px 0 0 var(--up); }
.mkt-row__sym { font-family: var(--mono); font-size: 12.5px; font-weight: 500; color: var(--text-hi); }
.mkt-row__price { font-family: var(--mono); font-size: 12.5px; text-align: right; color: var(--text); }
.mkt-row__name { font-size: 10.5px; color: var(--muted-2); grid-column: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mkt-row__chg { font-family: var(--mono); font-size: 11px; text-align: right; }
.mkt-row.is-flash { background: rgba(25, 194, 133, .14); }

/* ---------- chart ---------- */
.center { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.chart__head {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.chart__id h1 { font-size: 17px; font-weight: 620; letter-spacing: -0.01em; color: var(--text-hi); font-family: var(--mono); }
.chart__id p { font-size: 11.5px; color: var(--muted-2); margin-top: 1px; }
.chart__quote { display: flex; align-items: baseline; gap: 10px; }
.chart__price { font-family: var(--mono); font-size: 24px; font-weight: 500; letter-spacing: -0.02em; color: var(--text-hi); }
.chart__chg { font-family: var(--mono); font-size: 12.5px; }
.chart__meta { display: flex; gap: 16px; font-size: 11.5px; color: var(--muted); }
.chart__meta b { font-family: var(--mono); font-weight: 500; color: var(--text); margin-left: 4px; }
.chart__tfs { margin-left: auto; display: flex; gap: 4px; }
.chart__tfs button {
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 7px;
  color: var(--muted);
  transition: background .2s, color .2s;
}
.chart__tfs button:hover { color: var(--text-hi); }
.chart__tfs button.is-active { background: rgba(25, 194, 133, .16); color: var(--text-hi); }
.chart__wrap { position: relative; height: clamp(300px, 44vh, 520px); padding: 6px 8px 2px; }
#chart { width: 100%; height: 100%; display: block; cursor: crosshair; }
.chart__tip {
  position: absolute;
  top: 14px;
  pointer-events: none;
  background: rgba(4, 35, 27, .95);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 7px 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.7;
  color: var(--text);
  white-space: nowrap;
  z-index: 2;
}

/* ---------- positions ---------- */
.positions__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}
.positions__head .pane__label { border-bottom: none; }
.positions__acct { display: flex; align-items: center; gap: 18px; padding: 8px 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.positions__acct b { font-family: var(--mono); font-weight: 500; color: var(--text-hi); margin-left: 6px; }
.positions__acct button {
  font-size: 11.5px;
  font-weight: 550;
  color: var(--muted);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 4px 11px;
  transition: color .2s, border-color .2s;
}
.positions__acct button:hover { color: var(--down-soft); border-color: var(--down); }
.positions__scroll { overflow-x: auto; }
.positions__table { width: 100%; border-collapse: collapse; min-width: 640px; }
.positions__table th {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted-2);
  text-align: left;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.positions__table th.num { text-align: right; }
.positions__table td {
  font-family: var(--mono);
  font-size: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.positions__table td.num { text-align: right; }
.positions__table td:first-child { color: var(--text-hi); font-weight: 500; }
.positions__table tr:last-child td { border-bottom: none; }
.positions__table .close-btn {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 550;
  color: var(--muted);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 3px 10px;
  transition: color .2s, border-color .2s;
}
.positions__table .close-btn:hover { color: var(--text-hi); border-color: var(--muted); }
.positions__empty { padding: 18px 14px; font-size: 12.5px; color: var(--muted-2); }

/* ---------- right column ---------- */
.side { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 64px; }

/* ticket */
.ticket__tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.ticket__tabs button {
  padding: 11px 0;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: color .2s, border-color .2s;
}
#buyTab.is-active { color: var(--up-soft); border-bottom-color: var(--up); }
#sellTab.is-active { color: var(--down-soft); border-bottom-color: var(--down); }
.ticket__field { display: block; padding: 12px 14px 4px; }
.ticket__field span {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.ticket__field input {
  width: 100%;
  background: rgba(234, 243, 238, .06);
  border: 1px solid var(--line-2);
  border-radius: 9px;
  color: var(--text-hi);
  font-family: var(--mono);
  font-size: 15px;
  padding: 9px 12px;
  outline: none;
  transition: border-color .2s;
}
.ticket__field input:focus { border-color: var(--up); }
.ticket__row {
  display: flex;
  justify-content: space-between;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--muted);
}
.ticket__row b { font-family: var(--mono); font-weight: 500; color: var(--text); }
.ticket__submit {
  display: block;
  width: calc(100% - 28px);
  margin: 10px 14px 6px;
  padding: 11px 0;
  border-radius: 9px;
  font-weight: 620;
  font-size: 14px;
  color: #04231B;
  transition: filter .2s, transform .2s;
}
.ticket__submit.is-buy { background: var(--up); }
.ticket__submit.is-sell { background: var(--down); color: #fff; }
.ticket__submit:hover { filter: brightness(1.08); transform: translateY(-1px); }
.ticket__submit:disabled { opacity: .45; cursor: not-allowed; transform: none; filter: none; }
.ticket__note { padding: 0 14px 12px; font-size: 10.5px; color: var(--muted-2); }

/* book + tape */
.bk-row {
  position: relative;
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.45;
  padding: 2.5px 14px;
  overflow: hidden;
}
.bk-row > * { position: relative; }
.bk-row i { position: absolute; inset: 0 0 0 auto; }
.bk-row--ask { color: var(--down-soft); }
.bk-row--ask i { background: rgba(226, 87, 76, .12); }
.bk-row--bid { color: var(--up-soft); }
.bk-row--bid i { background: rgba(25, 194, 133, .12); }
.bk-row span:last-child { color: var(--muted); }
.book__spread {
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  padding: 4px 0;
  margin: 2px 0;
  border-block: 1px dashed var(--line);
}
.book { padding-bottom: 6px; }
.tape { padding-bottom: 6px; }
.trade {
  display: grid;
  grid-template-columns: 34px 1fr 1fr auto;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.5;
  padding: 2.5px 14px;
}
.trade .t-buy { color: var(--up-soft); }
.trade .t-sell { color: var(--down-soft); }
.trade span:nth-child(3) { text-align: right; color: var(--text); }
.trade span:last-child { color: var(--muted-2); }
.trade.is-new { animation: flash .7s ease; }
@keyframes flash { 0% { background: rgba(25, 194, 133, .2); } 100% { background: transparent; } }

/* ---------- footer / toast ---------- */
.app__foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 9px 18px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted-2);
}
.toast {
  position: fixed;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 11px 18px;
  font-size: 13px;
  color: var(--text-hi);
  box-shadow: 0 12px 40px -8px rgba(0, 0, 0, .5);
  z-index: 100;
  animation: toastIn .3s var(--ease);
}
.toast b { font-family: var(--mono); font-weight: 500; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .app__grid { grid-template-columns: 220px minmax(0, 1fr); }
  .side { grid-column: 1 / -1; position: static; display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: start; }
}
@media (max-width: 800px) {
  .app__grid { grid-template-columns: 1fr; }
  .mkts { position: static; }
  .mkts__list { max-height: 220px; }
  .side { grid-template-columns: 1fr; }
  .ah__clock, .ah__net { display: none; }
  .chart__wrap { height: 300px; }
}
