/* ===== СамБарс — ERP, «стекло» (glassmorphism) + тёмная/светлая тема ===== */
@font-face {
  font-family: "Manrope ERP";
  font-weight: 300 900;
  font-display: swap;
  src: url('/vendor/fonts/Manrope-cyrillic.woff2') format('woff2');
  unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope ERP";
  font-weight: 300 900;
  font-display: swap;
  src: url('/vendor/fonts/Manrope-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC;
}
:root {
  --bg: #0a0a0b;
  --panel-solid: #141b25;
  color-scheme: dark;
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .07);
  --border: rgba(255, 255, 255, .09);
  --border-strong: rgba(255, 255, 255, .16);
  --text: #f2f2f0;
  --muted: #9a9a97;
  --faint: #6a6a68;
  --steel: #f4652f;        /* оранжевый — основной акцент (Churn-гамма) */
  --steel-strong: #d24f1f;
  --accent: #f4652f;
  --success: #34d399;
  --warning: #f4652f;
  --danger: #f87171;
  --blue: #60a5fa;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .35);
  --shadow: 0 8px 24px rgba(0, 0, 0, .28);
  --shadow-lg: 0 20px 50px -12px rgba(0, 0, 0, .55);
  --header-bg: rgba(10, 10, 11, .72);
  --bg-grad:
    radial-gradient(1200px 600px at 15% -10%, rgba(244, 101, 47, .12), transparent 60%),
    radial-gradient(1000px 700px at 100% 0%, rgba(244, 101, 47, .08), transparent 55%),
    radial-gradient(900px 700px at 50% 120%, rgba(216, 79, 31, .10), transparent 60%),
    #0a0a0b;
}

:root[data-theme="light"] {
  --bg: #eef1f6;
  color-scheme: light;
  --surface: rgba(255, 255, 255, .85);
  --surface-2: rgba(255, 255, 255, .98);
  --border: rgba(15, 23, 42, .14);
  --border-strong: rgba(15, 23, 42, .26);
  --text: #0f172a;
  --muted: #42506b;
  --faint: #64748b;
  --steel: #e08e0a;
  --steel-strong: #c47a08;
  --accent: #e08e0a;
  --success: #16a34a;
  --warning: #e08e0a;
  --danger: #dc2626;
  --blue: #2563eb;
  --shadow-sm: 0 1px 2px rgba(30, 40, 70, .06);
  --shadow: 0 8px 26px rgba(30, 40, 70, .10);
  --shadow-lg: 0 20px 50px -16px rgba(30, 40, 70, .22);
  --header-bg: rgba(255, 255, 255, .92);
  --bg-grad:
    radial-gradient(1200px 600px at 15% -10%, rgba(224, 142, 10, .14), transparent 60%),
    radial-gradient(1000px 700px at 100% 0%, rgba(34, 211, 238, .12), transparent 55%),
    radial-gradient(900px 700px at 50% 120%, rgba(236, 72, 153, .10), transparent 60%),
    #eef1f6;
}

* { box-sizing: border-box; }

/* «стекло»: полупрозрачные поверхности размывают градиентный фон */
.card, .kpi-card, .order-row, .sidebar, .tab-bar, .modal, .login-card,
.search-box, .filter-pill, .spec-template-btn {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Manrope ERP", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  font-feature-settings: "tnum" 1, "cv02" 1, "cv03" 1;
}
h1, h2, h3, h4 { font-family: "Manrope ERP", "IBM Plex Sans", sans-serif; letter-spacing: .01em; }

/* ===== Утилиты ===== */
.muted-text { color: var(--muted); font-size: 13px; }
.empty-hint { color: var(--muted); font-size: 13.5px; padding: 20px 4px; text-align: center; }
.section-label {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 0 0 10px; display: flex; align-items: center; gap: 6px;
}

/* ===== Кнопки ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--steel); border-color: var(--steel); color: #1a1204;
  box-shadow: 0 1px 2px rgba(245, 166, 35, .35);
}
.btn-primary:hover { background: var(--steel-strong); border-color: var(--steel-strong); }
.btn-danger-ghost { color: var(--danger); border-color: rgba(248, 113, 113, .4); background: transparent; }
.btn-danger-ghost:hover { background: rgba(248, 113, 113, .1); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px; border: none; background: transparent;
  color: var(--muted); cursor: pointer; transition: .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn-sm { width: 28px; height: 28px; border-radius: 7px; }

/* ===== Поля ===== */
/* Фикс выпадающего списка в тёмной теме: не красим option вручную (ломает нативный рендеринг),
   оставляем только color-scheme: dark — Chrome сам рисует тёмный список */
