/* AutoCRM — простая и аккуратная тема для автомастерской */
:root {
  --bg: #f2f4f7;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f6;
  --border: #e3e8ef;
  --border-strong: #cfd6e0;
  --text: #111827;
  --text-2: #344054;
  --muted: #667085;
  --brand: #101828;
  --brand-2: #1d2939;
  --accent: #f59e0b;
  --accent-2: #d97706;
  --accent-soft: #fff7e6;
  --success: #067647;
  --success-soft: #ecfdf3;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --info: #175cd3;
  --info-soft: #eff8ff;
  --warning: #b54708;
  --warning-soft: #fffaeb;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 12px 32px rgba(16, 24, 40, .07);
  --sidebar: 264px;
  --font: "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
img, svg { max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }
.text-muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 28px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.w-100 { width: 100%; }
.hidden { display: none !important; }

/* ---------- Каркас ---------- */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 50;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #0d1524 0%, #111c2e 60%, #0b1220 100%);
  color: #cbd5e1; border-right: 1px solid rgba(255,255,255,.06);
  transform: translateX(0); transition: transform .22s ease;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; color: #fff; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #fb923c); color: #111;
  box-shadow: 0 6px 20px rgba(245, 158, 11, .3);
}
.brand-mark .icon { width: 24px; height: 24px; stroke-width: 2; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 18px; letter-spacing: -.3px; }
.brand-text small { font-size: 11px; color: #94a3b8; text-transform: uppercase; letter-spacing: 1.4px; margin-top: 3px; }
.nav { padding: 8px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: #aebacb; font-weight: 500; font-size: 13.5px; transition: background .15s, color .15s;
  position: relative;
}
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.is-active { background: rgba(245, 158, 11, .12); color: #fff; }
.nav-link.is-active::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-link .icon { width: 18px; height: 18px; opacity: .9; }
.sidebar-footer { padding: 14px 14px 18px; border-top: 1px solid rgba(255,255,255,.07); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.user-chip:hover { background: rgba(255,255,255,.06); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(245, 158, 11, .16); color: #fbbf24; font-weight: 700; font-size: 12px;
  border: 1px solid rgba(245, 158, 11, .25);
}
.user-chip-text { display: flex; flex-direction: column; min-width: 0; }
.user-chip-text strong { color: #f1f5f9; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-text small { color: #94a3b8; font-size: 11px; }
.logout-btn {
  width: 100%; display: flex; align-items: center; gap: 8px; margin-top: 6px;
  background: transparent; border: 0; color: #94a3b8; padding: 8px; border-radius: 8px;
  cursor: pointer; font-size: 12.5px;
}
.logout-btn:hover { background: rgba(255,255,255,.06); color: #fff; }
.logout-btn .icon { width: 16px; height: 16px; }

.app-main { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px;
  padding: 14px 30px; background: rgba(255,255,255,.9); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.page-heading h1 { font-size: 20px; letter-spacing: -.3px; line-height: 1.25; }
.page-heading p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.menu-toggle { display: none !important; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); display: inline-grid; place-items: center; cursor: pointer;
  color: var(--text-2); position: relative; transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.bell-count {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid #fff;
}
.content { width: 100%; max-width: 1440px; margin: 0 auto; padding: 26px 30px 40px; flex: 1; }
.app-footer {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px 30px 22px; color: #98a2b3; font-size: 11.5px;
}
.public-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.sidebar-backdrop { display: none; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); font-weight: 600; font-size: 13px;
  cursor: pointer; transition: .15s ease; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(180deg, #f7a928, var(--accent)); border-color: #e79a10; color: #1f1300; box-shadow: 0 1px 2px rgba(245,158,11,.35); }
.btn-primary:hover { background: linear-gradient(180deg, #f6b13c, #ef9f08); border-color: #d98b07; }
.btn-dark { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-dark:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { color: var(--danger); border-color: #fecdca; background: var(--danger-soft); }
.btn-danger:hover { background: #fee4e2; }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.btn-lg { min-height: 46px; padding: 12px 20px; font-size: 14px; }
.btn:disabled, .btn.is-disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-link { background: none; border: 0; color: var(--info); font-weight: 600; cursor: pointer; padding: 0; }

/* ---------- Карточки ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-header h2, .card-header h3 { font-size: 15px; letter-spacing: -.15px; }
.card-body { padding: 20px; }
.card-body.tight { padding: 0; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.grid { display: grid; gap: 18px; }
.grid-2 { 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)); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(300px, .9fr); gap: 20px; align-items: start; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-full { grid-column: 1 / -1; }

/* ---------- Формы ---------- */
.form-section { padding: 20px; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: 0; }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.section-head h2 { font-size: 14px; letter-spacing: -.1px; }
.section-head .step {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-2); font-size: 11px; font-weight: 800;
}
.section-head p { color: var(--muted); font-size: 12px; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 16px 20px; background: var(--surface-2); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.req { color: var(--danger); margin-left: 3px; }
.input {
  width: 100%; min-height: 40px; padding: 9px 12px; border: 1px solid var(--border-strong);
  border-radius: 9px; background: #fff; color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: #f5a623; box-shadow: 0 0 0 3px rgba(245, 158, 11, .16); }
.input::placeholder { color: #98a2b3; }
textarea.input { resize: vertical; min-height: 76px; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px; }
.checkbox { width: 17px; height: 17px; accent-color: var(--accent); }
.check-field { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.help { color: var(--muted); font-size: 11.5px; }
.error { color: var(--danger); font-size: 12px; }
.has-error .input { border-color: #fda29b; background: #fffbfa; }
.form-errors { background: var(--danger-soft); border: 1px solid #fecdca; color: var(--danger); padding: 10px 12px; border-radius: 9px; margin-bottom: 14px; font-size: 12.5px; }
.form-errors ul { list-style: disc; padding-left: 18px; }
.inline-form { display: inline; }
.form-note { color: var(--muted); font-size: 12px; margin-top: 8px; }

/* ---------- Переключатели режима ---------- */
.choice-tabs { display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 3px; gap: 2px; }
.choice-tabs label { position: relative; cursor: pointer; }
.choice-tabs input { position: absolute; opacity: 0; pointer-events: none; }
.choice-tabs span { display: block; padding: 5px 12px; border-radius: 7px; font-size: 12px; font-weight: 600; color: var(--muted); }
.choice-tabs input:checked + span { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }
.mode-box { margin-top: 14px; }
.mode-box.is-hidden { display: none; }

/* ---------- Таблицы ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; padding: 10px 14px; color: var(--muted); font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .7px; font-weight: 700; white-space: nowrap;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fcfcfd; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.table-empty { padding: 28px; text-align: center; color: var(--muted); }
.table-main { font-weight: 600; color: var(--text); }
.table-sub { color: var(--muted); font-size: 12px; margin-top: 1px; }
.table-strong { font-weight: 700; }

/* ---------- Бейджи ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .2px; border: 1px solid transparent; white-space: nowrap;
}
.badge-info { background: var(--info-soft); color: var(--info); border-color: #b2ddff; }
.badge-success { background: var(--success-soft); color: var(--success); border-color: #abefc6; }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: #fedf89; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: #fecdca; }
.badge-muted { background: var(--surface-3); color: var(--muted); border-color: var(--border); }
.badge-dark { background: #f1f5f9; color: #334155; border-color: #e2e8f0; }
.badge-accent { background: var(--accent-soft); color: var(--accent-2); border-color: #fedf89; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- KPI / дашборд ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: flex; gap: 14px; align-items: flex-start; box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.kpi::after { content: ""; position: absolute; inset: auto -20px -30px auto; width: 90px; height: 90px; border-radius: 50%; background: var(--surface-2); }
.kpi-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; flex: 0 0 auto; position: relative; z-index: 1; }
.kpi-icon .icon { width: 21px; height: 21px; }
.kpi-icon.accent { background: var(--accent-soft); color: var(--accent-2); }
.kpi-icon.blue { background: var(--info-soft); color: var(--info); }
.kpi-icon.green { background: var(--success-soft); color: var(--success); }
.kpi-icon.violet { background: #f4f3ff; color: #6938ef; }
.kpi-body { min-width: 0; position: relative; z-index: 1; }
.kpi-label { color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.kpi-value { font-size: 26px; font-weight: 800; letter-spacing: -.8px; margin-top: 2px; line-height: 1.2; }
.kpi-hint { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, .9fr); gap: 20px; align-items: start; }
.chart { display: flex; align-items: flex-end; gap: 14px; height: 190px; padding: 8px 4px 0; }
.chart-bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; min-width: 0; }
.chart-fill {
  width: 100%; max-width: 46px; border-radius: 8px 8px 4px 4px; min-height: 4px;
  background: linear-gradient(180deg, #fbbf24, #f59e0b); transition: height .4s ease;
  position: relative;
}
.chart-fill:hover { filter: brightness(1.05); }
.chart-label { font-size: 10.5px; color: var(--muted); }
.chart-value { font-size: 10.5px; color: var(--text-2); font-weight: 700; }
.status-list { display: flex; flex-direction: column; gap: 2px; }
.status-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--border); gap: 10px; }
.status-row:last-child { border-bottom: 0; }
.status-row .count { font-weight: 800; font-variant-numeric: tabular-nums; }
.quick-links { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-link { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 12px; color: var(--text-2); background: #fff; }
.quick-link:hover { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Фильтры и табы ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.filter-bar .field { gap: 4px; }
.filter-bar .input { min-height: 36px; padding: 6px 10px; font-size: 12.5px; background: #fff; }
.filter-search { position: relative; min-width: 240px; flex: 1; max-width: 360px; }
.filter-search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.filter-search .input { padding-left: 34px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--border); padding: 0 14px; background: #fff; }
.tab { padding: 11px 12px; font-size: 12.5px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 600; }
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }
.tab .count { margin-left: 6px; background: var(--surface-3); color: var(--text-2); border-radius: 999px; padding: 1px 7px; font-size: 10.5px; }

/* ---------- Детали ---------- */
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.info-list { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.info-item { min-width: 0; }
.info-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
.info-value { font-weight: 600; margin-top: 2px; word-break: break-word; }
.info-value.lg { font-size: 17px; }
.vehicle-card { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.vehicle-card + .vehicle-card { margin-top: 10px; }
.vehicle-icon { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex: 0 0 auto; }
.vehicle-title { font-weight: 700; }
.vehicle-meta { color: var(--muted); font-size: 12px; margin-top: 1px; }
.plate { display: inline-flex; align-items: center; padding: 2px 7px; border: 1px solid var(--border-strong); border-radius: 5px; font-size: 11.5px; font-weight: 700; letter-spacing: .6px; background: #fff; }
.totals { display: flex; flex-direction: column; gap: 8px; }
.totals-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.totals-row.grand { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 4px; font-size: 18px; font-weight: 800; letter-spacing: -.4px; }
.totals-row .value { font-variant-numeric: tabular-nums; }
.money-positive { color: var(--success); }

/* ---------- Редактор строк ---------- */
.items-editor { width: 100%; }
.items-editor th { background: #f8fafc; }
.items-editor td { padding: 8px 6px; vertical-align: top; }
.items-editor .input { min-height: 34px; padding: 6px 8px; font-size: 12px; border-radius: 7px; }
.items-editor .name-input { min-width: 210px; }
.items-editor .article-input { min-width: 100px; max-width: 120px; }
.items-editor .qty-input, .items-editor .price-input, .items-editor .vat-input { width: 84px; text-align: right; }
.items-editor .supplier-select { min-width: 140px; }
.items-editor .supplier-url { min-width: 190px; }
.item-row.is-part .part-only { display: table-cell; }
.item-row:not(.is-part) .part-only { display: none; }
.item-row .row-total { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; padding-top: 13px; text-align: right; }
.row-delete { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 7px; background: #fff; color: var(--muted); cursor: pointer; }
.row-delete:hover { color: var(--danger); border-color: #fecdca; background: var(--danger-soft); }
.row-delete input { display: none; }
.row-actions { display: flex; gap: 4px; }
.editor-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.price-fetch { font-size: 10.5px; padding: 3px 7px; }
.price-status { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.supplier-links { display: flex; flex-wrap: wrap; gap: 8px; }
.supplier-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 12px; font-weight: 600; background: #fff; }
.supplier-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.supplier-chip .icon { width: 14px; height: 14px; color: var(--muted); }

/* ---------- Алерты / уведомления ---------- */
.messages { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border); font-size: 13px; background: #fff; box-shadow: var(--shadow-sm); }
.alert .icon { width: 18px; height: 18px; margin-top: 1px; }
.alert-success { background: var(--success-soft); border-color: #abefc6; color: #05603a; }
.alert-error { background: var(--danger-soft); border-color: #fecdca; color: #912018; }
.alert-warning { background: var(--warning-soft); border-color: #fedf89; color: #93370d; }
.alert-info { background: var(--info-soft); border-color: #b2ddff; color: #194185; }
.alert-close { margin-left: auto; background: none; border: 0; color: currentColor; opacity: .6; cursor: pointer; font-size: 18px; line-height: 1; }
.alert-close:hover { opacity: 1; }
.notification-item { display: flex; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.notification-item:last-child { border-bottom: 0; }
.notification-item.is-unread { background: #fffdf7; }
.notification-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; flex: 0 0 auto; background: var(--accent); }
.notification-body { flex: 1; min-width: 0; }
.notification-title { font-weight: 700; }
.notification-text { color: var(--text-2); font-size: 12.5px; margin-top: 2px; }
.notification-meta { color: var(--muted); font-size: 11px; margin-top: 5px; }

/* ---------- Пагинация / пустое ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 18px; border-top: 1px solid var(--border); }
.page-link { padding: 6px 11px; border: 1px solid var(--border); border-radius: 7px; font-size: 12px; color: var(--text-2); background: #fff; }
.page-link:hover { border-color: var(--border-strong); background: var(--surface-2); }
.page-link.is-disabled { opacity: .45; pointer-events: none; }
.page-info { color: var(--muted); font-size: 12px; }
.empty-state { text-align: center; padding: 44px 20px; }
.empty-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--surface-3); color: var(--muted); display: grid; place-items: center; margin: 0 auto 12px; }
.empty-icon .icon { width: 24px; height: 24px; }
.empty-state h3 { font-size: 15px; }
.empty-state p { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.empty-state .btn { margin-top: 14px; }

/* ---------- Вход ---------- */
.auth-body { background: #0b1220; min-height: 100vh; }
.auth {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr;
  background:
    radial-gradient(900px 500px at 12% 8%, rgba(245, 158, 11, .16), transparent 62%),
    radial-gradient(700px 500px at 85% 92%, rgba(37, 99, 235, .13), transparent 60%),
    #0b1220;
}
.auth-aside { color: #e2e8f0; padding: 64px 8vw; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.auth-aside::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: linear-gradient(180deg, rgba(0,0,0,.8), transparent 92%);
}
.auth-brand { display: flex; align-items: center; gap: 12px; position: relative; }
.auth-brand .brand-mark { width: 46px; height: 46px; }
.auth-brand strong { font-size: 20px; color: #fff; letter-spacing: -.4px; }
.auth-brand small { display: block; color: #94a3b8; font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase; margin-top: 2px; }
.auth-title { font-size: clamp(30px, 3.5vw, 46px); line-height: 1.08; letter-spacing: -1.5px; margin-top: 48px; color: #fff; position: relative; font-weight: 800; }
.auth-title span { color: #fbbf24; }
.auth-subtitle { color: #94a3b8; font-size: 15px; max-width: 460px; margin-top: 16px; line-height: 1.65; position: relative; }
.auth-features { display: flex; flex-direction: column; gap: 14px; margin-top: 36px; position: relative; }
.auth-feature { display: flex; gap: 12px; align-items: flex-start; color: #cbd5e1; font-size: 13.5px; }
.auth-feature .icon { width: 18px; height: 18px; color: #fbbf24; margin-top: 2px; }
.auth-feature strong { color: #fff; font-weight: 600; }
.auth-panel { display: grid; place-items: center; padding: 36px; }
.auth-card { width: 100%; max-width: 410px; background: #fff; border-radius: 18px; padding: 32px; box-shadow: 0 24px 80px rgba(0,0,0,.35); }
.auth-card h1 { font-size: 22px; letter-spacing: -.5px; }
.auth-card > p { color: var(--muted); font-size: 13px; margin-top: 4px; margin-bottom: 22px; }
.auth-form { display: flex; flex-direction: column; gap: 15px; }
.auth-form .field > label { font-size: 12.5px; }
.auth-form .input { min-height: 44px; }
.auth-submit { width: 100%; min-height: 46px; margin-top: 4px; }
.auth-hint { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11.5px; line-height: 1.6; }
.auth-footer { text-align: center; color: #64748b; font-size: 11px; margin-top: 18px; }
.auth-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-2); font-size: 10.5px; font-weight: 700; margin-bottom: 16px; }
.auth-badge .icon { width: 12px; height: 12px; }

/* ---------- Утилиты ---------- */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-header h2 { font-size: 18px; letter-spacing: -.3px; }
.page-header p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { font-weight: 600; text-align: right; }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--info-soft); border: 1px solid #b2ddff; color: #194185; font-size: 12.5px; }
.callout .icon { color: var(--info); }
.callout.warning { background: var(--warning-soft); border-color: #fedf89; color: #93370d; }
.callout.warning .icon { color: var(--warning); }
.excel-disabled { display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px; border: 1px dashed var(--border-strong); border-radius: 9px; color: var(--muted); background: var(--surface-2); font-size: 12px; cursor: not-allowed; }
.excel-disabled .badge { font-size: 9.5px; }

/* ---------- Адаптив ---------- */
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); box-shadow: 20px 0 60px rgba(0,0,0,.3); }
  .app.sidebar-open .sidebar { transform: translateX(0); }
  .app.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 45; }
  .app-main { margin-left: 0; }
  .menu-toggle { display: inline-grid !important; }
  .topbar { padding: 12px 18px; }
  .content { padding: 20px 18px 32px; }
  .app-footer { padding: 0 18px 20px; }
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-panel { padding: 20px; }
}
@media (max-width: 720px) {
  .grid-2, .grid-3, .grid-4, .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .info-list { grid-template-columns: 1fr; }
  .topbar-new span { display: none; }
  .topbar-new { padding: 8px 10px; }
  .page-heading h1 { font-size: 17px; }
  .page-heading p { display: none; }
  .kpi-value { font-size: 22px; }
  .card-body, .form-section { padding: 16px; }
  .table th, .table td { padding: 9px 10px; }
  .filter-search { max-width: none; }
  .items-editor { min-width: 980px; }
}

/* ---------- Тосты ---------- */
.toast-stack {
  position: fixed; right: 22px; bottom: 22px; z-index: 100;
  display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px));
}
.toast {
  padding: 11px 14px; border-radius: 10px; background: #111827; color: #fff;
  font-size: 12.5px; box-shadow: 0 12px 30px rgba(16,24,40,.25);
  border: 1px solid rgba(255,255,255,.08); animation: toast-in .2s ease;
  transition: opacity .25s ease, transform .25s ease;
}
.toast-success { background: #05603a; }
.toast-error { background: #912018; }
.toast-warning { background: #93370d; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Логотип-буква (не зависит от SVG-спрайта) */
.brand-letter {
  font-weight: 900;
  font-size: 23px;
  line-height: 1;
  letter-spacing: -1.5px;
  color: #111827;
  transform: translateY(-1px);
}

/* Сетки не должны растягиваться содержимым таблиц */
.grid > *, .detail-grid > *, .dashboard-grid > * { min-width: 0; }
.detail-grid .table-wrap { max-width: 100%; }
.items-editor { min-width: 980px; }
.items-editor th:nth-child(1), .items-editor td:nth-child(1) { width: 104px; }
.items-editor .qty-input { width: 78px; }
.items-editor .price-input { width: 100px; }
.items-editor .supplier-url { min-width: 170px; max-width: 220px; }

/* Компактный редактор строк: поставщик раскрывается под наименованием */
.items-editor { min-width: 0; table-layout: fixed; }
.items-editor .name-input, .items-editor .article-input, .items-editor .supplier-url,
.items-editor .qty-input, .items-editor .price-input, .items-editor .vat-input { width: 100%; min-width: 0; }
.items-editor .supplier-select { width: 100%; }
.item-supplier-details { margin-top: 6px; }
.item-supplier-details summary {
  cursor: pointer; color: var(--muted); font-size: 11px; list-style: none;
  display: inline-flex; align-items: center; gap: 4px;
}
.item-supplier-details summary::-webkit-details-marker { display: none; }
.item-supplier-details summary::before { content: "＋"; font-weight: 700; color: var(--accent-2); }
.item-supplier-details details[open] summary::before { content: "−"; }
.item-supplier-grid { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.item-supplier-grid .input { min-height: 30px; font-size: 11.5px; padding: 5px 8px; }
.item-supplier-grid .vat-field { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
.item-supplier-grid .vat-field .input { width: 64px; }
.item-supplier-grid .price-fetch { width: 100%; justify-content: center; border: 1px solid var(--border-strong); background: #fff; }
.item-row:not(.is-part) .item-supplier-details { display: none; }
@media (max-width: 720px) { .items-editor { min-width: 720px; } }
