/* Modern Professional Design System 2024 */

/* Design Tokens */
:root {
  /* Colors - Professional Palette */
  --primary: #0066ff;
  --primary-dark: #0052cc;
  --primary-light: #e6f0ff;
  --success: #00a86b;
  --success-light: #e6f7f1;
  --warning: #ff9500;
  --danger: #ff3b30;

  /* Neutrals */
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Semantic Colors */
  --bg-primary: var(--white);
  --bg-secondary: var(--gray-50);
  --bg-card: var(--white);
  --text-primary: var(--gray-900);
  --text-secondary: var(--gray-600);
  --text-muted: var(--gray-500);
  --border: var(--gray-200);
  --border-focus: var(--primary);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
  --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #171717;
    --bg-card: #1a1a1a;
    --text-primary: #f3f4f6;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --border: #262626;
    --gray-50: #171717;
    --gray-100: #262626;
  }
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* Disable decorative background for article pages */
body.article-page::before {
  display: none;
}

.page-surface {
  max-width: 1360px;
  margin: var(--space-2xl) auto var(--space-xl);
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(17, 24, 39, 0.08);
  padding-bottom: var(--space-2xl);
  position: relative;
  overflow: hidden;
}

.page-surface--article {
  padding-bottom: var(--space-3xl);
}

.page-surface .hero {
  margin: 0;
  border-bottom: 1px solid var(--border);
  padding: var(--space-3xl) 0;
}

.page-surface .tabs-navigation {
  margin: 0 var(--space-lg) var(--space-xl);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.tabs-navigation {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.article-hero {
  margin: var(--space-2xl) var(--space-lg) var(--space-xl);
  padding: clamp(2.5rem, 6vw, 4rem);
  background: linear-gradient(135deg, rgba(0, 102, 255, 0.08) 0%, rgba(0, 168, 107, 0.15) 100%);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(17, 24, 39, 0.08);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.article-hero__tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.6);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: var(--space-md);
}

.article-hero h1 {
  font-size: clamp(2.4rem, 4.5vw, 3.25rem);
  letter-spacing: -0.03em;
  margin-bottom: var(--space-sm);
}

.article-hero__meta,
.article-hero .article-meta {
  margin-top: var(--space-lg);
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  color: var(--text-secondary);
  font-size: 0.95rem;
  align-items: center;
}

.article-hero__meta span,
.article-hero .article-meta span {
  margin-right: var(--space-sm);
}

.article-hero__subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 760px;
  margin-top: var(--space-md);
}

.article-hero__actions {
  margin-top: var(--space-xl);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: center;
}

.article-hero__actions .data-badge {
  background: rgba(255, 255, 255, 0.7);
}

@media (max-width: 768px) {
  .article-hero {
    margin: var(--space-xl) var(--space-sm) var(--space-lg);
    padding: var(--space-2xl) var(--space-lg) var(--space-2xl);
  }

  .article-hero__actions {
    flex-direction: column;
    align-items: flex-start;
  }
}

.article-hero+.tabs-navigation {
  margin-top: calc(-1 * var(--space-2xl));
  margin-left: clamp(0.75rem, 3vw, var(--space-xl));
  margin-right: clamp(0.75rem, 3vw, var(--space-xl));
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-xl);
  padding: 0.25rem;
  border: 1px solid rgba(17, 24, 39, 0.08);
  background: var(--bg-primary);
}

@media (max-width: 768px) {
  .article-hero+.tabs-navigation {
    margin-top: -2.25rem;
    border-radius: var(--radius-lg);
  }
}


/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-md);
  letter-spacing: 0;
}

h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

h2 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-2xl);
  color: var(--text-primary);
  position: relative;
  padding-bottom: var(--space-md);
}

h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--success) 100%);
  border-radius: 2px;
}

h3 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h4 {
  font-size: 1.25rem;
  font-weight: 600;
}

h5 {
  font-size: 1.125rem;
  font-weight: 600;
}

h6 {
  font-size: 1rem;
  font-weight: 600;
}

p {
  margin-bottom: var(--space-md);
  color: var(--text-secondary);
}

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

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* Scroll offset for sections to account for sticky header */
section[id] {
  scroll-margin-top: 100px;
}

#calculators,
#articles,
#compare {
  scroll-margin-top: 100px;
}

/* Header */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 900;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-sm);
}

@media (prefers-color-scheme: dark) {
  .site-header {
    background: rgba(26, 26, 26, 0.95);
  }
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  gap: var(--space-lg);
}

.mobile-header-title {
  display: none;
}

/* Header Tabs Navigation */
.header-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex: 1;
  justify-content: center;
}

.header-tab {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
}

.header-tab:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.header-tab.active {
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 600;
}

@media (max-width: 900px) {
  .header-content {
    flex-wrap: wrap;
    gap: var(--space-sm);
    padding-bottom: 0;
  }

  .header-tabs {
    display: flex;
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
    padding: 0.5rem 0 1rem;
    order: 3;
    -webkit-overflow-scrolling: touch;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
  }

  .header-tab {
    flex-shrink: 0;
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
  }

  /* Hide scrollbar but keep functionality */
  .header-tabs::-webkit-scrollbar {
    height: 0;
    width: 0;
    display: none;
  }
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.logo svg {
  width: 32px;
  height: 32px;
}

/* Navigation */
.nav-menu {
  display: flex;
  gap: var(--space-xs);
  align-items: center;
}

.nav-link {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
}

.nav-link:hover {
  background: var(--gray-100);
  color: var(--text-primary);
  text-decoration: none;
}

.nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
}


/* Hero Section */
.hero {
  padding: var(--space-3xl) 0;
  text-align: center;
  background: linear-gradient(135deg, var(--primary-light) 0%, transparent 100%);
  margin-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  font-size: 3.5rem;
  margin-bottom: var(--space-lg);
  color: var(--gray-900);
}

.hero p {
  font-size: 1.25rem;
  max-width: 600px;
  margin: 0 auto;
  color: var(--text-secondary);
}

/* Cards Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-lg);
  margin: var(--space-2xl) 0;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  position: relative;
  overflow: hidden;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-lg);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-4px);
}

.card:hover .card-icon {
  opacity: 1;
  background: var(--primary-light);
  color: var(--primary);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-md);
  position: relative;
  z-index: 1;
}

.card-header h3 {
  margin: 0;
  flex: 1;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.card-icon {
  flex-shrink: 0;
  margin-left: var(--space-md);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary) 0%, #0052cc 100%);
  border-radius: 14px;
  box-shadow: 0 6px 16px -3px rgba(0, 102, 255, 0.3);
  transition: all var(--transition-base);
}

.card-icon svg {
  width: 28px;
  height: 28px;
  stroke: white;
  color: white;
}

.card h3 {
  margin-bottom: var(--space-sm);
}

.card p {
  margin-bottom: var(--space-lg);
  flex-grow: 1;
  position: relative;
  z-index: 1;
}

.card-link {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.card-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 4px;
}

.card-description {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
  font-weight: 400;
  position: relative;
  z-index: 1;
}

.card-highlights {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  position: relative;
  z-index: 1;
}

.card-highlights li {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.5;
  padding: 0.4rem 0;
}

.card-highlights li::before {
  content: '';
  /* CSS Checkmark handled via SVG in HTML usually, but keeping fallback */
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230066ff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px;
  background-color: rgba(0, 102, 255, 0.1);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Articles Section Hero Style */
#articles .container>h2 {
  text-align: center;
  margin-bottom: var(--space-2xl);
  position: relative;
}

#articles .container>h2::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background: linear-gradient(135deg, var(--primary) 0%, #0052cc 100%);
  border-radius: 2px;
  margin: var(--space-md) auto 0;
}

/* Articles Grid Improvements */
#articles .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-xl);
}

#articles .card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 0;
  overflow: hidden;
  transition: all var(--transition-base);
  min-height: auto;
}

#articles .card:hover {
  border-color: var(--primary);
  box-shadow: 0 12px 32px -8px rgba(0, 102, 255, 0.2);
  transform: translateY(-4px);
}

#articles .card-header {
  background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 50%, #3b82f6 100%);
  padding: var(--space-lg) var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
  height: 130px;
  /* Fixed height for uniform cards */
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

#articles .card-header h3 {
  color: white;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 0;
  flex: 1;
  padding-right: var(--space-md);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;

  overflow: hidden;
}

#articles .card-icon {
  width: 52px;
  height: 52px;
  min-width: 52px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  box-shadow: none;
  margin-left: var(--space-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

#articles .card-icon svg {
  width: 26px;
  height: 26px;
  stroke: white;
}

