@font-face {
  font-family: Manrope;
  src: url("/assets/manrope-latin.woff2") format("woff2");
  font-display: swap;
  font-weight: 200 800;
  unicode-range: U+0000-00FF,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215;
}

@font-face {
  font-family: Manrope;
  src: url("/assets/manrope-cyrillic.woff2") format("woff2");
  font-display: swap;
  font-weight: 200 800;
  unicode-range: U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;
}

:root {
  color-scheme: dark;
  --ink: #111019;
  --surface: #191722;
  --surface-up: #232030;
  --line: #363044;
  --text: #f6f2f9;
  --muted: #bdb4cb;
  --accent: #c2acf6;
  --accent-text: #21172c;
  --pink: #edabc8;
  --mint: #96ddc1;
  --red: #ffafba;
  --radius: 22px;
  --tap: 46px;
  font: 500 16px/1.55 Manrope, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; background: var(--ink); color: var(--text); }
button, input, select { font: inherit; }
a { color: inherit; }
button { color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
::selection { color: var(--accent-text); background: var(--accent); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.05rem, 4.3vw, 3.25rem); line-height: 1.11; letter-spacing: -.058em; font-weight: 800; overflow-wrap: anywhere; }
h2 { font-size: clamp(1.18rem, 2.4vw, 1.4rem); line-height: 1.28; letter-spacing: -.035em; }
h3 { font-size: 1.05rem; line-height: 1.31; letter-spacing: -.02em; }
p + p { margin-top: .65rem; }
.muted, small { color: var(--muted); }
small { font-size: .875rem; }
.skip-link { position: fixed; left: 12px; top: 12px; transform: translateY(-160%); padding: .65rem 1rem; background: var(--accent); color: var(--accent-text); border-radius: 10px; z-index: 10; }
.skip-link:focus { transform: none; }

