:root {
  color-scheme: dark;
  --bg: #050505;
  --panel: #0a0a0a;
  --panel-2: #101010;
  --line: #242424;
  --line-soft: #1a1a1a;
  --text: #dddddd;
  --muted: #858585;
  --soft: #b9b9b9;
  --green: #21a88f;
  --red: #e05261;
  --amber: #f4a51c;
  --blue: #1ca7d8;
  --focus: #d9d9d9;
  --shadow: rgba(0, 0, 0, 0.38);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  overscroll-behavior: none;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(360px, 450px) minmax(0, 1fr);
  height: 100vh;
  background: var(--bg);
}

.watch-pane {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #000;
}

.dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 999px;
  background: var(--muted);
}

.dot.ok {
  background: var(--green);
}

.dot.warn {
  background: var(--amber);
}

.dot.bad {
  background: var(--red);
}

.icon-btn {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #141414;
  color: var(--text);
  cursor: pointer;
}

.btn-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.icon-btn:hover,
.icon-btn:focus-visible,
.pill-button:hover,
.pill-button:focus-visible,
.add-button:hover,
.add-button:focus-visible {
  border-color: #555;
  outline: none;
}

.session-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 40px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--soft);
  font-size: 13px;
}

.manual-carry {
  border-bottom: 1px solid var(--line);
  background: #020202;
}

.carry-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  background: var(--line-soft);
}

.carry-summary-cell {
  min-width: 0;
  padding: 9px 10px;
  background: #080808;
}

.carry-summary-cell label,
.carry-metric label {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 780;
  line-height: 1.1;
  text-transform: uppercase;
}

.carry-summary-cell strong,
.carry-metric strong {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manual-carry-rows {
  max-height: 190px;
  overflow: auto;
}

.manual-carry-row {
  display: grid;
  grid-template-columns: minmax(92px, 1.2fr) repeat(5, minmax(62px, 0.7fr)) 28px;
  gap: 8px;
  align-items: center;
  min-height: 54px;
  padding: 8px 10px 8px 12px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
}

.carry-asset {
  min-width: 0;
}

.carry-asset strong {
  display: block;
  overflow: hidden;
  margin-bottom: 5px;
  font-size: 14px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-carry {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #777;
  cursor: pointer;
}

.remove-carry:hover {
  background: #1c1c1c;
  color: var(--text);
}

.carry-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
}

.session-strip strong {
  color: var(--text);
  font-weight: 700;
}

.session-count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.watch-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  scrollbar-color: #333 transparent;
}

.section {
  border-bottom: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 52px;
  padding: 0 18px;
  border: 0;
  background: #000;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.chev {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-right: 3px solid var(--text);
  border-bottom: 3px solid var(--text);
  transform: rotate(45deg);
  transition: transform 0.14s ease;
}

.collapsed .chev {
  transform: rotate(-45deg);
}

.section-title {
  font-size: 15px;
  font-weight: 780;
}

.rows {
  display: block;
}

.row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) minmax(126px, auto) 28px;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 76px;
  padding: 9px 10px 9px 14px;
  border: 0;
  border-top: 1px solid var(--line-soft);
  background: #000;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}

.row:hover,
.row.active {
  background: #0d0d0d;
}

.avatar-wrap {
  position: relative;
  width: 46px;
  height: 46px;
}

.avatar {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 50%;
  background: #333;
  color: white;
  font-size: 16px;
  font-weight: 820;
  overflow: hidden;
}

.avatar.small-badge::after {
  position: absolute;
  right: -3px;
  top: -3px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 2px solid #000;
  border-radius: 50%;
  background: #089b9b;
  color: white;
  content: "$";
  font-size: 13px;
  font-weight: 900;
}

.row-main {
  min-width: 0;
}

.symbol-line {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 18px;
  font-weight: 780;
  line-height: 1.18;
}