#articles .card-description {
  padding: var(--space-lg) var(--space-lg) var(--space-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  flex-grow: 0;
  margin-bottom: 0;
}

#articles .card-highlights {
  padding: 0 var(--space-lg) var(--space-lg);
  gap: 0.5rem;
}

#articles .card-highlights li {
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.3rem 0;
}

#articles .card-highlights li::before {
  width: 18px;
  height: 18px;
  background-size: 12px;
}

/* ═══════════════════════════════════════════════════════════════
   CALCULATOR CARDS - Clean Professional Design
   ═══════════════════════════════════════════════════════════════ */
.calc-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
  margin-top: var(--space-xl);
}

/* Articles Section on Main Page */
.articles-section {
  margin-top: var(--space-2xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border);
}

.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.section-header-row h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--primary);
  background: transparent;
  color: var(--primary);
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.btn-outline:hover {
  background: var(--primary);
  color: white;
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

@media (max-width: 1024px) {
  .articles-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .articles-grid {
    grid-template-columns: 1fr;
  }
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-fast);
}

.article-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.article-card__icon {
  width: 48px;
  height: 48px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-md);
}

.article-card__icon svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
}

.article-card__title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-sm) 0;
}

.article-card__desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 var(--space-md) 0;
}

.article-card__link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.article-card__link:hover {
  color: var(--primary-dark);
}

/* News Section on Main Page */
.news-section-main {
  margin: var(--space-lg);
  padding: var(--space-xl);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.news-grid-main {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-top: var(--space-md);
}

@media (max-width: 1024px) {
  .news-grid-main {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .news-grid-main {
    grid-template-columns: 1fr;
  }
}

.news-card-main {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.news-card-main:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.news-card-main__badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  width: fit-content;
}

.news-card-main__badge--invest {
  background: #e8f5e9;
  color: #2e7d32;
}

.news-card-main__badge--savings {
  background: #fff3e0;
  color: #ef6c00;
}

.news-card-main__badge--realty {
  background: #e3f2fd;
  color: #1565c0;
}

.news-card-main__badge--crypto {
  background: #fce4ec;
  color: #c2185b;
}

.news-card-main__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.4;
}

.news-card-main__desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
  flex-grow: 1;
}

.news-card-main__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-light);
}

.news-card-main__source {
  font-weight: 500;
}

.calc-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
}

.calc-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px -8px rgba(0, 102, 255, 0.2);
  border-color: var(--primary);
}

.calc-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Header with gradient */
.calc-card__header {
  background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 50%, #3b82f6 100%);
  padding: var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 90px;
}

.calc-card__title {
  font-size: 1.1rem;
  font-weight: 600;
  color: white;
  margin: 0;
  flex: 1;
  line-height: 1.3;
}

/* Icon */
.calc-card__icon {
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  margin-left: var(--space-sm);
}

.calc-card__icon svg {
  width: 26px;
  height: 26px;
  stroke: white;
}

/* Content */
.calc-card__content {
  padding: var(--space-lg);
}

.calc-card__desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0 0 var(--space-md) 0;
  line-height: 1.5;
}

.calc-card__example {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: 10px;
  font-size: 0.85rem;
}

.calc-card__example-label {
  color: var(--text-muted);
  font-weight: 500;
}

.calc-card__example-value {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.calc-card__example-value strong {
  color: var(--primary);
  font-weight: 700;
}

/* Responsive */
@media (max-width: 640px) {
  .calc-cards-grid {
    grid-template-columns: 1fr;
  }

  .calc-card__header {
    height: 80px;
    padding: var(--space-md);
  }

  .calc-card__icon {
    width: 46px;
    height: 46px;
    min-width: 46px;
  }

  .calc-card__icon svg {
    width: 22px;
    height: 22px;
  }

  .calc-card__title {
    font-size: 1rem;
  }

  .calc-card__content {
    padding: var(--space-md);
  }

  .calc-card__desc {
    font-size: 0.85rem;
  }

  .calc-card__example {
    font-size: 0.8rem;
    padding: 0.4rem 0.7rem;
  }
}

/* Buttons */
.btn,
.btn-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1rem;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: 2px solid transparent;
  text-decoration: none;
  gap: var(--space-sm);
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--gray-200);
}

.btn-success {
  background: var(--success);
  color: var(--white);
}

.btn-success:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Forms */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  margin-bottom: var(--space-sm);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input,
.form-select {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.form-input::placeholder {
  color: var(--text-muted);
}

/* Calculator Form */
.calculator-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-md);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-lg);
}

/* Results */
.results-container {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--success-light) 100%);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-top: var(--space-xl);
  border: 1px solid var(--primary-light);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-lg);
  text-align: center;
}

.result-item {
  background: var(--bg-card);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  /* Improved layout */
  align-items: center;
}

.result-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
}

.result-value {
  font-size: 1.875rem;
  font-weight: 800;
  color: var(--primary);
}

/* Footer */
.site-footer {
  background: var(--bg-card);
  padding: var(--space-2xl) 0;
  margin-top: var(--space-3xl);
}

.page-surface .site-footer {
  background: transparent;
  margin-top: var(--space-3xl);
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

.footer-bottom {
  text-align: center;
  color: var(--text-muted);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.6s ease forwards;
}


/* Tabs Navigation */
.tabs-navigation {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 73px;
  /* Height of header approx */
  z-index: 190;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.tab-btn {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  text-decoration: none;
  display: inline-block;
}

a.tab-btn {
  border: none;
}

.tab-btn:hover {
  color: var(--primary);
  background: rgba(0, 102, 255, 0.08);
}

.tab-btn.active {
  color: var(--primary);
  background: var(--primary-light);
  box-shadow: none;
}

/* Form Label Icons (Visually Expressive Section) */
.label-with-icon {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.label-with-icon svg {
  color: var(--primary);
  width: 18px;
  height: 18px;
  stroke-width: 2.5px;
  opacity: 0.85;
}

.toggle-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toggle-header-left h3 {
  margin: 0 !important;
}

.toggle-header-left svg {
  color: var(--primary);
  width: 20px;
  height: 20px;
  stroke-width: 2.5px;
  opacity: 0.85;
}

/* Base Form Elements */
/* Tab Content */
.tab-content {
  display: none !important;
  padding: var(--space-2xl) 0;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block !important;
}

/* =========================================
   Article Specific Styles (Standardized)
   ========================================= */

.article-container {
  max-width: 960px;
  margin: var(--space-2xl) auto;
  padding: 0 var(--space-lg) var(--space-3xl);
}

.page-surface--article .article-container {
  max-width: 980px;
  padding: 0 var(--space-lg) var(--space-3xl);
}

.article-content {
  line-height: 1.8;
  font-size: 1.05rem;
  color: var(--gray-700);
}

.article-content h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 3rem 0 1rem 0;
  color: var(--primary);
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 0.5rem;
}

.article-content h3 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 2rem 0 1rem 0;
  color: var(--text-primary);
}

/* Article Components */
.example-box {
  background: var(--primary-light);
  border: 1px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 2rem 0;
}

.example-title {
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.info-box {
  background: var(--success-light);
  border: 1px solid var(--success);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 2rem 0;
}

.info-title {
  font-weight: 600;
  color: var(--success);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin: 2rem 0;
  box-shadow: var(--shadow-sm);
}

.chart-title {
  font-weight: 600;
  text-align: center;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

/* Automation Flow / Steps */
.automation-flow {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin: 2rem 0;
}

@media (min-width: 768px) {
  .automation-flow {
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
  }
}

.automation-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
}

.step-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  background: var(--white);
}

.step-icon svg {
  width: 32px;
  height: 32px;
}

.step-blue {
  background: var(--primary-light);
  border: 2px solid var(--primary);
  color: var(--primary);
}

.step-green {
  background: var(--success-light);
  border: 2px solid var(--success);
  color: var(--success);
}

.step-yellow {
  background: #fffbeb;
  border: 2px solid #f59e0b;
  color: #f59e0b;
}

.step-arrow {
  color: var(--gray-400);
  display: none;
}

@media(min-width: 768px) {
  .step-arrow {
    display: block;
  }
}

.step-label {
  font-weight: 600;
  color: var(--text-primary);
}

.step-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Goal Cards */
.goals-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin: 2rem 0;
}

