:root {
  --bg: #000;
  --line: #121214;
  --text: #f2f2f3;
  --muted: #6f6f73;
  --green: #55e9b0;
  --green-soft: #b4f5da;
  --red: #fb4d6a;
  --red-soft: #ffd0d7;
  --amber: #e8a317;
  --win-bg: #053222;
  --loss-bg: #43101a;
  --flat-bg: #15291f;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.4 Manrope, "Segoe UI", system-ui, sans-serif; }
main { max-width: 1280px; margin: 0 auto; padding: 14px 13px 24px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.spacer { flex: 1; }

#login { display: flex; flex-direction: column; gap: 10px; width: min(300px, calc(100% - 32px)); margin: 22vh auto 0; }
#login .btn { padding: 9px 14px; }
#loginError { color: var(--red); font-size: 13px; text-align: center; min-height: 18px; }

.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.sessions { flex: 1; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; min-width: 0; }
.session { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 5px 10px; font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.session::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #333338; }
.session b { font-weight: 600; }
.session.open { border-color: #0a5a3e; background: #010d08; color: var(--green-soft); }
.session.open::before { background: var(--green); }
.btn, .pill { background: none; border: 1px solid #222226; border-radius: 10px; padding: 6px 14px; font-size: 13px; }
.btn.primary { background: #fff; border-color: #fff; color: #000; font-weight: 600; }.pill { border-radius: 999px; padding: 4px 11px; font-size: 12px; margin-left: 12px; }
.icon { background: none; border: 0; color: #a9a9ad; font-size: 22px; line-height: 1; padding: 2px 8px; }

.cards { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.card { border: 1px solid var(--line); border-radius: 16px; padding: 15px 20px; min-height: 127px; min-width: 0; }
.card h2 { margin: 0 0 10px; font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.value { font-size: 29px; font-weight: 700; line-height: 1.25; }
.value.big { font-size: 36px; }
.sub { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
#netCard.win { border-color: #08331f; background: #010d08; }
#netCard.win .value { color: var(--green); }
#netCard.loss { border-color: #3d0f18; background: #0f0306; }
#netCard.loss .value { color: var(--red); }
.w { color: #00d27a; }
.l { color: var(--red); }
.b { color: var(--amber); }
.dot { color: #333; margin: 0 8px; }

.calendar { border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.calendar header { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 0 0 6px; }
#monthName { min-width: 118px; text-align: center; font-size: 14px; font-weight: 600; }
.total { color: var(--muted); font-size: 12.5px; }
.total b { font-weight: 600; margin-left: 3px; }
.win-text { color: var(--green); }
.loss-text { color: var(--red); }

.grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) 78px; gap: 4px; }
.dow { text-align: center; font-size: 10px; color: #55555a; text-transform: uppercase; padding: 2px 0; }
.blank { min-height: 115px; }
.day { position: relative; min-height: 115px; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 14px 2px 4px; background: none; border: 1px solid var(--line); border-radius: 10px; line-height: 1.2; }
.day:hover { border-color: #3a3a40; }
.num { position: absolute; top: 5px; left: 6px; font-size: 11px; color: var(--muted); }
.day.win, .day.loss, .day.flat { border-color: transparent; }
.day.win { background: var(--win-bg); color: var(--green-soft); }
.day.loss { background: var(--loss-bg); color: var(--red-soft); }
.day.flat { background: var(--flat-bg); color: #c4cfc9; }
.day.win:hover, .day.loss:hover, .day.flat:hover { filter: brightness(1.25); }
.day.best { border-color: #0a8a5c; }
.day.worst { border-color: #a93450; }
.amount { font-size: 13px; font-weight: 700; white-space: nowrap; }
.count { font-size: 10.5px; font-weight: 600; opacity: .85; }
.ratio { font-size: 10px; opacity: .55; }
.week { display: flex; flex-direction: column; justify-content: center; padding-left: 4px; font-size: 10.5px; color: var(--muted); min-width: 0; }
.week b { font-size: 13px; }

dialog { width: min(440px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 16px; background: #0a0a0c; color: var(--text); border: 1px solid #232327; border-radius: 16px; }
dialog::backdrop { background: rgba(0, 0, 0, .72); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
#list { list-style: none; margin: 0 0 12px; padding: 0; }
#list:empty { display: none; }
#list li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid #1a1a1e; }
#list .info { flex: 1; min-width: 0; overflow-wrap: anywhere; }
#list .info small { display: block; color: var(--muted); }
#list .btn { padding: 3px 9px; font-size: 12px; }
form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); min-width: 0; }
input, select, textarea { width: 100%; background: #000; color: var(--text); border: 1px solid #2a2a30; border-radius: 9px; padding: 8px 10px; font-size: 16px; }
textarea { resize: vertical; }
.wide { grid-column: 1 / -1; }
.actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 760px) {
  main { padding: 10px 8px 20px; }
  .toolbar { flex-wrap: wrap; }
  #import { margin-left: auto; }
  .sessions { order: 1; flex-basis: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .session { padding: 5px 8px; font-size: 11.5px; }
  .cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  #netCard { grid-column: 1 / -1; }
  .card { min-height: 0; padding: 12px 14px; }
  .value { font-size: 24px; }
  .value.big { font-size: 30px; }
  .dot { margin: 0 3px; }
  .calendar { padding: 8px 4px; }
  .calendar .total { width: 100%; padding: 4px 8px 0; }
  .grid { grid-template-columns: repeat(7, minmax(0, 1fr)) 38px; gap: 2px; }
  .day, .blank { min-height: 56px; }
  .day { padding: 14px 0 2px; border-radius: 7px; }
  .num { top: 2px; left: 4px; font-size: 9.5px; }
  .amount { font-size: 10px; letter-spacing: -.02em; }
  .count, .ratio, .week span:last-child { display: none; }
  .week { padding-left: 1px; font-size: 9px; }
  .week b { font-size: 10px; }
}
