/* Импульс CRM Mobile — мини-PWA для старшего оператора.
   Ребрендинг «Конструктор» (2026): токены — ровно те же, что в public/styles.css
   (светлая + тёмная), вёрстка целиком мобильная. */
@import url("fonts/fonts.css");

:root {
  /* ── Бренд: четыре детали конструктора ─────────────────────────────── */
  --coral: #FF5B3A;  --coral-soft: #FFE7E1;  --coral-text: #D13A1C;   /* спорт, движение */
  --sky:   #4BA3F2;  --sky-soft:   #E3F0FD;  --sky-text:   #1467B8;   /* образование, знания */
  --lemon: #FFC72C;  --lemon-soft: #FFF3CC;  --lemon-text: #8A6200;   /* дети, «Чемпион», акции */
  --mint:  #2FC795;  --mint-soft:  #DDF6EC;  --mint-text:  #0E7A57;   /* взрослые, успех */
  /* Дополнения для CRM (в ките нет): творчество, опасные действия */
  --violet: #8B6CF6; --violet-soft: #EEE9FE; --violet-text: #5B3CC4;
  --berry:  #E5336B; --berry-soft:  #FDE3EB; --berry-text:  #B0194A;
  --ink: #16161A; --paper: #FFFFFF; --sand: #F3F1EC;

  /* ── Поверхности и текст ──────────────────────────────────────────── */
  --bg:        #F3F1EC;
  --bg-2:      #ECE9E2;
  --surface:   #FFFFFF;
  --surface-2: #F8F7F3;
  --border:    #E4E1DA;
  --border-2:  #D3CFC6;
  --line-strong: #16161A;          /* «чернильная» обводка ключевых контейнеров */
  --text:      #16161A;
  --text-2:    #3A3A42;
  --text-3:    #66666E;
  --text-1: var(--text);
  --bg-1: var(--surface);
  --overlay: rgba(22,22,26,.55);

  /* ── Акцент интерфейса = коралл; текст на цвете всегда тёмный ─────── */
  --accent-h: 12;
  --accent:      var(--coral);
  --accent-2:    #F04A28;
  --accent-soft: var(--coral-soft);
  --accent-text: var(--coral-text);
  --accent-fg:   var(--coral-text);
  --on-accent:   var(--ink);
  --focus:       #1467B8;
  --selection:   var(--lemon-soft);   /* выделенная строка, «вернулись сюда» */

  --lime: var(--lemon); --lime-soft: var(--lemon-soft); --lime-text: var(--lemon-text);

  /* ── Семантика. Опасное — «ягода», чтобы не спорить с кораллом ───── */
  --success: var(--mint-text);   --success-soft: var(--mint-soft);   --success-fill: var(--mint);
  --warn:    var(--lemon-text);  --warning: var(--lemon-text);       --warn-soft: var(--lemon-soft); --warn-fill: var(--lemon);
  --danger:  var(--berry-text);  --danger-soft: var(--berry-soft);   --danger-fill: var(--berry);
  --info:    var(--sky-text);    --info-soft: var(--sky-soft);       --info-fill: var(--sky);
  --purple:  var(--violet-text); --purple-soft: var(--violet-soft);   --purple-fill: var(--violet);

  /* Школы/партнёры */
  --school-impulse: var(--coral);
  --school-champion: var(--lemon);

  --today-col-bg: #FFFBEA;

  /* ── Форма: обводка, радиусы, тени ────────────────────────────────── */
  --stroke: 1.5px;
  --stroke-strong: 2px;
  --radius-sm: 10px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-hard-sm: 2px 2px 0 var(--ink);
  --shadow-hard:    3px 3px 0 var(--ink);
  --shadow-hard-lg: 6px 6px 0 var(--ink);
  --shadow-sm: 0 1px 2px rgba(22,22,26,.06);
  --shadow-md: 0 4px 12px rgba(22,22,26,.08);
  --shadow-lg: 0 16px 36px -12px rgba(22,22,26,.22);
  --ease: cubic-bezier(.2,.8,.2,1);

  --sidebar-w: 248px;
  --topbar-h: 64px;

  --font: Manrope, "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Dela Gothic One", "Arial Black", sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;

  /* ── Сетка отступов (4px) ─────────────────────────────────────────── */
  --space-0: 0;     --space-1: 4px;   --space-1h: 6px;  --space-2: 8px;
  --space-2h: 10px; --space-3: 12px;  --space-4: 16px;  --space-5: 20px;
  --space-6: 24px;  --space-8: 32px;  --space-10: 40px; --space-12: 48px;

  --page-pad-x: 28px; --page-pad-y: 24px; --section-gap: 24px;
  --card-pad: 20px;   --card-head-pad-y: 16px; --card-head-pad-x: 20px;
  --grid-gutter: 16px; --field-gap: 8px; --control-gap: 8px; --stack-gap: 12px;

  --navbar-h: 60px;
  --topbar-h: 54px;

  color-scheme: light;
}


* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body, #root { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  overscroll-behavior-y: none;
}
input, select, textarea, button { font-family: inherit; font-size: 16px; color: inherit; }
.mono, .money, .num { font-family: var(--font-mono); letter-spacing: -0.01em; }
a { color: var(--info); text-decoration: none; }

/* ── App shell ───────────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.topbar {
  height: var(--topbar-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  padding-top: env(safe-area-inset-top);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-weight: 700; font-size: 17px; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-back {
  width: 38px; height: 38px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--text); border-radius: 10px;
}
.topbar-back:active { background: var(--bg-2); }
.topbar-action {
  border: none; background: transparent; color: var(--text-2);
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
}
.topbar-action:active { background: var(--bg-2); }

.screen {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 14px calc(var(--navbar-h) + env(safe-area-inset-bottom) + 16px);
}

/* ── Bottom navigation ───────────────────────────────────── */
.navbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--navbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px -6px rgba(0,0,0,0.18);
}
.nav-tab {
  flex: 1; min-width: 0; border: none; background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--text-3); font-size: 10px; font-weight: 600;
  white-space: nowrap; letter-spacing: -0.2px;
  position: relative; padding-top: 6px;
}
.nav-tab.active { color: var(--accent-text); }
.nav-tab .nav-ico { width: 24px; height: 24px; }
.nav-tab .nav-badge {
  position: absolute; top: 2px; left: calc(50% + 8px);
  min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--danger); color: #fff; border-radius: 9px;
  font-size: 10px; font-weight: 700; line-height: 17px; text-align: center;
}

/* ── Segmented control (фильтры списков) ─────────────────── */
.seg { display: flex; gap: 6px; margin-bottom: 12px; }
.seg-btn {
  flex: 1; min-width: 0; padding: 8px 6px; border-radius: 10px;
  border: 1px solid var(--border-2); background: var(--surface);
  color: var(--text-3); font-weight: 600; font-size: 13px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.seg-btn.active { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }

/* ── Экран «Оплаты» ──────────────────────────────────────── */
.pay-daybar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.pay-nav {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--border-2); background: var(--surface);
  display: grid; place-items: center; color: var(--text-2); cursor: pointer;
}
.pay-nav:active { background: var(--surface-2); }
.pay-nav:disabled { opacity: .35; }
.pay-day {
  position: relative; flex: 1; min-width: 0; height: 42px;
  border: 1px solid var(--border-2); border-radius: 12px; background: var(--surface);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: 600; color: var(--text); cursor: pointer;
}
.pay-day > svg { color: var(--text-3); }
.pay-day input[type="date"] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; padding: 0; border: none; background: transparent;
  opacity: 0; cursor: pointer; -webkit-appearance: none; appearance: none;
}
.pay-total {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 12px 16px; margin-bottom: 12px; border-radius: 14px;
  background: var(--accent-soft);
}
.pay-total-sum {
  font-size: 24px; font-weight: 800; letter-spacing: -0.02em;
  color: var(--accent-text); font-variant-numeric: tabular-nums;
}
.pay-total-cnt { font-size: 13px; font-weight: 600; color: var(--text-2); }
.pay-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ── Cards / list ────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px;
  margin-bottom: 12px;
}
.card.tap:active { background: var(--surface-2); }
.card-row { display: flex; align-items: center; gap: 12px; }
.section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-3); margin: 18px 4px 8px;
}
.section-title:first-child { margin-top: 4px; }
.muted { color: var(--text-3); }
.subtle { color: var(--text-2); font-size: 13px; }
.empty {
  text-align: center; color: var(--text-3); padding: 48px 20px; font-size: 14px;
}
.empty .empty-emoji { font-size: 34px; display: block; margin-bottom: 10px; opacity: .7; }

