/* Мини-приложение группы: светлая и тёмная темы (макеты art/src/miniapp2_mock_b*.png) */
:root {
  --bg: #f6f6f9;
  --card: #ffffff;
  --card-2: #f0f0f5;
  --text: #15161a;
  --muted: #6b6f7b;
  --faint: #a3a7b2;
  --line: #e8e8ef;
  --accent: #5b5bd6;
  --accent-soft: #ececfb;
  --accent-text: #ffffff;
  --danger: #e5484d;
  --ok: #30a46c;
  --shadow: 0 1px 2px rgba(20, 20, 40, .04), 0 4px 16px rgba(20, 20, 40, .05);
  --radius: 18px;
  --tabbar-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #111318;
  --card: #1b1e25;
  --card-2: #23262e;
  --text: #f2f3f5;
  --muted: #9a9fab;
  --faint: #636875;
  --line: #2a2d35;
  --accent: #7c7cf0;
  --accent-soft: #2a2a4a;
  --accent-text: #ffffff;
  --danger: #ff6369;
  --ok: #3dd68c;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon.sm { width: 18px; height: 18px; }

.screen {
  padding: 18px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 24px);
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
}

/* Заголовок экрана */
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 2px 18px; }
.head h1 { font-size: 32px; line-height: 1.1; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.round-btn {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.round-btn.plain { background: var(--card); color: var(--text); box-shadow: var(--shadow); }

/* Карточки и списки */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.stack { display: grid; gap: 10px; }
.row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; min-height: 64px; width: 100%; text-align: left;
}
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 650; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { color: var(--faint); }
.section-title { font-size: 20px; font-weight: 750; margin: 26px 2px 10px; }
.note { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: 13.5px; margin: 16px 4px 0; }

/* Аватар-буква на цвете класса */
.avatar {
  width: 48px; height: 48px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-weight: 700; font-size: 20px; color: #fff;
  background: var(--av, #8b8fa0);
}
.avatar.sm { width: 26px; height: 26px; font-size: 12px; }
.avatar.dashed { background: transparent; border: 2px dashed var(--faint); color: var(--faint); }

/* Быстрые инструменты */
.tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.tool {
  display: grid; justify-items: center; gap: 8px;
  padding: 16px 6px; color: var(--accent); font-size: 14px;
}
.tool span { color: var(--text); }
.next-card { margin-top: 14px; }
.badge {
  width: 44px; height: 44px; border-radius: 14px; flex: none;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}

/* Фильтры-чипы */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  padding: 8px 14px; border-radius: 999px; background: var(--card); color: var(--text);
  font-size: 14px; box-shadow: var(--shadow); white-space: nowrap;
}
.chip.on { background: var(--accent); color: var(--accent-text); box-shadow: none; }
.chip .n { opacity: .7; margin-left: 4px; }

/* Планы */
.check {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  border: 2px solid var(--faint); display: grid; place-items: center; color: transparent;
}
.check.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.done .title { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--faint); flex: none; }
.icon-btn:active { background: var(--card-2); }

/* Собрать */
.need { padding: 14px 14px 14px 14px; display: grid; gap: 10px; }
.need-top { display: flex; align-items: center; gap: 12px; }
.item-icon {
  width: 44px; height: 44px; border-radius: 12px; flex: none; object-fit: cover;
  background: var(--card-2); display: grid; place-items: center; color: var(--muted);
}
.bar { height: 6px; border-radius: 99px; background: var(--card-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .25s; }
.qty-btn {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: var(--card-2); color: var(--text);
}
.qty-btn.go { background: var(--accent); color: #fff; }

/* Справка */
.search {
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px; height: 50px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow);
  color: var(--muted);
}
.search input { flex: 1; border: 0; outline: 0; background: none; color: var(--text); font-size: 16px; min-width: 0; }
.item-card { padding: 16px; margin-top: 14px; }
.item-card .top { display: flex; gap: 14px; align-items: center; }
.item-card .big-icon { width: 64px; height: 64px; border-radius: 14px; }
.item-card h2 { font-size: 19px; margin: 0 0 2px; }
.item-lines { margin: 12px 0 4px; color: var(--muted); font-size: 14px; display: grid; gap: 2px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 52px; border-radius: 16px;
  background: var(--accent); color: var(--accent-text); font-weight: 650; font-size: 16px;
}
.btn.ghost { background: transparent; color: var(--accent); height: 44px; }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn:disabled { opacity: .5; }
.q0 { color: #9d9d9d !important; } .q1 { color: var(--text) !important; } .q2 { color: #1eaa2f !important; }
.q3 { color: #2f7fe0 !important; } .q4 { color: #a335ee !important; } .q5 { color: #ff8000 !important; }
:root[data-theme="dark"] .q2 { color: #3ddc4f !important; }

/* Напоминания */
.time { font-weight: 750; font-size: 20px; min-width: 58px; font-variant-numeric: tabular-nums; }
.vline { width: 1px; align-self: stretch; background: var(--line); }

/* Пусто */
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .icon { width: 36px; height: 36px; color: var(--faint); margin-bottom: 8px; }

/* Нижняя панель вкладок */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tab { display: grid; justify-items: center; align-content: center; gap: 3px; font-size: 10.5px; white-space: nowrap; color: var(--muted); }
.tab.on { color: var(--accent); font-weight: 650; }

/* Шторка снизу */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .35);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
  max-width: 560px; margin: 0 auto; max-height: 88vh; overflow: auto;
  background: var(--card); border-radius: 24px 24px 0 0;
  padding: 10px 18px calc(20px + var(--safe-bottom));
  transform: translateY(105%); transition: transform .25s cubic-bezier(.2, .8, .2, 1);
}
.sheet.open { transform: translateY(0); }
.grip { width: 40px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-head h3 { margin: 0; font-size: 21px; font-weight: 750; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { color: var(--muted); font-size: 13.5px; }
.input {
  width: 100%; height: 50px; padding: 0 14px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); outline: 0; font-size: 16px;
}
.input:focus { border-color: var(--accent); }
textarea.input { height: 92px; padding: 12px 14px; resize: none; }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper .val { min-width: 64px; text-align: center; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg .chip { box-shadow: none; background: var(--card-2); }
.seg .chip.on { background: var(--accent); }
.switch-row { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 18px; }
.switch { width: 52px; height: 32px; border-radius: 99px; background: var(--line); position: relative; transition: background .2s; }
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(20px); }
.classes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.classes .chip { text-align: center; box-shadow: none; background: var(--card-2); }
.classes .chip.on { background: var(--av); color: #111; }
.suggest { margin-top: 8px; display: grid; gap: 4px; }
.suggest button { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; text-align: left; }
.suggest button:active { background: var(--card-2); }
.suggest img { width: 32px; height: 32px; border-radius: 8px; }
.big-number { text-align: center; font-size: 64px; font-weight: 800; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.result { text-align: center; color: var(--muted); margin-bottom: 16px; min-height: 20px; }
.gap { height: 10px; }

/* Сообщение снизу */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px); z-index: 30;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: all .2s;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px;
  max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.skeleton { height: 64px; border-radius: var(--radius); background: var(--card); opacity: .6; }