@media (min-width: 768px) {
  .goals-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.goal-card {
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: var(--shadow-md);
  background: var(--white);
  border: 1px solid var(--border);
  transition: transform 0.2s ease;
}

.goal-card:hover {
  transform: translateY(-4px);
}

.goal-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--white);
}

.goal-icon svg {
  width: 32px;
  height: 32px;
}

.goal-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.goal-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.blue-card {
  border-top: 4px solid var(--primary);
}

.blue-card .goal-icon {
  background: var(--primary-light);
  color: var(--primary);
}

.green-card {
  border-top: 4px solid var(--success);
}

.green-card .goal-icon {
  background: var(--success-light);
  color: var(--success);
}

.yellow-card {
  border-top: 4px solid #f59e0b;
}

.yellow-card .goal-icon {
  background: #fffbeb;
  color: #f59e0b;
}

/* Comparison Table */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--white);
}

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

.comparison-table th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--text-primary);
}

/* CTA Section */
.cta-section {
  background: linear-gradient(135deg, var(--primary) 0%, var(--success) 100%);
  color: white;
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  text-align: center;
  margin: 3rem 0;
  box-shadow: var(--shadow-lg);
}

.cta-section h3 {
  color: white;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.btn-cta {
  background: white;
  color: var(--primary);
  padding: 0.75rem 2rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 600;
  display: inline-block;
  margin-top: 1rem;
  transition: var(--transition-base);
}

.btn-cta:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Article Nav */
.article-nav {
  display: flex;
  justify-content: space-between;
  margin: 3rem 0;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}

.nav-btn {
  background: var(--gray-100);
  color: var(--text-primary);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition-base);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-btn:hover {
  background: var(--primary);
  color: white;
}

/* Language Dropdown */
.lang-dropdown {
  position: relative;
  display: inline-block;
  margin-left: auto;
  z-index: 1001;
}

.lang-dropdown-btn {
  background-color: var(--gray-100);
  color: var(--text-primary);
  padding: var(--space-sm) var(--space-md);
  font-size: 1rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.lang-dropdown-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.lang-dropdown-btn:hover,
.lang-dropdown-btn:focus {
  background-color: var(--gray-200);
  border-color: var(--primary);
}

.lang-dropdown-content {
  display: none;
  position: absolute;
  background-color: var(--bg-card);
  min-width: 140px;
  /* Ensure wide enough */
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  /* Boost z-index above everything */
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
  right: 0;
  top: 100%;
  margin-top: 0.5rem;
}

/* Open on hover OR focus (for mobile tap) */
.lang-dropdown:hover .lang-dropdown-content,
.lang-dropdown:focus-within .lang-dropdown-content,
.lang-dropdown.active .lang-dropdown-content {
  display: block;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lang-dropdown-content a {
  color: var(--text-primary);
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  transition: all var(--transition-fast);
}

.lang-dropdown-content a:hover {
  background-color: var(--gray-100);
  color: var(--primary);
}

/* News Section */
.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  min-height: 350px;
  /* Fix for "no body" look */
}

.news-card:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-2px);
}

.news-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: var(--radius-md);
  background: var(--gray-100);
}

.news-card-image.no-image {
  display: none;
}

/* News card without image */
.news-card.no-image {
  padding: var(--space-xl);
}

.news-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;

  overflow: hidden;
}

.news-card-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;

  overflow: hidden;
}

.news-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.news-card-source {
  font-weight: 600;
  color: var(--primary);
}

.news-card-date {
  font-style: italic;
}

.news-card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  margin-top: var(--space-sm);
}

.news-card-link:hover {
  text-decoration: underline;
}

.news-card-link svg {
  width: 16px;
  height: 16px;
}

/* Compact news section styling */
#news-compact-grid .news-card {
  min-height: auto;
}

#news-compact-grid .news-card-description {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;

  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mobile Optimization */
@media (max-width: 768px) {

  /* Typography adjustments for mobile */
  :root {
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 0.75rem;
    --space-lg: 1rem;
    --space-xl: 1.5rem;
    --space-2xl: 2rem;
    --space-3xl: 2.5rem;
  }

  /* Container adjustments */
  .container {
    padding: 0 var(--space-md);
  }

  body::before {
    top: 110px;
    width: calc(100% - 1rem);
    border-radius: var(--radius-lg);
  }

  .page-surface {
    margin: var(--space-lg) var(--space-sm);
    border-radius: var(--radius-lg);
    padding-bottom: var(--space-xl);
  }

  .page-surface .tabs-navigation {
    margin: 0 var(--space-sm) var(--space-lg);
  }

  /* Header mobile optimization */
  .site-header {
    padding: 0 var(--space-md);
    position: sticky;
    top: 0;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    z-index: 2000;
  }

  .header-content {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-sm);
    position: relative;
  }

  .logo {
    flex-shrink: 0;
  }

  .logo span {
    display: none;
    /* Hide text on mobile */
  }

  .mobile-header-title {
    display: block;
    flex: 1;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    white-space: nowrap;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 var(--space-sm);
  }

  /* Navigation mobile - compact horizontal */
  .nav-menu {
    display: none;
    /* Hide nav-menu on mobile, it's empty now */
  }

  /* Mobile Tabs */
  .tabs-navigation {
    gap: 0.25rem;
    padding: 0.5rem 0;
    flex-wrap: wrap;
    margin-left: var(--space-sm);
    margin-right: var(--space-sm);
  }

  .tab-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }

  .news-card {
    min-height: auto;
  }

  .article-container {
    padding: 0 var(--space-md) var(--space-2xl);
    margin: var(--space-xl) auto;
  }
}

/* Refresh Button */
.btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-refresh:hover {
  background: var(--gray-50);
  color: var(--primary);
  border-color: var(--primary);
}

.btn-refresh:active {
  transform: scale(0.95);
}

.btn-refresh svg {
  transition: transform 0.3s ease;
}

.btn-refresh:hover svg {
  transform: rotate(180deg);
}

.btn-refresh.loading svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* ═══════════════════════════════════════════════════════════════
   APP LAYOUT - Main Application Structure (profinansy.ru inspired)
   ═══════════════════════════════════════════════════════════════ */

.page-surface--app {
  padding-bottom: 0;
  overflow: visible;
}

.app-layout {
  display: flex;
  min-height: calc(100vh - 60px);
}

/* Sidebar Navigation */
.app-sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  transition: all 0.3s ease;
  z-index: 100;
}

.app-sidebar.collapsed {
  width: 60px;
  min-width: 60px;
}

.app-sidebar.collapsed .sidebar-link span,
.app-sidebar.collapsed .sidebar-title {
  display: none;
}

/* Sidebar Calculator Description */
.sidebar-desc {
  margin: var(--space-md);
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: opacity 0.25s ease;
}

.app-sidebar.collapsed .sidebar-desc {
  display: none;
}

.sidebar-desc__text {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0;
}

.sidebar-desc__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  margin-top: 2px;
}

.sidebar-desc__link:hover {
  text-decoration: underline;
}

