/* ЗАВОД — оформление интерфейса */

:root {
  --bg: #080c11;
  --bg-2: #0c1219;
  --panel: #111923;
  --panel-2: #151f2b;
  --panel-3: #1a2532;
  --border: #223040;
  --border-soft: #1a2532;
  --text: #e8eff8;
  --muted: #8b9cb1;
  --muted-2: #64758a;
  --accent: #f59e0b;
  --accent-bright: #fbbf24;
  --accent-dim: rgba(245, 158, 11, 0.12);
  --info: #38bdf8;
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.45);
  --font: "Segoe UI", "Inter", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: "Cascadia Code", "Consolas", "SF Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(245, 158, 11, 0.07), transparent 60%),
    radial-gradient(900px 500px at 95% 0%, rgba(56, 189, 248, 0.05), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.016) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.016) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 78%);
  z-index: 0;
}

a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: none; }

button { font-family: inherit; }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }

::selection { background: rgba(245, 158, 11, 0.3); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #22303f; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #2e4053; }

/* --- Каркас --------------------------------------------------------------- */

#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-loading {
  display: grid;
  place-items: center;
  min-height: 100vh;
  color: var(--muted);
}

.boot { display: flex; flex-direction: column; align-items: center; gap: 16px; color: var(--muted); font-size: 12.5px; }
.boot-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 2px solid #263545;
  border-top-color: var(--accent);
  animation: bootSpin 0.9s linear infinite;
}
@keyframes bootSpin { to { transform: rotate(360deg); } }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 22px;
  height: 64px;
  padding: 0 22px;
  background: rgba(10, 15, 21, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  flex-shrink: 0;
}

.brand-mark { display: grid; place-items: center; }

.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-title {
  font-weight: 800;
  letter-spacing: 0.18em;
  font-size: 15px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand-sub { font-size: 10px; color: var(--muted); letter-spacing: 0.14em; text-transform: uppercase; }
.brand-mark-logo { width: 38px; height: 38px; overflow: hidden; border-radius: 9px; }
.brand-mark-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }

.nav-tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav-tabs::-webkit-scrollbar { display: none; }

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s;
}
.nav-tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.045); }
.nav-tab.active {
  color: var(--accent-bright);
  background: var(--accent-dim);
  border-color: color-mix(in srgb, var(--accent) 28%, transparent);
}

.topbar-right { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }

.clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.clock-time { font-variant-numeric: tabular-nums; font-weight: 650; font-size: 14px; }
.clock-shift { font-size: 10px; color: var(--muted-2); letter-spacing: 0.06em; text-transform: uppercase; }

.user-menu-wrap { position: relative; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 5px 10px 5px 6px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.user-chip:hover { border-color: #31455b; background: var(--panel-2); }
.user-chip-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.user-chip-name { font-size: 12.5px; font-weight: 600; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip-role { font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; }
.chev { color: var(--muted-2); display: flex; }

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 250px;
  background: #0e1620;
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: var(--shadow);
  padding: 7px;
  z-index: 90;
  animation: dropIn 0.14s ease-out;
}
@keyframes dropIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }

.user-dropdown-head {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 9px 12px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 6px;
}
.user-dropdown-name { font-size: 13px; font-weight: 600; }
.user-dropdown-login { font-size: 11px; color: var(--muted); }

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}
.user-dropdown-item:hover { background: rgba(255, 255, 255, 0.05); }
.user-dropdown-item.danger { color: #fca5a5; }
.user-dropdown-item.danger:hover { background: rgba(239, 68, 68, 0.12); }
.user-dropdown-sep { height: 1px; background: var(--border-soft); margin: 6px 4px; }

.temp-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 22px;
  background: rgba(245, 158, 11, 0.1);
  border-bottom: 1px solid rgba(245, 158, 11, 0.22);
  color: #fcd9a0;
  font-size: 12.5px;
}
.temp-banner .btn { margin-left: auto; }

.main {
  flex: 1;
  width: 100%;
  max-width: 1640px;
  margin: 0 auto;
  padding: 22px 24px 28px;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  border-top: 1px solid var(--border-soft);
  color: var(--muted-2);
  font-size: 11px;
  letter-spacing: 0.03em;
}

body:has(.map-page) .footer { display: none; }

.view-loading { opacity: 0.45; transition: opacity 0.12s; }

.view-error {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
}
.view-error h3 { color: var(--text); }

/* --- Страницы ------------------------------------------------------------- */

.page { display: flex; flex-direction: column; gap: 18px; }
.page-wide { max-width: none; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}
.page-title h1 { font-size: 25px; letter-spacing: -0.02em; }
.page-title p { color: var(--muted); font-size: 13px; margin-top: 5px; max-width: 720px; }
.page-actions { display: flex; gap: 9px; flex-wrap: wrap; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 12px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}
.stat-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-soft);
  flex-shrink: 0;
}
.stat-value { font-size: 21px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.stat-hint { font-size: 9.5px; color: var(--muted-2); margin-top: 2px; }

.stat-row-6 { grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); }

.stat-card.clickable {
  text-align: left;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.14s, transform 0.12s, box-shadow 0.14s, background 0.14s;
}
.stat-card.clickable:hover { border-color: #31455b; transform: translateY(-1px); }
.stat-card.clickable.active {
  border-color: rgba(245, 158, 11, 0.55);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.04));
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.2);
}
.stat-card.clickable.active .stat-label { color: var(--accent-bright); }

.toolbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.view-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
}
.view-toggle-btn {
  width: 30px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.view-toggle-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.view-toggle-btn.active { color: var(--accent-bright); background: var(--accent-dim); }

.employees-content { display: flex; flex-direction: column; }
.person-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
  gap: 12px;
}
.person-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 13px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 13px;
  cursor: pointer;
  transition: border-color 0.14s, transform 0.12s, box-shadow 0.14s;
}
.person-card:hover {
  border-color: #32465b;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}
.person-card-top { display: flex; align-items: flex-start; gap: 10px; }
.person-card-photo { flex-shrink: 0; display: flex; }
.person-card-main { flex: 1; min-width: 0; }
.person-card-name { font-size: 13.5px; font-weight: 650; line-height: 1.25; }
.person-card-pos { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.person-card-dept { font-size: 10.5px; color: var(--muted-2); margin-top: 2px; }
.person-card-contacts {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
  font-size: 11px;
  color: var(--muted);
}
.person-card-contacts > span { display: flex; align-items: center; gap: 6px; }
.person-card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
}
.person-card-foot .row-actions { margin-left: auto; }

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar > .input {
  width: auto;
  flex: 0 1 210px;
  min-width: 170px;
}

.search-wrap { position: relative; flex: 1 1 260px; min-width: 200px; }
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
  display: flex;
  pointer-events: none;
}
.search-wrap .input { padding-left: 37px; width: 100%; }

.card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-card { overflow: hidden; }

/* --- Поля ----------------------------------------------------------------- */

.input {
  width: 100%;
  background: #0c131b;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13.2px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 38px;
}
.input:focus { border-color: rgba(245, 158, 11, 0.55); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1); }
.input::placeholder { color: #4e5f74; }
.input:disabled { opacity: 0.55; cursor: not-allowed; }
.input-sm { padding: 5px 9px; min-height: 30px; font-size: 12.5px; }
textarea.input { resize: vertical; min-height: 74px; line-height: 1.5; }

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b9cb1' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 32px;
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 11.5px; color: var(--muted); letter-spacing: 0.03em; }
.field-hint { font-size: 10.5px; color: var(--muted-2); }

