/* ================================================================
   EASYTOOLS24 DESIGN SYSTEM — 2026 Edition v2
   Inspired by Stripe, Linear, Vercel, Raycast
   Round 2: Reviewer feedback implemented
   ================================================================ */

/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
  /* Brand — refined indigo palette (no more pink) */
  --brand: #6366F1;
  --brand-hover: #4F46E5;
  --brand-dark: #4338CA;
  --brand-light: #EEF2FF;
  --brand-100: #E0E7FF;
  --brand-200: #C7D2FE;
  --brand-gradient: linear-gradient(135deg, #4F46E5, #6366F1, #818CF8);

  /* Category Accent Colors */
  --cat-rechner: #6366F1;
  --cat-rechner-light: #EEF2FF;
  --cat-text: #10B981;
  --cat-text-light: #ECFDF5;
  --cat-konverter: #F59E0B;
  --cat-konverter-light: #FFFBEB;
  --cat-design: #F43F5E;
  --cat-design-light: #FFF1F2;
  --cat-dev: #06B6D4;
  --cat-dev-light: #ECFEFF;

  /* Text — Slate palette for warmth */
  --text-primary: #0F172A;
  --text-secondary: #64748B;
  --text-body: #475569;
  --text-muted: #94A3B8;

  /* Surfaces */
  --bg-body: #FAFBFC;
  --bg-white: #FFFFFF;
  --bg-gray: #F8FAFC;
  --bg-elevated: #FFFFFF;

  /* Borders */
  --border-color: rgba(0, 0, 0, 0.08);
  --border-subtle: rgba(0, 0, 0, 0.04);
  --border-dark: #CBD5E1;
  --border-brand: rgba(99, 102, 241, 0.25);
  --border-input: #94A3B8; /* [FIX #7] clearly visible border for form inputs */

  /* Shadows — multi-layer for depth */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 1px 2px rgba(0, 0, 0, 0.03), 0 8px 32px rgba(99, 102, 241, 0.08);
  --shadow-xl: 0 1px 3px rgba(0, 0, 0, 0.04), 0 20px 48px rgba(99, 102, 241, 0.12);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-pill: 100px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;

  /* Semantic */
  --success: #10B981;
  --warning: #F59E0B;
  --error: #EF4444;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.7;
  color: var(--text-body);
  background: var(--bg-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  overflow-x: hidden;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.025em;
  line-height: 1.2;
}

h3 {
  font-size: clamp(1.125rem, 2vw, 1.375rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.35;
}

p {
  margin-bottom: 1rem;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ===== LAYOUT ===== */
.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

@media (min-width: 640px) {
  .container { padding: 0 2rem; }
}

@media (min-width: 1024px) {
  .container { padding: 0 2.5rem; }
}

main {
  flex: 1;
}

/* ===== GRADIENT TEXT ===== */
.gradient-text {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== BUTTONS ===== */
/* [FIX #8] CTA Buttons — more depth, hover lift */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--brand);
  color: #FFFFFF;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9375rem;
  border: none;
  cursor: pointer;
  transition:
    background var(--duration-fast) ease,
    transform var(--duration-fast) var(--ease-spring),
    box-shadow var(--duration-normal) ease;
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3), 0 1px 2px rgba(0,0,0,0.06);
  min-height: 48px;
  font-family: inherit;
  line-height: 1;
}

.btn-primary:hover {
  background: var(--brand-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35), 0 2px 4px rgba(0,0,0,0.08);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
  background: var(--brand-dark);
  box-shadow: 0 1px 2px rgba(99, 102, 241, 0.2);
}

.btn-primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-white), 0 0 0 4px var(--brand);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--bg-white);
  color: var(--text-body);
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.875rem;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition:
    background var(--duration-fast) ease,
    border-color var(--duration-fast) ease,
    color var(--duration-fast) ease,
    transform var(--duration-fast) var(--ease-spring);
  min-height: 40px;
  font-family: inherit;
  line-height: 1;
}

