/* ==========================================================================
   ШТРАФОВНЕТ: КАБИНЕТ ЗАЯВОК И ЧЕК-ЛИСТА (portal.css)
   ========================================================================== */

.hidden {
  display: none !important;
}

.container-fluid {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

.header-portal-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.portal-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--shn-black);
  background: var(--shn-gray-200);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  margin-left: 6px;
}

.header-portal-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-create-lead {
  background: var(--shn-green);
  color: var(--shn-white);
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(99, 197, 86, 0.35);
  transition: all 0.2s;
}

.btn-create-lead:hover {
  background: var(--shn-green-dark);
  box-shadow: 0 4px 10px rgba(25, 143, 81, 0.4);
}

.btn-create-lead.is-open {
  background: var(--shn-gray-700);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.btn-create-lead.is-open:hover {
  background: var(--shn-black);
}

/* Встроенная панель создания заявки (инлайн в потоке страницы, без затемнения) */
.create-lead-panel {
  background: var(--shn-white);
  border: 1.5px solid var(--shn-green);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 24px;
  box-shadow: 0 6px 24px rgba(99, 197, 86, 0.12), 0 2px 6px rgba(0, 0, 0, 0.04);
  position: static;
  animation: panelSlideDown 0.25s ease-out;
}

@keyframes panelSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.create-lead-panel.hidden {
  display: none !important;
}

.create-lead-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--shn-gray-200);
}

.create-lead-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.create-lead-icon {
  font-size: 22px;
  background: var(--shn-green-soft);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.create-lead-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--shn-black);
  margin: 0 0 2px 0;
}

.create-lead-desc {
  font-size: 13px;
  color: var(--shn-gray-500);
  margin: 0;
}

.btn-panel-close {
  background: var(--shn-gray-100);
  border: 1px solid var(--shn-gray-300);
  color: var(--shn-gray-700);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-panel-close:hover {
  background: var(--shn-gray-200);
  color: var(--shn-black);
}

.panel-create-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--shn-gray-200);
}

.modal-card-large {
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
}

.create-files-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.file-pick-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--shn-gray-50);
  border: 1.5px dashed var(--shn-gray-300);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.file-pick-btn:hover {
  border-color: var(--shn-green);
  background: var(--shn-green-soft);
}

.file-pick-btn input[type="file"] {
  display: none !important;
}

.file-pick-btn.has-file {
  border-style: solid;
  border-color: var(--shn-green);
  background: var(--shn-green-soft);
  color: var(--shn-green-deep);
  font-weight: 700;
}

.user-greeting {
  font-size: 13px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--shn-green-soft);
  color: var(--shn-green-deep);
  border: 1px solid rgba(99, 197, 86, 0.3);
}

.user-greeting.role-manager {
  background: #EBF8FF;
  color: #2B6CB0;
  border-color: #BEE3F8;
}

.btn-refresh {
  background: var(--shn-white);
  border: 1px solid var(--shn-gray-300);
  color: var(--shn-gray-700);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-refresh:hover {
  background: var(--shn-gray-100);
  border-color: var(--shn-gray-400);
  color: var(--shn-black);
}

.btn-refresh:active {
  transform: scale(0.97);
}

.btn-refresh .refresh-icon {
  display: inline-block;
  font-size: 14px;
  line-height: 1;
  transition: transform 0.2s;
}

.btn-refresh.is-refreshing {
  opacity: 0.85;
  cursor: wait;
  pointer-events: none;
}

.btn-refresh.is-refreshing .refresh-icon {
  animation: spin 0.7s linear infinite;
}

.btn-refresh.is-success {
  border-color: var(--shn-green);
  background: var(--shn-green-soft);
  color: var(--shn-green-deep);
  font-weight: 600;
}

.refresh-timestamp {
  font-size: 11px;
  color: var(--shn-gray-500);
  white-space: nowrap;
}

.refresh-timestamp.hidden {
  display: none;
}

.btn-logout {
  background: none;
  border: none;
  color: var(--shn-gray-500);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
  padding: 4px;
}

.btn-logout:hover {
  color: var(--shn-red);
}

/* --- ЭКРАН ВХОДА --- */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
  padding: 24px;
}

.auth-card {
  background: var(--shn-white);
  border: 1px solid var(--shn-border-soft);
  box-shadow: var(--shadow-card);
  border-radius: var(--radius-lg);
  max-width: 440px;
  width: 100%;
  padding: 36px 32px;
  text-align: center;
}

.auth-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--shn-black);
  margin-bottom: 8px;
}

.auth-desc {
  font-size: 13px;
  color: var(--shn-gray-500);
  margin-bottom: 24px;
  line-height: 1.45;
}

.auth-form {
  text-align: left;
}

.auth-error {
  margin: 12px 0;
  padding: 10px 14px;
  background: var(--shn-red-soft);
  color: var(--shn-red-dark);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
}