.form-stack { display: flex; flex-direction: column; gap: 13px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid .form-error { grid-column: 1 / -1; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-error { color: #fca5a5; font-size: 12.5px; min-height: 1px; }

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.check-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }

.inline-field { display: flex; gap: 8px; align-items: center; }
.inline-field .input { flex: 1; }

/* --- Кнопки --------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--panel-2);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.06s, filter 0.15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, var(--accent-bright), var(--accent));
  color: #201503;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: rgba(255, 255, 255, 0.035); border-color: var(--border); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.07); }
.btn-danger { background: rgba(239, 68, 68, 0.14); border-color: rgba(239, 68, 68, 0.35); color: #fecaca; }
.btn-danger:hover { background: rgba(239, 68, 68, 0.22); }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }
.btn.loading { opacity: 0.8; }
.btn.active { border-color: rgba(245, 158, 11, 0.5); color: var(--accent-bright); background: var(--accent-dim); }
.btn.pulse { animation: savePulse 1.6s ease-in-out infinite; }
@keyframes savePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
  flex-shrink: 0;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.icon-btn.active { color: var(--accent-bright); background: var(--accent-dim); border-color: rgba(245, 158, 11, 0.25); }
.icon-btn.danger:hover { color: #fca5a5; background: rgba(239, 68, 68, 0.12); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.row-actions { display: flex; gap: 2px; justify-content: flex-end; }

/* --- Таблицы -------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
.data-table th.right, .data-table td.right { text-align: right; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left;
  padding: 11px 14px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  font-weight: 600;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.015);
  white-space: nowrap;
}
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr.clickable { cursor: pointer; }
.data-table tbody tr.clickable:hover { background: rgba(255, 255, 255, 0.028); }
.data-table tr.row-disabled { opacity: 0.55; }

.person-cell { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.person-text { min-width: 0; }
.person-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.person-sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }

.cell-strong { font-weight: 550; }
.cell-sub { font-size: 11.5px; color: var(--muted); }

.avatar {
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 650;
  flex-shrink: 0;
  overflow: hidden;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--badge-color, #94a3b8);
  background: color-mix(in srgb, var(--badge-color, #94a3b8) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--badge-color, #94a3b8) 30%, transparent);
  white-space: nowrap;
}

.role-pill {
  display: inline-flex;
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--role-color, #94a3b8);
  background: color-mix(in srgb, var(--role-color, #94a3b8) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--role-color, #94a3b8) 26%, transparent);
  white-space: nowrap;
}

.login-chip {
  display: inline-flex;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--info);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  padding: 2px 7px;
  border-radius: 6px;
}

.muted { color: var(--muted); }
.small { font-size: 11.5px; }
.accent { color: var(--accent-bright); }

/* --- Модальные окна ------------------------------------------------------- */

body.modal-open { overflow: hidden; }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(3, 6, 10, 0.72);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.14s;
}
.modal-overlay.open { opacity: 1; }
.modal-overlay.closing { opacity: 0; }

.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 44px);
  display: flex;
  flex-direction: column;
  background: #0f1720;
  border: 1px solid #263545;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transform: translateY(10px) scale(0.985);
  transition: transform 0.16s ease-out;
}
.modal-overlay.open .modal { transform: none; }
.modal-sm { width: min(430px, 100%); }
.modal-lg { width: min(820px, 100%); }
.modal-xl { width: min(1040px, 100%); }

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 20px 14px;
  border-bottom: 1px solid var(--border-soft);
}
.modal-title { font-size: 17px; }
.modal-subtitle { font-size: 12px; color: var(--muted); margin-top: 3px; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot {
  padding: 13px 20px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.modal-actions { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.confirm-text { color: var(--muted); line-height: 1.55; }

/* --- Детали, документы, фото --------------------------------------------- */

.detail-layout { display: grid; grid-template-columns: 220px 1fr; gap: 22px; }
.detail-side { display: flex; flex-direction: column; gap: 12px; }
.detail-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 13px;
  overflow: hidden;
  background: linear-gradient(160deg, #1a2532, #111923);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--muted-2);
}
.detail-photo img { width: 100%; height: 100%; object-fit: cover; }
.detail-photo .avatar {
  width: 96px !important;
  height: 96px !important;
  border-radius: 50%;
  font-size: 30px !important;
  border: 2px solid rgba(255, 255, 255, 0.16);
}
.equipment-detail-photo img { object-fit: contain; }
.detail-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-contacts { display: flex; flex-direction: column; gap: 7px; }
.detail-contact {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
}
.detail-contact span { color: var(--muted-2); display: flex; }

.detail-list { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; margin: 0; font-size: 13px; }
.detail-list dt { color: var(--muted); font-size: 12px; }
.detail-list dd { margin: 0; min-width: 0; }
.detail-list dd .input { margin-top: -5px; }

.detail-notes { margin-top: 16px; padding: 12px 14px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border-soft); }
.detail-notes h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted-2); margin-bottom: 6px; }
.detail-notes p { font-size: 12.8px; color: #c8d4e2; white-space: pre-wrap; }

.detail-files { margin-top: 20px; }
.detail-subtitle { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted-2); margin-bottom: 9px; }

.profile-grid { display: flex; flex-direction: column; gap: 18px; }
.profile-head { display: flex; align-items: center; gap: 14px; }
.profile-name { font-size: 16px; font-weight: 650; }
.profile-role { font-size: 12px; color: var(--muted); }

.credentials { display: flex; flex-direction: column; gap: 10px; }
.credential-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  background: #0b1219;
  border: 1px solid var(--border);
  border-radius: 9px;
}
.credential-label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.credential-value { font-family: var(--mono); font-size: 13.5px; color: var(--accent-bright); }

.photo-field { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.photo-preview {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--panel-2);
  display: grid;
  place-items: center;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-placeholder { color: var(--muted-2); display: flex; }

/* --- Файлы ---------------------------------------------------------------- */

.files-panel { display: flex; flex-direction: column; gap: 10px; }
.upload-zone {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px dashed #2a3c4f;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.015);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: rgba(245, 158, 11, 0.06); }
.upload-zone.compact { padding: 9px 12px; }
.upload-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--accent-dim);
  color: var(--accent-bright);
  flex-shrink: 0;
}
.upload-text { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--muted); }
.upload-text strong { color: var(--text); font-weight: 550; }
.upload-hint { font-size: 10.5px; color: var(--muted-2); }

