/* Montserrat for everything — the geometric sans of the design reference — with Inter
   kept as a metric fallback. Self-hosted so the Mini App never waits on a third-party
   font host; each subset declares the unicode-range it covers, so a Latin-only screen
   does not download the Cyrillic files. */
@font-face {
  font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/inter-cyrillic-ext.woff2) format("woff2");
  unicode-range: u+0460-052f, u+1c80-1c8a, u+20b4, u+2de0-2dff, u+a640-a69f, u+fe2e-fe2f;
}
@font-face {
  font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/inter-cyrillic.woff2) format("woff2");
  unicode-range: u+0301, u+0400-045f, u+0490-0491, u+04b0-04b1, u+2116;
}
@font-face {
  font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/inter-latin-ext.woff2) format("woff2");
  unicode-range: u+0100-02ba, u+02bd-02c5, u+02c7-02cc, u+02ce-02d7, u+02dd-02ff, u+0304,
    u+0308, u+0329, u+1d00-1dbf, u+1e00-1e9f, u+1ef2-1eff, u+2020, u+20a0-20ab, u+20ad-20c0,
    u+2113, u+2c60-2c7f, u+a720-a7ff;
}
@font-face {
  font-family: Inter; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/inter-latin.woff2) format("woff2");
  unicode-range: u+00??, u+0131, u+0152-0153, u+02bb-02bc, u+02c6, u+02da, u+02dc, u+0304,
    u+0308, u+0329, u+2000-206f, u+20ac, u+2122, u+2191, u+2193, u+2212, u+2215, u+feff, u+fffd;
}
@font-face {
  font-family: Montserrat; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(fonts/montserrat-cyrillic-ext.woff2) format("woff2");
  unicode-range: u+0460-052f, u+1c80-1c8a, u+20b4, u+2de0-2dff, u+a640-a69f, u+fe2e-fe2f;
}
@font-face {
  font-family: Montserrat; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(fonts/montserrat-cyrillic.woff2) format("woff2");
  unicode-range: u+0301, u+0400-045f, u+0490-0491, u+04b0-04b1, u+2116;
}
@font-face {
  font-family: Montserrat; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(fonts/montserrat-latin-ext.woff2) format("woff2");
  unicode-range: u+0100-02ba, u+02bd-02c5, u+02c7-02cc, u+02ce-02d7, u+02dd-02ff, u+0304,
    u+0308, u+0329, u+1d00-1dbf, u+1e00-1e9f, u+1ef2-1eff, u+2020, u+20a0-20ab, u+20ad-20c0,
    u+2113, u+2c60-2c7f, u+a720-a7ff;
}
@font-face {
  font-family: Montserrat; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(fonts/montserrat-latin.woff2) format("woff2");
  unicode-range: u+00??, u+0131, u+0152-0153, u+02bb-02bc, u+02c6, u+02da, u+02dc, u+0304,
    u+0308, u+0329, u+2000-206f, u+20ac, u+2122, u+2191, u+2193, u+2212, u+2215, u+feff, u+fffd;
}

/* Warm near-black canvas, monochrome accent, no gradients or glows: the palette of
   the reference design. The accent is simply the ink colour, so green/orange/red for
   state are the only hues on screen — nothing competes with a running task's status.
   Dark is the default; `html[data-theme="light"]` swaps the same names, so every
   rule below stays theme-agnostic. */
