/**
 * ОКВЭД-КОД.РФ (оквэд-код.рф) — Modern Federal Classifier Design System
 * 2026 Edition. Pure Vanilla CSS, ultra-fast, mobile responsive, zero dependencies.
 */

:root {
  --font-sans: 'Golos Text', 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, Monaco, 'Courier New', monospace;

  /* Sapphire & Slate Official Palette */
  --primary-50: #f0f7ff;
  --primary-100: #e0effe;
  --primary-200: #bae0fd;
  --primary-300: #7cc5fb;
  --primary-400: #38a5f6;
  --primary-500: #0f87e8;
  --primary-600: #026bc7;
  --primary-700: #0355a1;
  --primary-800: #074884;
  --primary-900: #0c3e6e;
  --primary-950: #082749;

  /* Emerald success & Teal accents */
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --teal-700: #0f766e;

  /* Neutral Slate Palette */
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --slate-950: #020617;

  /* Theme mappings - Light Mode */
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-primary-subtle: #f0f7ff;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-brand: #026bc7;

  --border-light: #e2e8f0;
  --border-focus: #026bc7;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px -5px rgba(2, 107, 199, 0.25);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --container-max: 1200px;
  --transition-fast: 0.15s ease;
  --transition-smooth: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Theme */
[data-theme="dark"] {
  --bg-body: #090d16;
  --bg-surface: #111827;
  --bg-surface-elevated: #1e293b;
  --bg-subtle: #1f293d;
  --bg-primary-subtle: #082749;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --text-brand: #38a5f6;

  --border-light: #1e293b;
  --border-focus: #38a5f6;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px -5px rgba(56, 165, 246, 0.2);
}

/* Base reset & typography */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-main);
  background-color: var(--bg-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a {
  color: var(--primary-600);
  text-decoration: none;
  transition: color var(--transition-fast);
}

[data-theme="dark"] a {
  color: var(--primary-400);
}

a:hover {
  color: var(--primary-800);
}

[data-theme="dark"] a:hover {
  color: var(--primary-300);
}

/* Layout Container */
.rf-container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* Top Official Notice Bar */
.rf-top-bar {
  background: var(--slate-900);
  color: var(--slate-300);
  font-size: 0.8125rem;
  border-bottom: 1px solid var(--slate-800);
  padding: 0.45rem 0;
}

.rf-top-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.rf-badge-pulse {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  color: #e2e8f0;
}

.rf-pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--emerald-500);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: rf-pulse 2s infinite;
}

@keyframes rf-pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.rf-top-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.rf-top-links a {
  color: var(--slate-400);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.rf-top-links a:hover {
  color: #ffffff;
}

/* Sticky Main Header */
.rf-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-smooth), border-color var(--transition-smooth);
}

.rf-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
  gap: 1.5rem;
}

.rf-logo-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
}

.rf-logo-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-800) 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.5px;
  box-shadow: 0 4px 10px rgba(2, 107, 199, 0.3);
}

.rf-logo-text {
  display: flex;
  flex-direction: column;
}

.rf-logo-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.rf-logo-title span {
  color: var(--primary-600);
}

[data-theme="dark"] .rf-logo-title span {
  color: var(--primary-400);
}

.rf-logo-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.2px;
}

.rf-unofficial-tag {
  background: #0284c7;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.6875rem;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.rf-header-badge-status {
  display: inline-flex;
  align-items: center;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0369a1;
  font-weight: 800;
  font-size: 0.75rem;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

[data-theme="dark"] .rf-header-badge-status {
  background: rgba(2, 132, 199, 0.15);
  border-color: rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
}

.rf-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  list-style: none;
  flex-wrap: nowrap;
}

.rf-nav-link {
  display: inline-flex;
  align-items: center;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.35rem 0.15rem;
  white-space: nowrap;
  position: relative;
  transition: color var(--transition-fast);
}

.rf-nav-link:hover, .rf-nav-link.active {
  color: var(--primary-600);
}

[data-theme="dark"] .rf-nav-link:hover, [data-theme="dark"] .rf-nav-link.active {
  color: var(--primary-400);
}

.rf-nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  height: 3px;
  background-color: var(--primary-600);
  border-radius: var(--radius-full);
}

.rf-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.rf-btn-theme {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.rf-btn-theme:hover {
  background: var(--border-light);
  transform: scale(1.05);
}

/* Hero Section */
.rf-hero {
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-body) 100%);
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--border-light);
}