.file-list { display: flex; flex-direction: column; gap: 4px; }
.file-empty { font-size: 12px; color: var(--muted-2); padding: 8px 2px; }
.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background 0.14s;
}
.file-row:hover { background: rgba(255, 255, 255, 0.035); }
.file-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  color: var(--muted);
  flex-shrink: 0;
}
.file-badge.ext-pdf { color: #f87171; background: rgba(239, 68, 68, 0.1); }
.file-badge.ext-doc, .file-badge.ext-docx { color: #60a5fa; background: rgba(59, 130, 246, 0.1); }
.file-badge.ext-xls, .file-badge.ext-xlsx, .file-badge.ext-csv { color: #34d399; background: rgba(52, 211, 153, 0.1); }
.file-badge.ext-jpg, .file-badge.ext-jpeg, .file-badge.ext-png, .file-badge.ext-tif, .file-badge.ext-tiff, .file-badge.ext-webp { color: #c084fc; background: rgba(192, 132, 252, 0.1); }
.file-meta { flex: 1; min-width: 0; }
.file-name { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-sub { font-size: 10.5px; color: var(--muted-2); }
.file-dot { color: var(--muted-2); }
.file-actions { display: flex; gap: 2px; opacity: 0.65; transition: opacity 0.14s; }
.file-row:hover .file-actions { opacity: 1; }

.file-preview { display: flex; flex-direction: column; align-items: center; gap: 12px; min-height: 240px; justify-content: center; }
.preview-image { max-width: 100%; max-height: 66vh; object-fit: contain; border-radius: 8px; background: #0b1118; }
.preview-frame { width: 100%; height: 68vh; border: 0; border-radius: 8px; background: #fff; }
.preview-text {
  width: 100%;
  max-height: 62vh;
  overflow: auto;
  margin: 0;
  padding: 16px;
  background: #0b1118;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 12.3px;
  line-height: 1.55;
  white-space: pre-wrap;
  color: #cdd9e5;
}
.preview-note { font-size: 11.5px; color: var(--muted); }
.preview-doc {
  width: 100%;
  max-height: 64vh;
  overflow: auto;
  padding: 22px 26px;
  background: #0b1118;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.65;
  color: #d7e2ee;
}
.preview-doc h2, .preview-doc h3, .preview-doc h4 { margin: 6px 0 10px; color: #fff; font-size: 17px; }
.preview-doc p { margin: 0 0 9px; }
.preview-doc .doc-li { position: relative; padding-left: 17px; margin-bottom: 5px; }
.preview-doc .doc-li::before { content: "•"; position: absolute; left: 3px; color: var(--accent); }
.preview-doc .doc-gap { height: 7px; }
.preview-doc table.doc-table { border-collapse: collapse; margin: 12px 0; width: 100%; }
.preview-doc table.doc-table td { border: 1px solid #263545; padding: 6px 10px; vertical-align: top; }
.preview-doc table.doc-table tr:first-child td { background: #16202b; font-weight: 600; }.preview-fallback { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 36px 20px; text-align: center; color: var(--muted); }
.preview-fallback-icon {
  width: 64px; height: 64px; border-radius: 14px; display: grid; place-items: center;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
}
.sheet-wrap { width: 100%; max-height: 64vh; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
table.sheet { border-collapse: collapse; font-size: 12px; min-width: 100%; }
table.sheet th, table.sheet td { border: 1px solid #23303d; padding: 4px 8px; text-align: left; white-space: nowrap; }
table.sheet th { background: #16202b; position: sticky; top: 0; z-index: 1; }
table.sheet .rownum { background: #111923; color: var(--muted-2); text-align: right; font-size: 10.5px; width: 34px; }
.preview-empty { color: var(--muted); }

/* --- Сотрудники / оборудование ------------------------------------------- */

.equipment-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  overflow-x: auto;
}
.equipment-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}
.equipment-tab:hover { color: var(--text); background: rgba(255,255,255,.04); }
.equipment-tab.active { color: var(--accent-bright); border-bottom-color: var(--accent); background: var(--accent-dim); }
.equipment-extra { display: flex; flex-direction: column; gap: 13px; }
.equipment-extra-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.equipment-extra-head h2 { margin: 0 0 4px; font-size: 18px; }
.equipment-extra-head p { margin: 0; color: var(--muted); font-size: 12.5px; }
.equipment-empty { padding: 28px; text-align: center; }
.equipment-empty h3 { margin: 0 0 6px; }
.ppr-note { max-width: 280px; }
.text-danger { color: #ef4444 !important; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.metal-fields {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: var(--surface-2);
}
.metal-fields .detail-subtitle { margin-top: 0; }
.metal-calc-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 8px; }
.metal-calc-row .field-hint { flex: 1; min-width: 220px; }
.metal-converter-info { font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.metal-converter-result {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: var(--surface-2);
}
.metal-converter-line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.metal-converter-eq { color: var(--muted); }
.metal-converter-big { font-size: 19px; font-weight: 700; color: var(--accent-bright); }
.metal-converter-extra { margin-top: 5px; color: var(--muted); font-size: 11.5px; }
.metal-calc-head { margin-bottom: 10px; }
.metal-calc-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.metal-calc-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.metal-calc-tab:hover { color: var(--text); border-color: var(--border-strong); }
.metal-calc-tab.active { color: var(--accent-bright); border-color: var(--accent); background: var(--accent-dim); }
.metal-calc-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); gap: 14px; align-items: start; }
.metal-calc-panel { padding: 16px; }
.metal-calc-result-panel { position: sticky; top: 14px; }
.metal-calc-form-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.metal-calc-form-head h3 { margin: 0; font-size: 17px; }
.metal-calc-result-head { margin-bottom: 10px; }
.metal-calc-result-title { font-size: 15px; font-weight: 700; }
.metal-calc-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.metal-calc-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
}
.metal-calc-card-value { font-size: 17px; font-weight: 700; color: var(--accent-bright); }
.metal-calc-card-label { font-size: 10.5px; color: var(--muted); }
.metal-calc-error { color: #ef4444; font-size: 12px; padding: 8px 0; }
@media (max-width: 900px) { .metal-calc-layout { grid-template-columns: 1fr; } .metal-calc-result-panel { position: static; } }
@media (max-width: 520px) { .metal-calc-cards { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .form-grid-3 { grid-template-columns: 1fr; } .equipment-extra-head { flex-direction: column; } }

.equipment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 14px;
}

.equipment-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  color: var(--text);
  padding: 0;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.equipment-card:hover {
  transform: translateY(-2px);
  border-color: #32465b;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}
.equipment-photo {
  position: relative;
  height: 128px;
  background: linear-gradient(150deg, #1b2836, #101821);
  display: grid;
  place-items: center;
  color: #43586d;
  border-bottom: 1px solid var(--border-soft);
  overflow: hidden;
}
.equipment-photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.equipment-placeholder { display: flex; }
.equipment-status {
  position: absolute;
  top: 9px;
  right: 9px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 650;
  color: var(--status-color, #94a3b8);
  background: rgba(8, 12, 17, 0.82);
  border: 1px solid color-mix(in srgb, var(--status-color, #94a3b8) 45%, transparent);
  backdrop-filter: blur(4px);
}
.equipment-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 5px; }
.equipment-inv { font-family: var(--mono); font-size: 10.5px; color: var(--muted-2); letter-spacing: 0.04em; }
.equipment-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 36px;
}
.equipment-meta { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.equipment-meta > span { display: flex; align-items: center; gap: 6px; }
.meta-icon { display: flex; color: var(--muted-2); }
.equipment-service {
  margin-top: 7px;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.equipment-service.soon { color: var(--accent-bright); }
.equipment-service.overdue { color: #f87171; }

.equipment-content { display: flex; flex-direction: column; }
.equipment-cell { display: flex; align-items: center; gap: 10px; min-width: 240px; }
.equip-thumb {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--panel-2);
  color: var(--muted-2);
}
.equip-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.service-inline { font-size: 11.5px; color: var(--muted); }
.service-inline.soon { color: var(--accent-bright); }
.service-inline.overdue { color: #f87171; }

.tasks-content { display: flex; flex-direction: column; }
.task-table-desc {
  max-width: 560px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Канбан --------------------------------------------------------------- */

.kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(272px, 1fr);
  gap: 13px;
  overflow-x: auto;
  align-items: start;
  padding-bottom: 8px;
}
.kanban-column {
  background: rgba(17, 25, 35, 0.68);
  border: 1px solid var(--border-soft);
  border-radius: 13px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 140px;
  border-top: 2px solid var(--col-color, var(--border));
}
.kanban-column.drag-over { background: rgba(245, 158, 11, 0.06); border-color: rgba(245, 158, 11, 0.45); }
.kanban-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 4px; }
.kanban-dot { width: 7px; height: 7px; border-radius: 50%; }
.kanban-title { font-size: 12.5px; font-weight: 650; letter-spacing: 0.01em; }
.kanban-count {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  padding: 1px 7px;
  font-variant-numeric: tabular-nums;
}
.kanban-list { display: flex; flex-direction: column; gap: 7px; min-height: 40px; }
.kanban-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px;
  border-radius: 8px;
  border: 1px dashed #263545;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  cursor: pointer;
}
.kanban-add:hover { color: var(--accent-bright); border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.05); }

.task-card {
  position: relative;
  display: flex;
  gap: 0;
  background: #151f2b;
  border: 1px solid #223040;
  border-radius: 10px;
  padding: 10px 10px 9px 13px;
  cursor: pointer;
  transition: border-color 0.14s, transform 0.1s, box-shadow 0.14s;
  overflow: hidden;
}
.task-card:hover { border-color: #31465c; box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22); }
.task-card.dragging { opacity: 0.45; transform: rotate(1deg); }
.task-card.overdue { border-color: rgba(239, 68, 68, 0.32); }
.task-prio {
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: var(--prio-color, #64748b);
}
.task-card-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.task-title { font-size: 12.9px; font-weight: 600; line-height: 1.32; }
.task-desc {
  font-size: 11.3px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.task-tags { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.task-priority { font-size: 10.5px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }
.task-template {
  font-size: 9.5px;
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.1);
  border-radius: 999px;
  padding: 1px 7px;
}
.task-due { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; color: var(--muted); }
.task-due.overdue { color: #f87171; }
.task-foot { display: flex; align-items: center; gap: 7px; margin-top: 2px; }
.task-assignee { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); min-width: 0; }
.task-assignee span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-detail { display: flex; flex-direction: column; gap: 16px; }
.task-detail-top { display: flex; flex-wrap: wrap; gap: 7px; }
.task-detail-desc { font-size: 13px; color: #c3d0de; line-height: 1.6; white-space: pre-wrap; }

/* --- Планировка ----------------------------------------------------------- */

.map-page {
  display: flex;
  flex-direction: column;
  gap: 13px;
  height: calc(100vh - 64px - 50px);
  min-height: 540px;
}

.map-head {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
}
.map-title h1 { font-size: 21px; letter-spacing: -0.02em; }
.map-title p { font-size: 12px; color: var(--muted); margin-top: 3px; max-width: 620px; }
.map-head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin-left: auto; }
.map-stats { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.map-chip {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 6px 11px;
  min-width: 74px;
}
.map-chip-value { font-size: 16px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.map-chip-label { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted-2); }
.map-actions { display: flex; align-items: center; gap: 8px; }
.action-group { display: flex; background: var(--panel); border: 1px solid var(--border-soft); border-radius: 9px; overflow: hidden; }
.action-group .icon-btn { border-radius: 0; }
.save-status { font-size: 11px; color: var(--muted-2); display: flex; align-items: center; gap: 6px; }
.save-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.save-status.dirty { color: var(--accent-bright); }
.save-status.dirty::before { background: var(--accent); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15); }

.map-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 196px 1fr 306px;
  gap: 11px;
}

.map-floors {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 30px;
}
.floors-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  margin-right: 4px;
}
.floor-tab {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--panel);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.14s, border-color 0.14s, background 0.14s;
}
.floor-tab:hover { color: var(--text); border-color: #31455b; }
.floor-tab.active {
  color: var(--accent-bright);
  background: var(--accent-dim);
  border-color: rgba(245, 158, 11, 0.38);
}
.floor-add {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-style: dashed;
}
.floor-add:hover { color: var(--accent-bright); border-color: rgba(245, 158, 11, 0.4); }
.floor-settings { width: 30px; height: 30px; }
.floor-manage-list { display: flex; flex-direction: column; gap: 6px; }
.floor-manage-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
}
.floor-index { width: 18px; text-align: center; color: var(--muted-2); font-size: 11px; }
.floor-manage-row .input { flex: 1; }
.floor-manage-info { font-size: 10.5px; color: var(--muted-2); white-space: nowrap; }

.map-tools {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 13px;
  padding: 7px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  min-height: 0;
}
.tool-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}
.tool-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.tool-btn.active { background: var(--accent-dim); color: var(--accent-bright); border-color: rgba(245, 158, 11, 0.28); }
.tool-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.tool-btn .icon { flex-shrink: 0; }
.tool-label { flex: 1; }
.tool-btn kbd {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 4px;
}

.object-palette {
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
  min-height: 0;
  overflow: hidden;
}
.palette-title { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-2); padding: 0 4px; }
.palette-list { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; min-height: 0; }
.palette-group-title { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.06em; color: #5b6d82; padding: 7px 5px 3px; }
.palette-item {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.palette-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.palette-item.active { background: var(--accent-dim); border-color: rgba(245, 158, 11, 0.3); color: var(--accent-bright); }
.palette-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }

.draw-options {
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  padding: 8px;
  border-top: 1px solid var(--border-soft);
}
.draw-options-label { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted-2); }
.draw-colors { display: flex; gap: 4px; }
.draw-color {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.draw-color.active { border-color: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .6); }
.draw-width { width: 100%; }
.equipment-works { border-top: 1px solid var(--border-soft); padding-top: 8px; }
.equipment-task-list { display: flex; flex-direction: column; gap: 6px; }
.equipment-task-row { display: flex; gap: 7px; align-items: flex-start; }
.equipment-task-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.equipment-task-body { min-width: 0; }
.equipment-task-title { font-size: 12px; font-weight: 600; }
.equipment-task-meta { font-size: 10.5px; color: var(--muted); }
.selection-list { display: flex; flex-direction: column; gap: 5px; }
.selection-row { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.selection-name { flex: 1; min-width: 0; }
.selection-size { font-size: 10.5px; color: var(--muted); }
.map-stage[data-tool="draw"] .map-canvas,
.map-stage[data-tool="marquee"] .map-canvas { cursor: crosshair; }
.palette-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-size { font-size: 9.5px; color: var(--muted-2); font-family: var(--mono); }

.tools-note {
  margin-top: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.05);
  border: 1px solid rgba(56, 189, 248, 0.15);
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
}

.map-stage {
  position: relative;
  background: #070b10;
  border: 1px solid var(--border-soft);
  border-radius: 13px;
  overflow: hidden;
  min-height: 0;
}
.map-canvas { display: block; touch-action: none; cursor: crosshair; }
.map-stage[data-tool="select"] .map-canvas { cursor: default; }
.map-stage.grabbing .map-canvas { cursor: grabbing; }
.map-stage.grab .map-canvas { cursor: grab; }

.map-zoom {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(13, 19, 27, 0.9);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
  backdrop-filter: blur(6px);
}
.map-zoom-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.map-zoom-btn:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.zoom-label { font-size: 10.5px; color: var(--muted); min-width: 40px; text-align: center; font-variant-numeric: tabular-nums; }

.map-legend {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: flex;
  gap: 11px;
  flex-wrap: wrap;
  padding: 5px 9px;
  background: rgba(13, 19, 27, 0.82);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  font-size: 10px;
  color: var(--muted);
  backdrop-filter: blur(6px);
  pointer-events: none;
}
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.lg { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.lg-production { background: #f59e0b; }
.lg-storage { background: #38bdf8; }
.lg-office { background: #a78bfa; }
.lg-social { background: #34d399; }

.map-inspector {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 13px;
  padding: 12px;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.inspector-head h2 {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted-2);
  font-weight: 650;
}
.inspector-card {
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 11px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.inspector-subtitle {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted-2);
  font-weight: 650;
}
.object-head { display: flex; gap: 9px; align-items: flex-start; }
.object-swatch { width: 15px; height: 15px; border-radius: 4px; margin-top: 2px; flex-shrink: 0; }
.object-name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.object-sub { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.mini-info { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; }
.inspector-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.inspector-card .field-label { font-size: 10.5px; }

.room-list { display: flex; flex-direction: column; gap: 1px; }
.room-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px;
  border-radius: 7px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}
.room-item:hover { background: rgba(255, 255, 255, 0.05); }
.room-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.room-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-item-area { font-size: 10px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.object-counts { display: flex; flex-direction: column; gap: 3px; }
.object-count { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
.count-pill { background: rgba(255, 255, 255, 0.05); border-radius: 999px; padding: 0 7px; font-size: 10px; color: var(--text); }
.hint-card { background: rgba(245, 158, 11, 0.035); border-color: rgba(245, 158, 11, 0.14); }
.hint-list { margin: 0; padding-left: 17px; display: block; font-size: 11.5px; color: var(--muted); }
.hint-list li { margin-bottom: 6px; }
.hint-list li::marker { color: var(--accent); }

/* --- Пустые состояния и уведомления -------------------------------------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 42px 20px;
  text-align: center;
  color: var(--muted);
}
.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted-2);
  margin-bottom: 4px;
}
.empty-state h3 { font-size: 14px; color: var(--text); }
.empty-state p { font-size: 12px; max-width: 360px; }

#toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 220px;
  max-width: 380px;
  padding: 10px 13px;
  background: #121c27;
  border: 1px solid #2a3b4d;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  font-size: 12.5px;
  color: var(--text);
  transform: translateY(10px);
  opacity: 0;
  transition: transform 0.2s, opacity 0.2s;
}
.toast.show { transform: none; opacity: 1; }
.toast-icon { display: flex; color: var(--info); }
.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--danger); }
.toast-success { border-color: rgba(34, 197, 94, 0.3); }
.toast-error { border-color: rgba(239, 68, 68, 0.35); }
.toast-text { line-height: 1.35; }

/* --- Вход ----------------------------------------------------------------- */

.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
}

.auth-hero {
  position: relative;
  padding: 44px 52px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow: hidden;
  background:
    radial-gradient(700px 380px at 20% 0%, rgba(245, 158, 11, 0.1), transparent 65%),
    radial-gradient(600px 400px at 100% 100%, rgba(56, 189, 248, 0.06), transparent 60%),
    #0a1017;
  border-right: 1px solid var(--border-soft);
}
.auth-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, #000, transparent 90%);
  pointer-events: none;
}
.auth-brand { display: flex; align-items: center; gap: 12px; position: relative; }
.auth-brand .brand-mark-logo { width: 46px; height: 46px; }
.auth-brand-title { font-weight: 800; letter-spacing: 0.24em; font-size: 18px; }
.auth-brand-sub { font-size: 10.5px; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.auth-hero-text { position: relative; max-width: 560px; }
.auth-hero-text h1 { font-size: clamp(30px, 3.6vw, 46px); line-height: 1.06; letter-spacing: -0.035em; }
.auth-hero-text p { margin-top: 14px; color: var(--muted); font-size: 14px; line-height: 1.6; max-width: 480px; }
.auth-art { position: relative; margin: 2px 0; max-width: 660px; }
.plan-art {
  width: 100%;
  max-width: 100%;
  height: auto;
  border: 1px solid #263545;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.auth-features { display: flex; gap: 18px; flex-wrap: wrap; position: relative; margin-top: auto; }
.auth-feature { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.auth-feature span { color: var(--accent); display: flex; }

.auth-panel {
  display: grid;
  place-items: center;
  padding: 32px;
  background: rgba(8, 12, 17, 0.55);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(180deg, #121b25, #0e151d);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.auth-card-head { margin-bottom: 22px; }
.auth-card-head h2 { font-size: 21px; }
.auth-card-head p { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 42px; }
.password-toggle {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  border-radius: 6px;
}
.password-toggle:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }

.auth-error {
  display: none;
  padding: 9px 11px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  font-size: 12.5px;
}
.auth-error.visible { display: block; }

.auth-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--muted-2);
  padding-top: 2px;
}
.auth-hint span { display: flex; }

.auth-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 22px;
  padding-top: 15px;
  border-top: 1px solid var(--border-soft);
  font-size: 10.5px;
  color: var(--muted-2);
  letter-spacing: 0.02em;
}
.auth-foot-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); }

/* --- Фото, оргструктура и блок-схема ------------------------------------- */

.photo-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.photo-hint { font-size: 10px; color: var(--muted-2); }
.photo-remove { color: #fca5a5; }
.photo-field-large { width: 100%; }
.photo-preview-lg {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
}
.photo-preview-lg img { width: 100%; height: 100%; object-fit: cover; }

.segmented {
  display: inline-flex;
  gap: 4px;
  align-self: flex-start;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 11px;
  padding: 4px;
  flex-wrap: wrap;
}
.segmented-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}
.segmented-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.045); }
.segmented-btn.active { color: var(--accent-bright); background: var(--accent-dim); }
.users-content { display: flex; flex-direction: column; gap: 16px; }
.panel-loading { padding: 44px; text-align: center; color: var(--muted); font-size: 12.5px; }

.structure-intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
}
.structure-intro h2 { font-size: 18px; letter-spacing: -0.01em; }
.structure-intro p { font-size: 12.5px; color: var(--muted); margin-top: 4px; max-width: 660px; }
.mini-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.mini-stat {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  padding: 7px 12px;
  min-width: 92px;
}
.mini-stat-value { display: block; font-size: 17px; font-weight: 700; line-height: 1.2; }
.mini-stat-label { font-size: 9.5px; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.05em; }
.structure-hint {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
  padding: 10px 12px;
  background: rgba(56, 189, 248, 0.04);
  border: 1px solid rgba(56, 189, 248, 0.13);
  border-radius: 9px;
}
.structure-hint span { display: flex; }
.structure-hint span:last-child { display: block; }

/* --- Оргструктура --------------------------------------------------------- */

.org-tree-scroll {
  overflow-x: auto;
  padding: 6px 6px 20px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(600px 240px at 50% 0%, rgba(245, 158, 11, 0.04), transparent 70%),
    var(--panel);
}
.org-tree { min-width: max-content; padding: 18px 8px 6px; }
.org-tree ul {
  position: relative;
  display: flex;
  justify-content: center;
  margin: 0;
  padding: 24px 0 0;
  list-style: none;
}
.org-tree > ul { padding-top: 0; }
.org-tree li {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 4px 0;
}
.org-tree li::before,
.org-tree li::after {
  content: "";
  position: absolute;
  top: 0;
  right: 50%;
  width: 50%;
  height: 24px;
  border-top: 2px solid #2a3a4a;
}
.org-tree li::after {
  right: auto;
  left: 50%;
  border-left: 2px solid #2a3a4a;
}
.org-tree li:only-child::before,
.org-tree li:only-child::after { display: none; }
.org-tree li:only-child { padding-top: 24px; }
.org-tree li:first-child::before,
.org-tree li:last-child::after { border: 0; }
.org-tree li:last-child::before { border-right: 2px solid #2a3a4a; border-radius: 0 6px 0 0; }
.org-tree li:first-child::after { border-radius: 6px 0 0 0; }
.org-tree ul ul::before {
  content: "";
  position: absolute;
  top: -24px;
  left: 50%;
  width: 2px;
  height: 24px;
  background: #2a3a4a;
}
.org-tree > ul > li { padding-top: 0; }
.org-tree > ul > li::before,
.org-tree > ul > li::after { display: none; }

.org-node {
  position: relative;
  width: 158px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 8px;
  cursor: pointer;
  transition: border-color 0.14s, transform 0.12s, box-shadow 0.14s;
}
.org-node:hover { border-color: #3b5166; transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0, 0, 0, 0.25); }
.org-node-top { display: flex; gap: 6px; align-items: flex-start; padding-right: 17px; }
.org-node:not(.has-kids) .org-node-top { padding-right: 0; }
.org-avatar { flex-shrink: 0; display: flex; }
.org-node-info { flex: 1; min-width: 0; }
.org-node-name {
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.org-node-pos {
  font-size: 9.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.org-toggle {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  cursor: pointer;
  z-index: 1;
}
.org-toggle:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); }
.org-toggle .icon { transition: transform 0.15s; }
.org-li.collapsed .org-toggle .icon { transform: rotate(-90deg); }
.org-li.collapsed > ul { display: none; }
.org-node-foot {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px solid var(--border-soft);
  font-size: 9px;
  color: var(--muted-2);
}
.org-dept {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  padding: 1px 5px;
  max-width: 84px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.org-kids { white-space: nowrap; }

.org-scroll-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--accent-bright);
  padding: 0 2px;
}
.org-scroll-hint span { display: flex; }

/* --- Блок-схема предприятия ---------------------------------------------- */

.ent-map { display: flex; flex-direction: column; align-items: center; }
.ent-root {
  display: flex;
  align-items: center;
  gap: 13px;
  background: linear-gradient(180deg, #16202b, #111923);
  border: 1px solid #2c3d4f;
  border-radius: 14px;
  padding: 12px 20px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
}
.ent-root-title { font-size: 15px; font-weight: 750; letter-spacing: 0.12em; }
.ent-root-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.ent-stem { width: 2px; height: 26px; background: #2a3a4a; }
.ent-hline {
  height: 2px;
  width: 100%;
  background: linear-gradient(90deg, transparent, #2a3a4a 8%, #2a3a4a 92%, transparent);
}
.ent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
  width: 100%;
  margin-top: 24px;
}
.ent-block {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 13px 14px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-top: 3px solid var(--block-color);
  border-radius: 13px;
}
.ent-block::before {
  content: "";
  position: absolute;
  top: -26px;
  left: 50%;
  width: 2px;
  height: 26px;
  background: #2a3a4a;
}
.ent-block.is-empty { opacity: 0.7; border-top-color: #3b4b5c; }
.ent-block-head { display: flex; gap: 10px; align-items: flex-start; }
.ent-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--block-color);
  background: color-mix(in srgb, var(--block-color) 14%, transparent);
}
.ent-name { font-size: 13px; font-weight: 650; line-height: 1.3; }
.ent-desc { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.ent-meta { display: flex; gap: 12px; font-size: 10px; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.04em; }
.ent-depts { display: flex; flex-wrap: wrap; gap: 4px; }
.ent-dept-chip {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
  color: var(--muted);
}
.ent-staff { display: flex; flex-direction: column; gap: 1px; }
.ent-person {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 4px 5px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.ent-person:hover { background: rgba(255, 255, 255, 0.05); }
.ent-person-text { display: flex; flex-direction: column; min-width: 0; }
.ent-person-name { font-size: 11.5px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ent-person-pos { font-size: 9.5px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ent-empty {
  font-size: 11px;
  color: var(--muted-2);
  padding: 7px;
  text-align: center;
  border: 1px dashed #2a3a4a;
  border-radius: 7px;
}
.ent-rooms {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  padding-top: 7px;
  border-top: 1px solid var(--border-soft);
  font-size: 10.5px;
  color: var(--muted);
}
.ent-rooms-label { color: var(--muted-2); }
.ent-room-chip { background: rgba(255, 255, 255, 0.04); border-radius: 4px; padding: 1px 6px; }

/* --- Склад ---------------------------------------------------------------- */

.tab-count {
  font-size: 9.5px;
  line-height: 1.5;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.18);
  color: var(--accent-bright);
}
.tab-count:empty { display: none; }

.warehouse-content { display: flex; flex-direction: column; gap: 14px; }
.warehouse-item-cell { display: flex; align-items: center; gap: 10px; min-width: 230px; }
.warehouse-thumb {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--panel-2);
  color: var(--muted-2);
}
.warehouse-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.supplier-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--muted);
}
.supplier-chip i { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.supplier-chip.trusted { color: #86efac; }
.supplier-chip.blocked { color: #fca5a5; }

.supplier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
}
.supplier-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
}
.supplier-card.blocked {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.04);
}
.supplier-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.supplier-name { font-size: 13.5px; font-weight: 650; }
.supplier-status { display: flex; align-items: center; gap: 5px; font-size: 10.5px; margin-top: 3px; }
.supplier-dot { width: 7px; height: 7px; border-radius: 50%; }
.supplier-warning { color: #f87171; display: flex; }
.supplier-contacts { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--muted); }
.supplier-contacts > span { display: flex; align-items: center; gap: 6px; }
.supplier-notes { font-size: 11px; color: var(--muted-2); line-height: 1.45; }
.supplier-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
}

.photo-edit-row { display: flex; align-items: center; gap: 12px; }
.photo-edit-actions { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.form-photo-preview {
  width: 84px;
  height: 84px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted-2);
}
.form-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.detail-quick-edit {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 13px;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: 9px;
}
.stock-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.stock-value.low { color: #f87171; }
.low-text { color: #f87171; }
.low-check { white-space: nowrap; margin-left: 4px; font-size: 12px; }
.toolbar-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted-2);
  margin-right: auto;
}

.request-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.request-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 13px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.14s, transform 0.12s, box-shadow 0.14s;
}
.request-card:hover {
  border-color: #32465b;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}
.request-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.request-number { font-family: var(--mono); font-size: 12px; color: var(--accent-bright); }
.request-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 11px; color: var(--muted); }
.request-meta > span { display: flex; align-items: center; gap: 5px; }
.request-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
  font-size: 11px;
  color: var(--muted);
}
.request-task {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted-2);
}
.request-open { margin-left: auto; display: flex; color: var(--muted-2); }

.movement-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--panel-2);
}
.movement-row {
  display: grid;
  grid-template-columns: 92px 92px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 3px 4px;
  font-size: 11px;
}
.movement-type { font-weight: 600; }
.movement-qty.plus { color: #4ade80; }
.movement-qty.minus { color: #f87171; }
.movement-balance, .movement-date { color: var(--muted-2); }
.movement-date { font-size: 10px; }

.request-lines { display: flex; flex-direction: column; gap: 6px; }
.request-line { display: grid; grid-template-columns: 1fr 110px 32px; gap: 6px; align-items: center; }
.request-add { align-self: flex-start; margin-top: 6px; }

.request-detail-lines { display: flex; flex-direction: column; gap: 6px; }
.request-detail-line {
  display: grid;
  grid-template-columns: 1fr 120px 120px;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--panel-2);
}
.request-detail-name { min-width: 0; }
.request-detail-qty, .request-detail-approve { display: flex; flex-direction: column; gap: 2px; }
.request-detail-approve .input { width: 100%; }

/* --- Группы ---------------------------------------------------------------- */

.group-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.group-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.14s, border-color 0.14s, background 0.14s;
}
.group-chip:hover { color: var(--text); border-color: #31455b; }
.group-chip.active {
  color: var(--accent-bright);
  background: var(--accent-dim);
  border-color: rgba(245, 158, 11, 0.4);
}
.group-chip-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); flex-shrink: 0; }
.group-chip-count {
  font-size: 10px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted-2);
}
.group-settings { width: 30px; height: 30px; }

.group-manage-list { display: flex; flex-direction: column; gap: 8px; }
.group-edit-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: 9px;
}
.group-manage-row { display: grid; grid-template-columns: 32px 1fr auto 32px; gap: 8px; align-items: center; }
.group-manage-count { font-size: 10.5px; color: var(--muted-2); white-space: nowrap; }
.color-input {
  width: 32px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}
.section-label { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-2); }
.section-checks { display: flex; flex-wrap: wrap; gap: 7px 13px; }
.section-check { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); cursor: pointer; }
.section-check input { accent-color: var(--accent); }
.group-permissions { margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--border-soft); display: flex; flex-direction: column; gap: 6px; }
.permission-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.permission-module {
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 7px 9px;
  background: var(--panel-2);
}
.permission-module-name {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  margin-bottom: 4px;
}
.permission-checks { display: flex; flex-direction: column; gap: 3px; }
.permission-check { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); cursor: pointer; }
.permission-check input { accent-color: var(--accent); }
.group-create-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 8px;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
}
.group-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
}
.group-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; }
.group-check input { accent-color: var(--accent); }
.group-pill {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--group-color);
  background: color-mix(in srgb, var(--group-color) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--group-color) 26%, transparent);
}
.field-full { grid-column: 1 / -1; }