:root {
  color-scheme: dark;

  --bg: #1a1918;
  --surface: #211f1e;
  --surface2: #2a2725;
  --surface3: #34302e;
  --fill: rgba(255, 255, 255, 0.06);
  --fill2: rgba(255, 255, 255, 0.1);
  --fill3: rgba(255, 255, 255, 0.15);
  --sep: rgba(255, 255, 255, 0.11);

  --label: #f7f5f3;
  --label2: rgba(247, 245, 243, 0.62);
  --label3: rgba(247, 245, 243, 0.34);

  --green: #3ec98f;
  --orange: #e8a84c;
  --red: #ff5f56;

  /* Names the markup uses. */
  --text: var(--label);
  --dim: var(--label2);
  --accent: var(--label);
  /* Text and glyphs on a filled accent take the canvas colour back. */
  --on-accent: #1a1918;
  --ink: var(--label);
  --card: var(--surface);
  --card2: var(--surface2);
  --line: var(--sep);
  --good: var(--green);
  --warn: var(--orange);
  --bad: var(--red);
  --accent-line: var(--accent);
  --radius: 14px;

  /* Tints as text need more lift than the same colour as a fill. */
  --good-soft: rgba(62, 201, 143, 0.16);
  --bad-soft: rgba(255, 95, 86, 0.18);
  --warn-soft: rgba(232, 168, 76, 0.16);
  --ink-good: #4fd8a0;
  --ink-bad: #ff8078;
  --ink-warn: #e8a84c;
  --pro-bg: #262322;
  /* Avatars stay near-grey: a rainbow of initials fights the single-accent palette. */
  --av-s: 5%;
  --av-l: 44%;

  /* Chrome and materials, so the accessibility fallbacks stay one-line swaps. */
  --chrome: rgba(26, 25, 24, 0.8);
  --chrome-solid: #1a1918;
  --chrome-line: rgba(255, 255, 255, 0.1);
  --chrome-fade: rgba(0, 0, 0, 0.45);
  --sheet-bg: rgba(33, 31, 30, 0.92);
  --sheet-solid: #211f1e;
  --sheet-line: rgba(255, 255, 255, 0.12);
  --sheet-shadow: 0 -18px 50px rgba(0, 0, 0, 0.55);
  --grab: rgba(247, 245, 243, 0.26);
  --thumb: var(--surface3);
  --thumb-shadow: none;
  --toast-bg: rgba(52, 48, 46, 0.94);
  --toast-solid: #34302e;
  --toast-fg: #f7f5f3;
  --card-shadow: inset 0 0 0 1px var(--sep);
  --lift: 0 14px 34px rgba(0, 0, 0, 0.5);
  --veil-rgb: 0, 0, 0;
  --veil-a: 0.6;

  --font-sans: Montserrat, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-title: var(--font-sans);

  /* Continuity curve used for taps; gestures go through springs in motion.js. */
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

/* Light set. The reference is dark-only, so this moves the same palette onto warm
   paper: the accent follows the ink and flips to near-black, and the account card keeps
   that same near-black, as a single dark block on paper. */
html[data-theme="light"] {
  color-scheme: light;

  --bg: #f1eeea;
  --surface: #fff;
  --surface2: #f6f4f1;
  --surface3: #e4dfd9;
  --fill: rgba(26, 25, 24, 0.06);
  --fill2: rgba(26, 25, 24, 0.1);
  --fill3: rgba(26, 25, 24, 0.15);
  --sep: rgba(26, 25, 24, 0.13);

  --label: #1a1918;
  --label2: rgba(26, 25, 24, 0.6);
  --label3: rgba(26, 25, 24, 0.34);

  --green: #0b8f63;
  --orange: #b5731a;
  --red: #c8372c;

  --on-accent: #fff;

  --good-soft: rgba(11, 143, 99, 0.12);
  --bad-soft: rgba(200, 55, 44, 0.12);
  --warn-soft: rgba(181, 115, 26, 0.13);
  --ink-good: #087a54;
  --ink-bad: #ab2c22;
  --ink-warn: #8d5810;
  --pro-bg: #1a1918;
  --av-s: 5%;
  --av-l: 52%;

  --chrome: rgba(241, 238, 234, 0.84);
  --chrome-solid: #f1eeea;
  --chrome-line: rgba(26, 25, 24, 0.12);
  --chrome-fade: rgba(26, 25, 24, 0.06);
  --sheet-bg: rgba(255, 255, 255, 0.92);
  --sheet-solid: #fff;
  --sheet-line: rgba(26, 25, 24, 0.1);
  --sheet-shadow: 0 -18px 50px rgba(26, 25, 24, 0.18);
  --grab: rgba(26, 25, 24, 0.24);
  --thumb: #fff;
  --thumb-shadow: 0 1px 2px rgba(26, 25, 24, 0.12);
  /* Transient messages stay dark in both themes, as they do on iOS. */
  --toast-bg: rgba(26, 25, 24, 0.94);
  --toast-solid: #1a1918;
  --toast-fg: #f7f5f3;
  --card-shadow: inset 0 0 0 1px var(--sep);
  --lift: 0 12px 26px rgba(26, 25, 24, 0.16);
  --veil-rgb: 26, 25, 24;
  --veil-a: 0.38;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.45 var(--font-sans);
  letter-spacing: -0.004em;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

/* Sheets dim and push the page back, so focus moves to the modal layer. */
#app {
  padding: 18px 18px 108px; max-width: 560px; margin: 0 auto;
  transform: scale(calc(1 - 0.024 * var(--sheet-p, 0)));
  transform-origin: 50% 0;
  border-radius: calc(20px * var(--sheet-p, 0));
  overflow: clip;
}

h1, h2 { font-family: var(--font-title); }

/* ---------- headers ---------- */
.header { display: flex; align-items: flex-end; gap: 10px; margin: 6px 0 16px; }
.header h1 { font-size: 1.625rem; line-height: 1.15; letter-spacing: -0.022em; font-weight: 700; margin: 0; }
.header .sub { color: var(--label2); font-size: 0.9375rem; line-height: 1.33;
  letter-spacing: -0.006em; margin-top: 3px; }

.hero { margin: 6px 0 26px; }
/* The reference block: a small accent kicker, a heavy wordmark, a grey line of prose.
   No logo tile and no gradient — the type carries the brand on its own. */
.eyebrow, .hero p.eyebrow {
  margin: 0 0 9px; color: var(--accent); font-size: 0.6875rem; line-height: 1.2;
  font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
}
.wordmark, .hero h1 {
  margin: 0; font-size: 2.25rem; line-height: 1.04; font-weight: 700;
  letter-spacing: -0.03em; color: var(--label);
}
.hero p { margin: 12px 0 0; color: var(--label2); font-size: 0.9375rem; line-height: 1.5;
  letter-spacing: -0.004em; max-width: 34ch; }

/* Grouped-list header, as in Settings. */
.sec {
  color: var(--accent); font-size: 0.6875rem; line-height: 1.2; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; margin: 30px 2px 10px;
}
.sec.first { margin-top: 4px; }

/* Way back from a screen that has no tab of its own. */
.backrow {
  display: inline-flex; align-items: center; gap: 2px; margin: 2px 0 0; padding: 4px 8px 4px 0;
  background: none; border: 0; color: var(--label2); font: inherit;
  font-size: 0.9375rem; letter-spacing: -0.006em; cursor: pointer;
}
.backrow svg { transform: rotate(180deg); }
.backrow + .sec { margin-top: 10px; }

/* ---------- surfaces ---------- */
.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--card-shadow);
  padding: 14px; margin-bottom: 10px;
}
.card.tap { cursor: pointer; }
/* A card that happens to be a link must still read as a card: the browser default
   paints anchors blue and underlines every line of text inside them. */
