/* Основа: стекло, карточки, строки, кнопки, чипы, поля, сегменты, переключатель, скелетоны.
   Перенесено из vMarket styles.css и упрощено; размеры — по правилам владельца
   (касание ≥ 48 px, текст ≥ 15 px, мелкие 13 px — только цифры). */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-body);
  font-size: 16px; line-height: 1.35;
  color: var(--text);
  background: var(--bg-body);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
img { display: block; }
#root { height: 100%; }

/* ───────── фон приложения со световыми пятнами (vMarket .app-bg) ───────── */
.app-bg { position: absolute; inset: 0; background: var(--bg-app); overflow: hidden; pointer-events: none; z-index: 0; }
.app-bg::before, .app-bg::after {
  content: ""; position: absolute; width: 70%; height: 50%; border-radius: 50%; filter: blur(80px);
}
.app-bg::before { top: -12%; left: -18%; opacity: 0.5; background: radial-gradient(circle at center, var(--accent-glow), transparent 70%); }
.app-bg::after { bottom: -10%; right: -25%; opacity: 0.2; background: radial-gradient(circle at center, var(--accent-2), transparent 70%); }
[data-theme="dark"] .app-bg::before { opacity: 0.34; }
[data-theme="dark"] .app-bg::after { opacity: 0.12; }

/* ───────── стекло ───────── */
.glass {
  position: relative;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  backdrop-filter: blur(24px) saturate(160%);
  border: 0.5px solid var(--glass-border);
  border-radius: var(--r-lg);
  box-shadow: inset 0 1px 0 var(--glass-inset), var(--glass-shadow);
}
.glass-strong { background: var(--glass-bg-strong); }