select {
  color-scheme: dark;
}
.input {
  width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
 .input:focus { border-color: var(--steel); box-shadow: 0 0 0 3px rgba(245, 166, 35, .18); }
/* Кастомный тёмный селект (замена нативного <select>) */
.sbox { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.sbox .sbox-val { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sbox .sbox-arrow { font-size: 10px; color: var(--muted); flex: none; }
.sbox.open { border-color: var(--steel); }
.sbox-menu { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 100; background: #141b25; border: 1px solid var(--border-strong); border-radius: 9px; box-shadow: var(--shadow-lg); max-height: 260px; overflow: auto; padding: 4px; }
.sbox-opt { padding: 9px 12px; border-radius: 7px; color: var(--text); font-size: 14px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sbox-opt:hover { background: var(--surface-2); }
.sbox-opt.sel { background: rgba(244, 101, 47, .18); color: var(--steel); font-weight: 600; }
:root[data-theme="light"] .sbox-menu { background: #ffffff; border-color: var(--border-strong); }
:root[data-theme="light"] .sbox-opt { color: var(--text); }
:root[data-theme="light"] .sbox-opt:hover { background: #f3f4f6; }
:root[data-theme="light"] .sbox-opt.sel { background: rgba(224, 142, 10, .18); }
textarea.input { resize: vertical; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; flex: 1; min-width: 0; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.field-row { display: flex; gap: 12px; }
.checkbox-field { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin: 8px 0 12px; cursor: pointer; }
.checkbox-field input { width: 17px; height: 17px; accent-color: var(--steel); }

/* ===== Карточки ===== */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; letter-spacing: .01em; }

.badge {
  display: inline-flex; align-items: center; padding: 2.5px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650; border: 1px solid transparent; letter-spacing: .01em;
}

/* ===== Экран загрузки / логин ===== */
.loading-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  gap: 10px; color: var(--muted); font-size: 15px;
}
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: var(--bg-grad);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid rgba(255, 255, 255, .07); border-radius: 18px; padding: 30px;
  box-shadow: var(--shadow-lg);
}
.login-bare {
  background: transparent; border: 0; box-shadow: none; padding: 0; max-width: 420px;
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
.login-bare .login-brand { width: auto; height: auto; background: none; }

.login-brand {
  width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, #f5a623, #d9820a);
  display: flex; align-items: center; justify-content: center; color: #1a1204; margin-bottom: 18px;
  font-family: "Manrope ERP", sans-serif; font-weight: 700; font-size: 22px;
}
.login-title { font-size: 19px; font-weight: 600; letter-spacing: -.02em; margin-bottom: 3px; }
.login-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 22px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-pwd-row { display: flex; gap: 8px; align-items: center; }
.login-submit { width: 100%; padding: 11px; font-size: 14px; }
.login-error { color: var(--danger); font-size: 13px; font-weight: 600; }
.login-hint { margin-top: 18px; color: var(--muted); font-size: 11.5px; text-align: center; line-height: 1.5; }

/* ===== Шапка и навигация ===== */
.erp-root { min-height: 100vh; display: flex; flex-direction: column; }
.app-layout { display: flex; flex: 1; min-height: 0; align-items: stretch; }
.sidebar {
  width: 216px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); padding: 12px 10px;
}
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav .tab-btn { width: 100%; justify-content: flex-start; padding: 10px 12px; text-align: left; }
.app-main { flex: 1; min-width: 0; }
.app-header {
  background: var(--header-bg); backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 13px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  position: sticky; top: 0; z-index: 20;
}
.app-title { font-size: 15.5px; font-weight: 600; letter-spacing: -.01em; }
.app-subtitle { font-size: 12px; color: var(--muted); }
.save-indicator { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.logout-btn {
  display: inline-flex; align-items: center; gap: 5px; margin-left: 8px;
  padding: 6px 11px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: .15s;
}
.logout-btn:hover { background: var(--border); border-color: var(--border-strong); }

.tab-bar {
  display: flex; gap: 4px; padding: 8px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border); overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.tab-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px;
  border: none; border-radius: 8px; background: transparent; color: var(--muted);
  font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: .15s;
}
.tab-btn:hover { background: var(--surface-2); color: var(--text); }
.tab-btn-active { background: var(--surface-2); color: var(--steel); }

.view-pad { padding: 20px; width: 100%; max-width: 1120px; margin: 0 auto; }
.view-title { margin: 0 0 16px; font-size: 19px; font-weight: 600; letter-spacing: -.02em; }

/* ===== Дашборд ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px; display: flex; align-items: center; gap: 13px; box-shadow: var(--shadow);
  transition: box-shadow .15s, border-color .15s;
}
.kpi-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.kpi-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi-value { font-family: "IBM Plex Sans", "Manrope ERP", sans-serif; font-size: 23px; font-weight: 700; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.big-number { font-family: "IBM Plex Sans", "Manrope ERP", sans-serif; font-size: 28px; font-weight: 700; color: var(--text); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.low-stock-list { list-style: none; margin: 0; padding: 0; }
.low-stock-list li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.low-stock-list li:last-child { border-bottom: none; }
.ls-name { font-size: 13.5px; }
.ls-qty { color: var(--danger); font-weight: 700; font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ===== Тулы (заказы/склад) ===== */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.search-box {
  display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 9px; padding: 0 12px; flex: 1; min-width: 180px;
  transition: border-color .15s, box-shadow .15s;
}
.search-box:focus-within { border-color: var(--steel); box-shadow: 0 0 0 3px rgba(245, 166, 35, .18); }
.search-box input { border: none; outline: none; padding: 9px 0; width: 100%; font-size: 14px; background: transparent; color: var(--text); }
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-pill {
  padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: .15s;
}
.filter-pill:hover { border-color: var(--border-strong); color: var(--text); }
.filter-pill-active { background: var(--steel); border-color: var(--steel); color: #1a1204; }
.filter-pill-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 999px; background: var(--success); color: #06281a; font-size: 11px; font-weight: 800; line-height: 1; }
.filter-pill-active .filter-pill-badge { background: #1a1204; color: var(--success); }

/* ===== Список заказов ===== */
.order-list { display: flex; flex-direction: column; gap: 10px; }
.order-row {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 14px 16px; cursor: pointer; transition: border-color .15s, box-shadow .15s; box-shadow: var(--shadow);
}
.order-row:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.order-row-need-narad { border-color: rgba(248, 113, 113, .5); background: rgba(248, 113, 113, .07); }
.order-row-need-narad:hover { border-color: var(--danger); }
/* Площадка производства: ИК (синий) / цех (оранжевый) — подсветка карточки заказа */
.order-row-ik { border-color: #2b6cb0; background: linear-gradient(180deg, rgba(43,108,176,.22), rgba(43,108,176,.10)); }
.order-row-ik:hover { border-color: #2b6cb0; background: linear-gradient(180deg, rgba(43,108,176,.28), rgba(43,108,176,.14)); }
.order-row-tseh { border-color: #f4652f; background: linear-gradient(180deg, rgba(244,101,47,.22), rgba(244,101,47,.10)); }
.order-row-tseh:hover { border-color: #f4652f; background: linear-gradient(180deg, rgba(244,101,47,.28), rgba(244,101,47,.14)); }
.site-chip { flex: 0 0 auto; display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 6px;
  font-size: 11px; font-weight: 700; border: 1px solid; line-height: 1.5; }
.site-selector-row { display: flex; align-items: center; gap: 10px; margin: 2px 0 14px; flex-wrap: wrap; }
.input-sm { width: auto; min-width: 200px; padding: 7px 11px; }
/* Вкладки площадки в разделе «Сварка» у овнера */
.weld-tabs { display: flex; gap: 8px; margin: 14px 0 4px; border-bottom: 1px solid var(--border); }
.weld-tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; font-size: 14px; font-weight: 700; cursor: pointer; border: none; background: transparent; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s; }
.weld-tab:hover { color: var(--text); }
.weld-tab .dot { width: 9px; height: 9px; border-radius: 50%; }
.weld-tab .cnt { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
.weld-tab.active-ik { color: var(--blue); border-bottom-color: var(--blue); }
.weld-tab.active-ik .cnt { color: var(--blue); border-color: rgba(96,165,250,.4); }
.weld-tab.active-tseh { color: var(--steel); border-bottom-color: var(--steel); }
.weld-tab.active-tseh .cnt { color: var(--steel); border-color: rgba(244,101,47,.4); }
.order-row-main { flex: 1; min-width: 0; }
.order-row-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.order-number { font-weight: 700; font-size: 14.5px; letter-spacing: -.01em; }
.order-row-client { font-size: 13.5px; color: var(--muted); margin-top: 3px; }
.order-row-track { flex-shrink: 1; }

/* ===== Этапы (stage-track) ===== */
.stage-track { display: flex; align-items: center; }
.stage-rail { height: 2px; flex: 1; min-width: 8px; background: var(--border); }
.stage-rail-lit { background: var(--success); }
.stage-chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  border-radius: 999px; border: 1.5px solid var(--border); background: var(--surface); color: var(--muted);
  font-weight: 650; cursor: default; flex-shrink: 0;
}
.stage-chip-sm { padding: 5px 10px; font-size: 12px; }
.stage-chip-md { padding: 7px 13px; font-size: 12.5px; }
.stage-chip-xs { padding: 3px 7px; font-size: 10px; }
.stage-chip-label { font-weight: 650; }
.stage-chip.status-pending { border-color: var(--border); color: var(--faint); }
.stage-chip.status-in_progress { border-color: var(--steel); background: rgba(245, 166, 35, .12); color: var(--steel); }
.stage-chip.status-done { border-color: var(--success); background: rgba(62, 207, 142, .12); color: var(--success); }
.stage-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--steel); }
.stage-chip-clickable { cursor: pointer; }

/* ===== Модалки ===== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(5, 8, 12, .65); z-index: 50;
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto;
}
.modal {
  background: var(--surface); border-radius: 18px; width: 100%; max-width: 520px;
  max-height: 92vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: modal-in .18s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-wide { max-width: 780px; }
/* Карточка заказа: шрифт чуть крупнее */
.modal-wide .modal-head h3 { font-size: 17px; }
.modal-wide .modal-body { font-size: 15px; }
.modal-wide .modal-body .section-label { font-size: 12.5px; }
.modal-wide .modal-body .detail-row { font-size: 15px; }
.modal-wide .modal-body .field > span { font-size: 13px; }
.modal-wide .modal-body .input, .modal-wide .modal-body .sbox .sbox-val { font-size: 15px; }
.modal-wide .modal-body .sbox-opt { font-size: 15px; }
.modal-wide .modal-body .cost-summary > div { font-size: 14.5px; }
.modal-wide .modal-body .stage-chip-label { font-size: 13.5px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 17px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 15.5px; font-weight: 600; letter-spacing: -.01em; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 15px 20px; border-top: 1px solid var(--border); }
.modal-foot-split { justify-content: space-between; }

.inner-tab-bar { display: flex; gap: 4px; padding: 8px 14px 0; border-bottom: 1px solid var(--border); }
.inner-tab {
  padding: 9px 14px; border: none; border-bottom: 2px solid transparent; background: transparent;
  color: var(--muted); font-size: 13.5px; font-weight: 600; cursor: pointer; transition: .15s;
}
.inner-tab:hover { color: var(--text); }
.inner-tab-active { color: var(--steel); border-bottom-color: var(--steel); }

/* ===== Таблицы ===== */
.mini-table, .data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mini-table th, .data-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 700; padding: 9px 10px; border-bottom: 1px solid var(--border);
}
.mini-table td, .data-table td { padding: 10px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.mini-table tr:last-child td, .data-table tr:last-child td { border-bottom: none; }
.mini-table tbody tr:hover, .data-table tbody tr:hover { background: var(--surface-2); }
.row-warning td { background: rgba(245, 166, 35, .07); }
.row-done td { opacity: .55; }
.ops-table td:first-child { width: 32px; }
.ops-table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--steel); }
.input-inline { padding: 6px 8px; font-size: 13px; max-width: 160px; }
.input-qty { max-width: 90px; }

/* ===== Строки добавления ===== */
.material-add-row, .spec-add-row { display: flex; gap: 8px; margin-bottom: 10px; }
.spec-input-narrow { max-width: 84px; }
.spec-template-grid { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; max-height: 300px; overflow-y: auto; padding: 2px; }
.spec-template-btn { text-align: left; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 13.5px; cursor: pointer; transition: .15s; }
.spec-template-btn:hover { border-color: var(--steel); }
.spec-template-btn:disabled { cursor: default; }
.spec-template-btn-added { background: rgba(62, 207, 142, .12); border-color: var(--success); color: var(--success); }

/* ===== Сводка стоимости ===== */
.cost-summary { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.cost-summary > div { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.cost-summary .cost-total { font-size: 15px; font-weight: 700; border-top: 1px solid var(--border); padding-top: 9px; }

.detail-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

/* ===== Приоритеты ===== */
.priority-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.prio-pill {
  padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: .15s;
}
.prio-pill:hover { border-color: var(--border-strong); }
.prio-pill-active { border-color: var(--pc, var(--steel)); color: var(--pc, var(--steel)); background: color-mix(in srgb, var(--pc, var(--steel)) 15%, transparent); }

/* ===== Склад ===== */
.qty-adjust { display: flex; align-items: center; gap: 4px; }

/* ===== Цех: Сварка / Сборка ===== */
.workshop-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.workshop-head .view-title { margin-bottom: 2px; }
.workshop-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.wstat { display: inline-flex; align-items: baseline; gap: 5px; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 5px 10px; }
.wstat b { color: var(--text); font-family: "IBM Plex Sans", "Manrope ERP", sans-serif; font-size: 13px; }
.wgroup { display: flex; align-items: center; gap: 8px; margin: 18px 2px 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.wgroup::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.wgroup-cnt { color: var(--steel); }
.wpos { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 11px 14px; margin-bottom: 8px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.wpos:hover { border-color: var(--border-strong); }
.wpos.done { opacity: .55; }
.wcheck { flex: 0 0 22px; height: 22px; border: 2px solid var(--border-strong); border-radius: 6px; display: flex; align-items: center; justify-content: center; color: #1a1204; font-size: 13px; font-weight: 800; }
.wpos.done .wcheck { background: var(--steel); border-color: var(--steel); }
.w-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.w-name { font-size: 14px; font-weight: 700; }
.w-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.w-qty { font-size: 15px; font-weight: 800; color: var(--steel); white-space: nowrap; }
.w-zp { font-size: 13.5px; font-weight: 800; color: var(--success); white-space: nowrap; font-variant-numeric: tabular-nums; }
.w-prog { font-family: "IBM Plex Sans", "Manrope ERP", sans-serif; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.deadline { font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 20px; white-space: nowrap; border: 1px solid transparent; }
.deadline.urgent { background: rgba(248,113,113,.14); color: var(--danger); border-color: rgba(248,113,113,.4); }
.deadline.soon { background: rgba(245,166,35,.14); color: var(--steel); border-color: rgba(245,166,35,.4); }
.deadline.normal { background: rgba(91,140,255,.14); color: var(--blue); border-color: rgba(91,140,255,.4); }
/* ===== Список сварщика (drill-down позиции) ===== */
.weld-hint { background: rgba(245,166,35,.08); border: 1px solid rgba(245,166,35,.3); border-radius: 10px; padding: 9px 14px; font-size: 13px; color: var(--muted); margin: 8px 0 4px; }
.weld-hint b { color: var(--steel); }
.weld-item { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin-bottom: 8px; overflow: hidden; }
.weld-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; cursor: pointer; transition: background .15s; }
.weld-row:hover { background: var(--surface-2); }
.weld-chev { color: var(--steel); font-size: 13px; width: 12px; font-weight: 800; transition: transform .15s; }
.weld-item.open .weld-chev { transform: rotate(90deg); }
.weld-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.weld-name { font-size: 14.5px; font-weight: 700; }
.weld-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.weld-sub b { color: var(--text); font-weight: 600; }
.weld-qty { font-size: 14px; font-weight: 800; color: var(--steel); white-space: nowrap; font-variant-numeric: tabular-nums; }
.weld-zp { font-size: 14px; font-weight: 800; color: var(--success); white-space: nowrap; font-variant-numeric: tabular-nums; }
.weld-item.done { border-color: rgba(62,207,142,.35); }
.status-pill { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px; white-space: nowrap; border: 1px solid transparent; }
.status-pill.ok { background: rgba(62,207,142,.14); color: var(--success); border-color: rgba(62,207,142,.4); }
.status-pill.doing { background: rgba(245,166,35,.14); color: var(--steel); border-color: rgba(245,166,35,.4); }
.weld-part { border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); margin-bottom: 10px; padding: 10px 12px; }
.weld-part-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.weld-part-name { font-size: 14px; font-weight: 700; }
.weld-part-done { font-size: 12px; font-weight: 700; color: var(--success); white-space: nowrap; }
.weld-part-done.muted { color: var(--faint); }
.weld-detail { border-top: 1px solid var(--border); padding: 12px 14px 14px 38px; }
.weld-dlbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); margin: 6px 0 8px; }
.weld-cut { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; margin-bottom: 10px; }
.weld-cut-head { font-size: 12.5px; font-weight: 700; color: var(--steel); margin-bottom: 5px; }
.weld-cut-row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); padding: 2.5px 0; }
.weld-met { color: var(--text); font-weight: 600; }
.weld-cut-total { border-top: 1px dashed var(--border-strong); margin-top: 6px; padding-top: 6px; font-size: 12.5px; color: var(--text); }
.weld-cut-total b { color: var(--steel); }
.weld-ticks { display: flex; flex-wrap: wrap; gap: 8px; }
.weld-ticks .tick { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); cursor: pointer; padding: 5px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); transition: .15s; }
.weld-ticks .tick:hover { border-color: var(--border-strong); }
.weld-ticks .tick.read-only { cursor: default; opacity: .85; }
.weld-ticks .tick.read-only:hover { border-color: var(--border); }
.weld-ticks .tick .box { width: 16px; height: 16px; border: 2px solid var(--border-strong); border-radius: 4px; position: relative; }
.weld-ticks .tick.done .box { background: var(--steel); border-color: var(--steel); }
.weld-ticks .tick.done .box::after { content: "✓"; color: #1a1204; font-size: 11px; font-weight: 800; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.acard { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
.acard-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; transition: background .15s; }
.acard-head:hover { background: var(--surface-2); }
.achev { color: var(--steel); font-size: 12px; width: 14px; font-weight: 800; }
.acard-body { border-top: 1px solid var(--border); padding: 12px 14px 14px; }
.dlbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); margin: 6px 0 8px; }
.astep { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; cursor: pointer; transition: .15s; }
.astep:hover { border-color: var(--border-strong); }
.astep.done { opacity: .5; }
.astep .wcheck { flex: 0 0 20px; height: 20px; }
.astep .w-main { font-size: 13px; }
.tech-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.tech-row:last-child { border-bottom: none; }
.tech-row span:first-child { color: var(--muted); }
.tech-row .tech-v { color: var(--text); font-weight: 600; text-align: right; }

/* ===== Настройки ===== */
.settings-list { list-style: none; margin: 0 0 12px; padding: 0; }
.settings-list li {
  display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border);
}
.settings-list li:last-child { border-bottom: none; }
.settings-list li > span:first-child { flex: 1; font-size: 13.5px; }
.settings-list .input { max-width: 180px; padding: 7px 10px; font-size: 13.5px; }

.confirm-row { display: inline-flex; align-items: center; gap: 8px; }
.confirm-question { color: var(--danger); font-weight: 600; font-size: 14px; }

/* ===== Адаптивность (мобильные) ===== */
@media (max-width: 760px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .dash-grid { grid-template-columns: 1fr; gap: 14px; }
  .field-row { flex-direction: column; gap: 0; }
  .modal { max-height: 96vh; }
  .modal-backdrop { padding: 8px; align-items: flex-end; }
  .modal, .modal-wide { border-radius: 16px 16px 0 0; }
  .order-row { flex-direction: column; align-items: stretch; }
  .order-row-track { overflow-x: auto; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-box { min-width: 0; }
  .app-subtitle { display: none; }
  .view-pad { padding: 14px; }
  .material-add-row, .spec-add-row { flex-wrap: wrap; }
  .spec-input-narrow { flex: 1; min-width: 60px; }
  .mini-table, .data-table { font-size: 12.5px; }
  .stage-chip-label { display: none; }
  .stage-chip-md { padding: 7px 9px; }
  .tab-btn { padding: 8px 11px; font-size: 13px; }
  .app-layout { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); padding: 8px 10px; }
  .side-nav { flex-direction: row; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .side-nav .tab-btn { width: auto; justify-content: center; padding: 8px 11px; }

  /* Убираем горизонтальный overflow всей страницы */
  html, body { overflow-x: hidden; }
  .app-main { overflow-x: hidden; }

  /* Таблицы скроллятся внутри себя, а не растягивают экран */
  .data-table, .mini-table, .ops-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Кабинет сварщика: боковое меню → строка сверху */
  .welder-cabinet { flex-direction: column; }
  .welder-side { width: 100%; flex: none; border-right: none; border-bottom: 1px solid var(--border); padding: 10px 12px; }
  .welder-logo { padding: 0 4px 10px; }
  .welder-nav { flex-direction: row; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 2px; }
  .welder-nav button { white-space: nowrap; padding: 8px 10px; }
  .welder-user { display: none; }
  .welder-main { padding: 14px; }
  .welder-topbar { flex-wrap: wrap; gap: 8px; }
  .welder-salary-grid { grid-template-columns: 1fr; }

  /* Карточки сварки: кнопки и метки переносятся */
  .weld-row { flex-wrap: wrap; }
  .weld-photo-thumb { width: 60px; height: 60px; }
  .workshop-head { align-items: flex-start; }
}

/* ===== Дашборд: метрики как в макете ===== */
.kpi-card { position: relative; }
.kpi-idx {
  position: absolute; top: 10px; right: 12px;
  font-family: "IBM Plex Sans", "Manrope ERP", sans-serif; font-size: 10px; color: var(--faint); letter-spacing: 1px;
}
.kpi-unit { font-family: "IBM Plex Sans", "Manrope ERP", sans-serif; font-size: 13px; color: var(--muted); font-weight: 500; }
.k-delta { margin-top: 7px; font-family: "IBM Plex Sans", "Manrope ERP", sans-serif; font-size: 11px; color: var(--faint); }

.hrows { display: flex; flex-direction: column; gap: 15px; }
.hrow .h-top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 6px; }
.hrow .h-name { color: var(--muted); }
.hrow .h-num { font-family: "IBM Plex Sans", "Manrope ERP", sans-serif; font-weight: 600; }
.h-track { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.h-fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--accent), var(--steel-strong)); }

