:root {
  color-scheme: dark;
  --bg: #101116;
  --surface: #181a23;
  --surface-2: #20232f;
  --line: #2b2e3c;
  --text: #f3f2f7;
  --muted: #a4a8ba;
  --accent: #c1a8ff;
  --accent-fill: #a783f8;
  --positive: #71d6ad;
  --negative: #ff9aab;
  --warning: #edbb7b;
  --sidebar: #14151d;
  --radius: 16px;
  --sidebar-width: 232px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, select, input, textarea { font: inherit; color: inherit; }
button, select { cursor: pointer; }
:disabled { cursor: default; opacity: .58; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.15; }
h1 { font-size: clamp(29px, 3.25vw, 46px); font-weight: 690; letter-spacing: -.05em; }
h2 { font-size: clamp(19px, 2vw, 24px); letter-spacing: -.025em; }
h3 { font-size: 16px; }
svg { flex-shrink: 0; }
.muted { color: var(--muted); }
.positive { color: var(--positive); }
.negative { color: var(--negative); }
.eyebrow {
  color: var(--accent);
  font-size: .73rem;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-weight: 650;
  text-align: center;
}
.button:hover { border-color: var(--muted); }
.button.primary { color: #141024; background: var(--accent-fill); border-color: var(--accent-fill); }
.button.primary:hover { background: var(--accent); border-color: var(--accent); }
.button.quiet { background: transparent; }
.button svg { width: 20px; height: 20px; }
.page-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  gap: 10px 24px;
  margin-bottom: 24px;
}
.page-heading p { max-width: 60ch; margin-top: 6px; }
.empty-state { min-height: 200px; padding: 28px; display: grid; justify-items: start; align-content: center; gap: 12px; }
.empty-state h1 { font-size: 26px; }
#app > .empty-state { width: min(500px, calc(100% - 32px)); margin: 12vh auto 0; }
.page-loading { padding: 18px 0; }
.boot-screen { min-height: 100svh; display: grid; justify-items: center; align-content: center; gap: 10px; }
.boot-screen .brand-name { font-size: 30px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); white-space: nowrap; }
.brand-name { font-size: 22px; font-weight: 770; letter-spacing: -.045em; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--accent);
  background: #2b2144;
  border: 1px solid #463061;
  border-radius: 11px;
}
.brand-mark svg { width: 20px; height: 20px; margin-top: -3px; }
.workspace-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  padding: 25px 16px 21px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  z-index: 3;
}
.workspace-sidebar .brand { margin: 0 8px; }
.workspace-nav { display: grid; gap: 5px; margin-top: 43px; }
.workspace-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 13px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 650;
}
.workspace-nav a svg, .profile-button svg, .profile-avatar svg { width: 20px; height: 20px; }
.workspace-nav a:hover, .profile-button:hover { color: var(--text); background: var(--surface-2); }
.workspace-nav a[aria-current="page"] {
  color: var(--accent);
  background: #272039;
  border-color: #3a2c54;
}
.sidebar-footer { color: var(--muted); margin: auto 8px 0; font-size: .82rem; }
.workspace-top {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 65px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-left: var(--sidebar-width);
  padding: 10px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.brand-mobile { display: none; }
.top-controls { display: flex; align-items: center; gap: 14px; }
.profile-button, .market-status {
  min-height: 35px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 9px;
  color: var(--muted);
  font-size: .82rem;
}
.profile-button[aria-current="page"] { color: var(--accent); border-color: #44345d; }
.market-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--positive);
}
.market-status.stale::before { background: var(--warning); }
.workspace-main {
  width: auto;
  margin-left: var(--sidebar-width);
  padding: 31px clamp(22px, 3.25vw, 56px) 55px;
}
.market-notice {
  padding: 10px 14px;
  margin-bottom: 16px;
  background: #281f18;
  border: 1px solid #4b372a;
  border-radius: 10px;
  color: var(--warning);
  font-size: .86rem;
}
.profile-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  max-width: 640px;
  padding: 20px;
}
.profile-avatar { width: 46px; height: 46px; display: grid; place-items: center; background: #29203d; border-radius: 12px; color: var(--accent); }
.profile-card .login-error, .profile-status, .telegram-link-form { grid-column: 1 / -1; }
.telegram-link-form { display: grid; justify-items: start; gap: 10px; }
.telegram-link-form .auth-field { width: min(100%, 300px); }
.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 480px) minmax(0, 620px);
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  padding: clamp(22px, 6vw, 88px);
  gap: clamp(30px, 6vw, 86px);
  background: radial-gradient(ellipse at 70% 45%, #1b172b, transparent 62%), var(--bg);
}
.login-card { width: min(100%, 400px); }
.login-card .brand { margin-bottom: 36px; }
.login-card .eyebrow { margin-bottom: 8px; }
.login-card h1 { font-size: clamp(32px, 4vw, 52px); }
.auth-description { margin-top: 14px; }
.auth-form { display: grid; gap: 12px; margin-top: 24px; }
.auth-field { display: grid; gap: 5px; font-weight: 650; }
.auth-field input {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  font-size: 16px;
  font-weight: 400;
}
.auth-field .recovery-code { font-family: ui-monospace, monospace; }
.auth-hint { margin-top: -7px; font-size: .88rem; }
.auth-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.auth-form .auth-actions { margin-top: 0; }
.login-error { color: var(--negative); }
.login-error:empty, .auth-form [role="status"]:empty { margin: 0; padding: 0; height: 0; overflow: hidden; }
.auth-form .login-error:empty, .auth-form [role="status"]:empty { margin-top: -12px; }
.profile-card .login-error:empty { display: none; }
.telegram-login { margin-top: 12px; }
.login-visual {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #3c3254;
  border-radius: 24px;
  background: linear-gradient(155deg, #211b36, #171922);
  box-shadow: 0 28px 80px #08080d99;
}
.login-visual svg { display: block; width: 100%; }
@media (max-width: 820px) {
  .workspace-sidebar { display: contents; }
  .workspace-sidebar > .brand, .sidebar-footer { display: none; }
  .workspace-sidebar .workspace-nav {
    position: fixed;
    right: max(10px, env(safe-area-inset-right));
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: max(10px, env(safe-area-inset-left));
    z-index: 4;
    width: auto;
    max-width: 510px;
    min-height: 58px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1px;
    margin: 0 auto;
    padding: 4px;
    border: 1px solid #3b3d4c;
    border-radius: 32px;
    background: #191b25f7;
    box-shadow: 0 7px 32px #0009;
    backdrop-filter: blur(16px);
  }
  .workspace-nav a { flex-direction: column; justify-content: center; gap: 2px; min-height: 48px; padding: 4px 1px; border-radius: 26px; font-size: clamp(10px, 2.45vw, 12px); }
  .workspace-nav a svg { width: 18px; height: 18px; }
  .workspace-top { min-height: 57px; justify-content: space-between; gap: 8px; margin-left: 0; padding: 8px 14px; }
  .brand-mobile { display: inline-flex; }
  .brand-mobile .brand-mark { width: 32px; height: 32px; }
  .brand-mobile .brand-name { font-size: 19px; }
  .top-controls { min-width: 0; gap: 6px; }
  .profile-button { flex: 0 0 35px; width: 35px; justify-content: center; padding-inline: 0; }
  .profile-button span { display: none; }
  .market-status { min-width: 0; padding: 3px 6px; font-size: .73rem; white-space: nowrap; }
  .market-status::before { flex-shrink: 0; }
  .market-status span { overflow: hidden; text-overflow: ellipsis; }
  .workspace-main { margin-left: 0; padding: 23px 15px calc(88px + env(safe-area-inset-bottom)); }
  .page-heading { margin-bottom: 17px; }
  .login-layout { grid-template-columns: minmax(0, 400px); padding: 30px 22px; }
  .login-card .brand { margin-bottom: 23px; }
  .login-visual { display: none; }
}
@media (max-width: 540px) {
  .profile-card { grid-template-columns: auto 1fr; padding: 14px; }
  .profile-card > .button { grid-column: 1 / -1; }
}