.btn-secondary:hover {
  background: var(--bg-gray);
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: scale(0.98);
}

.btn-secondary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg-white), 0 0 0 4px var(--brand);
}

/* ===== FORM INPUTS ===== */
/* [FIX #7] Inputs — more visual definition */
.tool-input {
  width: 100%;
  background: var(--bg-white);
  border: 1.5px solid var(--border-input, #94A3B8);
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
  min-height: 48px;
  transition:
    border-color var(--duration-normal) ease,
    box-shadow var(--duration-normal) ease;
  box-shadow: var(--shadow-xs);
}

.tool-input:hover {
  border-color: #64748B;
}

.tool-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15), 0 2px 4px rgba(99, 102, 241, 0.1);
}

.tool-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

textarea.tool-input {
  resize: vertical;
  min-height: 120px;
}

select.tool-input {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748B' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px;
  padding-right: 2.5rem;
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--duration-normal) var(--ease-out),
    box-shadow var(--duration-normal) var(--ease-out),
    border-color var(--duration-normal) ease;
}

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

.tool-card {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 2rem;
}

@media (min-width: 768px) {
  .tool-card { padding: 2.5rem; }
}

/* ===== RESULT BOX ===== */
/* [FIX #9] Result box — more pop */
.result-box {
  background: linear-gradient(135deg, var(--brand-light) 0%, #F5F3FF 100%);
  border: 1px solid var(--border-brand);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  transition: all var(--duration-normal) ease;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.06);
}

/* ===== TAB NAVIGATION ===== */
.tab-btn {
  padding: 0.5rem 1.125rem;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition:
    background var(--duration-normal) ease,
    color var(--duration-normal) ease,
    box-shadow var(--duration-normal) ease;
  line-height: 1.4;
}

.tab-btn.active {
  background: var(--brand);
  color: #FFFFFF;
  box-shadow: 0 1px 4px rgba(99, 102, 241, 0.25);
}

.tab-btn:not(.active) {
  background: var(--bg-gray);
  color: var(--text-secondary);
}

.tab-btn:not(.active):hover {
  background: var(--brand-light);
  color: var(--brand);
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.breadcrumb a {
  color: var(--text-secondary);
  transition: color var(--duration-fast);
}

.breadcrumb a:hover {
  color: var(--brand);
}

.breadcrumb span.separator {
  margin: 0 0.5rem;
  color: var(--text-muted);
}

.breadcrumb span.current {
  color: var(--text-primary);
  font-weight: 600;
}

/* ===== SEO CONTENT ===== */
.seo-content {
  padding: 2rem;
}

@media (min-width: 768px) {
  .seo-content { padding: 2.5rem; }
}

.seo-content h2 {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  padding-left: 1rem;
  border-left: 3px solid var(--brand);
}

.seo-content h2:first-child {
  margin-top: 0;
}

.seo-content h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

.seo-content p {
  color: var(--text-body);
  line-height: 1.8;
  margin-bottom: 1rem;
}

.seo-content ul {
  list-style: none;
  padding-left: 0;
  margin-bottom: 1rem;
}

.seo-content ul li {
  position: relative;
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
  line-height: 1.75;
  color: var(--text-body);
}

.seo-content ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
}

.seo-content code {
  background: var(--brand-light);
  color: var(--brand);
  padding: 0.125em 0.375em;
  border-radius: 4px;
  font-size: 0.875em;
  font-weight: 500;
}

.seo-content a {
  color: var(--brand);
  font-weight: 500;
  transition: color var(--duration-fast);
}

.seo-content a:hover {
  color: var(--brand-hover);
}

/* ===== FAQ ACCORDION ===== */
.faq-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
  overflow: hidden;
  transition:
    border-color var(--duration-normal) ease,
    box-shadow var(--duration-normal) ease;
  background: var(--bg-white);
}

.faq-item:hover {
  border-color: rgba(0, 0, 0, 0.1);
}

.faq-item[open] {
  border-color: var(--border-brand);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.05);
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
  transition: color var(--duration-fast);
  user-select: none;
  gap: 1rem;
}