.rf-hero-header {
  text-align: center;
  max-width: 860px;
  margin: 0 auto 2rem;
}

.rf-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  background-color: var(--primary-50);
  color: var(--primary-700);
  font-size: 0.8125rem;
  font-weight: 700;
  margin-bottom: 1rem;
  border: 1px solid var(--primary-200);
}

[data-theme="dark"] .rf-hero-badge {
  background-color: rgba(2, 107, 199, 0.15);
  color: var(--primary-300);
  border-color: rgba(2, 107, 199, 0.3);
}

.rf-hero-title {
  font-size: 2.35rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.75px;
  color: var(--text-main);
  margin-bottom: 0.85rem;
}

.rf-hero-subtitle {
  font-size: 1.125rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* Search Box & Autocomplete */
.rf-search-box {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  box-sizing: border-box;
}

.rf-search-form {
  display: flex;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  background-color: var(--bg-surface);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 0.35rem 0.5rem 0.35rem 1.25rem;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-fast);
  position: relative;
  overflow: visible;
}

.rf-search-form:focus-within {
  border-color: var(--primary-500);
  box-shadow: var(--shadow-glow);
}

.rf-search-icon {
  color: var(--slate-400);
  display: flex;
  align-items: center;
  margin-right: 0.75rem;
  flex-shrink: 0;
}

.rf-search-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 1.05rem;
  color: var(--text-main);
  background: transparent;
  padding: 0.5rem 0;
}

.rf-search-input::placeholder {
  color: var(--slate-400);
  font-size: 0.95rem;
}

.rf-search-btn {
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-lg);
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.rf-search-btn:hover {
  background: linear-gradient(135deg, var(--primary-700) 0%, var(--primary-800) 100%);
  transform: translateY(-1px);
}

.rf-quick-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.rf-quick-tag {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-weight: 500;
  transition: all var(--transition-fast);
}

.rf-quick-tag:hover {
  background-color: var(--primary-50);
  border-color: var(--primary-300);
  color: var(--primary-700);
}

/* Fast Section Jump Matrix */
.rf-matrix-bar {
  margin-top: 1.75rem;
  padding: 1rem 1.25rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem;
  box-shadow: var(--shadow-sm);
}

.rf-matrix-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text-main);
  white-space: nowrap;
}

.rf-matrix-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.rf-matrix-pill {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.875rem;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  transition: all var(--transition-fast);
}

.rf-matrix-pill:hover {
  background: var(--primary-600);
  color: #ffffff;
  border-color: var(--primary-600);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(2, 107, 199, 0.3);
}

/* Grid of Sections */
.rf-sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.5rem;
  margin: 2.5rem 0;
}

.rf-section-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: all var(--transition-smooth);
}

.rf-section-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-300);
}

.rf-section-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.rf-section-badge {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  flex-shrink: 0;
}

.rf-section-title-wrap {
  flex: 1;
}

.rf-section-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.rf-section-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.rf-section-classes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}

.rf-class-pill {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-light);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
  transition: all var(--transition-fast);
}

.rf-class-pill:hover {
  background-color: var(--primary-50);
  border-color: var(--primary-300);
  color: var(--primary-700);
}

/* Breadcrumbs */
.rf-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  list-style: none;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  gap: 0.35rem;
}

.rf-breadcrumb-item a {
  color: var(--text-muted);
  font-weight: 500;
}

.rf-breadcrumb-item a:hover {
  color: var(--primary-600);
}

.rf-breadcrumb-sep {
  margin: 0 0.35rem;
  color: var(--slate-400);
}

.rf-breadcrumb-current {
  color: var(--text-main);
  font-weight: 700;
}

/* Protocol Card / Code Detail Page */
.rf-protocol-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.rf-protocol-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 1.5rem;
}

.rf-code-badge-large {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.rf-code-pill-main {
  font-family: var(--font-mono);
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--primary-700);
  background-color: var(--primary-50);
  padding: 0.35rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--primary-200);
  letter-spacing: -0.5px;
}

[data-theme="dark"] .rf-code-pill-main {
  color: var(--primary-300);
  background-color: rgba(2, 107, 199, 0.2);
  border-color: rgba(2, 107, 199, 0.4);
}

.rf-btn-copy-code {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
}

.rf-btn-copy-code:hover {
  background-color: var(--border-light);
  transform: translateY(-1px);
}