.sidebar-header {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-title {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-toggle {
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.sidebar-toggle:hover {
  background: var(--gray-100);
  color: var(--text-primary);
}

.sidebar-toggle svg {
  width: 18px;
  height: 18px;
}

.app-sidebar.collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

.sidebar-nav {
  flex: 0;
  padding: var(--space-md);
  padding-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s;
  background: var(--bg-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.sidebar-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-link:hover {
  background: var(--gray-100);
  color: var(--text-primary);
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.sidebar-link.active {
  background: linear-gradient(135deg, rgba(0, 102, 255, 0.1) 0%, rgba(0, 168, 107, 0.1) 100%);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-link.active svg {
  stroke: var(--primary);
}


/* Main Content Area */
.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Calculator Hero Section */
.calc-hero {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: var(--space-md);
  padding: var(--space-lg);
  background: linear-gradient(135deg, rgba(0, 102, 255, 0.02) 0%, rgba(0, 168, 107, 0.02) 100%);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin: var(--space-md);
  align-items: start;
}

.calc-hero__form {
  order: 1;
}

.calc-hero__results {
  order: 2;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Заголовок калькулятора — полная ширина над обеими колонками */
.calc-hero__title-row {
  grid-column: 1 / -1;
  order: 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.calc-hero__title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text-primary);
}

.calc-hero__badges {
  display: flex;
  gap: 0.5rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge--live {
  background: rgba(0, 168, 107, 0.1);
  color: var(--success);
}

.badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

/* Result Cards */
.result-card--primary {
  display: none !important;
}

.result-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
}

.result-card {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.result-card--primary {
  background: linear-gradient(135deg, var(--primary) 0%, #0052cc 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}

.result-card--primary .result-card__label {
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.9;
}

.result-card--primary .result-card__value {
  color: white;
  font-size: 1.8rem;
  font-weight: 800;
  font-family: var(--font-sans);
}

.result-card--primary .result-card__icon {
  background: rgba(255, 255, 255, 0.2);
}

.result-card--primary .result-card__icon svg {
  stroke: white;
}

.result-card__icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--gray-100);
}

.result-card__icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-muted);
}

.result-card__icon--blue {
  background: rgba(0, 102, 255, 0.1);
}

.result-card__icon--blue svg {
  stroke: var(--primary);
}

.result-card__icon--green {
  background: rgba(0, 168, 107, 0.1);
}

.result-card__icon--green svg {
  stroke: var(--success);
}

.result-card__content {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.result-card__label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.25;
}

.result-card__value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  font-family: var(--font-mono);
  letter-spacing: -0.03em;
}

.result-card__value--success {
  color: var(--success);
}

/* Chart Section */
.chart-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.chart-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.chart-header h3::after {
  display: none;
}

.chart-legend {
  display: flex;
  gap: var(--space-lg);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-dot--invested {
  background: rgba(107, 114, 128, 0.5);
}

.legend-dot--interest {
  background: rgba(0, 168, 107, 0.8);
}

.chart-container {
  height: 280px;
  position: relative;
}

/* Form Card */
.calc-hero__form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
}

.form-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.form-card__header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.form-card__header h3::after {
  display: none;
}

.btn-reset {
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.btn-reset:hover {
  background: var(--gray-100);
  color: var(--primary);
}

.btn-reset svg {
  width: 18px;
  height: 18px;
}

.form-group {
  margin-bottom: var(--space-lg);
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}


.input-with-currency,
.input-with-suffix {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-currency input,
.input-with-suffix input {
  width: 100%;
  padding: 0.75rem 1rem;
  padding-right: 2.5rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  font-weight: 600;
  font-family: var(--font-mono);
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: all 0.2s;
}

.input-with-currency input:focus,
.input-with-suffix input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon input,
.input-with-icon select {
  width: 100%;
  padding: 0.75rem 1rem;
  padding-left: 2.5rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 500;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: all 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.input-with-icon select {
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px;
}

.input-with-icon input:focus,
.input-with-icon select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.input-icon {
  position: absolute;
  left: 0.85rem;
  color: var(--primary);
  width: 18px;
  height: 18px;
  stroke-width: 2.5px;
  opacity: 0.85;
  pointer-events: none;
}

.currency-symbol,
.input-suffix {
  position: absolute;
  right: 1rem;
  color: var(--text-muted);
  font-weight: 600;
  pointer-events: none;
}

.form-group input[type="range"] {
  width: 100%;
  height: 6px;
  margin-top: 0.75rem;
  -webkit-appearance: none;
  appearance: none;
  background: var(--gray-200);
  border-radius: 3px;
  cursor: pointer;
}

.form-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 102, 255, 0.3);
  transition: all 0.2s;
}

.form-group input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.form-group input[type="number"],
.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 500;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: all 0.2s;
}

.form-group input[type="number"]:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.form-group .input-with-icon input,
.form-group .input-with-icon select {
  padding-left: 2.5rem;
}

.form-group .input-with-icon select {
  padding-right: 2rem;
}

.form-actions {
  margin-top: var(--space-lg);
}

.btn-full {
  width: 100%;
  justify-content: center;
}



/* Compact tabs navigation */
.tabs-navigation--compact {
  margin: 0;
  padding: var(--space-md) var(--space-xl);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  justify-content: flex-start;
  gap: 0.5rem;
  position: static;
  top: auto;
  z-index: auto;
  box-shadow: none;
  border-radius: 0;
}

.tabs-navigation--compact .tab-btn {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

/* Mobile Responsive for App Layout */
@media (max-width: 1200px) {
  .calc-hero {
    grid-template-columns: 1fr;
  }

  /* Mobile Order: Title hidden (in header) -> Form (1) -> Results (2) */
  .calc-hero__title-row {
    display: none !important;
  }

  .calc-hero__form {
    order: 1;
  }

  .calc-hero__results {
    display: contents;
    order: 2;
  }

  .result-cards,
  .chart-section {
    order: 3;
    width: 100%;
  }

  .result-cards {
    grid-template-columns: 1fr;
    margin-top: var(--space-lg);
  }
}

@media (max-width: 900px) {
  .app-sidebar {
    position: fixed;
    left: -260px;
    top: 60px;
    height: calc(100vh - 60px);
    z-index: 1000;
    box-shadow: var(--shadow-xl);
  }

  .app-sidebar.open {
    left: 0;
  }

  .app-layout {
    flex-direction: column;
  }

  .calc-hero {
    padding: var(--space-lg);
  }

  .calc-hero__title {
    font-size: 1.5rem;
  }

  .result-card__value {
    font-size: 1.5rem;
  }

  .form-row-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .calc-hero {
    padding: var(--space-md);
  }

  .form-card {
    padding: var(--space-lg);
  }

  .chart-container {
    height: 200px;
  }
}

/* ===========================================
   COOKIE CONSENT BANNER
   =========================================== */

.cookie-consent-banner {
  display: none;
  /* Hidden by default, shown by JS */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  padding: 1.5rem 0;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12);
  z-index: 2000;
  border-top: 3px solid #ff9500;
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-consent-banner .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  max-width: 1000px;
}

.cookie-consent-banner p {
  margin: 0;
  font-weight: 500;
  font-size: 1.05rem;
  color: var(--gray-800);
  line-height: 1.5;
}

.cookie-actions {
  display: flex;
  gap: 1rem;
  flex-shrink: 0;
}

.cookie-actions .btn {
  padding: 0.6rem 1.5rem;
  font-weight: 600;
  border-radius: var(--radius-lg);
  transition: all 0.2s ease;
}

.cookie-actions .btn-primary {
  background: linear-gradient(135deg, var(--success) 0%, #009960 100%);
  border: none;
  box-shadow: 0 4px 12px rgba(0, 168, 107, 0.25);
}

.cookie-actions .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 168, 107, 0.35);
}

.cookie-actions .btn-secondary {
  background: transparent;
  border: 2px solid var(--gray-300);
  color: var(--text-secondary);
}

.cookie-actions .btn-secondary:hover {
  border-color: var(--gray-400);
  background: var(--gray-50);
  color: var(--text-primary);
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .cookie-consent-banner .container {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }

  .cookie-actions {
    width: 100%;
    justify-content: center;
  }

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

/* ===========================================
   UTILITIES
   =========================================== */

/* Hamburger Button */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  border-radius: var(--radius-md);
  transition: background 0.2s;
}

.mobile-menu-toggle:hover {
  background: var(--gray-100);
}

.hamburger-line {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.25s ease;
}

/* Hamburger animation when open */
.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Sidebar Close Button (mobile) */
.sidebar-close {
  display: none;
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.sidebar-close:hover {
  background: var(--gray-100);
  color: var(--danger);
}

.sidebar-close svg {
  width: 20px;
  height: 20px;
}

/* Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* Hide extra sidebar links on desktop */
@media (min-width: 901px) {

  .sidebar-link[data-tab],
  .sidebar-divider {
    display: none;
  }
}

@media (max-width: 900px) {
  .mobile-menu-toggle {
    display: flex;
    order: -1;
  }

  .sidebar-close {
    display: block;
  }

  .sidebar-toggle {
    display: none;
  }

  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    height: 100dvh;
    /* Use dynamic viewport height for mobile browsers */
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: 1001;
    box-shadow: var(--shadow-xl);
    border-right: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Fix the container, scroll only the nav */
    background-color: var(--bg-card);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-header {
    padding: var(--space-lg);
    background: linear-gradient(135deg, var(--primary) 0%, var(--success) 100%);
    flex-shrink: 0;
    /* Do not shrink */
    position: relative;
    z-index: 5;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  }

  .sidebar-header .sidebar-title {
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
  }

  .sidebar-close {
    color: white;
  }

  .sidebar-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
  }

  .sidebar-nav {
    padding: var(--space-md);
    gap: var(--space-xs);
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    /* Grow and shrink */
    min-height: 0;
    /* Crucial for flex child scrolling */
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 120px;
    /* Extra padding to reach bottom items */
  }

  .sidebar-divider {
    height: 1px;
    background-color: var(--gray-200);
    margin: 0.5rem 1rem;
    flex-shrink: 0;
  }

  .sidebar-link {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    flex-shrink: 0;
  }

  .sidebar-link svg {
    width: 22px;
    height: 22px;
  }

  .sidebar-link--premium {
    background: linear-gradient(135deg, #FFB700 0%, #FF8C00 100%);
    color: #1a1a1a !important;
    /* Force dark text for contrast on gold */
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(255, 136, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 0.5rem;
    /* Increased margin */
    padding: 0.75rem 1rem;
    line-height: 1.2;
    flex-shrink: 0;
  }

  .sidebar-link--premium:hover {
    background: linear-gradient(135deg, #FFC700 0%, #FF9500 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(255, 136, 0, 0.3);
  }

  .sidebar-link--premium svg {
    stroke-width: 2.5;
  }

}

/* ===========================================
   CALCULATOR CONTAINER & SWITCHING
   =========================================== */

.calculators-container {
  position: relative;
}

.calc-hero {
  display: none;
}

.calc-hero.active {
  display: grid;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===========================================
   CALCULATOR COLOR THEMES
   =========================================== */

/* Deposit - Blue/Green (primary) */
.calc-hero--deposit {
  background: linear-gradient(135deg, rgba(0, 102, 255, 0.04) 0%, rgba(0, 168, 107, 0.04) 100%);
}

.calc-hero--deposit .result-card--primary,
body[data-page="deposit"] .result-card--primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--success) 100%);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--success) 100%);
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, #008a57 100%);
  color: white;
}

/* Loan - Orange */
.calc-hero--loan {
  background: linear-gradient(135deg, rgba(255, 149, 0, 0.05) 0%, rgba(255, 107, 0, 0.05) 100%);
  --calc-accent: #ff9500;
  --calc-accent-dark: #e68600;
  --calc-accent-light: rgba(255, 149, 0, 0.1);
}

.calc-hero--loan .result-card--primary,
body[data-page="loan"] .result-card--primary {
  background: linear-gradient(135deg, #ff9500 0%, #ff6b00 100%);
}

.calc-hero--loan .result-card__icon--orange {
  background: rgba(255, 149, 0, 0.1);
  color: #ff9500;
}

.calc-hero--loan .badge--live {
  background: rgba(255, 149, 0, 0.1);
  color: #ff9500;
}

.calc-hero--loan .badge__dot {
  background: #ff9500;
}

.calc-hero--loan .sidebar-link.active {
  background: rgba(255, 149, 0, 0.1);
  color: #ff9500;
}

.btn-loan {
  background: linear-gradient(135deg, #ff9500 0%, #ff6b00 100%);
  color: white;
}

.btn-loan:hover {
  filter: brightness(1.1);
}

.legend-dot--principal {
  background: #0066ff;
}

.legend-dot--interest-loan {
  background: #ff9500;
}

/* Loan chart legend */
.legend-dot--principal-orange {
  background: rgba(255, 152, 0, 0.9);
}

.legend-dot--interest-red {
  background: rgba(244, 67, 54, 0.8);
}

/* Mortgage chart legend */
.legend-dot--principal-purple {
  background: rgba(138, 43, 226, 0.9);
}

.legend-dot--interest-pink {
  background: rgba(255, 105, 180, 0.8);
}

/* Savings - Teal */
.calc-hero--savings {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.05) 0%, rgba(6, 182, 212, 0.05) 100%);
  --calc-accent: #14b8a6;
  --calc-accent-dark: #0d9488;
  --calc-accent-light: rgba(20, 184, 166, 0.1);
}

.calc-hero--savings .result-card--primary,
body[data-page="savings"] .result-card--primary {
  background: linear-gradient(135deg, #14b8a6 0%, #06b6d4 100%);
}

.calc-hero--savings .result-card__icon--teal {
  background: rgba(20, 184, 166, 0.1);
  color: #14b8a6;
}

.calc-hero--savings .badge--live {
  background: rgba(20, 184, 166, 0.1);
  color: #14b8a6;
}

.calc-hero--savings .badge__dot {
  background: #14b8a6;
}

.btn-savings {
  background: linear-gradient(135deg, #14b8a6 0%, #06b6d4 100%);
  color: white;
}

.btn-savings:hover {
  filter: brightness(1.1);
}

.legend-dot--savings {
  background: #14b8a6;
}

/* Mortgage - Purple */
.calc-hero--mortgage {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(168, 85, 247, 0.05) 100%);
  --calc-accent: #8b5cf6;
  --calc-accent-dark: #7c3aed;
  --calc-accent-light: rgba(139, 92, 246, 0.1);
}

.calc-hero--mortgage .result-card--primary,
body[data-page="mortgage"] .result-card--primary {
  background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
}

.calc-hero--mortgage .result-card__icon--purple {
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
}

.calc-hero--mortgage .badge--live {
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
}

.calc-hero--mortgage .badge__dot {
  background: #8b5cf6;
}

.btn-mortgage {
  background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
  color: white;
}

.btn-mortgage:hover {
  filter: brightness(1.1);
}

/* Credit Card - Pink/Rose */
.calc-hero--creditcard {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.05) 0%, rgba(251, 113, 133, 0.05) 100%);
  --calc-accent: #ec4899;
  --calc-accent-dark: #db2777;
  --calc-accent-light: rgba(236, 72, 153, 0.1);
}

.calc-hero--creditcard .result-card--primary,
body[data-page="creditcard"] .result-card--primary {
  background: linear-gradient(135deg, #ec4899 0%, #fb7185 100%);
}

.calc-hero--creditcard .result-card__icon--pink {
  background: rgba(236, 72, 153, 0.1);
  color: #ec4899;
}

.calc-hero--creditcard .badge--live {
  background: rgba(236, 72, 153, 0.1);
  color: #ec4899;
}

.calc-hero--creditcard .badge__dot {
  background: #ec4899;
}

.btn-creditcard {
  background: linear-gradient(135deg, #ec4899 0%, #fb7185 100%);
  color: white;
}

.btn-creditcard:hover {
  filter: brightness(1.1);
}

.legend-dot--balance {
  background: #ec4899;
}

/* ROI - Emerald */
.calc-hero--roi {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(52, 211, 153, 0.05) 100%);
  --calc-accent: #10b981;
  --calc-accent-dark: #059669;
  --calc-accent-light: rgba(16, 185, 129, 0.1);
}

.calc-hero--roi .result-card--primary,
body[data-page="roi"] .result-card--primary {
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
}

.calc-hero--roi .result-card__icon--emerald {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.calc-hero--roi .badge--live {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.calc-hero--roi .badge__dot {
  background: #10b981;
}

.btn-roi {
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  color: white;
}

.btn-roi:hover {
  filter: brightness(1.1);
}

.legend-dot--profit {
  background: #10b981;
}

/* Additional Result Icons */
.result-card__icon--red {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.result-card__value--danger {
  color: #ef4444;
}

/* ===========================================
   SIDEBAR ACTIVE STATES PER CALCULATOR
   =========================================== */

[data-active-calc="loan"] .sidebar-link[data-calc="loan"] {
  background: rgba(255, 149, 0, 0.1);
  color: #ff9500;
}

[data-active-calc="savings"] .sidebar-link[data-calc="savings"] {
  background: rgba(20, 184, 166, 0.1);
  color: #14b8a6;
}

[data-active-calc="mortgage"] .sidebar-link[data-calc="mortgage"] {
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
}

[data-active-calc="creditcard"] .sidebar-link[data-calc="creditcard"] {
  background: rgba(236, 72, 153, 0.1);
  color: #ec4899;
}

[data-active-calc="roi"] .sidebar-link[data-calc="roi"] {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

/* ===========================================
   FULL CALCULATOR PAGE STYLES
   =========================================== */

/* Breakdown Section */
.breakdown-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  margin-top: var(--space-xl);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.section-header h2 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text-primary);
}

.view-toggle {
  display: flex;
  gap: 0.25rem;
  background: var(--gray-100);
  padding: 4px;
  border-radius: var(--radius-md);
}

.view-btn {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.view-btn.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

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

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.breakdown-table th,
.breakdown-table td {
  padding: 0.75rem 1rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
}

.breakdown-table th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.breakdown-table th:first-child,
.breakdown-table td:first-child {
  text-align: left;
}

.breakdown-table tbody tr:hover {
  background: var(--gray-50);
}

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

/* Collapsible Form Card */
.form-card--collapsible {
  padding: 0;
}

.form-card__toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}

.form-card__toggle h3 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.form-card__toggle svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.form-card__toggle.open svg {
  transform: rotate(180deg);
}

.form-card__content {
  padding: 0 var(--space-lg) var(--space-lg);
}

/* Checkbox Label */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* Back Button */
.btn-secondary {
  background: var(--gray-100);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--gray-200);
}

.mt-md {
  margin-top: var(--space-md);
}

.mt-lg {
  margin-top: var(--space-lg);
}

/* Full page footer */
.app-main .site-footer {
  margin-top: var(--space-2xl);
  padding: var(--space-lg) 0;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

@media (max-width: 900px) {
  .breakdown-section {
    padding: var(--space-lg);
    margin: var(--space-lg) var(--space-sm) 0;
    border-radius: var(--radius-lg);
  }

  .breakdown-table th,
  .breakdown-table td {
    padding: 0.5rem;
    font-size: 0.8rem;
  }
}

/* Mobile Responsive Fix for Calculator Order */
@media (max-width: 1200px) {
  .calc-hero {
    grid-template-columns: 1fr;
  }

  /* Mobile Order: Title (1) -> Form (2) -> Results (3) */
  .calc-hero__results {
    display: contents;
  }

  .calc-hero__title-row {
    display: none !important;
  }

  .calc-hero__form {
    order: 2;
  }

  .result-cards,
  .chart-section {
    order: 3;
    width: 100%;
  }

  .result-cards {
    grid-template-columns: 1fr;
    margin-top: var(--space-lg);
  }
}

/* Mobile Safety Fixes (Prevent Overflow) */
@media (max-width: 600px) {

  html,
  body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
    margin: 0;
    padding: 0;
  }

  /* Force boxes to fit - ALL Calculator Types */
  .calculator-form,
  .results-container,
  .calc-hero,
  .full-calc-page,
  .calc-grid,
  .results-panel,
  .chart-section,
  .result-card,
  .form-card {
    padding-left: var(--space-md) !important;
    padding-right: var(--space-md) !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box;
    overflow-x: hidden;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

/* Reordering for Full Calculators on Mobile */
@media (max-width: 1024px) {
  .full-calc-page {
    display: flex;
    flex-direction: column;
  }

  .calc-grid,
  .results-panel,
  .form-panel {
    display: contents;
  }

  /* Default Order for panel children to prevent jumping to top */
  .results-panel>*,
  .form-panel>* {
    order: 10;
  }

  /* 1. HEADER (Title) - Ensure it's always first */
  .full-calc-header {
    order: -1;
    width: 100%;
    margin-bottom: var(--space-md);
  }

  /* 2. MAIN INPUTS (First form card) */
  .form-panel>.form-card:first-child {
    order: 2;
  }

  /* 3. EXTRA INPUTS (Additions) - usually 2nd if present */
  .form-panel>.form-card:nth-child(2) {
    order: 3;
  }

  /* 4. RESULTS (Summary Cards) */
  .results-panel>.result-cards {
    order: 4;
    margin-top: var(--space-lg);
  }

  /* 5. SETTINGS (Tax) - usually 3rd if present */
  .form-panel>.form-card:nth-child(3) {
    order: 5;
  }

  /* 6. BREAKDOWN & COMPARISON */
  .breakdown-section,
  .comparison-box {
    order: 6;
  }

  /* 7. CHART */
  .results-panel>.chart-section {
    order: 7;
  }

  /* 8. PRESETS (Bottom) */

  /* Fix Detailed Breakdown Layout */
  .breakdown-section {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    padding: var(--space-md) 0;
  }

  .table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--space-sm);
    display: block;
  }

  .breakdown-table {
    width: 100%;
    min-width: 600px;
    /* Force scroll on small screens */
  }

  /* Ensure footer is last */
  .app-main>.site-footer {
    order: 100;
  }
}

@media (max-width: 600px) {

  /* --- Compact Header for Mobile --- */

  /* 1. Hide Back Button */
  .back-link {
    display: none !important;
  }

  /* 2. Compact Containers */
  .full-calc-header {
    display: block !important;
    /* Stack for positioning */
    margin-bottom: var(--space-xs) !important;
    position: relative;
    padding-top: 10px;
    /* Space for the badge if needed */
  }

  /* 3. Inline Icon + Title */
  .full-calc-header h1 {
    display: flex !important;
    flex-wrap: nowrap !important;
    /* Force single line */
    align-items: center !important;
    font-size: 1.25rem !important;
    line-height: 1.2;
    width: 100%;
    margin: 0 !important;
    position: relative;
    /* Context for absolute badge */
  }

  /* Icon Sizing */
  .full-calc-header h1 svg,
  .calc-icon-mortgage,
  .calc-icon-loan {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    /* Prevent shrinking */
    margin-right: 8px !important;
    align-self: flex-start;
    /* Align with top of text if it wraps (though we try to prevent wrap) */
    margin-top: 2px;
  }

  /* 4. Absolute Badge (Top Right) */
  .full-calc-header h1 .badge {
    position: absolute !important;
    top: -12px !important;
    right: 0 !important;
    font-size: 0.65rem !important;
    padding: 2px 6px !important;
    margin: 0 !important;
    z-index: 2;
  }

  /* Remove spacing that pushes content */
  .calc-hero,
  .full-calc-page {
    margin: var(--space-md) 0 !important;
  }

  /* Compact Spacing for Mobile */
  .form-row,
  .calc-grid {
    grid-template-columns: 1fr !important;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm) !important;
    /* Compact gap */
  }

  /* Exception: Keep row layout for small grouped inputs (Term + Unit) */
  .form-row-2 {
    display: grid !important;
    grid-template-columns: 1fr 120px !important;
    /* Keep side-by-side */
    flex-direction: row !important;
    gap: 0.5rem !important;
  }

  /* --- Mortgage / Comparison Fixes --- */

  /* Stack comparison items vertically */
  .comparison-grid {
    grid-template-columns: 1fr !important;
    gap: var(--space-sm) !important;
  }

  .comparison-item {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }

  /* Wrap Preset Buttons */
  .preset-buttons {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    width: 100% !important;
  }

  .preset-btn {
    flex: 1 1 auto !important;
    /* Grow to fill */
    min-width: 120px !important;
    /* Minimum touch target width */
    max-width: 100% !important;
  }
}

/* Reduce form group spacing */
.form-group {
  margin-bottom: var(--space-sm) !important;
}

/* Universal Fit */
.form-input,
.form-select,
.btn,
.result-card,
.full-calc-header {
  max-width: 100%;
  box-sizing: border-box;
}

/* Result Cards in Loan Calc - grid layout */
.results-panel .result-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
  width: 100%;
}

@media (max-width: 640px) {
  .results-panel .result-cards {
    grid-template-columns: 1fr;
  }
}

/* Fix Chart Overflow & Header */
.chart-container {
  width: 100% !important;
  padding: 0.5rem !important;
  overflow: hidden;
  box-sizing: border-box;
}

.chart-header {
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 0.5rem !important;
}

.chart-legend {
  flex-wrap: wrap;
  gap: 0.5rem;
}

.legend-item {
  font-size: 0.8rem;
}

.chart-container canvas {
  max-width: 100% !important;
  height: auto !important;
}

/* Fix Presets Button Overflow */
.preset-buttons,
.full-calc-header {
  flex-wrap: wrap;
  width: 100%;
  box-sizing: border-box;
}

/* Fix header title size on mobile */
.full-calc-header h1,
.calc-hero__title {
  font-size: 1.25rem;
  flex-wrap: wrap;
}

/* Ensure container doesn't overflow */
.container,
.app-main {
  padding-left: var(--space-sm);
  padding-right: var(--space-sm);
  overflow-x: hidden;
  max-width: 100vw;
  box-sizing: border-box;
}

/* EXCEPTION: Header must allow overflow for dropdowns */
/* EXCEPTION: Header must allow overflow for dropdowns */
.site-header .container {
  overflow: visible !important;
  overflow-x: visible !important;
}

/* Offers / Compare Section Styles */
.filters-container {
  margin-bottom: var(--space-xl);
  padding: var(--space-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: inline-flex;
  gap: var(--space-xs);
  overflow-x: auto;
  max-width: 100%;
  box-shadow: var(--shadow-sm);
}

.filter-btn {
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  background: var(--gray-100);
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 4px rgba(0, 102, 255, 0.25);
}

.offer-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-lg);
}

.offer-card {
  display: flex;
  flex-direction: column;
  border-top: 4px solid transparent;
}

.offer-card:hover {
  border-top-color: var(--primary);
}

.offer-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.bank-name {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 600;
}

.offer-main-rate {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin: 0.5rem 0;
  letter-spacing: -1px;
}

.offer-rate-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.feature-list {
  margin: 1.5rem 0 auto 0;
  padding: 0;
  list-style: none;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.check-icon {
  width: 20px;
  height: 20px;
  color: var(--success);
  background: var(--success-light);
  border-radius: 50%;
  padding: 3px;
}

/* Engagement CTA Buttons - Premium Gold Style */
.btn-premium {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #FDB931 0%, #F59E0B 100%);
  color: #111827 !important;
  /* Force dark text for contrast on gold */
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 6px -1px rgba(245, 158, 11, 0.3), 0 2px 4px -1px rgba(245, 158, 11, 0.15);
  margin-top: var(--space-md);
}

.btn-premium:hover {
  background: linear-gradient(135deg, #FDB931 0%, #EA580C 100%);
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(245, 158, 11, 0.4), 0 4px 6px -2px rgba(245, 158, 11, 0.2);
  color: #000 !important;
}

.btn-premium:active {
  transform: translateY(0);
}

.btn-premium svg {
  stroke-width: 2.5;
  width: 20px;
  height: 20px;
}

/* Shine effect */
.btn-premium::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transition: 0.5s;
}

.btn-premium:hover::after {
  left: 100%;
}

.cta-button {
  margin-top: 1.5rem;
  display: block;
  width: 100%;
  text-align: center;
  background: var(--primary);
  color: white;
  padding: 1rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s;
  box-shadow: 0 4px 6px rgba(0, 102, 255, 0.2);
}

.cta-button:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 102, 255, 0.3);
  text-decoration: none;
  color: white;
}

