html,
body {
  overscroll-behavior-y: none;
}

body::before {
  content: "";
  position: fixed;
  left: 50%;
  top: calc(50% - 14px);
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(87, 209, 161, 0.28);
  box-shadow:
    -16px 0 0 rgba(87, 209, 161, 0.95),
    16px 0 0 rgba(87, 209, 161, 0.28);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 9999;
  animation:
    pwa-boot-dots 900ms ease-in-out infinite,
    pwa-loader-fallback-hide 0s linear 3.2s forwards;
}

body::after {
  content: "Загрузка интерфейса…";
  position: fixed;
  left: 50%;
  top: calc(50% + 18px);
  transform: translateX(-50%);
  color: rgba(155, 170, 192, 0.82);
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  white-space: nowrap;
  pointer-events: none;
  z-index: 9999;
  animation: pwa-loader-fallback-hide 0s linear 3.2s forwards;
}

html.pwa-ui-ready body::before,
html.pwa-ui-ready body::after {
  opacity: 0;
  visibility: hidden;
  animation: none;
  transition:
    opacity 150ms ease-out,
    visibility 0s linear 150ms;
}

@keyframes pwa-boot-dots {
  0%,
  100% {
    background: rgba(87, 209, 161, 0.28);
    box-shadow:
      -16px 0 0 rgba(87, 209, 161, 0.95),
      16px 0 0 rgba(87, 209, 161, 0.28);
  }

  33% {
    background: rgba(87, 209, 161, 0.95);
    box-shadow:
      -16px 0 0 rgba(87, 209, 161, 0.28),
      16px 0 0 rgba(87, 209, 161, 0.28);
  }

  66% {
    background: rgba(87, 209, 161, 0.28);
    box-shadow:
      -16px 0 0 rgba(87, 209, 161, 0.28),
      16px 0 0 rgba(87, 209, 161, 0.95);
  }
}

@keyframes pwa-loader-fallback-hide {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

.shell {
  opacity: 0;
  pointer-events: none;
  animation: pwa-shell-fallback-reveal 0s linear 3s forwards;
}

html.pwa-ui-ready .shell {
  opacity: 1;
  pointer-events: auto;
  animation: none;
  transition: opacity 120ms ease-out;
}

@keyframes pwa-shell-fallback-reveal {
  to {
    opacity: 1;
    pointer-events: auto;
  }
}

.batch-export-card,
.single-export-card,
.exports-card,
.context-section {
  margin-bottom: 10px;
}

.exports-card:not(.is-workspace-visible) {
  display: none;
}

.batch-export-card {
  border-color: rgba(87, 209, 161, 0.22);
}

.batch-export-card .section-heading {
  align-items: flex-start;
}

.batch-export-card .section-heading h2 {
  margin-bottom: 0;
}

.batch-export-card .batch-export-form {
  gap: 12px;
}

.batch-export-card .batch-date-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  width: 100%;
}

.batch-export-card .batch-date-grid .export-field {
  min-width: 0;
}

.batch-export-card .batch-date-grid input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.batch-export-card .batch-toolbar .button {
  min-height: 42px;
}

.batch-export-card #batch-all,
.batch-export-card #batch-none {
  flex: 0 1 auto;
  min-height: 38px;
  padding: 8px 10px;
  font-size: 0.74rem;
  white-space: nowrap;
}

.batch-export-card #batch-find {
  flex: 1 1 180px;
}

.batch-export-card #batch-create {
  min-height: 46px;
}

.single-export-card {
  padding: 0;
  overflow: hidden;
}

.single-export-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.single-export-summary::-webkit-details-marker {
  display: none;
}

.single-export-summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -4px;
}

.single-export-summary-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.single-export-summary-copy .muted {
  margin: 0;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.single-export-summary-copy strong {
  font-size: 1rem;
  line-height: 1.1;
}

.single-export-summary-copy small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
}

.single-export-chevron {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel-soft);
  transition: transform 160ms ease;
}

.single-export-card[open] .single-export-chevron {
  transform: rotate(180deg);
}

.single-export-body {
  border-top: 1px solid var(--line);
  padding: 0 16px 16px;
}

.single-export-body .export-action-form {
  margin-top: 14px;
}

@media (max-width: 520px) {
  .batch-export-card,
  .single-export-card,
  .exports-card,
  .context-section {
    margin-bottom: 9px;
  }

  .batch-export-card .batch-export-form {
    gap: 10px;
  }

  .batch-export-card .batch-toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .batch-export-card #batch-find {
    grid-column: 1 / -1;
    width: 100%;
  }

  .batch-export-card #batch-all,
  .batch-export-card #batch-none {
    grid-column: auto;
    width: 100%;
  }

  .single-export-summary {
    min-height: 54px;
    padding: 12px 13px;
  }

  .single-export-summary-copy strong {
    font-size: 0.92rem;
  }

  .single-export-summary-copy small {
    font-size: 0.66rem;
  }

  .single-export-body {
    padding: 0 13px 13px;
  }
}

@media (max-width: 360px) {
  .single-export-summary {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .single-export-summary #export-auth-pill {
    justify-self: start;
  }

  .single-export-chevron {
    grid-row: 1 / span 2;
    grid-column: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after {
    animation: pwa-loader-fallback-hide 0s linear 3.2s forwards;
  }

  html.pwa-ui-ready body::before,
  html.pwa-ui-ready body::after,
  html.pwa-ui-ready .shell,
  .single-export-chevron {
    transition: none;
  }
}

/* Unified primary workspace section typography */
.batch-export-card > .section-heading > div,
.exports-card > .section-heading > div,
.context-section > .section-heading > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.batch-export-card > .section-heading .muted,
.exports-card > .section-heading .muted,
.context-section > .section-heading .muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.batch-export-card > .section-heading h2,
.exports-card > .section-heading h2,
.context-section > .section-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.22rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

@media (max-width: 520px) {
  .batch-export-card > .section-heading > div,
  .exports-card > .section-heading > div,
  .context-section > .section-heading > div {
    gap: 3px;
  }

  .batch-export-card > .section-heading .muted,
  .exports-card > .section-heading .muted,
  .context-section > .section-heading .muted {
    font-size: 0.66rem;
    line-height: 1.2;
    letter-spacing: 0.075em;
  }

  .batch-export-card > .section-heading h2,
  .exports-card > .section-heading h2,
  .context-section > .section-heading h2 {
    font-size: 1.14rem;
    line-height: 1.18;
  }
}
