/* Цвета: тёмная тема — золото, светлая — терракота. Тему выбирает Telegram. */
:root,
:root[data-theme='dark'] {
  --bg: #111110;
  --card: #1c1b19;
  --line: #2a2926;
  --nav: #161513;
  --text: #f2efea;
  --muted: #9c998f;
  --accent: #e8a33d;
  --accent-hover: #f4be6a;
  --on-accent: #1a1206;
  --tint: #2a2113;
  --tint-line: #4a3a1e;
  --tint-text: #f2e6cf;
  --track: #3a3833;
  --dash: #4a4842;
  --drop: #171614;
  --bad-bg: #2b1a15;
  --bad-line: #5a2e22;
  --bad: #f59a80;
  --bad-text: #f8c2b2;
  --good: #6fcf8e;
  --good-bg: #17301f;
  --good-line: #2e5a3c;
  --good-text: #bdebcb;
  --on-good: #0e2215;
}
:root[data-theme='light'] {
  --bg: #f4f1ec;
  --card: #ffffff;
  --line: #e4dfd6;
  --nav: #ffffff;
  --text: #1a1917;
  --muted: #6b665d;
  --accent: #c4532d;
  --accent-hover: #a8431f;
  --on-accent: #ffffff;
  --tint: #fbede6;
  --tint-line: #f0cdbe;
  --tint-text: #4a2a1e;
  --track: #e4dfd6;
  --dash: #cfc8bc;
  --drop: #faf8f4;
  --bad-bg: #fce9e6;
  --bad-line: #f2c2bb;
  --bad: #b3261e;
  --bad-text: #8c1d17;
  --good: #2e7d4f;
  --good-bg: #e5f2ea;
  --good-line: #b8dcc5;
  --good-text: #1f5c39;
  --on-good: #ffffff;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: Manrope, system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
button, input, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; }

#app { max-width: 560px; margin: 0 auto; padding: 20px 16px 110px; display: flex; flex-direction: column; gap: 16px; }
.loading, .empty { color: var(--muted); text-align: center; padding: 40px 0; font-size: 15px; }

