body.app {
  background: var(--bg);
  color: var(--ink);
}

.shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

.side {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.side-link {
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 0 12px;
  font-weight: 600;
  font-size: 14px;
}

.side-link:hover { background: var(--bg); color: var(--navy); }
.side-link.active { background: var(--bg); color: var(--navy); }

.side-foot {
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  font-size: 13px;
}

.side-foot b { display: block; color: var(--navy); }
.side-foot span { color: var(--muted); }

.main {
  min-width: 0;
  padding: 20px 24px 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.top-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.top-links a {
  height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.panel[hidden] { display: none; }

.grid-4, .grid-2 {
  display: grid;
  gap: 12px;
}

.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: 1.4fr 0.8fr; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.metric b {
  display: block;
  font-family: var(--mono);
  font-size: 26px;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.metric span, .muted { color: var(--muted); font-size: 13px; }
.metric em, .fine {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}
.card-head, .book-head, .chart-head, .signal-top, .pos-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.card-head { margin-bottom: 12px; }
.card-head h2, .signal-top h2 { margin: 0; }
.quote-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
}
.signals, .quotes {
  list-style: none;
  margin: 0;
  padding: 0;
}
.signals li, .quotes li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.signals li:last-child, .quotes li:last-child { border-bottom: 0; }
.signals b, .quotes b { display: block; font-size: 14px; }
.signals span, .quotes span, .setup, .appbar-kicker, .pair span {
  color: var(--muted);
  font-size: 12px;
}
.q-px { text-align: right; }
.q-px b, .q-px span { display: block; }
.up { color: var(--green); }
.down { color: #dc3b3b; }

.list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.list li:last-child { border-bottom: 0; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  display: table-cell;
  width: auto;
  height: auto;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  white-space: nowrap;
  vertical-align: middle;
  text-align: left;
  font-size: 14px;
}
th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
td { font-variant-numeric: tabular-nums; }
td.num, th.num {
  text-align: right;
  font-family: var(--mono);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-wrap table { min-width: 760px; }

.tv-chart {
  position: relative;
  width: 100%;
  height: 420px;
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}
.tv-chart-tall { height: min(72vh, 680px); }
.tv-fallback {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.chip, .field, .seg button {
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 12px;
  font-size: 13px;
  color: var(--navy);
}

.chip.active, .seg button.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.seg { display: inline-flex; gap: 6px; }
.field { min-width: 0; width: 120px; }
select.field { width: 110px; }
label.stack { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.note {
  margin-top: 10px;
  font-size: 13px;
  color: var(--green);
}

.phone-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 40px;
}

.phone-tools {
  width: min(420px, 100%);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 14px;
}

.phone {
  width: min(390px, 100%);
  height: min(844px, calc(100vh - 96px));
  background: #f7f1e6;
  border: 10px solid #12263c;
  border-radius: 40px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 50px rgba(23, 50, 77, 0.18);
}

.ios-status, .appbar, .phone-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ios-status {
  padding: 12px 22px 0;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
}
.ios-icons { display: inline-flex; align-items: center; gap: 6px; }
.appbar {
  padding: 10px 16px 12px;
  gap: 12px;
}
.appbar strong {
  display: block;
  font-size: 22px;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.appbar-equity { text-align: right; }
.appbar-equity span, .appbar-equity em {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}
.appbar-equity b { font-size: 14px; }
.phone-body { flex: 1; overflow: auto; padding: 0 14px 16px; }
.phone .tv-chart { height: 300px; min-height: 240px; }

.signal-hero, .pos, .result {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}
.pair { font-weight: 700; letter-spacing: -0.02em; }
.pair span { font-weight: 500; margin-left: 6px; }
.conf {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--bg);
  display: grid;
  place-items: center;
  text-align: center;
}
.conf b { font-family: var(--mono); font-size: 18px; line-height: 1; }
.conf span { font-size: 10px; color: var(--muted); }
.side-pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  margin-top: 8px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--bg);
  font-size: 12px;
  font-weight: 700;
}
.side-pill.up { color: var(--green); }
.side-pill.down { color: #dc3b3b; }
.levels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.levels div, .account-card .levels div {
  background: var(--bg);
  border-radius: 12px;
  padding: 8px;
}
.levels span { display: block; color: var(--muted); font-size: 11px; }
.levels b { font-size: 13px; }
.meta-row, .pos-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.meta-row span, .pos-grid span {
  background: var(--bg);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--muted);
}
.pair-actions { display: flex; gap: 8px; margin-top: 12px; }
.pair-actions .btn { flex: 1; height: 42px; }
.section-label, .book-head {
  margin: 16px 2px 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.check-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.check-list li { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.check-list i {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  border-radius: 50%;
  flex: 0 0 16px;
  background: var(--green);
}
.check-list i.warn { background: #d97706; }
.pos { margin-bottom: 8px; }
.pos-top b { font-size: 14px; }
.pos-grid { margin-top: 8px; }
.quotes.compact li { padding: 8px 0; }
.phone-tabs {
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 6px 6px 10px;
  gap: 2px;
}
.phone-tabs button {
  flex: 1;
  min-width: 0;
  height: 52px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.phone-tabs svg { width: 20px; height: 20px; }
.phone-tabs button.active { background: var(--bg); color: var(--navy); }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    position: sticky;
    top: 0;
    z-index: 30;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    gap: 10px;
  }
  .side nav {
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .side-link { white-space: nowrap; min-height: 44px; }
  .side-foot { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .main { padding: 16px 16px 88px; }
  .topbar { align-items: flex-start; }
  .phone-page { padding: 0; height: 100vh; height: 100dvh; overflow: hidden; }
  .phone-tools { width: 100%; flex: 0 0 auto; margin-bottom: 0; padding: 10px 16px; }
  .phone { border-width: 0; border-radius: 0; width: 100%; height: auto; flex: 1; min-height: 0; box-shadow: none; }
}

@media (max-width: 640px) {
  .grid-4 { grid-template-columns: 1fr; }
  .main { padding: 12px 12px 96px; }
  .card { padding: 12px; }
  .metric b { font-size: 22px; }
  .tv-chart, .tv-chart-tall { height: 68vh; min-height: 340px; }
  .topbar h1 { font-size: 20px; }
  .top-links { width: 100%; }
  .row { flex-direction: column; align-items: stretch; }
  .seg { width: 100%; }
  .seg button { flex: 1; min-height: 44px; }
  .field, select.field { width: 100%; }
  .row .btn { width: 100%; }
  .phone .tv-chart { height: 46vh; min-height: 260px; }
  .quote-pill { width: 100%; justify-content: space-between; }
  .list li { font-size: 13px; }
}
