/* ==========================================================================
   Тема в стиле макетов: белый фон, светло-серые блоки секций и полей,
   узкий шрифт Roboto Condensed, заглавные заголовки, серые пилюли с белым текстом,
   красные акценты, нижняя навигация.
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Атрибут hidden сильнее любых display у классов */
[hidden] {
  display: none !important;
}

:root {
  --bg: #ffffff;
  --card: #f1f1f1;
  --tile: #e7e7e7;
  --tile-border: #e2e2e2;
  --text: #3b3b3b;
  --muted: #9a9a9a;
  --red: #e6392e;
  --red-dark: #c92f25;
  --badge-blue: #a5cdec;
  --pill: #b0b0b0;
  --radius: 12px;
}

@font-face {
  font-family: "Roboto Condensed";
  src: url("/assets/RobotoCondensed-379a3832.ttf") format("truetype-variations");
  font-weight: 100 900;
  font-stretch: 75% 100%;
  font-display: swap;
}

body {
  font-family: "Roboto Condensed", "Arial Narrow", Arial, sans-serif;
  font-stretch: 75%;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 400;
  color: var(--text);
  background-color: var(--bg);
}

.app-version {
  padding: 6px 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.25px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* --------------------------------------------------------------------------
   Пользовательские страницы (мобильный макет)
   -------------------------------------------------------------------------- */

.user-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 110px;
}.page-title {
  margin: 18px 0 16px;
  text-align: center;
  text-transform: uppercase;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.25px;
  color: #4f4f4f;
}

/* Подзаголовок над списком карточек («История отслеживаемых проектов») */

.list-subtitle {
  margin: 26px 0 18px;
  text-align: center;
  color: #9a9a9a;
  text-transform: uppercase;
  letter-spacing: 0.25px;
  font-size: 13.5px;
  font-weight: 500;
}

.user-page-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

/* Артикул под названием проекта */

.page-article {
  margin: -8px 0 14px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  letter-spacing: 0.25px;
}

.user-page-footer {
  margin: 28px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* Служебные ссылки над контентом (навигация, админка) — ненавязчивый текст */

.user-page-toolbar .btn-light {
  background: transparent;
  border: none;
  padding: 4px 8px;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.25px;
}

.user-page-toolbar .btn-light:hover {
  background: transparent;
  color: var(--text);
}

/* Строка фильтров «Проекты» по просмотрам */

.period-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  margin-bottom: 14px;
}

.period-chip {
  flex-shrink: 0;
  padding: 6px 12px;
  border: 1px solid #eee;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.25px;
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.period-chip:hover {
  color: var(--text);
}

.period-chip--active {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

.page-size-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.page-size-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.page-size-label {
  font-size: 12.5px;
  color: var(--muted);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin-top: 14px;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--muted);
}

.pagination-pages {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 4px;
  flex-wrap: wrap;
}

.pagination-nav {
  flex-shrink: 0;
  padding: 6px 14px;
  border: 1px solid #eee;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.25px;
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.pagination-nav:hover {
  color: var(--text);
}

.pagination-nav--disabled {
  opacity: 0.45;
  cursor: default;
}

.pagination-page {
  min-width: 26px;
  padding: 4px 6px;
  border-radius: 6px;
  text-align: center;
  color: var(--text);
  text-decoration: none;
}

.pagination-page:hover {
  background: #f2f2f2;
}

.pagination-page--active {
  background: var(--text);
  color: #fff;
  cursor: default;
}

.pagination-gap {
  padding: 0 2px;
  color: var(--muted);
}

.pagination--bottom {
  margin-top: 18px;
  margin-bottom: 6px;
}

/* Нижняя навигация (фиксированная внизу экрана) */

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  gap: 56px;
  padding: 20px 12px calc(20px + env(safe-area-inset-bottom));
  background-color: #ffffff;
}

.bottom-nav-link {
  color: #9a9a9a;
  text-decoration: none;
  text-transform: uppercase;
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0.25px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 18px;
}

.bottom-nav-link:hover {
  color: var(--text);
}

.bottom-nav-link.active {
  color: var(--text);
  font-weight: 600;
  border-color: #4f4f4f;
}

/* Десктоп: меню сверху, над контентом */

@media (min-width: 769px) {
  .bottom-nav {
    position: sticky;
    top: 0;
    padding: 20px 12px;
    background-color: #ffffff;
  }

  .user-page {
    padding-bottom: 40px;
  }

  /* Название страницы дублирует пункт меню — на десктопе скрываем */
  .page-title--nav {
    display: none;
  }
}

/* Поиск */

.search-box {
  margin-bottom: 16px;
}

.search-input {
  display: flex;
  position: relative;
}

.form-control {
  width: 100%;
  padding: 14px 16px;
  border: none;
  border-radius: 12px;
  background-color: var(--card);
  font-family: inherit;
  font-size: 15px;
  letter-spacing: 0.25px;
  color: var(--text);
}

.form-control::placeholder {
  color: #a9a9a9;
  text-transform: uppercase;
  letter-spacing: 0.25px;
}

.form-control:focus {
  outline: none;
  box-shadow: 0 0 0 2px #dcdcdc;
}

/* Карточки проектов (список и история) */

.project-card-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.project-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
}