.symbol {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-dash {
  width: 16px;
  height: 5px;
  flex: 0 0 16px;
  border-radius: 99px;
  background: #9c9c9c;
}

.dex-tag {
  color: var(--amber);
  font-size: 13px;
  font-weight: 760;
}

.desc {
  overflow: hidden;
  margin-top: 6px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-values {
  min-width: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.price {
  display: block;
  color: #d6d6d6;
  font-size: 18px;
  font-weight: 760;
  line-height: 1.18;
}

.rolling-pcts {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 7px;
  font-size: 13px;
  line-height: 1.1;
  white-space: nowrap;
}

.rolling {
  display: inline-flex;
  gap: 3px;
  align-items: baseline;
  font-variant-numeric: tabular-nums;
}

.rolling b {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
}

.pos {
  color: var(--green);
}

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

.muted {
  color: var(--muted);
}

.remove-row {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #777;
  cursor: pointer;
}

.remove-row:hover {
  background: #1c1c1c;
  color: var(--text);
}

.add-zone {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 10px;
  padding: 14px 16px 18px;
  border-top: 1px solid var(--line-soft);
}

.add-button {
  display: flex;
  width: 100%;
  height: 46px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid #333;
  border-radius: 8px;
  background: #202020;
  color: var(--text);
  font-size: 16px;
  font-weight: 760;
  cursor: pointer;
}

.plus {
  font-size: 30px;
  font-weight: 300;
  line-height: 1;
}

.settings-button {
  width: 46px;
  height: 46px;
}

.detail-pane {
  display: grid;
  grid-template-rows: minmax(360px, 54vh) minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}

.chart-panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.detail-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 58px;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.mobile-back {
  display: none;
}

.detail-title {
  min-width: 0;
}

.detail-title h2 {
  overflow: hidden;
  margin: 0;
  font-size: 20px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-title span {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.pill-button,
.stat-pill {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #141414;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.pill-button {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.pill-button.primary {
  border-color: #4a4a4a;
  background: #242424;
}

.stat-pill {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.chart-frame {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #050505;
}

.chart-stack {
  display: grid;
  height: 100%;
  grid-template-rows: minmax(220px, 1fr) auto;
  min-height: 0;
}

.price-chart {
  width: 100%;
  height: 100%;
  min-height: 220px;
  background: #050505;
}

.chart-grid {
  stroke: #1d1d1d;
  stroke-width: 1;
}

.chart-line {
  fill: none;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.chart-area {
  opacity: 0.11;
}

.price-chart.positive .chart-line {
  stroke: var(--green);
}

.price-chart.positive .chart-area {
  fill: var(--green);
}

.price-chart.negative .chart-line {
  stroke: var(--red);
}

.price-chart.negative .chart-area {
  fill: var(--red);
}

.price-chart.neutral .chart-line {
  stroke: #c8c8c8;
}

.price-chart.neutral .chart-area {
  fill: #c8c8c8;
}

.local-detail {
  display: grid;
  height: auto;
  min-height: 0;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  align-content: start;
  gap: 1px;
  background: var(--line-soft);
}

.chart-frame > .local-detail {
  min-height: 100%;
}

.local-detail-cell {
  min-height: 108px;
  padding: 16px;
  background: #070707;
}

.local-detail-cell label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  text-transform: uppercase;
}

.local-detail-cell strong {
  display: block;
  overflow: hidden;
  margin-top: 8px;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-detail {
  display: grid;
  height: 100%;
  place-items: center;
  color: var(--muted);
}

.bottom-panel {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: var(--bg);
}

.wallet-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.wallet-title {
  min-width: 0;
}

.wallet-title h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.wallet-title span {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.income-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(96px, 1fr));
  gap: 1px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--line-soft);
}

.income-cell {
  min-width: 0;
  padding: 12px;
  background: #090909;
}

.income-cell label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.income-cell strong {
  display: block;
  overflow: hidden;
  margin-top: 6px;
  color: var(--text);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.positions {
  display: block;
}

.position-row {
  display: grid;
  grid-template-columns: minmax(128px, 1.1fr) repeat(6, minmax(86px, 1fr)) minmax(104px, 0.85fr);
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}

.position-row.header {
  min-height: 38px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  text-transform: uppercase;
}

.position-cell {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.position-cell.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.side {
  display: inline-flex;
  min-width: 54px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: white;
  font-size: 11px;
  font-weight: 850;
}

.side.long {
  background: #116b5b;
}

.side.short {
  background: #8f2f39;
}

.carry-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.carry-toggle input,
.modal-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.alert-input {
  width: 62px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #111;
  color: var(--text);
  text-align: right;
}

.risk {
  color: var(--amber);
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.68);
}

.modal {
  display: flex;
  width: min(720px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  flex-direction: column;
  border: 1px solid #343434;
  border-radius: 8px;
  background: #080808;
  box-shadow: 0 24px 80px var(--shadow);
}

.carry-size-modal {
  width: min(420px, 100%);
}

.modal-head {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
  font-size: 17px;
}

.modal-body {
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 10px;
  margin-bottom: 12px;
}

.search-input,
.modal-field input,
.modal-field select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111;
  color: var(--text);
  padding: 0 10px;
}

.modal-field {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.modal-field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.results {
  display: grid;
  gap: 1px;
  background: var(--line-soft);
}

.result-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 8px 10px;
  border: 0;
  background: #0c0c0c;
  cursor: pointer;
  text-align: left;
}

.result-row:hover {
  background: #151515;
}

.result-row .avatar {
  width: 38px;
  height: 38px;
  font-size: 13px;
}

.result-name {
  min-width: 0;
}

.result-name strong,
.result-name span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-name strong {
  font-size: 14px;
}

.result-name span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.source-chip {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.carry-target {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.carry-target .avatar {
  width: 38px;
  height: 38px;
  font-size: 13px;
}

.ghost {
  color: var(--muted);
}

@media (max-width: 920px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .app-shell.mobile-detail {
    height: 100vh;
    overflow: hidden;
  }

  .watch-pane {
    min-height: 100vh;
    border-right: 0;
  }

  .app-shell.mobile-detail .watch-pane {
    display: none;
  }

  .detail-pane {
    display: none;
    min-height: 720px;
    grid-template-rows: minmax(420px, 58vh) minmax(320px, auto);
    border-top: 1px solid var(--line);
  }

  .app-shell.mobile-detail .detail-pane {
    display: grid;
    height: 100vh;
    min-height: 0;
    border-top: 0;
  }

  .app-shell.mobile-detail .chart-panel {
    min-height: 0;
  }

  .mobile-back {
    display: inline-grid;
  }

  .detail-head {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .detail-head .pill-row {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .row {
    grid-template-columns: 54px minmax(0, 1fr) minmax(116px, auto);
    min-height: 76px;
    padding-left: 12px;
  }

  .remove-row {
    display: none;
  }

  .avatar-wrap,
  .avatar {
    width: 44px;
    height: 44px;
  }

  .symbol-line,
  .price {
    font-size: 17px;
  }

  .desc,
  .rolling-pcts {
    font-size: 12px;
  }

  .rolling-pcts {
    gap: 6px;
  }

  .rolling b {
    font-size: 9px;
  }

  .detail-head,
  .wallet-head,
  .session-strip {
    grid-template-columns: 1fr;
  }

  .detail-head {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .pill-row {
    justify-content: flex-start;
  }

  .income-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .carry-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .manual-carry-row {
    grid-template-columns: minmax(94px, 1fr) repeat(3, minmax(58px, auto)) 28px;
  }

  .manual-carry-row .carry-metric:nth-of-type(3),
  .manual-carry-row .carry-metric:nth-of-type(5) {
    display: none;
  }

  .position-row {
    grid-template-columns: minmax(130px, 1fr) minmax(90px, 1fr) minmax(90px, 1fr);
  }

  .position-row.header {
    display: none;
  }

  .position-row .hide-sm {
    display: none;
  }

  .modal-grid {
    grid-template-columns: 1fr;
  }
}
