/* ЧекБонус — оформление в стиле iOS (светлая / тёмная тема) */

:root,
:root[data-theme="light"] {
  --bg: #f2f2f7;
  --bg2: #ffffff;
  --card: #ffffff;
  --card2: #f2f2f7;
  --fill: #e9e9ee;
  --text: #000000;
  --text2: #8e8e93;
  --sep: rgba(60, 60, 67, .18);
  --sep2: rgba(60, 60, 67, .12);
  --accent: #007aff;
  --accent2: #0066d6;
  --green: #34c759;
  --green2: #248a3d;
  --red: #ff3b30;
  --orange: #ff9500;
  --gold: #ffb100;
  --purple: #af52de;
  --teal: #30b0c7;
  --indigo: #5856d6;
  --nav: rgba(249, 249, 249, .86);
  --nav-border: rgba(0, 0, 0, .12);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04);
  --sheet: #f2f2f7;
  --toastbg: rgba(28, 28, 30, .92);
  --toasttext: #fff;
  --radius: 14px;
}

:root[data-theme="dark"] {
  --bg: #000000;
  --bg2: #1c1c1e;
  --card: #1c1c1e;
  --card2: #2c2c2e;
  --fill: #2c2c2e;
  --text: #ffffff;
  --text2: #8e8e93;
  --sep: rgba(84, 84, 88, .6);
  --sep2: rgba(84, 84, 88, .4);
  --accent: #0a84ff;
  --accent2: #409cff;
  --green: #30d158;
  --green2: #30d158;
  --red: #ff453a;
  --orange: #ff9f0a;
  --gold: #ffd60a;
  --purple: #bf5af2;
  --teal: #40c8e0;
  --indigo: #5e5ce6;
  --nav: rgba(22, 22, 24, .82);
  --nav-border: rgba(255, 255, 255, .12);
  --shadow: none;
  --sheet: #1c1c1e;
  --toastbg: rgba(58, 58, 60, .96);
  --toasttext: #fff;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}
body { padding-bottom: 92px; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; font-size: 17px; border: 0; background: none; color: inherit; cursor: pointer; padding: 0; }
input, select, textarea {
  font-family: inherit; font-size: 17px; width: 100%;
  background: var(--fill); border: 0; color: var(--text);
  border-radius: 10px; padding: 12px 14px; outline: none;
  -webkit-appearance: none; appearance: none;
}
input::placeholder, textarea::placeholder { color: var(--text2); }
input:focus, textarea:focus { box-shadow: 0 0 0 3px rgba(0, 122, 255, .18); }
label { display: block; font-size: 13px; color: var(--text2); margin: 14px 0 6px; text-transform: uppercase; letter-spacing: .3px; }
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.02em; }
h1 { font-size: 34px; font-weight: 800; letter-spacing: -.03em; }
h2 { font-size: 22px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 600; }
p { margin: 0 0 10px; line-height: 1.5; }
.muted, .small.muted { color: var(--text2); }
.small { font-size: 13px; color: var(--text2); }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.hide { display: none !important; }

/* навигационная панель */
.appbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--nav);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--nav-border);
}
.appbar .wrap { display: flex; align-items: center; gap: 10px; height: 52px; }
.appbar .title { font-weight: 600; font-size: 17px; letter-spacing: -.02em; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  color: var(--accent); font-size: 17px; flex: 0 0 auto;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.solid { background: var(--fill); color: var(--text); }
.logo {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(160deg, #34c759, #007aff);
  display: grid; place-items: center; color: #fff; flex: 0 0 auto;
}
.logo svg { width: 20px; height: 20px; }

/* карточки / grouped-список */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 18px;
  box-shadow: var(--shadow);
}
.card.tight { padding: 0 16px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--text2); margin: 22px 4px 8px; }

/* баланс */
.balance {
  background: var(--card);
  border-radius: 18px;
  padding: 20px;
  margin-top: 16px;
  box-shadow: var(--shadow);
}
.balance .sum { font-size: 40px; font-weight: 800; letter-spacing: -.04em; margin: 6px 0 2px; }
.balance .row .btn { flex: 1; }

