:root {
  --brand: #0e7c66;
  --brand-dark: #0a5e4d;
  --brand-soft: #e3f2ee;
  --accent: #ffd666;
  --drop: #d64545;
  --drop-soft: #fdecec;
  --warn: #9a6400;
  --warn-soft: #fff4dc;
  --bg: #f5f6f3;
  --card: #ffffff;
  --text: #1c2321;
  --muted: #66706c;
  --line: #e4e7e3;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text); background: var(--bg);
  min-height: 100vh;
}
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- каркас ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 6px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: rgba(245, 246, 243, .92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 18px; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { border: 0; background: none; padding: 6px; margin-left: -8px; color: var(--brand); cursor: pointer; display: flex; }
.badge-paid { font-size: 11px; font-weight: 700; letter-spacing: .5px; color: #5c4400; background: var(--accent); padding: 3px 8px; border-radius: 99px; }

main { max-width: 640px; margin: 0 auto; padding: 14px 14px calc(90px + var(--safe-b)); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around;
  padding: 6px 4px calc(6px + var(--safe-b));
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); padding: 4px 0; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.active { color: var(--brand); font-weight: 600; }

.toast {
  position: fixed; left: 50%; bottom: calc(84px + var(--safe-b)); transform: translateX(-50%);
  z-index: 50; max-width: 92vw; padding: 11px 16px; border-radius: 12px;
  background: #1c2321; color: #fff; font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.2);
}

/* ---------- элементы ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card h2 { font-size: 17px; margin: 0 0 8px; }
.card h3 { font-size: 15px; margin: 14px 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 12px; padding: 12px 16px; min-height: 46px;
  font-weight: 600; cursor: pointer; background: var(--brand); color: #fff; text-align: center;
}
.btn:active { background: var(--brand-dark); }
.btn:disabled { opacity: .55; }
.btn.block { width: 100%; }
.btn.secondary { background: var(--brand-soft); color: var(--brand-dark); }
.btn.ghost { background: transparent; color: var(--brand); padding: 8px 10px; min-height: 0; }
.btn.danger { background: var(--drop-soft); color: var(--drop); }
.btn.gold { background: var(--accent); color: #4a3700; }
.btn.small { padding: 8px 12px; min-height: 36px; font-size: 14px; border-radius: 10px; }

label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], textarea, select {
  width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: 11px; background: #fff;
  outline: none; font-size: 16px;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { min-height: 90px; resize: vertical; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 7px 12px;
  font-size: 14px; cursor: pointer; user-select: none;
}
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.lock { opacity: .6; }

.notice { border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 12px; }
.notice.info { background: var(--brand-soft); color: var(--brand-dark); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.gold { background: linear-gradient(135deg, #fff6d8, #ffe9a8); color: #4a3700; }
.notice b { font-weight: 700; }

/* ---------- лоты ---------- */
.lot { display: block; color: inherit; background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.04); position: relative; }
.lot-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.lot-cat { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.lot-title { font-weight: 600; margin: 4px 0 6px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.lot-price { font-size: 20px; font-weight: 700; }
.lot-meta { font-size: 13px; color: var(--muted); margin-top: 4px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { font-size: 12px; padding: 3px 8px; border-radius: 99px; background: var(--bg); color: var(--muted); }
.tag.drop { background: var(--drop-soft); color: var(--drop); font-weight: 700; }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.expert { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.fav-btn { border: 0; background: none; padding: 4px; cursor: pointer; color: #b8bfbb; flex-shrink: 0; }
.fav-btn svg { width: 26px; height: 26px; }
.fav-btn.on { color: var(--drop); }

.detail-price { font-size: 28px; font-weight: 800; margin: 2px 0; }
.kv { display: grid; grid-template-columns: 42% 58%; gap: 7px 10px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.photos { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px; scroll-snap-type: x mandatory; }
.photos img { height: 190px; border-radius: 12px; object-fit: cover; scroll-snap-align: start; background: var(--line); }
.desc { white-space: pre-wrap; font-size: 14px; }
.expert-box { border-left: 4px solid var(--brand); background: var(--brand-soft); padding: 12px 14px; border-radius: 0 12px 12px 0; }

/* ---------- прочее ---------- */
.hero { text-align: center; padding: 24px 8px 8px; }
.hero img { width: 76px; height: 76px; border-radius: 20px; box-shadow: 0 8px 24px rgba(14,124,102,.3); }
.hero h2 { font-size: 24px; margin: 14px 0 6px; line-height: 1.2; }
.hero p { color: var(--muted); margin: 0 auto; max-width: 420px; }
.features { list-style: none; padding: 0; margin: 0; }
.features li { padding: 8px 0 8px 30px; position: relative; font-size: 15px; }
.features li::before { content: "✓"; position: absolute; left: 4px; color: var(--brand); font-weight: 800; }

.plans { display: grid; gap: 10px; }
.plan { border: 2px solid var(--line); border-radius: 14px; padding: 14px; display: flex; align-items: center; gap: 10px; cursor: pointer; background: #fff; text-align: left; width: 100%; }
.plan.best { border-color: var(--brand); }
.plan b { font-size: 18px; }
.plan .save { font-size: 12px; background: var(--accent); color: #4a3700; padding: 2px 8px; border-radius: 99px; font-weight: 700; }

.list-row { display: flex; align-items: center; gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--line); color: inherit; cursor: pointer; }
.list-row:last-child { border-bottom: 0; }
.list-row .chev { color: #b8bfbb; }

.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding: 6px 0 12px 40px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 4px; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 14px; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--card); border-radius: 12px; padding: 12px; }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 12px; color: var(--muted); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl td, table.tbl th { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 8px; }
.loader { text-align: center; padding: 30px; color: var(--muted); }
.switch { position: relative; width: 50px; height: 30px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cfd5d1; border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(20px); }
.disclaimer { font-size: 12px; color: var(--muted); margin-top: 12px; }

@media (prefers-color-scheme: dark) {
  :root { --bg: #111614; --card: #1a201e; --text: #e8ecea; --muted: #97a19c; --line: #2a322f; --brand-soft: #16332c; --drop-soft: #3a1d1d; --warn-soft: #382a10; --warn: #e8b34a; }
  .topbar { background: rgba(17,22,20,.92); }
  .tabbar { background: rgba(26,32,30,.96); }
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], textarea, select, .chip, .plan { background: #141a18; }
  .notice.gold { background: linear-gradient(135deg, #3a3018, #4a3b12); color: #ffe7a3; }
  .notice.info { color: #9fdccb; }
  .tag.expert { color: #9fdccb; }
}
