/* ==========================================================================
   nalogi.io — Публичные страницы, Standalone Формы и Компоненты (public.css)
   Соответствует NALOGI_SITE_DESIGN_SPEC.md и NALOGI_SITE_IMPLEMENTATION_PLAN.md
   ========================================================================== */

@import url('/design-tokens.css');

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  background-color: var(--surface-page);
  color: var(--text-primary);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100%;
}

body.mobile-nav-locked {
  overflow: hidden;
}

img, svg, video, canvas, audio, iframe, embed, object {
  max-width: 100%;
  height: auto;
}

/* ==========================================================================
   A11y Skip Link
   ========================================================================== */
.skip-link {
  position: absolute;
  /* Сдвиг по left (не по top): top не должен уводить элемент за верхнюю границу,
     иначе :focus возвращает его частично. AC-DS-13. */
  left: -9999px;
  top: 0;
  background: var(--action-primary);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  z-index: 9999;
  text-decoration: none;
  font-weight: 600;
  transition: top var(--transition-fast);
}
.skip-link:focus,
.skip-link:focus-visible {
  left: 1rem;
  top: 1rem;
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ==========================================================================
   Header & Responsive Public Navigation
   ========================================================================== */
.site-header {
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-default);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-heading);
  flex-shrink: 0;
}

.brand-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 6px;
}

.brand-text {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-heading);
}

.brand-badge {
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--surface-subtle);
  color: var(--action-accent);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-default);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Desktop Main Nav */
.main-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.35rem 0.2rem;
  border-bottom: 2px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.nav-link:hover {
  color: var(--action-primary);
}
.nav-link.active {
  color: var(--action-accent);
  border-bottom-color: var(--action-accent);
  font-weight: 600;
}

.btn-auth {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 1.1rem;
  background: var(--surface-subtle);
  color: var(--action-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}
.btn-auth:hover {
  background: var(--action-primary);
  color: #fff;
  border-color: var(--action-primary);
  box-shadow: var(--shadow-sm);
}

/* Mobile Hamburger Button */
.mobile-nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 38px;
  height: 38px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 8px;
  cursor: pointer;
  z-index: 1001;
  transition: all var(--transition-fast);
}
.mobile-nav-toggle:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}
.hamburger-bar {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--text-heading);
  border-radius: 2px;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}
.mobile-nav-toggle.is-active .hamburger-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.mobile-nav-toggle.is-active .hamburger-bar:nth-child(2) {
  opacity: 0;
}
.mobile-nav-toggle.is-active .hamburger-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Mobile Drawer & Backdrop */
.mobile-nav-drawer[hidden],
.mobile-nav-backdrop[hidden] {
  display: none !important;
}

.mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  background: var(--surface-overlay);
  backdrop-filter: blur(2px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}
.mobile-nav-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 290px;
  max-width: 85vw;
  background: var(--surface-card);
  box-shadow: var(--shadow-lg);
  z-index: 999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-normal);
  padding: 1.25rem;
  overflow-y: auto;
}
.mobile-nav-drawer.is-open {
  transform: translateX(0);
}

.mobile-nav-header {
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.mobile-nav-link:hover, .mobile-nav-link.active {
  background: var(--surface-subtle);
  color: var(--action-accent);
}

.mobile-nav-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
  margin-top: 1rem;
}

/* ==========================================================================
   Page Container & Breadcrumbs
   ========================================================================== */
.page-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 1.5rem;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}
.breadcrumbs a {
  color: var(--link);
  text-decoration: none;
}
.breadcrumbs a:hover {
  text-decoration: underline;
}
.breadcrumbs-sep {
  color: var(--text-muted);
}

/* ==========================================================================
   Homepage Marketing Hero (P01)
   ========================================================================== */
.marketing-hero {
  background: var(--gradient-hero);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 3rem 2.5rem;
  margin-bottom: 3rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2.5rem;
  align-items: center;
}

.hero-preview-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--action-accent);
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  margin-bottom: 1rem;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-heading);
  line-height: 1.18;
  margin: 0 0 1rem;
  letter-spacing: -0.025em;
}

.hero-subtitle {
  font-size: 1.12rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 1.75rem;
  max-width: 540px;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}