.faq-question::-webkit-details-marker { display: none; }

/* [FIX #10] FAQ icon — smooth + to × rotation */
.faq-question::after {
  content: '+';
  font-size: 1.25rem;
  font-weight: 300;
  color: var(--text-muted);
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-gray);
  transition:
    transform var(--duration-slow) var(--ease-out),
    background var(--duration-normal) ease,
    color var(--duration-normal) ease;
  line-height: 1;
}

.faq-item[open] .faq-question::after {
  transform: rotate(45deg);
  background: var(--brand-light);
  color: var(--brand);
}

.faq-question:hover {
  color: var(--brand);
}

.faq-question:hover::after {
  background: var(--brand-light);
  color: var(--brand);
}

.faq-answer {
  padding: 0 1.25rem 1.25rem;
  color: var(--text-body);
  line-height: 1.75;
}

.faq-answer p {
  margin: 0;
}

/* ===== ICON CONTAINERS ===== */
.icon-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--brand-light);
  color: var(--brand);
  flex-shrink: 0;
}

.icon-square {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: var(--brand-light);
  color: var(--brand);
  flex-shrink: 0;
  transition: all var(--duration-normal) ease;
}

/* ===== SCROLL TO TOP ===== */
.scroll-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--brand);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all var(--duration-slow) var(--ease-out);
  z-index: 40;
}

.scroll-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top:hover {
  background: var(--brand-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.scroll-top:active {
  transform: scale(0.95);
}

/* ===== SECTION SPACING ===== */
.section {
  padding: 4rem 0;
}

@media (min-width: 768px) {
  .section { padding: 5rem 0; }
}

@media (min-width: 1024px) {
  .section { padding: 6rem 0; }
}

/* ===== UTILITY ===== */
.hidden { display: none !important; }
.text-brand { color: var(--brand); }
.bg-brand-light { background: var(--brand-light); }

/* ===== CHECKBOX ===== */
input[type="checkbox"] {
  accent-color: var(--brand);
}

/* ===== RANGE SLIDER ===== */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #E2E8F0;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--brand);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(99, 102, 241, 0.3);
  transition: box-shadow var(--duration-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--brand);
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 4px rgba(99, 102, 241, 0.3);
}

/* ===== TABLE RESETS ===== */
table {
  border-collapse: collapse;
  width: 100%;
}

/* ===== NAV LINK ===== */
.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--duration-fast);
  text-decoration: none;
  white-space: nowrap;
}

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

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

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 767px) {
  .tool-card { padding: 1.5rem; }

  .seo-content { padding: 1.5rem; }

  .seo-content h2 {
    font-size: 1.25rem;
  }
}

/* ================================================================
   COMPREHENSIVE MOBILE UX FIXES (390px iPhone + 360px Android)
   Fixes: iOS zoom, touch targets, charts, tables, layouts
   ================================================================ */
