/* SVP Mini App. Цвета берутся из темы Telegram, поэтому светлая и темная темы работают сами. */

/* Шрифты лежат в fonts/ (лицензия SIL OFL): текст - Onest, заголовки и крупные цифры - Russo One (.hd).
   Только кириллица и латиница; остальные знаки (֏, армянские буквы) берутся из системного шрифта. */
@font-face { font-family: Onest; font-weight: 100 900; font-display: swap; src: url(fonts/onest-cyrillic-wght-normal.woff2) format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: Onest; font-weight: 100 900; font-display: swap; src: url(fonts/onest-latin-wght-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Russo One'; font-weight: 400; font-display: swap; src: url(fonts/russo-one-cyrillic-400-normal.woff2) format('woff2'); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Russo One'; font-weight: 400; font-display: swap; src: url(fonts/russo-one-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: var(--tg-theme-secondary-bg-color, #efeff4);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text: var(--tg-theme-text-color, #1c1c1e);
  --hint: var(--tg-theme-hint-color, #8a8a8e);
  --link: var(--tg-theme-link-color, #2f80ed);
  --btn: var(--tg-theme-button-color, #2f80ed);
  --btn-text: var(--tg-theme-button-text-color, #ffffff);
  --danger: var(--tg-theme-destructive-text-color, #e5484d);
  --sep: rgba(128, 128, 128, 0.2);
  /* rgb-тройки текста и кнопок: main.js берет их из темы Telegram, здесь - запасные */
  --text-rgb: 28, 28, 30;
  --btn-rgb: 47, 128, 237;
  --line: rgba(var(--text-rgb), 0.24);       /* граница облачков */
  --line-soft: rgba(var(--text-rgb), 0.12);  /* полоса между вкладками и подразделами */
  --hdr-tint: rgba(var(--btn-rgb), 0.09);    /* оттенок шапки поверх фона */
  --ok: #2fa45a;
  --warn: #e0820b;
  --info: #2f80ed;
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.35 Onest, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body { padding-bottom: env(safe-area-inset-bottom); }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }

/* ---------- Шапка: вкладки и подразделы ---------- */

/* Шапка закреплена сверху. На телефоне она уезжает и возвращается вместе с прокруткой (headerMotion в main.js). */
.hdr {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 5;
  /* на весь экран (компьютер): не заезжать под кнопки Telegram */
  padding-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  background-color: var(--bg);
  background-image: linear-gradient(var(--hdr-tint), var(--hdr-tint));
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.tabs { display: flex; padding: 8px 12px; }
/* Широкое окно: шапка во всю ширину, содержимое 980 px по центру */
.tabs, .subnav > *, .screen-body { max-width: 980px; margin-left: auto; margin-right: auto; }
/* место под кнопку ⛶, пока окно не намного шире 980 px */
@media (max-width: 1100px) { .has-fs .tabs, .has-fs .backrow { padding-right: 56px; } .has-fs .subnav .chips { margin-right: 44px; } }
.subnav { border-top: 1px solid var(--line-soft); padding: 8px 0; }
.subnav:empty { display: none; }
/* ряд подразделов прокручивается до края экрана */
.subnav .chips { padding: 0 12px; position: relative; }
.subnav .chips:after { content: ''; flex: 0 0 6px; }
.backrow { display: flex; align-items: center; padding-left: 12px; padding-right: 12px; }
/* «Назад» - капсула с названием экрана, куда вернемся */
.backpill {
  flex: 0 1 auto;
  display: -webkit-flex;
  display: flex;
  align-items: center;
  max-width: 55%;
  margin-right: 12px;
  padding: 6px 14px 6px 10px;
  border-radius: 18px;
  background: rgba(var(--btn-rgb), 0.16);
  color: var(--link);
  font-weight: 700;
  font-size: 15px;
}
.backpill .bp-arrow { font-size: 20px; line-height: 16px; margin-right: 5px; }
.backpill .bp-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backpill:active { background: rgba(var(--btn-rgb), 0.26); }
.backrow .tt { flex: 1; min-width: 0; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Кнопка «На весь экран» (компьютер): отдельно в правом верхнем углу, поверх всех экранов */
.fsbtn {
  position: fixed;
  right: 12px;
  top: calc(8px + var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  z-index: 25;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--hint);
  font-size: 18px;
  line-height: 1;
}
.fsbtn.on { color: var(--link); }
.tab {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 4px;
  margin: 0 2px;
  border-radius: 10px;
  color: var(--hint);
  font-weight: 400;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid transparent;
}
.tab.active { background: var(--card); color: var(--text); border-color: var(--line); }
@media (max-width: 374px) {
  .tabs { padding: 8px 8px; }
  .tab { font-size: 13.5px; padding: 8px 2px; }
  .chip { font-size: 12.5px; }
}

#view { padding: 0 12px 24px; }

/* Широкое окно на компьютере: содержимое не растягивается на весь экран */
#app { max-width: 980px; margin: 0 auto; }

/* Russo One - только шапка (вкладки, название экрана) и крупные итоговые цифры статистики.
   Все внутри экрана - Onest. У Russo One одно начертание: font-weight всегда 400, иначе браузер дорисует жирность. */
.hd, .tab, .backrow .tt, .mside-title, .tile-value { font-family: 'Russo One', Onest, -apple-system, sans-serif; font-weight: 400; letter-spacing: 0.01em; }

/* ---------- Общие блоки ---------- */

.empty { padding: 40px 16px; text-align: center; color: var(--hint); }
.hint { color: var(--hint); font-size: 13px; }
.hint.warn { color: var(--warn); }
/* Пояснение под значком ⓘ */
.ib {
  display: inline-block; vertical-align: middle; margin: -6px -4px -6px 0; padding: 6px;
  border: 0; background: none; color: var(--hint); font: 400 15px/1 -apple-system, sans-serif;
  letter-spacing: 0; text-transform: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.ib.on, .ib:hover { color: var(--link); }
.tile .tile-sub2 { margin-top: 4px; }
.row.letter.unread { background: rgba(var(--btn-rgb, 47, 128, 237), 0.06); }
.letter-text { margin-top: 2px; white-space: pre-line; word-break: break-word; }
.rcpt-comment { margin: 8px 0 2px; padding: 8px 10px; border-radius: 10px; background: var(--bg); font-size: 14px; white-space: pre-line; }
.btnrow { display: flex; align-items: center; gap: 4px; margin-top: 16px; }
.btnrow .btn { flex: 1; margin-top: 0; }
.btnrow > .ib { margin: 0; padding: 8px; font-size: 17px; }
.infotip {
  display: none; position: fixed; z-index: 1000; box-sizing: border-box; padding: 10px 12px;
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18); font-size: 13.5px; line-height: 1.4; white-space: pre-line;
}
.warn, .info .line.warn, .person .name .meta.warn { color: var(--warn); }
.warnbox { margin: 0 0 8px; padding: 10px 14px; color: var(--warn); font-size: 14px; }
.section-title {
  margin: 18px 4px 8px;
  color: var(--hint);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.box { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.row {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--sep);
}
.row:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; }
.row-sub { color: var(--hint); font-size: 13px; margin-top: 2px; }
.row-side { margin-left: 10px; text-align: right; white-space: nowrap; }
button.row { width: 100%; text-align: left; }
.row-title .badge { margin: 0 0 0 4px; vertical-align: 1px; }
.muted { opacity: 0.5; }

.btn {
  display: block;
  width: 100%;
  padding: 12px 14px;
  margin-top: 8px;
  border-radius: 12px;
  background: var(--btn);
  color: var(--btn-text);
  font-weight: 600;
  text-align: center;
}
.btn.secondary { background: var(--card); color: var(--link); }
.btn.danger { background: var(--card); color: var(--danger); }
.btn.small { display: inline-block; width: auto; padding: 7px 12px; margin: 6px 6px 0 0; font-size: 14px; }
.btn[disabled] { opacity: 0.5; }

.chips { display: flex; overflow-x: auto; padding: 4px 0 2px; -webkit-overflow-scrolling: touch; }
.chip {
  flex: 0 0 auto;
  padding: 7px 12px;
  margin-right: 6px;
  border-radius: 18px;
  background: var(--card);
  color: var(--hint);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--line);
}
.chip.active { background: var(--btn); color: var(--btn-text); border-color: var(--btn); }

.badge {
  --c: 142, 142, 147;
  display: inline-block;
  padding: 1px 7px;
  border: 1px solid rgba(var(--c), 0.35);
  margin: 3px 0 0 4px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(var(--c), 0.11);
  color: var(--hint);
  white-space: nowrap;
}
/* Цветные метки: светлый фон и рамка чуть насыщеннее того же цвета (--c - rgb-тройка цвета) */
.badge.ok, .pill.yes, .pill.paid { --c: 47, 164, 90; color: var(--ok); }
.badge.warn, .badge.noshow, .pill.awaiting { --c: 224, 130, 11; color: var(--warn); }
.badge.info, .pill.review, .pill.sub { --c: 47, 128, 237; color: var(--info); }
.pill.act { --c: 47, 128, 237; color: var(--link); }
.badge.danger, .pill.no { --c: 229, 72, 77; color: var(--danger); }
/* Нарушения: поздняя отписка - желтая, неявка - оранжевая, плашка у игрока от порога - светло-красная с рамкой */
.badge.late { --c: 184, 134, 11; background: rgba(234, 179, 8, 0.2); color: #b8860b; }
.badge.viol.over { --c: 229, 72, 77; color: var(--danger); border-color: var(--danger); }
.row-sub .badge, .meta .badge { margin-left: 0; }

/* ---------- Неделя ---------- */

.weekbar { display: flex; align-items: center; padding: 6px 0 2px; }
.weekbar .title { flex: 1; text-align: center; font-weight: 700; font-size: 17px; }
.iconbtn {
  width: 40px;
  height: 36px;
  border-radius: 10px;
  background: var(--card);
  color: var(--link);
  font-size: 20px;
  line-height: 36px;
  text-align: center;
}
.weekbar .today-link { display: block; text-align: center; color: var(--link); font-size: 13px; padding: 4px 0 0; }

.day-title { margin: 18px 4px 8px; font-weight: 700; font-size: 15px; }
.day-title.today { color: var(--link); }
.day-title span { color: var(--hint); font-weight: 500; }

.card {
  display: flex;
  width: 100%;
  margin-bottom: 8px;
  padding: 12px 12px 12px 0;
  border-radius: var(--radius);
  background: var(--card);
  text-align: left;
  position: relative;
  overflow: hidden;
}
.card .accent { width: 5px; margin-right: 12px; border-radius: 0 4px 4px 0; align-self: stretch; }
.card .time { width: 52px; font-weight: 700; }
.card .time span { display: block; color: var(--hint); font-weight: 500; font-size: 13px; }
.card .body { flex: 1; min-width: 0; }
.card .title { font-weight: 700; }
.card .sub { color: var(--hint); font-size: 13px; margin-top: 2px; }
.card .side { text-align: right; margin-left: 8px; }
.card .count { font-weight: 700; font-size: 17px; }
.card.cancelled .title, .card.cancelled .time { text-decoration: line-through; color: var(--hint); }

/* ---------- Слой поверх: карточка тренировки, формы ---------- */

#layer .screen {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 20;
  background: var(--bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 0 40px;
}
.screen-body { padding: 0 12px; }

.info { padding: 12px 14px; }
.info .big { font-size: 18px; font-weight: 700; }
.info .line { margin-top: 4px; color: var(--hint); }

.person { display: flex; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--sep); }
.person:last-child { border-bottom: 0; }
.person .name { flex: 1; min-width: 0; }
.person .name b { font-weight: 600; }
.person .name .meta { color: var(--hint); font-size: 12px; }
.pill {
  --c: 142, 142, 147;
  margin-left: 6px;
  padding: 5px 8px;
  border: 1px solid rgba(var(--c), 0.35);
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  background: rgba(var(--c), 0.11);
  color: var(--hint);
}

/* ---------- Формы ---------- */

.field { padding: 10px 14px; border-bottom: 1px solid var(--sep); }
.field:last-child { border-bottom: 0; }
/* Подпись поля - основной цвет, полужирная; пояснение под полем - серое, мельче */
.field label { display: block; color: var(--text); font-size: 15.5px; font-weight: 600; margin-bottom: 6px; }
.field .hint { margin-top: 5px; font-size: 12.5px; line-height: 1.35; }
.field label .hint { font-weight: 400; }
.field input[type=text], .field input[type=number], .field input[type=date], .field input[type=time],
.field select, .field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  -webkit-appearance: none;
  appearance: none;
}
.field textarea { min-height: 70px; resize: vertical; }
.field input[type=color] { width: 60px; height: 36px; border: 0; padding: 0; background: none; }
.field.check, .field .check-row { display: flex; align-items: center; }
.field.check label, .field .check-row label { flex: 1; margin: 0; color: var(--text); font-size: 15.5px; font-weight: 600; }
/* варианты в списке галочек - обычным шрифтом */
.field .checks .check-row label { font-weight: 400; font-size: 15px; }
.field.check input, .field .check-row input { width: 22px; height: 22px; }
.field .check-row + .hint { margin-top: 4px; }
.field .checks .check-row { padding: 5px 0; }
.field .checks .check-row.sub { padding-left: 16px; }
.field .checks + .hint { margin-top: 4px; }

.search { width: 100%; padding: 10px 12px; margin: 8px 0; border: 0; border-radius: 12px; background: var(--card); }
.players-group select { width: 100%; padding: 10px 34px 10px 12px; margin: 4px 0 8px; background-repeat: no-repeat; background-position: right 12px center; background-size: 12px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238a8a8e' stroke-width='1.6'/%3E%3C/svg%3E"); border: 1px solid var(--line); border-radius: 12px; background-color: var(--card); -webkit-appearance: none; appearance: none; }

/* ---------- Выбор действия снизу ---------- */

.backdrop { position: fixed; left: 0; right: 0; top: 0; bottom: 0; z-index: 30; background: rgba(0, 0, 0, 0.35); }
.actionsheet {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 31;
  padding-bottom: env(safe-area-inset-bottom);
}
.actionsheet .box { margin-bottom: 8px; }
.actionsheet .head { padding: 12px 14px; color: var(--hint); font-size: 13px; text-align: center; border-bottom: 1px solid var(--sep); }
.actionsheet button.opt { display: block; width: 100%; padding: 14px; border-bottom: 1px solid var(--sep); color: var(--link); font-size: 17px; }
.actionsheet button.opt:last-child { border-bottom: 0; }
.actionsheet button.opt.danger { color: var(--danger); }
.actionsheet button.cancel { display: block; width: 100%; padding: 14px; font-weight: 700; color: var(--link); font-size: 17px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  max-width: 90%;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(30, 30, 30, 0.92);
  color: #fff;
  font-size: 14px;
  -webkit-transform: translateX(-50%);
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  -webkit-transition: opacity 0.2s;
  transition: opacity 0.2s;
}
.toast.show { opacity: 1; }
/* Ошибка: красная, висит, пока не закроют (в формах ошибка пишется над кнопкой «Сохранить») */
.toast.error {
  display: flex;
  align-items: flex-start;
  width: 90%;
  max-width: 520px;
  padding: 10px 8px 10px 14px;
  background: #d93b3f;
  text-align: left;
  pointer-events: auto;
}
.toast-text { flex: 1; min-width: 0; padding-top: 3px; }
.toast-close { flex: 0 0 auto; width: 28px; height: 28px; margin-left: 8px; color: #fff; font-size: 20px; line-height: 28px; }
.form-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(229, 72, 77, 0.12);
  color: var(--danger);
  font-size: 14px;
}

.receipt-items { margin: 6px 0 0; padding: 0; list-style: none; color: var(--hint); font-size: 13px; }
.receipt-items li { margin-top: 2px; }

/* Кнопки внутри карточки: фон страницы, чтобы они были видны */
.box .btn.secondary, .box .btn.danger { background: var(--bg); }
.actions-row { display: flex; }
.actions-row .btn { flex: 1; }
.actions-row .btn + .btn { margin-left: 8px; }

/* ---------- Правила времени и тексты сообщений ---------- */

.field .inline { display: flex; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.field .inline input[type=number], .field .inline input[type=time] {
  width: auto;
  min-width: 64px;
  max-width: 110px;
  margin: 0 6px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  -webkit-appearance: none;
  appearance: none;
}
.field .inline input[type=number] { width: 72px; }
.field .inline input[type=time] { min-width: 120px; max-width: 150px; }
.rule-summary { margin-top: 8px; color: var(--link); font-size: 13px; font-weight: 600; }
.rule-summary:empty { display: none; }

.text-box { margin-bottom: 8px; }
.text-box textarea { font-size: 15px; line-height: 1.35; }
.preview {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg);
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
}
.preview:before { content: 'Как увидит игрок'; display: block; margin-bottom: 4px; color: var(--hint); font-size: 12px; }
button.link { display: inline-block; margin-top: 8px; color: var(--link); font-size: 14px; }
button.link + button.link { margin-left: 16px; }

/* Свернутые блоки: строка со стрелкой, содержимое под ней */
.fold { margin-bottom: 8px; }
.fold-head .chev { margin-left: 8px; color: var(--hint); font-size: 22px; line-height: 1; transition: transform 0.15s; }
.fold-head.open .chev { transform: rotate(90deg); }
.fold-head .cnt { color: var(--hint); font-weight: 400; }
.fold-head .row-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fold-head.open { border-bottom: 1px solid var(--sep); }
.fold-pad { padding: 12px 10px 10px; background: var(--bg); }
.fold-pad > .hint:first-child { margin-top: 0 !important; }
.fold [data-fold-body] > .box { border-radius: 0; border: 0; box-shadow: none; }
.fold.set > .fold-head:not(.open) { border-bottom: 0; }
.fold-body textarea { font-size: 15px; line-height: 1.35; }
.section-title.sub { margin-top: 14px; text-transform: none; letter-spacing: 0; font-size: 14px; }
.chip .dot { color: var(--warn); }
.chip.active .dot { color: inherit; }
.unsaved-list { margin-top: 6px; color: var(--hint); font-size: 13px; line-height: 1.4; }
.actionsheet .head b { color: var(--text); font-size: 14px; }

/* ---------- Список ожидания и уровни в карточке тренировки ---------- */

.person .pos { color: var(--hint); font-weight: 600; }
.card .side .wait { color: var(--warn); white-space: nowrap; }
.level-box { margin-top: 8px; }
.level-box .btn { margin-top: 8px; }

/* ---------- Чеки с картинкой ---------- */

.receipt-img {
  display: block;
  width: 100%;
  margin-top: 8px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
}
.receipt-img img { display: block; width: 100%; max-height: 360px; object-fit: contain; background: var(--bg); }
.receipt-img.empty-img { padding: 22px 12px; text-align: center; color: var(--hint); font-size: 13px; }
.receipt-full { display: block; width: 100%; border-radius: 12px; background: var(--card); }

/* ---------- Абонементы ---------- */

.row-side .pill { display: inline-block; margin: 4px 0 0; }
.pickbtn {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--link);
  text-align: left;
}

/* Абонементы в форме группы: название и что дает */
.field.check label .hint { font-size: 13px; }
.iconbtn.sm { width: 34px; height: 34px; line-height: 34px; font-size: 15px; margin-left: 6px; flex: 0 0 auto; background: var(--bg); }
.iconbtn[disabled] { opacity: 0.35; }

/* ---------- Редактор уровней ---------- */

.level-row { display: flex; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--sep); }
.level-row:last-child { border-bottom: 0; }
.level-main { flex: 1; min-width: 0; }
.level-main input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  font-weight: 600;
  -webkit-appearance: none;
  appearance: none;
}
.level-main .hint { margin-top: 3px; font-size: 12px; }

/* ---------- Статистика ---------- */

.tiles { display: flex; flex-wrap: wrap; margin: 8px -4px 0; }
.tile {
  flex: 1 1 40%;
  min-width: 0;
  margin: 4px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--card);
}
.tile-value { font-size: 26px; line-height: 1.1; }
.tile-label { margin-top: 4px; font-weight: 600; font-size: 14px; overflow-wrap: break-word; -webkit-hyphens: auto; hyphens: auto; }
.tile-sub { margin-top: 2px; color: var(--hint); font-size: 12px; }
.period-nav { display: flex; align-items: center; margin: 8px 0 0; }
.period-nav .period-title { flex: 1; text-align: center; font-weight: 600; }
.period-nav button { min-width: 44px; padding: 6px 12px; border: 0; border-radius: 10px; background: var(--card); color: var(--link); font-size: 18px; }
.period-nav button:disabled { color: var(--hint); opacity: 0.4; }

/* Воронка: одна серия, подпись значения у конца полосы, дорожка - светлее той же краски */
.funnel { padding: 6px 14px 12px; }
.funnel-step { margin-top: 10px; }
.funnel-head { display: flex; justify-content: space-between; font-size: 14px; }
.funnel-head .hint { margin-left: 8px; white-space: nowrap; font-size: 12px; }
.funnel-track {
  position: relative;
  display: flex;
  align-items: center;
  height: 22px;
  margin-top: 4px;
  border-radius: 0 4px 4px 0;
  background: rgba(47, 128, 237, 0.10);
}
.funnel-bar { height: 22px; max-width: calc(100% - 44px); border-radius: 0 4px 4px 0; background: var(--btn); }
.funnel-value { margin-left: 8px; font-weight: 700; font-size: 13px; color: var(--text); }

/* ---------- Границы облачков ---------- */

.box, .card, .tile, .iconbtn, .search, .period-nav button, .btn.secondary, .btn.danger, .receipt-full { border: 1px solid var(--line); }
/* .info у метки уровня - это цвет, а не блок с отступами */
.badge.info { padding: 1px 7px; }

/* ---------- Отступы ---------- */

.chips + .chips { margin-top: 6px; }
.chips + .box { margin-top: 8px; }
.tiles + .box { margin-top: 8px; }
.box .empty { padding: 18px 16px; }

/* ---------- Меню «Управления» ---------- */

.mmenu .mcol > .section-title:first-child { margin-top: 10px; }
/* широкое окно: два столбца плашек */
@media (min-width: 700px) {
  .mmenu { display: -webkit-flex; display: flex; }
  .mmenu .mcol { -webkit-flex: 1; flex: 1; min-width: 0; }
  .mmenu .mcol + .mcol { margin-left: 16px; }
}
.mrow {
  display: -webkit-flex;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 50px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--sep);
  text-align: left;
}
.mrow:last-child { border-bottom: 0; }
.mrow.on { background: rgba(var(--btn-rgb), 0.12); }
.mrow .mic {
  display: -webkit-flex;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  margin-right: 12px;
  border-radius: 8px;
}
.mrow .mic svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mrow .mt { flex: 1; min-width: 0; font-weight: 600; font-size: 16px; }
.mrow .mcount { margin-left: 8px; color: var(--hint); font-size: 15px; }
.mrow .chev { margin-left: 8px; color: var(--hint); font-size: 22px; line-height: 1; }
.mview { margin: 18px 4px 0; }
.mview .chips { margin-top: 6px; }

/* компьютер, «меню слева» */
.mside { display: -webkit-flex; display: flex; align-items: flex-start; }
.mside-menu { flex: 0 0 250px; width: 250px; margin-right: 16px; }
.mside-menu .section-title:first-child { margin-top: 4px; }
.mside-main { flex: 1; min-width: 0; }
.mside-title { margin: 2px 4px 8px; font-size: 20px; }