a.card, a.card:visited { display: block; color: inherit; text-decoration: none; }
a.card .chev { color: var(--label3); flex: 0 0 auto; }
/* The ribbon hangs over the top edge, so the card needs headroom of its own —
   otherwise it collides with whatever sits in the first row. */
.card.best {
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--accent);
  position: relative; padding-top: 22px;
}
.ribbon {
  position: absolute; top: -7px; right: 12px; background: var(--accent); color: var(--on-accent);
  font-size: 0.6875rem; line-height: 1.18; font-weight: 600; letter-spacing: 0.005em;
  padding: 3px 8px; border-radius: 999px;
}

.banner {
  display: flex; gap: 13px; align-items: center;
  background: var(--surface); border-radius: 16px; box-shadow: var(--card-shadow);
  padding: 14px; margin-bottom: 14px;
}
.banner .ico {
  width: 30px; height: 30px; flex: 0 0 auto; color: var(--accent);
  display: grid; place-items: center;
}
.banner b { display: block; font-size: 1.0625rem; line-height: 1.29;
  letter-spacing: -0.011em; font-weight: 600; }
.banner span { color: var(--label2); font-size: 0.8125rem; line-height: 1.38; letter-spacing: 0; }

.row { display: flex; gap: 12px; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; row-gap: 10px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--label2); font-size: 0.8125rem; line-height: 1.38; letter-spacing: 0; }

.cmd { display: flex; gap: 13px; align-items: flex-start; }
.cmd .ico {
  width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto;
  color: var(--accent);
}
.cmd b { font-size: 1.0625rem; line-height: 1.29; letter-spacing: -0.011em; font-weight: 600; }
.cmd p { margin: 3px 0 0; color: var(--label2); font-size: 0.8125rem; line-height: 1.38; letter-spacing: 0; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; font-weight: 600; font-size: 0.8125rem; color: #fff;
}

