/* ==========================================================================
   СкладПро — интерфейс
   ========================================================================== */
:root {
  --bg: #f3f6fa;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --ink: #0b1220;
  --text: #0f172a;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e6edf5;
  --line-2: #eef2f7;
  --accent: #0d9488;
  --accent-2: #14b8a6;
  --accent-soft: #ecfdf9;
  --blue: #2563eb;
  --violet: #7c3aed;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --green: #059669;
  --green-soft: #ecfdf5;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, .08);
  --shadow-lg: 0 30px 80px rgba(2, 8, 23, .25);
  --radius: 16px;
  --sidebar: 256px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.45;
}
body.modal-open { overflow: hidden; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.02em; }
p { margin: 0; }
svg { flex: none; }
::selection { background: #99f6e4; color: #042f2e; }

/* Скроллбары */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

.boot-screen {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 18px; background: #0b1220; color: #cbd5e1;
}
.boot-logo {
  width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center;
  font-weight: 800; font-size: 26px; color: #04212a;
  background: linear-gradient(135deg, #2dd4bf, #0ea5e9);
  box-shadow: 0 12px 40px rgba(45, 212, 191, .35);
  animation: pulse 1.6s ease-in-out infinite;
}
.boot-text { font-size: 13px; color: #94a3b8; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.noscript { padding: 30px; text-align: center; }

/* ================= Вход ================= */
.login {
  min-height: 100vh; display: grid; grid-template-columns: 1.08fr .92fr; background: #07101f;
}
.login-brand {
  position: relative; overflow: hidden; padding: 56px 64px; color: #e2e8f0;
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(900px 500px at 12% 0%, rgba(20, 184, 166, .22), transparent 60%),
    radial-gradient(700px 500px at 90% 100%, rgba(99, 102, 241, .18), transparent 60%),
    #07101f;
}
.login-brand::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(148, 163, 184, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, .06) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 40% 40%, black, transparent 78%);
}
.login-brand > * { position: relative; z-index: 1; }
.login-logo { display: flex; align-items: center; gap: 13px; }
.login-logo .mark {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2dd4bf, #0ea5e9); color: #04212a;
  font-weight: 800; font-size: 22px; box-shadow: 0 10px 30px rgba(45, 212, 191, .3);
}
.login-logo .name { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.login-logo .name span { color: #5eead4; }
.login-hero { max-width: 560px; padding: 48px 0; }
.login-kicker {
  display: inline-flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: #5eead4; background: rgba(45, 212, 191, .1);
  border: 1px solid rgba(45, 212, 191, .2); padding: 6px 11px; border-radius: 999px;
}
.login-hero h1 {
  font-size: clamp(34px, 4.2vw, 54px); line-height: 1.04; margin: 22px 0 18px;
  color: #f8fafc; font-weight: 750;
}
.login-hero h1 em { font-style: normal; color: #2dd4bf; }
.login-hero p { color: #94a3b8; font-size: 16px; line-height: 1.6; max-width: 480px; }
.login-features { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 26px; margin-top: 36px; }
.login-feature { display: flex; gap: 11px; align-items: flex-start; color: #cbd5e1; font-size: 13px; line-height: 1.4; }
.login-feature svg { color: #2dd4bf; margin-top: 2px; }
.login-foot { color: #64748b; font-size: 12px; display: flex; gap: 18px; flex-wrap: wrap; }
.login-side {
  background: #f7fafc; display: flex; align-items: center; justify-content: center; padding: 42px;
}
.login-card { width: min(400px, 100%); }
.login-card h2 { font-size: 26px; margin-bottom: 7px; }
.login-card .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 28px; }
.login-error {
  display: none; background: var(--red-soft); color: #b91c1c; border: 1px solid #fecaca;
  border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px;
}
.login-error.show { display: block; }
.demo-box { margin-top: 26px; border-top: 1px dashed #dbe4ee; padding-top: 18px; }
.demo-title { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 10px; }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.demo-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 11px;
  text-align: left; transition: .15s; color: var(--text);
}
.demo-btn:hover { border-color: #99f6e4; background: var(--accent-soft); }
.demo-btn b { display: block; font-size: 12.5px; font-weight: 650; }
.demo-btn span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ================= Каркас ================= */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40;
  background: #0b1220; color: #cbd5e1; padding: 18px 14px 14px;
  display: flex; flex-direction: column; overflow-y: auto;
  border-right: 1px solid rgba(148, 163, 184, .08);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 20px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2dd4bf, #0ea5e9); color: #04212a;
  font-weight: 800; font-size: 20px; box-shadow: 0 6px 20px rgba(45, 212, 191, .25);
}
.brand-name { color: #f1f5f9; font-weight: 700; font-size: 16px; letter-spacing: -.02em; line-height: 1.15; }
.brand-name span { color: #5eead4; }
.brand-sub { font-size: 10px; color: #64748b; letter-spacing: .08em; text-transform: uppercase; margin-top: 2px; }
.company-chip {
  display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.04);
  border: 1px solid rgba(148, 163, 184, .1); border-radius: 10px; padding: 8px 10px;
  margin: 0 4px 14px; font-size: 11.5px; color: #94a3b8;
}
.company-chip svg { color: #5eead4; }
.company-chip b { color: #e2e8f0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-label {
  font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: #526077;
  padding: 16px 12px 7px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: #94a3b8; font-size: 13.5px; cursor: pointer; transition: .14s; margin-bottom: 2px;
  border: 1px solid transparent; user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.045); color: #e2e8f0; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(20, 184, 166, .17), rgba(20, 184, 166, .03));
  color: #5eead4; border-color: rgba(45, 212, 191, .18);
}
.nav-item .nav-badge {
  margin-left: auto; background: rgba(45, 212, 191, .15); color: #5eead4;
  font-size: 10px; border-radius: 999px; padding: 2px 7px; font-weight: 700;
}
.nav-item svg { width: 18px; height: 18px; opacity: .95; }
.sidebar-spacer { flex: 1; min-height: 24px; }
.side-help {
  margin: 10px 4px; padding: 13px; border-radius: 12px;
  background: linear-gradient(160deg, rgba(20,184,166,.13), rgba(14,165,233,.05));
  border: 1px solid rgba(45, 212, 191, .14);
}
.side-help .t { color: #e2e8f0; font-size: 12px; font-weight: 650; margin-bottom: 3px; }
.side-help .d { color: #7c8ca3; font-size: 10.5px; line-height: 1.45; }
.side-user {
  display: flex; align-items: center; gap: 10px; padding: 10px 8px 4px; margin-top: 6px;
  border-top: 1px solid rgba(148, 163, 184, .1); cursor: pointer;
}
.side-user:hover .side-user-name { color: #fff; }
.avatar {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #334155, #1e293b); color: #e2e8f0;
  font-weight: 700; font-size: 12px; border: 1px solid rgba(255,255,255,.08);
}
.side-user-name { color: #e2e8f0; font-size: 12px; font-weight: 600; line-height: 1.25; }
.side-user-role { color: #64748b; font-size: 10px; margin-top: 1px; }
.side-user .logout { margin-left: auto; color: #64748b; }
.side-user .logout:hover { color: #f87171; }

.main { margin-left: var(--sidebar); min-width: 0; }
.topbar {
  height: 72px; position: sticky; top: 0; z-index: 30; display: flex; align-items: center;
  justify-content: space-between; gap: 18px; padding: 0 30px;
  background: rgba(255,255,255,.82); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.menu-btn { display: none; }
.page-title { font-size: 18px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.page-crumb { font-size: 10.5px; color: var(--muted-2); letter-spacing: .06em; text-transform: uppercase; margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 9px; }
.rate-chip {
  display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line);
  padding: 7px 10px; border-radius: 9px; font-size: 11.5px; color: var(--muted);
}
.rate-chip b { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.rate-chip .flag { color: var(--accent); font-weight: 700; }
.top-date { font-size: 11.5px; color: var(--muted); padding: 0 8px; white-space: nowrap; }
.user-chip {
  display: flex; align-items: center; gap: 9px; padding: 5px 8px 5px 5px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer;
}
.user-chip:hover { border-color: #cbd5e1; }
.user-chip .avatar { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #0f766e, #0e7490); }
.user-chip .u { font-size: 11.5px; font-weight: 600; line-height: 1.2; text-align: left; }
.user-chip .r { font-size: 9.5px; color: var(--muted); text-align: left; }
.view { max-width: 1560px; margin: 0 auto; padding: 26px 30px 70px; }
.view.is-wide { max-width: none; }

/* ================= Заголовок страницы ================= */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 27px; font-weight: 750; letter-spacing: -.035em; line-height: 1.15; }
.page-head .lead { color: var(--muted); font-size: 13px; margin-top: 6px; max-width: 720px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.section-title { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.section-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }

/* ================= Кнопки ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 10px; padding: 9px 13px; font-size: 12.5px; font-weight: 600;
  transition: .15s; white-space: nowrap; line-height: 1.2; min-height: 36px;
  text-decoration: none;
}
.btn:hover { border-color: #cbd5e1; background: #f8fafc; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }
.btn-primary {
  background: linear-gradient(180deg, #0f9f92, #0d8a7f); color: #fff; border-color: #0d8a7f;
  box-shadow: 0 4px 12px rgba(13, 148, 136, .22);
}
.btn-primary:hover { background: linear-gradient(180deg, #0d9488, #0b7c73); border-color: #0b7c73; color: #fff; }
.btn-dark { background: #0f172a; color: #fff; border-color: #0f172a; }
.btn-dark:hover { background: #1e293b; color: #fff; }
.btn-danger { color: #b91c1c; border-color: #fecaca; background: #fff; }
.btn-danger:hover { background: #fef2f2; border-color: #fca5a5; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f1f5f9; color: var(--text); }
.btn-sm { min-height: 30px; padding: 6px 10px; font-size: 11.5px; border-radius: 8px; }
.btn-xs { min-height: 26px; padding: 4px 8px; font-size: 10.5px; border-radius: 7px; }
.btn-icon { padding: 8px; min-width: 34px; min-height: 34px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-link { background: none; border: none; color: var(--accent); font-size: 12px; font-weight: 600; padding: 0; }
.btn-link:hover { text-decoration: underline; }

/* ================= Карточки / сетки ================= */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 17px 20px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.card-body { padding: 20px; }
.card-body.tight { padding: 0; }
.card-foot { padding: 13px 20px; border-top: 1px solid var(--line-2); background: #fcfeff; border-radius: 0 0 var(--radius) var(--radius); }
.card.flush { overflow: hidden; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-2-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: grid; gap: 18px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.tiny { font-size: 10.5px; }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.w-100 { width: 100%; }
.num { font-variant-numeric: tabular-nums; }
.hint { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.divider { height: 1px; background: var(--line-2); margin: 16px 0; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.kpi {
  position: relative; overflow: hidden; padding: 17px 18px 15px; border-radius: 15px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.kpi::after { content: ""; position: absolute; width: 120px; height: 120px; right: -55px; top: -65px; border-radius: 50%; background: rgba(20,184,166,.06); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.kpi-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: #0f766e; }
.kpi-icon.blue { background: #eff6ff; color: #1d4ed8; }
.kpi-icon.violet { background: #f5f3ff; color: #6d28d9; }
.kpi-icon.amber { background: #fffbeb; color: #b45309; }
.kpi-icon.red { background: #fef2f2; color: #b91c1c; }
.kpi-value { font-size: 25px; font-weight: 750; letter-spacing: -.035em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-value.sm { font-size: 21px; }
.kpi-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 10.5px; color: var(--muted); flex-wrap: wrap; }
.delta { display: inline-flex; align-items: center; gap: 3px; border-radius: 999px; padding: 2px 7px; font-size: 10px; font-weight: 700; }
.delta.up { background: var(--green-soft); color: #047857; }
.delta.down { background: var(--red-soft); color: #b91c1c; }
.delta.flat { background: #f1f5f9; color: #64748b; }

/* ================= Таблицы ================= */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th {
  text-align: left; padding: 10px 14px; background: #f8fafc; color: var(--muted);
  font-size: 9.5px; letter-spacing: .09em; text-transform: uppercase; font-weight: 700;
  border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
table.data td { padding: 11px 14px; border-bottom: 1px solid #f2f6fa; vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: #f9fcfe; }
table.data tr.clickable { cursor: pointer; }
table.data td.right, table.data th.right { text-align: right; }
table.data td.center, table.data th.center { text-align: center; }
table.data .strong { font-weight: 650; color: var(--text); }
table.data .sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
table.data tfoot td { background: #fbfdff; font-weight: 650; border-top: 1px solid var(--line); }
.table-empty { padding: 46px 20px; text-align: center; color: var(--muted); font-size: 12.5px; }
.table-empty .big { font-size: 30px; margin-bottom: 8px; opacity: .5; }

.product-cell { display: flex; align-items: center; gap: 11px; min-width: 210px; }
.thumb {
  width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center;
  font-size: 11px; font-weight: 800; color: #0f5f5a; flex: none; overflow: hidden;
  background: linear-gradient(135deg, #ccfbf1, #e0f2fe); border: 1px solid rgba(15, 118, 110, .08);
}
.thumb.lg { width: 64px; height: 64px; border-radius: 14px; font-size: 18px; }
.thumb.sm { width: 30px; height: 30px; border-radius: 8px; font-size: 9.5px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.t1 { background: linear-gradient(135deg, #ccfbf1, #d1fae5); color: #115e59; }
.thumb.t2 { background: linear-gradient(135deg, #dbeafe, #e0e7ff); color: #1e40af; }
.thumb.t3 { background: linear-gradient(135deg, #fef3c7, #ffedd5); color: #92400e; }
.thumb.t4 { background: linear-gradient(135deg, #f3e8ff, #fae8ff); color: #6b21a8; }
.thumb.t5 { background: linear-gradient(135deg, #ffe4e6, #fef3c7); color: #9f1239; }
.thumb.t6 { background: linear-gradient(135deg, #e0f2fe, #ccfbf1); color: #075985; }
.product-name { font-weight: 600; color: var(--text); line-height: 1.25; max-width: 340px; }
.product-name:hover { color: var(--accent); }
.product-sku { font-size: 10px; color: var(--muted); margin-top: 2px; letter-spacing: .02em; }

/* ================= Бейджи ================= */
.badge {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 999px;
  padding: 3px 8px; font-size: 10px; font-weight: 700; letter-spacing: .01em;
  white-space: nowrap; border: 1px solid transparent; line-height: 1.3;
}
.badge.green { background: var(--green-soft); color: #047857; border-color: #d1fae5; }
.badge.red { background: var(--red-soft); color: #b91c1c; border-color: #fee2e2; }
.badge.amber { background: var(--amber-soft); color: #b45309; border-color: #fef3c7; }
.badge.blue { background: #eff6ff; color: #1d4ed8; border-color: #dbeafe; }
.badge.violet { background: #f5f3ff; color: #6d28d9; border-color: #ede9fe; }
.badge.gray { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.badge.teal { background: var(--accent-soft); color: #0f766e; border-color: #ccfbf1; }
.badge.dot::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.outline { background: #fff; border-color: var(--line); color: var(--muted); }

.pill { display: inline-flex; align-items: center; gap: 5px; background: #f8fafc; border: 1px solid var(--line); border-radius: 7px; padding: 3px 7px; font-size: 10px; color: var(--muted); }
.score { display: flex; align-items: center; gap: 7px; min-width: 94px; }
.score-bar { height: 5px; border-radius: 5px; background: #eef2f7; flex: 1; overflow: hidden; }
.score-bar span { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, #f59e0b, #14b8a6); }
.score b { font-size: 10px; color: var(--muted); font-weight: 700; min-width: 28px; text-align: right; }

/* ================= Формы ================= */
.field { min-width: 0; }
.field > label, .label { display: block; font-size: 11px; font-weight: 650; color: #475569; margin-bottom: 5px; }
.input, .select, .textarea {
  width: 100%; border: 1px solid #dbe4ee; background: #fff; color: var(--text);
  border-radius: 9px; padding: 9px 11px; font-size: 12.5px; outline: none;
  transition: border-color .15s, box-shadow .15s; min-height: 36px;
}
.input:focus, .select:focus, .textarea:focus { border-color: #14b8a6; box-shadow: 0 0 0 3px rgba(20, 184, 166, .12); }
.input::placeholder, .textarea::placeholder { color: #a8b5c5; }
.input[readonly] { background: #f8fafc; color: var(--muted); }
.textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.input-sm, .select-sm { min-height: 30px; padding: 5px 9px; font-size: 11.5px; border-radius: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: #475569; cursor: pointer; user-select: none; }
.check input, .radio input { accent-color: var(--accent); width: 15px; height: 15px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.toggle-row:last-child { border-bottom: none; }
.toggle-row .t { font-size: 12.5px; font-weight: 600; }
.toggle-row .d { font-size: 11px; color: var(--muted); margin-top: 2px; max-width: 420px; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: 9px 0 0 9px; }
.input-group .btn { border-radius: 0 9px 9px 0; border-left: none; }
.input-with-icon { position: relative; }
.input-with-icon svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted-2); width: 15px; height: 15px; }
.input-with-icon .input { padding-left: 31px; }
.form-note { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; font-size: 11.5px; color: var(--muted); line-height: 1.55; }
.form-note b { color: var(--text); }
.form-note.warn { background: var(--amber-soft); border-color: #fef3c7; color: #92400e; }
.form-note.info { background: #eff6ff; border-color: #dbeafe; color: #1e40af; }

/* Фильтры */
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filters .input, .filters .select { min-height: 34px; font-size: 12px; }
.filters .search { min-width: 230px; }
.filter-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ================= Страницы: дашборд ================= */
.dash-grid { display: grid; grid-template-columns: minmax(0, 2.15fr) minmax(300px, 1fr); gap: 18px; }
.chart-box { padding: 10px 16px 16px; }
.chart-legend { display: flex; gap: 15px; flex-wrap: wrap; padding: 4px 4px 0; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); }
.legend-dot { width: 8px; height: 8px; border-radius: 3px; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-svg text { font-family: var(--font); }
.chart-empty { padding: 60px 20px; text-align: center; color: var(--muted); font-size: 12px; }

.quick-list { display: grid; gap: 2px; }
.quick-item { display: flex; align-items: center; gap: 11px; padding: 9px 4px; border-radius: 9px; cursor: pointer; }
.quick-item:hover { background: #f8fafc; }
.quick-item .qi-icon { width: 32px; height: 32px; border-radius: 9px; background: #f1f5f9; color: #475569; display: grid; place-items: center; }
.quick-item .qi-t { font-size: 12px; font-weight: 600; }
.quick-item .qi-d { font-size: 10px; color: var(--muted); }
.quick-item .qi-arrow { margin-left: auto; color: #cbd5e1; }

.rates-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rates-table td { padding: 8px 2px; border-bottom: 1px solid var(--line-2); }
.rates-table tr:last-child td { border-bottom: none; }
.rates-table .cur { font-weight: 650; }
.rates-table .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.rates-table .src { color: var(--muted-2); font-size: 9.5px; }

.top-list { display: grid; gap: 13px; }
.top-row { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; }
.top-rank { width: 24px; height: 24px; border-radius: 7px; background: #f1f5f9; color: var(--muted); display: grid; place-items: center; font-size: 10px; font-weight: 700; }
.top-rank.gold { background: #fef3c7; color: #92400e; }
.top-name { font-size: 11.5px; font-weight: 600; line-height: 1.25; }
.top-sub { font-size: 9.5px; color: var(--muted); margin-top: 2px; }
.top-bar { height: 4px; border-radius: 4px; background: #f1f5f9; margin-top: 5px; overflow: hidden; }
.top-bar span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #2dd4bf, #0ea5e9); }
.top-val { font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; }

.aging-list { display: grid; gap: 12px; }
.aging-row { display: grid; grid-template-columns: 62px 1fr 72px; gap: 10px; align-items: center; font-size: 11px; }
.aging-bar { height: 8px; border-radius: 6px; background: #f1f5f9; overflow: hidden; }
.aging-bar span { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #14b8a6, #0ea5e9); }
.aging-row:nth-child(4) .aging-bar span, .aging-row:nth-child(5) .aging-bar span { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.aging-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

/* ================= Модальные окна ================= */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(7, 16, 31, .58);
  backdrop-filter: blur(4px); display: flex; align-items: flex-start; justify-content: center;
  padding: 4vh 20px; overflow-y: auto; animation: fadeIn .14s ease-out;
}
.modal {
  width: min(720px, 100%); background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg);
  animation: modalIn .18s cubic-bezier(.2,.8,.3,1); overflow: hidden; margin: auto;
}
.modal.lg { width: min(980px, 100%); }
.modal.xl { width: min(1180px, 100%); }
.modal.sm { width: min(500px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 19px 23px; border-bottom: 1px solid var(--line-2); }
.modal-head h2 { font-size: 18px; letter-spacing: -.025em; }
.modal-head .sub { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.modal-close { background: #f8fafc; border: 1px solid var(--line); width: 31px; height: 31px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); flex: none; }
.modal-close:hover { background: #f1f5f9; color: var(--text); }
.modal-body { padding: 22px 23px; max-height: calc(100vh - 190px); overflow-y: auto; }
.modal-body.flush { padding: 0; }
.modal-foot { padding: 14px 23px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; align-items: center; gap: 9px; background: #fbfdff; flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Вкладки */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 18px; overflow-x: auto; }
.tabs.inside { margin: 0; padding: 0 23px; background: #fcfdff; }
.tab {
  background: none; border: none; border-bottom: 2px solid transparent; padding: 10px 13px;
  font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap; font-weight: 550;
  display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--text); }
.tab.active { color: #0f766e; border-bottom-color: #14b8a6; font-weight: 700; }
.tab .cnt { background: #f1f5f9; color: var(--muted); border-radius: 999px; padding: 1px 6px; font-size: 9.5px; }

/* Детали товара */
.detail-head { display: flex; align-items: flex-start; gap: 16px; padding: 22px 23px; border-bottom: 1px solid var(--line-2); background: linear-gradient(180deg, #fbfdff, #fff); }
.detail-head .thumb { width: 68px; height: 68px; border-radius: 15px; font-size: 19px; }
.detail-head h2 { font-size: 21px; letter-spacing: -.03em; line-height: 1.2; }
.detail-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 7px; }
.detail-price { margin-left: auto; text-align: right; }
.detail-price .v { font-size: 21px; font-weight: 750; letter-spacing: -.03em; }
.detail-price .l { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.detail-actions { display: flex; gap: 7px; flex-wrap: wrap; padding: 12px 23px; border-bottom: 1px solid var(--line-2); background: #fff; }
.detail-body { padding: 20px 23px 24px; }
.detail-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 22px; }
.price-cards { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.price-card { border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px; background: #fcfdff; }
.price-card.current { border-color: #99f6e4; background: var(--accent-soft); }
.price-card.hidden-price { opacity: .55; }
.price-card .pc-l { font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-weight: 700; }
.price-card .pc-v { font-size: 16px; font-weight: 750; margin-top: 4px; font-variant-numeric: tabular-nums; }
.attr-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.attr-table td { padding: 7px 0; border-bottom: 1px dashed #edf2f7; }
.attr-table td:first-child { color: var(--muted); width: 46%; }
.attr-table tr:last-child td { border-bottom: none; }
.batch-age { display: inline-flex; align-items: center; gap: 5px; }
.age-dot { width: 6px; height: 6px; border-radius: 50%; background: #14b8a6; }
.age-dot.warn { background: #f59e0b; }
.age-dot.bad { background: #ef4444; }

.history { display: grid; gap: 0; }
.history-row { display: grid; grid-template-columns: 138px 1fr auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); align-items: start; }
.history-row:last-child { border-bottom: none; }
.history-date { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.history-main { font-size: 12px; }
.history-delta { font-size: 11.5px; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.history-delta.up { color: #b91c1c; }
.history-delta.down { color: #047857; }
.history-comment { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.history-src { font-size: 9.5px; color: var(--muted-2); }

/* ================= Линии документов ================= */
.line-table { width: 100%; border-collapse: collapse; }
.line-table th { text-align: left; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 0 6px 6px; font-weight: 700; }
.line-table td { padding: 4px 6px; vertical-align: top; }
.line-table .input, .line-table .select { min-height: 33px; padding: 6px 8px; font-size: 11.5px; }
.line-table .line-product { min-width: 190px; }
.line-table .line-qty { width: 76px; text-align: right; }
.line-table .line-price { width: 100px; text-align: right; }
.line-table .line-sum { width: 100px; text-align: right; font-size: 11.5px; font-weight: 650; padding-top: 12px; font-variant-numeric: tabular-nums; }
.line-table .line-remove { padding-top: 5px; }
.line-add { margin-top: 8px; }
.doc-total { display: flex; justify-content: flex-end; gap: 28px; padding: 13px 8px 0; border-top: 1px solid var(--line-2); margin-top: 7px; }
.doc-total .tl { font-size: 10.5px; color: var(--muted); }
.doc-total .tv { font-size: 15px; font-weight: 750; text-align: right; font-variant-numeric: tabular-nums; }

/* ================= Загрузка / пустые ================= */
.skeleton { position: relative; overflow: hidden; background: #eef2f7; border-radius: 8px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent); animation: shimmer 1.25s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-page { display: grid; gap: 18px; }
.sk-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 15px; }
.sk-card { height: 118px; border-radius: 15px; }
.sk-title { height: 24px; width: 240px; }
.sk-line { height: 13px; width: 100%; }
.empty { padding: 44px 20px; text-align: center; }
.empty .e-icon { width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 14px; background: #f1f5f9; color: var(--muted); display: grid; place-items: center; }
.empty h3 { font-size: 14px; margin-bottom: 4px; }
.empty p { color: var(--muted); font-size: 12px; max-width: 380px; margin: 0 auto 12px; }
.error-panel { background: var(--red-soft); border: 1px solid #fee2e2; color: #991b1b; border-radius: 12px; padding: 16px 18px; font-size: 12.5px; }

/* ================= Тосты ================= */
.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; background: #0f172a; color: #f1f5f9; border-radius: 11px;
  padding: 11px 14px; font-size: 12px; box-shadow: 0 12px 32px rgba(2,8,23,.3);
  display: flex; align-items: flex-start; gap: 9px; max-width: 420px;
  animation: toastIn .2s ease-out;
}
.toast.success { background: #064e3b; }
.toast.error { background: #7f1d1d; }
.toast.info { background: #0c4a6e; }
.toast svg { margin-top: 1px; }
.toast .t-close { margin-left: 6px; color: rgba(255,255,255,.6); cursor: pointer; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ================= Прочее ================= */
.notice {
  display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px; border-radius: 11px;
  background: #f8fafc; border: 1px solid var(--line); font-size: 11.5px; color: var(--muted); line-height: 1.5;
}
.notice svg { color: var(--accent); margin-top: 1px; }
.notice.warn { background: var(--amber-soft); border-color: #fef3c7; color: #92400e; }
.notice.warn svg { color: #d97706; }
.notice.success { background: var(--green-soft); border-color: #d1fae5; color: #047857; }
.notice.info { background: #eff6ff; border-color: #dbeafe; color: #1d4ed8; }
.notice b { color: inherit; }

.code-box { display: flex; gap: 8px; align-items: center; background: #0f172a; color: #e2e8f0; border-radius: 9px; padding: 8px 10px; }
.code-box code { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-box .btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.1); color: #e2e8f0; min-height: 26px; }
.code-box .btn:hover { background: rgba(255,255,255,.14); }

.integration-status { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #cbd5e1; }
.status-dot.on { background: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,.12); }
.status-dot.err { background: #ef4444; }

.timeline { display: flex; gap: 0; margin: 4px 0 18px; }
.tl-step { flex: 1; position: relative; font-size: 10px; color: var(--muted); text-align: center; }
.tl-step::before { content: ""; display: block; height: 3px; background: #eef2f7; margin-bottom: 8px; border-radius: 3px; }
.tl-step.done::before { background: #14b8a6; }
.tl-step.current::before { background: #0ea5e9; }
.tl-step b { display: block; color: var(--text); font-size: 10.5px; font-weight: 650; margin-bottom: 1px; }

.two-col-list { columns: 2; column-gap: 26px; }
.two-col-list > * { break-inside: avoid; }

.search-results { display: grid; gap: 3px; max-height: 380px; overflow: auto; }
.search-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 9px; cursor: pointer; }
.search-item:hover { background: #f1f5f9; }
.search-item .nm { font-size: 12px; font-weight: 600; }
.search-item .sk { font-size: 10px; color: var(--muted); }

.copied { color: #10b981 !important; }
.hidden { display: none !important; }

/* ================= Адаптив ================= */
@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 1100px) {
  .dash-grid, .grid-2 { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .top-date { display: none; }
}
@media (max-width: 940px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: 20px 0 60px rgba(2,8,23,.25); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 18px; }
  .view { padding: 20px 18px 60px; }
  .rate-chip:nth-child(n+3) { display: none; }
  .login { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-side { min-height: 100vh; padding: 30px 22px; background: linear-gradient(180deg, #07101f 0%, #0b1220 55%, #f7fafc 55%, #f7fafc 100%); }
  .login-card { background: #fff; padding: 28px; border-radius: 18px; box-shadow: var(--shadow-lg); }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(2,8,23,.45); z-index: 39; display: none; }
  .sidebar-backdrop.show { display: block; }
}
@media (max-width: 720px) {
  .page-head h1 { font-size: 23px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 13px 14px; }
  .kpi-value { font-size: 20px; }
  .kpi-label { font-size: 9.5px; }
  .grid-3, .grid-2-even { grid-template-columns: 1fr; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .form-grid .span-2, .form-grid .span-3 { grid-column: span 1; }
  .modal-overlay { padding: 2vh 10px; }
  .modal-body { padding: 17px; }
  .modal-head { padding: 16px 17px; }
  .modal-foot { padding: 12px 17px; }
  .detail-head { padding: 16px; flex-wrap: wrap; }
  .detail-price { margin-left: 0; text-align: left; }
  .detail-actions, .detail-body { padding-left: 16px; padding-right: 16px; }
  .topbar-right .user-chip .u, .topbar-right .user-chip .r { display: none; }
  .rate-chip { display: none; }
  .filters { width: 100%; }
  .filters .search { min-width: 0; flex: 1; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
  .line-table .line-product { min-width: 140px; }
  .doc-total { justify-content: space-between; gap: 10px; }
  .history-row { grid-template-columns: 96px 1fr; }
  .history-delta { grid-column: 2; }
  .tabs.inside { padding: 0 12px; }
  .detail-head .thumb { width: 52px; height: 52px; }
  .detail-head h2 { font-size: 17px; }
  .price-cards { grid-template-columns: 1fr; }
}
@media (max-width: 460px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .topbar { height: 62px; }
  .page-title { font-size: 15px; }
  .view { padding: 16px 12px 50px; }
  .card-body { padding: 15px; }
  .card-head { padding: 14px 15px; }
  .login-card { padding: 20px; }
  .demo-grid { grid-template-columns: 1fr; }
}

/* Индикатор загрузки кнопки */
.spin {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  animation: spin .7s linear infinite; vertical-align: -2px; margin-right: 4px;
}
.btn:not(.btn-primary):not(.btn-dark) .spin { border-color: rgba(15,23,42,.2); border-top-color: #0f172a; }
@keyframes spin { to { transform: rotate(360deg); } }

a.quick-item { color: inherit; text-decoration: none; }
a.quick-item:hover { text-decoration: none; }

/* --- точечные исправления --- */
.btn.menu-btn { display: none; }
.user-chip .u, .user-chip .r { display: block; line-height: 1.22; }
.grid > *, .stack > *, .dash-grid > * { min-width: 0; }
.card, .code-box, .code-box code { min-width: 0; }
.code-box code { display: block; }
.dash-grid > .stack { align-content: start; }
.integration-grid { grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); }
@media (max-width: 940px) {
  .btn.menu-btn { display: inline-flex; }
  .integration-grid { grid-template-columns: 1fr; }
}

.card-head > * { min-width: 0; }
.card-head > div:first-child { flex: 1 1 180px; }
@media (max-width: 460px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

table.data td.right, table.data th.right { white-space: nowrap; }