/* Compare Page - Product Comparison Layout */
.compare-container {
  padding-bottom: 4rem;
}

.compare-header {
  text-align: center;
  margin-bottom: 3rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.compare-filters {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: 50px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  background: var(--gray-100);
  color: var(--primary);
  border-color: var(--primary);
}

.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.2);
}

.compare-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 1000px;
  margin: 0 auto;
}

/* Offer Card Redesign */
.offer-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.offer-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}

.offer-card.highlighted {
  border: 2px solid #f59e0b;
  /* Amber-500 */
  background: linear-gradient(to right, rgba(245, 158, 11, 0.02), transparent);
}

/* Highlight Badge */
.offer-badge-highlight {
  position: absolute;
  top: -12px;
  left: 20px;
  background: #f59e0b;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  box-shadow: 0 4px 6px rgba(245, 158, 11, 0.2);
  z-index: 2;
}

/* Main Row: Brand + Metrics + Action */
.offer-main-row {
  display: grid;
  grid-template-columns: 240px 1fr 160px;
  gap: 2rem;
  align-items: center;
}

/* Brand Section */
.offer-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.offer-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 8px;
}

.offer-logo-placeholder {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
  color: #1E40AF;
  font-weight: 700;
  font-size: 0.75rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px;
  line-height: 1.1;
  border: 1px solid #BFDBFE;
}