.project-card-thumb {
  flex-shrink: 0;
}

.project-card-thumb-link {
  display: block;
  text-decoration: none;
}

.project-thumb-image {
  display: block;
  height: 90px;
  width: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 4px;
  background-color: #ececec;
}

.project-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 90px;
  aspect-ratio: 4 / 3;
  color: #9a9a9a;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.25px;
  text-align: center;
}

.project-card-main {
  min-width: 0;
  flex: 1;
}

.project-card-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.project-card-line {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.project-card-line.muted {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--muted);
}

.project-card-side {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.project-card-admin {
  margin-top: 6px;
}

/* Пилюли с информацией проекта */

.tag-pills {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.pill {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  background-color: var(--pill);
  color: #ffffff;
  font-size: 9px;
  font-weight: 600;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.pill--red {
  background-color: var(--red);
  color: #ffffff;
}

.history-kind {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 8px;
  border-radius: 8px;
  background-color: #e2e2e2;
  color: var(--text);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.25px;
}

/* Секционные карточки (страница проекта, статистика) */

.section-card {
  background-color: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

/* Секции: заголовок с счётчиком и кнопкой «Показать ещё ▼» (одна логика раскрытия) */

.section-block {
  margin-bottom: 12px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 2px;
}

.section-accordion-title {
  flex: 1;
  min-width: 0;
  text-transform: uppercase;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.25px;
  color: var(--text);
}

.section-header-info {
  flex: 1;
  min-width: 0;
}

.section-header-info .section-accordion-title {
  flex: none;
}

.section-description {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--muted);
}

.show-more-count {
  flex-shrink: 0;
  min-width: 26px;
  padding: 4px 6px;
  border-radius: 6px;
  background-color: var(--text);
  color: #fff;
  font-size: 13px;
  text-align: center;
}

.triangle {
  flex-shrink: 0;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid var(--red);
  transition: transform 0.15s ease;
}

.show-more-toggle[aria-expanded="true"] .triangle {
  transform: rotate(180deg);
}

.section-accordion-body {
  margin: 0;
  padding: 4px 0 0;
  background-color: transparent;
}

/* Статистика: группы на белом фоне, без серого блока */

.stat-board-card {
  margin-bottom: 26px;
}

.stat-board-card .project-card-list[data-section-rest] {
  margin-top: 34px;
}

/* Кнопка «Показать ещё ▼» — текст и красный треугольник, единый элемент раскрытия */

.show-more-toggle {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid #eee;
  border-radius: 999px;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 12.5px;
  letter-spacing: 0.25px;
  white-space: nowrap;
  color: var(--muted);
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.show-more-toggle:hover {
  color: var(--text);
}

/* Шапка проекта: сверху превью PDF с красным бейджем на всю ширину, ниже блок информации */

.project-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 18px;
}

.project-header-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.project-header-preview .project-pdf-preview-link {
  display: block;
  width: 100%;
  text-decoration: none;
}

.project-header-preview .project-pdf-preview-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: none;
  border-radius: 6px;
  background-color: #d9d9d9;
}

.project-header-preview .project-pdf-preview-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background-color: #d9d9d9;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.25px;
  text-align: center;
}

/* Красный бейдж «PDF | чертеж» под превью */

.pdf-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 12px;
  border-radius: 10px;
  background-color: var(--red);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.25px;
  text-decoration: none;
}