/* ---------- search ---------- */
.search {
  display: flex; align-items: center; gap: 8px; color: var(--label2);
  background: var(--fill); border-radius: 12px; padding: 9px 11px; margin-bottom: 14px;
}
.search input { flex: 1; background: none; border: 0; outline: none; color: var(--text);
  font: inherit; font-size: 1.0625rem; letter-spacing: -0.011em; }
.search input::placeholder { color: var(--label3); }

/* ---------- pills, tags ---------- */
.pill {
  font-size: 0.8125rem; line-height: 1.38; letter-spacing: 0; white-space: nowrap;
  padding: 3px 9px; border-radius: 999px; background: var(--fill); color: var(--label2);
}
.pill.accent { color: var(--ink); }
.pill.good { color: var(--ink-good); }
.pill.bad { color: var(--ink-bad); }
.pill.warn { color: var(--ink-warn); }
/* For a pill carrying a whole message rather than a status word. */
.pill.long { white-space: normal; }

.tags { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; scrollbar-width: none;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.tags::-webkit-scrollbar { display: none; }
.tag {
  white-space: nowrap; padding: 6px 13px; border-radius: 999px; scroll-snap-align: start;
  font-size: 0.9375rem; letter-spacing: -0.006em;
  background: var(--fill); color: var(--text); border: 0;
}
.tag.on { background: var(--accent); color: var(--on-accent); }

/* ---------- segmented control ---------- */
.seg {
  position: relative; display: flex; background: var(--fill); border-radius: 999px;
  padding: 2px; margin-bottom: 14px; isolation: isolate;
}
.seg-thumb {
  position: absolute; top: 2px; bottom: 2px; z-index: -1; border-radius: 999px;
  background: var(--thumb); box-shadow: var(--thumb-shadow);
  left: calc(2px + var(--i, 0) * (100% - 4px) / var(--n, 1));
  width: calc((100% - 4px) / var(--n, 1));
  transition: left 0.28s var(--ease);
}
.seg button {
  flex: 1; background: none; border: 0; color: var(--label2); font-family: inherit;
  font-size: 0.8125rem; line-height: 1.38; letter-spacing: 0; padding: 9px 4px;
  border-radius: 999px; transition: color 0.18s linear;
}
.seg button.on { color: var(--text); font-weight: 600; }

/* ---------- buttons ---------- */
.btn {
  display: block; width: 100%; padding: 15px; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font-family: inherit;
  font-size: 0.9375rem; line-height: 1.33; letter-spacing: -0.004em; font-weight: 600;
  margin-top: 10px;
}
/* Anything that is not the primary action is a hairline outline on bare canvas —
   the reference has no second filled colour, so neither does this. */
.btn.ghost { background: none; color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-line); }
.btn.line { background: none; color: var(--text); box-shadow: inset 0 0 0 1px var(--sep); }
.btn.danger { background: none; color: var(--ink-bad); box-shadow: inset 0 0 0 1px var(--bad-soft); }
/* The gap replaces the whitespace between an icon and its label: flex drops
   inter-node spaces, so `${svg(...)} Фильтры` would render glued together. */
.btn.sm { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: auto; padding: 8px 15px; border-radius: 999px; margin: 0;
  font-size: 0.875rem; letter-spacing: -0.002em; white-space: nowrap; }
.icobtn {
  width: 38px; height: 38px; border-radius: 999px; border: 0; background: var(--fill);
  color: var(--text); display: grid; place-items: center; flex: 0 0 auto;
}
.icobtn.accent { background: var(--accent); color: var(--on-accent); }
/* Small buttons keep their labels intact, so a crowded row has to wrap rather
   than push the last one out of its card. */
.row.actions { gap: 8px; row-gap: 8px; margin-top: 11px; }

/* Press feedback lands on pointer-down and is short enough to feel like contact. */
.is-press { transition: transform 0.1s ease-out, background 0.08s linear, opacity 0.08s linear; }
.btn.is-press, .qcard.is-press, .card.tap.is-press, .tile.is-press { transform: scale(0.975); }
.btn.is-press { filter: brightness(0.86); }
.btn.ghost.is-press, .btn.line.is-press, .btn.danger.is-press { background: var(--fill2); }
.qcard.is-press, .card.tap.is-press, .guide-row.is-press, .kv-row.is-press { background: var(--fill2); }
.icobtn.is-press, .tag.is-press, .pro-btn.is-press, .seg button.is-press { background: var(--fill3); }
.tabbar button.is-press { opacity: 0.45; }

