/* Токены из артбордов Proxy-*: тёмная тема одна, светлой нет. */
:root {
  --bg: #000000;
  --card: #1C1C1F;
  --card-sunken: #151517;
  --line: #2E2E32;
  --text: #F5F5F7;
  --muted: #86868B;
  --paper: #FFFFFF;
  --r-group: 26px;
  --r-card: 18px;
  --r-button: 16px;
  --r-pill: 999px;
  --gutter: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Golos Text", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
}

body {
  font-family: var(--font);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--text); text-decoration: none; }

button { font-family: var(--font); }

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
}

.screen {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

/* ——— шапки ——— */

.topbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px var(--gutter) 12px;
}

.topbar-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  margin-left: -12px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.topbar-title {
  flex-grow: 1;
  min-width: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px var(--gutter) 14px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.brand-mark {
  font-size: 19px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
}

.brand-name {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.012em;
}

.page-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

/* ——— колонка контента ——— */

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 var(--gutter) 24px;
}

.group {
  padding: 12px;
  background: var(--card-sunken);
  border-radius: var(--r-group);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 20px;
  background: var(--card);
  border-radius: var(--r-card);
}

.card-stacked {
  gap: 14px;
  padding: 18px 20px 16px;
}

.stat-value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.stat-value-lg {
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.muted {
  font-size: 14px;
  color: var(--muted);
}

.section-label {
  padding: 10px 6px 0;
  font-size: 13px;
  color: var(--muted);
}

.lead {
  padding: 0 6px 2px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.status {
  padding: 2px 6px 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.primary-head {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.primary-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  background: var(--line);
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}

.primary-hint {
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

/* ——— кнопки ——— */

.buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 54px;
  padding: 8px 16px;
  border: 0;
  border-radius: var(--r-button);
  font-size: 16px;
  font-weight: 500;
  font-family: var(--font);
  background: var(--card);
  color: var(--text);
  text-align: center;
  cursor: pointer;
}

.btn-compact { min-height: 50px; }

.btn-accent {
  background: var(--text);
  color: #000000;
}

.btn[disabled] { opacity: 0.55; cursor: default; }

/* ——— списки строк ——— */

.list {
  background: var(--card);
  border-radius: var(--r-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  color: var(--text);
}

.row-static { color: var(--muted); }

.row-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.row-title {
  font-size: 15px;
  font-weight: 500;
}

.row-static .row-title { color: var(--muted); }

.row-hint {
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.row-note {
  flex-shrink: 0;
  font-size: 13px;
  color: var(--muted);
}

.row-chevron {
  flex-shrink: 0;
  color: var(--muted);
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 0 18px;
}

/* ——— QR и ссылка ——— */

.qr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 26px;
  background: var(--card);
  border-radius: var(--r-card);
}

.qr-paper {
  padding: 14px;
  background: var(--paper);
  border-radius: 14px;
  line-height: 0;
}

.qr-paper svg {
  display: block;
  width: 190px;
  height: 190px;
  max-width: 100%;
}

.qr-skeleton {
  width: 218px;
  max-width: 100%;
  aspect-ratio: 1;
  background: var(--line);
  border-radius: 14px;
}

.link-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.link-box {
  flex-grow: 1;
  min-width: 0;
  padding: 15px 18px;
  background: var(--card);
  border-radius: var(--r-button);
}

.link-text {
  display: block;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  background: var(--text);
  border-radius: var(--r-button);
  color: #000000;
  cursor: pointer;
}

/* ——— «как поставить» ——— */

.segmented {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--card);
  border-radius: var(--r-pill);
}

.segment {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 42px;
  padding: 0 6px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}

.segment[aria-current="true"] {
  background: var(--line);
  color: var(--text);
}

.step {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 18px;
}

.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.step-text {
  font-size: 15px;
  line-height: 1.4;
}

/* ——— трафик ——— */

.traffic-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 15px 18px;
}

.traffic-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.traffic-label { font-size: 15px; }

.traffic-bytes {
  flex-shrink: 0;
  font-size: 14px;
  color: var(--muted);
}

.bar {
  height: 4px;
  background: var(--line);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.bar-fill {
  height: 4px;
  background: var(--text);
  border-radius: var(--r-pill);
}

/* ——— сообщения ——— */

.notice {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  background: var(--card);
  border-radius: var(--r-card);
}

.notice-text {
  font-size: 15px;
  line-height: 1.5;
}

.notice-sub {
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

/* ——— вкладки ——— */

.tabs {
  margin-top: auto;
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 2px;
  padding: 7px 8px 26px;
  padding-bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--card);
  background: var(--bg);
}

/* display: flex у .tabs перебивает hidden из браузерного стиля, поэтому явно. */
.tabs[hidden] { display: none; }

.tab {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 7px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.tab[aria-current="page"] { color: var(--text); }

@media (prefers-reduced-motion: no-preference) {
  .qr-skeleton { animation: pulse 1.4s ease-in-out infinite; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