.hero-trust-list {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0;
  margin: 0;
  list-style: none;
}
.hero-trust-list li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.hero-trust-list svg {
  color: var(--success);
  flex-shrink: 0;
}

/* Product UI Mockup Card (Hero Right) */
.hero-product-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transition: transform var(--transition-normal);
}
.hero-product-card:hover {
  transform: translateY(-2px);
}

.mockup-window-bar {
  background: #F1F5F9;
  border-bottom: 1px solid var(--border-default);
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.window-dots {
  display: flex;
  gap: 5px;
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.dot-red { background: #EF4444; }
.dot-yellow { background: #F59E0B; }
.dot-green { background: #10B981; }

.mockup-window-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  padding: 0.15rem 0.65rem;
  border-radius: var(--radius-sm);
  flex-grow: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mockup-body {
  padding: 1.25rem;
  background: var(--surface-card);
}

.mockup-taxpayer-badge {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1rem;
}
.taxpayer-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-heading);
}

.mockup-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.mockup-kpi-cell {
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.75rem;
}
.kpi-cell-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}
.kpi-cell-value {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-heading);
  margin-top: 0.2rem;
}
.kpi-cell-highlight {
  color: var(--success);
}

.mockup-status-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--success);
  margin-bottom: 1rem;
}

.mockup-table-preview {
  background: #FAFBFD;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  overflow: hidden;
}
.table-row-head {
  background: #F1F5F9;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}
.table-row-item {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}
.table-row-item:last-child {
  border-bottom: none;
  font-weight: 700;
  background: #EFF6FF;
  color: var(--text-heading);
}

/* ==========================================================================
   Buttons and CTAs
   ========================================================================== */
.btn-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-align: center;
}

.btn-cta-primary {
  background: var(--action-primary);
  color: #FFFFFF;
}
.btn-cta-primary:hover {
  background: var(--action-hover);
  box-shadow: var(--shadow-sm);
}

.btn-cta-accent {
  background: var(--action-accent);
  color: #FFFFFF;
}
.btn-cta-accent:hover {
  background: var(--action-accent-hover);
  box-shadow: var(--shadow-sm);
}

.btn-cta-outline {
  background: var(--surface-card);
  color: var(--action-primary);
  border-color: var(--border-control);
}
.btn-cta-outline:hover {
  background: var(--surface-hover);
  border-color: var(--action-primary);
}

.btn-cta-disabled {
  background: var(--surface-subtle);
  color: var(--text-muted);
  border-color: var(--border-default);
  cursor: not-allowed;
  opacity: 0.8;
}

/* ==========================================================================
   Two Scenarios Section (Самостоятельно vs С бухгалтером)
   ========================================================================== */
.scenario-section {
  margin-bottom: 3.5rem;
}

.section-h2 {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-heading);
  margin: 0 0 0.5rem;
  letter-spacing: -0.015em;
}

.scenario-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.75rem;
}

.scenario-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 2.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}
.scenario-card:hover {
  border-color: var(--action-accent);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.scenario-card-header {
  margin-bottom: 1.25rem;
}

.scenario-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  margin-bottom: 0.85rem;
}
.scenario-badge-self {
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}
.scenario-badge-expert {
  background: var(--ai-bg);
  color: var(--ai);
  border: 1px solid var(--ai-border);
}

.scenario-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-heading);
  margin: 0 0 0.5rem;
}

.scenario-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}

.scenario-features-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.scenario-features-list li {
  font-size: 0.92rem;
  color: var(--text-primary);
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}
.scenario-features-list svg {
  color: var(--success);
  flex-shrink: 0;
  margin-top: 2px;
}

/* ==========================================================================
   Features Grid (Возможности сервиса)
   ========================================================================== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 1.5rem;
  margin-bottom: 3.5rem;
}

.feature-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}
.feature-card:hover {
  transform: translateY(-2px);
  border-color: var(--action-accent);
}

.feature-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--action-accent);
  margin-bottom: 1rem;
}

.feature-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0 0 0.5rem;
}
.feature-card p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}

/* ==========================================================================
   Steps Grid (Как это работает)
   ========================================================================== */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 3.5rem;
}

.step-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--action-accent);
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.85rem;
}

.step-card h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0 0 0.4rem;
}
.step-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* ==========================================================================
   Popular Forms Section
   ========================================================================== */
