:root {
  --pos: #36ad69;
  --neg: #cf4238;
  --pos-tint: rgba(54, 173, 105, 0.16);
  --neg-tint: rgba(207, 66, 56, 0.16);
  --line-series: #4c9ee8;
  --grid: #232833;
}
main.wide { max-width: 1240px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); font-size: 14px; }
h2 { margin: 0; font-size: 16px; font-weight: 600; }

button.ghost {
  height: 40px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--field); color: var(--text); font: 600 14px inherit; font-family: inherit; cursor: pointer;
}
button.ghost:hover { border-color: #4a5261; }
button.ghost.icon { width: 40px; padding: 0; display: grid; place-items: center; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.presets { display: flex; flex-wrap: wrap; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 4px; }
.presets button {
  height: 36px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); font: 600 14px inherit; font-family: inherit; cursor: pointer;
}
.presets button:hover { color: var(--text); }
.presets button[aria-pressed="true"] { background: #2f3642; color: var(--text); }
.custom { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.custom input[type=date] {
  height: 44px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: 500 14px var(--mono); color-scheme: dark;
}
.sync { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi .k { font-size: 13px; color: var(--muted); }
.kpi .v { font: 600 24px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .s { font-size: 13px; color: var(--muted); min-height: 18px; }

.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
figure.chart { margin: 0; gap: 12px; }
figcaption { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.sw.pos { background: var(--pos); } .sw.neg { background: var(--neg); }
.plot { position: relative; height: 240px; }
.plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.plot .empty { height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.axis text { fill: var(--muted); font: 11px var(--mono); }
.gridline { stroke: var(--grid); stroke-width: 1; }
.zero { stroke: #4a5261; stroke-width: 1; }
.bar { cursor: default; }
.bar:hover, .bar.hot { filter: brightness(1.25); }

.tip {
  position: fixed; z-index: 10; pointer-events: none; min-width: 140px;
  background: #0b0e12; border: 1px solid #3a404d; border-radius: 8px; padding: 8px 10px;
  font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
.tip .tv { font: 600 15px var(--mono); color: var(--text); }
.tip .tl { color: var(--muted); }

.cal-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cal-head h2 { min-width: 150px; text-align: center; font-size: 17px; }
.cal-total { margin-left: auto; font-size: 14px; color: var(--muted); }
.cal-total b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(0, 1.1fr); gap: 6px; }
.cal-dow { font-size: 12px; color: var(--muted); text-align: center; padding: 2px 0 4px; }
.cell {
  min-height: 92px; border-radius: 9px; border: 1px solid var(--line); background: #13171d;
  padding: 8px; display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.cell.out { opacity: .35; }
.cell .d { font-size: 12px; color: var(--muted); }
.cell .p { font: 600 15px var(--mono); margin-top: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell .m { font-size: 12px; color: #c9ccd2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell .pc { display: none; }
.cell.win { background: var(--pos-tint); border-color: rgba(54,173,105,.55); }
.cell.loss { background: var(--neg-tint); border-color: rgba(207,66,56,.55); }
.cell.flat { border-color: #4a5261; }
.cell.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cell.week { background: var(--card); }
.cell.week .d { font-weight: 600; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid #1f242d; white-space: nowrap; }
td.num, th.num { text-align: right; font-family: var(--mono); }
td .side { display: inline-block; min-width: 38px; font-size: 12px; font-weight: 700; }
tbody tr:hover td { background: #1a1f27; }
.trades .none { color: var(--muted); padding: 14px 10px; }

@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .charts { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .bar .nav { margin-left: 0; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sync { margin-left: 0; }
  .cal-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
  .cell { min-height: 58px; padding: 4px; }
  .cell .m { display: none; }
  .cell .p { display: none; }
  .cell .pc { display: block; font-size: 11px; }
  .kpi .v { font-size: 20px; }
  .cell.week, .cal-dow.wk { display: none; }
  .cal-head h2 { min-width: 0; flex: 1; }
  .cal-total { margin-left: 0; width: 100%; }
}
