/* Рынок Победа - веб-версия. Оформление «светлый тёплый», как в Android-приложении. */
:root {
  --bg: #F6F3EE; --fg: #1E2A3A; --muted: #5F6B78; --card: #FFFFFF; --soft: #EFEAE2;
  --line: #E7E1D8; --outline: #CFC7BB; --primary: #1E3A5F; --on-primary: #FFFFFF;
  --primary-soft: #DCE6F2; --gold: #FFC24B; --gold-soft: #FFE7B8; --on-gold-soft: #5A3A00;
  --hero: #1E3A5F; --hero-sub: #B9C6D6; --hero-bad: #FFA49A; --err: #C0392B;
  --good-bg: #E3F1E4; --good-fg: #1B5E20; --bad-bg: #FBE4E1; --bad-fg: #8E1F14; --ok: #2E7D32;
  --nav: #FFFFFF; --radius: 16px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #12171E; --fg: #E6E9ED; --muted: #A3ACB8; --card: #1B222C; --soft: #262E39;
  --line: #2C3540; --outline: #3A4452; --primary: #9DBCE3; --on-primary: #0E2238;
  --primary-soft: #2A4468; --gold-soft: #4A3712; --on-gold-soft: #FFE7B8;
  --hero: #22385A; --err: #FF8A7A; --good-bg: #1E3A23; --good-fg: #A5D6A7; --bad-bg: #4A1F1A; --bad-fg: #FFB4A9;
  --ok: #81C784; --nav: #1B222C;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #12171E; --fg: #E6E9ED; --muted: #A3ACB8; --card: #1B222C; --soft: #262E39;
    --line: #2C3540; --outline: #3A4452; --primary: #9DBCE3; --on-primary: #0E2238;
    --primary-soft: #2A4468; --gold-soft: #4A3712; --on-gold-soft: #FFE7B8;
    --hero: #22385A; --err: #FF8A7A; --good-bg: #1E3A23; --good-fg: #A5D6A7; --bad-bg: #4A1F1A; --bad-fg: #FFB4A9;
    --ok: #81C784; --nav: #1B222C;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body {
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-text-size-adjust: 100%; overscroll-behavior-y: none;
}
.boot { padding: 40px 20px; text-align: center; color: var(--muted); }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }

/* каркас */
.screen {
  max-width: 640px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 14px) 16px calc(env(safe-area-inset-bottom) + 96px);
  display: flex; flex-direction: column; gap: 10px;
}
.login.screen { padding-bottom: calc(env(safe-area-inset-bottom) + 30px); }
.head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 4px; }
.head .t { flex: 1; min-width: 0; }
.head h1 { margin: 0; font-size: 28px; line-height: 1.15; letter-spacing: -0.3px; }
.head .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.bell { position: relative; border: 0; background: var(--soft); width: 42px; height: 42px; border-radius: 50%; font-size: 20px; cursor: pointer; }
.bell .badge { position: absolute; top: -2px; right: -2px; background: var(--err); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.section { font-size: 18px; font-weight: 700; margin: 12px 0 0; }

nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--nav);
  border-top: 1px solid var(--line); display: flex; justify-content: center;
  padding: 6px 4px calc(env(safe-area-inset-bottom) + 6px);
}
nav.tabs .in { display: flex; width: 100%; max-width: 640px; }
nav.tabs button {
  flex: 1; border: 0; background: none; padding: 4px 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 12px; color: var(--muted); cursor: pointer;
}
nav.tabs button .ic { width: 56px; height: 30px; border-radius: 15px; display: flex; align-items: center; justify-content: center; }
nav.tabs button .ic svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
nav.tabs button.on { color: var(--fg); font-weight: 600; }
nav.tabs button.on .ic { background: var(--primary-soft); color: var(--primary); }
:root[data-theme="dark"] nav.tabs button.on .ic { color: var(--fg); }

/* элементы */
.card { background: var(--card); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 6px;
  box-shadow: 0 1px 2px rgba(30, 42, 58, .06); }