/* ── Avatar ──────────────────────────────────────────────── */
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto;
  background: var(--accent-soft); color: var(--accent-text);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Badges / chips ──────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--bg-2); color: var(--text-2);
}
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 16px; border-radius: var(--radius-sm); font-size: 15px; font-weight: 600;
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
  min-height: 46px; cursor: pointer; width: 100%;
}
.btn:active { background: var(--bg-2); }
.btn:disabled { opacity: .5; }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: transparent;
  box-shadow: var(--shadow-sm); }
.btn-primary:active { background: var(--accent-2); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-sm { min-height: 38px; padding: 8px 12px; font-size: 13px; width: auto; }
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { width: auto; flex: 1; }

/* ── Inputs ──────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.input {
  width: 100%; padding: 12px 14px; min-height: 48px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); outline: none;
}
.input:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--accent-soft); }
select.input { appearance: none; background-image:
  url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23857b69' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 40px; }

.search-bar { position: relative; margin-bottom: 12px; }
.search-bar .input { padding-left: 42px; }
.search-bar .search-ico {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); pointer-events: none;
}

/* ── Sheet (bottom modal) ────────────────────────────────── */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(15,15,12,0.45);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .15s ease;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 92vh;
  background: var(--surface); border-radius: 20px 20px 0 0;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: slideup .22s cubic-bezier(.2,.7,.3,1);
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--border-2);
  margin: 8px auto 4px; flex: 0 0 auto; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 6px 16px 12px; flex: 0 0 auto; }
.sheet-head .sheet-title { font-weight: 700; font-size: 17px; flex: 1; }
.sheet-close { border: none; background: var(--bg-2); color: var(--text-2);
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto; }
.sheet-body { overflow-y: auto; padding: 0 16px 16px; -webkit-overflow-scrolling: touch; }
.sheet-foot { padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border); display: flex; gap: 10px; flex: 0 0 auto; }
.sheet-foot > .btn { flex: 1; }
@keyframes slideup { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ── Toast ───────────────────────────────────────────────── */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(var(--navbar-h) + 18px);
  display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 80; pointer-events: none; }
.toast {
  background: var(--text); color: var(--surface); padding: 11px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); max-width: 88%;
  animation: fade .15s ease;
}
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: var(--success); color: #fff; }

/* ── Login ───────────────────────────────────────────────── */
.login-wrap { min-height: 100%; display: flex; flex-direction: column; justify-content: center;
  padding: 28px 22px calc(28px + env(safe-area-inset-bottom)); }
.login-brand { display: flex; flex-direction: column; align-items: center; margin-bottom: 26px; }
.login-mark { width: 64px; height: 64px; border-radius: 18px; background: var(--accent);
  color: var(--accent-text); display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 30px; box-shadow: var(--shadow-md); margin-bottom: 12px; }
.login-title { font-weight: 700; font-size: 20px; }
.login-sub { color: var(--text-3); font-size: 13px; margin-top: 2px; }

