﻿/* ═══════════════════════════════════════════
       0. Custom Properties
       ═══════════════════════════════════════════ */
    :root {
      --accent:       #f59e0b;
      --accent-light: #fef3c7;
      --accent-dark:  #b45309;
      --accent-text:  #78350f;
      --text:         #1e293b;
      --text-mid:     #475569;
      --text-light:   #64748b;
      --bg:           #ffffff;
      --bg-page:      #f8fafc;
      --bg-alt:       #f1f5f9;
      --border:       #e2e8f0;
      --border-light: #f1f5f9;
      --radius:       12px;
      --radius-sm:    8px;
      --shadow-sm:    0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
      --shadow-md:    0 4px 16px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
      --shadow-lg:    0 8px 30px rgba(0,0,0,0.08);
      --focus-ring:   0 0 0 3px rgba(245,158,11,0.45);
      --transition:   0.2s ease;
      --content-max:  1080px;
      --error:        #dc2626;
      --error-light:  #fef2f2;
      --success:      #16a34a;
      --success-light:#f0fdf4;
    }

    /* ═══════════════════════════════════════════
       1. Reset & Base
       ═══════════════════════════════════════════ */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    html {
      scroll-behavior: smooth;
      scroll-padding-top: 24px;
    }

    body {
      background: var(--bg-page);
      color: var(--text);
      font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
      font-size: clamp(15px, 1vw + 12px, 17px);
      line-height: 1.75;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      text-rendering: optimizeLegibility;
    }

    /* ═══════════════════════════════════════════
       2. Skip Link (WCAG 2.4.1)
       ═══════════════════════════════════════════ */
    .skip-link {
      position: absolute;
      top: -100%;
      left: 16px;
      z-index: 9999;
      padding: 12px 24px;
      background: var(--text);
      color: #fff;
      border-radius: var(--radius-sm);
      font-weight: 600;
      font-size: 0.9rem;
      text-decoration: none;
      transition: top var(--transition);
    }
    .skip-link:focus { top: 16px; }

    /* ═══════════════════════════════════════════
       3. Reading Progress Bar
       ═══════════════════════════════════════════ */
    .progress-bar {
      position: fixed;
      top: 0;
      left: 0;
      width: 0%;
      height: 3px;
      background: linear-gradient(90deg, var(--accent), var(--accent-dark));
      z-index: 1000;
      transition: width 60ms linear;
      border-radius: 0 2px 2px 0;
    }

    /* ═══════════════════════════════════════════
       4. Page Layout
       ═══════════════════════════════════════════ */
    .bm-page {
      max-width: var(--content-max);
      margin: 0 auto;
      padding: 40px clamp(16px, 4vw, 48px) 64px;
    }

    /* ═══════════════════════════════════════════
       5. Hero Header
       ═══════════════════════════════════════════ */
    .bm-hero {
      text-align: center;
      margin-bottom: 36px;
      padding-bottom: 28px;
      border-bottom: 2px solid var(--accent);
    }
    .bm-hero h1 {
      font-size: clamp(1.5rem, 2.5vw + 0.5rem, 2rem);
      font-weight: 800;
      color: var(--text);
      letter-spacing: -0.025em;
      line-height: 1.25;
      margin-bottom: 8px;
    }
    .bm-hero .company {
      font-size: 1rem;
      font-weight: 600;
      color: var(--accent-dark);
      margin-bottom: 4px;
    }
    .bm-hero .subtitle {
      font-size: 0.92rem;
      color: var(--text-mid);
      max-width: 600px;
      margin: 8px auto 0;
      line-height: 1.7;
    }

    /* ═══════════════════════════════════════════
       6. Two-Column Layout (Form + Sidebar)
       ═══════════════════════════════════════════ */
    .bm-layout {
      display: grid;
      grid-template-columns: 1fr 340px;
      gap: 32px;
      align-items: start;
    }

    /* ═══════════════════════════════════════════
       7. Form Card
       ═══════════════════════════════════════════ */
    .bm-form-card {
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      overflow: hidden;
    }

    .bm-form-header {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 18px 24px 14px;
      border-bottom: 1px solid var(--border-light);
      background: linear-gradient(135deg, var(--accent-light) 0%, var(--bg) 70%);
    }
    .bm-form-header h2 {
      font-size: 1.1rem;
      font-weight: 700;
      color: var(--text);
      margin: 0;
    }
    .bm-form-header .badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 38px;
      height: 32px;
      padding: 0 10px;
      border-radius: var(--radius-sm);
      background: var(--accent-light);
      color: var(--accent-text);
      font-size: 0.78rem;
      font-weight: 800;
      flex-shrink: 0;
      white-space: nowrap;
      border: 1px solid rgba(245,158,11,0.25);
    }

    .bm-form-body {
      padding: 24px;
    }

    /* ═══════════════════════════════════════════
       8. Form Styles
       ═══════════════════════════════════════════ */
    .form-intro {
      font-size: 0.92rem;
      color: var(--text-mid);
      line-height: 1.7;
      margin-bottom: 24px;
    }

    .form-group {
      margin-bottom: 20px;
    }

    .form-group-title {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 0.82rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      color: var(--accent-dark);
      margin-bottom: 16px;
      padding-bottom: 8px;
      border-bottom: 1px solid var(--border);
    }
    .form-group-title .group-icon {
      font-size: 1.1rem;
    }

    .form-label {
      display: block;
      font-size: 0.9rem;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 6px;
      line-height: 1.5;
    }
    .form-label .required {
      color: var(--error);
      margin-left: 2px;
    }
    .form-label .optional {
      font-weight: 400;
      color: var(--text-light);
      font-size: 0.85em;
    }

    .form-hint {
      display: block;
      font-size: 0.82rem;
      color: var(--text-light);
      margin-bottom: 6px;
      line-height: 1.6;
    }

    .form-input,
    .form-textarea,
    .form-select {
      width: 100%;
      padding: 10px 14px;
      font-family: inherit;
      font-size: 0.92rem;
      color: var(--text);
      background: var(--bg);
      border: 1.5px solid var(--border);
      border-radius: var(--radius-sm);
      transition: border-color var(--transition), box-shadow var(--transition);
      line-height: 1.5;
    }
    .form-input:hover,
    .form-textarea:hover,
    .form-select:hover {
      border-color: var(--text-light);
    }
    .form-input:focus,
    .form-textarea:focus,
    .form-select:focus {
      outline: none;
      border-color: var(--accent);
      box-shadow: var(--focus-ring);
    }

    .form-textarea {
      resize: vertical;
      min-height: 140px;
    }

    .form-select {
      appearance: none;
      background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23475569'%3E%3Cpath d='M7 7l3 3 3-3'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 12px center;
      background-size: 16px;
      padding-right: 36px;
      cursor: pointer;
    }

    /* Field row (inline fields) */
    .field-row {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 16px;
    }

    /* Radio / Checkbox group */
    .radio-group,
    .checkbox-group {
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      margin-top: 4px;
    }

    .radio-option,
    .checkbox-option {
      display: flex;
      align-items: center;
      gap: 8px;
      cursor: pointer;
      font-size: 0.9rem;
      color: var(--text);
      padding: 6px 14px;
      border: 1.5px solid var(--border);
      border-radius: var(--radius-sm);
      transition: all var(--transition);
      background: var(--bg);
      -webkit-user-select: none;
      user-select: none;
    }
    .radio-option:hover,
    .checkbox-option:hover {
      border-color: var(--accent);
      background: var(--accent-light);
    }
    .radio-option:has(input:checked),
    .checkbox-option:has(input:checked) {
      border-color: var(--accent);
      background: var(--accent-light);
      color: var(--accent-text);
      font-weight: 600;
    }
    .radio-option:has(input:focus-visible),
    .checkbox-option:has(input:focus-visible) {
      box-shadow: var(--focus-ring);
    }

    .radio-option input,
    .checkbox-option input {
      accent-color: var(--accent-dark);
      width: 16px;
      height: 16px;
      cursor: pointer;
    }

    /* Anonymous toggle */
    .anonymous-toggle {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 14px 16px;
      background: var(--bg-alt);
      border-radius: var(--radius-sm);
      border: 1px solid var(--border);
      margin-bottom: 16px;
      cursor: pointer;
    }
    .anonymous-toggle:hover { border-color: var(--accent); }
    .anonymous-toggle:has(input:focus-visible) { box-shadow: var(--focus-ring); }

    .toggle-switch {
      position: relative;
      width: 44px;
      height: 24px;
      flex-shrink: 0;
    }
    .toggle-switch input {
      opacity: 0;
      width: 0;
      height: 0;
      position: absolute;
    }
    .toggle-slider {
      position: absolute;
      inset: 0;
      background: var(--border);
      border-radius: 24px;
      cursor: pointer;
      transition: background var(--transition);
    }
    .toggle-slider::before {
      content: '';
      position: absolute;
      width: 18px;
      height: 18px;
      left: 3px;
      bottom: 3px;
      background: #fff;
      border-radius: 50%;
      transition: transform var(--transition);
      box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    }
    .toggle-switch input:checked + .toggle-slider { background: var(--accent); }
    .toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }
    .toggle-switch input:focus-visible + .toggle-slider { box-shadow: var(--focus-ring); }

    .toggle-label {
      font-size: 0.9rem;
      font-weight: 600;
      color: var(--text);
      line-height: 1.5;
    }
    .toggle-sublabel {
      font-size: 0.82rem;
      color: var(--text-light);
      font-weight: 400;
    }

    /* Hint box (amber) */
    .hint-box {
      display: flex;
      gap: 12px;
      padding: 14px 16px;
      background: var(--accent-light);
      border-radius: var(--radius-sm);
      border: 1px solid rgba(245,158,11,0.2);
      margin-bottom: 20px;
      font-size: 0.87rem;
      line-height: 1.65;
      color: var(--accent-text);
    }
    .hint-box .hint-icon {
      font-size: 1.2rem;
      flex-shrink: 0;
      margin-top: 1px;
    }
    .hint-box.hidden { display: none; }

    /* Personal data section – collapsible */
    .personal-section {
      transition: opacity 0.3s, max-height 0.3s;
    }
    .personal-section.disabled {
      opacity: 0.45;
      pointer-events: none;
    }

    /* Separator */
    .form-separator {
      height: 1px;
      background: var(--border);
      margin: 24px 0;
      border: none;
    }

    /* Utility classes */
    .hidden { display: none !important; }
    .mb-12 { margin-bottom: 12px; }
    .required-star { color: var(--error); }

    /* Privacy consent row */
    .privacy-label {
      width: 100%;
      border: none;
      padding: 0;
      gap: 12px;
      align-items: flex-start;
    }
    .privacy-label input {
      margin-top: 4px;
    }
    .privacy-label-text {
      font-size: 0.88rem;
      line-height: 1.65;
      color: var(--text-mid);
    }

    /* Sidebar links body compact */
    .sidebar-links-body {
      padding: 8px 0;
    }

    /* Schlichtungsstelle intro */
    .schlichtung-intro {
      font-size: 0.85rem;
      color: var(--text-mid);
      line-height: 1.7;
      margin-bottom: 12px;
    }

    /* Submit button */
    .bm-submit {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      width: 100%;
      padding: 14px 28px;
      background: var(--accent);
      color: var(--accent-text);
      font-family: inherit;
      font-size: 1rem;
      font-weight: 700;
      border: none;
      border-radius: var(--radius-sm);
      cursor: pointer;
      transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
    }
    .bm-submit:hover {
      background: var(--accent-dark);
      color: #fff;
      transform: translateY(-1px);
      box-shadow: var(--shadow-md);
    }
    .bm-submit:active { transform: translateY(0); }
    .bm-submit:focus-visible {
      outline: none;
      box-shadow: var(--focus-ring);
    }
    .bm-submit svg {
      width: 18px;
      height: 18px;
      fill: currentColor;
      flex-shrink: 0;
    }

    /* Success message (hidden by default) */
    .success-message {
      display: none;
      padding: 20px 24px;
      background: var(--success-light);
      border: 2px solid var(--success);
      border-radius: var(--radius);
      text-align: center;
    }
    .success-message.visible { display: block; }
    .success-message h3 {
      font-size: 1.1rem;
      color: var(--success);
      margin-bottom: 8px;
    }
    .success-message p {
      color: var(--text-mid);
      font-size: 0.92rem;
      line-height: 1.7;
    }

    /* ═══════════════════════════════════════════
       9. Sidebar
       ═══════════════════════════════════════════ */
    .bm-sidebar {
      display: flex;
      flex-direction: column;
      gap: 20px;
      position: sticky;
      top: 20px;
      align-self: start;
    }

    .sidebar-card {
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      overflow: hidden;
      transition: box-shadow var(--transition);
    }
    .sidebar-card:hover { box-shadow: var(--shadow-sm); }

    .sidebar-card-header {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 14px 18px 12px;
      border-bottom: 1px solid var(--border-light);
      background: var(--bg-alt);
    }
    .sidebar-card-header .sidebar-icon {
      font-size: 1.2rem;
      flex-shrink: 0;
    }
    .sidebar-card-header h3 {
      font-size: 0.9rem;
      font-weight: 700;
      color: var(--text);
      margin: 0;
    }

    .sidebar-card-body {
      padding: 16px 18px 20px;
    }

    .contact-row {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      padding: 8px 0;
      border-bottom: 1px solid var(--border-light);
      font-size: 0.88rem;
      line-height: 1.6;
    }
    .contact-row:last-child { border-bottom: none; }
    .contact-row .contact-icon {
      flex-shrink: 0;
      font-size: 1rem;
      margin-top: 2px;
    }
    .contact-row .contact-label {
      font-weight: 600;
      color: var(--text);
      display: block;
      margin-bottom: 2px;
    }
    .contact-row .contact-value {
      color: var(--text-mid);
    }
    .contact-row a {
      color: var(--accent-dark);
      text-decoration: underline;
      text-decoration-color: rgba(180,83,9,0.3);
      text-underline-offset: 3px;
      transition: text-decoration-color var(--transition);
    }
    .contact-row a:hover { text-decoration-color: var(--accent-dark); }
    .contact-row a:focus-visible {
      outline: none;
      box-shadow: var(--focus-ring);
      border-radius: 2px;
    }

    /* Sidebar links */
    .sidebar-link {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 14px;
      font-size: 0.88rem;
      font-weight: 500;
      color: var(--text);
      text-decoration: none;
      border-radius: var(--radius-sm);
      transition: all var(--transition);
      border-bottom: 1px solid var(--border-light);
    }
    .sidebar-link:last-child { border-bottom: none; }
    .sidebar-link:hover {
      background: var(--accent-light);
      color: var(--accent-dark);
    }
    .sidebar-link:focus-visible {
      outline: none;
      box-shadow: var(--focus-ring);
    }
    .sidebar-link .link-icon {
      font-size: 1rem;
      flex-shrink: 0;
    }
    .sidebar-link .link-arrow {
      margin-left: auto;
      color: var(--text-light);
      font-size: 0.9rem;
    }

    /* ═══════════════════════════════════════════
       10. Footer
       ═══════════════════════════════════════════ */
    .bm-footer {
      text-align: center;
      margin-top: 48px;
      padding-top: 28px;
      border-top: 2px solid var(--accent);
    }
    .bm-footer .company-name {
      font-weight: 700;
      font-size: 1rem;
      color: var(--text);
      margin-bottom: 8px;
    }
    .bm-footer .contact-info {
      color: var(--text-mid);
      font-size: 0.9rem;
      line-height: 1.9;
    }
    .bm-footer .contact-info a {
      color: var(--accent-dark);
      text-decoration: underline;
      text-decoration-color: rgba(180,83,9,0.3);
      text-underline-offset: 3px;
    }
    .bm-footer .contact-info a:hover { text-decoration-color: var(--accent-dark); }
    .bm-footer .contact-info a:focus-visible {
      outline: none;
      box-shadow: var(--focus-ring);
      border-radius: 2px;
    }

    /* ═══════════════════════════════════════════
       11. Back-to-Top Button
       ═══════════════════════════════════════════ */
    .back-to-top {
      position: fixed;
      bottom: 24px;
      right: 20px;
      width: 44px;
      height: 44px;
      border-radius: 50%;
      background: var(--accent);
      color: var(--accent-text);
      border: none;
      cursor: pointer;
      font-size: 1.2rem;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: var(--shadow-md);
      opacity: 0;
      transform: translateY(10px);
      transition: opacity 0.3s, transform 0.3s, background var(--transition);
      z-index: 100;
    }
    .back-to-top.visible { opacity: 1; transform: translateY(0); }
    .back-to-top:hover { background: var(--accent-dark); color: #fff; }
    .back-to-top:focus-visible { outline: none; box-shadow: var(--focus-ring); }
    .back-to-top svg { width: 18px; height: 18px; fill: currentColor; }

    /* ═══════════════════════════════════════════
       12. Focus States (WCAG 2.4.7 / 2.4.11)
       ═══════════════════════════════════════════ */
    :focus-visible {
      outline: 2px solid var(--accent);
      outline-offset: 2px;
    }
    button:focus-visible,
    a:focus-visible {
      outline: none;
      box-shadow: var(--focus-ring);
      border-radius: 4px;
    }

    /* ═══════════════════════════════════════════
       13. Print Styles
       ═══════════════════════════════════════════ */
    @media print {
      .back-to-top, .progress-bar { display: none !important; }
      .bm-layout { display: block !important; }
      .bm-sidebar { display: block !important; position: static !important; margin-top: 24pt; }
      body { font-size: 11pt; line-height: 1.5; color: #000; background: #fff; }
      .bm-form-card, .sidebar-card {
        box-shadow: none !important;
        border: 1px solid #ccc;
        break-inside: avoid;
      }
      .bm-form-header, .sidebar-card-header { background: #f5f5f5 !important; }
      a { color: inherit !important; }
      a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 0.75em;
        color: #666;
      }
      .bm-hero { border-bottom-color: #333; }
      .bm-footer { border-top-color: #333; }
    }

    /* ═══════════════════════════════════════════
       14. Reduced Motion (WCAG 2.3.3)
       ═══════════════════════════════════════════ */
    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
      }
      html { scroll-behavior: auto; }
      .progress-bar { transition: none; }
    }

    /* ═══════════════════════════════════════════
       15. Responsive – Tablet (≤ 1080px)
       ═══════════════════════════════════════════ */
    @media (max-width: 1080px) {
      .bm-layout {
        grid-template-columns: 1fr;
      }
      .bm-sidebar {
        position: static;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
      }
    }

    /* ═══════════════════════════════════════════
       16. Responsive – Mobile (≤ 640px)
       ═══════════════════════════════════════════ */
    @media (max-width: 640px) {
      .bm-page { padding: 24px 16px 48px; }
      .bm-hero { margin-bottom: 24px; padding-bottom: 20px; }
      .bm-hero h1 { font-size: 1.35rem; }

      .bm-form-header { padding: 14px 16px 12px; }
      .bm-form-body { padding: 16px; }

      .field-row { grid-template-columns: 1fr; gap: 16px; }

      .radio-group { flex-direction: column; gap: 8px; }
      .radio-option { width: 100%; }

      .bm-sidebar {
        grid-template-columns: 1fr;
        gap: 12px;
      }

      .back-to-top { width: 40px; height: 40px; bottom: 18px; right: 14px; }
    }

    /* ═══════════════════════════════════════════
       17. Responsive – Small Mobile (≤ 380px)
       ═══════════════════════════════════════════ */
    @media (max-width: 380px) {
      .bm-page { padding: 16px 12px 40px; }
      .bm-form-header { padding: 12px 12px 10px; }
      .bm-form-body { padding: 12px; }
      body { font-size: 14px; }
    }