.stock-row { display: flex; align-items: center; gap: 12px; font-size: 13px; padding: 9px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 8px; }
.stock-row .s-name { flex: 1; }
.stock-row .s-qty { font-family: "IBM Plex Sans", "Manrope ERP", sans-serif; font-size: 13px; }
.stock-row .s-qty.low { color: var(--danger); font-weight: 600; }
.stock-row .s-qty.mid { color: var(--accent); font-weight: 600; }
.badge.red { background: rgba(248, 113, 113, .14); color: var(--danger); }
.badge.amber { background: rgba(245, 166, 35, .14); color: var(--accent); }

/* ===== Чат сотрудников ===== */
.chat { display: flex; flex-direction: column; height: 100%; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid #1c2430; }
.chat-head-left { display: flex; align-items: center; gap: 10px; }
.chat-head h3 { font-size: 16px; font-weight: 600; }
.chat-members { font-size: 12px; color: #7a8699; }
.chat-head-right { display: flex; align-items: center; gap: 8px; }
.chat-sound-btn { display: flex; align-items: center; gap: 5px; padding: 6px 10px; font-size: 12px; border: 1px solid #2a3442; color: #2ecc71; background: #141b25; border-radius: 6px; cursor: pointer; }
.chat-sound-btn.off { color: #7a8699; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.day-sep { display: flex; align-items: center; gap: 12px; color: #5b6778; font-size: 11px; }
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: #1c2430; }
.msg { max-width: 72%; }
.msg-own { align-self: flex-end; }
.msg-mentioned { border-left: 3px solid #f5a623; padding-left: 10px; }
.msg-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; font-size: 12px; }
.msg-own .msg-head { flex-direction: row-reverse; }
.msg-name { font-weight: 600; }
.msg-role { font-size: 10px; color: #7a8699; padding: 1px 6px; border: 1px solid #2a3442; border-radius: 4px; }
.msg-time { font-size: 10.5px; color: #5b6778; }
.msg-bubble { display: inline-block; padding: 9px 13px; font-size: 13.5px; line-height: 1.45; background: #141b25; border: 1px solid #1e2836; border-radius: 12px; border-top-left-radius: 4px; }
.msg-own .msg-bubble { background: #1a2a1f; border-color: #23492f; border-radius: 12px; border-top-right-radius: 4px; }
.msg-attach { margin-top: 8px; border-radius: 10px; overflow: hidden; border: 1px solid #2a3442; }
.msg-attach img { display: block; width: 100%; max-width: 360px; height: auto; }
.msg-file { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #141b25; font-size: 12.5px; color: #c9d4e0; }
.chat-input { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-top: 1px solid #1c2430; position: relative; }
.chat-attach-btn { width: 42px; height: 42px; font-size: 20px; border: 1px solid #2a3442; color: #9aa7b8; background: #141b25; border-radius: 10px; cursor: pointer; }
.chat-input-box { flex: 1; height: 42px; padding: 0 14px; font-size: 14px; color: #e6edf3; background: #0c1017; border: 1px solid #2a3442; border-radius: 10px; outline: none; }
.chat-input-box:focus { border-color: #f5a623; }
.chat-send-btn { width: 42px; height: 42px; font-size: 18px; border: none; color: #0c1017; background: #f5a623; border-radius: 10px; cursor: pointer; font-weight: 700; }
.chat-mention-list { position: absolute; bottom: 66px; left: 20px; max-width: 320px; background: #141b25; border: 1px solid #2a3442; border-radius: 10px; overflow: hidden; z-index: 20; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.chat-mention-item { display: flex; align-items: center; gap: 8px; padding: 9px 14px; font-size: 13.5px; cursor: pointer; }
.chat-mention-item:hover { background: #1a2230; }
.chat-mention-role { font-size: 10.5px; color: #7a8699; }

/* ===== Чат: привязка к заказу ===== */
.chat-order-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; font-size: 12.5px; background: #1a2230; border: 1px solid #f5a623; color: #f5a623; border-radius: 6px; white-space: nowrap; }
.chat-order-x { border: none; background: transparent; color: #f5a623; cursor: pointer; font-size: 13px; padding: 0 2px; }
.chat-order-list { position: absolute; bottom: 66px; left: 20px; max-width: 360px; max-height: 260px; overflow-y: auto; background: #141b25; border: 1px solid #2a3442; border-radius: 10px; z-index: 21; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.chat-order-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; font-size: 13.5px; cursor: pointer; }
.chat-order-item:hover { background: #1a2230; }
.chat-order-item .chat-order-num { color: #f5a623; font-weight: 600; white-space: nowrap; }
.chat-order-item .chat-order-client { color: #7a8699; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-order { display: inline-block; margin-bottom: 5px; padding: 3px 9px; font-size: 11.5px; background: #1a2230; border: 1px solid #2a3442; color: #f5a623; border-radius: 6px; }

/* ===== Кабинет сварщика ===== */
.welder-cabinet { display: flex; min-height: 100vh; }
.welder-side { width: 216px; flex: 0 0 216px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 16px 12px; }
.welder-logo { font-family: "Manrope ERP", sans-serif; font-size: 20px; font-weight: 700; padding: 0 8px 14px; }
.welder-logo span { color: var(--steel); }
.welder-nav { display: flex; flex-direction: column; gap: 3px; }
.welder-nav button { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: 13.5px; background: transparent; border: none; cursor: pointer; text-align: left; font-family: inherit; }
.welder-nav button.active { background: var(--surface-2); color: var(--text); box-shadow: inset 2px 0 0 var(--steel); }
.welder-nav-badge { margin-left: auto; background: var(--steel); color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.welder-user { margin-top: auto; padding: 10px 11px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.welder-user b { color: var(--text); }
.welder-main { flex: 1; padding: 20px 24px; }
.welder-salary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.welder-salary-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.welder-salary-card span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.welder-salary-card b { font-family: "IBM Plex Sans", "Manrope ERP", sans-serif; font-size: 22px; color: var(--steel); }

.welder-logout { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 6px 10px; font-size: 12px; font-weight: 600; color: var(--muted); background: transparent; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-family: inherit; }
.welder-logout:hover { color: var(--text); border-color: var(--border-strong); }

.welder-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.welder-top-title { font-family: "Manrope ERP", sans-serif; font-size: 20px; font-weight: 700; }
.welder-logout.top { margin-top: 0; }
.weld-problem-btn { margin-left: 2px; padding: 6px 11px; font-size: 12px; font-weight: 700; color: var(--danger); background: transparent; border: 1px solid rgba(248, 113, 113, .4); border-radius: 8px; cursor: pointer; white-space: nowrap; transition: .15s; font-family: inherit; }
.weld-problem-btn:hover { background: rgba(248, 113, 113, .1); border-color: var(--danger); }
.problem-option { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px; margin-bottom: 7px; cursor: pointer; font-size: 13.5px; color: var(--text); transition: .15s; }
.problem-option:hover { border-color: var(--border-strong); }
.problem-option input { accent-color: var(--steel); }
.problem-textarea { margin-top: 4px; }
.weld-photo-btn { margin-left: 2px; padding: 6px 11px; font-size: 12px; font-weight: 700; color: var(--steel); background: transparent; border: 1px solid rgba(245, 166, 35, .45); border-radius: 8px; cursor: pointer; white-space: nowrap; transition: .15s; font-family: inherit; }
.weld-photo-btn:hover:not(:disabled) { background: rgba(245, 166, 35, .12); border-color: var(--steel); }
.weld-photo-btn:disabled { opacity: .55; cursor: default; }
.weld-photos { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 14px 12px; }
.weld-photo-thumb { width: 76px; height: 76px; object-fit: cover; border-radius: 9px; border: 1px solid var(--border); cursor: pointer; background: var(--surface-2); transition: transform .12s; }
.weld-photo-thumb:hover { transform: scale(1.04); border-color: var(--steel); }
.weld-photo-wrap { position: relative; }
.weld-photo-del { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: none; background: var(--danger, #e5484d); color: #fff; font-size: 11px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.weld-photo-del:hover { background: #c8323a; }
.photo-lightbox { position: relative; max-width: min(92vw, 860px); max-height: 90vh; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.photo-lightbox-img { max-width: 100%; max-height: 74vh; object-fit: contain; border-radius: 9px; }
.photo-lightbox-meta { font-size: 13px; color: var(--muted, #9aa7b8); }
.photo-lightbox-close { position: absolute; top: 10px; right: 10px; }
.weld-toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); background: var(--steel); color: #fff; padding: 9px 16px; border-radius: 9px; font-size: 13.5px; font-weight: 600; box-shadow: 0 6px 24px rgba(0,0,0,.35); z-index: 999; animation: weldToastIn .2s ease; }
@keyframes weldToastIn { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ===== Чертежи (база знаний) ===== */
.drawings-list { display: flex; flex-direction: column; gap: 14px; }
.drawing-group .wgroup { margin-bottom: 8px; }
.drawing-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; text-decoration: none; color: var(--text); margin-bottom: 6px; transition: border-color .15s; }
.drawing-row:hover { border-color: var(--steel); }
.drawing-name { font-weight: 600; font-size: 14px; }
.drawing-open { color: var(--steel); font-weight: 700; font-size: 13px; }

/* ===== Заставка (splash) при запуске ===== */
#splash {
  position: fixed; inset: 0; z-index: 10000;
  background: var(--bg);
  background-image: var(--bg-grad);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px;
  transition: opacity .22s ease, visibility .22s;
}
#splash.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-logo {
  width: 200px; height: 200px; border-radius: 44px; overflow: hidden;
  box-shadow: 0 16px 46px rgba(244, 101, 47, .4);
  animation: splashPulse 1.8s ease-in-out infinite;
}
.splash-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.splash-name {
  font-family: "Manrope ERP", sans-serif; font-size: 26px; font-weight: 800; letter-spacing: .06em;
  color: var(--text);
}
.splash-name span { color: var(--steel); }
@keyframes sloganIn {
  0% { opacity: 0; transform: translateY(8px); filter: blur(2px); }
  100% { opacity: 1; transform: none; filter: blur(0); }
}
.splash-slogan span { display: inline-block; opacity: 0; animation: sloganIn .4s cubic-bezier(.22,.61,.36,1) forwards; }
.splash-slogan {
  font-family: "Manrope ERP", sans-serif; font-size: 19px; font-weight: 700;
  letter-spacing: .01em; color: var(--text); opacity: .95; margin-top: 20px; text-align: center;
}
.splash-slogan .slogan-accent { color: var(--steel); }
.splash-track {
  width: 168px; height: 4px; border-radius: 3px; overflow: hidden;
  background: var(--surface-2); margin-top: 4px;
}
.splash-track i {
  display: block; height: 100%; width: 42%; border-radius: 3px;
  background: linear-gradient(90deg, var(--steel), var(--steel-strong));
  animation: splashLoad 1.3s ease-in-out infinite;
}
@keyframes splashPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 16px 46px rgba(244, 101, 47, .35); }
  50% { transform: scale(1.06); box-shadow: 0 20px 58px rgba(244, 101, 47, .55); }
}
@keyframes splashLoad {
  0% { transform: translateX(-120%); }
  50% { transform: translateX(150%); }
  100% { transform: translateX(280%); }
}


/* ===== адаптив: запрет горизонтальной прокрутки ===== */
html, body { max-width: 100%; overflow-x: hidden; }
img, video, canvas, iframe, svg { max-width: 100%; }
.tbl-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dash-grid, .kpi-grid, .field-row, .row { max-width: 100%; }

@media (max-width: 640px) {
  .view-pad { padding: 12px 12px 40px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .field-row { flex-wrap: wrap; }
  .field-row .field { flex: 1 1 100%; }
  .tab-bar { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .app-title { font-size: 15px; }
  .login-card { padding: 22px 16px; }
  table { font-size: 12px; }
  th, td { padding: 7px 8px; }
  .btn { padding: 9px 12px; }
}
@media (min-width: 641px) and (max-width: 1100px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== шапка в две строки на мобильных ===== */
@media (max-width: 640px) {
  .app-header { flex-wrap: wrap; gap: 8px; padding-top: 10px; padding-bottom: 8px; }
  .app-header-left { flex: 1 1 100%; }
  .app-header-right, .header-actions { flex: 1 1 100%; justify-content: space-between; gap: 6px; }
  .save-indicator { display: none; }
  .app-subtitle { display: none; }
  .app-header .logout-btn, .app-header button { font-size: 11.5px; padding: 6px 8px; white-space: nowrap; }
}

/* ===== мобильная версия: нижняя навигация и компактная шапка ===== */
@media (max-width: 640px) {
  .app-header { position: sticky; top: 0; z-index: 70; flex-wrap: nowrap; gap: 6px; padding: 8px 12px; }
  .app-header-left { flex: 1 1 auto; min-width: 0; }
  .app-title { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .app-subtitle, .save-indicator { display: none !important; }
  .app-header .logout-btn:first-of-type { display: none; } /* «Заморозить» — только в настройках */

  .tab-bar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch;
    background: var(--surface); border-top: 1px solid var(--border);
    z-index: 60; gap: 2px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    scrollbar-width: none;
  }
  .tab-bar::-webkit-scrollbar { display: none; }
  .tab-btn {
    flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 3px;
    min-width: 62px; padding: 7px 8px; font-size: 10px; border-radius: 10px;
    line-height: 1.1; text-align: center;
  }
  .tab-btn svg { width: 20px; height: 20px; }

  .view-pad { padding: 12px 12px 96px; }
  main, .erp-root { padding-bottom: 0; }

  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .dash-grid { grid-template-columns: 1fr; gap: 10px; }
  .field-row { flex-direction: column; gap: 10px; }
  .field-row .field { width: 100%; }
  .tbl-wrap { border-radius: 10px; }
  table { min-width: 560px; }
  .btn { min-height: 42px; font-size: 14px; }
  input, select, textarea { min-height: 44px; font-size: 16px; }
}

/* ===== мобильная нижняя навигация (sidebar → bottom bar) ===== */
@media (max-width: 640px) {
  .app-layout { display: block; }
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: 100%;
    z-index: 60; background: var(--surface); border-top: 1px solid var(--border);
    border-right: 0; padding: 0;
  }
  .side-nav {
    display: flex; flex-direction: row; gap: 2px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-nav .tab-btn {
    flex: 0 0 auto; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; min-width: 64px; padding: 7px 8px; font-size: 10px; line-height: 1.1;
    text-align: center; border-radius: 10px;
  }
  .side-nav .tab-btn svg { width: 20px; height: 20px; }
  .app-main { padding-bottom: 92px; }
}

/* ===== Дашборд V22 (наша палитра) ===== */
.v22 { display: flex; flex-direction: column; gap: 14px; }
.v22-head { display: flex; justify-content: space-between; align-items: center; }
.v22-hello h1 { font-size: 22px; margin: 0 0 3px; font-weight: 750; letter-spacing: -.01em; }
.v22-hello p { margin: 0; color: var(--muted); font-size: 12.5px; }
.v22-grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.v22-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 14px; }
.v22-kpi .l { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.v22-kpi .v { font-size: 26px; font-weight: 750; margin: 8px 0 4px; letter-spacing: -.02em; }
.v22-kpi .d { font-size: 12px; color: var(--muted); }
.v22-tint { background: linear-gradient(180deg, rgba(245,166,35,.16), var(--surface) 70%); }
.v22-tint2 { background: linear-gradient(180deg, rgba(244,101,47,.16), var(--surface) 70%); }
.v22-cols3 { display: grid; grid-template-columns: 1.2fr .9fr 1fr; gap: 12px; }
.v22-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.v22-h h2 { font-size: 13px; font-weight: 700; margin: 0; }
.v22-h span { font-size: 11.5px; color: var(--muted); }
.v22-list { display: flex; flex-direction: column; gap: 8px; }
.v22-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; background: var(--surface-2); }
.v22-av { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: #1a1206; background: var(--steel); flex: 0 0 auto; }
.v22-item .t { flex: 1; min-width: 0; }
.v22-item .t b { display: block; font-size: 12.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v22-item .t span { font-size: 11px; color: var(--muted); }
.v22-tag { font-size: 10.5px; padding: 3px 7px; border-radius: 999px; background: rgba(245,166,35,.18); color: var(--steel); white-space: nowrap; }
.v22-tag.w { background: rgba(245,166,35,.14); color: var(--steel); }
.v22-tag.b { background: rgba(229,72,77,.18); color: var(--danger); }
.v22-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; font-size: 11px; }
.v22-cal i { font-style: normal; color: var(--muted); text-align: center; padding: 3px 0; }
.v22-cal b { font-weight: 600; text-align: center; padding: 5px 0; border-radius: 7px; }
.v22-cal b.today { background: var(--steel); color: #1a1206; }
.v22-cal b.dot { position: relative; }
.v22-cal b.dot::after { content: ""; position: absolute; left: 50%; bottom: 1px; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; background: var(--danger); }
.v22-bars { display: flex; flex-direction: column; gap: 8px; }
.v22-bar { display: grid; grid-template-columns: 88px 1fr 30px; gap: 8px; align-items: center; font-size: 11.5px; color: var(--muted); }
.v22-bar .tr { height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.v22-bar .fi { height: 100%; border-radius: 999px; background: var(--steel); }
.v22-bar .fi.hot { background: var(--danger); }
.v22-bar b { font-size: 11.5px; color: var(--text); text-align: right; }
.v22-team { display: flex; gap: 8px; flex-wrap: wrap; }
.v22-mem { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 58px; }
.v22-mem .a { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font-weight: 750; font-size: 12px; color: #1a1206; }
.v22-mem span { font-size: 10px; color: var(--muted); text-align: center; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 58px; }
@media (max-width: 900px) { .v22-grid4 { grid-template-columns: 1fr 1fr; } .v22-cols3 { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .v22-hello h1 { font-size: 19px; } .v22-kpi .v { font-size: 21px; } .v22-card { padding: 12px; border-radius: 16px; } }

/* ===== выбор сферы в форме ===== */
.sphere-picker { position: relative; }
.sphere-picker-btn { display: flex; justify-content: space-between; align-items: center; width: 100%; cursor: pointer; }
.sphere-panel {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 80;
  max-height: 320px; overflow-y: auto; padding: 8px;
  background: var(--panel-solid, #141b25); border: 1px solid var(--border-strong, var(--border));
  border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.55);
}
.sphere-group {
  font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
  padding: 8px 8px 4px;
}
.sphere-opt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; text-align: left; padding: 9px 10px; border: 0; border-radius: 10px;
  background: transparent; color: var(--text); font-size: 13px; cursor: pointer;
}
.sphere-opt:hover, .sphere-opt.on { background: var(--surface-2); }
.sphere-opt.on { box-shadow: inset 0 0 0 1px var(--steel); }
.sphere-cap { font-size: 10.5px; color: var(--muted); line-height: 1.2; }

html[data-theme="light"] { --panel-solid: #ffffff; }

/* ===== кнопка «Обновить» на мобильных ===== */
@media (max-width: 640px) {
  .app-header .logout-btn { display: none !important; }
  .app-header .refresh-btn {
    display: inline-flex !important; align-items: center; justify-content: center;
    width: 38px; height: 38px; padding: 0; border-radius: 12px; font-size: 0;
    background: var(--surface-2); border: 1px solid var(--border);
  }
  .app-header .refresh-btn::before { content: "🔄"; font-size: 17px; }
}
