/* BRAVITO — фирменный стиль по логотипу: глубокий синий + золото, зелёный и жёлтый флага — тонкими акцентами.
   Только логические свойства (margin-inline и т.п.) — одинаково работает справа налево (иврит) и слева направо (русский). */
@font-face { font-family: 'Rubik'; font-style: normal; font-display: swap; font-weight: 300 900; src: url(/fonts/rubik-hebrew-wght-normal.woff2) format('woff2'); unicode-range: U+0307-0308,U+0590-05FF,U+200C-2010,U+20AA,U+25CC,U+FB1D-FB4F; }
@font-face { font-family: 'Rubik'; font-style: normal; font-display: swap; font-weight: 300 900; src: url(/fonts/rubik-cyrillic-wght-normal.woff2) format('woff2'); unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: 'Rubik'; font-style: normal; font-display: swap; font-weight: 300 900; src: url(/fonts/rubik-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+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

:root {
  --navy-950: #060f24; --navy-900: #0b1d3f; --navy-800: #102a5c; --navy-700: #163a7a; --navy-100: #e6ecf7; --navy-50: #f3f6fb;
  --gold-600: #b8861b; --gold-500: #d4a72c; --gold-400: #e9c25a; --gold-100: #fbf1d6;
  --green-600: #13803a; --green-500: #1e9e4a; --green-100: #e2f5e8; --yellow-400: #f7d117; --blue-600: #1c3f94; --cream: #fff8e7;
  --ink: #0f1a2e; --ink-2: #3d4a63; --ink-3: #6b778f; --line: #e3e8f1; --line-2: #ced6e4; --bg: #f4f6fa; --surface: #ffffff;
  --ok-bg: #e3f6ea; --ok-fg: #0f6b32; --part-bg: #fff4c7; --part-fg: #7a5a00; --pend-bg: #ffe8d6; --pend-fg: #9a4300; --bad-bg: #fde3e3; --bad-fg: #a1121f;
  --info-bg: #e5edff; --info-fg: #1c3f94; --muted-bg: #eef1f6; --muted-fg: #56627a;
  --radius: 14px; --radius-sm: 10px; --radius-lg: 20px;
  --shadow-1: 0 1px 2px rgba(11,29,63,.06), 0 1px 3px rgba(11,29,63,.08); --shadow-2: 0 6px 20px rgba(11,29,63,.10); --shadow-3: 0 18px 48px rgba(6,15,36,.24);
  --font: 'Rubik', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --tabbar-h: 64px; --appbar-h: 56px; --side-w: 248px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.45; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--navy-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; color: var(--navy-900); }
h1 { font-size: 1.45rem; font-weight: 700; } h2 { font-size: 1.12rem; font-weight: 650; } h3 { font-size: 1rem; font-weight: 600; }
p { margin: .4em 0; }
.muted { color: var(--ink-3); } .small { font-size: .85rem; } .strong { font-weight: 600; } .bad { color: var(--bad-fg); } .ok { color: var(--ok-fg); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pre-wrap { white-space: pre-wrap; } .pre { white-space: pre-wrap; background: var(--navy-50); padding: 12px; border-radius: var(--radius-sm); font-size: .85rem; max-height: 60vh; overflow: auto; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold-400); outline-offset: 2px; }
.ico { flex: none; }

/* ───────── оболочка ───────── */
.shell { min-height: 100vh; display: flex; }
.sidenav { display: none; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.appbar { position: sticky; top: 0; z-index: 20; height: var(--appbar-h); display: flex; align-items: center; gap: 10px; padding: 0 12px;
  background: linear-gradient(180deg, var(--navy-900), var(--navy-800)); color: #fff; box-shadow: 0 2px 0 var(--gold-500); }
.appbar::after { content: ''; position: absolute; inset-inline: 0; bottom: -5px; height: 3px; background: linear-gradient(90deg, var(--green-500) 0 33%, var(--yellow-400) 33% 66%, var(--blue-600) 66%); opacity: .9; }
.appbar-brand { display: flex; align-items: center; gap: 8px; color: #fff; }
.appbar-brand:hover { text-decoration: none; }
.brand-name { font-weight: 800; letter-spacing: .08em; color: var(--gold-400); font-size: 1.05rem; }
.appbar-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .92; }
.appbar-actions { display: flex; align-items: center; gap: 2px; }
.appbar .btn-ghost { color: #fff; }
.appbar .btn-ghost:hover { background: rgba(255,255,255,.12); }
.logo { border-radius: 50%; display: block; }
.pending-badge { display: inline-flex; gap: 4px; align-items: center; background: var(--gold-500); color: var(--navy-950); border-radius: 99px; padding: 2px 8px; font-size: .8rem; font-weight: 700; }
.main { flex: 1; padding: 16px 14px calc(var(--tabbar-h) + 24px); outline: none; }
.tabbar { position: fixed; z-index: 30; inset-inline: 0; bottom: 0; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr); background: var(--navy-900); border-top: 2px solid var(--gold-500); }
.tabbar .nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #c9d3e8; font-size: .7rem; position: relative;
  background: none; border: 0; font-family: inherit; cursor: pointer; padding: 6px 2px; text-align: center; }
.tabbar .nav-item span:not(.badge) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.tabbar .nav-item.active { color: var(--gold-400); }
.tabbar .nav-item.active::before { content: ''; position: absolute; top: 0; inset-inline: 28%; height: 3px; background: var(--gold-400); border-radius: 0 0 3px 3px; }
.tabbar .nav-item:hover { text-decoration: none; }
.nav-item .badge, .badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #e5484d; color: #fff; font-size: .7rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.tabbar .nav-item .badge { position: absolute; top: 4px; inset-inline-start: 56%; }
@media (min-width: 1000px) {
  .sidenav { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; width: var(--side-w); flex: none; overflow-y: auto;
    background: linear-gradient(180deg, var(--navy-950), var(--navy-900) 40%, var(--navy-800)); color: #dfe6f5; border-inline-end: 3px solid var(--gold-500); }
  .sidenav .brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 14px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
  .sidenav .brand:hover { text-decoration: none; }
  .nav-list { padding: 10px 8px 24px; display: flex; flex-direction: column; gap: 2px; }
  .sidenav .nav-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: #cdd6ea; font-size: .93rem; position: relative; }
  .sidenav .nav-item:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
  .sidenav .nav-item.active { background: linear-gradient(90deg, rgba(212,167,44,.24), rgba(212,167,44,.06)); color: #fff; box-shadow: inset 3px 0 0 var(--gold-400); }
  [dir="rtl"] .sidenav .nav-item.active { box-shadow: inset -3px 0 0 var(--gold-400); background: linear-gradient(270deg, rgba(212,167,44,.24), rgba(212,167,44,.06)); }
  .sidenav .nav-item .badge { margin-inline-start: auto; }
  .tabbar { display: none; }
  .appbar-brand { display: none; }
  .main { padding: 24px 28px 40px; }
}

/* ───────── страница ───────── */
.page { max-width: 1280px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.page.narrow { max-width: 720px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.page-actions, .row-actions, .head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.page-actions-bottom { display: flex; justify-content: center; padding: 10px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-3); font-size: .9rem; }
[dir="rtl"] .back .ico, [dir="rtl"] .cal-nav .btn:first-child .ico, [dir="rtl"] .ico-flip { transform: scaleX(-1); }
[dir="rtl"] .attention-item .ico:last-child, [dir="rtl"] .cal-nav .btn:nth-child(3) .ico { transform: scaleX(-1); }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 16px; border: 1px solid var(--line); }
.card-title { margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.grid-2 { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.notice { background: var(--gold-100); border: 1px solid #f0d78b; color: #5c4300; padding: 10px 14px; border-radius: var(--radius-sm); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.notice.warn { background: var(--pend-bg); border-color: #f6c39a; color: var(--pend-fg); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; background: var(--muted-bg); color: var(--muted-fg); font-size: .78rem; margin-inline-start: 6px; white-space: nowrap; }
.tag.warn { background: var(--pend-bg); color: var(--pend-fg); } .tag.bad { background: var(--bad-bg); color: var(--bad-fg); } .tag.ok { background: var(--ok-bg); color: var(--ok-fg); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.dl dt { color: var(--ink-3); } .dl dd { margin: 0; }
.plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }

/* ───────── кнопки ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 14px; border-radius: 11px; border: 1px solid transparent;
  font: 600 .92rem var(--font); cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background .15s, box-shadow .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(180deg, var(--navy-700), var(--navy-900)); color: #fff; box-shadow: 0 1px 0 var(--gold-500) inset, var(--shadow-1); }
.btn-primary:hover { background: linear-gradient(180deg, #1d4790, var(--navy-800)); }
.btn-secondary { background: var(--surface); color: var(--navy-900); border-color: var(--line-2); }
.btn-secondary:hover { border-color: var(--gold-500); background: #fffdf6; }
.btn-ghost { background: transparent; color: var(--navy-800); }
.btn-ghost:hover { background: var(--navy-50); }
.btn-danger { background: #fff; color: var(--bad-fg); border-color: #f3b4b4; }
.btn-danger:hover { background: var(--bad-bg); }
.btn-wa { background: #1faa53; color: #fff; }
.btn-wa:hover { background: #178c44; }
.btn-sm { min-height: 34px; padding: 0 10px; font-size: .84rem; border-radius: 9px; }
.btn-icon { min-width: 40px; padding: 0 8px; }
.btn-sm.btn-icon { min-width: 34px; }
.phone-actions { display: inline-flex; align-items: center; gap: 4px; flex-wrap: nowrap; }
.phone-actions .btn { min-height: 36px; min-width: 36px; padding: 0 7px; }
.phone-num { font-variant-numeric: tabular-nums; color: var(--ink-2); margin-inline-end: 4px; }
.lang-btn { font-weight: 700; }
.mic-btn.on, .voice-big.on { animation: pulse 1.2s infinite; background: #e5484d; color: #fff; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(229,72,77,.2); } }

/* ───────── чипы статусов (ТЗ: оплачено — зелёный, частично — жёлтый, ожидается — оранжевый, просрочено — красный) ───────── */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px; font-size: .78rem; font-weight: 650; white-space: nowrap; border: 1px solid transparent; }
.chip-paid { background: var(--ok-bg); color: var(--ok-fg); border-color: #b9e6c8; }
.chip-partial { background: var(--part-bg); color: var(--part-fg); border-color: #f2df8e; }
.chip-pending { background: var(--pend-bg); color: var(--pend-fg); border-color: #f6c39a; }
.chip-overdue { background: var(--bad-bg); color: var(--bad-fg); border-color: #f3b4b4; }
.chip-review, .chip-info { background: var(--info-bg); color: var(--info-fg); border-color: #c4d4fa; }
.chip-muted { background: var(--muted-bg); color: var(--muted-fg); }

/* ───────── формы ───────── */
.form-grid { display: grid; grid-template-columns: 1fr; gap: 12px 14px; }
@media (min-width: 720px) { .modal-wide .form-grid, .page:not(.narrow) .card .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .full, .form-grid .form-section, .form-grid .form-note, .form-grid .field-check { grid-column: 1 / -1; } }
.field { display: flex; flex-direction: column; gap: 5px; position: relative; }
.field-label { font-size: .86rem; color: var(--ink-2); font-weight: 550; }
.req { color: var(--bad-fg); }
.field-hint { font-size: .78rem; color: var(--ink-3); }
.field-check { flex-direction: row; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.field-check input { width: 22px; height: 22px; accent-color: var(--navy-800); flex: none; }
.input { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 11px; font: 400 1rem var(--font); color: var(--ink); background: #fff; }
textarea.input { resize: vertical; min-height: 64px; }
.input:focus { border-color: var(--navy-700); outline: none; box-shadow: 0 0 0 3px rgba(22,58,122,.15); }
.input.invalid { border-color: var(--bad-fg); box-shadow: 0 0 0 3px rgba(161,18,31,.12); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-inline-end: 30px; }
[dir="rtl"] select.input { background-position: 18px 50%, 13px 50%; }
.form-section { margin-top: 6px; color: var(--navy-800); font-size: .95rem; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.form-note { color: var(--ink-3); font-size: .86rem; margin: 0; background: var(--navy-50); padding: 8px 10px; border-radius: 9px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.field .mic-btn { position: absolute; inset-inline-end: 4px; bottom: 2px; }
.img-preview { width: 120px; height: 120px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.image-input { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sig { border: 2px dashed var(--line-2); border-radius: 12px; background: #fff; padding: 6px; }
.sig-canvas { width: 100%; height: 160px; touch-action: none; display: block; background: repeating-linear-gradient(0deg, transparent 0 38px, #eef1f6 38px 39px); border-radius: 8px; }
.sig-foot { display: flex; justify-content: space-between; align-items: center; padding: 4px; }
.sig-img { max-width: 320px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* ───────── фильтры, вкладки ───────── */
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter { display: flex; align-items: center; gap: 6px; }
.filter .input { min-height: 38px; padding-block: 6px; font-size: .9rem; }
.filter-search { position: relative; flex: 1 1 220px; }
.filter-search .ico { position: absolute; inset-inline-start: 10px; color: var(--ink-3); }
.filter-search .input { padding-inline-start: 34px; }
.filter-label { font-size: .8rem; color: var(--ink-3); }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tab { padding: 10px 14px; border: 0; background: none; font: 600 .9rem var(--font); color: var(--ink-3); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tab.active { color: var(--navy-900); border-bottom-color: var(--gold-500); }
.tab:hover { text-decoration: none; color: var(--navy-800); }
.seg { display: inline-flex; background: var(--navy-50); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg-btn { border: 0; background: transparent; border-radius: 9px; padding: 8px 14px; font: 600 .9rem var(--font); color: var(--ink-2); cursor: pointer; min-height: 40px; }
.seg-btn.active { background: #fff; color: var(--navy-900); box-shadow: var(--shadow-1); }

/* ───────── таблицы → карточки на телефоне ───────── */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: start; font-weight: 600; color: var(--ink-3); font-size: .8rem; text-transform: uppercase; letter-spacing: .02em; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfd; white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #fbfcff; }
@media (max-width: 760px) {
  .table-wrap { background: none; border: 0; box-shadow: none; overflow: visible; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); margin-bottom: 10px; padding: 8px 12px; }
  .table td { border: 0; padding: 5px 0; display: flex; gap: 10px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
  .table td::before { content: attr(data-label); color: var(--ink-3); font-size: .8rem; flex: none; }
  .table td[data-label=""]::before { content: none; }
  .table td:first-child { font-size: 1rem; font-weight: 600; }
}
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 32px 16px; color: var(--ink-3); text-align: center; background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.empty.err { color: var(--bad-fg); }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px; color: var(--ink-3); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--gold-500); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────── KPI ───────── */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 760px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.kpis.small { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow-1); text-align: start; font-family: inherit;
  display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
button.kpi { cursor: pointer; } button.kpi:hover { border-color: var(--gold-500); box-shadow: var(--shadow-2); }
.kpi::before { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--navy-700); }
.kpi-ok::before { background: var(--green-500); } .kpi-bad::before { background: #d33; } .kpi-warn::before { background: var(--gold-500); }
.kpi-top { display: flex; gap: 6px; align-items: center; color: var(--ink-3); }
.kpi-label { font-size: .8rem; color: var(--ink-3); }
.kpi-value { font-size: 1.45rem; font-weight: 750; color: var(--navy-900); font-variant-numeric: tabular-nums; }
.kpi-value.small { font-size: .95rem; } .kpi-value.bad { color: var(--bad-fg); }
.kpi-sub { font-size: .78rem; color: var(--ink-3); }
.attention { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.attention-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 11px; background: var(--navy-50); color: var(--ink); border: 1px solid var(--line); }
.attention-item:hover { border-color: var(--gold-500); text-decoration: none; background: #fffcf2; }
.att-label { flex: 1; } .att-n { font-weight: 700; color: var(--navy-800); }

/* ───────── окна ───────── */
.modal-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(6,15,36,.55); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.modal { background: var(--surface); width: 100%; max-height: 92vh; display: flex; flex-direction: column; border-radius: 20px 20px 0 0; box-shadow: var(--shadow-3); animation: up .2s ease-out; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 1.05rem; }
.modal-body { padding: 14px 16px; overflow-y: auto; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
@media (min-width: 700px) { .modal-wrap { align-items: center; } .modal { width: 560px; border-radius: 20px; } .modal-wide { width: 860px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } } @keyframes fade { from { opacity: 0; } }
.toasts { position: fixed; z-index: 200; inset-inline: 12px; bottom: calc(var(--tabbar-h) + 14px); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
@media (min-width: 1000px) { .toasts { bottom: 20px; } }
.toast { pointer-events: auto; max-width: 520px; background: var(--navy-900); color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-3); border-inline-start: 4px solid var(--green-500); transition: opacity .3s, transform .3s; }
.toast-err { border-inline-start-color: #e5484d; } .toast-warn { border-inline-start-color: var(--gold-500); }
.toast.out { opacity: 0; transform: translateY(10px); }
.menu-sheet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.menu-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 14px 6px; border-radius: 14px; background: var(--navy-50); border: 1px solid var(--line);
  color: var(--navy-900); font: 600 .8rem var(--font); text-align: center; cursor: pointer; min-height: 84px; }
.menu-tile:hover { border-color: var(--gold-500); text-decoration: none; }
.pick-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; max-height: 50vh; overflow: auto; }
.pick-item { text-align: start; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; cursor: pointer; font-family: inherit; }
.pick-item:hover { border-color: var(--gold-500); }
.link-box { background: var(--navy-50); border: 1px solid var(--line); padding: 8px 10px; border-radius: 9px; font-size: .85rem; word-break: break-all; }
.link-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.check-list { max-height: 40vh; overflow: auto; display: flex; flex-direction: column; gap: 6px; }

/* ───────── вход ───────── */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; position: relative; overflow: hidden;
  background: radial-gradient(1200px 600px at 50% -10%, #1d4790 0%, var(--navy-900) 45%, var(--navy-950) 100%); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 24px; padding: 22px 22px 18px; box-shadow: var(--shadow-3); position: relative; z-index: 1; border-top: 4px solid var(--gold-500); }
.auth-top { display: flex; justify-content: flex-end; }
.auth-logo { display: flex; justify-content: center; margin: -4px 0 6px; } .auth-logo .logo { filter: drop-shadow(0 8px 18px rgba(6,15,36,.35)); }
.auth-title { text-align: center; letter-spacing: .14em; color: var(--navy-900); font-weight: 800; }
.auth-sub { text-align: center; color: var(--ink-3); margin-bottom: 14px; }
.auth-sub.err { color: var(--bad-fg); }
.auth-links { text-align: center; margin-top: 12px; }
.auth .form-actions .btn { width: 100%; min-height: 48px; font-size: 1rem; }
.auth-stripe { position: absolute; inset-inline: 0; bottom: 0; height: 6px; background: linear-gradient(90deg, var(--green-500) 0 33%, var(--yellow-400) 33% 66%, var(--blue-600) 66%); }
.install-hint { display: flex; gap: 8px; align-items: center; background: var(--gold-100); color: #5c4300; border-radius: 12px; padding: 10px 12px; margin-top: 12px; font-size: .86rem; }
.profile-head { display: flex; gap: 14px; align-items: center; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: linear-gradient(135deg, var(--navy-800), var(--navy-700)); color: var(--gold-400); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.2rem; flex: none; border: 2px solid var(--gold-500); }
.avatar.big { width: 64px; height: 64px; font-size: 1.6rem; }

/* ───────── ученики ───────── */
.student-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.student-head .grow, .grow { flex: 1; min-width: 200px; }
.health { color: var(--bad-fg); display: flex; gap: 6px; align-items: center; font-weight: 550; }
.contact-list { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 8px; }
.contact-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.att-months { display: flex; flex-direction: column; gap: 10px; }
.att-month-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 4px; }
.att-dots { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; }
.att-dot { min-width: 40px; padding: 3px 6px; border-radius: 8px; text-align: center; font-size: .78rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.att-dot.present { background: var(--ok-bg); color: var(--ok-fg); } .att-dot.absent { background: var(--bad-bg); color: var(--bad-fg); }
.att-dot.unmarked { background: var(--muted-bg); color: var(--muted-fg); } .att-dot.cancelled { background: #fff; color: var(--ink-3); text-decoration: line-through; border: 1px dashed var(--line-2); }
.debt-items { display: flex; flex-wrap: wrap; gap: 4px; }

/* ───────── урок / посещаемость ───────── */
.lesson-head { display: flex; gap: 14px; align-items: center; }
.lesson-time { font-size: 1.6rem; font-weight: 800; color: var(--navy-900); background: var(--gold-100); border: 1px solid #f0d78b; border-radius: 14px; padding: 8px 12px; font-variant-numeric: tabular-nums; }
.att-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; position: sticky; top: calc(var(--appbar-h) + 4px); z-index: 5; background: var(--bg); padding: 6px 0; }
.att-counter { display: flex; gap: 10px; font-weight: 700; }
.c-present { color: var(--ok-fg); } .c-absent { color: var(--bad-fg); } .c-none { color: var(--ink-3); }
.att-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.att-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; box-shadow: var(--shadow-1); }
.att-row.paused { opacity: .65; }
.att-name { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.att-tags { display: flex; flex-wrap: wrap; gap: 4px; } .att-tags .tag { margin: 0; }
.att-seg { flex: none; }
.att-seg .seg-btn { width: 56px; height: 50px; display: flex; align-items: center; justify-content: center; color: var(--ink-3); }
.att-seg .seg-btn.present.active { background: var(--green-500); color: #fff; }
.att-seg .seg-btn.absent.active { background: #d64545; color: #fff; }
.att-actions { display: flex; flex-wrap: wrap; gap: 8px; position: sticky; bottom: calc(var(--tabbar-h) + 8px); background: var(--bg); padding: 8px 0; }
@media (min-width: 1000px) { .att-actions { bottom: 0; } }
.att-paused summary { cursor: pointer; color: var(--ink-3); padding: 6px 0; }
.att-grid .att-col { text-align: center; min-width: 38px; } .att-grid .att-col.cancelled { opacity: .5; }
.att-cell { text-align: center; font-weight: 700; } .att-cell.present { color: var(--ok-fg); background: #f3fbf6; } .att-cell.absent { color: var(--bad-fg); background: #fff6f6; }
.att-cell.unmarked { color: var(--gold-600); background: #fffbeb; } .att-cell.cancelled { color: var(--ink-3); }
@media (max-width: 760px) { .att-grid, .att-grid thead, .att-grid tbody, .att-grid tr { display: revert; } .att-grid thead { display: table-header-group; } .att-grid tr { display: table-row; } .att-grid td { display: table-cell; } .att-grid td::before { content: none; } }
.lesson-cards { display: flex; flex-direction: column; gap: 10px; }
.lesson-card { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; box-shadow: var(--shadow-1); border-inline-start: 5px solid var(--gold-500); }
.lesson-card.held { border-inline-start-color: var(--green-500); } .lesson-card.cancelled { border-inline-start-color: #d64545; opacity: .8; }
.lesson-card-time { display: flex; flex-direction: column; align-items: center; } .lesson-card-time b { font-size: 1.3rem; color: var(--navy-900); }
.lesson-card-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.today-head { display: flex; flex-direction: column; }

/* ───────── календарь ───────── */
.cal-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-list { display: flex; flex-direction: column; gap: 10px; }
.cal-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.cal-group.today { border-color: var(--gold-500); box-shadow: 0 0 0 2px var(--gold-100); }
.cal-lesson { display: block; text-align: start; width: 100%; border: 1px solid var(--line); background: var(--navy-50); border-radius: 10px; padding: 8px 10px; font: 400 .9rem var(--font); color: var(--ink); cursor: pointer; border-inline-start: 4px solid var(--navy-700); }
.cal-lesson:hover { border-color: var(--gold-500); }
.cal-lesson.held { border-inline-start-color: var(--green-500); } .cal-lesson.cancelled { border-inline-start-color: #d64545; text-decoration: line-through; opacity: .7; }
.cal-lesson.replaced { background: #fffaf0; } .cal-lesson.moved { background: #f6f0ff; }
.cal-lesson .mark.warn { color: var(--gold-600); font-weight: 800; }
.cal-holiday { background: var(--gold-100); color: #5c4300; border-radius: 8px; padding: 3px 8px; font-size: .8rem; }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-wd { text-align: center; font-size: .8rem; color: var(--ink-3); font-weight: 600; }
.cal-day { min-height: 96px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 4px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; overflow: hidden; }
.cal-day.empty { background: transparent; border: 0; cursor: default; }
.cal-day.today { border-color: var(--gold-500); background: #fffdf5; }
.cal-date { font-weight: 700; font-size: .8rem; color: var(--ink-3); }
.cal-day .cal-lesson { padding: 2px 4px; font-size: .7rem; border-inline-start-width: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-day .cal-lesson .muted { display: none; }
@media (max-width: 700px) { .cal-day { min-height: 62px; } .cal-day .cal-lesson span:not(.mark) { display: none; } }

/* ───────── контакты (аккордеон по группам) ───────── */
.ct-groups { display: flex; flex-direction: column; gap: 10px; }
.ct-group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); overflow: hidden; }
.ct-group > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 14px; cursor: pointer; background: linear-gradient(180deg, #fff, var(--navy-50)); }
.ct-group > summary::-webkit-details-marker { display: none; }
.ct-group > summary .ico { transition: transform .2s; color: var(--gold-600); }
[dir="rtl"] .ct-group > summary .ico { transform: scaleX(-1); }
.ct-group[open] > summary .ico { transform: rotate(90deg); }
.ct-title { flex: 1; min-width: 0; }
.ct-group-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 14px; border-top: 1px solid var(--line); background: #fcfcfe; }
.ct-list { list-style: none; margin: 0; padding: 0; }
.ct-row { display: grid; grid-template-columns: minmax(140px, 1.1fr) 2fr auto; gap: 8px 16px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); }
.ct-child { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ct-parents { display: flex; flex-direction: column; gap: 4px; }
.ct-parent { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.ct-months { display: flex; gap: 4px; }
.ct-month { display: flex; flex-direction: column; align-items: center; min-width: 42px; padding: 3px 4px; border-radius: 9px; font-size: .72rem; background: var(--muted-bg); color: var(--muted-fg); }
.ct-month b { font-size: .95rem; }
.ct-month.st-paid { background: var(--ok-bg); color: var(--ok-fg); } .ct-month.st-partial { background: var(--part-bg); color: var(--part-fg); }
.ct-month.st-pending { background: var(--pend-bg); color: var(--pend-fg); } .ct-month.st-overdue { background: var(--bad-bg); color: var(--bad-fg); }
@media (max-width: 760px) { .ct-row { grid-template-columns: 1fr; } }

/* ───────── чат ───────── */
.thread-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.thread { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; color: var(--ink); }
.thread:hover { text-decoration: none; border-color: var(--gold-500); }
.thread.unread { border-inline-start: 4px solid var(--gold-500); }
.thread-ico { width: 40px; height: 40px; border-radius: 50%; background: var(--navy-50); color: var(--navy-800); display: flex; align-items: center; justify-content: center; flex: none; }
.thread-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.thread-last { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .86rem; }
.thread-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.chat-page { max-width: 820px; height: calc(100vh - var(--appbar-h) - var(--tabbar-h) - 40px); }
@media (min-width: 1000px) { .chat-page { height: calc(100vh - var(--appbar-h) - 64px); } }
.chat-head { display: flex; align-items: center; gap: 8px; }
.chat-msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 10px; background: linear-gradient(180deg, var(--navy-50), #fff); border: 1px solid var(--line); border-radius: var(--radius); }
.msg { max-width: 82%; align-self: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 7px 10px; box-shadow: var(--shadow-1); }
.msg.mine { align-self: flex-end; background: var(--navy-800); color: #fff; border-color: var(--navy-800); }
.msg.announce { border-inline-start: 4px solid var(--gold-500); }
.msg.pending { opacity: .6; }
.msg-name { font-size: .76rem; font-weight: 700; color: var(--gold-600); }
.msg-body { white-space: pre-wrap; word-wrap: break-word; }
.msg-meta { font-size: .7rem; opacity: .7; display: flex; gap: 6px; justify-content: flex-end; }
.msg-del { border: 0; background: none; color: inherit; cursor: pointer; font-size: .9rem; }
.chat-composer { display: flex; gap: 6px; align-items: flex-end; flex-wrap: wrap; }
.chat-input { flex: 1; min-height: 44px; max-height: 160px; resize: none; }
.chat-ro { text-align: center; }

/* ───────── магазин ───────── */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.product { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-1); display: flex; flex-direction: column; }
.product.inactive { opacity: .55; }
.product-img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--navy-50); display: flex; align-items: center; justify-content: center; color: var(--navy-700); }
.product-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product > .btn { margin: 0 14px 14px; }
.price { font-size: 1.2rem; font-weight: 800; color: var(--navy-900); margin: 0; }
.size-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.size-chip { min-width: 44px; min-height: 36px; padding: 4px 10px; border-radius: 10px; border: 1px solid var(--line-2); background: #fff; font: 600 .85rem var(--font); cursor: pointer; color: var(--ink); }
.size-chip.active { border-color: var(--navy-800); background: var(--navy-800); color: #fff; }
.cart-btn { position: fixed; z-index: 40; bottom: calc(var(--tabbar-h) + 14px); inset-inline-end: 16px; min-height: 52px; border-radius: 26px; box-shadow: var(--shadow-3); }
.cart-row { display: flex; gap: 10px; justify-content: space-between; align-items: center; }
.shop-page { display: flex; flex-direction: column; gap: 12px; }

/* ───────── кабинет родителя ───────── */
.balance-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: linear-gradient(135deg, var(--navy-900), var(--navy-700)); color: #fff; border: 0; }
.balance-card .muted { color: #c9d3e8; }
.balance { font-size: 2rem; font-weight: 800; color: var(--gold-400); font-variant-numeric: tabular-nums; }
.balance-card.ok .balance { color: #8fe0aa; }
.ok-mark { color: #8fe0aa; font-weight: 700; }
.child-card { display: flex; flex-direction: column; gap: 10px; }
.child-head { display: flex; gap: 12px; align-items: center; }
.month-summary { background: var(--navy-50); border-radius: 12px; padding: 10px; }
.ms-head { display: flex; justify-content: space-between; align-items: center; }
.upcoming li.cancelled b { text-decoration: line-through; }
.pay-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pay-list .field-check { justify-content: space-between; } .pay-list .field-check > span { flex: 1; }
.pay-total { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; font-size: 1.1rem; }
.pay-methods { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.pay-method { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.pay-method input { margin-top: 3px; width: 20px; height: 20px; accent-color: var(--navy-800); }
.ok-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px 16px; }
.month-list li.cancelled { color: var(--ink-3); text-decoration: line-through; }
.doc-text { white-space: pre-wrap; max-height: 40vh; overflow: auto; background: var(--navy-50); border-radius: 10px; padding: 10px; font-size: .9rem; margin: 6px 0; }

/* ───────── публичные страницы (анкета, магазин) ───────── */
.public-shell { min-height: 100vh; background: linear-gradient(180deg, var(--navy-900) 0 180px, var(--bg) 180px); }
.public-top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: #fff; max-width: 760px; margin: 0 auto; }
.public-top .lang-btn { margin-inline-start: auto; color: #fff; }
.public-main { max-width: 760px; margin: 0 auto; padding: 8px 14px 40px; display: flex; flex-direction: column; gap: 12px; }
.reg-title { color: #fff; } .public-main > div > .muted { color: #c9d3e8; }
.stepper { list-style: none; display: flex; gap: 6px; padding: 0; margin: 8px 0 12px; counter-reset: s; }
.stepper li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: .75rem; color: #c9d3e8; text-align: center; }
.step-n { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; }
.stepper li.active .step-n { background: var(--gold-500); border-color: var(--gold-500); color: var(--navy-950); }
.stepper li.done .step-n { background: var(--green-500); border-color: var(--green-500); }
.stepper li.active { color: #fff; font-weight: 600; }
.reg-body { display: flex; flex-direction: column; gap: 12px; }
.reg-nav { display: flex; justify-content: space-between; margin-top: 16px; }
.reg-nav .btn { min-width: 120px; min-height: 48px; }
.consent { align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.doc { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.doc summary { cursor: pointer; font-weight: 600; color: var(--navy-800); }

/* ───────── разное ───────── */
.tree { display: flex; flex-direction: column; gap: 12px; }
.tree-city { margin: 8px 0 4px; padding-inline-start: 10px; border-inline-start: 3px solid var(--gold-100); }
.tree-city > h3 { color: var(--ink-3); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.tree-org { margin: 6px 0 10px; } .tree-org-head { display: flex; align-items: center; gap: 6px; }
.tree-groups { list-style: none; margin: 4px 0; padding-inline-start: 14px; display: flex; flex-direction: column; gap: 4px; }
.billing-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.billing-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; margin-top: 10px; }
.report-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.report-tile { text-align: start; cursor: pointer; display: flex; flex-direction: column; gap: 6px; font-family: inherit; }
.report-tile:hover { border-color: var(--gold-500); }
.tile-cta { color: var(--green-600); font-weight: 700; font-size: .85rem; }
.msg-preview { max-width: 420px; white-space: pre-wrap; font-size: .85rem; max-height: 4.5em; overflow: hidden; }
.manual-queue { display: flex; flex-direction: column; gap: 6px; }
.mq-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.mq-row.done { opacity: .5; }
.quick-texts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.voice { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.voice-big { min-height: 64px; font-size: 1.05rem; border-radius: 18px; }
.voice-card { display: flex; flex-direction: column; gap: 6px; }
.connect-list li { padding: 8px 0; border-bottom: 1px solid var(--line); }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85em; }

/* ───────── печать / PDF ───────── */
.print-area { display: none; }
@media print {
  body.printing > *:not(.print-area) { display: none !important; }
  body.printing .print-area { display: block; padding: 0; font-size: 11pt; }
  .print-area h1 { font-size: 16pt; margin-bottom: 8pt; }
  .print-area .table-wrap { border: 0; box-shadow: none; }
  .print-area table { width: 100%; border-collapse: collapse; }
  .print-area th, .print-area td { border: 1px solid #999; padding: 4pt 6pt; display: table-cell !important; }
  .print-area thead { display: table-header-group !important; } .print-area tr { display: table-row !important; } .print-area td::before { content: none !important; }
  .print-area .total td { font-weight: 700; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
