/* MAMAMIO — стили (основа — ApexGroup, цвета — MAMAMIO: тёмно-синий и золото). */
:root {
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --ink: #111827;
  --muted: #5B6474;
  --line: #E3E6EB;
  --line-soft: #EEF0F3;
  --field: #D1D5DB;
  --nav: #14182B;
  --nav-2: #1F2540;
  --nav-text: #CBD5E1;
  --nav-muted: #94A3B8;
  --primary: #1A3A5C;
  --primary-ink: #102D55;
  --primary-soft: #E8EEF6;
  --primary-tint: #F4F7FB;
  --accent: #F5C518;
  --good: #047857;
  --bad: #B91C1C;
  --warn-bg: #FEF3C7; --warn-fg: #92400E;
  --info-bg: #E0E7FF; --info-fg: #3730A3;
  --err-bg: #FEE2E2;
  --radius: 14px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: Manrope, Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; }
body { font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-ink); text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-head); margin: 0; }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 17px; font-weight: 700; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- каркас ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 236px; flex: 0 0 236px; background: var(--nav); color: var(--nav-text); padding: 20px 14px;
  display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, #F5C518, #E0A800); color: var(--nav);
  display: flex; align-items: center; justify-content: center; font-family: var(--font-head); font-weight: 800; font-size: 15px; }