.auth-help {
  margin-top: 24px;
  font-size: 11px;
  color: var(--shn-gray-400);
  line-height: 1.4;
  border-top: 1px solid var(--shn-gray-100);
  padding-top: 16px;
}

/* --- РАБОЧИЙ КАБИНЕТ --- */
.portal-main {
  padding: 24px 0 60px;
}

/* Статистическая строка */
.stats-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--shn-white);
  border: 1px solid var(--shn-border-soft);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.stat-num {
  font-size: 24px;
  font-weight: 700;
  color: var(--shn-black);
  margin-bottom: 4px;
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--shn-gray-500);
  font-weight: 500;
}

.color-new { color: #3B82F6; }
.color-docs { color: #8B5CF6; }
.color-progress { color: #F59E0B; }
.color-submitted { color: #0EA5E9; }
.color-approved { color: var(--shn-green-dark); }

/* Панель фильтров и поиск */
.controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-tabs {
  display: flex;
  background: var(--shn-gray-200);
  padding: 4px;
  border-radius: var(--radius-sm);
  gap: 4px;
}

.tab-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--shn-gray-700);
  transition: all 0.2s;
}

.tab-btn.active {
  background: var(--shn-white);
  color: var(--shn-black);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

.search-wrap {
  position: relative;
  min-width: 340px;
  flex: 1;
  max-width: 480px;
}

.search-input {
  width: 100%;
  height: 40px;
  padding: 0 36px 0 14px;
  border: 1px solid var(--shn-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  background: var(--shn-white);
  outline: none;
}

.search-input:focus {
  border-color: var(--shn-green);
}

.search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 18px;
  color: var(--shn-gray-400);
  cursor: pointer;
}

/* --- КАРТОЧКА ЗАЯВКИ --- */
.leads-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lead-card {
  background: var(--shn-white);
  border: 1px solid var(--shn-border-soft);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.lead-card:hover {
  box-shadow: var(--shadow-card);
}

.lead-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--shn-gray-100);
  flex-wrap: wrap;
  gap: 12px;
}

.lead-id-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lead-title-id {
  font-size: 18px;
  font-weight: 700;
  color: var(--shn-black);
}

.lead-date {
  font-size: 12px;
  color: var(--shn-gray-400);
}

.lead-header-badges {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Статусные бейджи */
.status-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-badge.NEW {
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}

.status-badge.DOCS_LOADED {
  background: #F5F3FF;
  color: #6D28D9;
  border: 1px solid #DDD6FE;
}

.status-badge.IN_PROGRESS {
  background: #FFFBEB;
  color: #B45309;
  border: 1px solid #FDE68A;
}

.status-badge.SUBMITTED {
  background: #F0F9FF;
  color: #0369A1;
  border: 1px solid #BAE6FD;
}

.status-badge.TEMP_PASS_ISSUED {
  background: var(--shn-green-soft);
  color: var(--shn-green-dark);
  border: 1px solid rgba(99, 197, 86, 0.3);
}

.status-badge.APPROVED {
  background: var(--shn-green-soft);
  color: var(--shn-green-deep);
  border: 1.5px solid var(--shn-green);
}

.status-badge.REJECTED {
  background: var(--shn-red-soft);
  color: var(--shn-red-dark);
  border: 1px solid #FECACA;
}

.tag-zone, .tag-period {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--shn-gray-100);
  color: var(--shn-gray-700);
}

/* Сетка параметров заявки */
.lead-grid {
  display: grid;
  grid-template-columns: 1.4fr 1.6fr 1.8fr;
  gap: 20px;
  margin-bottom: 16px;
}

.lead-col-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  color: var(--shn-gray-400);
  margin-bottom: 6px;
}

.lead-plate-badge {
  display: inline-block;
  font-family: "Courier New", Courier, monospace, var(--shn-font);
  font-size: 16px;
  font-weight: 700;
  color: var(--shn-black);
  background: var(--shn-gray-100);
  border: 1.5px solid var(--shn-gray-300);
  border-radius: 4px;
  padding: 4px 10px;
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.lead-contact-phone {
  font-size: 15px;
  font-weight: 700;
  color: var(--shn-green-dark);
  text-decoration: none;
  display: block;
  margin-bottom: 2px;
}

.lead-contact-name {
  font-size: 13px;
  color: var(--shn-black);
  font-weight: 500;
}

.lead-contact-company {
  font-size: 12px;
  color: var(--shn-gray-500);
}

.mosru-badge {
  background: #E0F2FE;
  color: #0369A1;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  display: inline-block;
  margin-top: 4px;
}

.reject-badge {
  background: var(--shn-red-soft);
  color: var(--shn-red-dark);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  display: block;
  margin-top: 4px;
}

/* ИНТЕРАКТИВНЫЙ ЧЕК-ЛИСТ ДОКУМЕНТОВ */
.lead-checklist {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chk-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--shn-gray-100);
  color: var(--shn-gray-500);
  border: 1px solid var(--shn-gray-200);
  cursor: pointer;
  user-select: none;
  transition: all 0.2s;
}

.chk-item.checked {
  background: var(--shn-green-soft);
  color: var(--shn-green-deep);
  border-color: rgba(99, 197, 86, 0.4);
  font-weight: 700;
}

.chk-item.readonly {
  cursor: default;
}

.chk-icon {
  font-size: 12px;
}

/* Список прикрепленных файлов */
.lead-files-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 0;
  border-top: 1px solid var(--shn-gray-100);
  margin-top: 12px;
}