@media (max-width: 768px) {

  /* --- FIX #1: Prevent iOS zoom on focus (font-size ≥ 16px) --- */
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="url"],
  input[type="tel"],
  input[type="search"],
  input[type="password"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* --- FIX #2: Touch targets ≥ 44px for ALL interactive elements --- */
  .tab-btn,
  .kr-tab-btn,
  .er-tab,
  .fc-palette-tab,
  .qr-type-tab,
  .sk-btn,
  .kv-type-btn,
  .period-btn,
  .pill,
  button,
  .btn-primary,
  .btn-secondary,
  .jf-action-btn,
  select,
  .bn-select,
  .qr-field-select {
    min-height: 44px;
  }

  input[type="checkbox"],
  input[type="radio"] {
    width: 22px;
    height: 22px;
    min-width: 22px;
  }

  label:has(input[type="checkbox"]),
  label:has(input[type="radio"]),
  .qr-radio-label {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* --- FIX #3: Sliders — bigger thumb for touch --- */
  input[type="range"] {
    height: 8px;
  }
  input[type="range"]::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
  }
  input[type="range"]::-moz-range-thumb {
    width: 28px;
    height: 28px;
  }

  /* --- FIX #4: Adequate padding --- */
  .tool-card {
    padding: 1rem;
  }
  .tool-card--flush {
    padding: 0;
  }

  /* --- FIX #5: Charts min-height --- */
  canvas {
    min-height: 220px;
  }

  /* --- FIX #6: Table overflow scrollable --- */
  .kr-tilgungsplan-table-wrap,
  .table-responsive,
  .er-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table:not(.bn-breakdown) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* --- Result grids: 1 column on mobile --- */
  .result-grid,
  .stats-grid,
  .bn-year-grid {
    grid-template-columns: 1fr !important;
  }

  /* --- Scroll-to-top: avoid overlap with sticky bars --- */
  .scroll-top {
    bottom: 5rem;
    right: 1rem;
  }

  /* --- Tool page padding --- */
  .tool-page {
    padding-left: 1rem;
    padding-right: 1rem;
    padding-top: 1.5rem;
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* --- Prevent any child from exceeding viewport --- */
  .tool-card,
  .tool-card--flush,
  main > * {
    max-width: 100%;
    box-sizing: border-box;
  }

  /* --- tool-card-body/header narrower padding --- */
  .tool-card-header {
    padding: 0.875rem 1rem 0.625rem;
  }
  .tool-card-body {
    padding: 1rem;
  }

  /* --- FAQ touch targets --- */
  .faq-question {
    min-height: 48px;
    padding: 0.875rem 1rem;
  }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  0% { background-position: 200% 50%; }
  100% { background-position: -200% 50%; }
}

@keyframes gradientMove {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* [FIX #5] Staggered card reveal animation */
@keyframes cardReveal {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* [FIX #5] Hero badge float */
@keyframes badgeFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.animate-in {
  animation: fadeInUp 0.4s var(--ease-out) both;
}

/* ===== LABEL ===== */
label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ===== COPY BUTTON PATTERN ===== */
.copy-result-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: all var(--duration-fast);
}

.copy-result-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.copy-result-btn.copied {
  border-color: var(--success);
  color: var(--success);
  transform: scale(1.02);
}

/* ===== PILL / TAG ===== */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--bg-white);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast);
  white-space: nowrap;
  user-select: none;
}

.pill:hover {
  border-color: var(--border-brand);
  color: var(--brand);
  background: var(--brand-light);
}

.pill.active {
  background: var(--brand);
  color: #FFFFFF;
  border-color: var(--brand);
}

/* ===== FOCUS RING GLOBAL ===== */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
}

/* ===== TOOL PAGE LAYOUT ===== */
.tool-page {
  padding: 2.5rem 0 4rem;
  max-width: 860px;
  margin: 0 auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 640px) {
  .tool-page { padding-left: 2rem; padding-right: 2rem; }
}

@media (min-width: 1024px) {
  .tool-page { padding-left: 2.5rem; padding-right: 2.5rem; }
}

.tool-page-wide {
  max-width: 1120px;
}

/* Inline max-width overrides should still respect viewport */
main[style*="max-width"] {
  width: 100% !important;
  box-sizing: border-box !important;
}

/* ===== TOOL HEADER ===== */
.tool-header {
  margin-bottom: 2rem;
}

.tool-header h1 {
  margin-bottom: 0.75rem;
}

.tool-subtitle {
  color: var(--text-secondary);
  font-size: 1.0625rem;
  margin-bottom: 0;
}

/* ===== TOOL SECTIONS ===== */
.tool-section-title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.375rem;
}

.tool-section-hint {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* ===== INPUT PATTERNS ===== */
.input-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
}

.input-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.input-group {
  flex: 1;
  min-width: 140px;
}

.input-group-lg {
  flex: 2;
  min-width: 200px;
}

.input-separator {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 1.125rem;
  padding-bottom: 0.625rem;
}

.tool-input-lg {
  font-size: 1.125rem;
  padding: 0.875rem 1rem;
}