.topbar { border-bottom: 1px solid var(--line); background: #14121c; }
.topbar-inner {
  width: min(100% - 64px, 1192px);
  margin: 0 auto;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; text-decoration: none; }
.brand-mark { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; overflow: hidden; background: #2b202d; }
.brand-mark img { display: block; width: 42px; height: 42px; object-fit: contain; }
.brand-name { font-size: 1.13rem; font-weight: 800; letter-spacing: -.05em; white-space: nowrap; }
.brand-name span { display: block; color: var(--muted); font-size: .76rem; font-weight: 650; letter-spacing: 0; }
.topbar-actions, #identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.wallet-shortcut { display: inline-flex; align-items: center; min-height: 40px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-weight: 760; white-space: nowrap; }
.wallet-shortcut:hover { background: var(--surface-up); }
#identity .account-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 14ch; color: var(--muted); }
.account-avatar { width: 33px; height: 33px; flex: none; display: grid; place-items: center; color: var(--pink); border: 1px solid #654658; background: #332334; border-radius: 50%; font-weight: 800; }
#identity button { min-width: 0; font-size: .9rem; }

.shell {
  width: min(100% - 64px, 1192px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 186px minmax(0, 1fr);
  gap: clamp(26px, 5vw, 62px);
  padding: clamp(35px, 6vw, 66px) 0 72px;
}
.shell:has(.navigation[hidden]) { grid-template-columns: minmax(0, 1fr); }
.navigation { align-self: start; position: sticky; top: 24px; display: grid; gap: 6px; }
.navigation a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  min-height: var(--tap);
  border: 1px solid transparent;
  border-radius: 13px;
  color: var(--muted);
  font-size: .925rem;
  font-weight: 720;
  text-decoration: none;
}
.navigation a:hover { background: var(--surface); color: var(--text); }
.navigation a[aria-current] { color: var(--accent); background: #251e34; border-color: #3e3055; }
.nav-icon { position: relative; display: block; width: 22px; height: 22px; flex: none; }
.nav-icon::before, .nav-icon::after { content: ""; position: absolute; }
.nav-overview::before { inset: 3px; border: 1.6px solid; border-radius: 4px; }
.nav-overview::after { inset: 3px 3px auto 3px; height: 7px; border-bottom: 1.5px solid; }
.nav-connect::before { top: 5px; left: 2px; right: 2px; height: 6px; border-top: 1.5px solid; border-right: 1.5px solid; transform: skewX(25deg); border-radius: 1px; }
.nav-connect::after { bottom: 4px; left: 2px; right: 2px; height: 6px; border-bottom: 1.5px solid; border-left: 1.5px solid; transform: skewX(25deg); border-radius: 1px; }
.nav-devices::before { inset: 4px 7px 5px 2px; border: 1.6px solid; border-radius: 3px; }
.nav-devices::after { inset: 8px 2px 3px 12px; border: 1.6px solid; border-radius: 3px; background: var(--ink); }
.nav-wallet::before { inset: 5px 2px 4px; border: 1.6px solid; border-radius: 4px; }
.nav-wallet::after { right: 5px; top: 10px; width: 4px; height: 4px; background: currentColor; border-radius: 50%; }
.nav-help::before { inset: 3px; border: 1.6px solid; border-radius: 50%; }
.nav-help::after { content: "?"; inset: 0; text-align: center; font-weight: 800; font-size: 15px; }

#page { min-width: 0; }
#page:focus { outline: none; }
.page-intro { margin: 0 0 14px; display: flex; justify-content: space-between; align-items: end; gap: 14px; flex-wrap: wrap; }
.page-intro p { margin-top: 10px; color: var(--muted); }
.eyebrow { color: var(--accent); font-size: .86rem; font-weight: 800; margin-bottom: 7px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, .9fr); gap: 16px; align-items: start; }
.stack { display: grid; gap: 14px; min-width: 0; }
.stack.compact { gap: 3px; }
.panel {
  min-width: 0;
  padding: clamp(16px, 2.9vw, 26px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-wrap: anywhere;
}
.page-intro + .panel, .panel + .panel, .dashboard-grid + .panel { margin-top: 16px; }
.stack > .panel + .panel, .dashboard-grid > .panel + .panel { margin-top: 0; }
.dashboard-grid > .panel:first-child { background: #211b2d; border-color: #503b62; }
.subscription-panel { background: #251e31; border-color: #503b62; box-shadow: inset 0 3px 0 #b4a0ec88; }
.subscription-metrics { display: grid; grid-template-columns: 1.1fr minmax(0, .85fr) minmax(0, 1fr); gap: 11px; margin-bottom: 16px; }
.subscription-panel .row-actions, .usage-progress { margin-top: 16px; }
.balance-value { display: block; font-size: clamp(1.65rem, 3.8vw, 2.4rem); font-weight: 800; margin-bottom: 11px; letter-spacing: -.04em; }
.panel-head, .row, .row-actions, .device-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.panel-head { margin-bottom: 16px; flex-wrap: wrap; }
.row-actions { justify-content: flex-start; flex-wrap: wrap; }
.panel-head p, .device-row p { margin-top: 4px; }
.panel > p + .row-actions, .panel > h2 + p, .panel > p + .stack, .row-actions + p { margin-top: 14px; }
.metric-value { color: var(--text); display: block; font-weight: 800; font-size: clamp(1.28rem, 2.7vw, 1.75rem); line-height: 1.25; letter-spacing: -.04em; }
.metric { min-width: 0; }
.metric p { margin: 0; }
.metric > span, .metric-label { color: var(--muted); font-size: .875rem; }
.badge { display: inline-flex; align-items: center; min-height: 27px; padding: 3px 9px; border: 1px solid #51425c; border-radius: 999px; color: var(--accent); font-size: .78rem; line-height: 1.3; font-weight: 800; }
.badge.ok { border-color: #35564e; color: var(--mint); }
.badge.attention, .danger { color: var(--red); }
.data-list { margin: 0; display: grid; gap: 9px; }
.data-list dt { color: var(--muted); }
.data-list dd { margin: 0; font-weight: 750; }
.data-list > .row, .data-list > div { border-bottom: 1px solid var(--line); padding: 8px 0; }
.data-list > .row:last-child, .data-list > div:last-child { border-bottom: 0; }

.primary, .secondary, .text-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--tap);
  max-width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 8px 15px;
  font-size: .94rem;
  font-weight: 800;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
}
.primary { background: var(--accent); color: var(--accent-text); }
.primary:hover { background: #d2bffa; }
.secondary { background: var(--surface-up); border-color: #494058; }
.secondary:hover { border-color: var(--accent); }
.text-link { border-color: transparent; background: transparent; color: var(--accent); padding-inline: 8px; }
.text-link:hover { text-decoration: underline; }
button:disabled { opacity: .66; cursor: wait; }
.action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick-card { display: flex; flex-direction: column; justify-content: flex-start; gap: 4px; background: var(--surface-up); padding: 13px; min-height: 84px; border: 1px solid var(--line); border-radius: 13px; text-decoration: none; }
.quick-card:hover { border-color: var(--accent); }
.quick-card p, .quick-card span { color: var(--muted); font-size: .86rem; }
.quick-card .quick-symbol { width: 34px; height: 34px; display: grid; place-items: center; background: #302844; color: var(--accent); border-radius: 10px; font-size: 1.18rem; margin-bottom: 3px; }
.empty-state { padding: 16px 0; color: var(--muted); }
.empty-state h2, .empty-state h3 { color: var(--text); }
.empty-state p { margin-top: 8px; }
.empty-state .row-actions { margin-top: 12px; }

.login-layout { max-width: 930px; margin: clamp(18px, 6vh, 65px) auto 0; }
.login-copy { min-width: 0; }
.login-copy h1 { max-width: 11ch; }
.login-copy p { color: var(--muted); max-width: 41ch; margin-top: .9rem; }
.login-card { min-height: 290px; margin: 0; display: grid; grid-template-columns: 1.25fr 1fr; align-items: center; gap: clamp(20px, 5vw, 52px); padding: clamp(23px, 5vw, 46px); border-color: #503b62; background: linear-gradient(120deg, #2a2136, #191722 55%); }
.login-card .primary { width: 100%; }
.login-card h2 + p, .login-card p + .primary { margin-top: 12px; }
.login-card .stack + p { margin-top: 12px; }
.login-layout .eyebrow { color: var(--pink); }
.connection-code { width: 100%; padding: 10px 12px; color: var(--text); border: 1px solid var(--line); border-radius: 10px; background: var(--ink); min-height: 42px; font-size: .9rem; text-overflow: ellipsis; overflow: hidden; }
.platform-switch { display: flex; flex-wrap: wrap; gap: 7px; }
.platform-switch button[aria-pressed="true"], .platform-switch button[aria-selected="true"] { border-color: var(--accent); color: var(--accent); }
.qr-image, .qr-image canvas, canvas.qr-image, .connection-qr canvas { display: block; max-width: min(100%, 245px); margin: 12px auto; padding: 5px; background: white; border-radius: 10px; }
.instruction-list { margin-block: 10px; padding-left: 23px; color: var(--muted); }
.field { display: grid; gap: 5px; }
.preview-banner { margin: 0 0 15px; padding: 8px 12px; border: 1px solid #654658; border-radius: 9px; color: var(--pink); }
.device-row { padding: 13px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.device-row button { flex: none; }
.table-wrap { overflow-x: auto; }
.activity-table { width: 100%; border-collapse: collapse; text-align: left; }
.activity-table th, .activity-table td { border-bottom: 1px solid var(--line); padding: 10px 9px; overflow-wrap: anywhere; }
.activity-table th { color: var(--muted); font-size: .84rem; }
.activity-table tr:last-child td { border-bottom: 0; }
.activity-table td:last-child { font-variant-numeric: tabular-nums; }
select { width: 100%; max-width: 26rem; min-height: var(--tap); border: 1px solid var(--line); border-radius: 11px; padding: 8px 12px; color: var(--text); background: var(--surface-up); }
progress { display: block; width: 100%; height: 9px; accent-color: var(--accent); }
details { border-bottom: 1px solid var(--line); padding: 10px 0; }
summary { cursor: pointer; min-height: 35px; font-weight: 750; }
details p { padding: 8px 0 12px; color: var(--muted); }
.skeleton, .loading-message { display: flex; align-items: center; gap: 12px; color: var(--muted); min-height: 60px; }
.loading-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: breathe 1.15s ease-in-out infinite alternate; }
@keyframes breathe { from { opacity: .48; } to { opacity: 1; } }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 4; max-width: min(calc(100vw - 44px), 28rem); padding: .8rem 1rem; color: var(--text); background: #30263d; border: 1px solid #68547a; border-radius: 13px; box-shadow: 0 9px 28px #0008; }

@media (max-width: 800px) {
  .topbar-inner { width: min(100% - 38px, 620px); min-height: 63px; }
  .shell { width: min(100% - 38px, 620px); grid-template-columns: minmax(0, 1fr); padding: 28px 0 calc(96px + env(safe-area-inset-bottom)); }
  .shell:has(.navigation[hidden]) { padding-bottom: 36px; }
  .navigation {
    position: fixed;
    inset: auto 0 0;
    z-index: 3;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1px;
    padding: 6px max(4px, calc((100vw - 600px) / 2)) calc(5px + env(safe-area-inset-bottom));
    background: #17141ff8;
    border-top: 1px solid var(--line);
  }
  .navigation a { flex-direction: column; justify-content: center; gap: 2px; padding: 5px 1px; min-height: 52px; font-size: clamp(.60rem, 2.3vw, .76rem); border-radius: 10px; }
  .nav-icon { width: 22px; height: 22px; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .dashboard-grid { gap: 13px; }
  .panel { padding: 17px; }
  .login-layout { margin: 12px 0 0; }
}
@media (max-width: 560px) {
  .dashboard-grid, .login-card { grid-template-columns: minmax(0, 1fr); }
  .login-card { min-height: 0; }
  .login-copy h1 { max-width: 12ch; }
  .topbar-actions, #identity { gap: 5px; }
  #identity .account-name, #identity .account-avatar { display: none; }
  .brand-name { font-size: 1.02rem; }
  .brand-name span { font-size: .72rem; }
  .brand { gap: 8px; }
  .brand-mark, .brand-mark img { width: 36px; height: 36px; }
  .wallet-shortcut { font-size: .83rem; padding-inline: 8px; }
  .row { flex-wrap: wrap; }
  .subscription-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; }
}