.popular-forms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 1.25rem;
  margin-bottom: 3.5rem;
}

.form-card-teaser {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  text-decoration: none;
}
.form-card-teaser:hover {
  border-color: var(--action-accent);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.form-card-knd {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--action-accent);
  background: #EFF6FF;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-bottom: 0.5rem;
}
.form-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0 0 0.5rem;
}
.form-card-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

/* ==========================================================================
   Form Page: Header & Badges
   ========================================================================== */
.form-hero {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.form-h1 {
  font-size: 2.1rem;
  line-height: 1.22;
  color: var(--text-heading);
  margin: 0 0 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
}

.badge-verified {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.badge-unverified {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.badge-subtle {
  background: var(--surface-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.badge-ai {
  background: var(--ai-bg);
  color: var(--ai);
  border: 1px solid var(--ai-border);
}

.form-quick-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 1rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  margin-top: 1rem;
}

.fact-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.fact-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.fact-value {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
}

/* ==========================================================================
   Multi-page Blank Viewer (§5)
   ========================================================================== */
.viewer-section {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-bottom: 2.25rem;
  box-shadow: var(--shadow-md);
}

.viewer-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-default);
}

.viewer-title-group h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0 0 0.25rem;
}

.viewer-meta-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.viewer-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.viewer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-card);
  border: 1px solid var(--border-control);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.75rem;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}
.viewer-btn:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--action-primary);
}
.viewer-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.page-counter {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-heading);
  padding: 0 0.5rem;
  min-width: 110px;
  text-align: center;
}

.viewer-workspace {
  display: flex;
  gap: 1.25rem;
  min-height: 640px;
  background: var(--surface-subtle);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  max-width: 100%;
}

.viewer-thumbnails {
  width: 130px;
  flex-shrink: 0;
  overflow-y: auto;
  max-height: 620px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-right: 0.5rem;
}

.thumbnail-item {
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast);
  text-align: center;
  padding: 0.25rem;
}
.thumbnail-item:hover {
  border-color: var(--link);
}
.thumbnail-item.active {
  border-color: var(--action-accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}
.thumbnail-item img {
  width: 100%;
  height: auto;
  display: block;
}
.thumbnail-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.viewer-canvas-wrap {
  flex-grow: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  max-height: 620px;
  background: #E8EEF4;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  max-width: 100%;
}

.viewer-sheet {
  background: #FFFFFF;
  box-shadow: 0 8px 30px rgba(20, 43, 73, 0.18);
  border-radius: 4px;
  transition: transform var(--transition-fast);
  max-width: 100%;
  height: auto;
  display: block;
}

.viewer-empty {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: #fff;
  border-radius: var(--radius-md);
}
.viewer-empty h3 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-heading);
  margin: 0.75rem 0 0.5rem;
}
.viewer-empty p {
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 0 1.5rem;
}

/* ==========================================================================
   Action Cards (Сразу под Preview: Три карточки)
   ========================================================================== */
.action-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.action-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.action-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.card-featured {
  border-color: #93C5FD;
  box-shadow: 0 0 0 1px #3B82F6, var(--shadow-md);
}

.card-badge-top {
  margin-bottom: 0.75rem;
}

.card-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-heading);
  margin: 0 0 0.25rem;
}

.card-subtitle {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--action-accent);
  margin-bottom: 0.75rem;
}

.card-price {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-heading);
  margin-bottom: 0.75rem;
}

.card-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 1.25rem;
}

