/* ====================================
   CANCELLO - APPLE-LEVEL DESIGN SYSTEM
   Professional CSS Framework
   ==================================== */

/* ===== DESIGN TOKENS (CSS VARIABLES) ===== */
:root {
  /* SPACING SCALE */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 48px;
  --space-10: 64px;
  --space-11: 80px;

  /* BORDER RADIUS */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* SHADOWS */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.10), 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.12), 0 8px 24px rgba(0, 0, 0, 0.08);

  /* COLORS */
  --color-bg: #f5f5f7;
  --color-surface: #ffffff;
  --color-surface-2: #f0f0f2;
  --color-surface-3: #e8e8ed;
  --color-border: rgba(0, 0, 0, 0.09);
  --color-border-strong: rgba(0, 0, 0, 0.16);
  --color-text: #1d1d1f;
  --color-text-2: #3d3d3f;
  --color-text-3: #6e6e73;
  --color-text-4: #a1a1a6;
  
  /* PRIMARY COLORS */
  --color-primary: #0071e3;
  --color-primary-dark: #0058b0;
  --color-primary-light: #409cff;
  
  /* SEMANTIC COLORS */
  --color-success: #30d158;
  --color-error: #ff3b30;
  --color-warning: #ff9f0a;
  --color-info: #0071e3;

  /* GRADIENTS */
  --gradient-primary: linear-gradient(135deg, #0071e3 0%, #0040a8 100%);
  --gradient-primary-hover: linear-gradient(135deg, #1a80e8 0%, #1050bb 100%);
  --gradient-surface: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
  --gradient-hero: linear-gradient(180deg, #f5f5f7 0%, #ffffff 100%);

  /* TYPOGRAPHY */
  --font-system: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", Menlo, Monaco, Consolas, monospace;
  
  --font-size-xs: 11px;
  --font-size-sm: 13px;
  --font-size-base: 15px;
  --font-size-md: 16px;
  --font-size-lg: 18px;
  --font-size-xl: 21px;
  --font-size-2xl: 28px;
  --font-size-3xl: 40px;
  --font-size-4xl: 56px;

  --line-height-tight: 1.2;
  --line-height-snug: 1.4;
  --line-height-base: 1.6;
  --line-height-relaxed: 1.8;

  /* TRANSITIONS */
  --transition-instant: 80ms ease;
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 220ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

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

body {
  font-family: var(--font-system);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

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

a:hover {
  text-decoration: underline;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input,
select,
textarea {
  font-family: inherit;
}

/* ===== TYPOGRAPHY ===== */
h1 {
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: var(--line-height-tight);
  margin-bottom: 0;
}

h2 {
  font-size: clamp(24px, 4vw, 40px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: var(--line-height-tight);
  margin-bottom: 0;
}

h3 {
  font-size: clamp(18px, 3vw, 24px);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0;
}

h4 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 0;
}

h5 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 0;
}

p {
  margin-bottom: 0;
}

.lead {
  font-size: clamp(17px, 2vw, 21px);
  color: var(--color-text-3);
  line-height: var(--line-height-relaxed);
}

.text-sm {
  font-size: var(--font-size-sm);
}

.text-xs {
  font-size: var(--font-size-xs);
}

.text-muted {
  color: var(--color-text-3);
}

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

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

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

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

/* ===== CONTAINER ===== */
.container {
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-5);
  padding-right: var(--space-5);
}

.container--sm {
  max-width: 640px;
}

.container--md {
  max-width: 800px;
}

.container--lg {
  max-width: 960px;
}

/* ===== NAVBAR ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--color-border);
}

.navbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.navbar__logo img {
  height: 28px;
}

.navbar__nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.navbar__nav a {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-3);
  transition: var(--transition-fast);
}

.navbar__nav a:hover,
.navbar__nav a.active {
  color: var(--color-text);
  background: var(--color-surface-2);
  text-decoration: none;
}

.navbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.lang-switcher {
  appearance: none;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%23A1A1A6' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  padding: 6px 28px 6px var(--space-3);
  font: var(--font-size-sm) / 1 var(--font-system);
  color: var(--color-text-3);
  cursor: pointer;
  transition: var(--transition-fast);
}

.lang-switcher:hover {
  border-color: var(--color-primary-light);
}

.lang-switcher:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ===== BUTTON STYLES ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 44px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-lg);
  font: 500 var(--font-size-base) / 1 var(--font-system);
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: var(--transition-fast);
  border: none;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:focus-visible {
  outline: 3px solid rgba(0, 113, 227, 0.4);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* PRIMARY BUTTON - Gradient with Subtle Animation */
.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 113, 227, 0.30), 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover:not(:disabled) {
  background: var(--gradient-primary-hover);
  box-shadow: 0 4px 16px rgba(0, 113, 227, 0.35), 0 2px 4px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 1px 4px rgba(0, 113, 227, 0.25);
}

/* SECONDARY BUTTON */
.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1.5px solid var(--color-border-strong);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-surface-2);
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

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

/* GHOST BUTTON */
.btn-ghost {
  background: transparent;
  color: var(--color-primary);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(0, 113, 227, 0.06);
}

/* DANGER BUTTON */
.btn-danger {
  background: linear-gradient(135deg, #ff3b30 0%, #c0392b 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(255, 59, 48, 0.30);
}

.btn-danger:hover:not(:disabled) {
  box-shadow: 0 4px 16px rgba(255, 59, 48, 0.35);
  transform: translateY(-1px);
}

/* BUTTON SIZES */
.btn-lg {
  height: 52px;
  padding: 0 var(--space-7);
  font-size: var(--font-size-lg);
  border-radius: var(--radius-xl);
}

.btn-sm {
  height: 36px;
  padding: 0 var(--space-3);
  font-size: var(--font-size-sm);
  border-radius: var(--radius-md);
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
}

.btn-block {
  width: 100%;
}

/* ===== FLOATING LABEL FORM SYSTEM (CRITICAL) ===== */
.field {
  position: relative;
  margin-bottom: var(--space-5);
}

.field__input {
  display: block;
  width: 100%;
  height: 58px;
  padding: 24px 16px 8px;
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  font: var(--font-size-base) / 1 var(--font-system);
  color: var(--color-text);
  background: var(--color-surface);
  transition: var(--transition-fast);
  outline: none;
  appearance: none;
}

.field__input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.field__input.has-error {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.12);
}

.field__input::placeholder {
  color: transparent;
}

/* FLOATING LABEL ANIMATION */
.field__label {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--font-size-base);
  color: var(--color-text-3);
  pointer-events: none;
  transition: var(--transition-fast);
  transform-origin: left top;
  font-weight: 400;
}