/* ───────── типографика ───────── */
.h1 { font-family: var(--font-head); font-size: 22px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; margin: 0; }
.h2 { font-family: var(--font-head); font-size: 18px; font-weight: 600; line-height: 1.25; margin: 0; }
.h3 { font-size: 17px; font-weight: 650; margin: 0; }
.t-soft { color: var(--text-soft); }
.t-mute { color: var(--text-mute); }
.t-accent { color: var(--accent); }
.t-green { color: var(--green); }
.t-amber { color: var(--amber); }
.t-red { color: var(--red); }
.cap { font-size: 15px; color: var(--text-soft); line-height: 1.35; }
.num { font-variant-numeric: tabular-nums; }
.small-num { font-size: 15px; font-variant-numeric: tabular-nums; color: var(--text-mute); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ───────── раскладка ───────── */
.col { display: flex; flex-direction: column; }
.row { display: flex; flex-direction: row; }
.aic { align-items: center; } .jcsb { justify-content: space-between; } .jcc { justify-content: center; }
.flex1 { flex: 1; min-width: 0; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; }
.gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.wrap { flex-wrap: wrap; }

/* ───────── кнопки (≥ 48 px, основная 52 px) ───────── */
.btn {
  appearance: none; border: 0; outline: none; cursor: pointer;
  min-height: 52px; width: 100%; padding: 0 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--r-md);
  font-size: 16px; font-weight: 650; letter-spacing: -0.005em;
  background: var(--bg-input); color: var(--text);
  transition: transform 0.13s cubic-bezier(0.3, 1.4, 0.45, 1), background 0.15s ease, opacity 0.15s ease;
  user-select: none;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled, .btn.is-disabled { opacity: 0.45; cursor: default; }
.btn-primary {
  background: linear-gradient(150deg, var(--accent-2) 0%, var(--accent) 60%);
  color: var(--on-accent);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 6px 16px var(--accent-glow);
}
.btn-soft { background: var(--accent-soft); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-sm { min-height: 48px; font-size: 15px; }
.btn .mp-spinner { width: 20px; height: 20px; border-width: 3px; }
.btn-primary .mp-spinner { border-color: rgba(255, 255, 255, 0.35); border-top-color: #fff; }

.icon-btn {
  appearance: none; border: 0; cursor: pointer; flex-shrink: 0;
  width: 48px; height: 48px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; position: relative;
  background: var(--bg-input); color: var(--text-soft);
  transition: transform 0.13s cubic-bezier(0.3, 1.4, 0.45, 1), background 0.15s;
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn.is-accent { background: var(--accent-soft); color: var(--accent); }
.icon-btn.is-plain { background: transparent; }
.icon-btn:disabled { opacity: 0.4; }

/* ───────── чипы ───────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  min-height: 28px; padding: 3px 10px; border-radius: var(--r-pill);
  font-size: 15px; font-weight: 600; line-height: 1.2; white-space: nowrap;
  background: var(--accent-soft); color: var(--accent);
}
.chip-green { background: var(--green-soft); color: var(--green); }
.chip-amber { background: var(--amber-soft); color: var(--amber); }
.chip-red { background: var(--red-soft); color: var(--red); }
.chip-grey { background: var(--grey-soft); color: var(--text-soft); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.chip-green .dot { animation: dotPulse 1.8s ease-out infinite; box-shadow: 0 0 0 0 var(--green-soft); }

/* фильтр-чип (переключаемый, ≥ 48 px по высоте касания) */
.fchip {
  appearance: none; border: 0; cursor: pointer; flex-shrink: 0;
  min-height: 40px; padding: 0 14px; margin: 4px 0; border-radius: var(--r-pill);
  font-size: 15px; font-weight: 600; white-space: nowrap;
  background: var(--bg-input); color: var(--text-soft);
  transition: background 0.15s ease, color 0.15s ease;
  position: relative;
}
.fchip::after { content: ""; position: absolute; inset: -4px 0; } /* зона касания 48 px */
.fchip.on { background: var(--accent); color: var(--on-accent); box-shadow: 0 4px 12px var(--accent-glow); }

/* ───────── поля ───────── */
.input {
  appearance: none; border: 1.5px solid transparent; outline: none;
  width: 100%; min-height: 52px; padding: 0 14px;
  border-radius: var(--r-md);
  background: var(--bg-input); color: var(--text);
  font: inherit; font-size: 16px;
  transition: border-color 0.15s ease;
}
.input:focus { border-color: var(--accent); }
.input.is-error { border-color: var(--red); }
.input::placeholder { color: var(--text-mute); }
textarea.input { padding: 12px 14px; min-height: 96px; resize: none; line-height: 1.4; }
.field-err { font-size: 15px; color: var(--red); padding: 6px 4px 0; }
.search {
  display: flex; align-items: center; gap: 8px; padding: 0 6px 0 14px;
  min-height: 48px; border-radius: var(--r-md); background: var(--bg-input); color: var(--text-mute);
}
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); font: inherit; font-size: 16px; height: 48px; }

/* ───────── сегменты ───────── */
.seg { display: flex; padding: 3px; border-radius: var(--r-md); background: var(--bg-input); gap: 2px; position: relative; }
.seg button {
  appearance: none; border: 0; cursor: pointer; flex: 1; min-width: 0;
  min-height: 48px; padding: 0 8px; border-radius: calc(var(--r-md) - 3px);
  background: transparent; color: var(--text-soft);
  font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.seg button.on { background: var(--bg-elev); color: var(--text); box-shadow: 0 1px 3px rgba(15, 25, 45, 0.12); }
[data-theme="dark"] .seg button.on { background: rgba(255, 255, 255, 0.12); }

/* ───────── переключатель (vMarket .switch) ───────── */
.switch {
  width: 50px; height: 30px; border-radius: var(--r-pill); flex-shrink: 0;
  background: var(--border-strong); position: relative; cursor: pointer;
  transition: background 0.2s ease;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 26px; height: 26px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.25s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(20px); }
.switch.is-disabled { opacity: 0.45; }

/* ───────── галочка ───────── */
.check {
  width: 24px; height: 24px; border-radius: 8px; flex-shrink: 0;
  border: 2px solid var(--border-strong); display: inline-flex; align-items: center; justify-content: center;
  color: #fff; transition: background 0.15s ease, border-color 0.15s ease;
}
.check.on { background: var(--accent); border-color: var(--accent); }
.check.is-disabled { opacity: 0.35; }
.check.round { border-radius: 50%; }

/* ───────── карточки и строки ───────── */
.card { padding: 16px; }
.card-tight { padding: 4px 0; }
.list { display: flex; flex-direction: column; }
.list > .row-item + .row-item::before {
  content: ""; position: absolute; top: 0; left: 64px; right: 16px; height: 0.5px; background: var(--border);
}
.row-item {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 8px 16px; cursor: pointer; width: 100%;
  background: transparent; border: 0; text-align: left; color: inherit; font: inherit;
  transition: background 0.16s ease;
}
.row-item:active:not(.is-static) { background: var(--accent-soft); }
.row-item.is-static { cursor: default; }
.row-item.is-disabled { opacity: 0.5; }
.list > .row-item:first-child { border-top-left-radius: var(--r-lg); border-top-right-radius: var(--r-lg); }
.list > .row-item:last-child { border-bottom-left-radius: var(--r-lg); border-bottom-right-radius: var(--r-lg); }
.row-ico {
  width: 36px; height: 36px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
}
.row-ico.is-red { background: var(--red-soft); color: var(--red); }
.row-ico.is-green { background: var(--green-soft); color: var(--green); }
.row-ico.is-amber { background: var(--amber-soft); color: var(--amber); }
.row-ico.is-grey { background: var(--grey-soft); color: var(--text-soft); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-size: 16px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 15px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-val { font-size: 15px; color: var(--text-soft); white-space: nowrap; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.row-chev { color: var(--text-mute); flex-shrink: 0; display: flex; }

/* аватар-буква */
.ava {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 600; font-size: 16px; color: #fff;
  background: linear-gradient(150deg, var(--accent-2), var(--accent));
}
.ava img { width: 100%; height: 100%; object-fit: cover; }
.ava.c1 { background: linear-gradient(150deg, #7aa7ff, #4f7cf0); }
.ava.c2 { background: linear-gradient(150deg, #5fd0b4, #2aa38a); }
.ava.c3 { background: linear-gradient(150deg, #ffb46b, #f08a3c); }
.ava.c4 { background: linear-gradient(150deg, #c08bff, #9a5cf0); }
.ava.c5 { background: linear-gradient(150deg, #ff8fb0, #e8648c); }
.ava.c6 { background: linear-gradient(150deg, #6fc6ef, #3a9bd4); }
.ava.sm { width: 36px; height: 36px; font-size: 15px; }
.ava.lg { width: 56px; height: 56px; font-size: 20px; }

/* плитки-счётчики */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tiles.t3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile { padding: 12px 14px; border-radius: var(--r-md); background: var(--bg-input); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile-val { font-family: var(--font-head); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile-cap { font-size: 15px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.is-red .tile-val { color: var(--red); }
.tile.is-green .tile-val { color: var(--green); }

/* полоса прогресса (vMarket .bar) */
.bar { height: 8px; border-radius: var(--r-pill); background: var(--bg-input); overflow: hidden; position: relative; }
.bar > div {
  height: 100%; border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px var(--accent-glow);
  transition: width 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.bar.is-amber > div { background: var(--amber); box-shadow: none; }

/* ───────── спиннер и скелетоны (vMarket) ───────── */
.mp-spinner {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  border: 4px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spinSlow 0.8s linear infinite;
}
.mp-spinner.sm { width: 20px; height: 20px; border-width: 3px; }
.sk { position: relative; overflow: hidden; background: var(--bg-input); border: 0.5px solid var(--border); flex-shrink: 0; }
.sk::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, var(--accent-soft) 45%, rgba(255, 255, 255, 0.10) 50%, var(--accent-soft) 55%, transparent 80%);
  background-size: 200% 100%;
  animation: skeletonWave 1.15s ease-in-out infinite;
}
[data-theme="light"] .sk::after {
  background: linear-gradient(100deg, transparent 20%, var(--accent-soft) 45%, rgba(0, 0, 0, 0.05) 50%, var(--accent-soft) 55%, transparent 80%);
  background-size: 200% 100%;
}

/* пустое состояние и ошибка */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 28px 16px; }
.empty-ico { width: 64px; height: 64px; border-radius: 22px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.empty-ico.is-red { background: var(--red-soft); color: var(--red); }
.empty-text { font-size: 16px; color: var(--text-soft); max-width: 300px; }
.empty .btn { max-width: 320px; }

/* полоса-предупреждение (одна строка) */
.warn {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 14px;
  border-radius: var(--r-md); font-size: 15px; font-weight: 550;
  background: var(--amber-soft); color: var(--amber);
}
.warn.is-red { background: var(--red-soft); color: var(--red); }
.warn.is-accent { background: var(--accent-soft); color: var(--accent); }
.warn .flex1 { color: var(--text); }
.warn.tap { cursor: pointer; }

.section-title { font-family: var(--font-head); font-size: 15px; font-weight: 600; color: var(--text-soft); padding: 6px 4px 0; }
.hscroll { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); }
.hscroll::-webkit-scrollbar { display: none; }
.divider { height: 0.5px; background: var(--border); }
.mono { font-family: var(--mono); }