.brand-name { font-family: var(--font-head); font-weight: 800; font-size: 17px; color: #F8FAFC; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--nav-text); font-size: 14px; }
.nav-link:hover { background: var(--nav-2); color: #F8FAFC; text-decoration: none; }
.nav-link.active { background: var(--nav-2); color: #F8FAFC; font-weight: 600; }
.nav-sub { padding: 7px 12px 7px 26px; font-size: 13px; color: var(--nav-muted); }
.nav-sub.active { color: #F8FAFC; background: transparent; }
.nav-foot { margin-top: auto; padding: 14px 12px 0; border-top: 1px solid var(--nav-2); font-size: 12px; color: var(--nav-muted); }
.nav-foot strong { color: #F8FAFC; font-weight: 600; }
.nav-foot button { display: block; margin-top: 10px; background: none; border: 0; color: var(--nav-muted); padding: 6px 0; cursor: pointer; }
.nav-foot button:hover { color: #F8FAFC; }
.main { flex: 1; min-width: 0; padding: 24px 32px 40px; display: flex; flex-direction: column; gap: 20px; }
.topbar { display: none; }
.bottom-nav { display: none; }

/* ---------- элементы ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.subtitle { font-size: 13px; color: var(--muted); margin-top: 4px; }
.row { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.grow { flex: 999 1 560px; min-width: 0; }
.side { flex: 1 1 320px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.hint { font-size: 12px; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 6px; }
.kpi-label { font-size: 13px; color: var(--muted); }
.kpi-value { font-family: var(--font-head); font-size: 26px; font-weight: 800; letter-spacing: -0.01em; }
.kpi-delta { font-size: 12px; font-weight: 600; color: var(--muted); }
.kpi-delta.up { color: var(--good); }
.kpi-delta.down { color: var(--bad); }

.btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 13px;
  padding: 9px 14px; border-radius: 10px; min-height: 40px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--field); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #FFFFFF; }
.btn.primary:hover { background: var(--primary-ink); }
.btn.soft { background: var(--primary-soft); border-color: #99D5CD; color: var(--primary-ink); }
.btn:disabled { opacity: 0.55; cursor: default; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: #374151; font-weight: 500; font-size: 13px; padding: 8px 14px;
  border-radius: 7px; min-height: 36px; cursor: pointer; }
.seg button.on { background: var(--primary); color: #FFFFFF; font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.field input, .field select, .input { border: 1px solid var(--field); border-radius: 8px; padding: 9px 10px; min-height: 40px;
  font-size: 14px; color: var(--ink); background: #FFFFFF; width: 100%; }
.field input:focus, .field select:focus, .input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--field); border-radius: 10px; padding: 0 12px;
  min-height: 42px; color: var(--muted); background: #FFFFFF; }
.search input { border: 0; outline: 0; flex: 1; min-width: 0; font-size: 14px; color: var(--ink); }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 600; padding: 8px; white-space: nowrap; }
table.data td { padding: 11px 8px; border-top: 1px solid var(--line-soft); }
table.data th:first-child, table.data td:first-child { padding-left: 0; }
table.data th:last-child, table.data td:last-child { padding-right: 0; }
table.data .num { text-align: right; white-space: nowrap; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: #F8FAFB; }
table.data tr.selected td { background: var(--primary-tint); }
table.data tfoot td { border-top: 2px solid var(--ink); font-weight: 700; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.unit-name { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; }
.bar { height: 8px; background: var(--line-soft); border-radius: 4px; }
.bar > div { height: 8px; border-radius: 4px; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 26px; padding: 0 8px;
  border-radius: 13px; font-weight: 700; font-size: 13px; }
.badge.warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge.err { background: var(--err-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info-fg); }
.tag { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: var(--line-soft); color: #374151; white-space: nowrap; }
.tag.primary { background: var(--primary-soft); color: var(--primary); }
.tag.warn { background: var(--warn-bg); color: var(--warn-fg); }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-top: 1px solid var(--line-soft); color: var(--ink); }
a.list-row:hover { text-decoration: none; background: #F8FAFB; }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 170px; border-bottom: 1px solid var(--line); margin-top: 16px; }
.chart > div { flex: 1; min-width: 3px; border-radius: 3px 3px 0 0; background: #99D5CD; }
.chart > div.last { background: var(--primary); }
.note { padding: 10px 12px; border-radius: 10px; background: var(--primary-tint); color: var(--primary-ink); font-size: 13px; }
.error { padding: 10px 12px; border-radius: 10px; background: var(--err-bg); color: var(--bad); font-size: 13px; }
.empty { padding: 40px 10px; text-align: center; color: var(--muted); }
.skeleton { background: linear-gradient(90deg, #EEF0F3, #F6F7F9, #EEF0F3); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--nav); color: #F8FAFC; padding: 12px 16px; border-radius: 12px;
  font-size: 14px; z-index: 50; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25); }

/* ---------- телефон: карточки строк, крупные действия, закреплённый итог ---------- */
.only-mobile { display: none; }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.line-card { display: grid; grid-template-columns: 8px 1fr auto; gap: 4px 10px; align-items: center; padding: 10px 0;
  border-top: 1px solid var(--line-soft); }
.line-card .stripe { grid-row: span 2; align-self: stretch; border-radius: 4px; }
.line-card .meta { font-size: 12px; color: var(--muted); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--field); border-radius: 10px; }
.stepper button { width: 38px; height: 40px; border: 0; background: none; font-size: 18px; color: #374151; cursor: pointer; }
.stepper input { width: 56px; border: 0; text-align: center; font-weight: 700; font-size: 15px; min-height: 40px; }
.sticky-foot { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 12px 0 4px; z-index: 5; }

/* ---------- печать (акты, отчёты) ---------- */
@media print {
  .sidebar, .topbar, .bottom-nav, .no-print, .toast { display: none !important; }
  body, .main { background: #FFFFFF; padding: 0; }
  .shell { display: block; }
  .card { border: 0; padding: 0; }
  .row { display: block; }
  .print-area { max-width: none; }
  table.data { font-size: 11pt; }
}

/* ---------- вход ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--nav); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border-radius: 18px; padding: 28px; display: flex; flex-direction: column; gap: 16px; }

/* ---------- телефон ---------- */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--nav); color: #F8FAFC;
    padding: 14px 16px; position: sticky; top: 0; z-index: 20; }
  .topbar .brand { padding: 0; }
  .shell { flex-direction: column; }
  .main { padding: 16px 14px 96px; gap: 14px; }
  h1 { font-size: 22px; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 8px calc(10px + env(safe-area-inset-bottom)); z-index: 20; }
  .bottom-nav a { flex: 1; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; font-size: 11px; color: var(--muted); }
  .bottom-nav a.active { color: var(--primary); font-weight: 600; }
  .bottom-nav a:hover { text-decoration: none; }
  .kpi-value { font-size: 22px; }
  .only-mobile { display: block; }
  .only-desktop { display: none !important; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .quick-actions .btn { min-height: 64px; font-size: 15px; justify-content: center; border-radius: 14px; }
  .card { padding: 14px 14px; }
  .page-head { gap: 10px; }
  .page-head > div:last-child { width: 100%; }
  .page-head .btn { flex: 1 1 auto; justify-content: center; }
  .sticky-foot { position: fixed; left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom)); padding: 10px 14px; box-shadow: 0 -6px 16px rgba(15, 23, 42, 0.08); }
  table.data.compact-mobile { min-width: 0 !important; }
  table.data.compact-mobile .input { width: 100px !important; }
}

/* ---------- списки как в Mamamio: фильтры, итоги, таблица с подгрузкой ---------- */
.crumbs { font-family: var(--font-head); font-size: 24px; font-weight: 800; }
.crumbs span { font-weight: 400; color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.toolbar .right { display: flex; flex-wrap: wrap; gap: 8px; }
.btn.filter-toggle { background: #EEF2FF; border-color: #C7D2FE; color: #3730A3; }
.btn.sm { min-height: 32px; padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.icon { min-height: 32px; width: 34px; padding: 0; justify-content: center; }
.filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 18px; }
.filters .f { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.filters .f .input, .filters .f select, .filters .f input { min-height: 34px; padding: 5px 9px; font-size: 13px; text-transform: none;
  letter-spacing: 0; font-weight: 400; width: auto; min-width: 120px; border: 1px solid var(--field); border-radius: 8px; background: #fff; color: var(--ink); }
.period { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.period .nav { display: inline-flex; align-items: center; border: 1px solid var(--field); border-radius: 8px; min-height: 34px; background: #fff; }
.period .nav button { border: 0; background: none; padding: 0 10px; min-height: 32px; cursor: pointer; color: var(--muted); }
.period .nav span { min-width: 140px; text-align: center; font-size: 13px; color: var(--ink); text-transform: none; letter-spacing: 0; font-weight: 500; }
.kpi.a1 { border-left: 4px solid #2563EB; } .kpi.a2 { border-left: 4px solid #16A34A; }
.kpi.a3 { border-left: 4px solid #F59E0B; } .kpi.a4 { border-left: 4px solid #DB2777; }
.kpi-hint { font-size: 12px; color: var(--muted); }
.dl { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.dl-scroll { overflow: auto; max-height: calc(100vh - 250px); min-height: 360px; }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.grid thead th { position: sticky; top: 0; z-index: 2; background: #1E3A5F; color: #F8FAFC; font-weight: 600; font-size: 12px;
  padding: 9px 10px; text-align: center; white-space: nowrap; border-right: 1px solid #2B4C75; }
table.grid td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.grid tbody tr:nth-child(even) td { background: #F8FAFC; }
table.grid tbody tr:hover td { background: #EEF6F5; }
table.grid tr.clickable { cursor: pointer; }
table.grid .num { text-align: right; white-space: nowrap; }
table.grid .c { text-align: center; }
table.grid .nw { white-space: nowrap; }
table.grid .neg { color: var(--bad); }
table.grid .pos { color: var(--good); }
table.grid .muted { color: var(--muted); }
.dl-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 14px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.thumb { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; display: block; margin: 0 auto; background: var(--line-soft); }
.nophoto { width: 44px; height: 44px; border-radius: 6px; margin: 0 auto; display: flex; align-items: center; justify-content: center;
  font-size: 10px; line-height: 1.1; color: #94A3B8; background: #F1F5F9; text-align: center; }
a.doclink { font-weight: 700; text-decoration: underline dotted; }
.status { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 10px; white-space: nowrap; }
.status.posted { background: #DCFCE7; color: #166534; } .status.draft { background: var(--warn-bg); color: var(--warn-fg); }
.status.sent { background: var(--info-bg); color: var(--info-fg); } .status.cancelled { background: var(--err-bg); color: var(--bad); }

/* ---------- окно (форма поверх списка) ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 60;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 760px; box-shadow: 0 20px 60px rgba(15, 23, 42, .3); }
.modal.wide { max-width: 1000px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 19px; }
.modal-head h2 span { font-weight: 400; color: var(--muted); }
.modal-head .close { border: 0; background: none; font-size: 16px; color: var(--muted); cursor: pointer; padding: 6px 10px; }
.modal-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; gap: 10px; padding: 14px 22px 20px; }
.modal-foot .btn.primary { flex: 1; justify-content: center; min-height: 44px; font-size: 14px; }
.field .req { color: var(--bad); }
.field textarea { border: 1px solid var(--field); border-radius: 8px; padding: 9px 10px; font-size: 14px; color: var(--ink); min-height: 64px; font: inherit; }
.two { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
.price-box { background: #F8FAFC; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.price-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo-box { display: flex; gap: 14px; align-items: center; background: #F8FAFC; border: 1px dashed var(--field); border-radius: 12px; padding: 12px; }
.photo-box img, .photo-box .nophoto { width: 96px; height: 96px; margin: 0; border-radius: 10px; object-fit: cover; }
.radio-row { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--ink); }

/* ---------- меню разделами ---------- */
.nav-group { display: flex; align-items: center; justify-content: space-between; width: 100%; background: none; border: 0; cursor: pointer;
  color: var(--nav-muted); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; padding: 14px 12px 6px; }
.nav-group:hover { color: #F8FAFC; }
.nav-group.open { color: #FCD34D; }
.nav-group .chev { transition: transform .15s; }
.nav-group.open .chev { transform: rotate(90deg); }
.sidebar .nav-sub { padding: 7px 12px 7px 30px; font-size: 13px; color: var(--nav-text); border-radius: 6px; }
.sidebar .nav-sub.active { color: #FCD34D; background: rgba(252, 211, 77, .08); font-weight: 600; }

/* ---------- накладная для печати ---------- */
.print-page { max-width: 900px; margin: 0 auto; padding: 24px; background: #fff; color: #000; font-family: Arial, sans-serif; font-size: 13px; }
.print-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; padding: 12px; background: var(--nav); position: sticky; top: 0; z-index: 5; }
.inv-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid #000; padding-bottom: 8px; }
.inv-title { text-align: center; font-size: 18px; font-weight: 700; margin: 18px 0 4px; }
.inv-stamp { text-align: center; color: #B91C1C; font-weight: 700; letter-spacing: .1em; }
.inv-parties { margin: 14px 0; display: grid; grid-template-columns: 170px 1fr; gap: 4px 10px; }
table.inv { width: 100%; border-collapse: collapse; }
table.inv th, table.inv td { border: 1px solid #000; padding: 4px 6px; }
table.inv th { background: #EEE; font-weight: 700; text-align: center; }
table.inv td.num { text-align: right; white-space: nowrap; }
table.inv tfoot td { font-weight: 700; }
.inv-words { margin-top: 10px; }
.inv-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 48px; }
.inv-sign div { border-top: 1px solid #000; padding-top: 4px; font-size: 12px; }
@media print {
  .print-tools { display: none !important; }
  .print-page { padding: 0; max-width: none; }
  @page { size: A4; margin: 12mm; }
}
@media (max-width: 900px) {
  .dl-scroll { max-height: none; }
  .two { grid-template-columns: 1fr; }
  .modal-back { padding: 0; }
  .modal { border-radius: 0; min-height: 100vh; }
  .filters .f { flex: 1 1 100%; justify-content: space-between; }
  .filters .f .input, .filters .f select, .filters .f input { flex: 1; }
  .crumbs { font-size: 20px; }
}

/* ---------- меню на телефоне ---------- */
.drawer-back { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 70; display: flex; justify-content: flex-end; }
.drawer { width: min(320px, 86vw); height: 100%; overflow-y: auto; background: var(--nav); color: var(--nav-text); padding: 16px 12px;
  display: flex; flex-direction: column; gap: 2px; }
.drawer .nav-sub { padding: 9px 12px 9px 30px; font-size: 14px; color: var(--nav-text); }
.drawer .nav-sub.active { color: #FCD34D; }

/* переключатель языка */
.lang-switch { display: flex; gap: 4px; margin-top: 10px; }
.nav-foot .lang-switch button, .lang-switch button { margin: 0; flex: 1; padding: 5px 6px; border-radius: 8px; border: 1px solid var(--nav-2);
  background: none; color: var(--nav-muted); font-size: 12px; cursor: pointer; }
.nav-foot .lang-switch button.on, .lang-switch button.on { background: var(--nav-2); color: #F8FAFC; }
.lang-switch.light button { border-color: var(--line); color: var(--muted); }
.lang-switch.light button.on { background: var(--primary-tint); color: var(--ink); border-color: var(--primary); }

/* ---------- Экран «Босс» (телефон): направления — бирюзовые, магазины — янтарные ---------- */
.boss { display: flex; flex-direction: column; gap: 12px; max-width: 760px; --accent: var(--primary); --accent-soft: var(--primary-soft); }
.boss.k-shop { --accent: #D97706; --accent-soft: #FEF3C7; }
.seg.kind { position: relative; padding-right: 48px; }
.seg.kind button.on.k-direction { background: var(--primary); color: #fff; }
.seg.kind button.on.k-shop { background: #D97706; color: #fff; }
.seg.kind .refresh { position: absolute; right: 3px; top: 3px; bottom: 3px; flex: none; width: 42px; }
.boss .bk { border-top: 3px solid var(--accent); }
.boss .card { border-top: 3px solid var(--accent-soft); }
.boss .c-rev { fill: var(--accent); } .boss .legend i.c-rev { background: var(--accent); }
.boss .c-line { stroke: var(--accent); }
.boss .seg.tabs button.on { color: var(--accent); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 7px; vertical-align: 0; }
.brand-sub { margin-left: 6px; padding: 2px 8px; border-radius: 8px; background: #F59E0B; color: #111827; font-size: .62em; font-weight: 800; vertical-align: middle; letter-spacing: .02em; }
.boss-head { display: flex; justify-content: space-between; align-items: center; }
.boss-head h1 { margin: 0; font-size: 22px; }
.seg { display: flex; background: var(--line-soft, #EEF1F4); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { flex: 1; white-space: nowrap; border: 0; background: none; padding: 9px 6px; border-radius: 9px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; position: relative; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.seg.tabs button { flex: auto; padding: 9px 4px; font-size: 12.5px; }
.seg.tabs .dot { min-width: 15px; padding: 0 4px; margin-left: 3px; font-size: 10px; line-height: 15px; }
.seg.mini button { padding: 5px 8px; font-size: 12px; }
.seg .dot { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; }
.boss-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .boss-kpis { grid-template-columns: repeat(4, 1fr); } }
.bk { background: #fff; border: 1px solid var(--line, #E5E7EB); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bk span { font-size: 12px; color: var(--muted); }
.bk strong { font-size: 19px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk em { font-style: normal; font-size: 12px; color: var(--muted); }
.bk em.up { color: var(--good); } .bk em.down { color: var(--bad); }
.boss .neg { color: var(--bad); }
.chart { width: 100%; height: auto; display: block; }
.chart text { font-size: 7px; fill: var(--muted); }
.c-rev { fill: var(--primary); } .c-prof { fill: #16A34A; }
.c-line { fill: none; stroke: var(--primary); stroke-width: 1.6; stroke-linejoin: round; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.legend i.c-rev { background: var(--primary); } .legend i.c-prof { background: #16A34A; }
.pl-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line-soft, #EEF1F4); }
.pl-row:first-of-type { border-top: 0; }
.pl-row strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pl-row.b { font-weight: 700; } .pl-row.sub { padding: 4px 0 4px 14px; font-size: 13px; color: var(--muted); border-top: 0; }
.unit-row { padding: 8px 0; border-top: 1px solid var(--line-soft, #EEF1F4); }
.unit-row:first-of-type { border-top: 0; }
.ur-top { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; }
.ur-bar { height: 6px; background: var(--line-soft, #EEF1F4); border-radius: 3px; margin: 5px 0 3px; overflow: hidden; }
.ur-bar i { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.ur-bar i.shop { background: #F59E0B; }
.alert-row { display: flex; justify-content: space-between; gap: 10px; padding: 12px; border-radius: 10px; margin-bottom: 8px; cursor: pointer; }
.alert-row.bad { background: #FEE2E2; color: #7F1D1D; } .alert-row.warn { background: var(--warn-bg); color: var(--warn-fg); }
.alert-row.info { background: var(--primary-soft); color: var(--primary-ink); }

/* ---------- Приложение «Apex Boss» ---------- */
body.boss-app { background: var(--bg); }
.boss-shell { min-height: 100vh; }
.boss-top { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: #0F172A; }
.boss-top .brand { padding: 0; }
.boss-top-btn { min-width: 40px; height: 36px; border-radius: 10px; border: 0; background: #1E293B; color: #E2E8F0; font: inherit; font-weight: 700; cursor: pointer; }
.boss-main { padding: 14px 16px calc(24px + env(safe-area-inset-bottom)); display: flex; justify-content: center; }
.boss-main .boss { width: 100%; }
.alert-items { margin: -4px 0 10px; padding: 4px 12px; border-radius: 10px; background: #fff; border: 1px solid var(--line-soft, #EEF1F4); font-size: 13px; }

/* ---------- Аналитика ---------- */
.an-bar { display: flex; gap: 14px; flex-wrap: wrap; align-items: end; }
.an-bar .seg.kind button.on.k-direction { background: var(--primary); color: #fff; }
.an-bar .seg.kind button.on.k-shop { background: #D97706; color: #fff; }
.an-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
@media (max-width: 600px) { .an-grid { grid-template-columns: 1fr; } }
.an-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(60px, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0;
  border-top: 1px solid var(--line-soft, #EEF1F4); font-size: 13px; }
.an-row:first-of-type { border-top: 0; }
.an-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-row .ur-bar { margin: 0; }
.an-row strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.an-stack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; margin: 2px 0 10px; background: var(--line-soft, #EEF1F4); }
.an-stack i { display: block; height: 100%; }
.c-prof { fill: #16A34A; }

/* QR бота на накладной и плакат магазина */
.inv-tg { display: flex; gap: 12px; align-items: center; margin-top: 12px; padding: 8px 10px; border: 1px dashed #9CA3AF; border-radius: 8px; font-size: 11px; line-height: 1.45; break-inside: avoid; }
.inv-tg svg { display: block; width: 92px; height: 92px; }
.poster { max-width: 560px; margin: 24px auto; background: #fff; border-radius: 18px; padding: 36px 32px; text-align: center; color: #0F172A; font-family: Inter, Arial, sans-serif; }
.poster h1 { font-size: 30px; margin: 0 0 6px; } .poster .qr svg { width: 340px; height: 340px; }
.poster ol { text-align: left; font-size: 17px; line-height: 1.7; margin: 18px auto; max-width: 400px; }
@media print { .poster { margin: 0 auto; box-shadow: none; } }

/* ---------- главная: показатели, динамика, карточки направлений ---------- */
.home-kpis .kpi { border-top: 3px solid var(--k, var(--primary)); }
.home-kpis .kpi-value { color: var(--ink); }
.trend { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin: 8px 0 2px; padding: 8px 12px; border-radius: 10px; font-size: 14px; }
.trend.up { background: #ECFDF5; color: var(--good); }
.trend.down { background: #FEF2F2; color: var(--bad); }
.trend span { color: var(--muted); font-size: 12px; }
.dyn { width: 100%; height: auto; display: block; margin-top: 8px; }
.dyn text { font-size: 11px; fill: var(--muted); }
.dyn .gl { stroke: var(--line-soft); stroke-width: 1; }
.dyn .bar-revenue { fill: #60A5FA; } .dyn .bar-profit { fill: #4ADE80; } .dyn .bar-sales { fill: #A78BFA; }
.dyn .wk { opacity: .55; }
.dyn .dim { opacity: .35; }
.dyn .avg { fill: none; stroke: #F97316; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.lg-avg { display: inline-block; width: 18px; height: 3px; background: #F97316; border-radius: 2px; vertical-align: middle; margin-right: 4px; }
.sec-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 6px 0 -6px; }
.sec-head h2 { font-size: 17px; }
.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.unit-card { text-align: left; font: inherit; color: inherit; cursor: pointer; background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--u); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px;
  transition: box-shadow .15s, transform .15s; }
.unit-card:hover { box-shadow: 0 6px 18px rgba(15, 23, 42, .08); transform: translateY(-1px); }
.uc-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.uc-top b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uc-top .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.uc-delta { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--line-soft); color: var(--muted); white-space: nowrap; }
.uc-delta.up { background: #DCFCE7; color: var(--good); } .uc-delta.down { background: #FEE2E2; color: var(--bad); }
.uc-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.uc-rev { font-family: var(--font-head); font-size: 22px; font-weight: 800; }
.uc-spark { width: 120px; height: 36px; flex: none; }
.uc-spark polyline { fill: none; stroke: var(--u); stroke-width: 2; stroke-linejoin: round; }
.uc-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); }
@media (max-width: 600px) { .unit-grid { grid-template-columns: 1fr; } .dyn text { font-size: 28px; } }
.quiet { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: -6px; }
.chip-q { font: inherit; font-size: 12px; border: 1px dashed var(--field); background: transparent; border-radius: 999px; padding: 4px 10px; cursor: pointer; color: var(--muted); }
.chip-q em { font-style: normal; color: var(--bad); }

/* ---------- MAMAMIO: подгруппы меню и баннер «просмотр от имени» ---------- */
.nav-subgroup { padding: 8px 18px 2px 40px; font-size: 11px; font-weight: 700; color: var(--nav-muted); text-transform: uppercase; letter-spacing: .4px; }
.viewas-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: #B7791F; color: #fff; border-radius: 10px; padding: 9px 14px; margin-bottom: 14px; font-weight: 600; }
.viewas-bar .btn { background: #fff; color: var(--ink); }