h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
h2 { margin: 0; font-size: 17px; font-weight: 800; }
.kicker { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.5; }
.tiny { font-size: 12px; line-height: 1.5; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card.tight { padding: 12px; gap: 10px; }
.card.good { border-color: var(--good-line); }
.card.hl { border: 2px solid var(--accent); }
.tint { background: var(--tint); border: 1px solid var(--tint-line); color: var(--tint-text); border-radius: 14px; padding: 14px; display: flex; gap: 12px; font-size: 14px; line-height: 1.5; }
.tint svg { flex-shrink: 0; color: var(--accent); }
.warn { background: var(--bad-bg); border: 1px solid var(--bad-line); color: var(--bad-text); border-radius: 14px; padding: 12px 14px; display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: 15px; }
.divider { height: 1px; background: var(--line); }

.btn { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 54px; border-radius: 16px; border: none; background: var(--accent); color: var(--on-accent); font-size: 17px; font-weight: 800; width: 100%; padding: 0 16px; }
.btn:active { filter: brightness(0.92); }
.btn[disabled] { opacity: 0.5; cursor: default; }
.btn.ghost { background: var(--card); color: var(--text); border: 1px solid var(--line); font-size: 15px; font-weight: 700; min-height: 48px; }
.btn.good { background: var(--good); color: var(--on-good); font-size: 15px; min-height: 48px; }
.btn.bad { background: var(--bad-bg); color: var(--bad-text); border: 1px solid var(--bad-line); font-size: 14px; min-height: 48px; }
.btn.small { min-height: 44px; font-size: 14px; border-radius: 12px; }
.iconbtn { width: 44px; height: 44px; border-radius: 12px; border: none; background: var(--line); color: var(--text); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.back { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.back .iconbtn { background: var(--card); }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 6px 12px; white-space: nowrap; }
.pill.good { color: var(--good); background: var(--good-bg); }
.pill.wait { color: var(--accent); background: var(--tint); }
.pill.bad { color: var(--bad-text); background: var(--bad-bg); }
.pill.plain { background: var(--line); color: var(--text); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters button { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 14px; font-weight: 600; }
.filters button.on { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 700; }

.big { font-size: 56px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; color: var(--accent); }
.num { font-size: 28px; font-weight: 800; }
.bars5 { display: grid; gap: 6px; }
.bars5 span { height: 8px; border-radius: 4px; background: var(--track); }
.bars5 span.on { background: var(--accent); }
.progress { height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--good); }

.thumb { border-radius: 10px; background: var(--line); object-fit: cover; width: 100%; }
.list-item { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px; color: var(--text); }
.list-item.urgent { background: var(--bad-bg); border-color: var(--bad-line); }
.list-item .thumbs { display: flex; gap: 4px; flex-shrink: 0; }
.list-item .thumbs img, .list-item .thumbs div { width: 44px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--line); }
.list-item .grow { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.t15 { font-size: 15px; font-weight: 700; }
.ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chev { color: var(--muted); flex-shrink: 0; }

.lines { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 4px 16px; }
.lines > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.lines > div:last-child { border-bottom: none; }

/* Загрузка фото */
.drop { position: relative; height: 200px; border-radius: 16px; border: 2px dashed var(--dash); background: var(--drop); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; overflow: hidden; text-align: center; padding: 10px; }
.drop.filled { border-style: solid; border-color: var(--line); padding: 0; }
.drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop .badge { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; border-radius: 999px; background: var(--good); color: var(--on-good); display: flex; align-items: center; justify-content: center; }
.drop .bar { position: absolute; left: 10px; right: 10px; bottom: 10px; height: 6px; border-radius: 3px; background: rgba(0,0,0,0.4); overflow: hidden; }
.drop .bar span { display: block; height: 100%; background: var(--accent); }
.drop.file { height: 56px; flex-direction: row; border-radius: 12px; font-size: 14px; font-weight: 700; }
.drop.file.filled { border: 1px solid var(--good-line); background: var(--good-bg); color: var(--good-text); padding: 0 10px; }

label.field { display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 700; }
label.field span.opt { color: var(--muted); font-weight: 500; }
input.inp, textarea.inp { min-height: 50px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 16px; padding: 12px 14px; width: 100%; font-weight: 500; }
textarea.inp { resize: vertical; line-height: 1.5; }
input.inp:focus, textarea.inp:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* До/после */
.compare { position: relative; border-radius: 18px; overflow: hidden; background: var(--line); user-select: none; touch-action: pan-y; }
.compare img { width: 100%; height: auto; }
.compare .after { position: absolute; inset: 0; }
.compare .after img { width: 100%; height: 100%; object-fit: cover; }
.compare .line { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; transform: translateX(-1px); pointer-events: none; }
.compare .knob { position: absolute; top: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 999px; background: #fff; color: #111; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.compare .tag { position: absolute; top: 12px; font-size: 12px; font-weight: 700; background: rgba(0,0,0,0.6); color: #fff; border-radius: 8px; padding: 5px 10px; }
input[type=range] { accent-color: var(--accent); width: 100%; }

.steps { display: flex; gap: 12px; font-size: 14px; line-height: 1.5; }
.steps b.n { width: 26px; height: 26px; border-radius: 999px; background: var(--tint); color: var(--accent); font-size: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Переключатель */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; width: 100%; text-align: left; }
.switch .track { width: 50px; height: 30px; border-radius: 999px; background: var(--track); position: relative; flex-shrink: 0; transition: background 0.15s; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 999px; background: #fff; transition: left 0.15s; }
.switch[aria-pressed='true'] .track { background: var(--accent); }
.switch[aria-pressed='true'] .track::after { left: 23px; }

/* Столбики */
.chart { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: end; height: 96px; }
.chart > div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; font-size: 11px; color: var(--muted); }
.chart i { display: block; width: 100%; border-radius: 6px; background: var(--track); min-height: 4px; }
.chart i.top { background: var(--accent); }
.chart b.top { color: var(--accent); }
.minibars { display: flex; gap: 5px; align-items: flex-end; height: 48px; }
.minibars i { width: 10px; border-radius: 3px; background: var(--track); min-height: 3px; }
.minibars i.top { background: var(--accent); }

/* Нижнее меню */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; background: var(--nav); border-top: 1px solid var(--line); display: grid; padding-bottom: max(10px, env(safe-area-inset-bottom)); z-index: 10; }
#tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--muted); min-height: 60px; position: relative; }
#tabs a.on { color: var(--accent); font-weight: 700; }
#tabs a .dot { position: absolute; top: 6px; left: calc(50% + 8px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 5px; }

#toast { position: fixed; left: 16px; right: 16px; bottom: 96px; max-width: 520px; margin: 0 auto; background: var(--text); color: var(--bg); border-radius: 14px; padding: 14px 16px; font-size: 14px; font-weight: 600; z-index: 20; text-align: center; }

.hero { display: flex; flex-direction: column; gap: 6px; }
.price { font-size: 22px; font-weight: 800; color: var(--accent); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 1.4; }
.check svg { color: var(--good); flex-shrink: 0; margin-top: 1px; }