.field__input:focus ~ .field__label,
.field__input:not(:placeholder-shown) ~ .field__label,
.field__input.has-value ~ .field__label {
  top: 10px;
  transform: translateY(0) scale(0.78);
  color: var(--color-primary);
  font-weight: 500;
}

.field__input.has-error ~ .field__label {
  color: var(--color-error);
}

/* SELECT AS FLOATING FIELD */
.field__select {
  display: block;
  width: 100%;
  height: 58px;
  padding: 24px 40px 8px 16px;
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  font: var(--font-size-base) / 1 var(--font-system);
  color: var(--color-text);
  background: var(--color-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%236E6E73' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 16px center;
  appearance: none;
  transition: var(--transition-fast);
  outline: none;
}

.field__select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.field__select ~ .field__label {
  top: 10px;
  transform: translateY(0) scale(0.78);
  font-weight: 500;
}

/* TEXTAREA AS FLOATING FIELD */
.field__textarea {
  display: block;
  width: 100%;
  min-height: 120px;
  padding: 28px 16px 8px;
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  font: var(--font-size-base) / var(--line-height-base) var(--font-system);
  color: var(--color-text);
  background: var(--color-surface);
  transition: var(--transition-fast);
  outline: none;
  resize: vertical;
  appearance: none;
}

.field__textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.field__textarea:focus ~ .field__label,
.field__textarea:not(:placeholder-shown) ~ .field__label {
  top: 8px;
  transform: translateY(0) scale(0.78);
  color: var(--color-primary);
  font-weight: 500;
}

.field__textarea ~ .field__label {
  top: 16px;
}

/* FORM MESSAGES */
.field__error {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--font-size-xs);
  color: var(--color-error);
}

