/* ==========================================================================
   SloyHUB UI — единая дизайн-система кабинета селлера и админки оператора.
   Классы старых страниц (.btn, .badge, .link, .muted, .flash, table, dialog,
   td.num) сохранены — экраны получают новый вид без переписывания.
   ========================================================================== */

:root {
  --brand-grad: linear-gradient(100deg, #4338ff 0%, #8b1ff2 55%, #ff1b7d 100%);
  --accent: #4f46e5; --accent-dark: #4338ca; --accent-soft: #eef0ff; --accent-ink: #3730a3;
  --bg: #f4f5f9; --card: #ffffff; --soft: #f8f9fc; --hover: #f2f3f8;
  --line: #eceef4; --line-strong: #dcdfe8;
  --text: #151826; --muted: #687087; --faint: #9aa1b4;
  --ok: #16a34a; --ok-soft: #e8f7ee;
  --warn: #dc2626; --warn-soft: #fdecec;
  --orange: #ea580c; --orange-soft: #fff1e8;
  --info: #0284c7; --info-soft: #e6f4fb;
  --side-bg: #ffffff; --side-text: #3b4256; --side-muted: #8a91a6; --side-active: #eef0ff; --side-active-text: #4338ca;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05);
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
  --shadow-lg: 0 20px 50px -12px rgba(16,24,40,.25);
  --radius: 14px; --radius-sm: 10px;
  --side-w: 252px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --accent: #818cf8; --accent-dark: #6366f1; --accent-soft: #23264a; --accent-ink: #c7d2fe;
  --bg: #0d0f15; --card: #151821; --soft: #1a1e29; --hover: #1d2130;
  --line: #232838; --line-strong: #2f3547;
  --text: #e8eaf2; --muted: #9aa2b8; --faint: #6b7287;
  --ok: #4ade80; --ok-soft: #12291b;
  --warn: #f87171; --warn-soft: #2e1517;
  --orange: #fb923c; --orange-soft: #2d1d10;
  --info: #38bdf8; --info-soft: #0f2533;
  --side-bg: #11141c; --side-text: #c4c9d8; --side-muted: #6f7790; --side-active: #23264a; --side-active-text: #c7d2fe;
  --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 20px 50px -12px rgba(0,0,0,.7);
  color-scheme: dark;
}
/* Админка оператора — тёмный сайдбар, чтобы не путать с кабинетом клиента */
body.is-admin {
  --side-bg: #12131c; --side-text: #c9cbe0; --side-muted: #6e7192; --side-active: #262a4d; --side-active-text: #fff;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 Inter, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-feature-settings: "cv11", "ss01";
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.ms {
  font-family: 'Material Symbols Rounded'; font-weight: normal; font-style: normal;
  font-size: 20px; line-height: 1; letter-spacing: normal; text-transform: none;
  display: inline-block; white-space: nowrap; direction: ltr; vertical-align: middle;
  -webkit-font-smoothing: antialiased; font-variation-settings: 'FILL' 0, 'wght' 450, 'GRAD' 0, 'opsz' 24;
  user-select: none;
}
.ms.fill { font-variation-settings: 'FILL' 1, 'wght' 450, 'GRAD' 0, 'opsz' 24; }

/* ---------------- Каркас ---------------- */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--side-bg);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 12px;
  z-index: 40;
}
body.is-admin .side { border-right-color: #1f2133; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: var(--side-text); }
.brand:hover { text-decoration: none; }
.brand-logo { width: 36px; height: 36px; flex: none; border-radius: 10px; display: block; box-shadow: 0 8px 18px -8px #7c3aed; }
.brand-name { font-weight: 800; font-size: 17px; letter-spacing: -.02em; line-height: 1.1; }
.brand-name b { font-weight: 800; background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-art .brand-name b { background: none; color: #fff; -webkit-text-fill-color: #fff; padding: 1px 7px; margin-left: 2px; border-radius: 7px;
  background-color: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.25); }
.brand-sub { font-size: 12px; color: var(--side-muted); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-group { margin-top: 14px; }
.nav-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--side-muted); padding: 0 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: var(--side-text);
  font-weight: 500; font-size: 14px; margin-bottom: 1px; position: relative;
}
.nav a .ms { font-size: 20px; color: var(--side-muted); }
.nav a:hover { background: var(--hover); text-decoration: none; }
body.is-admin .nav a:hover { background: #1b1d2c; }
.nav a.active { background: var(--side-active); color: var(--side-active-text); font-weight: 600; }
.nav a.active .ms { color: var(--side-active-text); font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; }
.nav .count {
  margin-left: auto; font-size: 11px; font-weight: 700; background: var(--accent); color: #fff;
  border-radius: 999px; padding: 1px 7px; min-width: 20px; text-align: center;
}
.nav .count.danger { background: var(--warn); }
.side-foot { margin-top: auto; padding-top: 16px; }
.side-card {
  border-radius: 12px; padding: 12px; background: linear-gradient(135deg, var(--accent-soft), transparent);
  border: 1px solid var(--line); font-size: 12px; color: var(--muted);
}
body.is-admin .side-card { background: #1a1c2b; border-color: #26293d; color: #9a9db8; }
.side-card b { color: var(--text); display: block; font-size: 13px; margin-bottom: 2px; }
body.is-admin .side-card b { color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 60px; display: flex; align-items: center; gap: 12px;
  padding: 0 28px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; min-width: 0; }
.crumbs b { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; border: 1px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer; position: relative;
}
.icon-btn:hover { background: var(--card); border-color: var(--line); color: var(--text); text-decoration: none; }
.icon-btn .dot {
  position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--warn); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center;
  border: 2px solid var(--bg);
}
.menu-btn { display: none; }
.user-chip {
  display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 13px; font-weight: 500;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px;
  background: linear-gradient(135deg, #6366f1, #a855f7); flex: none;
}
.avatar.lg { width: 44px; height: 44px; font-size: 16px; }
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 260px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 60;
}
.dropdown.open .dropdown-menu { display: block; animation: pop .14s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.dropdown-menu a, .dropdown-menu button {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--text);
  background: none; border: 0; font: inherit; cursor: pointer; text-align: left;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--hover); text-decoration: none; }
.dropdown-menu .ms { color: var(--muted); }
.dropdown-head { padding: 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.dropdown-head .muted { font-size: 12px; }
.notif-menu { width: 380px; max-width: calc(100vw - 24px); padding: 0; }
.notif-menu .dropdown-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; margin: 0; }
.notif-list { max-height: 420px; overflow-y: auto; padding: 6px; }

.wrap { width: 100%; max-width: 1280px; margin: 0 auto; padding: 26px 28px 60px; }

.imp-bar {
  background: linear-gradient(90deg, #ea580c, #f59e0b); color: #fff; padding: 8px 28px; font-size: 13px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.imp-bar .link { color: #fff; font-weight: 600; text-decoration: underline; }

/* ---------------- Типографика ---------------- */
h1 {
  font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 20px; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
h1 > span { display: flex; gap: 8px; flex-wrap: wrap; }
h2 { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.muted { color: var(--faint); }
.text-muted { color: var(--muted); }
.small { font-size: 12px; }
.mono, .num { font-variant-numeric: tabular-nums; }
.pos { color: var(--ok); } .neg { color: var(--warn); }

/* ---------------- Кнопки ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; min-height: 38px;
  background: var(--accent); color: #fff; border: 1px solid transparent; border-radius: 10px; font-weight: 600; font-size: 14px; line-height: 1;
  font-family: inherit; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, box-shadow .15s, transform .05s;
  box-shadow: 0 1px 2px rgba(79,70,229,.25), inset 0 1px 0 rgba(255,255,255,.12);
}
.btn:hover { background: var(--accent-dark); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn .ms { font-size: 18px; }
.btn.ghost, .btn.outline {
  background: var(--card); color: var(--text); border-color: var(--line-strong); box-shadow: var(--shadow-sm);
}
.btn.ghost:hover, .btn.outline:hover { background: var(--hover); }
.btn.danger { background: var(--warn); box-shadow: none; }
.btn.danger:hover { filter: brightness(.92); }
.btn.success { background: var(--ok); box-shadow: none; }
.btn.sm { min-height: 32px; padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.icon-only { padding: 0; width: 36px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
:root[data-theme="dark"] .btn:not(.ghost):not(.outline) { color: #0d0f15; }
.link {
  background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; font-size: 13px; font-weight: 500; padding: 0;
}
.link:hover { text-decoration: underline; }

/* ---------------- Бейджи ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--soft); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; line-height: 1.35;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.badge.plain::before { display: none; }
.badge.off, .badge.danger { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--orange-soft); color: var(--orange); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.mp { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12px; padding: 3px 8px; border-radius: 7px; }
.mp-wb { background: #f3e8ff; color: #7e22ce; }
.mp-ozon { background: #e0f2fe; color: #0369a1; }
.mp-manual { background: var(--soft); color: var(--muted); }
:root[data-theme="dark"] .mp-wb { background: #2b1840; color: #d8b4fe; }
:root[data-theme="dark"] .mp-ozon { background: #0c2a3d; color: #7dd3fc; }

/* ---------------- Таблицы ---------------- */
.table-wrap {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow-x: auto; margin-bottom: 8px;
}
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); }
.table-wrap > table { border: 0; }
table:not(.table-wrap > table) { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
th {
  background: var(--soft); color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap;
}
tr:last-child td { border-bottom: none; }
tbody tr, table tr { transition: background .1s; }
table tr:hover td { background: color-mix(in srgb, var(--hover) 60%, transparent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td a { font-weight: 500; }
.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--faint); }
table input, table select { padding: 6px 9px !important; min-height: 34px; }

/* ---------------- Карточки / сетки ---------------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card-head h2 .ms { color: var(--muted); }
.card-body { padding: 16px 20px; }
.card > table, .card > .table-wrap { border: 0; box-shadow: none; border-radius: 0 0 var(--radius) var(--radius); margin: 0; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 16px; }
.mt { margin-top: 24px; } .mb { margin-bottom: 24px; }

.kpi { padding: 18px 20px; position: relative; overflow: hidden; display: block; color: var(--text); }
a.kpi:hover { text-decoration: none; border-color: var(--line-strong); transform: translateY(-1px); }
a.kpi { transition: transform .15s, border-color .15s; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.kpi-icon.ok { background: var(--ok-soft); color: var(--ok); }
.kpi-icon.warn { background: var(--orange-soft); color: var(--orange); }
.kpi-icon.danger { background: var(--warn-soft); color: var(--warn); }
.kpi-icon.info { background: var(--info-soft); color: var(--info); }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 10px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi-foot { margin-top: 6px; font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.delta { font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }
.delta.up { color: var(--ok); } .delta.down { color: var(--warn); }
.kpi.hero {
  background: linear-gradient(135deg, #4f46e5, #7c3aed 55%, #db2777); color: #fff; border: 0;
  box-shadow: 0 18px 40px -18px rgba(99,102,241,.8);
}
.kpi.hero .kpi-label, .kpi.hero .kpi-foot { color: rgba(255,255,255,.82); }
.kpi.hero .kpi-icon { background: rgba(255,255,255,.18); color: #fff; }
.kpi.hero .delta { color: #fff; }

/* Полоса прогресса / уровень остатка */
.bar { height: 6px; background: var(--soft); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); min-width: 80px; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--ok); }
.bar > i.warn { background: var(--orange); } .bar > i.danger { background: var(--warn); }

/* Список-лента */
.list-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; color: var(--text); }
a.list-item:hover { background: var(--hover); text-decoration: none; }
.list-item + .list-item { margin-top: 2px; }
.li-icon { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; }
.li-icon.danger { background: var(--warn-soft); color: var(--warn); }
.li-icon.warn { background: var(--orange-soft); color: var(--orange); }
.li-icon.info { background: var(--info-soft); color: var(--info); }
.li-icon.ok { background: var(--ok-soft); color: var(--ok); }
.li-icon.accent { background: var(--accent-soft); color: var(--accent); }
.li-title { font-weight: 600; font-size: 14px; }
.li-text { color: var(--muted); font-size: 13px; }
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty .ms { font-size: 40px; color: var(--faint); display: block; margin: 0 auto 8px; }

/* Чарт */
.chart { width: 100%; height: 240px; display: block; }
.chart .gridline { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--faint); font-size: 11px; }
.chart .bar-rev { fill: var(--accent); }
.chart .bar-rev:hover { fill: var(--accent-dark); }
.chart .line-orders { stroke: #f59e0b; stroke-width: 2.5; fill: none; }
.chart .dot-orders { fill: var(--card); stroke: #f59e0b; stroke-width: 2; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-tip {
  position: fixed; pointer-events: none; background: #111827; color: #fff; font-size: 12px; padding: 7px 10px; border-radius: 8px;
  box-shadow: var(--shadow-lg); z-index: 100; display: none; white-space: nowrap;
}

/* Табы / сегменты */
.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--card); border: 1px solid var(--line); border-radius: 11px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 7px 13px; border-radius: 8px; color: var(--muted); font-weight: 500; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.tabs a:hover { color: var(--text); text-decoration: none; background: var(--hover); }
.tabs a.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.tabs .n { font-size: 11px; background: var(--soft); border-radius: 99px; padding: 0 6px; color: var(--muted); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.search {
  display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 0 12px; min-height: 38px; min-width: 240px;
}
.search input { border: 0 !important; padding: 8px 0 !important; background: transparent !important; box-shadow: none !important; outline: none; min-width: 0; flex: 1; }
.search .ms { color: var(--faint); font-size: 19px; }

/* ---------------- Формы ---------------- */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line-strong); border-radius: 9px;
  padding: 9px 11px; font-size: 14px; transition: border-color .15s, box-shadow .15s; max-width: 100%;
}
input[type=checkbox], input[type=radio] { accent-color: var(--accent); padding: 0; width: 16px; height: 16px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
label { color: var(--muted); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; }
.field .hint { font-size: 12px; color: var(--faint); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------------- Модалки ---------------- */
dialog {
  border: 1px solid var(--line); border-radius: 18px; padding: 0; width: 440px; max-width: calc(100vw - 24px);
  box-shadow: var(--shadow-lg); background: var(--card); color: var(--text);
}
dialog[open] { animation: dlg .18s ease-out; }
@keyframes dlg { from { opacity: 0; transform: translateY(8px) scale(.98); } }
dialog::backdrop { background: rgba(15,18,30,.45); backdrop-filter: blur(3px); }
dialog form { padding: 24px; }
dialog h3 { margin: 0 0 16px; font-size: 18px; letter-spacing: -.01em; }
dialog label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin: 12px 0 6px; }
dialog input:not([type=checkbox]):not([type=radio]), dialog select, dialog textarea { width: 100%; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }

/* ---------------- Flash / toast ---------------- */
.flash {
  display: flex; align-items: center; gap: 10px; background: var(--ok-soft); color: var(--ok); border-radius: 12px;
  padding: 12px 16px; font-size: 14px; font-weight: 500; margin-bottom: 18px; border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent);
}
.flash::before { content: "check_circle"; font-family: 'Material Symbols Rounded'; font-size: 20px; }
.flash.err { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.flash.err::before { content: "error"; }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--info-soft); color: var(--text); font-size: 13px; border: 1px solid color-mix(in srgb, var(--info) 20%, transparent); }
.callout .ms { color: var(--info); }
.callout.warn { background: var(--orange-soft); border-color: color-mix(in srgb, var(--orange) 25%, transparent); }
.callout.warn .ms { color: var(--orange); }