.input-suffix {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ===== TAB NAVIGATION ===== */
.tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

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

.stats-grid-6 {
  grid-template-columns: repeat(2, 1fr);
}

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

@media (min-width: 1024px) {
  .stats-grid-6 { grid-template-columns: repeat(6, 1fr); }
}

.stat-card {
  background: var(--brand-light);
  border-radius: var(--radius-xl);
  padding: 1rem;
  text-align: center;
}

.stat-card-sm {
  padding: 0.875rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brand);
}

.stat-value-sm {
  font-size: 1.25rem;
}

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

/* ===== RELATED TOOLS ===== */
.related-tools {
  margin-bottom: 3rem;
}

.related-tools h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.related-tools-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.related-tool-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--brand);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity var(--duration-fast);
}

.related-tool-link:hover {
  opacity: 0.8;
}

/* ===== FAQ SECTION ===== */
.faq-section {
  margin-bottom: 3rem;
}

.faq-section h2 {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.faq-list {
  display: flex;
  flex-direction: column;
}

/* ===== SPACING UTILITIES ===== */
.mb-1 { margin-bottom: 0.75rem; }
.mb-2 { margin-bottom: 1.5rem; }
.mb-3 { margin-bottom: 2.5rem; }
.mt-2 { margin-top: 1.5rem; }
.mt-3 { margin-top: 2.5rem; }

.text-right { text-align: right; }

/* ===== TOOL CARD HEADER (within zero-padding cards) ===== */
.tool-card-header {
  padding: 1.25rem 2rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.tool-card-header h2 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

.tool-card-body {
  padding: 1.5rem 2rem;
}

@media (max-width: 767px) {
  .tool-card-header { padding: 1rem 1.5rem 0.625rem; }
  .tool-card-body { padding: 1rem 1.5rem; }
}
.tool-card--flush { padding: 0; overflow: hidden; }

/* ===== INFO BANNER ===== */
.info-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--brand-light);
  border: 1px solid var(--brand-200);
  border-radius: var(--radius-lg);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--brand-dark);
}

.info-banner-icon {
  flex-shrink: 0;
}

/* ===== TABLE RESPONSIVE ===== */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===== SELECTION ===== */
::selection {
  background: var(--brand-100);
  color: var(--text-primary);
}

/* ================================================================
   GLOBAL TOOL PAGE OVERRIDES (v2 Fixes #7, #8, #9)
   Applied with higher specificity to override per-page inline styles
   ================================================================ */

/* [FIX #7] All text inputs/selects/textareas — GLOBAL override */
.tool-card input[type="text"],
.tool-card input[type="number"],
.tool-card input[type="email"],
.tool-card input[type="url"],
.tool-card input[type="tel"],
.tool-card select:not([multiple]),
.tool-card textarea,
input.tool-input,
select.tool-input,
textarea.tool-input,
main input[type="text"],
main input[type="number"],
main select:not([multiple]),
main textarea {
  border: 1.5px solid var(--border-input, #94A3B8) !important;
  transition:
    border-color var(--duration-normal) ease,
    box-shadow var(--duration-normal) ease !important;
}

.tool-card input[type="text"]:hover,
.tool-card input[type="number"]:hover,
.tool-card select:not([multiple]):hover,
.tool-card textarea:hover,
main input[type="text"]:hover,
main input[type="number"]:hover,
main select:not([multiple]):hover,
main textarea:hover {
  border-color: #64748B !important;
}

.tool-card input[type="text"]:focus,
.tool-card input[type="number"]:focus,
.tool-card input[type="email"]:focus,
.tool-card input[type="url"]:focus,
.tool-card input[type="tel"]:focus,
.tool-card select:not([multiple]):focus,
.tool-card textarea:focus,
input.tool-input:focus,
select.tool-input:focus,
textarea.tool-input:focus,
main input[type="text"]:focus,
main input[type="number"]:focus,
main select:not([multiple]):focus,
main textarea:focus {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15), 0 2px 4px rgba(99, 102, 241, 0.1) !important;
  outline: none !important;
}