/* ---------- form controls ---------- */
label.field { display: block; margin: 14px 0 0; }
label.field span { display: block; font-size: 0.8125rem; line-height: 1.38; letter-spacing: 0;
  color: var(--label2); margin-bottom: 7px; }
/* A control that serves the field above it: compact, so it cannot be mistaken
   for the primary action, and its result line collapses while it is empty. */
.field-aside { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.field-aside > .muted:empty { display: none; }
/* A primary action needs more air than the gap between two stacked fields,
   otherwise it reads as part of the last control. */
label.field + .btn, .field-aside + .btn { margin-top: 20px; }
input[type=text], input[type=tel], input[type=number], textarea, select {
  width: 100%; background: var(--fill); border: 0; color: var(--text);
  border-radius: 12px; padding: 12px 13px; font: inherit;
  font-size: 1.0625rem; letter-spacing: -0.011em; outline: none;
  box-shadow: inset 0 0 0 1px transparent; transition: box-shadow 0.15s ease-out;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.41; }
input[type=file] {
  width: 100%; background: var(--fill); color: var(--label2);
  border: 1px dashed var(--surface3); border-radius: 12px; padding: 13px;
  font: inherit; font-size: 0.8125rem;
}
input[type=file]::file-selector-button {
  background: var(--surface3); color: var(--text); border: 0; border-radius: 8px;
  padding: 7px 12px; margin-right: 12px; font: inherit; font-size: 0.8125rem; font-weight: 500;
}
input:focus, textarea:focus, select:focus { box-shadow: inset 0 0 0 1.5px var(--accent); }
input::placeholder, textarea::placeholder { color: var(--label3); }
.check { display: flex; align-items: center; gap: 10px; margin-top: 13px;
  font-size: 1rem; letter-spacing: -0.008em; }
.check input { width: 21px; height: 21px; accent-color: var(--accent); }

/* ---------- tab bar: translucent chrome, content scrolls underneath ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--chrome);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 0.5px solid var(--chrome-line);
  padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
  display: flex; max-width: 560px; margin: 0 auto;
}
/* Scroll edge effect instead of a hard divider where content meets the bar. */
.tabbar::before {
  content: ""; position: absolute; left: 0; right: 0; top: -22px; height: 22px;
  background: linear-gradient(to top, var(--chrome-fade), transparent);
  pointer-events: none;
}
.tabbar button {
  flex: 1; background: none; border: 0; color: var(--label3); font-family: inherit;
  font-size: 0.625rem; line-height: 1.2; letter-spacing: 0.01em; font-weight: 500;
  display: grid; gap: 3px; justify-items: center; padding: 4px 2px;
  transition: color 0.18s linear;
}
.tabbar button.on { color: var(--accent); }

/* ---------- sheet: draggable material that arrives rather than fades ---------- */
body.sheet-open { overflow: hidden; }
.sheet-wrap {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(var(--veil-rgb), calc(var(--veil-a) * var(--sheet-p, 1)));
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  background: var(--sheet-bg);
  backdrop-filter: blur(34px) saturate(180%);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
  border-top: 0.5px solid var(--sheet-line);
  border-radius: 14px 14px 0 0;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
  box-shadow: var(--sheet-shadow);
}
.sheet.enter { animation: materialize 0.42s var(--ease); }
@keyframes materialize {
  from { transform: translateY(100%) scale(0.96); opacity: 0.2; filter: blur(8px); }
  to { transform: none; opacity: 1; filter: blur(0); }
}
/* The handle is the always-available drag target, and marks the sheet as grabbable. */
.grabber {
  position: sticky; top: 0; z-index: 2; margin: 0 -16px 2px; padding: 7px 0 11px;
  display: grid; place-items: center; touch-action: none; cursor: grab;
}
.grabber::after {
  content: ""; width: 36px; height: 5px; border-radius: 999px;
  background: var(--grab);
}
.sheet h2 { margin: 0 0 5px; font-size: 1.375rem; line-height: 1.2;
  letter-spacing: -0.013em; font-weight: 650; }
.sheet .hint { color: var(--label2); font-size: 0.8125rem; line-height: 1.38;
  letter-spacing: 0; margin: 0 0 8px; }

/* ---------- inset grouped lists ---------- */
.guide-list, .kv, .steps {
  background: var(--surface); border-radius: 12px; overflow: hidden; margin-bottom: 10px;
  box-shadow: var(--card-shadow);
}
.kv { margin: 10px 0; }
.guide-row { position: relative; display: flex; gap: 13px; align-items: center; padding: 11px 14px;
  min-height: 48px; }
.guide-row .ico {
  width: 26px; height: 26px; display: grid; place-items: center; flex: 0 0 auto;
  color: var(--accent);
}
.guide-row .grow b { font-size: 1.0625rem; line-height: 1.29; letter-spacing: -0.011em;
  font-weight: 400; display: block; }
.guide-row .grow p { margin: 2px 0 0; color: var(--label2); font-size: 0.8125rem;
  line-height: 1.38; letter-spacing: 0; }
.guide-row .chev { color: var(--label3); flex: 0 0 auto; }
.guide-row .pill { flex: 0 0 auto; }
.guide-row input[type=checkbox] {
  width: 22px; height: 22px; flex: 0 0 auto; accent-color: var(--accent); pointer-events: none;
}
/* Hairline separators, inset past the icon like a native table view. */
.guide-row:not(:last-child)::after, .kv-row:not(:last-child)::after,
.step:not(:last-child)::after {
  content: ""; position: absolute; left: 53px; right: 0; bottom: 0; height: 1px;
  background: var(--sep); transform: scaleY(0.5); transform-origin: bottom;
}
.guide-row:not(:has(.ico)):not(:last-child)::after { left: 14px; }
.kv-row:not(:last-child)::after, .step:not(:last-child)::after { left: 14px; }

.kv-row { position: relative; display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 12px 14px; min-height: 44px;
  font-size: 1.0625rem; letter-spacing: -0.011em; }
.kv-row span { color: var(--label2); font-size: 1rem; letter-spacing: -0.008em; }
.kv-row .name { color: var(--label); }
.kv-row .pill { flex: 0 0 auto; }
/* An ellipsis only clips if the flex item is allowed to shrink below its text. */
.kv-row .ellipsis { min-width: 0; }
/* A row whose note is a sentence: status on the first line, explanation wrapped under it. */
.kv-row.col { display: block; }
.kv-row.col .kv-line { display: flex; justify-content: space-between; align-items: center;
  gap: 12px; }
.kv-row.col p { margin: 4px 0 0; }

.step { position: relative; display: flex; gap: 13px; padding: 13px 14px;
  font-size: 1rem; line-height: 1.41; letter-spacing: -0.008em; }
.step .n {
  width: 24px; height: 24px; border-radius: 999px; flex: 0 0 auto; background: var(--accent);
  color: var(--on-accent); display: grid; place-items: center; font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0;
}
.step b { font-weight: 550; display: block; }
.step p { margin: 2px 0 0; color: var(--label2); font-size: 0.8125rem; line-height: 1.38;
  letter-spacing: 0; }

/* ---------- documents ---------- */
/* The public documents inside a sheet. The browser page styles the same markup itself,
   at reading width; here the type steps down to fit a phone held in Telegram. */
.doc-body { margin: 4px 0 18px; }
/* An opener carries no href — it must still read and behave as a link. */
a[data-doc] { color: var(--text); text-decoration: underline; text-underline-offset: 2px;
  cursor: pointer; }
.doc-body h2 { font-size: 1rem; line-height: 1.3; letter-spacing: -0.011em; margin: 20px 0 6px; }
.doc-body h2:first-child { margin-top: 6px; }
.doc-body p, .doc-body li { color: var(--label2); font-size: 0.9375rem; line-height: 1.5;
  letter-spacing: 0; margin: 0 0 8px; }
.doc-body ul { margin: 0 0 8px; padding-left: 20px; }
.doc-body a { color: var(--text); }
.doc-body .box {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--card-shadow);
  padding: 12px 14px; margin: 16px 0;
}
.doc-body .box p:last-child { margin: 0; }
.doc-body .item { padding: 11px 0; border-bottom: 1px solid var(--sep); }
.doc-body .item .top { display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; color: var(--text); font-weight: 600; font-size: 0.9375rem; }
.doc-body .item p { margin: 3px 0 0; font-size: 0.875rem; }