.field__hint {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--font-size-xs);
  color: var(--color-text-3);
}

/* ===== ERROR SUMMARY ===== */
.error-summary {
  background: #fff5f4;
  border: 1.5px solid var(--color-error);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-6);
}

.error-summary__title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-error);
  margin-bottom: var(--space-2);
}

.error-summary__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.error-summary__item {
  font-size: var(--font-size-sm);
  color: var(--color-error);
  padding-left: var(--space-4);
  position: relative;
}

.error-summary__item::before {
  content: "•";
  position: absolute;
  left: var(--space-2);
}

/* ===== 5-STEP STEPPER (CLEAN VERSION) ===== */
.stepper {
  display: flex;
  align-items: flex-start;
  padding: var(--space-6) 0 var(--space-8);
  position: relative;
}

.stepper::before {
  content: "";
  position: absolute;
  top: calc(var(--space-6) + 18px);
  left: calc(100% / 10);
  right: calc(100% / 10);
  height: 2px;
  background: var(--color-border);
  z-index: 0;
}

.stepper__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
}

/* STEPPER CIRCLE */
.stepper__circle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-3);
  background: var(--color-surface);
  transition: var(--transition-base);
}

/* ACTIVE STEPPER STEP */
.stepper__item--active .stepper__circle {
  background: var(--gradient-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.35);
  animation: pulseActive 2s ease-in-out infinite;
}

/* COMPLETED STEPPER STEP */
.stepper__item--done .stepper__circle {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #fff;
}

.stepper__item--done .stepper__circle::after {
  content: "✓";
  font-size: 14px;
}

/* STEPPER LABEL */
.stepper__label {
  margin-top: var(--space-2);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-4);
  text-align: center;
  max-width: 80px;
  line-height: 1.3;
}

.stepper__item--active .stepper__label {
  color: var(--color-primary);
  font-weight: 600;
}

.stepper__item--done .stepper__label {
  color: var(--color-success);
}

/* STEPPER CONNECTOR */
.stepper__connector {
  position: absolute;
  top: 18px;
  left: calc(50% + 18px);
  right: calc(-50% + 18px);
  height: 2px;
  background: var(--color-border);
  z-index: 0;
}

.stepper__item--done .stepper__connector {
  background: var(--color-success);
}

/* ===== PROGRESS BAR COMPONENT ===== */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--color-surface-3);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-4);
}

.progress-bar__fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow) ease-out;
  box-shadow: 0 0 12px rgba(0, 113, 227, 0.4);
}

.progress-bar__label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
  font-size: var(--font-size-sm);
}

.progress-bar__text {
  color: var(--color-text-3);
}

.progress-bar__percentage {
  font-weight: 600;
  color: var(--color-primary);
}

/* ===== CARD SYSTEM ===== */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
  transition: var(--transition-fast);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card--selected {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15), var(--shadow-sm);
}

.card--clickable {
  cursor: pointer;
}

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

.card--clickable:active {
  transform: translateY(0);
}

/* ===== CATEGORY GRID (8 CATEGORIES) ===== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
}

.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-3);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: center;
}

.category-card:hover {
  border-color: var(--color-primary-light);
  background: rgba(0, 113, 227, 0.03);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.category-card--selected {
  border-color: var(--color-primary);
  background: rgba(0, 113, 227, 0.06);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.category-card__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: var(--color-surface-2);
  transition: var(--transition-fast);
}

.category-card--selected .category-card__icon {
  background: rgba(0, 113, 227, 0.1);
}

.category-card__name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
}

/* ===== PROVIDER GRID ===== */
.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-3);
}

.provider-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition-fast);
}

.provider-card:hover {
  border-color: var(--color-primary-light);
  background: rgba(0, 113, 227, 0.02);
}