/* ---------------- Логин ---------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art {
  position: relative; overflow: hidden; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(1100px 650px at -10% -10%, #4338ff 0, transparent 60%), radial-gradient(900px 650px at 110% 110%, #ff1b7d 0, transparent 55%), #6d1fe0;
}
.auth-art h2 { font-size: 38px; line-height: 1.1; letter-spacing: -.03em; margin: 0 0 14px; max-width: 480px; }
.auth-art p { opacity: .85; max-width: 440px; font-size: 15px; }
.auth-feats { display: grid; gap: 12px; margin-top: 28px; }
.auth-feats div { display: flex; gap: 12px; align-items: center; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15); padding: 12px 14px; border-radius: 14px; backdrop-filter: blur(6px); max-width: 420px; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; background: var(--card); }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h1 { display: block; font-size: 28px; margin-bottom: 6px; }
.auth-box .btn { width: 100%; min-height: 46px; font-size: 15px; margin-top: 8px; }

/* ---------------- Адаптив ---------------- */
@media (max-width: 1100px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  body.nav-open .side { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
  .menu-btn { display: grid; }
  .topbar { padding: 0 16px; }
  .wrap { padding: 18px 16px 48px; }
  .imp-bar { padding: 8px 16px; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .user-chip .uname { display: none; }
}
@media (max-width: 560px) {
  .g-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 20px; }
  h1 { font-size: 20px; }
  .form-row { grid-template-columns: 1fr; }
  .search { min-width: 0; flex: 1; }
}
@media print {
  .side, .topbar, .imp-bar, .no-print { display: none !important; }
  .app { display: block; } .wrap { padding: 0; max-width: none; }
  body { background: #fff; }
}
@media (max-width: 560px) { .hide-sm { display: none; } }
.table-wrap.flat { border: 0; box-shadow: none; border-radius: 0 0 var(--radius) var(--radius); margin: 0; }
.side { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.side:hover { scrollbar-color: var(--line-strong) transparent; }

/* Выбор типа бизнеса */
.biz-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.biz-opt { margin: 0 !important; cursor: pointer; position: relative; min-width: 0; }
.biz-opt input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.biz-card {
  display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 12px; border-radius: 12px;
  border: 1.5px solid var(--line-strong); background: var(--card); color: var(--text); transition: border-color .15s, background .15s;
}
.biz-card .ms { color: var(--accent); font-size: 22px; }
.biz-card b { font-size: 13px; }
.biz-card small { font-size: 11.5px; color: var(--muted); line-height: 1.35; font-weight: 400; }
.biz-opt input:checked + .biz-card { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.biz-opt input:disabled + .biz-card { opacity: .6; cursor: default; }
.biz-opt input:focus-visible + .biz-card { outline: 2px solid var(--accent); }
@media (max-width: 560px) { .biz-pick { grid-template-columns: 1fr; } }

[hidden] { display: none !important; }

/* ---- Загрузка файлов ---- */
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  padding: 34px 16px; border: 2px dashed var(--line-strong); border-radius: var(--radius); background: var(--soft); cursor: pointer; transition: .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
#preview th.col-used, #preview td.col-used { background: var(--accent-soft); }

.auth-form .btn:not(.ghost) { background: var(--brand-grad); border-color: transparent; box-shadow: 0 10px 24px -12px #8b1ff2; }
.auth-form .btn:not(.ghost):hover { filter: brightness(1.06); }

/* ---- Вход / регистрация ---- */
.auth-alt { margin-top: 18px; font-size: 14px; text-align: center; color: var(--muted); }
.auth-alt a { color: var(--accent); font-weight: 600; }
.auth-box .check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); margin: 6px 0; cursor: pointer; }
.auth-box .check input { margin-top: 2px; }
.biz-pick-sm { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.auth-box { min-width: 0; }
.auth-form > .auth-box { max-width: min(380px, 100%); }
.biz-pick-sm .biz-card { padding: 10px 8px !important; text-align: center; align-items: center; }
.biz-pick-sm .biz-card b { font-size: 12px; overflow-wrap: anywhere; }
.biz-pick-sm .biz-card .ms { font-size: 20px; }
.auth-admin .auth-art { background: radial-gradient(900px 600px at -10% -10%, #4338ff 0, transparent 60%), radial-gradient(800px 600px at 110% 110%, #ff1b7d 0, transparent 55%), #12122a; }
.totp-code { font-size: 26px !important; letter-spacing: .4em; text-align: center; font-family: ui-monospace, monospace; }

/* ---- Экономика: разложение прибыли ---- */
.pnl-row { display: grid; grid-template-columns: minmax(180px, 280px) 1fr minmax(110px, auto); gap: 14px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pnl-row:last-child { border-bottom: 0; }
.pnl-label { display: flex; gap: 10px; align-items: center; font-weight: 500; }
.pnl-label .ms { color: var(--muted); }
.pnl-label small { display: block; font-size: 11px; color: var(--faint); font-weight: 400; }
.pnl-bar { height: 10px; background: var(--soft); border-radius: 6px; overflow: hidden; }
.pnl-bar i { display: block; height: 100%; border-radius: 6px; }
.pnl-bar i.pos { background: var(--brand-grad); }
.pnl-bar i.neg { background: color-mix(in srgb, var(--warn) 55%, transparent); }
.pnl-val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.pnl-val.neg { color: var(--muted); font-weight: 600; }
.pnl-row.total { border-top: 2px solid var(--line-strong); margin-top: 4px; padding-top: 12px; font-size: 16px; }
@media (max-width: 640px) { .pnl-row { grid-template-columns: 1fr auto; } .pnl-bar { display: none; } }