.file-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--shn-gray-100);
  border: 1px solid var(--shn-gray-300);
  text-decoration: none;
  color: var(--shn-black);
  transition: all 0.2s;
}

.file-pill:hover {
  background: var(--shn-gray-200);
  border-color: var(--shn-gray-400);
}

/* Действия в карточке */
.lead-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--shn-gray-100);
  flex-wrap: wrap;
  gap: 12px;
}

.btn-zip-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--shn-green-dark);
  color: var(--shn-white);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s;
}

.btn-zip-download:hover {
  background: var(--shn-green-deep);
}

.card-action-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-status-change {
  background: var(--shn-white);
  border: 1.5px solid var(--shn-gray-300);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--shn-black);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-status-change:hover {
  border-color: var(--shn-green);
  background: var(--shn-green-soft);
  color: var(--shn-green-deep);
}

.btn-attach-file {
  background: var(--shn-white);
  border: 1px solid var(--shn-gray-300);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--shn-gray-700);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-attach-file:hover {
  background: var(--shn-gray-100);
}

/* --- МОДАЛЬНЫЕ ОКНА --- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  padding: 20px;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  background: var(--shn-white);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  padding: 28px;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--shn-gray-200);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--shn-black);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--shn-gray-400);
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--shn-black);
}

.textarea {
  height: auto;
  padding: 10px 14px;
  resize: vertical;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.btn-cancel {
  background: none;
  border: 1px solid var(--shn-gray-300);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.btn-modal-save {
  width: auto;
  padding: 10px 20px;
  height: auto;
}

/* Loading & Empty states */
.loading-state, .empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--shn-gray-500);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--shn-gray-200);
  border-top-color: var(--shn-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

/* Адаптивность портала */
@media (max-width: 900px) {
  .stats-row {
    grid-template-columns: repeat(3, 1fr);
  }
  .lead-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (max-width: 600px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .filter-tabs {
    width: 100%;
    overflow-x: auto;
  }
  .search-wrap {
    min-width: 100%;
  }
}

/* Бейджи готовности обязательного комплекта Дептранса */
.tag-pkg-status {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tag-pkg-status.pkg-ready {
  background: var(--shn-green-soft);
  color: var(--shn-green-deep);
  border: 1px solid rgba(99, 197, 86, 0.4);
}

.tag-pkg-status.pkg-incomplete {
  background: #FEF3C7;
  color: #B45309;
  border: 1px solid #FDE68A;
}

/* Кнопка переключения статуса владения (Лизинг / Собственность) */
.btn-toggle-leasing {
  background: var(--shn-gray-100);
  border: 1px solid var(--shn-gray-300);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-toggle-leasing.is-owned {
  background: #F0FDF4;
  color: #166534;
  border-color: #BBF7D0;
}

.btn-toggle-leasing.is-leased {
  background: #EFF6FF;
  color: #1D4ED8;
  border-color: #BFDBFE;
}

.btn-toggle-leasing:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.tag-zone-neutral {
  background: #F3F4F6 !important;
  color: #4B5563 !important;
  font-style: italic;
}

/* Чек-лист: элементы не требующиеся или опциональные */
.chk-item.chk-optional {
  opacity: 0.8;
  background: var(--shn-white);
  border-style: dashed;
}

.chk-item.chk-optional-checked {
  background: var(--shn-green-soft);
  color: var(--shn-green-deep);
  border-style: solid;
}

.chk-item.chk-not-needed {
  opacity: 0.6;
  text-decoration: line-through;
  background: var(--shn-gray-100);
  color: var(--shn-gray-400);
}

.text-req {
  color: #DC2626;
  font-weight: 700;
}

.file-pick-btn.is-mandatory-pick {
  border-color: #F87171;
  background: #FEF2F2;
}

.label-doc-hint {
  font-size: 11px;
  color: var(--shn-gray-500);
}

/* Предупреждение о неполном комплекте в модалке */
.status-warning-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #FEF3C7;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
}

.status-warning-box .warning-icon {
  font-size: 20px;
  line-height: 1.2;
}

.status-warning-box .warning-text strong {
  display: block;
  font-size: 13px;
  color: #92400E;
  margin-bottom: 2px;
}

.status-warning-box .warning-text span {
  font-size: 12px;
  color: #B45309;
}
