:root {
  --brand-lime: #D8E41C;
  --brand-dark: #18181B;
  --bg-light: #F3F5F8;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  height: 100dvh;
  max-width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  color: #18181B;
  overflow: hidden;
  background-color: var(--bg-light);
  background-image: linear-gradient(180deg, #F6F8FA 0%, #EDF1F6 100%);
}

#app {
  position: relative;
  z-index: 1;
}

/* Плавное проявление при переключении разделов */
@keyframes glassReveal {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

.glass-reveal {
  animation: glassReveal 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(24, 24, 27, 0.35);
  outline-offset: 1px;
}

input,
textarea,
[contenteditable="true"] {
  -webkit-user-select: text !important;
  user-select: text !important;
}

select {
  -webkit-user-select: auto !important;
  user-select: auto !important;
}

/* Спокойные чистые белые панели без пестроты и кислотных засветов */
.lg-panel {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid #E2E8F0;
  box-shadow:
    0 4px 16px -8px rgba(15, 23, 42, 0.06),
    0 1px 2px rgba(15, 23, 42, 0.03);
  border-radius: 8px;
}

.lg-card {
  background: #FFFFFF;
  border: 1px solid #E4E8EE;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
  border-radius: 6px;
  transition: background-color 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.lg-card:hover {
  background: #FFFFFF;
  border-color: #CBD5E1;
  box-shadow: 0 4px 12px -6px rgba(15, 23, 42, 0.07);
}

/* Деликатные состояния карточек без кричащих заливок */
.state-urgent {
  background: linear-gradient(135deg, #FFF1F2 0%, #FFFFFF 75%);
  border: 1px solid rgba(225, 29, 72, 0.28);
  border-left: 3px solid #E11D48;
  border-radius: 7px;
}

/* Карточка с проблемой / вопросом: вся карточка слегка красная + редкая деликатная вибрация раз в 8 сек */
@keyframes rareAlertTremor {
  0%, 91%, 100% {
    transform: translate3d(0, 0, 0);
  }
  92.5% {
    transform: translate3d(-1.5px, 0, 0);
  }
  94% {
    transform: translate3d(1.5px, 0, 0);
  }
  95.5% {
    transform: translate3d(-1px, 0, 0);
  }
  97% {
    transform: translate3d(1px, 0, 0);
  }
}

.card-issue-alert {
  background: linear-gradient(135deg, #FFE4E6 0%, #FFF1F2 65%, #FFF8F8 100%) !important;
  border: 1px solid rgba(225, 29, 72, 0.42) !important;
  box-shadow: 0 4px 14px -6px rgba(225, 29, 72, 0.22) !important;
  animation: rareAlertTremor 8s ease-in-out infinite;
}

.state-active {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-left: 3px solid #64748B;
  border-radius: 7px;
}

.state-transit {
  background: linear-gradient(135deg, #F0F9FF 0%, #FFFFFF 80%);
  border: 1px solid #BAE6FD;
  border-left: 3px solid #0284C7;
  border-radius: 7px;
}

.state-done {
  background: linear-gradient(135deg, #F8FAFC 0%, #FFFFFF 80%);
  border: 1px solid #D1FAE5;
  border-left: 3px solid #10B981;
  border-radius: 7px;
}

.state-neutral {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-left: 3px solid #CBD5E1;
  border-radius: 7px;
}

/* Кнопки */
.btn-brand,
.lg-btn-primary,
.btn-dark,
.btn-glass,
.lg-btn-glass,
.btn-danger-soft {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  max-width: 100%;
  line-height: 1.25;
  text-align: center;
  word-break: normal;
  border-radius: 5px;
  transition: transform 0.12s ease, background 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.btn-icon-sq {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  padding: 0;
  flex-shrink: 0;
  font-size: 0.85rem;
}

.btn-brand:active,
.btn-dark:active,
.btn-glass:active,
.btn-danger-soft:active {
  transform: scale(0.985);
}

/* Фирменный лаймовый акцент — только для главных кнопок и активного пункта */
.btn-brand,
.lg-btn-primary {
  background: #DCE722;
  color: #18181B;
  border: 1px solid #BDC810;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65), 0 1px 2px rgba(15, 23, 42, 0.06);
  font-weight: 700;
}
.btn-brand:hover,
.lg-btn-primary:hover {
  background: #D2DE15;
  border-color: #A6B00A;
}

/* Строгая сланцевая кнопка вторичного действия */
.btn-dark {
  background: #F1F5F9;
  color: #0F172A;
  border: 1px solid #CBD5E1;
  box-shadow: inset 0 1px 0 #FFFFFF;
  font-weight: 600;
}
.btn-dark:hover {
  background: #E2E8F0;
  border-color: #94A3B8;
}

/* Спокойная нейтральная кнопка */
.btn-glass,
.lg-btn-glass {
  background: #FFFFFF;
  color: #3F3F46;
  border: 1px solid #E2E8F0;
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.02);
  font-weight: 500;
}
.btn-glass:hover,
.lg-btn-glass:hover {
  background: #F8FAFC;
  color: #18181B;
  border-color: #CBD5E1;
}

.nav-item-idle {
  color: #52525B;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  transition: all 0.14s ease;
}
.nav-item-idle:hover {
  color: #18181B;
  background: #F1F5F9;
  border-color: #E2E8F0;
}

.btn-danger-soft {
  background: #FFF1F2;
  color: #9F1239;
  border: 1px solid #FECDD3;
  font-weight: 600;
}
.btn-danger-soft:hover {
  background: #FFE4E6;
  border-color: #FDA4AF;
}

/* Спокойные монохромные и статусные бейджи (без кислотной радуги и переносов строк) */
.glass-code {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.52rem;
  font-size: 0.76rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  color: #1E293B;
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  border-radius: 5px;
}

.glass-chip-urgent {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.16rem 0.52rem;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  color: #9F1239;
  background: #FFE4E6;
  border: 1px solid #FDA4AF;
  border-radius: 5px;
}

.glass-chip-ok {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.16rem 0.52rem;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  color: #065F46;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  border-radius: 5px;
}

.glass-chip-sky {
  display: inline-flex;
  align-items: center;
  padding: 0.16rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  color: #334155;
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  border-radius: 5px;
}

.lg-input {
  background-color: #FFFFFF;
  border: 1px solid #CBD5E1;
  outline: none;
  border-radius: 5px;
  color: #18181B;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.lg-input:hover {
  border-color: #94A3B8;
}
.lg-input:focus,
.lg-input:focus-visible {
  outline: none;
  background-color: #FFFFFF;
  border-color: #475569;
  box-shadow: 0 0 0 3px rgba(71, 85, 105, 0.14);
}

.stage-drop-active {
  border-color: #64748B !important;
  background: #F8FAFC !important;
  box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.22);
}

.item-muted {
  opacity: 0.55;
}
.item-muted:hover {
  opacity: 0.88;
}

.lg-mobile-dock {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid #E2E8F0;
  box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.06);
  padding-bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
}

.chat-bubble-mine {
  background: #F4F7D4;
  color: #18181B;
  border: 1px solid #D5DF7B;
  border-radius: 8px 8px 2px 8px;
}

.chat-bubble-other {
  background: #FFFFFF;
  color: #18181B;
  border: 1px solid #E2E8F0;
  border-radius: 8px 8px 8px 2px;
}

.sheet-iframe-wrap {
  height: calc(100vh - 210px);
  min-height: 440px;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.15);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 23, 42, 0.28);
}

.ctrl-micro {
  font-size: 0.775rem;
  line-height: 1.2;
  padding: 0.3rem 0.62rem;
  min-height: 1.9rem;
  white-space: nowrap;
  flex-shrink: 0;
}

select.ctrl-micro,
select.lg-input {
  white-space: nowrap;
  text-overflow: ellipsis;
}

.btn-action-lg {
  font-size: 0.825rem;
  line-height: 1.25;
  padding: 0.48rem 0.88rem;
  min-height: 2.25rem;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

/* Спокойная нейтральная плашка типа постройки в одну строку без переносов */
.lg-type-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.16rem 0.5rem;
  font-size: 0.7rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  flex-shrink: 0;
  color: #334155;
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  border-radius: 5px;
}

.passport-tile {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
}

@keyframes teleportPulse {
  0% { box-shadow: 0 0 0 0 rgba(71, 85, 105, 0.45); background-color: #FEFCE8; }
  65% { box-shadow: 0 0 0 8px rgba(71, 85, 105, 0.08); background-color: #FEFCE8; }
  100% { box-shadow: none; }
}
.teleport-flash {
  animation: teleportPulse 2s ease-out;
}

/* =========================================================================
   МОДУЛЬ «СПИСОК ОТГРУЗОК» В ЦУП (ГОРИЗОНТАЛЬНЫЕ МАТРИЦЫ, ОКНА, ЛЕВЫЙ САЙДБАР)
   ========================================================================= */
.shp-workspace {
  width: min(1420px, 98vw);
  height: min(94dvh, 960px);
  display: flex;
  flex-direction: column;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}

.shp-body-split {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
}

@media (max-width: 1023px) {
  .shp-workspace {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }
  .shp-body-split {
    grid-template-columns: minmax(0, 1fr);
    position: relative;
  }
  .shp-sidebar {
    position: absolute;
    inset: 0 auto 0 0;
    width: min(310px, 88vw);
    z-index: 30;
    box-shadow: 12px 0 32px rgba(15, 23, 42, 0.35);
    transform: translateX(-104%);
    transition: transform 0.18s ease-out;
  }
  .shp-sidebar.is-open-mobile {
    transform: translateX(0);
  }
}

.shp-sidebar {
  background: #0f172a;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid #1e293b;
}

.shp-order-card {
  padding: 10px 11px;
  border-radius: 8px;
  background: #1e293b;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.shp-order-card:hover {
  background: #263449;
}
.shp-order-card.active {
  background: #172554;
  border-color: #60a5fa;
}

.shp-mini-bar {
  flex: 1;
  height: 5px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 99px;
  overflow: hidden;
}
.shp-mini-bar-fill {
  height: 100%;
  background: #22c55e;
  transition: width 0.2s ease;
}

.shp-doc-sheet {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 20px 22px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.shp-key-grid {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
@media (max-width: 767px) {
  .shp-key-grid {
    grid-template-columns: 1fr;
  }
  .shp-doc-sheet {
    padding: 12px;
  }
}

.shp-key-box {
  background: #f8fafc;
  border: 1.5px solid #94a3b8;
  border-radius: 8px;
  padding: 7px 11px;
}
.shp-key-lbl {
  font-size: 10.5px;
  text-transform: uppercase;
  font-weight: 700;
  color: #475569;
  letter-spacing: 0.03em;
}
.shp-key-val {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  margin-top: 1px;
  line-height: 1.25;
}

.shp-section {
  margin-bottom: 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.shp-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  background: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
}
.shp-sec-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: #0f172a;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.shp-sec-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 6px;
  background: #ffffff;
  border: 1.5px solid #64748b;
}
.shp-sec-badge.is-alert {
  background: #fef2f2;
  border-color: #ef4444;
  color: #991b1b;
}

.shp-hmatrix-wrap {
  width: 100%;
  overflow-x: auto;
}
.shp-hmatrix-wrap + .shp-hmatrix-wrap {
  border-top: 2px solid #cbd5e1;
}
.shp-hmatrix-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 520px;
}
.shp-hmatrix-table th,
.shp-hmatrix-table td {
  border-right: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
  padding: 6px 7px;
  text-align: center;
  vertical-align: middle;
}
.shp-hmatrix-table tr:last-child th,
.shp-hmatrix-table tr:last-child td {
  border-bottom: none;
}
.shp-hmatrix-table th:last-child,
.shp-hmatrix-table td:last-child {
  border-right: none;
}
.shp-hmatrix-row-lbl {
  width: 124px;
  text-align: left !important;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  background: #f8fafc;
  padding-left: 10px !important;
  white-space: nowrap;
}
.shp-hmatrix-role-sup {
  color: #166534;
  background: #f0fdf4;
}
.shp-hmatrix-role-inst {
  color: #1e40af;
  background: #eff6ff;
}
.shp-check-cell.is-sup-ok {
  background: #dcfce7;
}
.shp-check-cell.is-inst-ok {
  background: #dbeafe;
}
.shp-check-cell.is-changed {
  background: #fff1f2;
}

.shp-box-lbl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #94a3b8;
  background: #ffffff;
  font-size: 11.5px;
  font-weight: 700;
}
.shp-box-lbl.is-sup-ok {
  border-color: #16a34a;
  background: #dcfce7;
  color: #14532d;
}
.shp-box-lbl.is-inst-ok {
  border-color: #2563eb;
  background: #dbeafe;
  color: #1e3a8a;
}
.shp-box-lbl input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  accent-color: #15803d;
}
.shp-box-lbl.is-inst-ok input[type="checkbox"],
.shp-box-lbl input[data-mark-role="installers"] {
  accent-color: #2563eb;
}

.shp-std-table {
  width: 100%;
  border-collapse: collapse;
}
.shp-std-table th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  color: #475569;
  background: #f8fafc;
  padding: 6px 12px;
  border-bottom: 1px solid #cbd5e1;
}
.shp-std-table td {
  padding: 7px 12px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
}
.shp-std-table tr:last-child td {
  border-bottom: none;
}

.shp-win-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px 92px 176px;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
}
.shp-win-sub {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 6px 12px 8px 22px;
  background: #f8fafc;
  border-top: 1px dashed #cbd5e1;
}
@media (max-width: 767px) {
  .shp-win-main {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }
  .shp-win-sub {
    grid-template-columns: 1fr;
    padding-left: 12px;
  }
}