.provider-card--selected {
  border-color: var(--color-primary);
  background: rgba(0, 113, 227, 0.05);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

.provider-card__radio {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  border: 2px solid var(--color-border-strong);
  flex-shrink: 0;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.provider-card--selected .provider-card__radio {
  border-color: var(--color-primary);
  background: var(--color-primary);
}

.provider-card--selected .provider-card__radio::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: white;
}

.provider-card__name {
  font-size: var(--font-size-base);
  font-weight: 500;
}

/* ===== SCENARIO SELECTOR ===== */
.scenario-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.scenario-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition-fast);
}

.scenario-item:hover {
  border-color: var(--color-primary-light);
}

.scenario-item--selected {
  border-color: var(--color-primary);
  background: rgba(0, 113, 227, 0.05);
}

.scenario-item__radio {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  border: 2px solid var(--color-border-strong);
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.scenario-item--selected .scenario-item__radio {
  border-color: var(--color-primary);
  background: var(--color-primary);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.9);
}

.scenario-item__label {
  font-size: var(--font-size-base);
  font-weight: 500;
}

.scenario-item__desc {
  font-size: var(--font-size-sm);
  color: var(--color-text-3);
  margin-top: 2px;
}

/* ===== LETTER PREVIEW COMPONENT (REVIEW STEP) ===== */
.letter-preview {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  font-family: "Times New Roman", Times, serif;
  font-size: 14px;
  line-height: 1.7;
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
  position: relative;
  max-width: 600px;
  margin: 0 auto;
  /* Force LTR — the letter is always a German-language formal document */
  direction: ltr;
  text-align: left;
  unicode-bidi: isolate;
}

.letter-preview::before {
  content: "Vorschau des Kündigungsschreibens";
  position: absolute;
  top: -10px;
  left: var(--space-5);
  right: auto;           /* override RTL-inherited auto-right */
  background: var(--color-surface);
  padding: 0 var(--space-2);
  font: 500 var(--font-size-xs) var(--font-system);
  color: var(--color-text-3);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  direction: ltr;
}

.letter-preview__sender {
  margin-bottom: var(--space-8);
  text-align: left;
}

.letter-preview__recipient {
  margin-bottom: var(--space-6);
  text-align: left;
}

.letter-preview__date {
  text-align: right;
  margin-bottom: var(--space-6);
}

.letter-preview__subject {
  font-weight: bold;
  margin-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-3);
}

.letter-preview__body {
  margin-bottom: var(--space-6);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.letter-preview__closing {
  margin-top: var(--space-8);
}

/* ===== REVIEW SUMMARY CARDS ===== */
.review-grid {
  display: grid;
  gap: var(--space-4);
}

.review-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
}

.review-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.review-card__title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.review-card__rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.review-card__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
}

.review-card__row-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-3);
  flex-shrink: 0;
}

.review-card__row-value {
  font-size: var(--font-size-sm);
  font-weight: 500;
  text-align: right;
}

/* ===== SUCCESS STATE ===== */
.success-hero {
  text-align: center;
  padding: var(--space-12) 0;
}

.success-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: rgba(48, 209, 88, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-6);
  animation: scaleIn var(--transition-spring);
}

.success-icon svg {
  width: 40px;
  height: 40px;
  color: var(--color-success);
}

.success-steps {
  display: grid;
  gap: var(--space-3);
  max-width: 480px;
  margin: var(--space-8) auto 0;
}

.success-step {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.success-step__number {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: rgba(0, 113, 227, 0.1);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--font-size-sm);
  flex-shrink: 0;
}

.success-step__text {
  font-size: var(--font-size-sm);
  font-weight: 500;
}

/* ===== FLOW NAVIGATION ===== */
.flow-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
  gap: var(--space-4);
}

.flow-nav--end {
  justify-content: flex-end;
}

/* ===== SECTIONS & HERO ===== */
.hero {
  padding: clamp(60px, 10vw, 120px) 0;
  background: var(--gradient-hero);
}

