:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f4f5f7;
  background: #000;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #111114; }
button { font: inherit; }

.brand-bar {
  height: calc(40px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}
.brand { display: flex; align-items: center; gap: 7px; font-size: 17px; letter-spacing: -.35px; }
.brand-mark { display: block; width: 19px; height: 19px; object-fit: contain; }

.dashboard { width: calc(100% - 80px); max-width: 1568px; margin-inline: auto; padding: 33px 0 38px; }
h1 { margin: 0 0 18px; font-size: 20px; line-height: 24px; font-weight: 500; letter-spacing: -.3px; }
.sample-badge { display: inline-block; margin-left: 8px; padding: 3px 7px; border: 1px solid #343940; border-radius: 4px; color: #a9b5b8; font-size: 10px; line-height: 13px; letter-spacing: 0; vertical-align: 3px; }
.sample-badge.has-live { border-color: #3d655b; color: #70d8bd; }
.sample-badge.source-stale { border-color: #705344; color: #e4a17b; }
h2 { margin: 0; font-weight: 500; }

.bots-panel { border: 1px solid #2f3038; border-radius: 11px; overflow: hidden; background: #1b1b21; }
.table-scroll { overflow-x: auto; scrollbar-color: #3d3e45 transparent; }
.bot-grid { display: grid; grid-template-columns: minmax(250px, 1.72fr) repeat(9, minmax(112px, 1fr)); align-items: center; min-width: 1390px; padding: 0 34px; column-gap: 0; }
.bot-grid-head { height: 42px; background: #151519; color: #b7b8bd; font-size: 10px; }
.bot-row { width: 100%; height: 55px; border: 0; border-top: 1px solid #282830; background: transparent; color: #f3f4f6; text-align: left; cursor: pointer; font-size: 13px; padding-top: 0; padding-bottom: 0; transition: background .15s ease; }
.bot-row:hover { background: linear-gradient(90deg, rgba(52, 103, 101, .26), rgba(27, 27, 33, 0) 47%); }
.bot-row.selected.positive-bot { background: linear-gradient(90deg, rgba(60, 112, 109, .45), rgba(35, 56, 58, .28) 19%, rgba(27, 27, 33, .12) 39%); }
.bot-row.selected.negative-bot { background: linear-gradient(90deg, rgba(136, 75, 61, .38), rgba(73, 44, 43, .2) 21%, rgba(27, 27, 33, .12) 42%); }
.bot-row:focus-visible, .range-button:focus-visible, .range-menu button:focus-visible, .plot:focus-visible { outline: 2px solid #83e8df; outline-offset: -3px; }
.bot-name { font-weight: 500; white-space: nowrap; }
.delivery { display: flex; flex-direction: column; gap: 2px; }
.delivery-main { display: flex; align-items: center; gap: 6px; line-height: 17px; }
.status-dot { width: 4px; height: 4px; border-radius: 50%; background: #45c7a9; }
.status-dot.stale { background: #e4a17b; }
.status-dot.sample { background: #788087; }
.delivery-since { font-size: 10px; color: #999ba5; line-height: 13px; }
.cell-stack { display: flex; flex-direction: column; gap: 3px; }
.cell-stack small { color: #92969f; font-size: 10px; line-height: 12px; font-weight: 400; }
.positive { color: #55d7b5; }
.negative { color: #e48f71; }
.drawdown { color: #e48f71; }

.detail-tabs { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; height: 45px; margin-top: 10px; border: 1px solid #30313a; border-radius: 8px; overflow: hidden; background: #191a20; }
.detail-tabs button { border: 0; border-bottom: 2px solid transparent; background: transparent; color: #aeb0ba; font-size: 12px; font-weight: 500; cursor: pointer; }
.detail-tabs button + button { border-left: 1px solid #2c2e35; }
.detail-tabs button:hover { color: #f2f4f4; background: #25292d; }
.detail-tabs button[aria-selected="true"] { color: #79ded2; border-bottom-color: #69d4c5; background: linear-gradient(180deg, #263a38, #202a2b); }
.detail-tabs button:focus-visible { outline: 2px solid #83e8df; outline-offset: -3px; }
.detail-panel[hidden] { display: none; }
.details-grid { display: grid; grid-template-columns: minmax(0, 1.86fr) minmax(340px, 1fr); gap: 10px; width: 100%; margin: 10px auto 0; }
.profit-card, .metrics-card { min-width: 0; height: 350px; border-radius: 10px; background: #191a20; }
.profit-card { padding: 40px 30px 28px; background: linear-gradient(115deg, #151517 0%, #181a22 100%); overflow: hidden; }
.profit-card.gridbot-chart { height: 385px; }
.profit-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.profit-header h2 { color: #b7b8be; font-size: 17px; line-height: 22px; margin-bottom: 7px; }
.profit-amount { font-size: 25px; line-height: 27px; font-weight: 600; letter-spacing: -.75px; font-variant-numeric: tabular-nums; }
.profit-subtitle { display: flex; gap: 17px; margin-top: 5px; font-size: 12px; white-space: nowrap; }
.profit-subtitle span:last-child { color: #a5a6ae; }
.range-control { position: relative; flex: none; z-index: 3; }
.range-control[hidden] { display: none; }
.range-button { display: flex; align-items: center; justify-content: space-between; gap: 11px; min-width: 146px; height: 33px; padding: 0 15px; color: #f0f0f2; background: transparent; border: 1px solid #30323b; border-radius: 5px; cursor: pointer; font-size: 12px; }
.range-button:hover { background: #242630; }
.range-menu { position: absolute; right: 0; top: 39px; width: 146px; padding: 4px; background: #252630; border: 1px solid #3b3d48; border-radius: 6px; box-shadow: 0 12px 30px #0008; }
.range-menu[hidden] { display: none; }
.range-menu button { display: block; width: 100%; border: 0; border-radius: 4px; padding: 8px; background: transparent; color: #e7e8eb; text-align: left; cursor: pointer; font-size: 12px; }
.range-menu button:hover, .range-menu button[aria-selected="true"] { background: #374141; }

.chart-tabs { display: flex; align-items: center; gap: 18px; height: 24px; margin-top: 10px; }
.chart-tabs button { height: 24px; padding: 0; border: 0; border-bottom: 1px solid transparent; background: transparent; color: #999ba5; font-size: 11px; cursor: pointer; white-space: nowrap; }
.chart-tabs button:hover { color: #e3e7e9; }
.chart-tabs button[aria-pressed="true"] { color: #74ddd3; border-bottom-color: #74ddd3; }
.chart-tabs button:focus-visible { outline: 2px solid #83e8df; outline-offset: 2px; }
.chart-note { margin-top: 8px; color: #a9afb8; font-size: 10px; line-height: 14px; }
.chart-note[hidden] { display: none; }
.chart { display: grid; grid-template-columns: 62px minmax(0, 1fr); margin-top: 14px; height: 184px; }
.chart-axis { display: flex; flex-direction: column; justify-content: space-between; height: 160px; padding: 10px 0 4px; color: #b5b6ba; font-size: 12px; font-variant-numeric: tabular-nums; }
.chart-main { min-width: 0; }
.plot { position: relative; height: 160px; cursor: crosshair; touch-action: pan-y; }
.plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.plot svg[hidden] { display: none; }
.chart-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; border: 1px dashed #343841; border-radius: 7px; color: #a9afb8; font-size: 12px; line-height: 19px; text-align: center; }
.chart-empty[hidden], .chart-tooltip[hidden] { display: none; }
.chart-tooltip { position: absolute; z-index: 2; min-width: 160px; padding: 9px 14px; border-radius: 9px; background: #292b36; box-shadow: 0 5px 20px #0003; text-align: center; font-size: 12px; line-height: 17px; color: #bbbcc4; white-space: nowrap; pointer-events: none; transform: translate(-50%, -100%); }
.chart-tooltip strong { display: block; color: #f3f3f6; font-weight: 500; font-size: 13px; margin-bottom: 2px; }
.chart-tooltip span { display: block; }
.chart-months { position: relative; height: 24px; color: #b5b6ba; font-size: 12px; }
.chart-months span { position: absolute; top: 9px; transform: translateX(-50%); }
.chart-months span:first-child { transform: none; }
.chart-months span:last-child { transform: translateX(-100%); }
.chart-months.monthly span:first-child, .chart-months.monthly span:last-child { transform: translateX(-50%); }

.metrics-card { border: 1px solid #30313a; padding: 17px 21px; }
.metrics-card h2 { margin: 0 0 20px; font-size: 14px; line-height: 18px; }
.metrics-list { display: grid; grid-template-columns: 1fr auto; column-gap: 16px; row-gap: 0; margin: 0; font-size: 12px; line-height: 23px; }
.metrics-list dt { color: #b8b9c1; }
.metrics-list dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.metrics-list .group-start { margin-top: 24px; }

.allocation-card { width: 100%; margin: 10px auto 0; padding: 23px 30px 25px; border: 1px solid #30313a; border-radius: 10px; background: #191a20; }
.allocation-heading h2 { font-size: 14px; line-height: 18px; }
.allocation-heading p { margin: 7px 0 0; color: #999ba5; font-size: 12px; }
.allocation-body { display: grid; grid-template-columns: minmax(230px, .8fr) minmax(0, 2fr); align-items: center; gap: 35px; margin-top: 2px; }
.allocation-visual { position: relative; justify-self: center; width: 200px; height: 200px; }
.allocation-visual svg { width: 100%; height: 100%; }
.allocation-visual circle[data-index] { cursor: pointer; transition: opacity .15s ease, stroke-width .15s ease; }
.allocation-visual circle[data-index]:hover { opacity: 1; stroke-width: 20; }
.allocation-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.allocation-center span { color: #aeb1b8; font-size: 11px; }
.allocation-center strong { margin-top: 5px; color: #f5f6f7; font-size: 21px; font-weight: 600; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }
.allocation-center small { margin-top: 5px; color: #898e98; font-size: 10px; }
.allocation-legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.allocation-item { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-width: 0; min-height: 42px; padding: 6px 10px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: #f1f2f4; text-align: left; cursor: pointer; }
.allocation-item:hover { background: #24272c; }
.allocation-item[aria-pressed="true"] { background: #263331; border-color: #3f625d; }
.allocation-item:focus-visible { outline: 2px solid #83e8df; outline-offset: 2px; }
.allocation-swatch { width: 8px; height: 8px; border-radius: 2px; }
.allocation-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.allocation-values { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; font-size: 12px; font-variant-numeric: tabular-nums; }
.allocation-values small { color: #a9adb5; font-size: 11px; }

.trades-card { width: 100%; margin: 10px auto 0; border: 1px solid #30313a; border-radius: 10px; background: #1b1b21; overflow: hidden; }
.trades-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 30px 18px; }
.trades-heading h2 { font-size: 15px; line-height: 20px; }
.trades-heading p { margin: 5px 0 0; color: #a4a6af; font-size: 12px; }
.trades-tag { flex: none; border: 1px solid #343940; border-radius: 4px; padding: 5px 8px; color: #a9b5b8; font-size: 10px; }
.trades-scroll { overflow-x: auto; scrollbar-color: #3d3e45 transparent; }
.trades-table { width: 100%; min-width: 850px; border-collapse: collapse; text-align: left; font-size: 12px; font-variant-numeric: tabular-nums; }
.trades-table th { height: 39px; padding: 0 20px; background: #151519; color: #b7b8bd; font-size: 10px; font-weight: 400; white-space: nowrap; }
.trades-table th:first-child, .trades-table td:first-child { padding-left: 30px; }
.trades-table th:last-child, .trades-table td:last-child { padding-right: 30px; }
.trades-table td { height: 49px; padding: 0 20px; border-top: 1px solid #2a2b32; white-space: nowrap; }
.trades-table tbody tr:hover { background: #232a2b; }
.trade-pair { font-weight: 500; }
.trade-side { display: inline-block; min-width: 45px; border-radius: 4px; padding: 4px 6px; text-align: center; font-size: 11px; }
.trade-side.long { background: #25433c; color: #6ee0bc; }
.trade-side.short { background: #3f3537; color: #e9a68e; }
.trades-footer { padding: 13px 30px; border-top: 1px solid #2a2b32; color: #989ba5; font-size: 11px; }

@media (max-width: 1100px) {
  .dashboard { width: calc(100% - 48px); }
  .details-grid { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); }
  .profit-card { padding-left: 22px; padding-right: 22px; }
}
@media (max-width: 750px) {
  .dashboard { width: calc(100% - 32px); padding-top: 28px; }
  .details-grid { grid-template-columns: 1fr; }
  .profit-card { height: 350px; }
  .metrics-card { height: auto; min-height: 350px; }
  .bot-grid { padding-left: 20px; padding-right: 20px; }
  .profit-amount { font-size: 22px; }
  .allocation-body { grid-template-columns: 1fr; gap: 8px; margin-top: 13px; }
  .allocation-card { padding: 20px; }
  .trades-heading { padding: 18px 20px; }
  .trades-table th:first-child, .trades-table td:first-child { padding-left: 20px; }
  .trades-footer { padding: 13px 20px; }
}
@media (max-width: 440px) {
  .profit-card { padding: 25px 15px 20px; height: 340px; }
  .profit-card.gridbot-chart { height: 395px; }
  .profit-header h2 { font-size: 15px; }
  .profit-amount { font-size: 19px; }
  .profit-subtitle { gap: 8px; font-size: 10px; }
  .range-button { min-width: 119px; padding: 0 8px; font-size: 10px; }
  .range-menu { width: 132px; }
  .chart-tabs { gap: 10px; margin-top: 11px; }
  .chart-tabs button { font-size: 10px; }
  .chart { grid-template-columns: 49px minmax(0, 1fr); margin-top: 13px; }
  .chart-axis, .chart-months { font-size: 10px; }
  .chart-tooltip { min-width: 140px; font-size: 10px; padding: 7px; }
  .allocation-legend { grid-template-columns: 1fr; gap: 3px; }
}