.card-features {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.card-features li {
  font-size: 0.88rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.cta-explanation {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.4rem;
}

/* ==========================================================================
   Comparison Table (Бесплатно vs Подписка)
   ========================================================================== */
.comparison-section {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 2rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.comparison-header {
  text-align: center;
  margin-bottom: 1.75rem;
}
.comparison-header h2 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-heading);
  margin: 0 0 0.4rem;
}
.comparison-header p {
  color: var(--text-secondary);
  margin: 0;
  font-size: 0.92rem;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.comparison-table th, .comparison-table td {
  padding: 0.9rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}
.comparison-table th {
  background: var(--surface-subtle);
  font-weight: 700;
  color: var(--text-heading);
}
.comparison-table tr:last-child td {
  border-bottom: none;
}
.col-free {
  color: var(--success);
  font-weight: 500;
}
.col-sub {
  color: var(--text-primary);
  font-weight: 500;
}
.icon-check {
  color: var(--success);
  font-weight: 800;
  margin-right: 0.25rem;
}
.icon-cross {
  color: var(--text-muted);
  font-weight: 800;
  margin-right: 0.25rem;
}

/* ==========================================================================
   Legal Basis Table & Instructions
   ========================================================================== */
.legal-table-section {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
.legal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.legal-table th, .legal-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}
.legal-table th {
  background: var(--surface-subtle);
  font-weight: 700;
  color: var(--text-heading);
}

.instruction-section {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-sm);
}

.related-forms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}
.related-form-card {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-decoration: none;
  transition: all var(--transition-fast);
  display: block;
}
.related-form-card:hover {
  border-color: var(--action-accent);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

/* ==========================================================================
   Inquiry Section (Форма вопроса)
   ========================================================================== */
.inquiry-section {
  background: var(--surface-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  text-align: center;
  margin-bottom: 3.5rem;
}

/* ==========================================================================
   FAQ Details/Summary
   ========================================================================== */
.faq-item {
  border-bottom: 1px solid var(--border-subtle);
  padding: 1rem 0;
}
.faq-item:last-child {
  border-bottom: none;
}
.faq-summary {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-heading);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}
.faq-summary::-webkit-details-marker {
  display: none;
}
.faq-summary::after {
  content: "＋";
  font-size: 1.2rem;
  color: var(--action-accent);
  font-weight: 700;
  transition: transform var(--transition-fast);
}
.faq-item[open] .faq-summary::after {
  content: "−";
}
.faq-answer {
  padding-top: 0.75rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ==========================================================================
   Catalog Search and Filters
   ========================================================================== */
.catalog-hero-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.5rem;
}
.catalog-hero-intro {
  flex: 1 1 320px;
}
.catalog-hero-media {
  flex: 0 0 180px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.catalog-illustration-img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  filter: drop-shadow(0 6px 16px rgba(15, 23, 42, 0.08));
}

.catalog-filters {
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
}
.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.filter-input-search {
  flex: 1 1 200px;
  min-width: 160px;
  max-width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-family: inherit;
  color: var(--text-primary);
  background: #FFFFFF;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.filter-input-search:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--focus-ring);
}

.catalog-search-bar {
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.search-input-wrap {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.search-input {
  flex-grow: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-primary);
  background: #FFFFFF;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.search-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--focus-ring);
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.filter-select {
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-family: inherit;
  background: #FFFFFF;
  color: var(--text-primary);
  cursor: pointer;
}

/* Pagination */
.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin: 2.5rem 0;
  flex-wrap: wrap;
}
.pagination-btn {
  padding: 0.45rem 0.85rem;
  background: var(--surface-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}
.pagination-btn:hover {
  background: var(--surface-hover);
  border-color: var(--action-primary);
}
.pagination-current {
  padding: 0.45rem 0.85rem;
  background: var(--action-primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: #0E1929;
  color: #CBD5E1;
  padding: 3rem 1.5rem 2rem;
  margin-top: 4rem;
  border-top: 1px solid #1E293B;
}

.footer-container {
  max-width: var(--container-max);
  margin: 0 auto;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.footer-links a {
  color: #94A3B8;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color var(--transition-fast);
}
.footer-links a:hover {
  color: #FFFFFF;
}

.footer-copy {
  font-size: 0.82rem;
  /* На тёмном футере muted-токен светлой темы не читается: явное значение
     для этой поверхности (AA ≥4.5:1 на #0E1929). */
  color: #94A3B8;
  line-height: 1.55;
}

/* ==========================================================================
   Responsive Breakpoints
   Desktop: >=1024, Tablet: 768-1023, Mobile: <768, Small: <=390
   ========================================================================== */
@media (max-width: 1023px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .hero-title {
    font-size: 2.15rem;
  }
  .steps-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .action-cards-grid {
    grid-template-columns: 1fr;
  }
  .viewer-workspace {
    min-height: 520px;
  }
}

@media (max-width: 767px) {
  .header-container {
    padding: 0.65rem 1rem;
  }
  .main-nav {
    display: none;
  }
  .mobile-nav-toggle {
    display: flex;
  }
  .page-container {
    padding: 1rem;
  }

  /* Hero Mobile */
  .marketing-hero {
    padding: 1.75rem 1.25rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
  }
  .hero-title {
    font-size: 1.75rem;
    line-height: 1.2;
  }
  .hero-subtitle {
    font-size: 1rem;
    margin-bottom: 1.25rem;
  }
  .hero-actions {
    flex-direction: column;
  }
  .hero-actions .btn-cta {
    width: 100%;
  }

  /* Scenarios */
  .scenario-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  .scenario-card {
    padding: 1.5rem;
  }

  /* Steps */
  .steps-grid {
    grid-template-columns: 1fr;
  }

  /* Form Landing */
  .form-hero {
    padding: 1.25rem;
  }
  .form-h1 {
    font-size: 1.45rem;
    line-height: 1.25;
  }
  .form-quick-facts {
    grid-template-columns: 1fr;
  }

  /* Viewer Mobile: No horizontal scroll */
  .viewer-section {
    padding: 1rem;
    border-radius: var(--radius-lg);
  }
  .viewer-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .viewer-toolbar {
    width: 100%;
    justify-content: flex-start;
  }
  .viewer-workspace {
    flex-direction: column;
    min-height: 420px;
    padding: 0.65rem;
  }
  .viewer-thumbnails {
    width: 100%;
    max-height: 90px;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.4rem;
    padding-right: 0;
  }
  .thumbnail-item {
    width: 58px;
    flex-shrink: 0;
  }
  .viewer-canvas-wrap {
    padding: 0.75rem;
  }

  .comparison-section {
    padding: 1.25rem;
  }
  .comparison-table th, .comparison-table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.85rem;
  }

  /* Catalog Mobile */
  .catalog-hero-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .catalog-hero-media {
    display: none;
  }
  .filters-row {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-input-search, .filter-select, .filters-row .btn-cta {
    width: 100%;
  }
}

@media (max-width: 390px) {
  .hero-title {
    font-size: 1.5rem;
  }
  .form-h1 {
    font-size: 1.3rem;
  }
  .mockup-kpi-grid {
    grid-template-columns: 1fr;
  }
  .page-counter {
    min-width: 80px;
    font-size: 0.82rem;
  }
  .viewer-btn {
    padding: 0.35rem 0.5rem;
    font-size: 0.82rem;
  }
}

/* ==========================================================================
   Ultra-narrow tier (320px) — без горизонтального overflow
   ========================================================================== */
@media (max-width: 360px) {
  .page-container {
    padding: 0.75rem;
  }
  .feature-card {
    padding: 1.15rem;
  }
  .intake-card {
    padding: 1.15rem;
  }
  .form-input,
  .form-select-control,
  .form-textarea,
  .filter-input-search,
  .filter-select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
}

/* --- Подписанные поля фильтров (AC-DS-14, AC-DS-24) --- */
.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}
.filter-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.filter-field .filter-input-search,
.filter-field .filter-select {
  width: 100%;
}

/* --- Видимый focus-ring (AC-DS-17): не убираем outline без замены --- */
.btn-cta:focus-visible,
.btn-cta:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}
.filter-select:focus-visible,
.filter-input-search:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* --- Provenance-блок страницы формы (03:§7) --- */
.form-provenance {
  margin: 1.5rem 0;
  padding: 1.25rem 1.5rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}
.form-provenance-title {
  font-size: 1.05rem;
  color: var(--text-heading);
  margin: 0 0 0.75rem;
}
.form-provenance-list {
  display: grid;
  grid-template-columns: minmax(120px, max-content) 1fr;
  gap: 0.4rem 1rem;
  margin: 0;
  font-size: 0.88rem;
}
.form-provenance-list dt {
  color: var(--text-secondary);
  font-weight: 600;
}
.form-provenance-list dd {
  margin: 0;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}
.form-provenance-note {
  margin: 0.85rem 0 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
@media (max-width: 767px) {
  .form-provenance-list { grid-template-columns: 1fr; gap: 0.15rem; }
  .form-provenance-list dd { margin-bottom: 0.5rem; }
}
