/* The trades Mini App, in Telegram's own colours (telegram-web-app.js sets the --tg-theme-* variables), with
   Telegram's dark theme as the fallback. Shares the calendar's markup with the desk (web/realcal.js). */
:root {
  --bg: var(--tg-theme-bg-color, #17212b);
  --card: var(--tg-theme-secondary-bg-color, #232e3c);
  --fg: var(--tg-theme-text-color, #f5f5f5);
  --hint: var(--tg-theme-hint-color, #708499);
  --link: var(--tg-theme-link-color, #6ab3f3);
  --line: color-mix(in srgb, var(--hint) 25%, transparent);
  --up: #22ab94;
  --down: #ff5b67;
  --rc-flat: var(--card);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, Roboto, 'Segoe UI', sans-serif;
  font-variant-numeric: tabular-nums;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.up { color: var(--up); }
.down { color: var(--down); }
.cap { margin: 0 0 6px; font-size: 11.5px; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; color: var(--hint); }
.empty { color: var(--hint); text-align: center; padding: 18px 8px; margin: 0; }
.note { color: var(--hint); text-align: center; padding: 10px; margin: 0; }

.mini { padding: 12px 14px calc(24px + env(safe-area-inset-bottom)); max-width: 520px; margin: 0 auto; }
.hero { display: grid; justify-items: center; gap: 1px; padding: 4px 0 2px; }
.hero .k, .hero .s { color: var(--hint); font-size: 12.5px; }
.hero .v { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }
.spark { display: block; width: 100%; height: 56px; margin: 6px 0 10px; }
.bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.bar b { font-size: 16px; }
.nav { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--card); color: var(--link); font-size: 18px; }
.nav:disabled { opacity: 0.3; cursor: default; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 2px; border-radius: 9px; background: var(--card); margin-bottom: 10px; }
.seg button { border: 0; background: none; border-radius: 7px; padding: 5px 0; color: var(--hint); font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--bg); color: var(--fg); font-weight: 600; }

.rc-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.rc-wd { text-align: center; font-size: 11px; color: var(--hint); }
.rc-day { aspect-ratio: 1 / 1.1; border: 0; border-radius: 10px; background: color-mix(in srgb, var(--card) 55%, transparent);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 0; }
.rc-day b { font-size: 13px; font-weight: 600; }
.rc-day small { font-size: 10px; font-weight: 600; }
.rc-day.pad { background: none; }
.rc-day.future { opacity: 0.3; cursor: default; }
.rc-day.today { box-shadow: inset 0 0 0 1.5px var(--link); }
.rc-day.sel { box-shadow: inset 0 0 0 2px var(--fg); }

.latest { margin-top: 16px; }
.row { display: flex; width: 100%; justify-content: space-between; align-items: baseline; gap: 8px; padding: 9px 2px;
  border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; }
.row small { color: var(--hint); }

.scrim { position: fixed; inset: 0; background: rgb(0 0 0 / 0.45); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 78vh; display: flex; flex-direction: column;
  background: var(--bg); border-radius: 16px 16px 0 0; box-shadow: 0 -10px 40px rgb(0 0 0 / 0.35);
  transform: translateY(105%); transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
.sheet.open { transform: none; }
.grab { width: 38px; height: 4px; border-radius: 2px; background: var(--line); margin: 8px auto 4px; flex: none; }
.sheet-body { overflow-y: auto; padding: 4px 14px calc(20px + env(safe-area-inset-bottom)); display: grid; gap: 9px; }
.rc-dayhead { padding: 2px 0 6px; border-bottom: 1px solid var(--line); }
.rc-dayhead h3 { margin: 0; font-size: 17px; }
.rc-dayhead small { color: var(--hint); }
.rc-card { background: var(--card); border-radius: 12px; padding: 10px 12px; }
.rc-l1 { display: flex; align-items: baseline; gap: 6px; }
.rc-res { margin-left: auto; font-size: 15px; }
.rc-dir { font-size: 11px; font-weight: 600; padding: 0 5px; border-radius: 4px; }
.rc-dir.long { color: var(--up); background: color-mix(in srgb, var(--up) 18%, transparent); }
.rc-dir.short { color: var(--down); background: color-mix(in srgb, var(--down) 16%, transparent); }
.rc-eng, .rc-l2 { color: var(--hint); font-size: 12px; }
.rc-test { color: #f0b90b; font-size: 10px; font-weight: 600; }
.rc-l2 { display: flex; justify-content: space-between; gap: 8px; margin: 2px 0 7px; }
.rc-l2 span:last-child { font-weight: 600; }
.rc-card dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 12px; margin: 0; font-size: 12.5px; }
.rc-card dt { color: var(--hint); }
.rc-card dd { margin: 0; text-align: right; }
.rc-card dd small { color: var(--hint); }
@media (prefers-reduced-motion: reduce) {
  .sheet, .scrim { transition: none; }
}