/* [FIX #8] CTA buttons everywhere */
.btn-primary,
button[type="submit"],
.tool-card .btn-primary,
button.btn-primary {
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3), 0 1px 2px rgba(0,0,0,0.06) !important;
  transition:
    background var(--duration-fast) ease,
    transform var(--duration-fast) var(--ease-spring),
    box-shadow var(--duration-normal) ease !important;
}

.btn-primary:hover,
button[type="submit"]:hover,
.tool-card .btn-primary:hover,
button.btn-primary:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35), 0 2px 4px rgba(0,0,0,0.08) !important;
}

/* [FIX #9] Result boxes everywhere */
.result-box,
[class*="result"],
[id*="result"]:not(script):not(style) {
  background: linear-gradient(135deg, var(--brand-light) 0%, #F5F3FF 100%);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.06);
}

/* [FIX #10] FAQ items everywhere */
details.faq-item summary.faq-question::after {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform var(--duration-slow) var(--ease-out),
    background var(--duration-normal) ease,
    color var(--duration-normal) ease;
}

details.faq-item[open] summary.faq-question::after {
  transform: rotate(45deg);
  background: var(--brand-light);
  color: var(--brand);
}

/* ================================================================
   TOOL HISTORY — Berechnungsverlauf
   ================================================================ */

.tool-history {
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.tool-history__header {
  margin-bottom: 1rem;
}

.tool-history__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.tool-history__title svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Empty state */
.history-empty {
  padding: 1.5rem;
  text-align: center;
  background: var(--bg-gray);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
}

.history-empty p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0;
}

/* Entry list */
.tool-history__list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Single entry card */
.history-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 1rem;
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition:
    box-shadow var(--duration-normal) ease,
    border-color var(--duration-normal) ease,
    opacity var(--duration-slow) ease,
    transform var(--duration-slow) var(--ease-out);
  animation: historySlideIn 0.3s var(--ease-out) both;
}

.history-entry:hover {
  box-shadow: var(--shadow-sm);
  border-color: rgba(0, 0, 0, 0.1);
}

/* Remove animation */
.history-entry--removing {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Left side */
.history-entry__left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.history-entry__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

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

.history-entry__label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-entry__result {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--brand);
}

.history-entry__detail {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Right side */
.history-entry__right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.history-entry__time {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Load button */
.history-load-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.75rem;
  background: var(--brand-light);
  color: var(--brand);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--duration-fast);
  min-height: 32px;
  min-width: 44px;
  justify-content: center;
}

.history-load-btn:hover {
  background: var(--brand);
  color: #FFFFFF;
}

.history-load-btn:active {
  transform: scale(0.96);
}

/* Delete button */
.history-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--duration-fast);
  line-height: 1;
}

.history-delete-btn:hover {
  background: #FEF2F2;
  color: #EF4444;
}

/* Show more / expand button */
.tool-history__show-more {
  display: block;
  width: 100%;
  padding: 0.625rem;
  margin-top: 0.5rem;
  background: var(--bg-gray);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: all var(--duration-fast);
}

.tool-history__show-more:hover {
  background: var(--brand-light);
  color: var(--brand);
  border-color: var(--border-brand);
}

/* Clear all button */
.tool-history__clear {
  display: block;
  margin: 0.75rem auto 0;
  padding: 0.375rem 0.75rem;
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-size: 0.75rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: color var(--duration-fast);
}

.tool-history__clear:hover {
  color: #EF4444;
}

/* Slide-in animation */
@keyframes historySlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile adjustments */
@media (max-width: 640px) {
  .history-entry {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .history-entry__right {
    width: 100%;
    justify-content: flex-end;
    padding-left: 1.75rem;
  }

  .history-entry__label {
    white-space: normal;
  }

  .history-load-btn {
    min-height: 44px;
    padding: 0.5rem 1rem;
  }

  .history-delete-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    font-size: 1.25rem;
  }
}