.rf-btn-copy-code.copied {
  background-color: var(--emerald-500);
  color: #ffffff;
  border-color: var(--emerald-500);
}

.rf-protocol-title {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
}

/* Tables */
.rf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  margin: 1.25rem 0;
}

.rf-table th, .rf-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.rf-table th {
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 600;
  width: 260px;
}

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

/* Descriptive Blocks (Includes / Excludes) */
.rf-desc-block {
  margin: 1.75rem 0;
}

.rf-desc-block-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rf-list-check, .rf-list-cross {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.rf-list-check li, .rf-list-cross li {
  position: relative;
  padding-left: 1.75rem;
  line-height: 1.5;
  color: var(--text-main);
}

.rf-list-check li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 800;
  color: var(--emerald-600);
}

.rf-list-cross li::before {
  content: '✕';
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 800;
  color: #ef4444;
}

/* Business / Tax guidance alert box */
.rf-guidance-box {
  background: linear-gradient(135deg, rgba(2, 107, 199, 0.05) 0%, rgba(16, 185, 129, 0.05) 100%);
  border: 1px solid var(--primary-200);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin: 1.75rem 0;
}

[data-theme="dark"] .rf-guidance-box {
  background: rgba(2, 107, 199, 0.1);
  border-color: rgba(2, 107, 199, 0.3);
}

.rf-guidance-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary-700);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

[data-theme="dark"] .rf-guidance-title {
  color: var(--primary-300);
}

.rf-guidance-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.rf-pill-tag {
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
}

.rf-pill-success {
  background-color: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.rf-pill-warning {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.rf-pill-danger {
  background-color: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* Children tree cards */
.rf-tree-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.rf-tree-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rf-tree-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-light);
  transition: all var(--transition-fast);
  gap: 0.65rem;
  min-width: 0;
}

.rf-tree-item:hover {
  background-color: var(--bg-primary-subtle);
  border-color: var(--primary-300);
}

.rf-tree-item > a {
  display: flex;
  align-items: baseline;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  gap: 0.65rem;
}

.rf-tree-code {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--primary-600);
  flex-shrink: 0;
}

.rf-tree-name {
  flex: 1;
  font-weight: 600;
  color: var(--text-main);
  padding: 0;
  line-height: 1.35;
  word-break: break-word;
  min-width: 0;
}

.rf-tree-item .rf-btn-add-basket {
  flex-shrink: 0;
  white-space: nowrap;
}

/* Search Dropdown on Live Input */
.rf-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 420px;
  overflow-y: auto;
  z-index: 2000;
  display: none;
}

.rf-search-dropdown.active {
  display: block;
}

.rf-dropdown-item {
  display: flex;
  align-items: center;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  text-decoration: none;
  gap: 1rem;
  transition: background-color var(--transition-fast);
}

.rf-dropdown-item:hover, .rf-dropdown-item.selected {
  background-color: var(--bg-primary-subtle);
}

.rf-dropdown-code {
  font-family: var(--font-mono);
  font-weight: 800;
  color: var(--primary-600);
  font-size: 1rem;
  min-width: 75px;
}

.rf-dropdown-name {
  color: var(--text-main);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.35;
}

/* Footer */
.rf-footer {
  margin-top: auto;
  background-color: var(--slate-900);
  color: var(--slate-400);
  border-top: 1px solid var(--slate-800);
  padding: 3.5rem 0 2rem;
  font-size: 0.9375rem;
}

