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

* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

  :root {
    --sage: #4a7c59;
    --sage-light: #6a9e78;
    --sage-pale: #e8f0ea;
    --sage-ultra: #f2f6f3;
    --warm: #f7f3ee;
    --ink: #1e2820;
    --ink-mid: #3d4f42;
    --ink-soft: #6b7d6f;
    --gold: #b8955a;
    --gold-light: #d4b07a;
    --border: #c8d8cc;
    --red: #c0392b;
    --white: #ffffff;
    --radius: 12px;
    --shadow: 0 2px 16px rgba(30,40,32,0.08);
  }

  * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

  body {
    font-family: 'Source Sans 3', sans-serif;
    background: var(--warm);
    color: var(--ink);
    min-height: 100vh;
    font-size: 16px;
  }

  /* ── HEADER ── */
  .header {
    background: var(--ink);
    padding: 14px 16px 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 20px rgba(0,0,0,0.3);
  }
  .header-logo {
    display: flex;
    align-items: center;
    gap: 14px;
  }
  .header-paw {
    width: 36px;
    height: 36px;
    background: var(--sage);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
  }
  .header-text h1 {
    font-family: 'Playfair Display', serif;
    color: white;
    font-size: 17px;
    font-weight: 600;
    line-height: 1;
  }
  .header-text p {
    color: var(--sage-light);
    font-size: 10px;
    margin-top: 2px;
    font-weight: 300;
  }
  .progress-wrap {
    text-align: right;
  }
  .progress-label {
    color: rgba(255,255,255,0.5);
    font-size: 11px;
    margin-bottom: 5px;
  }
  .progress-bar {
    width: 72px;
    height: 4px;
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
    overflow: hidden;
  }
  .progress-fill {
    height: 100%;
    background: var(--sage-light);
    border-radius: 2px;
    transition: width 0.4s ease;
    width: 0%;
  }

  /* ── STEPS ── */
  .steps-nav {
    display: flex;
    background: var(--ink-mid);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .steps-nav::-webkit-scrollbar { display: none; }
  .step-tab {
    flex: 1;
    min-width: 0;
    padding: 8px 4px;
    text-align: center;
    font-size: 10px;
    color: rgba(255,255,255,0.45);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .step-tab.active {
    color: white;
    border-bottom-color: var(--sage-light);
    background: rgba(255,255,255,0.05);
  }
  .step-tab.done {
    color: var(--sage-light);
  }
  .step-tab .step-num {
    display: block;
    font-size: 9px;
    opacity: 0.6;
    margin-bottom: 2px;
  }

  /* ── CONTAINER ── */
  .container {
    width: 100%;
    max-width: 100%;
    padding: 0 14px 100px;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  /* ── SECTION ── */
  .page { display: none; }
  .page.active { display: block; }

  .section-header {
    padding: 28px 0 6px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
  }
  .section-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 26px;
    color: var(--ink);
    font-weight: 600;
  }
  .section-header p {
    color: var(--ink-soft);
    font-size: 14px;
    margin-top: 4px;
  }

  .card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(200,216,204,0.5);
    width: 100%;
    box-sizing: border-box;
  }
  .card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--sage);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .card-title::before {
    content: '';
    width: 3px;
    height: 14px;
    background: var(--sage);
    border-radius: 2px;
    display: inline-block;
  }

  /* ── FORM FIELDS ── */
  .field-row {
    display: grid;
    gap: 14px;
    margin-bottom: 14px;
  }
  .field-row.cols-2 { grid-template-columns: 1fr 1fr; }
  .field-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
  .field-row.cols-auto { grid-template-columns: auto 1fr 1fr; }

  .field {
    display: flex;
    flex-direction: column;
    gap: 5px;
  }
  .field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  .field label .req {
    color: var(--red);
    margin-left: 2px;
  }
  .field input,
  .field textarea,
  .field select {
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 16px;
    font-family: 'Source Sans 3', sans-serif;
    color: var(--ink);
    background: var(--sage-ultra);
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
    -webkit-appearance: none;
  }
  .field input:focus,
  .field textarea:focus,
  .field select:focus {
    outline: none;
    border-color: var(--sage);
    box-shadow: 0 0 0 3px rgba(74,124,89,0.12);
    background: white;
  }
  .field textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
  }
  .field input.invalid {
    border-color: var(--red);
    background: #fdf3f2;
  }

  /* ── RADIO / CHECKBOX ── */
  .radio-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
  }
  .radio-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    color: var(--ink-mid);
    background: var(--sage-ultra);
    transition: all 0.15s;
    user-select: none;
  }
  .radio-btn input { display: none; }
  .radio-btn.selected {
    border-color: var(--sage);
    background: var(--sage-pale);
    color: var(--sage);
    font-weight: 600;
  }
  .radio-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid currentColor;
    position: relative;
    flex-shrink: 0;
  }
  .radio-btn.selected .radio-dot::after {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--sage);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
  }

  .check-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    background: var(--sage-ultra);
    border-radius: 8px;
    border: 1.5px solid var(--border);
    cursor: pointer;
    margin-bottom: 10px;
    transition: all 0.15s;
  }
  .check-row:hover { border-color: var(--sage-light); }
  .check-row.checked {
    border-color: var(--sage);
    background: var(--sage-pale);
  }
  .check-box {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 5px;
    flex-shrink: 0;
    margin-top: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    transition: all 0.15s;
  }
  .check-row.checked .check-box {
    background: var(--sage);
    border-color: var(--sage);
    color: white;
  }
  .check-row.checked .check-box::after {
    content: '✓';
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
  }
  .check-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink-mid);
  }
  .check-text strong { color: var(--ink); }

  /* ── TERMINABSAGEN PAGE ── */
  .policy-box {
    background: white;
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(200,216,204,0.5);
    margin-bottom: 20px;
    max-height: 420px;
    overflow-y: auto;
    font-size: 15px;
    line-height: 1.8;
    color: var(--ink-mid);
  }
  .policy-box h3 {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    color: var(--ink);
    margin-bottom: 16px;
    text-align: center;
  }
  .policy-box p { margin-bottom: 14px; }
  .policy-highlight {
    background: #fff8e8;
    border-left: 4px solid var(--gold);
    padding: 14px 16px;
    border-radius: 0 8px 8px 0;
    margin: 16px 0;
    font-weight: 500;
    color: var(--ink);
  }
  .scroll-hint {
    text-align: center;
    color: var(--ink-soft);
    font-size: 13px;
    margin-top: 8px;
    margin-bottom: 20px;
  }

  /* ── SIGNATURE ── */
  .sig-wrap {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(200,216,204,0.5);
    margin-bottom: 16px;
  }
  .sig-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
  }
  .sig-canvas-wrap {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: 10px;
    background: var(--sage-ultra);
    overflow: hidden;
  }
  .sig-canvas-wrap.has-sig {
    border-style: solid;
    border-color: var(--sage);
  }
  canvas.sig-canvas {
    display: block;
    width: 100%;
    height: 160px;
    cursor: crosshair;
    touch-action: none;
  }
  .sig-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    color: var(--ink-soft);
    gap: 8px;
    transition: opacity 0.2s;
  }
  .sig-placeholder span { font-size: 13px; }
  .sig-clear {
    margin-top: 8px;
    background: none;
    border: none;
    color: var(--ink-soft);
    font-size: 13px;
    cursor: pointer;
    font-family: 'Source Sans 3', sans-serif;
    text-decoration: underline;
    padding: 4px;
  }
  .sig-clear:hover { color: var(--red); }

  /* ── DATEPICKER ── */
  .ort-date {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }

  /* ── NAV BUTTONS ── */
  .nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--border);
    padding: 14px 20px;
    display: flex;
    gap: 12px;
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  }
  .btn {
    flex: 1;
    padding: 15px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Source Sans 3', sans-serif;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
  }
  .btn-back {
    background: var(--sage-ultra);
    color: var(--ink-mid);
    border: 1.5px solid var(--border);
    flex: 0 0 100px;
  }
  .btn-back:active { opacity: 0.7; }
  .btn-next {
    background: var(--sage);
    color: white;
    box-shadow: 0 4px 14px rgba(74,124,89,0.35);
  }
  .btn-next:active { transform: scale(0.98); }
  .btn-pdf {
    background: var(--ink);
    color: white;
    box-shadow: 0 4px 14px rgba(0,0,0,0.2);
  }
  .btn-pdf:active { transform: scale(0.98); }
  .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
  }

  /* ── SUCCESS ── */
  .success-screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 40px 20px;
  }
  .success-screen.active { display: flex; }
  .success-circle {
    width: 100px;
    height: 100px;
    background: var(--sage-pale);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    margin-bottom: 24px;
    border: 3px solid var(--sage-light);
  }
  .success-screen h2 {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    color: var(--ink);
    margin-bottom: 10px;
  }
  .success-screen p {
    color: var(--ink-soft);
    font-size: 15px;
    max-width: 320px;
    line-height: 1.6;
    margin-bottom: 28px;
  }
  .btn-restart {
    padding: 14px 32px;
    background: var(--sage-ultra);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-family: 'Source Sans 3', sans-serif;
    color: var(--ink-mid);
    cursor: pointer;
    font-weight: 500;
  }

  /* ── SEND OVERLAY ── */
  .send-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(30,40,32,0.7);
    z-index: 500;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 18px;
  }
  .send-overlay.visible { display: flex; }
  .send-card {
    background: white;
    border-radius: 18px;
    padding: 36px 40px;
    text-align: center;
    max-width: 320px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  }
  .send-spinner {
    width: 52px;
    height: 52px;
    border: 4px solid var(--sage-pale);
    border-top-color: var(--sage);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin: 0 auto 18px;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  .send-card h3 {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    color: var(--ink);
    margin-bottom: 8px;
  }
  .send-card p { font-size: 14px; color: var(--ink-soft); line-height: 1.5; }
  .send-success-icon { font-size: 48px; margin-bottom: 12px; }

  /* ── CONFIG BANNER ── */
  .config-banner {
    background: #fff3cd;
    border: 1.5px solid #f0c050;
    border-radius: 10px;
    padding: 14px 16px;
    margin: 16px 0 0;
    font-size: 13px;
    color: #7a5c00;
    line-height: 1.6;
    display: none;
  }
  .config-banner.visible { display: block; }
  .config-banner strong { color: #5a4000; }
  .config-banner code {
    background: rgba(0,0,0,0.08);
    border-radius: 4px;
    padding: 1px 5px;
    font-family: monospace;
    font-size: 12px;
  }

  .error-msg {    background: #fdf3f2;
    border: 1px solid #e8b4b0;
    color: var(--red);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    margin-bottom: 14px;
    display: none;
  }
  .error-msg.visible { display: block; }

  @media (max-width: 768px) {
    .field-row,
    .field-row.cols-2,
    .field-row.cols-3,
    .field-row.cols-auto {
      grid-template-columns: 1fr !important;
    }

    .field[style*="flex:0 0 120px"],
    .field[style*="flex: 0 0 120px"] {
      flex: 1 1 100% !important;
      width: 100%;
    }

    .ort-date {
      grid-template-columns: 1fr !important;
    }

    .radio-group {
      flex-direction: column;
      gap: 8px;
    }
    .radio-btn {
      width: 100%;
      justify-content: flex-start;
      padding: 13px 16px;
    }

    .section-header h2 {
      font-size: 20px;
    }

    .policy-box {
      max-height: 300px;
      padding: 18px;
      font-size: 14px;
    }

    .nav-bar {
      padding: 10px 14px;
      padding-bottom: max(14px, env(safe-area-inset-bottom));
    }
    .btn {
      padding: 14px 10px;
      font-size: 15px;
    }
    .btn-back {
      flex: 0 0 88px;
    }
  }