/* --- Настройки ------------------------------------------------------------ */

.settings-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 14px;
  align-items: start;
}
.settings-card { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.settings-wide { grid-column: 1 / -1; }
.templates-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.template-list { display: flex; flex-direction: column; gap: 7px; }
.template-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--panel-2);
}
.template-main { flex: 1; min-width: 0; }
.template-name { font-size: 12.5px; font-weight: 600; }
.template-desc {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.template-prefix {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted-2);
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settings-card-head h2 { font-size: 16px; }
.settings-card-head p { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.logo-row { display: flex; gap: 14px; align-items: flex-start; }
.logo-preview {
  width: 96px;
  height: 96px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
}
.logo-preview img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.logo-placeholder { display: flex; color: var(--muted-2); }
.logo-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.accent-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.color-text { max-width: 110px; }
.module-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.module-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  font-size: 12.5px;
  cursor: pointer;
}
.module-check input { accent-color: var(--accent); }
.module-check.locked { opacity: 0.7; }
.module-check.locked input { cursor: not-allowed; }
.module-check-name { flex: 1; }
.module-check-id { font-size: 9.5px; color: var(--muted-2); font-family: var(--mono); }
.settings-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.04);
  border: 1px solid rgba(56, 189, 248, 0.13);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}
.settings-note span { display: flex; }
.settings-note span:last-child { display: block; }
.settings-page > .form-error { margin-top: 8px; }