.hero__eyebrow {
  display: inline-block;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-primary);
  background: rgba(0, 113, 227, 0.08);
  border-radius: var(--radius-full);
  padding: 6px 16px;
  margin-bottom: var(--space-4);
  letter-spacing: 0.02em;
}

.hero__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-8);
  flex-wrap: wrap;
}

.hero__trust {
  margin-top: var(--space-5);
  font-size: var(--font-size-sm);
  color: var(--color-text-3);
}

.section {
  padding: var(--space-10) 0;
}

.section-alt {
  background: var(--color-surface);
}

.section__title {
  text-align: center;
  margin-bottom: var(--space-3);
}

.section__subtitle {
  text-align: center;
  color: var(--color-text-3);
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: var(--space-10);
}

.page-header {
  max-width: 720px;
  margin: 0 auto var(--space-10);
  text-align: center;
}

.page-header h1 {
  margin-bottom: var(--space-3);
}

/* ===== HOW IT WORKS ===== */
.how-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6);
}

.how-card {
  text-align: center;
  padding: var(--space-6);
}

.how-card__number {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin: 0 auto var(--space-4);
  box-shadow: 0 4px 16px rgba(0, 113, 227, 0.3);
}

.how-card__title {
  font-size: var(--font-size-base);
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.how-card__desc {
  font-size: var(--font-size-sm);
  color: var(--color-text-3);
}

/* ===== FAQ ===== */
.faq-list {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  flex-direction: column;
}

.faq-item {
  border-bottom: 1px solid var(--color-border);
}

.faq-item:first-child {
  border-top: 1px solid var(--color-border);
}

.faq-item summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) 0;
  cursor: pointer;
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--color-text);
  transition: var(--transition-fast);
}

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

.faq-item summary::after {
  content: "+";
  font-size: 20px;
  font-weight: 300;
  color: var(--color-text-3);
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.faq-item[open] summary::after {
  content: "−";
  color: var(--color-primary);
}

.faq-item[open] summary {
  color: var(--color-primary);
}

.faq-answer {
  padding-bottom: var(--space-5);
  font-size: var(--font-size-base);
  color: var(--color-text-3);
  line-height: var(--line-height-relaxed);
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-blue {
  background: rgba(0, 113, 227, 0.1);
  color: var(--color-primary);
}

.badge-green {
  background: rgba(48, 209, 88, 0.12);
  color: #218c3b;
}

.badge-red {
  background: rgba(255, 59, 48, 0.1);
  color: var(--color-error);
}

.badge-gray {
  background: var(--color-surface-2);
  color: var(--color-text-3);
}

/* ===== FOOTER ===== */
.footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: var(--space-10) 0 var(--space-8);
  margin-top: auto;
}

.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-10);
  margin-bottom: var(--space-10);
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 var(--space-5);
}

.footer__brand img {
  height: 24px;
  margin-bottom: var(--space-3);
}

.footer__tagline {
  font-size: var(--font-size-sm);
  color: var(--color-text-3);
  line-height: var(--line-height-relaxed);
}

.footer__heading {
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-3);
  margin-bottom: var(--space-4);
}

.footer__links {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.footer__links a {
  font-size: var(--font-size-sm);
  color: var(--color-text-3);
  transition: var(--transition-fast);
}

.footer__links a:hover {
  color: var(--color-text);
  text-decoration: none;
}

.footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
  font-size: var(--font-size-xs);
  color: var(--color-text-4);
  flex-wrap: wrap;
  gap: var(--space-3);
  max-width: 1120px;
  margin: 0 auto;
  padding-left: var(--space-5);
  padding-right: var(--space-5);
}

/* ===== CONTACT PAGE ===== */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}

.contact-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.contact-card__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.contact-card__icon--email {
  background: rgba(0, 113, 227, 0.1);
}

.contact-card__icon--whatsapp {
  background: rgba(37, 211, 102, 0.1);
}

.contact-card__title {
  font-size: var(--font-size-md);
  font-weight: 600;
}

.contact-card__text {
  font-size: var(--font-size-sm);
  color: var(--color-text-3);
}

.contact-card__value {
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--color-primary);
}