/* ---------- empty state ---------- */
/* Leads a screen that has nothing on it yet: says what the thing is for, then one way forward. */
.hollow {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--card-shadow);
  padding: 30px 22px 24px; margin-bottom: 12px; text-align: center;
}
.hollow-ico {
  width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 999px;
  display: grid; place-items: center; color: var(--label2);
  background: var(--surface2); border: 1px solid var(--sep);
}
.hollow b { display: block; font-size: 1.1875rem; line-height: 1.25; letter-spacing: -0.012em;
  font-weight: 650; }
.hollow p { margin: 7px auto 18px; max-width: 30ch; color: var(--label2);
  font-size: 0.875rem; line-height: 1.43; letter-spacing: 0; }
.hollow .btn { width: auto; min-width: 190px; }

/* ---------- tariffs ---------- */
.tier {
  position: relative; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--card-shadow); padding: 14px; margin-bottom: 12px;
}
/* The «выгоднее всего» ribbon sits on the top edge, so that card gets extra headroom. */
.tier.best { box-shadow: inset 0 0 0 1px var(--accent); padding-top: 26px; }
.tier.mine { box-shadow: inset 0 0 0 1px var(--accent-line); }
.tier h3 { margin: 0; font-size: 1.25rem; line-height: 1.2; letter-spacing: -0.014em; font-weight: 700; }
.tier .note { color: var(--label2); font-size: 0.8125rem; line-height: 1.38; margin-top: 3px; }
.tier .now { font-size: 1.75rem; line-height: 1.14; letter-spacing: -0.018em; font-weight: 700; }
.tier .was { color: var(--label3); font-size: 1rem; text-decoration: line-through; }
.tier-feats { list-style: none; margin: 12px 0 14px; padding: 0; }
.tier-feats li {
  display: flex; gap: 8px; align-items: center; padding: 6px 0;
  font-size: 0.9375rem; line-height: 1.33; letter-spacing: -0.006em;
}
.tier-feats li { position: relative; }
.tier-feats li:not(:last-child)::after {
  content: ""; position: absolute; left: 22px; right: 0; bottom: 0; height: 1px;
  background: var(--sep); transform: scaleY(0.5); transform-origin: bottom;
}
.tier-feats .ok { color: var(--accent); display: grid; place-items: center; flex: 0 0 auto; }
.tier .btn { width: 100%; margin: 0; }
.tier-feats .grow { color: var(--label2); }