/* кнопки */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px 16px; border-radius: 12px;
  font-weight: 600; font-size: 17px;
  background: var(--fill); color: var(--text);
  transition: opacity .15s, transform .05s;
}
.btn:active { transform: scale(.985); opacity: .85; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.green { background: var(--green); color: #fff; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.danger { background: rgba(255, 59, 48, .12); color: var(--red); }
.btn.sm { padding: 8px 14px; font-size: 15px; width: auto; border-radius: 10px; }
.btn:disabled { opacity: .4; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }

/* плитки быстрых действий */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.tile {
  background: var(--card); border-radius: 16px; padding: 14px;
  text-align: left; box-shadow: var(--shadow);
}
.tile .ico {
  width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center;
  color: #fff; margin-bottom: 10px;
}
.tile .ico svg { width: 24px; height: 24px; }
.tile .t { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.tile .d { font-size: 13px; color: var(--text2); margin-top: 2px; }

/* строки списка */
.list { margin-top: 4px; }
.item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0;
  border-bottom: .5px solid var(--sep2);
  color: var(--text);
  min-height: 44px;
}
.item:last-child { border-bottom: 0; }
.item .right { margin-left: auto; text-align: right; flex: 0 0 auto; }
.item .chev { color: var(--text2); margin-left: auto; display: flex; }
.item .chev svg { width: 13px; height: 13px; }
.plus { color: var(--green); font-weight: 600; }
.minus { color: var(--red); font-weight: 600; }

/* квадратные иконки как в Настройках iOS */
.dot {
  width: 29px; height: 29px; border-radius: 7px; display: grid; place-items: center;
  flex: 0 0 auto; color: #fff;
}
.dot svg { width: 17px; height: 17px; }
.dot.lg { width: 34px; height: 34px; border-radius: 8px; }
.dot.lg svg { width: 20px; height: 20px; }
.t-blue { background: #007aff; }
.t-green { background: #34c759; }
.t-orange { background: #ff9500; }
.t-red { background: #ff3b30; }
.t-purple { background: #af52de; }
.t-teal { background: #30b0c7; }
.t-indigo { background: #5856d6; }
.t-gray { background: #8e8e93; }
.t-pink { background: #ff2d55; }
:root[data-theme="dark"] .t-green { background: #30d158; color: #0b2a14; }
:root[data-theme="dark"] .t-blue { background: #0a84ff; }

/* бейджи */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: rgba(52, 199, 89, .16); color: var(--green2);
}
:root[data-theme="dark"] .badge { color: #30d158; }
.badge.grey { background: var(--fill); color: var(--text2); }
.badge.gold { background: rgba(255, 159, 10, .16); color: #c26a00; }
:root[data-theme="dark"] .badge.gold { color: var(--gold); }
.badge.red { background: rgba(255, 59, 48, .14); color: var(--red); }
.badge.blue { background: rgba(0, 122, 255, .14); color: var(--accent); }

/* задания */
.task { background: var(--card); border-radius: 18px; overflow: hidden; margin-top: 14px; box-shadow: var(--shadow); }
.task img { width: 100%; height: 156px; object-fit: cover; display: block; }
.task .body { padding: 14px; }
.task .name { font-weight: 600; font-size: 17px; letter-spacing: -.01em; }
.task .desc { font-size: 14px; color: var(--text2); margin-top: 6px; line-height: 1.45; max-height: 3em; overflow: hidden; }
.task .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 10px; }
.reward { font-weight: 700; font-size: 20px; color: var(--green2); letter-spacing: -.02em; }
:root[data-theme="dark"] .reward { color: #30d158; }

/* аватар */
.ava {
  width: 52px; height: 52px; border-radius: 50%; overflow: hidden; flex: 0 0 auto;
  display: grid; place-items: center; font-weight: 600; font-size: 20px;
  background: var(--fill); color: var(--text2);
}
.ava.big { width: 76px; height: 76px; font-size: 30px; }
.ava img { width: 100%; height: 100%; object-fit: cover; }

/* прогресс */
.bar { height: 6px; border-radius: 999px; background: var(--fill); overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; background: var(--green); border-radius: 999px; transition: width .25s; }

/* нижняя таб-бар */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--nav);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--nav-border);
}
.nav .inner {
  max-width: 560px; margin: 0 auto; display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}
.nav a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10px; letter-spacing: -.01em; color: var(--text2); padding: 4px 0;
}
.nav a svg { width: 26px; height: 26px; }
.nav a.on { color: var(--accent); }

/* шторка */
.overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 560px; background: var(--sheet);
  border-radius: 14px 14px 0 0; padding: 8px 18px 24px;
  max-height: 90vh; overflow: auto; position: relative;
  animation: up .22s cubic-bezier(.32, .72, 0, 1);
}
.sheet:before {
  content: ""; display: block; width: 36px; height: 5px; border-radius: 3px;
  background: var(--sep); margin: 2px auto 12px;
}
.sheet h3 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
@keyframes up { from { transform: translateY(40px); opacity: .5 } to { transform: none; opacity: 1 } }
.overlay.center-modal { align-items: center; padding: 16px; }
.overlay.center-modal .sheet { border-radius: 16px; padding: 20px; }
.overlay.center-modal .sheet:before { display: none; }

/* тост */
#toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  z-index: 99; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--toastbg); color: var(--toasttext);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  padding: 11px 16px; border-radius: 14px; font-size: 15px; font-weight: 500;
  max-width: 90vw; animation: tin .2s ease; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.toast.err { color: #ff9f9a; }
@keyframes tin { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }

/* сегментированный контрол */
.seg { display: flex; background: var(--fill); border-radius: 10px; padding: 2px; gap: 2px; }
.seg button {
  flex: 1; padding: 7px 10px; border-radius: 8px; font-size: 14px; font-weight: 500;
  color: var(--text); transition: background .15s;
}
.seg button.on { background: var(--card); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
:root[data-theme="dark"] .seg button.on { background: #636366; }

.tabs { display: flex; gap: 8px; overflow: auto; padding: 10px 0; position: sticky; top: 52px; background: var(--bg); z-index: 15; }
.tabs button { white-space: nowrap; padding: 8px 14px; border-radius: 999px; background: var(--card); font-size: 15px; color: var(--text2); }
.tabs button.on { background: var(--accent); color: #fff; }

/* ios switch */
.switch { display: flex; align-items: flex-start; gap: 12px; margin-top: 14px; }
.switch input {
  appearance: none; -webkit-appearance: none; width: 51px; height: 31px; min-width: 51px;
  border-radius: 999px; background: var(--fill); position: relative; transition: background .2s;
  padding: 0; margin: 0; cursor: pointer;
}
.switch input:checked { background: var(--green); }
.switch input:after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px;
  border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .2s;
}
.switch input:checked:after { transform: translateX(20px); }
.switch label { margin: 0; text-transform: none; font-size: 15px; color: var(--text); letter-spacing: 0; line-height: 1.35; }

/* реквизиты, kv */
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: .5px solid var(--sep2); font-size: 16px; }
.kv:last-child { border-bottom: 0; }
.kv b { font-weight: 600; text-align: right; }
.kv > span:first-child { color: var(--text); }

.check-item { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: .5px solid var(--sep2); }
.check-item:last-child { border-bottom: 0; }

video { width: 100%; border-radius: 14px; background: #000; max-height: 62vh; }
.scan-frame { position: relative; }
.scan-frame:after {
  content: ""; position: absolute; inset: 16% 10%; border: 2px solid rgba(255, 255, 255, .9);
  border-radius: 18px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35); pointer-events: none;
}

/* админка */
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { padding: 12px 10px; border-bottom: .5px solid var(--sep2); text-align: left; vertical-align: middle; }
th { color: var(--text2); font-weight: 500; font-size: 13px; text-transform: uppercase; letter-spacing: .3px; }
td .badge { font-size: 12px; }

.doc { font-size: 16px; line-height: 1.6; }
.doc h3 { margin: 22px 0 8px; }
.doc ul { padding-left: 20px; margin: 8px 0; }
.doc li { margin-bottom: 6px; }
.doc p { margin: 0 0 10px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--card); font-size: 14px; color: var(--text2); }

/* подсказки в формах */
.form-note { font-size: 13px; color: var(--text2); margin-top: 10px; line-height: 1.4; }
.divider { height: .5px; background: var(--sep); margin: 16px 0; }

/* логотип и иконки в кнопках */
.logo.lg { width: 76px; height: 76px; border-radius: 20px; }
.logo.lg svg { width: 44px; height: 44px; }
.btn svg { width: 20px; height: 20px; flex: 0 0 auto; }
.badge svg { width: 13px; height: 13px; }
.icon-btn svg { display: block; }