.rf-footer a {
  color: var(--slate-300);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.rf-footer a:hover {
  color: #ffffff;
}

.rf-footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

.rf-footer-col h4 {
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.rf-footer-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.rf-footer-bottom {
  border-top: 1px solid var(--slate-800);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
}

/* ==========================================================================
   RESPONSIVE QUERIES & MOBILE VIEWPORT ADAPTATION (down to 320px)
   ========================================================================== */

html, body {
  max-width: 100vw;
  overflow-x: hidden;
}

.rf-class-actions-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

@media (max-width: 900px) {
  .rf-footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
}

@media (max-width: 768px) {
  .rf-container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .rf-top-links { display: none; }
  .rf-top-bar-inner { justify-content: center; text-align: center; }
  .rf-badge-pulse { font-size: 0.75rem; text-align: center; }

  .rf-header-inner {
    height: auto;
    min-height: 58px;
    padding: 0.5rem 0;
    gap: 0.75rem;
    flex-wrap: wrap;
  }

  /* Horizontal touch-scrollable navigation bar on mobile */
  .rf-nav {
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    padding: 0.35rem 0 0.5rem;
    scrollbar-width: none;
    order: 3;
    border-top: 1px solid var(--border-light);
  }
  .rf-nav::-webkit-scrollbar { display: none; }

  .rf-nav-link {
    font-size: 0.8125rem;
    padding: 0.25rem 0.65rem;
    background-color: var(--bg-subtle);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    white-space: nowrap;
  }

  .rf-nav-link.active {
    background-color: var(--primary-50);
    border-color: var(--primary-300);
    color: var(--primary-700);
  }
  .rf-nav-link.active::after { display: none; }

  .rf-hero { padding: 1.5rem 0 2rem; }
  .rf-hero-title { font-size: 1.5rem; }
  .rf-hero-subtitle { font-size: 0.9375rem; }
  .rf-search-box { padding: 0.5rem; }

  .rf-sections-grid { grid-template-columns: 1fr; gap: 1rem; }
  .rf-bundles-grid { grid-template-columns: 1fr; gap: 1rem; }

  .rf-protocol-card {
    padding: 1.25rem 1rem;
    margin-bottom: 1.25rem;
  }
  .rf-protocol-header {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }
  .rf-protocol-title { font-size: 1.35rem; line-height: 1.3; }

  .rf-code-badge-large {
    flex-wrap: wrap;
    gap: 0.4rem;
  }
  .rf-code-pill-main {
    font-size: 1.35rem;
    padding: 0.25rem 0.65rem;
  }

  .rf-footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .rf-footer-bottom { flex-direction: column; gap: 0.75rem; text-align: center; }

  .rf-nav-hide-mobile {
    display: none !important;
  }
}

@media (max-width: 600px) {
  .rf-search-form {
    padding: 0.25rem 0.35rem 0.25rem 0.75rem;
    border-radius: var(--radius-lg);
  }
  .rf-search-icon {
    margin-right: 0.4rem;
  }
  .rf-search-input {
    font-size: 0.85rem;
    padding: 0.35rem 0;
  }
  .rf-search-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: var(--radius-md);
    flex-shrink: 0;
  }
  .rf-search-btn span {
    display: none;
  }

  /* Key-value tables become stacked cards on mobile to eliminate all horizontal scroll */
  .rf-table, .rf-table tbody {
    display: block;
    width: 100%;
  }

  .rf-table tr {
    display: flex;
    flex-direction: column;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-light);
  }

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

  .rf-table th {
    width: 100% !important;
    padding: 0 0 0.2rem 0 !important;
    font-size: 0.75rem !important;
    color: var(--text-muted) !important;
    border: none !important;
    text-align: left !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .rf-table td {
    width: 100% !important;
    padding: 0 !important;
    font-size: 0.9375rem !important;
    border: none !important;
    word-break: break-word;
  }

  .rf-breadcrumbs {
    font-size: 0.75rem;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    padding-bottom: 0.35rem;
  }
  .rf-breadcrumbs::-webkit-scrollbar { display: none; }
}

@media (max-width: 480px) {
  .rf-container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .rf-logo-sub { font-size: 0.65rem; line-height: 1; margin-top: 2px; }
  .rf-logo-title { font-size: 1.15rem; }
  .rf-logo-icon { width: 34px; height: 34px; font-size: 0.95rem; }
  .rf-header-badge-status { font-size: 0.625rem; padding: 0.15rem 0.4rem; }

  .rf-protocol-card {
    padding: 1rem 0.75rem;
  }

  .rf-protocol-title {
    font-size: 1.15rem;
  }

  .rf-code-pill-main {
    font-size: 1.15rem;
    padding: 0.2rem 0.5rem;
  }

  .rf-btn-copy-code, .rf-btn-add-basket {
    font-size: 0.75rem;
    padding: 0.35rem 0.6rem;
  }

  .rf-tree-card {
    padding: 1rem 0.75rem;
  }

  .rf-tree-item {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.45rem;
    padding: 0.6rem 0.65rem;
  }

  .rf-tree-item > a {
    width: 100%;
    flex: none;
  }

  .rf-tree-item .rf-btn-add-basket {
    margin-left: auto;
    font-size: 0.75rem;
    padding: 0.25rem 0.55rem;
  }

  .rf-basket-trigger {
    bottom: 12px;
    right: 12px;
    padding: 0.55rem 0.85rem;
    font-size: 0.8125rem;
    gap: 0.4rem;
    box-shadow: 0 4px 16px rgba(2, 107, 199, 0.4);
  }
}

/* ==========================================================================
   E-E-A-T & TRUST COMPONENTS (YMYL Compliance)
   ========================================================================== */

.rf-expert-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 0.4rem 1rem 0.4rem 0.5rem;
  font-size: 0.8125rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}