/* ── выбор логина из списка на экране входа ── */
.mlogin-combo { position: relative; }
.mlogin-inputwrap { position: relative; }
.mlogin-inputwrap .input { padding-right: 46px; }
.mlogin-chev { position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--text-3); cursor: pointer; border-radius: 8px; }
.mlogin-chev svg { transition: transform .18s; }
.mlogin-chev.open svg { transform: rotate(180deg); }
.mlogin-ava { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; object-fit: cover;
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px;
  font-weight: 700; color: #fff; background: hsl(var(--ah, 220) 52% 52%); }
.mlogin-sel { display: flex; align-items: center; gap: 11px; text-align: left; cursor: pointer; }
.mlogin-sel-name { flex: 1; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mlogin-x { color: var(--text-3); flex-shrink: 0; }
.mlogin-menu { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 20px 50px -12px rgba(0,0,0,.4); padding: 6px; max-height: 50vh; overflow-y: auto; }
.mlogin-opt { width: 100%; display: flex; align-items: center; gap: 11px; padding: 10px;
  border: none; background: none; border-radius: 10px; cursor: pointer; font-size: 15px;
  color: var(--text); text-align: left; }
.mlogin-opt:active { background: var(--surface-2); }
.mlogin-opt-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mlogin-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.mlogin-manual { color: var(--text-2); font-size: 14px; justify-content: center; }

/* ── Misc ────────────────────────────────────────────────── */
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--border-2); border-top-color: var(--accent-2);
  animation: spin .7s linear infinite; margin: 28px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack > * + * { margin-top: 10px; }
.hr { height: 1px; background: var(--border); margin: 14px 0; border: none; }
.list-line { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list-line:last-child { border-bottom: none; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.amount { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Плашка установки PWA — сверху, поверх контента, с учётом выреза. */
.install-bar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 12px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  animation: install-slide 0.25s ease;
}
@keyframes install-slide { from { transform: translateY(-100%); } to { transform: translateY(0); } }
.install-ico {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 11px;
  background: var(--accent); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 22px;
}
.install-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.install-text b { font-size: 14px; color: var(--text); }
.install-text span { font-size: 12px; color: var(--text-3); }
.install-btn { width: auto; flex: 0 0 auto; padding: 9px 16px; }
.install-x {
  flex: 0 0 auto; width: 32px; height: 32px; border: none; background: transparent;
  color: var(--text-3); border-radius: 8px; display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.install-x:active { background: var(--bg-2); }

/* ══ Слой бренда «Конструктор» ═══════════════════════════════════════════ */
.topbar { border-bottom: var(--stroke-strong) solid var(--line-strong); }
.topbar-title { font-family: var(--font-display); font-weight: 400; text-transform: lowercase; font-size: 19px; }
.navbar { border-top: var(--stroke-strong) solid var(--line-strong); }
.nav-tab { font-weight: 700; }
.nav-tab.active { color: var(--ink); background: var(--lemon); border-radius: 12px; }
.card { border: var(--stroke) solid var(--line-strong); }
.btn { border: var(--stroke) solid var(--line-strong); font-weight: 800; }
.btn-primary { background: var(--coral); color: var(--ink); border: var(--stroke-strong) solid var(--ink); box-shadow: var(--shadow-hard); }
.btn-primary:active { background: var(--coral); transform: translate(3px,3px); box-shadow: none; }
.seg-btn.active { border-color: var(--line-strong); background: var(--text); color: var(--surface); }
.input:focus { border-color: var(--line-strong); box-shadow: var(--shadow-hard-sm); }
.login-mark, .install-ico {
  background: url("brand/impulse-mark.svg") center/contain no-repeat !important;
  color: transparent !important; font-size: 0 !important; box-shadow: none !important; border-radius: 0 !important;
}
.login-title { font-family: var(--font-display); font-weight: 400; text-transform: lowercase; }
.empty .empty-emoji {
  display: block; width: 46px; height: 46px; margin: 0 auto 12px; font-size: 0; opacity: 1;
  background: url("brand/impulse-mark.svg") center/contain no-repeat;
}
.amount, .pay-total-sum { font-family: var(--font-display); font-weight: 400; letter-spacing: 0; }

/* Баннер «Установить приложение» */
.install-bar { background: var(--surface); border-bottom: var(--stroke-strong) solid var(--ink); box-shadow: none; }
.install-ico { width: 40px; height: 40px; }
.install-text b { font-family: var(--font-display); font-weight: 400; font-size: 15px; text-transform: lowercase; }
.install-text span { font-weight: 600; }
.install-btn { padding: 8px 14px; }
.install-x { color: var(--ink); }