@media (max-width: 1100px) {
  .settings-grid { grid-template-columns: 1fr; }
}

/* --- Сотрудник: вверенное имущество, задачи и журнал ---------------------- */

.detail-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.detail-assigned { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.assigned-list { display: flex; flex-direction: column; gap: 6px; }
.assigned-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.assigned-item:hover { border-color: rgba(245, 158, 11, 0.3); }
.assigned-item.static { cursor: default; }
.assigned-icon { display: flex; color: var(--accent); flex-shrink: 0; }
.assigned-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.assigned-name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assigned-sub { font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assigned-status { font-size: 10px; white-space: nowrap; }
.assigned-arrow { color: var(--muted-2); display: flex; }
.assigned-qty { font-size: 11px; color: var(--muted); white-space: nowrap; }
.assigned-empty { padding: 10px; border: 1px dashed var(--border); border-radius: 8px; color: var(--muted); font-size: 11.5px; }

.btn-xs { padding: 4px 7px; font-size: 10.5px; border-radius: 6px; gap: 4px; min-height: 0; }
.btn-xs svg { width: 13px; height: 13px; }
.task-quick { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.task-review-hint {
  font-size: 9.5px;
  color: #c4b5fd;
  background: rgba(167, 139, 250, 0.12);
  border-radius: 999px;
  padding: 1px 7px;
}
.task-items-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9.5px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
  padding: 1px 7px;
}
.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
}
.task-history { padding-top: 4px; }
.timeline { display: flex; flex-direction: column; gap: 0; margin-top: 4px; }
.timeline-item { display: grid; grid-template-columns: 14px 1fr; gap: 9px; padding-bottom: 12px; position: relative; }
.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 14px;
  bottom: 0;
  width: 1px;
  background: var(--border-soft);
}
.timeline-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 3px; z-index: 1; }
.timeline-body { min-width: 0; }
.timeline-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.timeline-title { font-size: 11.5px; font-weight: 600; }
.timeline-date { font-size: 10px; color: var(--muted-2); }
.timeline-comment { font-size: 11.5px; color: #c3d0de; margin-top: 3px; line-height: 1.45; }
.timeline-user { font-size: 10px; color: var(--muted-2); margin-top: 2px; }

.activity-table td { vertical-align: top; }
.activity-time { white-space: nowrap; font-size: 10.5px; }
.activity-details { max-width: 440px; word-break: break-word; }

/* --- Задачи: статусы, проверка и участники -------------------------------- */

.status-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 8px;
  scrollbar-width: thin;
}
.status-tabs::-webkit-scrollbar { height: 4px; }
.status-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}
.status-tab:hover { border-color: var(--border); color: var(--text); }
.status-tab.active {
  color: var(--status-color, var(--accent-bright));
  border-color: color-mix(in srgb, var(--status-color, var(--accent)) 45%, transparent);
  background: color-mix(in srgb, var(--status-color, var(--accent)) 12%, transparent);
}
.status-tab-dot { width: 7px; height: 7px; border-radius: 50%; }
.status-tab-count {
  font-size: 9.5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  font-variant-numeric: tabular-nums;
}
.review-banner {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  margin-bottom: 12px;
  border: 1px solid rgba(167, 139, 250, 0.32);
  background: rgba(167, 139, 250, 0.08);
  border-radius: 11px;
}
.review-banner.hidden { display: none; }
.review-banner-icon { display: flex; color: #c4b5fd; flex-shrink: 0; }
.review-banner-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.review-banner-body strong { font-size: 12.5px; color: #ddd6fe; }
.review-banner-body span { font-size: 11px; color: var(--muted); }
.review-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 11.5px;
  line-height: 1.45;
  color: #d8ccff;
  background: rgba(167, 139, 250, 0.09);
  border: 1px solid rgba(167, 139, 250, 0.24);
}
.review-note.for-creator {
  color: #e9e2ff;
  border-color: rgba(167, 139, 250, 0.4);
  background: rgba(167, 139, 250, 0.13);
}
.review-note span:first-child { display: flex; margin-top: 1px; }
.task-status-bottom {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}
.task-status-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
}
.task-status-bottom select { width: auto; min-width: 150px; }
.task-status-pill {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--status-color, #94a3b8) 35%, transparent);
  background: color-mix(in srgb, var(--status-color, #94a3b8) 10%, transparent);
  color: var(--status-color, #94a3b8);
  font-size: 9.5px;
  white-space: nowrap;
}
.task-team-count {
  font-size: 9.5px;
  color: var(--muted);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 1px 6px;
}
.task-people-list { display: flex; flex-wrap: wrap; gap: 5px; }
.task-person {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px 2px 3px;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  font-size: 10.5px;
}
.task-person.observer { border-style: dashed; color: var(--muted); }
.party-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  max-height: 150px;
  overflow: auto;
  padding: 7px;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  background: var(--panel-2);
}
.party-check {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border-radius: 6px;
  cursor: pointer;
}
.party-check:hover { background: rgba(255, 255, 255, 0.04); }
.party-check input { accent-color: var(--accent); }
.party-check-name {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.party-check-role {
  font-size: 9px;
  color: var(--muted-2);
  max-width: 88px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Импорт склада -------------------------------------------------------- */

.import-body { display: flex; flex-direction: column; gap: 12px; }
.import-intro {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 11px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--panel-2);
}
.import-intro strong { font-size: 12.5px; }
.import-intro p { font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.import-icon { color: var(--accent); display: flex; flex-shrink: 0; }
.import-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.import-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 9.5px;
  color: var(--muted-2);
}
.import-columns span {
  padding: 2px 6px;
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.02);
}
.import-status { font-size: 11.5px; color: var(--muted); }
.import-update {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--muted);
  cursor: pointer;
}
.import-update input { accent-color: var(--accent); }
.import-preview { max-height: 290px; overflow: auto; border-radius: 9px; }
.import-table { min-width: 680px; }
.import-row-error { background: rgba(239, 68, 68, 0.05); }
.import-error-text { color: #fca5a5; font-size: 10px; line-height: 1.35; }

.archive-body { display: flex; flex-direction: column; gap: 10px; }
.archive-body .search-wrap { flex: 0 0 auto; }
.archive-table { min-width: 640px; }
.archive-summary {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  background: rgba(56, 189, 248, 0.06);
}
.archive-icon { display: flex; color: #7dd3fc; margin-top: 1px; }
.archive-summary strong { display: block; font-size: 12.5px; }
.archive-summary span { font-size: 11px; color: var(--muted); line-height: 1.45; }
.archive-table-card { max-height: 52vh; overflow: auto; }
.archive-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 52vh;
  overflow: auto;
  padding-right: 2px;
}
.archive-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 11px;
  text-align: left;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  cursor: pointer;
}
.archive-item:hover { border-color: rgba(56, 189, 248, 0.3); }
.archive-item-main { flex: 1; min-width: 0; }
.archive-item-title { font-size: 12.5px; font-weight: 600; }
.archive-item-desc {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.archive-item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
  font-size: 10px;
  color: var(--muted);
}
.archive-item-arrow { color: var(--muted-2); display: flex; flex-shrink: 0; }
.archive-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 11.5px;
  line-height: 1.45;
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.22);
}
.archive-note span:first-child { display: flex; margin-top: 1px; color: #94a3b8; }
@media (max-width: 720px) {
  .archive-table { min-width: 760px; }
  .archive-table-card { max-height: 46vh; }
}
/* --- Поиск сотрудников и позиции задачи ---------------------------------- */

.employee-picker { display: flex; flex-direction: column; gap: 5px; }
.picker-input { width: 100%; }
.picker-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.picker-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 2px 5px 2px 2px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--panel-2);
  font-size: 10.5px;
}
.picker-chip-avatar { display: flex; }
.picker-chip-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-chip-remove {
  display: flex;
  padding: 1px;
  color: var(--muted-2);
  background: none;
  border: none;
  cursor: pointer;
}
.picker-chip-remove:hover { color: #fca5a5; }
.picker-dropdown {
  display: flex;
  flex-direction: column;
  max-height: 190px;
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0c131b;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
}
.picker-dropdown.hidden { display: none; }
.picker-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 7px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.picker-option:hover { background: rgba(255, 255, 255, 0.05); }
.picker-option-avatar { display: flex; flex-shrink: 0; }
.picker-option-body { display: flex; flex-direction: column; min-width: 0; }
.picker-option-name { font-size: 11.5px; }
.picker-option-position { font-size: 9.5px; color: var(--muted); }
.picker-empty { padding: 8px; font-size: 11px; color: var(--muted); text-align: center; }

.task-items-editor { display: flex; flex-direction: column; gap: 7px; }
.task-item-add { display: grid; grid-template-columns: minmax(0, 1fr) 105px auto; gap: 6px; }
.task-items-list { display: flex; flex-direction: column; gap: 5px; }
.task-items-empty { font-size: 11px; color: var(--muted); padding: 8px; border: 1px dashed var(--border); border-radius: 7px; }
.task-item-row, .task-warehouse-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--panel-2);
}
.task-item-icon { display: flex; color: var(--accent); flex-shrink: 0; }
.task-item-body { flex: 1; min-width: 0; }
.task-item-name { font-size: 11.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-item-sub { font-size: 9.5px; color: var(--muted); }
.task-item-qty-wrap { display: flex; align-items: center; gap: 4px; }
.task-item-qty { width: 82px; padding: 5px 7px; font-size: 11px; }
.task-item-unit { font-size: 10px; color: var(--muted); }
.task-warehouse { display: flex; flex-direction: column; gap: 7px; }
.task-warehouse-list { display: flex; flex-direction: column; gap: 5px; }
.task-warehouse-qty { font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.task-warehouse-stock { font-size: 9.5px; color: var(--muted); white-space: nowrap; }
.task-written-off { font-size: 9.5px; color: #86efac; white-space: nowrap; }

.template-fields { display: flex; flex-direction: column; gap: 7px; }
.template-fields-title {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  padding-top: 2px;
}
.template-fields-grid { gap: 8px; }
.task-type-chooser { display: flex; flex-direction: column; gap: 14px; }
.task-type-intro { margin: 0; color: var(--muted); font-size: 13px; }
.task-type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.task-type-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.task-type-card:hover { border-color: var(--accent); background: var(--surface-3); transform: translateY(-1px); }
.task-type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  color: #fff;
  background: var(--accent);
}
.task-type-icon.type-repair { background: #c084fc; }
.task-type-icon.type-calculation { background: #22c55e; }
.task-type-icon.type-other { background: #64748b; }
.task-type-name { font-size: 15px; font-weight: 700; }
.task-type-desc { font-size: 12px; line-height: 1.45; color: var(--muted); }
.template-requirements {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 11px;
  background: var(--surface-2);
}
.template-requirements summary { cursor: pointer; font-size: 12px; color: var(--accent); }
.template-requirements-text { margin-top: 7px; font-size: 12px; line-height: 1.55; color: var(--muted); }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.task-form { gap: 9px; }
.task-form .field-label { font-size: 10.5px; }
.task-form .field-hint { font-size: 10.5px; }
.task-form .template-fields-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.task-form-section-title {
  margin: 5px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.task-drawings-field {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: var(--surface-2);
  gap: 8px;
}
.task-drawings-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.task-drawings-head > div { display: flex; flex-direction: column; gap: 3px; }
.task-drawing-preview { display: flex; flex-wrap: wrap; gap: 6px; }
.task-drawing-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-3);
  font-size: 11px;
}
.task-drawing-chip-icon { color: var(--accent); display: inline-flex; }
.task-drawing-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.task-drawings-section { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--border); }
.task-drawings-gallery { min-height: 24px; }
.task-drawing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.task-drawing-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
}
.task-drawing-image {
  display: block;
  width: 100%;
  height: 120px;
  padding: 0;
  border: 0;
  background: #0b1118;
  cursor: pointer;
  overflow: hidden;
}
.task-drawing-image img { width: 100%; height: 100%; object-fit: contain; display: block; }
.task-drawing-file-icon { display: flex; align-items: center; justify-content: center; height: 72px; color: var(--accent); background: var(--surface-3); }
.task-drawing-card-body { padding: 7px 8px 3px; min-width: 0; }
.task-drawing-name { font-size: 11.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-drawing-card-actions { display: flex; gap: 2px; padding: 2px 5px 5px; justify-content: flex-end; }
@media (max-width: 1100px) { .form-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .task-form .template-fields-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .form-grid-4, .task-form .template-fields-grid { grid-template-columns: 1fr; } .task-drawings-head { flex-direction: column; } }
.task-stages { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.task-stages-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.task-stages-head .detail-subtitle { margin: 0 0 3px; }
.task-stages-empty { font-size: 12px; color: var(--muted); padding: 8px 0; }
.task-stage-list { display: flex; flex-direction: column; gap: 7px; }
.task-stage-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-left: 3px solid #64748b;
  border-radius: 9px;
  background: var(--surface-2);
}
.task-stage-row.stage-in_progress { border-left-color: #f59e0b; }
.task-stage-row.stage-done { border-left-color: #22c55e; opacity: .82; }
.task-stage-number {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-3);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}
.task-stage-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.task-stage-title-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-stage-title { font-size: 13px; font-weight: 600; }
.task-stage-meta { display: flex; gap: 4px 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.task-stage-comment { font-size: 12px; color: var(--muted); white-space: pre-wrap; }
.task-stage-actions { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.task-stage-actions .icon-btn:disabled { opacity: .3; cursor: default; }
@media (max-width: 640px) {
  .task-stage-row { flex-wrap: wrap; }
  .task-stage-actions { width: 100%; justify-content: flex-start; padding-left: 34px; }
}
.task-document-data { display: flex; flex-direction: column; gap: 6px; }
.task-document-field { display: contents; }
.pre-wrap { white-space: pre-wrap; }
@media (max-width: 640px) { .task-type-grid { grid-template-columns: 1fr; } }

/* --- Адаптивность --------------------------------------------------------- */

@media (max-width: 1280px) {
  .map-body { grid-template-columns: 178px 1fr 280px; }
  .map-head { flex-direction: column; }
  .map-head-right { width: 100%; align-items: stretch; margin-left: 0; }
  .map-actions { flex-wrap: wrap; }
  .map-stats { justify-content: flex-start; }
}

@media (max-width: 1100px) {
  .map-body { grid-template-columns: 168px 1fr 260px; }
  .clock { display: none; }
  .auth-hero { padding: 34px; }
}

@media (max-width: 960px) {
  .main { padding: 16px; }
  .topbar { gap: 12px; padding: 0 14px; }
  .user-chip-text { display: none; }
  .nav-tab span { display: none; }
  .nav-tab { padding: 9px; }
  .auth-screen { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-panel { min-height: 100vh; }
  .map-page { height: auto; min-height: 0; }
  .map-body { grid-template-columns: 1fr; }
  .map-tools { flex-direction: row; flex-wrap: wrap; overflow: visible; }
  .tool-btn .tool-label, .tool-btn kbd { display: none; }
  .object-palette { width: 100%; max-height: 200px; }
  .map-stage { height: clamp(250px, 54vw, 520px); min-height: 0; }
  .map-inspector { max-height: none; }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-photo { max-width: 220px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .page-head { flex-direction: column; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .form-grid, .form-grid-2 { grid-template-columns: 1fr; }
  .modal { max-height: calc(100vh - 24px); }
  .modal-overlay { padding: 12px; }
  .modal-body { padding: 14px; }
  .modal-head, .modal-foot { padding-left: 14px; padding-right: 14px; }
  .detail-list { grid-template-columns: 1fr; gap: 3px; }
  .detail-list dt { margin-top: 7px; }
  .equipment-grid { grid-template-columns: 1fr; }
  .map-head { flex-direction: column; }
  .map-actions { width: 100%; flex-wrap: wrap; }
  .save-status { width: 100%; }
  .footer { flex-direction: column; }
  .toast { min-width: 0; }
}

@media (max-width: 460px) {
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-card { padding: 20px; }
  .auth-panel { padding: 16px; }
}

@media (max-width: 720px) {
  body { padding-bottom: 64px; }
  .topbar { height: 58px; padding: 0 12px; gap: 8px; backdrop-filter: none; -webkit-backdrop-filter: none; background: #0a0f15; }
  .brand { gap: 8px; }
  .brand-title { font-size: 13px; max-width: 120px; letter-spacing: 0.1em; }
  .brand-sub { font-size: 8.5px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-mark svg { width: 30px; height: 30px; }
  .nav-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    height: 64px;
    display: flex;
    justify-content: flex-start;
    gap: 0;
    padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
    background: rgba(10, 15, 22, 0.98);
    border-top: 1px solid var(--border);
    overflow-x: auto;
    backdrop-filter: blur(14px);
  }
  .nav-tabs::-webkit-scrollbar { display: none; }
  .nav-tab {
    flex: 0 0 64px;
    min-width: 64px;
    max-width: 74px;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 4px 2px;
    border: none;
    background: transparent;
    font-size: 8.5px;
  }
  .nav-tab span {
    display: block;
    max-width: 64px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 8.5px;
  }
  .nav-tab svg { width: 19px; height: 19px; }
  .nav-tab.active { border: none; }
  .main { padding: 12px; padding-bottom: 8px; }
  .footer { display: none; }
  .page-title h1 { font-size: 21px; }
  .page-head { gap: 10px; }
  .page-actions { flex-wrap: wrap; }
  .page-actions .btn { flex: 1 1 auto; min-height: 40px; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat-card { padding: 10px; }
  .stat-value { font-size: 19px; }
  .toolbar { gap: 7px; }
  .toolbar .search-wrap, .toolbar > .input { flex: 1 1 100%; min-width: 0; }
  .toolbar-right { width: 100%; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 720px; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { max-height: 100dvh; width: 100%; border-radius: 16px 16px 0 0; }
  .modal-lg, .modal-md, .modal-sm { max-width: 100%; }
  .modal-body { padding: 14px; max-height: calc(100dvh - 130px); overflow: auto; }
  .modal-foot { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .modal-actions { width: 100%; flex-wrap: wrap; }
  .modal-actions .btn { flex: 1 1 auto; min-height: 42px; }
  .detail-photo { max-width: 100%; }
  .detail-layout { gap: 14px; }
  .task-actions .btn { flex: 1 1 100%; }
  .status-tabs { margin: 0 -12px; padding-left: 12px; padding-right: 12px; }
  .review-banner { flex-wrap: wrap; }
  .review-banner .btn { flex: 1 1 100%; }
  .party-checks { grid-template-columns: 1fr; max-height: 200px; }
  .task-status-bottom { justify-content: space-between; }
  .task-status-bottom select { flex: 1; min-width: 0; }
  .kanban { grid-auto-columns: minmax(260px, 84vw); }
  .task-card { padding: 10px; }
  .assigned-item { padding: 9px; }
  .activity-details { max-width: none; }
  .activity-table { min-width: 820px; }
  .group-checks { grid-template-columns: 1fr; }
  .permission-groups { grid-template-columns: 1fr; }
  .settings-card { padding: 13px; }
  .templates-head { flex-direction: column; }
  .template-row { flex-wrap: wrap; }
  .template-prefix { max-width: 100%; }
  .logo-row { flex-direction: column; }
  .module-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