.soft { background: var(--soft); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.hero { background: var(--hero); color: #fff; border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.hero .k { color: var(--hero-sub); font-size: 14px; }
.hero .big { font-size: 34px; font-weight: 800; color: var(--gold); line-height: 1.1; }
.hero .big.bad { color: var(--hero-bad); }
.hero .small { font-size: 13px; }
.hero .subtle { color: var(--hero-sub); }
.hero .warn { color: var(--hero-bad); font-size: 13px; }
.hero hr { border: 0; border-top: 1px solid rgba(255,255,255,.15); margin: 6px 0; width: 100%; }
.hero .line { display: flex; font-size: 13px; }
.hero .line span:first-child { flex: 1; color: var(--hero-sub); }
.hero .two { display: flex; gap: 10px; }
.hero .two > div { flex: 1; }
.hero .two b { font-weight: 600; }

.row { display: flex; gap: 8px; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
.wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.scrollx { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.scrollx::-webkit-scrollbar { display: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: var(--err); }
.okc { color: var(--ok); }
.prim { color: var(--primary); }
.b { font-weight: 700; }
.sb { font-weight: 600; }
.pre { white-space: pre-line; }
.strike { text-decoration: line-through; color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field label { font-size: 12px; color: var(--muted); padding-left: 4px; }
input[type=text], input[type=password], input[type=email], input:not([type]), input[type=search], textarea {
  width: 100%; border: 1px solid var(--outline); border-radius: 12px; padding: 11px 12px; background: var(--card);
  font-size: 16px; outline: none; -webkit-appearance: none; appearance: none;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }

.btn { border: 0; border-radius: 22px; padding: 11px 18px; background: var(--primary); color: var(--on-primary); font-weight: 600;
  cursor: pointer; white-space: nowrap; font-size: 15px; }
.btn.out { background: transparent; color: var(--primary); border: 1px solid var(--outline); }
.btn.text { background: transparent; color: var(--primary); padding: 8px 10px; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.btns { display: flex; gap: 8px; }
.btns > .btn { flex: 1; }

.chip { border: 1px solid var(--outline); background: transparent; border-radius: 10px; padding: 7px 12px; font-size: 14px;
  cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--primary-soft); border-color: transparent; font-weight: 600; }
.tag { font-size: 12px; padding: 3px 8px; border-radius: 8px; background: var(--soft); color: var(--muted); }
.tag.acc { background: var(--gold-soft); color: var(--on-gold-soft); }

.price { font-size: 22px; font-weight: 800; color: var(--primary); }
.name { font-weight: 600; font-size: 15px; }
.verdict { border-radius: 10px; padding: 6px 10px; font-weight: 700; font-size: 14px; }
.verdict.good { background: var(--good-bg); color: var(--good-fg); }
.verdict.bad { background: var(--bad-bg); color: var(--bad-fg); }
.verdict.unrated { background: var(--soft); color: var(--muted); }
.evalbox { background: var(--gold-soft); color: var(--on-gold-soft); border-radius: 10px; padding: 6px 10px; }

.sw { position: relative; width: 50px; height: 30px; flex: none; }
.sw input { opacity: 0; width: 0; height: 0; position: absolute; }
.sw span { position: absolute; inset: 0; background: var(--outline); border-radius: 15px; transition: .2s; cursor: pointer; }
.sw span::before { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.sw input:checked + span { background: var(--primary); }
:root[data-theme="dark"] .sw input:checked + span { background: #5C83B5; }
.sw input:checked + span::before { transform: translateX(20px); }
.swrow { display: flex; align-items: center; gap: 10px; }
.swrow .grow { flex: 1; }

.check { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }

.spin { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--outline); border-top-color: var(--primary);
  border-radius: 50%; animation: sp 0.8s linear infinite; vertical-align: middle; margin-right: 8px; }
@keyframes sp { to { transform: rotate(360deg); } }

.partrow { display: flex; align-items: center; gap: 12px; padding: 10px 0; cursor: pointer; }
.partrow + .partrow { border-top: 1px solid var(--line); }
.letter { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex: none; }
.divider { border-top: 1px solid var(--line); margin: 4px 0; }

/* окно поверх */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; justify-content: center; }
.modal .box { background: var(--bg); width: 100%; max-width: 640px; max-height: 92vh; border-radius: 20px 20px 0 0;
  display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
.modal .mh { display: flex; align-items: center; gap: 8px; padding: 14px 16px 8px; }
.modal .mh h2 { flex: 1; margin: 0; font-size: 19px; }
.modal .mb { overflow-y: auto; padding: 4px 16px 18px; display: flex; flex-direction: column; gap: 8px; -webkit-overflow-scrolling: touch; }
@media (min-width: 700px) { .modal { align-items: center; } .modal .box { border-radius: 20px; } }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 84px); z-index: 60;
  background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 90vw; }
.install { background: var(--gold-soft); color: var(--on-gold-soft); border-radius: 14px; padding: 12px; font-size: 14px; }