.offer-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.offer-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
  line-height: 1.3;
}

.tag-default {
  display: inline-block;
  background: var(--gray-100);
  color: var(--text-secondary);
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  width: fit-content;
}

/* Metrics Grid */
.offer-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  padding: 0 1rem;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.offer-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.offer-metric.primary .metric-value {
  color: var(--primary);
  font-size: 1.8rem;
}

.metric-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.metric-value small {
  font-size: 0.6em;
  font-weight: 600;
  margin-left: 2px;
}

.metric-value.small {
  font-size: 1.1rem;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* Action Section */
.offer-actions {
  display: flex;
  justify-content: flex-end;
}

.offer-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  width: 100%;
  text-align: center;
}

.offer-cta:hover {
  background: var(--primary-dark);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Details Row */
.offer-details-row {
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.feature-list.horizontal {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
}

.check-icon {
  width: 16px;
  height: 16px;
  stroke: var(--success);
}

.offer-disclaimer {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  max-width: 300px;
  text-align: right;
  line-height: 1.3;
}

/* Responsive */
@media (max-width: 900px) {
  .offer-main-row {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    text-align: center;
  }

  .offer-brand {
    flex-direction: column;
    text-align: center;
  }

  .offer-metrics-grid {
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 0;
  }

  .offer-details-row {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .feature-list.horizontal {
    justify-content: center;
  }

  .offer-disclaimer {
    text-align: center;
    max-width: 100%;
  }

  .offer-badge-highlight {
    left: 50%;
    transform: translateX(-50%);
  }
}

@media (max-width: 768px) {
  .compare-title {
    font-size: 2rem;
  }

  .compare-filters {
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 0.5rem;
  }

  .filter-btn {
    white-space: nowrap;
  }
}


/* Fix for measurement overflow in comparison cards */
.offer-metric .metric-label {
  white-space: normal !important;
  text-align: left !important;
  line-height: 1.2 !important;
  overflow-wrap: break-word !important;
  min-height: 2.4em;
  display: block;
}

.offer-metric .metric-value {
  white-space: normal !important;
  overflow-wrap: break-word !important;
  text-align: left !important;
}

.offer-metric .metric-value small {
  white-space: nowrap;
}

.offer-card {
  height: auto !important;
  align-items: flex-start;
}

.offer-brand h3 {
  white-space: normal !important;
  overflow-wrap: break-word !important;
  word-break: normal !important;
  text-align: center;
}

@media (max-width: 900px) {
  .offer-brand h3 {
    max-width: 100%;
  }
}

/* ===========================================
   MOBILE STICKY RESULT BAR
   Удалён — заменён на form-mini-result внутри формы
   =========================================== */

.mobile-sticky-bar {
  display: none !important;
}

@media (max-width: 900px) {

  /* Отступ снизу больше не нужен (sticky bar убран) */
  /* .app-main { padding-bottom: 76px; } */

  /* ---- Сам бар ---- */
  .mobile-sticky-bar {
    display: none !important;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);

    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 800;

    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 10px 16px 10px 16px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.10);
    min-height: 64px;

    /* Плавное появление */
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
      opacity 0.3s ease;
  }

  .mobile-sticky-bar.visible {
    transform: translateY(0);
    opacity: 1;
  }

  .mobile-sticky-bar.hidden {
    transform: translateY(100%);
    opacity: 0;
  }

  .mobile-sticky-bar__main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
  }

  .mobile-sticky-bar__texts {
    display: flex;
    align-items: baseline;
    gap: var(--space-sm);
    flex-wrap: wrap;
  }

  .mobile-sticky-bar__label {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
  }

  .mobile-sticky-bar__value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.03em;
    line-height: 1;
  }

  .mobile-sticky-bar__secondary {
    font-size: 0.8rem;
    color: var(--success);
    font-weight: 600;
  }

  .mobile-sticky-bar__btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;

    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid rgba(0, 102, 255, 0.2);
    border-radius: var(--radius-lg);
    padding: 8px 14px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-fast),
      transform var(--transition-fast);
  }

  .mobile-sticky-bar__btn:active {
    transform: scale(0.95);
    background: rgba(0, 102, 255, 0.2);
  }

  /* ---- Слайд-ап панель ---- */
  body.modal-open {
    overflow: hidden !important;
    height: 100dvh !important;
    touch-action: none;
  }

  .mobile-results-panel {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 3000;
    overscroll-behavior: none;
    touch-action: none;
    /* Block touch gestures on the backdrop itself */
  }

  .mobile-results-panel.open {
    display: block;
  }

  .mobile-results-panel__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    animation: fadeInOverlay 0.25s ease;
  }

  @keyframes fadeInOverlay {
    from {
      opacity: 0;
    }

    to {
      opacity: 1;
    }
  }

  .mobile-results-panel__sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: 24px 24px 0 0 !important;
    overflow: hidden;
    max-height: 88vh;
    transform: translateZ(0);
    animation: slideUpSheet 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    overscroll-behavior: none;
    touch-action: pan-y;
    /* Allow vertical scrolling inside the sheet but no zoom/pan-x */
  }

  .mobile-results-panel__content {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    padding: 16px 20px max(24px, env(safe-area-inset-bottom)) 20px;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    min-height: 0;
  }

  @keyframes slideUpSheet {
    from {
      transform: translateY(100%);
    }

    to {
      transform: translateY(0);
    }
  }

  .mobile-results-panel__handle {
    width: 40px;
    height: 4px;
    background: var(--gray-300);
    border-radius: 2px;
    margin: 12px auto 0;
  }

  .mobile-results-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border);
  }

  .mobile-results-panel__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
  }

  .mobile-results-panel__close {
    background: var(--gray-100);
    border: none;
    border-radius: var(--radius-full);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
  }

  /* Правило слито с блоком выше (строка 4648) */

  /* Скрываем графики и полные результаты на главной странице для мобилок */
  .calc-hero__results>.result-cards,
  .calc-hero__results>.chart-section {
    display: none !important;
  }

  /* И показываем их внутри модального окна Details */
  #panel-content>.result-cards {
    display: flex !important;
    flex-direction: column;
    width: 100%;
    margin-top: 0;
  }

  #panel-content>.chart-section {
    display: block !important;
    width: 100%;
    margin-top: 0;
    overflow: visible;
  }

  #panel-content .chart-container {
    width: 100% !important;
    height: 240px;
    padding: 0 !important;
    margin-top: 0;
    overflow: hidden;
  }

  .panel-result-card__value--danger {
    color: var(--danger);
  }

  .panel-full-calc-btn {
    margin: 8px 20px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    padding: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition-fast);
  }

  .panel-full-calc-btn:hover {
    background: var(--primary-dark);
  }
}