.pdf-badge:hover {
  background-color: var(--red-dark);
}

.project-header-meta {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 13px;
  line-height: 1.5;
}

.project-header-meta-label {
  color: var(--muted);
}

.project-header-meta-value {
  color: var(--text);
  font-weight: 600;
}

/* Последние правки по проекту: серая рамка с красным текстом (статичный вариант без истории) */

.last-edit-box {
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--tile-border);
  border-radius: var(--radius);
}

.last-edit-label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.last-edit-text {
  margin: 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

/* Последние правки + история изменений: единый раскрывающийся блок,
   свернуто — последняя правка, при раскрытии — остальные записи */

.edit-history-box {
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--tile-border);
  border-radius: var(--radius);
}

.edit-history-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.edit-history-summary::-webkit-details-marker {
  display: none;
}

.edit-history-summary-main {
  flex: 1;
  min-width: 0;
}

.edit-history-toggle {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.edit-history-count {
  display: inline-block;
  min-width: 26px;
  padding: 4px 6px;
  border-radius: 6px;
  background-color: var(--text);
  color: #fff;
  font-size: 13px;
  text-align: center;
}

.edit-history-box[open] .triangle {
  transform: rotate(180deg);
}

.edit-history-list {
  margin: 10px 0 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--tile-border);
  list-style: none;
}

.edit-history-item {
  margin-bottom: 6px;
  font-size: 13px;
  line-height: 1.45;
}

.edit-history-item:last-child {
  margin-bottom: 0;
}

.edit-history-date {
  color: var(--muted);
  font-weight: 600;
  margin-right: 8px;
  white-space: nowrap;
}

.edit-history-text {
  color: var(--text);
  overflow-wrap: anywhere;
}

/* Информация о проекте: серая рамка с адресом, местом и заказчиком */

.project-info-box {
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--tile-border);
  border-radius: var(--radius);
}

.project-info-row + .project-info-row {
  margin-top: 8px;
}

.project-info-label {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.project-info-value {
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.project-info-meta {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 10px;
}

.project-description {
  white-space: pre-wrap;
  line-height: 1.6;
}

/* Статистика: раскрывающиеся группы по статусам */

.stat-board-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 4px 0 8px;
}

/* --------------------------------------------------------------------------
   Плитки файлов (замеры, фото, документы, ссылки)
   -------------------------------------------------------------------------- */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

/* Отступ между превью-строкой плиток и скрытым блоком «Показать ещё» */

.section-block [data-section-rest] {
  margin-top: 12px;
}

.image-card {
  background-color: var(--tile);
  border: none;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: background-color 0.2s;
}

.image-card:hover {
  background-color: #dedede;
}

.card-image {
  width: 100%;
  height: 130px;
  overflow: hidden;
  background-color: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background-color: #e6e6e6;
}

.card-img-placeholder span {
  font-size: 40px;
}

.card-body {
  padding: 8px;
}

.card-text {
  font-size: 12px;
  font-weight: 400;
  color: #6f6f6f;
  text-align: center;
  word-wrap: break-word;
}

.file-link-card {
  background-color: var(--tile);
  border: none;
  border-radius: 6px;
  padding: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-height: 110px;
}

.file-link-card .file-link {
  font-size: 13px;
  margin-bottom: 0;
}

.external-link-card .file-description {
  overflow-wrap: anywhere;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.file-item {
  padding: 12px;
  border: 1px solid var(--tile-border);
  border-radius: 4px;
}

.file-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
}

.file-link:hover {
  text-decoration: underline;
}

.file-description {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

/* Текстовые файлы */

.text-files-container {
  margin-top: 4px;
}

.text-file-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--tile-border);
}

.text-file-section.no-border {
  border-bottom: none;
}