/* ===== LEGAL PAGES ===== */
.legal-content {
  max-width: 800px;
}

.legal-content h1 {
  margin-bottom: var(--space-2);
}

.legal-meta {
  font-size: var(--font-size-sm);
  color: var(--color-text-3);
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.legal-section {
  margin-bottom: var(--space-8);
}

.legal-section h2 {
  font-size: var(--font-size-xl);
  font-weight: 600;
  margin-bottom: var(--space-4);
}

.legal-section p {
  font-size: var(--font-size-base);
  color: var(--color-text-2);
  line-height: var(--line-height-relaxed);
}

/* ===== RTL SUPPORT ===== */
[dir="rtl"] .field__label {
  left: auto;
  right: 16px;
  transform-origin: right top;
}

[dir="rtl"] .navbar__nav {
  flex-direction: row-reverse;
}

[dir="rtl"] .footer__links {
  align-items: flex-end;
}

[dir="rtl"] .flow-nav {
  flex-direction: row-reverse;
}

[dir="rtl"] .provider-card {
  flex-direction: row-reverse;
}

[dir="rtl"] .scenario-item {
  flex-direction: row-reverse;
}

[dir="rtl"] .category-grid {
  direction: rtl;
}

[dir="rtl"] .review-card__row {
  flex-direction: row-reverse;
}

/* Input fields ALWAYS LTR even in RTL pages */
[dir="rtl"] input[type="text"],
[dir="rtl"] input[type="email"],
[dir="rtl"] input[type="tel"],
[dir="rtl"] input[type="date"],
[dir="rtl"] input[type="number"],
[dir="rtl"] select,
[dir="rtl"] textarea {
  direction: ltr;
  text-align: left;
}

/* ===== ANIMATIONS ===== */
@keyframes pulseActive {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(0, 113, 227, 0.35);
  }
  50% {
    box-shadow: 0 4px 20px rgba(0, 113, 227, 0.5);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
  .category-grid {
    grid-template-columns: repeat(4, 1fr);
  }

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

  .footer__grid {
    grid-template-columns: 1fr 1fr;
  }
}

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

  .provider-grid {
    grid-template-columns: 1fr;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .how-grid {
    grid-template-columns: 1fr;
  }

  .footer__grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .navbar__nav {
    display: none;
  }

  .stepper__label {
    display: none;
  }

  .flow-nav {
    flex-direction: column-reverse;
    gap: var(--space-3);
  }

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

  .letter-preview {
    padding: var(--space-5);
  }

  .form-grid,
  .form-grid--3,
  .form-grid--zip {
    grid-template-columns: 1fr;
  }
}

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

  .hero__actions {
    flex-direction: column;
    width: 100%;
  }

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

  .btn-lg {
    height: 48px;
    font-size: var(--font-size-base);
  }

  .stepper {
    padding: var(--space-4) 0 var(--space-6);
  }

  .stepper::before {
    display: none;
  }

  .stepper__connector {
    display: none;
  }
}

/* ===== UTILITY CLASSES ===== */
.flex {
  display: flex;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.gap-4 {
  gap: var(--space-4);
}

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

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

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

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

.mb-4 {
  margin-bottom: var(--space-4);
}

.mb-6 {
  margin-bottom: var(--space-6);
}

.mb-8 {
  margin-bottom: var(--space-8);
}

.w-full {
  width: 100%;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-6) 0;
}

/* ===== PAGE-SPECIFIC STYLES ===== */
.flow-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.flow-page main {
  flex: 1;
  padding: var(--space-8) 0 var(--space-10);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 var(--space-4);
}

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

.form-grid--zip {
  grid-template-columns: 140px 1fr;
}

/* ===== DARK MODE ===== */