@keyframes slideDownSheet {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(100%);
  }
}


/* ===========================================
   MOBILE CALC SWITCHER
   Горизонтальный скролл-список калькуляторов
   Видим только на мобиле (< 900px)
   =========================================== */

.mobile-calc-switcher {
  display: none;
}

@media (max-width: 900px) {
  .mobile-calc-switcher {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 12px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 60px;
    z-index: 700;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  /* Center items if they don't fill the container, but keep scrollable if they overflow */
  .mobile-calc-switcher::before,
  .mobile-calc-switcher::after {
    content: '';
    margin: auto;
  }

  .mobile-calc-switcher::-webkit-scrollbar {
    display: none;
  }

  .mcs-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
    padding: 8px 14px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.12s;
    -webkit-tap-highlight-color: transparent;
  }

  .mcs-btn:active {
    transform: scale(0.94);
  }

  .mcs-btn__icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
  }

  /* Активная кнопка — иконка белая */
  .mcs-btn.active .mcs-btn__icon {
    stroke: #fff;
  }

  .mcs-btn__label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
  }

  /* Активная кнопка */
  .mcs-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 102, 255, 0.30);
  }

  /* Чуть больше отступа для main чтобы switcher не перекрывал */
  .page-surface--app {
    padding-top: 0;
  }
}