.text-file-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.text-file-content {
  background-color: #ffffff;
  border: 1px solid var(--tile-border);
  border-radius: 4px;
  padding: 12px;
  overflow-x: auto;
  font-family: "Courier New", monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* --------------------------------------------------------------------------
   Ссылка шаринга и QR
   -------------------------------------------------------------------------- */

.project-share-btn {
  width: 100%;
  margin-bottom: 18px;
}

.project-qr-code {
  margin-top: 20px;
}

.qr-modal-content {
  background: transparent !important;
  box-shadow: none !important;
}

.qr-modal-url {
  display: block;
  margin: 12px auto 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
}

.qr-modal-url:hover {
  text-decoration: underline;
}

.qr-code-card {
  background-color: #ffffff;
  padding: 30px;
  border-radius: 15px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  max-width: 480px;
  width: 90%;
}

.qr-code-svg-large {
  background-color: #ffffff;
  padding: 10px;
  border: 1px solid #eee;
  border-radius: 10px;
  display: block;
  line-height: 0;
  margin: 0 auto;
  max-width: 420px;
  width: 100%;
}

.qr-code-svg-large svg,
.qr-code-image {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

/* --------------------------------------------------------------------------
   Административные страницы (общие элементы)
   -------------------------------------------------------------------------- */

.navbar {
  background-color: var(--text);
  color: #ffffff;
  padding: 15px 0;
  margin-bottom: 30px;
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  gap: 10px;
}

.navbar-brand {
  font-size: 22px;
  font-weight: 500;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.25px;
}

.nav-link {
  color: #ffffff;
  text-decoration: none;
  font-size: 15px;
}

.nav-link:hover {
  text-decoration: underline;
}

.card {
  background-color: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.25px;
}

.project-details p {
  margin-bottom: 10px;
}

.project-details-column {
  padding: 16px;
}

.project-info-card {
  padding: 0 !important;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  align-items: stretch;
}

.project-info-card .project-pdf-preview {
  width: 100%;
  height: 100%;
  display: flex;
  background-color: #e6e6e6;
}

.project-info-card .project-pdf-preview-link {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100%;
}

.project-info-card .project-pdf-preview-image,
.project-info-card .project-pdf-preview-placeholder {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 0;
  object-fit: cover;
  display: block;
}

.project-pdf-preview {
  width: 100%;
}

.project-pdf-preview-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.project-pdf-preview-image,
.project-pdf-preview-placeholder {
  width: 100%;
  max-height: 480px;
  border: 1px solid var(--tile-border);
  border-radius: 4px;
  background-color: #e6e6e6;
  object-fit: contain;
}

.project-pdf-preview-image {
  display: block;
}

.project-pdf-preview-placeholder {
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-weight: 500;
}

.table-responsive {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background-color: #ffffff;
  border-radius: 8px;
  overflow: hidden;
}

.table th,
.table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #e6e6e6;
}

.table th {
  background-color: var(--card);
  color: var(--text);
  font-weight: 600;
}

.table tr:hover {
  background-color: #fafafa;
}

.table tr.clickable-row {
  cursor: pointer;
}

.table tr.clickable-row:focus {
  outline: 2px solid #9a9a9a;
  outline-offset: -2px;
  background-color: #fafafa;
}

.table tr:last-child td {
  border-bottom: none;
}

.table-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.table-link:hover {
  text-decoration: underline;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  font-family: inherit;
  font-size: 14px;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.25px;
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background-color: var(--text);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: #232323;
}

.btn-danger {
  background-color: #c94f4f;
  color: #ffffff;
  padding: 5px 15px;
  font-size: 12px;
}

.btn-danger:hover {
  background-color: #b03e3e;
}

.btn-light {
  background-color: var(--card);
  color: var(--text);
  border: 1px solid var(--tile-border);
}

.btn-light:hover {
  background-color: #e2e2e2;
}

.btn-secondary {
  background-color: #9a9a9a;
  color: #ffffff;
}

.btn-secondary:hover {
  background-color: #7f7f7f;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.alert {
  background-color: var(--card);
  border: none;
  border-radius: var(--radius);
  padding: 15px;
  color: var(--muted);
  text-align: center;
}

.no-keys {
  text-align: center;
  color: var(--muted);
  padding: 20px;
}

code {
  background-color: #e9e9e9;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: "Courier New", monospace;
  font-size: 13px;
}

.desktop-only {
  display: inline;
}

.mobile-only {
  display: none;
}

/* Индикаторы статуса просмотра */

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  vertical-align: middle;
  margin-left: 10px;
}

