.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app-main {
  width: min(100% - 32px, var(--container));
  margin: 0 auto;
  padding: 26px 0 56px;
  flex: 1;
}

.page {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: page-in 0.22s ease;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.page-head-main {
  min-width: 0;
}

.eyebrow {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 5px;
}

.page-title {
  font-size: clamp(23px, 3vw, 29px);
  line-height: 1.15;
}

.page-subtitle {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 13.5px;
  max-width: 68ch;
}

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

.page-actions .btn {
  min-height: 40px;
}

.summary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.summary-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
}

.summary-chip strong {
  color: var(--text);
  font-weight: 750;
}

/* Toolbar / filters ------------------------------------------------------- */
.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.search-field {
  position: relative;
  flex: 1;
  min-width: 210px;
}

.search-field input {
  width: 100%;
  min-height: 42px;
  padding: 0 38px 0 38px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  outline: 0;
  font-size: 13.5px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.search-field input:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--ring);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-soft);
  pointer-events: none;
}

.search-icon svg {
  width: 17px;
  height: 17px;
}

.search-clear {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
}

.filter-select {
  min-height: 42px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  appearance: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  max-width: 220px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-soft) 50%),
    linear-gradient(135deg, var(--text-soft) 50%, transparent 50%);
  background-position: calc(100% - 15px) 18px, calc(100% - 10px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.filter-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--ring);
  outline: 0;
}

.filter-clear {
  min-height: 38px;
}

.results-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 12.5px;
}

.results-line strong {
  color: var(--text);
}

/* Report cards ------------------------------------------------------------ */
.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.report-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 190px;
  padding: 16px 17px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.report-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--stripe, var(--border-strong));
}

.report-card.prio-1 {
  --stripe: #dc2626;
}

.report-card.prio-2 {
  --stripe: #ea580c;
}

.report-card.prio-3 {
  --stripe: #ca8a04;
}

.report-card.is-closed {
  opacity: 0.82;
}

.report-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.report-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.report-number {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

.report-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.report-desc {
  color: var(--text);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.report-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 12px;
}

.report-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.report-tag svg {
  width: 13px;
  height: 13px;
  color: var(--text-soft);
  flex: none;
}

.report-tag span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.report-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
}

.report-author {
  min-width: 0;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.3;
}

.report-author strong {
  display: block;
  color: var(--text-muted);
  font-weight: 650;
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-time {
  color: var(--text-soft);
  font-size: 10.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.report-footer-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 0 4px;
}

.load-more-wrap .btn {
  min-width: 180px;
}

/* Detail modal ------------------------------------------------------------ */
.detail-hero {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: space-between;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.detail-hero-main {
  min-width: 0;
}

.detail-number {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-soft);
}

.detail-desc {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.detail-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.detail-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.detail-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.detail-section-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.detail-section-title span {
  color: var(--text-soft);
  font-weight: 600;
}

.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.owner-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.owner-panel-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.owner-panel-row .field {
  flex: 1;
  min-width: 160px;
}

.inline-note {
  color: var(--text-soft);
  font-size: 11.5px;
}

.detail-loading {
  display: grid;
  place-items: center;
  padding: 40px;
  color: var(--text-muted);
}

/* Gallery ---------------------------------------------------------------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.gallery-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.gallery-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-3);
  cursor: pointer;
  overflow: hidden;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition);
}

.gallery-thumb:hover img {
  transform: scale(1.025);
}

.gallery-thumb .spinner {
  position: absolute;
  inset: 0;
  margin: auto;
  color: var(--text-soft);
}

.gallery-body {
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gallery-title {
  font-size: 13px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-meta {
  color: var(--text-soft);
  font-size: 11px;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 9px;
}

.gallery-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  padding: 0 8px 8px;
}

/* Admin ------------------------------------------------------------------ */
.admin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.admin-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.admin-toolbar .search-field {
  max-width: 360px;
}

.admin-empty {
  padding: 28px;
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  font-size: 13px;
}

.admin-help {
  font-size: 12px;
  color: var(--text-soft);
}

/* User/admin forms */
.form-note {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--info-soft);
  border: 1px solid var(--info-border);
  color: var(--info);
  font-size: 12.5px;
  line-height: 1.5;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13px;
}

.check-row input {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
  margin: 0;
}

.check-row label {
  font-weight: 600;
}

/* Responsive header/layout ------------------------------------------------ */
@media (max-width: 980px) {
  .header-inner {
    flex-wrap: wrap;
    padding: 9px 0;
    row-gap: 8px;
  }

  .header-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .header-nav::-webkit-scrollbar {
    display: none;
  }

  .brand-sub {
    display: none;
  }

  .header-spacer {
    min-width: 0;
  }
}

@media (max-width: 760px) {
  .app-main {
    width: min(100% - 24px, var(--container));
    padding: 18px 0 44px;
  }

  .page {
    gap: 16px;
  }

  .page-head {
    align-items: flex-start;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .btn-primary {
    flex: 1;
  }

  .report-grid {
    grid-template-columns: 1fr;
  }

  .report-card {
    min-height: 0;
  }

  .filters {
    padding: 8px;
  }

  .search-field {
    flex-basis: 100%;
  }

  .filter-select {
    flex: 1;
    max-width: none;
    min-width: 130px;
  }

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

  .gallery-body {
    padding: 9px 10px;
  }

  .gallery-meta {
    font-size: 10.5px;
  }

  .header-actions {
    gap: 4px;
  }

  .user-meta {
    display: none;
  }

  .user-chip {
    padding: 3px;
    border: 0;
    background: transparent;
  }

  .user-avatar {
    width: 36px;
    height: 36px;
  }

  .header-nav {
    border-radius: var(--radius-md);
  }

  .nav-link {
    flex: 1;
    justify-content: center;
    padding: 7px 10px;
  }

  .detail-hero {
    padding: 11px;
  }

  .admin-item {
    flex-wrap: wrap;
  }

  .admin-item-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 430px) {
  .brand-name {
    font-size: 14px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }

  .brand-mark svg {
    width: 21px;
    height: 21px;
  }

  .header-inner {
    width: calc(100% - 24px);
  }

  .nav-link svg {
    display: none;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-actions .btn {
    flex: 1;
  }
}