/* System dark mode */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #000000;
    --color-surface: #1c1c1e;
    --color-surface-2: #2c2c2e;
    --color-surface-3: #3a3a3c;
    --color-border: rgba(255, 255, 255, 0.10);
    --color-border-strong: rgba(255, 255, 255, 0.18);
    --color-text: #f5f5f7;
    --color-text-2: #d1d1d6;
    --color-text-3: #8e8e93;
    --color-text-4: #48484a;
    --color-primary: #409cff;
    --color-primary-dark: #5aa9ff;
    --color-primary-light: #70b7ff;
    --color-success: #32d74b;
    --color-error: #ff453a;
    --color-warning: #ff9f0a;
    --color-info: #409cff;
    --gradient-primary: linear-gradient(135deg, #409cff 0%, #0071e3 100%);
    --gradient-primary-hover: linear-gradient(135deg, #5aa9ff 0%, #1a80e8 100%);
    --gradient-surface: linear-gradient(180deg, #1c1c1e 0%, #2c2c2e 100%);
    --gradient-hero: linear-gradient(180deg, #000000 0%, #1c1c1e 100%);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.50), 0 1px 2px rgba(0, 0, 0, 0.40);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.50), 0 2px 6px rgba(0, 0, 0, 0.40);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.60), 0 4px 12px rgba(0, 0, 0, 0.50);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.70), 0 8px 24px rgba(0, 0, 0, 0.60);
  }
}

/* Manual dark mode override via data-theme attribute */
[data-theme="dark"] {
  --color-bg: #000000;
  --color-surface: #1c1c1e;
  --color-surface-2: #2c2c2e;
  --color-surface-3: #3a3a3c;
  --color-border: rgba(255, 255, 255, 0.10);
  --color-border-strong: rgba(255, 255, 255, 0.18);
  --color-text: #f5f5f7;
  --color-text-2: #d1d1d6;
  --color-text-3: #8e8e93;
  --color-text-4: #48484a;
  --color-primary: #409cff;
  --color-primary-dark: #5aa9ff;
  --color-primary-light: #70b7ff;
  --color-success: #32d74b;
  --color-error: #ff453a;
  --color-warning: #ff9f0a;
  --color-info: #409cff;
  --gradient-primary: linear-gradient(135deg, #409cff 0%, #0071e3 100%);
  --gradient-primary-hover: linear-gradient(135deg, #5aa9ff 0%, #1a80e8 100%);
  --gradient-surface: linear-gradient(180deg, #1c1c1e 0%, #2c2c2e 100%);
  --gradient-hero: linear-gradient(180deg, #000000 0%, #1c1c1e 100%);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.50), 0 1px 2px rgba(0, 0, 0, 0.40);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.50), 0 2px 6px rgba(0, 0, 0, 0.40);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.60), 0 4px 12px rgba(0, 0, 0, 0.50);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.70), 0 8px 24px rgba(0, 0, 0, 0.60);
}

/* Dark mode specific overrides */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .navbar {
    border-bottom-color: rgba(255, 255, 255, 0.08);
  }
  :root:not([data-theme="light"]) .field__input,
  :root:not([data-theme="light"]) .field__select,
  :root:not([data-theme="light"]) .field__textarea {
    background: var(--color-surface-2);
    color: var(--color-text);
  }
  :root:not([data-theme="light"]) .letter-preview {
    background: #1a1a1c;
    border-color: rgba(255, 255, 255, 0.10);
    color: #e8e8ed;
  }
  :root:not([data-theme="light"]) .letter-preview::before {
    background: var(--color-surface-3);
  }
  :root:not([data-theme="light"]) select option {
    background: var(--color-surface-2);
    color: var(--color-text);
  }
}

[data-theme="dark"] .navbar {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .field__input,
[data-theme="dark"] .field__select,
[data-theme="dark"] .field__textarea {
  background: var(--color-surface-2);
  color: var(--color-text);
}
[data-theme="dark"] .letter-preview {
  background: #1a1a1c;
  border-color: rgba(255, 255, 255, 0.10);
  color: #e8e8ed;
}
[data-theme="dark"] .letter-preview::before {
  background: var(--color-surface-3);
}
[data-theme="dark"] select option {
  background: var(--color-surface-2);
  color: var(--color-text);
}

/* Dark mode toggle button */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-full);
  color: var(--color-text-3);
  font-size: 18px;
  line-height: 1;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

.theme-toggle:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

/* ===== END OF CSS ===== */