/* Форма редактирования комплектации КП внутри модального окна */
.shp-editor-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 15px 18px;
}
.shp-fields-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 10px;
}
.shp-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.shp-field label {
  font-size: 11.5px;
  font-weight: 600;
  color: #334155;
}
.shp-field input,
.shp-field select {
  padding: 7px 10px;
  border: 1px solid #94a3b8;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  color: #0f172a;
}
.shp-radio-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid #94a3b8;
  border-radius: 7px;
  background: #f8fafc;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.shp-radio-pill:has(input:checked) {
  background: #dcfce7;
  border-color: #15803d;
  color: #14532d;
}
.shp-dyn-row {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 11px;
  margin-bottom: 8px;
}
.shp-preview-bar {
  margin-top: 10px;
  padding: 8px 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 7px;
  font-size: 12.5px;
  color: #14532d;
}

/* =========================================================================
   СТАРТОВАЯ АНИМАЦИЯ ЛОГОТИПА VILLAG≡ COMFORT И САЛЮТ 5 ЗВЁЗД
   ========================================================================= */
.vc-startup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(circle at 50% 38%, #1e293b 0%, #090d16 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.45s cubic-bezier(.4,0,.2,1), visibility 0.45s;
}
.vc-startup-overlay.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.vc-startup-emblem {
  position: relative;
  background: #D4FA00;
  border-radius: 22px;
  padding: 20px 26px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 24px 70px rgba(212, 250, 0, 0.28), 0 0 0 1px rgba(255,255,255,0.22) inset;
  overflow: hidden;
  animation: vcHubEmblemPop 0.65s cubic-bezier(.16,1,.3,1) forwards;
}
.vc-startup-emblem::after {
  content: "";
  position: absolute;
  top: -40%;
  left: -65%;
  width: 48%;
  height: 185%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.68), transparent);
  transform: rotate(24deg);
  animation: vcHubSheen 1.1s 0.32s ease-out forwards;
}
@keyframes vcHubEmblemPop {
  0% { opacity: 0; transform: scale(0.84) translateY(14px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes vcHubSheen {
  0% { left: -65%; }
  100% { left: 140%; }
}
.vc-startup-svg path {
  stroke-dasharray: 240;
  stroke-dashoffset: 240;
  animation: vcHubStrokeDraw 0.85s 0.1s cubic-bezier(.35,0,.2,1) forwards;
}
@keyframes vcHubStrokeDraw {
  to { stroke-dashoffset: 0; }
}
.vc-startup-word {
  color: #090d16;
  line-height: 1.04;
  letter-spacing: 0.06em;
  font-weight: 900;
  font-size: 22px;
  opacity: 0;
  transform: translateX(-8px);
  animation: vcHubWordIn 0.55s 0.3s cubic-bezier(.16,1,.3,1) forwards;
}
@keyframes vcHubWordIn {
  to { opacity: 1; transform: translateX(0); }
}
.vc-startup-caption {
  margin-top: 15px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0;
  animation: vcHubWordIn 0.5s 0.42s ease forwards;
}

.vc-flying-star {
  position: absolute;
  font-size: 26px;
  animation: vcStarBurstAnim 1.55s cubic-bezier(.15,.85,.3,1) forwards;
}
@keyframes vcStarBurstAnim {
  0% { opacity: 1; transform: translate(0, 0) scale(0.4) rotate(0deg); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(1.35) rotate(var(--rot)); }
}