/* ---------- home ---------- */
.offer {
  background: var(--surface); border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
  box-shadow: var(--card-shadow);
}
.offer b { font-size: 1.0625rem; line-height: 1.29; letter-spacing: -0.011em; font-weight: 600; }
.offer .muted { display: block; margin-top: 3px; }
.offer .price { text-align: right; flex: 0 0 auto; }
.offer .price b { display: block; font-size: 1.375rem; line-height: 1.18; letter-spacing: -0.016em; }
.offer .price s { color: var(--label3); font-size: 0.8125rem; letter-spacing: 0; }

/* The account block: one flat near-black panel in both themes, held together by a
   hairline rather than a gradient. */
.pro {
  position: relative; overflow: hidden; border-radius: var(--radius); padding: 16px;
  margin-bottom: 12px; background: var(--pro-bg); color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.pro > * { position: relative; }
.pro b { font-size: 1.0625rem; line-height: 1.29; letter-spacing: -0.011em; font-weight: 600; }
/* Vibrancy: on a live gradient, secondary text needs contrast and weight, not grey. */
.pro-dim { font-size: 0.8125rem; line-height: 1.38; letter-spacing: 0.005em;
  color: rgba(255, 255, 255, 0.82); font-weight: 500; }
.pro-btn {
  background: rgba(255, 255, 255, 0.22); border: 0; color: #fff; font-family: inherit;
  font-size: 0.8125rem; letter-spacing: 0.005em; font-weight: 600;
  padding: 7px 11px; border-radius: 999px; display: flex; align-items: center; gap: 3px;
}
.pro-bal { margin: 18px 0 14px; }
.pro-bal span { display: block; font-size: 0.8125rem; letter-spacing: 0.005em;
  color: rgba(255, 255, 255, 0.82); font-weight: 500; }
.pro-bal b { font-size: 2.125rem; line-height: 1.06; letter-spacing: -0.021em; font-weight: 700; }
.pro-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 0.5px solid rgba(255, 255, 255, 0.28); padding-top: 12px;
  font-size: 0.8125rem; line-height: 1.38; letter-spacing: 0.005em;
  color: rgba(255, 255, 255, 0.86); font-weight: 500;
}
.pro-foot button {
  background: none; border: 0; color: #fff; font-family: inherit; padding: 0; flex: 0 0 auto;
  font-size: 0.8125rem; letter-spacing: 0.005em; font-weight: 600;
  display: flex; align-items: center; gap: 2px;
}

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--surface); border-radius: 14px; padding: 13px 14px;
  box-shadow: var(--card-shadow); }
