/* ============================================================
   Трекер ремонтов — светлая минималистичная тема
   Акцент: синий #2563eb и его оттенки
   ============================================================ */
:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #e6eaf2;
  --text: #1e2430;
  --muted: #7a8499;

  --blue: #2563eb;
  --blue-dark: #1e50c8;
  --blue-soft: #e8effd;
  --blue-softer: #f3f7fe;

  --shadow: 0 1px 2px rgba(30, 41, 59, .04), 0 4px 16px rgba(30, 41, 59, .06);
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(37, 99, 235, .07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Верхняя панель ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 12px 24px;
  position: sticky; top: 0; z-index: 10;
}
.topbar a { color: #46536b; text-decoration: none; font-size: 14px; transition: all .15s; }
.topbar a:hover { color: var(--blue); }
.topbar .logo { font-weight: 700; font-size: 16px; color: var(--text); white-space: nowrap; }
.topbar .logo::first-letter { color: var(--blue); }
.topbar nav { display: flex; align-items: center; justify-content: flex-end; gap: 4px; flex-wrap: wrap; }
.topbar nav > a { padding: 8px 11px; border-radius: 9px; font-weight: 600; }
.topbar nav > a:hover, .topbar nav > a.active { color: var(--blue); background: var(--blue-soft); }
.topbar .user { display: flex; align-items: center; gap: 5px; color: var(--muted);
  font-size: 13px; margin-left: 8px; padding-left: 12px; border-left: 1px solid var(--line); }
.topbar .user-name { white-space: nowrap; }
.topbar .user a { color: var(--blue); padding: 7px 8px; border-radius: 8px; white-space: nowrap; }
.topbar .user a:hover { background: var(--blue-soft); }
.topbar .user .logout-link { color: #b91c1c; }
.topbar .user .logout-link:hover { background: #fef1f1; }

/* ---------- Основная навигация сотрудников ---------- */
.main-nav-wrap { max-width: 1140px; margin: 20px auto -8px; padding: 0 20px; }
.main-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 8px; }
.main-tab { padding: 10px 11px; gap: 8px; }
.main-tab .tab-icon { width: 32px; height: 32px; border-radius: 9px; font-size: 15px; }
.main-tab .tab-text strong { font-size: 13px; }
.main-tab .tab-text small { font-size: 11px; }

/* ---------- Клиентский кабинет ---------- */
@font-face {
  font-family: "Jost"; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url("fonts/jost-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Jost"; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url("fonts/jost-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2191, U+2193;
}
.client-head { margin-bottom: 20px; }
.client-head h1 { margin: 3px 0 6px; font-size: 26px; }
.client-head p { margin: 0; }
.eyebrow { color: var(--blue); font-size: 12px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; }
.client-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.client-theme .client-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.client-tab { display: flex; align-items: center; gap: 11px; min-width: 0;
  padding: 15px; background: var(--panel); color: var(--text); text-decoration: none;
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s, transform .15s; }
.client-tab:hover { border-color: #b8c9ed; box-shadow: 0 5px 18px rgba(37, 99, 235, .11); transform: translateY(-1px); }
.client-tab.active { border-color: var(--blue); background: var(--blue-softer);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .09), var(--shadow); }
.tab-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: none;
  border-radius: 11px; background: var(--blue-soft); color: var(--blue); font-size: 18px; font-weight: 700; }
.tab-icon.ready { background: #dcf5e5; color: #15803d; }
.tab-icon.work { background: #fef3d8; }
.tab-icon.history { background: #eef1f5; color: #64748b; }
.tab-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.tab-text strong { font-size: 14px; }
.tab-text small { color: var(--muted); font-size: 12px; }
.client-tab .badge { flex: none; }
.client-panel { padding-top: 18px; padding-bottom: 0; overflow: hidden; }
.client-panel .page-head { margin-bottom: 14px; }
.client-panel h2 { font-size: 18px; margin-bottom: 4px; }
.client-panel .page-head p { margin: 0; }
.client-panel .grid { margin-bottom: 0; }
.date-cell { white-space: nowrap; }

/* Айдентика Витма-Сервис — только для клиентского кабинета. */
.client-theme {
  --client-navy: #17243b;
  --client-blue: #5274df;
  --client-muted: #6e7d94;
  font-family: "Jost", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--client-navy);
  background: #f7f9fd;
}
.client-theme .topbar {
  min-height: 76px; padding: 13px max(24px, calc((100vw - 1140px) / 2));
  background: rgba(255, 255, 255, .96); border-bottom: 1px solid #e7edf6;
}
.client-theme .topbar .logo { display: flex; align-items: center; gap: 16px; }
.client-theme .brand-logo { display: block; width: 126px; height: auto; }
.client-theme .brand-divider { width: 1px; height: 28px; background: #dfe6f1; }
.client-theme .brand-section { color: #52627b; font-size: 14px; font-weight: 500; }
.client-theme .topbar a { font-family: inherit; }
.client-theme .topbar nav > a.active {
  padding: 9px 15px; border-radius: 10px; color: #fff;
  background: linear-gradient(110deg, #5274df, #6579e8);
  box-shadow: 0 6px 16px rgba(82, 116, 223, .2);
}
.client-theme .topbar .user { color: var(--client-muted); }
.client-theme .topbar .user a { color: #34549b; }
.client-theme .topbar .user .logout-link { color: #a44b58; }
.client-theme .container { max-width: 1180px; margin-top: 26px; }
.client-hero {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 34px;
  min-height: 230px; padding: 38px 42px; margin-bottom: 20px;
  border: 1px solid rgba(82, 116, 223, .09); border-radius: 20px;
  background-image: linear-gradient(rgba(255,255,255,.56), rgba(255,255,255,.56)),
    linear-gradient(115deg, #d9e8ff 0%, #a9c4ff 38%, #d9d5ff 72%, #b9dcff 100%);
  box-shadow: 0 12px 30px rgba(35, 65, 120, .075);
}
.client-hero::after {
  content: ""; position: absolute; z-index: -1; width: 340px; height: 340px;
  right: 170px; top: -210px; border: 1px solid rgba(82, 116, 223, .13);
  border-radius: 50%; box-shadow: 0 0 0 45px rgba(82,116,223,.035), 0 0 0 90px rgba(82,116,223,.025);
}
.client-hero-copy { max-width: 650px; }
.client-theme .client-hero .eyebrow { margin-bottom: 12px; color: #34549b; font-size: 11px; letter-spacing: 1.3px; }
.client-theme .client-hero h1 { margin: 0 0 12px; color: var(--client-navy); font-size: 38px; line-height: 1.12; letter-spacing: -.8px; font-weight: 700; }
.client-hero-copy > p { max-width: 560px; margin: 0; color: #5f708a; font-size: 17px; line-height: 1.55; }
.client-hero-summary {
  display: flex; flex-direction: column; align-items: flex-start; flex: none;
  width: 205px; padding: 22px 24px; border: 1px solid rgba(255,255,255,.75);
  border-radius: 16px; background: rgba(255,255,255,.72); color: var(--client-navy);
  text-decoration: none; box-shadow: 0 8px 25px rgba(35,65,120,.07);
  transition: transform .18s, box-shadow .18s;
}
.client-hero-summary:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(35,65,120,.12); }
.hero-summary-label { color: #34549b; font-size: 10px; font-weight: 700; letter-spacing: 1.1px; text-transform: uppercase; }
.client-hero-summary > strong { margin: 5px 0 -2px; color: #2859a7; font-size: 52px; line-height: 1.15; }
.hero-summary-unit { color: var(--client-muted); font-size: 13px; }
.hero-summary-link { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 18px; padding-top: 13px; border-top: 1px solid #dce5f3; color: #34549b; font-size: 13px; font-weight: 600; }
.hero-summary-link b { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 50%; background: #5274df; color: #fff; }
.client-theme .client-tabs { gap: 16px; margin-bottom: 20px; }
.client-theme .client-tab {
  position: relative; overflow: hidden; min-height: 112px; padding: 22px;
  border: 1px solid #e2e9f3; border-radius: 20px; background: #fff;
  box-shadow: 0 8px 25px rgba(20,42,83,.055);
}
.client-theme .client-tab:hover { border-color: #b8c9ed; box-shadow: 0 12px 28px rgba(20,42,83,.1); transform: translateY(-2px); }
.client-theme .client-tab.active {
  color: #fff; border: 1px solid rgba(255,255,255,.16);
  background: linear-gradient(135deg, #142b55 0%, #2859a7 100%);
  box-shadow: 0 8px 25px rgba(20,42,83,.16);
}
.client-theme .client-tab.active::after {
  content: ""; position: absolute; width: 150px; height: 150px; right: -70px; bottom: -95px;
  border: 1px solid rgba(255,255,255,.12); border-radius: 50%; box-shadow: 0 0 0 25px rgba(255,255,255,.025);
}
.client-theme .client-tab .tab-icon { width: 42px; height: 42px; border-radius: 12px; background: #edf3ff; color: #34549b; }
.client-theme .client-tab .tab-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.client-theme .client-tab.active .tab-icon { color: #fff; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.16); }
.client-theme .client-tab .tab-text { gap: 5px; }
.client-theme .client-tab .tab-text strong { font-size: 17px; line-height: 1.2; }
.client-theme .client-tab .tab-text small { color: var(--client-muted); font-size: 12px; }
.client-theme .client-tab.active .tab-text small { color: rgba(255,255,255,.68); }
.client-theme .client-tab .badge { min-width: 34px; padding: 5px 10px; text-align: center; background: #edf3ff; color: #34549b; }
.client-theme .client-tab.active .badge { color: #fff; background: rgba(255,255,255,.14); }
.client-theme .client-panel { padding: 25px 26px 0; border: 1px solid #e2e9f3; border-radius: 20px; box-shadow: 0 8px 25px rgba(20,42,83,.06); }
.client-theme .client-panel.highlight { border-color: #dce8e3; background: #fff; }
.client-theme .client-panel .page-head { margin-bottom: 20px; }
.client-theme .client-panel h2 { margin-bottom: 5px; color: var(--client-navy); font-size: 23px; letter-spacing: -.25px; }
.client-theme .client-panel .hint { color: var(--client-muted); font-size: 14px; }
.client-theme .client-panel .page-head > .badge { flex: none; padding: 5px 13px; color: #34549b; background: #edf3ff; white-space: nowrap; }
.client-table-wrap { width: 100%; overflow-x: auto; }
.client-theme .client-panel .grid { border: 1px solid #e5ebf4; box-shadow: none; border-radius: 14px; }
.client-theme .client-panel .grid th { padding: 13px 14px; background: #f5f8fd; color: #65758e; font-size: 10px; letter-spacing: .8px; }
.client-theme .client-panel .grid td { padding: 15px 14px; color: #2c3c55; border-bottom-color: #edf1f6; font-size: 14px; }
.client-theme .client-panel .grid tr.clickable:hover { background: #f5f8ff; }
.client-theme .client-panel .grid .mono { color: #244c91; font-size: 13px; font-weight: 500; }
.client-theme .client-panel .registration-address { overflow-wrap: anywhere; }
.client-theme .client-panel .empty { padding: 38px; color: var(--client-muted); }
.client-theme .status { font-family: "Segoe UI", sans-serif; font-size: 12px; }
@media (max-width: 980px) {
  .client-theme .client-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .topbar nav { justify-content: flex-start; }
  .topbar .user { margin-left: 0; padding-left: 0; border-left: none; }
  .client-theme .topbar { align-items: center; }
  .client-hero { padding: 32px; }
  .client-theme .client-tab { padding: 18px; }
  .client-theme .client-tab .tab-text strong { font-size: 15px; }
}
@media (max-width: 720px) {
  .client-tabs { grid-template-columns: 1fr; gap: 8px; }
  .client-theme .client-tabs { grid-template-columns: 1fr; }
  .main-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main-nav-wrap { margin-top: 14px; }
  .client-tab { padding: 12px 14px; }
  .topbar .user { flex-wrap: wrap; }
  .client-theme .topbar { position: relative; min-height: 0; padding: 15px 18px; gap: 12px; }
  .client-theme .topbar .logo { width: 100%; }
  .client-theme .brand-logo { width: 112px; }
  .client-theme .brand-section { font-size: 13px; }
  .client-theme .topbar nav { width: 100%; justify-content: space-between; gap: 8px; }
  .client-theme .topbar nav > a.active { display: none; }
  .client-theme .topbar .user { width: 100%; justify-content: space-between; gap: 4px; }
  .client-theme .topbar .user-name { margin-right: auto; }
  .client-theme .container { margin-top: 16px; padding: 0 14px; }
  .client-hero { align-items: stretch; flex-direction: column; gap: 24px; min-height: 0; padding: 27px 24px; }
  .client-theme .client-hero h1 { font-size: 29px; }
  .client-hero-copy > p { font-size: 15px; }
  .client-hero-summary { display: grid; grid-template-columns: 1fr auto; align-items: center; width: 100%; padding: 17px 19px; }
  .client-hero-summary > strong { grid-row: 1 / 3; grid-column: 2; font-size: 42px; }
  .hero-summary-link { grid-column: 1 / 3; margin-top: 12px; }
  .client-theme .client-tabs { gap: 10px; }
  .client-theme .client-tab { min-height: 88px; padding: 17px 18px; border-radius: 16px; }
  .client-theme .client-tab .tab-text strong { font-size: 17px; }
  .client-theme .client-panel { padding: 21px 16px 16px; border-radius: 18px; }
  .client-theme .client-panel h2 { font-size: 21px; }
  .client-theme .client-panel .page-head { align-items: flex-start; }
  .client-theme .client-panel .grid, .client-theme .client-panel .grid tbody { display: block; background: transparent; border: 0; }
  .client-theme .client-panel .grid thead { display: none; }
  .client-theme .client-panel .grid tr { display: block; padding: 9px 14px; margin-bottom: 10px; border: 1px solid #e3eaf4; border-radius: 13px; background: #f9fbfe; }
  .client-theme .client-panel .grid tr:last-child { margin-bottom: 0; }
  .client-theme .client-panel .grid td { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 8px 0; border: 0; text-align: right; }
  .client-theme .client-panel .grid td::before { content: attr(data-label); flex: none; color: #7b889d; font-size: 11px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; text-align: left; }
  .client-theme .client-panel .grid td.empty { display: block; padding: 25px 12px; text-align: center; }
  .client-theme .client-panel .grid td.empty::before { display: none; }
  .client-theme .client-panel .grid tr:has(td.empty) { padding: 0; }
}

.container { max-width: 1140px; margin: 28px auto; padding: 0 20px; }

h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 650; margin-top: 0; color: var(--text); }
h3 { font-size: 14px; color: var(--muted); }

.page-head { display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 16px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-block; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); padding: 8px 15px; border-radius: 10px; cursor: pointer;
  text-decoration: none; font-size: 14px; line-height: 1.4;
  transition: all .15s ease;
}
.btn:hover { border-color: var(--blue); color: var(--blue);
  box-shadow: 0 2px 8px rgba(37, 99, 235, .12); }
.btn.primary {
  background: linear-gradient(180deg, #3b74f0, var(--blue));
  border-color: var(--blue); color: #fff;
  box-shadow: 0 2px 10px rgba(37, 99, 235, .25);
}
.btn.primary:hover { background: linear-gradient(180deg, var(--blue), var(--blue-dark));
  color: #fff; box-shadow: 0 4px 14px rgba(37, 99, 235, .35); }
.btn.big { font-size: 15px; padding: 12px 22px; border-radius: 12px; }
.btn.danger { border-color: #f0c4c4; color: #b91c1c; background: #fff8f8; }
.btn.danger:hover { border-color: #dc2626; color: #991b1b; background: #fef1f1;
  box-shadow: 0 2px 8px rgba(185, 28, 28, .12); }
.btn:active { transform: translateY(1px); }

/* ---------- Бейджи и статусы ---------- */
.badge { background: var(--blue-soft); color: var(--blue); border-radius: 999px;
  padding: 2px 11px; font-size: 13px; font-weight: 600; }

.status { display: inline-block; padding: 3px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.st-new  { background: #e8effd; color: #1d4ed8; }              /* Принято — синий */
.st-diag { background: #f0eafd; color: #6d28d9; }              /* Диагностика — фиолет */
.st-work { background: #fef3d8; color: #b45309; }              /* В ремонте — янтарь */
.st-wait { background: #fdeadd; color: #c2410c; }              /* Ожидает запчасть — оранж */
.st-done { background: #dcf5e5; color: #15803d; }              /* Готово — зелёный */
.st-out  { background: #eef1f5; color: #64748b; }              /* Выдано — серый */
.st-dead { background: #fde4e4; color: #b91c1c; }              /* Неремонтопригодно — красный */

.mono { font-family: Consolas, "Cascadia Mono", monospace; }
.hint { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); text-align: center; padding: 28px; }

/* ---------- Флеш-сообщения ---------- */
.flash { padding: 11px 16px; border-radius: 12px; margin-bottom: 14px;
  font-size: 14px; box-shadow: var(--shadow); }
.flash.ok { background: #edfcf3; color: #15803d; border: 1px solid #c8f0d8; }
.flash.error { background: #fef1f1; color: #b91c1c; border: 1px solid #f6d5d5; }

/* ---------- Поле сканера ---------- */
.scan-line input {
  width: 100%; font-size: 17px; padding: 15px 18px;
  border: 2px solid var(--blue); border-radius: var(--radius);
  margin-bottom: 12px; background: var(--panel);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .08), var(--shadow);
  outline: none; transition: box-shadow .15s;
}
.scan-line input:focus { box-shadow: 0 0 0 5px rgba(37, 99, 235, .15), var(--shadow); }
.scan-line input::placeholder { color: #a5aec2; }

/* ---------- Фильтры ---------- */
.filters { display: flex; gap: 8px; margin: 12px 0 16px; flex-wrap: wrap; }
.filters input, .filters select {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); font-size: 14px; outline: none; transition: all .15s;
}
.filters input:focus, .filters select:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

/* ---------- Массовые действия ---------- */
.bulk-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 10px; box-shadow: var(--shadow);
  font-size: 13.5px;
}
.bulk-bar strong { color: var(--blue); min-width: 90px; }
.bulk-bar label { color: var(--muted); }
.bulk-bar select {
  padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); color: var(--text); font-size: 14px; outline: none;
}
.bulk-bar select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.bulk-bar button:disabled, .bulk-bar select:disabled { opacity: .5; cursor: not-allowed; }
.grid .check-col { width: 42px; padding-left: 10px; padding-right: 6px; }
.grid input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--blue); cursor: pointer; }
.grid tbody tr.selected { background: var(--blue-soft); }

/* ---------- Таблицы ---------- */
table.grid {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--panel); border-radius: var(--radius); overflow: hidden;
  margin-bottom: 20px; box-shadow: var(--shadow); border: 1px solid var(--line);
}
.grid th {
  background: var(--blue-softer); color: #46536b; font-weight: 600;
  font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em;
  padding: 11px 14px; text-align: center; vertical-align: middle;
  border-bottom: 1px solid var(--line);
}
.grid td { padding: 11px 14px; border-bottom: 1px solid #eef1f6;
  font-size: 14px; text-align: center; vertical-align: middle; }
.grid tbody tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; transition: background .12s; }
tr.clickable:hover { background: var(--blue-softer); }
.table-actions { display: flex; justify-content: center; align-items: center; gap: 6px; flex-wrap: wrap; }
.table-actions .btn { padding: 6px 10px; font-size: 12.5px; white-space: nowrap; }

/* ---------- Панели и карточки ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 22px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.panel.highlight { border-color: #b7e4c9; background: linear-gradient(180deg, #f4fdf7, #fff); }
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 820px) { .card-grid { grid-template-columns: 1fr; } }

.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 14px; margin: 0 0 12px; }
.kv dt { color: var(--muted); font-size: 13.5px; }
.kv dd { margin: 0; font-size: 14px; }

/* ---------- Пользователи ---------- */
.users-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.users-table th, .users-table td {
  padding: 11px 12px; text-align: left; vertical-align: middle;
  border-bottom: 1px solid var(--line); font-size: 14px;
}
.users-table th { color: var(--muted); font-size: 13px; font-weight: 600; }
.users-table th:nth-child(1) { width: 20%; }
.users-table th:nth-child(2) { width: 27%; }
.users-table th:nth-child(3) { width: 15%; }
.users-table tbody tr:last-child td { border-bottom: none; }
.users-table .inline-form { margin: 0; align-items: center; }
.users-table .inline-form input { flex: 1; width: 100%; min-width: 0; }
.users-table .btn { white-space: nowrap; }

/* ---------- Формы ---------- */
.form-grid {
  display: grid; grid-template-columns: 1.1fr 1.3fr .8fr 1.3fr auto;
  gap: 12px; align-items: end;
}
.form-grid label {
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
  color: #46536b; font-size: 13.5px; font-weight: 550;
}
.form-grid input, .form-grid select {
  width: 100%; min-width: 0; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fbfcfe; color: var(--text); font-size: 14px; outline: none;
}
.form-grid input:focus, .form-grid select:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); background: #fff;
}
.form-grid .btn { min-height: 41px; white-space: nowrap; }
@media (max-width: 900px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .btn { justify-self: start; }
}
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }

.form-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; max-width: 540px; display: flex; flex-direction: column; gap: 13px;
  box-shadow: var(--shadow);
}
.form-card.compact { max-width: none; padding: 14px; margin-top: 14px; box-shadow: none; }
.form-card label { display: flex; flex-direction: column; gap: 5px;
  font-size: 13.5px; color: #46536b; font-weight: 550; }
.form-card label.check { flex-direction: row; align-items: center; gap: 8px; }
.form-card input, .form-card select {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 14px; outline: none; transition: all .15s; background: #fbfcfe;
}
.form-card input:focus, .form-card select:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); background: #fff;
}

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row form { margin: 0; }

/* Форма перевода в «Готово» с адресом регистрации */
.address-form { display: flex; gap: 8px; flex: 1; min-width: 320px; }
.address-form input[name="address"] {
  flex: 1; padding: 9px 12px; border: 1.5px solid var(--blue); border-radius: 10px;
  font-size: 14px; outline: none; background: var(--blue-softer);
}
.address-form input[name="address"]:focus {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); background: #fff;
}
.inline-form { display: flex; gap: 7px; margin-top: 12px; }
.inline-form input, .inline-form select {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 14px; outline: none;
}
.inline-form input:focus { border-color: var(--blue); }

/* Справочники: левая навигация + содержимое */
.dicts-layout { display: grid; grid-template-columns: 230px 1fr; gap: 18px; align-items: start; }
@media (max-width: 700px) { .dicts-layout { grid-template-columns: 1fr; } }
.dicts-nav {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 8px; display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 76px;
}
.dicts-nav a {
  padding: 10px 14px; border-radius: 10px; text-decoration: none;
  color: var(--muted); font-size: 14px; font-weight: 550; transition: all .15s;
}
.dicts-nav a:hover { background: var(--blue-softer); color: var(--blue); }
.dicts-nav a.active { background: var(--blue-soft); color: var(--blue); }

/* Справочник моделей по типам */
.dict-type { margin: 16px 0 6px; color: var(--blue); font-size: 13.5px;
  text-transform: uppercase; letter-spacing: .04em; }
.dict-details { border-bottom: 1px solid var(--line); padding: 2px 0; }
.dict-details:last-of-type { border-bottom: none; }
.dict-details .dict-table { margin: 4px 0 10px 22px; width: calc(100% - 22px); }
.dict-table { width: 100%; border-collapse: collapse; }
.dict-table td { padding: 3px 0; vertical-align: middle; }
.dict-table .inline-form { margin-top: 0; }
.dict-table .inline-form input { flex: 1; }
.dict-del { width: 44px; text-align: right; }

/* ---------- Вход ---------- */
.login-box {
  max-width: 360px; margin: 80px auto; background: var(--panel);
  border-radius: 18px; padding: 32px; border: 1px solid var(--line);
  box-shadow: 0 8px 32px rgba(30, 41, 59, .10);
}
.login-box h1 { margin-top: 0; }
.login-box form { display: flex; flex-direction: column; gap: 13px; }
.login-box label { display: flex; flex-direction: column; gap: 5px;
  font-size: 13.5px; color: #46536b; font-weight: 550; }
.login-box input {
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; outline: none; transition: all .15s; background: #fbfcfe;
}
.login-box input:focus { border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); background: #fff; }
.login-box .btn { margin-top: 4px; padding: 11px; font-size: 15px; }
.login-box .hint { margin-top: 14px; text-align: center; }

/* ---------- Разное ---------- */
.qr-thumb { width: 68px; height: 68px; vertical-align: middle; margin-left: 12px;
  border-radius: 10px; border: 1px solid var(--line); padding: 3px; background: #fff; }
.events { font-size: 14px; line-height: 1.8; color: #46536b; }
.events b { color: var(--text); }
.events-box { margin-top: 8px; }
.events-box summary {
  cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 600;
  padding: 8px 0; user-select: none; transition: color .15s;
}
.events-box summary:hover { color: var(--blue); }
.events-box[open] summary { color: var(--blue); margin-bottom: 4px; }
.finish-line { display: flex; gap: 14px; align-items: center; margin: 18px 0; flex-wrap: wrap; }

::selection { background: rgba(37, 99, 235, .18); }

/* ---------- Общая айдентика Витма-Сервис ---------- */
.vitma-theme {
  --bg: #f7f9fd;
  --panel: #ffffff;
  --line: #e2e9f3;
  --text: #17243b;
  --muted: #687990;
  --blue: #34549b;
  --blue-dark: #2859a7;
  --blue-soft: #edf3ff;
  --blue-softer: #f5f8fd;
  --shadow: 0 8px 25px rgba(20, 42, 83, .06);
  --radius: 16px;
  font-family: "Jost", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: #f7f9fd;
}
.vitma-theme input, .vitma-theme select, .vitma-theme button { font-family: inherit; }
.vitma-theme .topbar {
  min-height: 76px; padding: 13px max(24px, calc((100vw - 1140px) / 2));
  background: rgba(255, 255, 255, .96); border-bottom: 1px solid #e7edf6;
}
.vitma-theme .topbar .logo { display: flex; align-items: center; gap: 16px; }
.vitma-theme .brand-logo { display: block; width: 126px; height: auto; }
.vitma-theme .brand-divider { width: 1px; height: 28px; background: #dfe6f1; }
.vitma-theme .brand-section { color: #52627b; font-size: 14px; font-weight: 500; }
.vitma-theme .topbar a { font-family: inherit; }
.vitma-theme .topbar .user { color: var(--muted); }
.vitma-theme .topbar .user a { color: #34549b; }
.vitma-theme .topbar .user .logout-link { color: #a44b58; }
.vitma-theme :focus-visible { outline: 3px solid rgba(82, 116, 223, .38); outline-offset: 3px; }
.vitma-theme .btn { border-color: #dce5f1; font-weight: 500; }
.vitma-theme .btn.primary {
  border-color: transparent; background: linear-gradient(110deg, #5274df, #6579e8);
  box-shadow: 0 6px 16px rgba(82, 116, 223, .2);
}
.vitma-theme .btn.primary:hover {
  border-color: transparent; background: linear-gradient(110deg, #4969cd, #596ed8);
  box-shadow: 0 8px 20px rgba(82, 116, 223, .28);
}
.vitma-theme .badge { color: #34549b; background: #edf3ff; }

/* Разделы инженера и администратора. */
.staff-theme .main-nav-wrap { max-width: 1180px; margin: 24px auto -8px; padding: 0 16px; }
.staff-theme .main-tabs { gap: 8px; }
.staff-theme .main-tab {
  min-height: 76px; padding: 14px 10px; gap: 8px;
  border: 1px solid #e2e9f3; border-radius: 16px; background: #fff;
  box-shadow: 0 6px 20px rgba(20, 42, 83, .05);
}
.staff-theme .main-tab:hover { border-color: #b8c9ed; box-shadow: 0 10px 24px rgba(20,42,83,.09); }
.staff-theme .main-tab.active {
  color: #fff; border: 1px solid rgba(255,255,255,.16);
  background: linear-gradient(135deg, #142b55 0%, #2859a7 100%);
  box-shadow: 0 8px 25px rgba(20,42,83,.16);
}
.staff-theme .main-tab .tab-icon {
  width: 32px; height: 32px; border-radius: 9px; background: #edf3ff; color: #34549b;
}
.staff-theme .main-tab .tab-icon svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.staff-theme .main-tab.active .tab-icon { color: #fff; background: rgba(255,255,255,.12); }
.staff-theme .main-tab .tab-text { gap: 4px; }
.staff-theme .main-tab .tab-text strong { font-size: 13px; line-height: 1.2; }
.staff-theme .main-tab .tab-text small { color: #6e7d94; font-size: 11px; }
.staff-theme .main-tab.active .tab-text small { color: rgba(255,255,255,.76); }
.staff-theme .container { max-width: 1180px; margin-top: 28px; }
.staff-theme h1 { color: #17243b; font-size: 28px; line-height: 1.2; letter-spacing: -.45px; }
.staff-theme h2 { color: #17243b; font-size: 19px; }
.staff-theme h3 { color: #52627b; }
.staff-theme .page-head h1 { margin: 0; }
.staff-theme .panel, .staff-theme .form-card, .staff-theme .bulk-bar, .staff-theme .dicts-nav {
  border-color: #e2e9f3; box-shadow: 0 8px 25px rgba(20,42,83,.06);
}
.staff-theme .panel { border-radius: 20px; }
.staff-theme .panel.highlight { border-color: #dce8e3; background: linear-gradient(180deg, #f8fcfa, #fff); }
.staff-theme .grid { border-color: #e2e9f3; border-radius: 16px; box-shadow: 0 8px 25px rgba(20,42,83,.05); }
.staff-theme .grid th { background: #f5f8fd; color: #65758e; font-size: 11px; letter-spacing: .55px; }
.staff-theme .grid td { color: #2c3c55; border-bottom-color: #edf1f6; }
.staff-theme .grid tr.clickable:hover { background: #f5f8ff; }
.staff-theme .grid .mono { color: #244c91; }
.staff-theme .scan-line input {
  border: 1.5px solid #5274df; border-radius: 16px;
  box-shadow: 0 0 0 4px rgba(82,116,223,.07), 0 8px 25px rgba(20,42,83,.05);
}
.staff-theme .scan-line input:focus { box-shadow: 0 0 0 5px rgba(82,116,223,.13), 0 8px 25px rgba(20,42,83,.06); }
.staff-theme .filters input, .staff-theme .filters select,
.staff-theme .form-grid input, .staff-theme .form-grid select,
.staff-theme .form-card input, .staff-theme .form-card select,
.staff-theme .inline-form input, .staff-theme .inline-form select {
  border-color: #dce5f1; background-color: #fbfcfe;
}
.staff-theme .filters input:focus, .staff-theme .filters select:focus,
.staff-theme .form-grid input:focus, .staff-theme .form-grid select:focus,
.staff-theme .form-card input:focus, .staff-theme .form-card select:focus {
  border-color: #5274df; box-shadow: 0 0 0 3px rgba(82,116,223,.12);
}
.staff-theme .dicts-nav a.active { color: #fff; background: linear-gradient(110deg, #5274df, #6579e8); }
.staff-theme .dict-type { color: #34549b; }
.staff-theme .events { color: #52627b; }
.staff-theme .events b { color: #17243b; }

/* Вход в сервисный портал. */
.vitma-theme .login-box {
  margin-top: 72px; padding: 34px; border: 1px solid #e2e9f3; border-radius: 20px;
  box-shadow: 0 12px 30px rgba(35,65,120,.09);
}
.vitma-theme .login-box h1 { margin-bottom: 22px; color: #17243b; font-size: 30px; letter-spacing: -.5px; }
.vitma-theme .login-box label { color: #52627b; }
.vitma-theme .login-box input { border-color: #dce5f1; }
.vitma-theme .login-box input:focus { border-color: #5274df; box-shadow: 0 0 0 3px rgba(82,116,223,.12); }

/* Воздух между таблицей и нижней границей клиентской панели. */
.client-theme .client-panel { padding-bottom: 24px; }

@media (max-width: 720px) {
  .staff-theme .topbar { position: relative; min-height: 0; padding: 15px 18px; gap: 12px; }
  .staff-theme .topbar .logo { width: 100%; }
  .vitma-theme .brand-logo { width: 112px; }
  .vitma-theme .brand-section { font-size: 13px; }
  .staff-theme .topbar nav { width: 100%; justify-content: space-between; }
  .staff-theme .topbar .user { width: 100%; justify-content: space-between; }
  .staff-theme .topbar .user-name { margin-right: auto; }
  .staff-theme .main-nav-wrap { margin-top: 16px; padding: 0 14px; }
  .staff-theme .main-tab { min-height: 74px; padding: 13px 12px; }
  .staff-theme .container { margin-top: 20px; padding: 0 14px; }
  .staff-theme h1 { font-size: 24px; }
  .client-theme .client-panel { padding-bottom: 16px; }
  .vitma-theme .login-box { margin-top: 38px; padding: 26px 22px; }
}

/* Подсказки, одинаково работающие мышью, клавиатурой и касанием. */
.autocomplete { position: relative; width: 100%; }
.autocomplete > input { width: 100%; }
.autocomplete-list {
  position: absolute; z-index: 20; top: calc(100% + 5px); left: 0; right: 0;
  max-height: 260px; overflow-y: auto; padding: 5px;
  border: 1px solid #dce5f1; border-radius: 12px; background: #fff;
  box-shadow: 0 12px 30px rgba(20, 42, 83, .16);
}
.autocomplete-option {
  display: block; width: 100%; min-height: 44px; padding: 10px 12px;
  border: 0; border-radius: 8px; background: transparent; color: var(--text);
  text-align: left; font-size: 15px; cursor: pointer;
}
.autocomplete-option:hover, .autocomplete-option:focus, .autocomplete-option.active {
  background: var(--blue-soft); color: var(--blue); outline: none;
}
.autocomplete-empty { padding: 12px; color: var(--muted); font-size: 14px; }

@media (max-width: 720px) {
  .vitma-theme .btn { min-height: 44px; }
  .staff-theme .form-card input, .staff-theme .form-card select,
  .staff-theme .form-grid input, .staff-theme .form-grid select,
  .staff-theme .filters input, .staff-theme .filters select,
  .staff-theme .inline-form input, .staff-theme .inline-form select {
    min-height: 44px; font-size: 16px;
  }
  .staff-theme .form-card { padding: 17px; }
  .staff-theme .page-head { align-items: flex-start; flex-wrap: wrap; }
  .staff-theme .address-form { min-width: 0; width: 100%; flex-direction: column; }
  .staff-theme .address-form .btn { width: 100%; }
  .staff-theme .kv { grid-template-columns: minmax(105px, .8fr) minmax(0, 1.2fr); }
  .staff-theme table.grid { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .staff-theme .dict-details .dict-table { width: 100%; margin-left: 0; }

  .users-table, .users-table tbody { display: block; }
  .users-table thead { display: none; }
  .users-table tr {
    display: block; margin-bottom: 12px; padding: 8px 12px;
    border: 1px solid var(--line); border-radius: 12px; background: var(--blue-softer);
  }
  .users-table tr:last-child { margin-bottom: 0; }
  .users-table td { display: block; padding: 8px 0; border-bottom: 0; }
  .users-table td::before {
    content: attr(data-label); display: block; margin-bottom: 4px;
    color: var(--muted); font-size: 12px; font-weight: 600;
  }
  .users-table .inline-form { margin-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .vitma-theme *, .vitma-theme *::before, .vitma-theme *::after { transition-duration: .01ms !important; }
}

.manual-search input[type="search"] { flex: 1 1 240px; min-width: 0; }
.issue-scan { display: flex; align-items: stretch; gap: 10px; margin-bottom: 16px; }
.issue-scan input { flex: 1 1 220px; min-width: 0; margin-bottom: 0; }
.page-links, .scan-choice { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 12px 0; }
.search-context { color: var(--muted); }
.transfer-document { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.transfer-document .kv { margin-bottom: 20px; }
.transfer-document .grid td { overflow-wrap: anywhere; }
@media (max-width: 720px) {
  .transfer-document .page-head { flex-wrap: wrap; }
  .issue-scan { flex-wrap: wrap; }
}
@media print {
  body:has(.transfer-document) { color: #111; background: white; }
  body:has(.transfer-document) :is(.topbar, .main-nav-wrap, .no-print, .flash) { display: none !important; }
  body:has(.transfer-document) .container, .transfer-document { margin: 0; padding: 0; border: 0; max-width: none; }
  .transfer-document .client-table-wrap, .transfer-document .grid { overflow: visible; }
  .transfer-document table.grid { display: table; width: 100%; box-shadow: none; border-collapse: collapse; }
  .transfer-document .grid thead { display: table-header-group; }
  .transfer-document .grid tr { break-inside: avoid; }
  .transfer-document .grid :is(td, th) { padding: 5px; border: 1px solid #aaa; font-size: 9pt; color: #111; }
  .transfer-document a { color: inherit; text-decoration: none; }
}
