:root {
  --bg: #f3eee4;
  --fg: #1c1914;
  --card: #fffdf8;
  --muted: #7a7264;
  --line: #e7e0d2;
  --gold: #9a7b2f;
  --gold-soft: #f4d07a;
  --ink: #1c1914;
  --buy: #047857;
  --sell: #b91c1c;
  --warn: #b45309;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabbar-h: calc(58px + var(--safe-b));
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}
body.menu-open { overflow: hidden; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
.num { font-family: ui-monospace, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); font-size: 12px; line-height: 1.45; }
.caps { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; }
.h { font-size: 16px; font-weight: 650; }
.buy { color: var(--buy); }
.sell { color: var(--sell); }
.pad { padding: 12px; display: grid; gap: 10px; padding-bottom: calc(12px + var(--tabbar-h)); max-width: 100%; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: 0 8px 24px rgb(28 25 20 / .04); max-width: 100%; overflow: hidden; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 8px; }
.grid-2, .grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: 1fr 1fr; }
.grid-4 > .metric:first-child { grid-column: 1 / -1; }
.split, .split-admin { display: grid; gap: 8px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.mb { margin-bottom: 8px; }
.mt { margin-top: 10px; }
.r { text-align: right; }
.grow { min-width: 0; flex: 1; }
.xl { font-size: 22px; line-height: 1.15; overflow-wrap: anywhere; }
.stat, .metric { min-height: 64px; }
.metric .muted { overflow-wrap: anywhere; }
.stat { background: #faf7f1; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.kv { display: flex; justify-content: space-between; gap: 8px; padding: 10px 0; border-bottom: 1px solid #f4f4f5; font-size: 13px; }
.inp, select.inp {
  width: 100%;
  min-height: 44px;
  border: 1px solid #d4d4d8;
  border-radius: 10px;
  padding: 0 12px;
  background: #fff;
  margin: 4px 0 10px;
  font-size: 16px;
}
.inp.sm, .inp.search { width: 100%; }
.btn, .text-btn {
  border: 0;
  background: var(--gold);
  color: #fffdf6;
  min-height: 44px;
  border-radius: 10px;
  padding: 0 14px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.card > .btn, .card .btn.mt, .login-card .btn { width: 100%; }
.text-btn { background: transparent; color: var(--muted); min-height: auto; padding: 10px 0; width: auto; }
.icon-btn { border: 0; background: transparent; width: 44px; height: 44px; border-radius: 10px; cursor: pointer; font-size: 18px; color: var(--fg); }
.icon-btn:hover { background: #f4f4f5; }
.chk { display: flex; align-items: center; gap: 10px; font-size: 14px; margin: 10px 0; min-height: 44px; }
.badge { font-size: 10px; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.badge.ok { background: #ecfdf5; color: var(--buy); }
.badge.warn { background: #fffbeb; color: var(--warn); }
.err { color: var(--sell); font-size: 13px; margin-bottom: 8px; }
.status { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.status .num { font-size: 18px; color: var(--fg); }

.login-body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(20px + var(--safe-t)) 16px calc(20px + var(--safe-b));
  background:
    radial-gradient(900px 420px at 12% -10%, rgb(154 123 47 / .18), transparent 55%),
    radial-gradient(700px 380px at 110% 110%, rgb(24 24 27 / .08), transparent 50%),
    #efe7d6;
}
.login-shell {
  width: min(860px, 100%);
  display: grid;
  gap: 0;
  background: #fff;
  border: 1px solid #e7e0d2;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgb(24 24 27 / .12);
}
.login-hero {
  background: linear-gradient(165deg, #1c1914 0%, #2a2418 55%, #3a311d 100%);
  color: #f8f1e3;
  padding: 28px 24px;
  display: grid;
  align-content: start;
  gap: 14px;
}
.login-hero-top { display: flex; align-items: center; gap: 12px; }
.login-hero .mark { background: rgb(244 208 122 / .12); border-color: rgb(244 208 122 / .35); color: #f4d07a; }
.login-hero .brand { color: #fffdf6; letter-spacing: .2em; }
.login-kicker { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #c4b89a; }
.login-hero-title { margin: 12px 0 0; font-size: 26px; line-height: 1.2; font-weight: 650; }
.login-hero-copy { margin: 0; color: #d9d0bc; font-size: 14px; line-height: 1.5; }
.login-steps { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.login-steps li {
  border: 1px solid rgb(244 208 122 / .2);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: #b7ad96;
}
.login-steps li.on { background: rgb(244 208 122 / .12); color: #f4d07a; border-color: rgb(244 208 122 / .4); }
.login-steps li.done { color: #e8dcc0; }
.login-card { width: 100%; background: #fff; padding: 26px 22px 24px; }
.login-card .login-title { font-size: 22px; font-weight: 650; margin: 6px 0 8px; }
.login-card label { display: block; font-size: 13px; font-weight: 600; margin-top: 8px; }
.login-card .btn { margin-top: 8px; }
.login-meta {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.qbox { border: 1px solid var(--line); background: #faf7f1; border-radius: 10px; padding: 12px; font-size: 14px; margin-bottom: 8px; line-height: 1.45; }

.shell { display: flex; height: 100dvh; overflow: hidden; max-width: 100%; }
.sidebar {
  width: min(300px, 88vw);
  background: linear-gradient(180deg, #1c1914 0%, #2a2418 100%);
  border-right: 1px solid #3a311d;
  color: #f8f1e3;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  transform: translateX(-105%);
  transition: transform .22s ease;
  padding-top: var(--safe-t);
  padding-bottom: var(--safe-b);
}
.sidebar.open { transform: translateX(0); box-shadow: 12px 0 40px rgb(24 24 27 / .28); }
.sidebar .muted { color: #c4b89a; }
.brand-row { display: flex; align-items: center; gap: 10px; padding: 16px; border-bottom: 1px solid rgb(244 208 122 / .12); }
.mark { width: 28px; height: 28px; border-radius: 7px; border: 1px solid rgb(244 208 122 / .35); background: rgb(244 208 122 / .12); color: #f4d07a; font-size: 10px; font-weight: 700; display: grid; place-items: center; flex: none; }
.brand { font-weight: 700; letter-spacing: .16em; font-size: 12px; color: #fffdf6; }
.nav { flex: 1; overflow: auto; padding: 8px; -webkit-overflow-scrolling: touch; }
.nav-group { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: #8a806c; padding: 14px 12px 6px; }
.nav-link { display: block; padding: 12px 12px; border-radius: 10px; color: #d9d0bc; text-decoration: none; font-size: 14px; }
.nav-link.on, .nav-link:hover { background: rgb(244 208 122 / .12); color: #f4d07a; font-weight: 600; }
.sidebar-foot { border-top: 1px solid rgb(244 208 122 / .12); padding: 14px; }
.sidebar .text-btn { color: #c4b89a; }
.sidebar .icon-btn { color: #f8f1e3; }
.who { display: grid; margin-bottom: 6px; }
.stage { flex: 1; min-width: 0; max-width: 100%; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  min-height: 56px;
  background: rgb(255 253 248 / .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--safe-t) 8px 0;
  height: calc(56px + var(--safe-t));
  position: sticky;
  top: 0;
  z-index: 20;
}
.page-title { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-line { display: none; }
.chip { background: #f4efe3; border-radius: 999px; padding: 6px 10px; font-size: 11px; flex: none; color: #3a311d; }
.live {
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 6px 8px;
  background: #f4efe3;
  color: #7a7264;
  flex: none;
}
.live.on { background: rgb(4 120 87 / .1); color: var(--buy); }
.avatar { width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line); display: grid; place-items: center; text-decoration: none; color: #52525b; font-size: 10px; font-weight: 700; background: #fafafa; flex: none; }
.ticker { height: 40px; width: 100%; max-width: 100%; background: #fffdf8; border-bottom: 1px solid var(--line); overflow: hidden; }
.ticker-track { display: flex; width: max-content; animation: tx 36s linear infinite; will-change: transform; }
.ticker-seq { display: flex; flex: none; }
.ticker-item { display: inline-flex; gap: 8px; padding: 0 14px; align-items: center; height: 40px; font-size: 12px; white-space: nowrap; }
.main { flex: 1; min-width: 0; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: none; overscroll-behavior-y: contain; touch-action: pan-y; }
.veil { position: fixed; inset: 0; background: rgb(24 24 27 / .35); z-index: 40; }
.close-only { margin-left: auto; }
.table-wrap, #trades { max-width: 100%; overflow-x: auto; padding: 0; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 10px; border-bottom: 1px solid #f4f4f5; text-align: left; }
th { color: #71717a; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.chart-box { min-height: 260px; display: flex; flex-direction: column; max-width: 100%; overflow: hidden; }
.tv { flex: 1; min-height: 220px; max-width: 100%; overflow: hidden; }
#chart-tabs { display: flex; gap: 6px; overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
#chart-tabs .btn { flex: none; min-height: 36px; width: auto; font-size: 12px; }
.tape { max-height: 240px; overflow: auto; font-size: 12px; }
.tape div { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f4f4f5; }
.bar { height: 6px; background: #f4f4f5; border-radius: 99px; overflow: hidden; margin: 4px 0 10px; }
.bar i { display: block; height: 100%; background: rgb(154 123 47 / .8); }
.admin-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 4px; border-bottom: 1px solid #f4f4f5; text-decoration: none; color: inherit; min-height: 52px; }
.admin-row.on { background: #fafafa; margin: 0 -14px; padding: 14px; border-radius: 10px; }
.source-row { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 12px; }
.source { display: grid; gap: 4px; align-content: center; justify-items: start; border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fafafa; }
.source img { display: block; max-width: 140px; max-height: 64px; width: auto; height: auto; object-fit: contain; }
.wd-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.wd-actions .btn { width: auto; min-height: 36px; }
.toolbar { display: flex; flex-direction: column; gap: 8px; }
.tabbar {
  display: flex;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  background: rgb(255 253 248 / .96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 4px 4px var(--safe-b);
  min-height: var(--tabbar-h);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 50px;
  text-decoration: none;
  color: #71717a;
  font-size: 10px;
  font-weight: 600;
  border: 0;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
}
.tab svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.desk-break { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
@media (max-width: 639px) {
  #bots .card .row-between { align-items: stretch; }
  #bots .btn { width: 100%; margin-top: 8px; }
  .topbar { padding-left: 12px; padding-right: 12px; }
}
.tab.on { color: var(--gold); background: rgb(154 123 47 / .08); }
.hide-xs { display: none; }
.hide-sm, .hide-md { display: none; }
@keyframes tx {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-50%, 0, 0); }
}

@media (min-width: 380px) {
  .hide-xs { display: inline; }
}
@media (min-width: 760px) {
  .login-shell { grid-template-columns: 1.05fr .95fr; min-height: 520px; }
  .login-hero { padding: 36px 32px; }
  .login-card { padding: 40px 36px; display: grid; align-content: center; }
}
@media (min-width: 640px) {
  .hide-sm { display: table-cell; }
  .grid-2, .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 > .metric:first-child { grid-column: auto; }
  .status { flex-direction: row; justify-content: space-between; align-items: center; }
  .toolbar { flex-direction: row; align-items: center; justify-content: space-between; }
  .inp.sm, .inp.search { width: 180px; margin: 0; }
  .pad { padding: 16px; padding-bottom: calc(16px + var(--tabbar-h)); }
  .xl { font-size: 22px; }
  .card > .btn, .card .btn.mt { width: auto; }
  .desk-break { flex-direction: row; flex-wrap: wrap; gap: 6px 14px; }
  .source-row { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1024px) {
  .sidebar {
    display: flex;
    position: relative;
    transform: none;
    width: 240px;
    inset: auto;
    box-shadow: none;
    padding: 0;
    z-index: 1;
  }
  .topbar { height: 56px; padding: 0 14px; }
  .topbar .icon-btn, .close-only, .veil, .tabbar { display: none !important; }
  .role-line { display: block; }
  .pad { padding: 16px; padding-bottom: 16px; }
  .grid-4, .split, .split-admin { grid-template-columns: 240px 1fr; }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .split { grid-template-columns: 1fr 320px; }
  .hide-md { display: table-cell; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .chart-box { min-height: 360px; }
  .tv { min-height: 280px; }
  .inp, select.inp { min-height: 36px; font-size: 13px; border-radius: 8px; }
  .btn { min-height: 36px; font-size: 12px; border-radius: 8px; }
  .card { border-radius: 8px; }
  .chk { min-height: auto; font-size: 12px; }
  .nav-link { font-size: 12px; padding: 8px 10px; }
}