.status-indicator .circle {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-indicator.viewed {
  background-color: rgba(76, 140, 80, 0.12);
  color: #3f7a45;
}

.status-indicator.viewed .circle {
  background-color: #4c8c50;
}

.status-indicator.not-viewed {
  background-color: rgba(201, 79, 79, 0.12);
  color: #a03c3c;
}

.status-indicator.not-viewed .circle {
  background-color: #c94f4f;
}

.admin-status-container {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  max-width: 100%;
}

.admin-user-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  background-color: #ffffff;
  border: 1px solid var(--tile-border);
}

.admin-user-badge .circle {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.admin-user-badge.viewed .circle {
  background-color: #4c8c50;
}

.admin-user-badge.not-viewed .circle {
  background-color: #c94f4f;
}

.project-stat-name {
  color: var(--text);
  font-weight: 600;
}

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

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
}

#modalImage {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

#modalImage.modal-image-loaded {
  opacity: 1;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 25px;
  color: #fff;
  font-size: 40px;
  font-weight: bold;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 1010;
  transition: color 0.2s, transform 0.2s;
  line-height: 1;
}

.modal-close:hover {
  color: #bbb;
  transform: scale(1.1);
}

.modal-prev,
.modal-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  font-size: 30px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1005;
  transition: background-color 0.2s, color 0.2s, transform 0.2s;
  user-select: none;
}

.modal-prev {
  left: 20px;
}

.modal-next {
  right: 20px;
}

.modal-prev:hover,
.modal-next:hover {
  background-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-50%) scale(1.05);
}

.modal-prev:active,
.modal-next:active {
  transform: translateY(-50%) scale(0.95);
}

.modal-caption-container {
  position: absolute;
  bottom: -45px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: #fff;
  width: 100%;
  max-width: 90vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.modal-counter {
  font-size: 14px;
  font-weight: 500;
  background-color: rgba(0, 0, 0, 0.6);
  padding: 4px 10px;
  border-radius: 12px;
}

.modal-description {
  font-size: 16px;
  font-weight: 600;
  word-wrap: break-word;
  max-width: 100%;
}

/* --------------------------------------------------------------------------
   Адаптив
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  .container {
    padding: 10px;
  }

  .navbar .container {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }

  .navbar .container > div[style*="display: flex"] {
    justify-content: center;
  }

  .table th,
  .table td {
    padding: 8px 10px;
    font-size: 12px;
  }

  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: block !important;
  }

  .project-info {
    grid-template-columns: 1fr;
  }

  .project-info-card {
    grid-template-columns: 1fr;
  }

  .project-info-card .project-pdf-preview {
    aspect-ratio: 4 / 3;
  }

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

  .card-image {
    height: 96px;
  }

  .project-header {
    gap: 12px;
  }

  /* Мобильный: в списках без превью-миниатюр */
  .project-card-thumb {
    display: none;
  }

  .modal-prev,
  .modal-next {
    width: 40px;
    height: 40px;
    font-size: 20px;
    background: rgba(0, 0, 0, 0.5);
  }

  .modal-prev {
    left: 10px;
  }

  .modal-next {
    right: 10px;
  }

  .modal-close {
    top: 15px;
    right: 20px;
    font-size: 35px;
  }

  .modal-caption-container {
    bottom: -50px;
  }

  .modal-description {
    font-size: 14px;
  }
}

/* Стадии проекта — список с чекбоксами */
.stadia-box {
  margin-top: 15px;
}

.stadia-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stadia-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: default;
}

.stadia-label:hover {
  background: #f5f7fa;
}

.stadia-checkbox {
  width: 16px;
  height: 16px;
  accent-color: #2563eb;
  flex-shrink: 0;
}

.stadia-checkbox:disabled {
  cursor: default;
}

.stadia-name {
  font-size: 14px;
  color: #333;
}