.rf-expert-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--teal-600) 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.rf-expert-info {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.rf-expert-name {
  font-weight: 700;
  color: var(--text-main);
}

.rf-expert-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.rf-disclaimer-box {
  background-color: var(--bg-subtle);
  border-left: 4px solid var(--primary-600);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 1.5rem 0;
}

.rf-disclaimer-title {
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ==========================================================================
   INTERACTIVE CODE BASKET / BUILDER FOR Р21001 & Р11001
   ========================================================================== */

/* Floating trigger button */
.rf-basket-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1200;
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-800) 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-full);
  padding: 0.85rem 1.4rem;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9375rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  box-shadow: 0 8px 24px rgba(2, 107, 199, 0.4);
  transition: all var(--transition-fast);
}

.rf-basket-trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(2, 107, 199, 0.5);
}

.rf-basket-count {
  background-color: #ef4444;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  border-radius: var(--radius-full);
  padding: 0.15rem 0.5rem;
  min-width: 20px;
  text-align: center;
}

/* Add to basket button on cards */
.rf-btn-add-basket {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
}

.rf-btn-add-basket:hover {
  background-color: var(--primary-50);
  border-color: var(--primary-300);
  color: var(--primary-700);
}

.rf-btn-add-basket.in-basket {
  background-color: var(--emerald-500);
  color: #ffffff;
  border-color: var(--emerald-500);
}

/* Modal Drawer */
.rf-basket-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  max-width: 90vw;
  height: 100vh;
  background-color: var(--bg-surface-elevated);
  border-left: 1px solid var(--border-light);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.2);
  z-index: 1500;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.rf-basket-drawer.active {
  right: 0;
}

.rf-basket-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1490;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

.rf-basket-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.rf-basket-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rf-basket-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

.rf-basket-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1.5rem;
  line-height: 1;
}

.rf-basket-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rf-basket-item {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.rf-basket-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rf-basket-item-code {
  font-family: var(--font-mono);
  font-weight: 800;
  color: var(--primary-700);
}

.rf-basket-item-name {
  font-size: 0.875rem;
  color: var(--text-main);
  line-height: 1.35;
}

.rf-basket-item-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.rf-basket-radio-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.rf-basket-remove {
  background: transparent;
  border: none;
  color: #ef4444;
  font-size: 0.75rem;
  cursor: pointer;
  margin-left: auto;
}

.rf-basket-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background-color: var(--bg-surface);
}

/* ==========================================================================
   INDUSTRY BUNDLE CARDS (/podborki/)
   ========================================================================== */

.rf-bundles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.rf-bundle-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: all var(--transition-smooth);
}

.rf-bundle-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-400);
}

.rf-bundle-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--primary-50);
  color: var(--primary-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

[data-theme="dark"] .rf-bundle-icon {
  background: rgba(2, 107, 199, 0.2);
  color: var(--primary-300);
}

.rf-bundle-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.rf-bundle-desc {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  line-height: 1.5;
  flex: 1;
}

.rf-bundle-codes-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

/* ==========================================================================
   PRINT STYLES (@media print)
   ========================================================================== */

@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .rf-top-bar,
  .rf-header,
  .rf-footer,
  .rf-search-box,
  .rf-matrix-bar,
  .rf-basket-trigger,
  .rf-basket-drawer,
  .rf-btn-theme,
  .rf-btn-copy-code,
  .rf-btn-add-basket {
    display: none !important;
  }
  .rf-container {
    max-width: 100% !important;
    padding: 0 !important;
  }
  .rf-protocol-card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .rf-protocol-title {
    font-size: 1.8rem !important;
  }
  .rf-table th, .rf-table td {
    border-color: #cccccc !important;
    color: #000000 !important;
  }
  a {
    color: #000000 !important;
    text-decoration: none !important;
  }
}