.tile span { color: var(--label2); font-size: 0.8125rem; line-height: 1.38; letter-spacing: 0; }
.tile svg { color: var(--label3); }
.tile b { display: block; font-size: 1.75rem; line-height: 1.14; letter-spacing: -0.018em;
  font-weight: 700; margin-top: 5px; }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick .qcard { background: var(--surface); border-radius: 14px; padding: 13px 14px;
  box-shadow: var(--card-shadow); }
.quick .ico {
  width: 26px; height: 26px; display: grid; place-items: center;
  color: var(--accent); margin-bottom: 12px;
}
.quick b { display: block; font-size: 1rem; line-height: 1.31; letter-spacing: -0.008em;
  font-weight: 600; }
.quick span { display: block; color: var(--label2); font-size: 0.8125rem; line-height: 1.38;
  letter-spacing: 0; margin-top: 2px; }

/* ---------- misc ---------- */
.log { font-size: 0.8125rem; line-height: 1.38; letter-spacing: 0; color: var(--label2);
  border-left: 2px solid var(--surface3); padding: 2px 0 2px 10px; margin-top: 8px; }
.log.warn { border-color: var(--orange); }
.log.error { border-color: var(--red); color: var(--ink-bad); }
.empty { text-align: center; color: var(--label2); padding: 44px 16px;
  font-size: 1rem; line-height: 1.41; letter-spacing: -0.008em; }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translate(-50%, 0); z-index: 60; max-width: 88%;
  background: var(--toast-bg);
  backdrop-filter: blur(22px) saturate(180%); -webkit-backdrop-filter: blur(22px) saturate(180%);
  color: var(--toast-fg); padding: 11px 17px; border-radius: 999px;
  font-size: 0.9375rem; line-height: 1.33; letter-spacing: -0.006em; font-weight: 500;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  will-change: transform, opacity;
}

.skel { height: 64px; border-radius: 14px; background: var(--surface);
  animation: pulse 1.6s ease-in-out infinite; margin-bottom: 10px; }
@keyframes pulse { 50% { opacity: 0.45; } }

/* ---------- accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
  .sheet.enter { animation: none; }
  .seg-thumb, .is-press, .tabbar button, .seg button { transition: none; }
  .skel { animation: none; opacity: 0.6; }
  .btn.is-press, .qcard.is-press, .card.tap.is-press, .tile.is-press { transform: none; }
  #app { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .tabbar { background: var(--chrome-solid); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .sheet { background: var(--sheet-solid); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .toast { background: var(--toast-solid); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .search, .pill, .tag, .seg, .btn.ghost, .btn.line, .icobtn, input, textarea, select {
    background: var(--surface2);
  }
}
@media (prefers-contrast: more) {
  :root { --label2: rgba(247, 245, 243, 0.84); --label3: rgba(247, 245, 243, 0.56);
    --sep: rgba(255, 255, 255, 0.32); --edge: rgba(255, 255, 255, 0.28);
    --chrome-solid: #1a1918; --sheet-solid: #2a2725; }
  html[data-theme="light"] { --label2: rgba(26, 25, 24, 0.84); --label3: rgba(26, 25, 24, 0.58);
    --sep: rgba(26, 25, 24, 0.45); --edge: rgba(26, 25, 24, 0.36);
    --chrome-solid: #fff; --sheet-solid: #fff; }
  .card, .banner, .tile, .qcard, .guide-list, .kv, .steps, .offer {
    box-shadow: inset 0 0 0 1px var(--edge);
  }
  .tabbar, .sheet, .toast { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .tabbar { background: var(--chrome-solid); }
  .sheet { background: var(--sheet-solid); }
}