/* ===========================================
   FORM MINI RESULT + RESET ROW
   Заменяет заголовок "Параметры" в форме
   =========================================== */

/* Мини-результат вверху form-card */
.form-mini-result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  padding: var(--space-lg);
  margin: calc(var(--space-lg) * -1) calc(var(--space-lg) * -1) var(--space-lg);
  background: linear-gradient(135deg, var(--primary) 0%, #0052cc 100%);
  border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0;
  color: #fff;
  gap: var(--space-xs);
  position: relative;
}

.form-mini-result__main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
}

.form-mini-result__label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.9;
  padding-right: 48px;
  /* Safe space from close/action buttons */
}

.form-mini-result__value {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  word-break: break-all;
  max-width: 100%;
}

.form-mini-result__secondary {
  display: none !important;
}

.form-mini-result__right {
  display: flex;
  gap: var(--space-xs);
  margin-top: var(--space-xs);
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #333;
  color: #fff;
  padding: 12px 24px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.95rem;
  z-index: 10000;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.form-mini-result__details,
.form-mini-result__share {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 20px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.form-mini-result__details:hover,
.form-mini-result__share:hover {
  background: rgba(255, 255, 255, 0.25);
}

.form-mini-result__details:active,
.form-mini-result__share:active {
  transform: translateY(1px);
}

.form-mini-result__details svg,
.form-mini-result__share svg {
  opacity: 0.9;
}

@media (min-width: 769px) {
  .form-mini-result__details {
    display: none !important;
  }
}


/* Разные цвета для разных калькуляторов */
.calc-hero--loan .form-mini-result,
body[data-page="loan"] .form-mini-result {
  background: linear-gradient(135deg, #e85d04 0%, #c0392b 100%);
}

.calc-hero--savings .form-mini-result,
body[data-page="savings"] .form-mini-result {
  background: linear-gradient(135deg, #00a86b 0%, #007a4d 100%);
}

.calc-hero--mortgage .form-mini-result,
body[data-page="mortgage"] .form-mini-result {
  background: linear-gradient(135deg, #6c3483 0%, #4a235a 100%);
}

.calc-hero--creditcard .form-mini-result,
body[data-page="creditcard"] .form-mini-result {
  background: linear-gradient(135deg, #c0392b 0%, #922b21 100%);
}

.calc-hero--roi .form-mini-result,
body[data-page="roi"] .form-mini-result {
  background: linear-gradient(135deg, #00a86b 0%, #007a4d 100%);
}

/* Маленькая кнопка reset над первым полем */
.form-reset-row {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.btn-reset-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 500;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn-reset-inline:hover {
  color: var(--text-secondary);
  background: var(--bg-secondary);
}

.btn-reset-inline svg {
  flex-shrink: 0;
  opacity: 0.65;
}

/* Убираем старый btn-reset (он больше не используется) */
.btn-reset {
  display: none !important;
}

.form-card__header {
  display: none !important;
}

/* ===========================================
   END OF FORM MINI RESULT
   =========================================== */

/* ===========================================
   FIX: lang-dropdown поверх calc-switcher
   =========================================== */

.site-header {
  overflow: visible;
}

.lang-dropdown {
  position: relative;
  z-index: 1500;
}

.lang-dropdown-content {
  z-index: 1600 !important;
}

/* ===========================================
   CALC TOP TOOLBAR (Desktop Switcher)
   =========================================== */
.calc-top-toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: var(--space-lg);
  gap: var(--space-md);
}

.calc-top-toolbar .back-link {
  margin-bottom: 0;
  margin-top: 0;
}

.header-calc-switcher {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  grid-column: 2;
  justify-content: center;
}

.hcs-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 1rem;
  height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.hcs-btn:hover {
  background: var(--bg-card);
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.hcs-btn.active {
  background: rgba(0, 102, 255, 0.1);
  border-color: var(--primary);
  color: var(--primary);
}

body[data-page="loan"] .hcs-btn.active {
  background: rgba(255, 149, 0, 0.1);
  border-color: #ff9500;
  color: #ff9500;
}

body[data-page="savings"] .hcs-btn.active {
  background: rgba(20, 184, 166, 0.1);
  border-color: #14b8a6;
  color: #14b8a6;
}

body[data-page="mortgage"] .hcs-btn.active {
  background: rgba(139, 92, 246, 0.1);
  border-color: #8b5cf6;
  color: #8b5cf6;
}

body[data-page="creditcard"] .hcs-btn.active {
  background: rgba(236, 72, 153, 0.1);
  border-color: #ec4899;
  color: #ec4899;
}

body[data-page="roi"] .hcs-btn.active {
  background: rgba(16, 185, 129, 0.1);
  border-color: #10b981;
  color: #10b981;
}

.hcs-btn svg {
  width: 20px;
  height: 20px;
}

@media (max-width: 900px) {
  .calc-top-toolbar {
    display: flex;
    justify-content: flex-start;
  }

  .header-calc-switcher {
    display: none;
    /* Hide on mobile because bottom switcher is used */
  }
}

/* Range Sliders Fixes */
input[type="range"] {
  pointer-events: none;
  /* Disable clicking on track */
}

input[type="range"]::-webkit-slider-thumb {
  pointer-events: auto;
  /* Enable dragging thumb */
}

input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  /* Enable dragging thumb */
}

/* Mobile Language Dropdown Optimization */
@media (max-width: 768px) {
  .lang-dropdown-btn {
    padding: var(--space-xs) var(--space-sm);
  }

  .lang-dropdown-btn .lang-btn-text {
    display: none;
  }
}

/* ═══════════════════════════════════════════════════════════════
   PREMIUM TOGGLE SWITCH
   ═══════════════════════════════════════════════════════════════ */
.switch-container {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-sm);
  cursor: pointer;
  user-select: none;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--gray-300);
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
  background-color: var(--success);
}

input:focus+.slider {
  box-shadow: 0 0 0 2px var(--primary-light);
}

input:checked+.slider:before {
  transform: translateX(20px);
}

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

@media (prefers-color-scheme: dark) {
  .slider {
    background-color: var(--gray-700);
  }
}