/* Layout & Grundstil */
:root{
  --bg:#f9fafb;
  --text:#111827;
  --muted:#6b7280;
  --border:#e5e7eb;
  --brand:#a48213;
  --brand-hover:#68530d;
  --danger-bg:#fee2e2;
  --danger:#991b1b;
  --card:#ffffff;
  --head:#a48213;
  --radius: 8px;
}

*{ box-sizing:border-box; }
html{
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html,body{ margin:0; padding:0; }
body{
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height:1.6;
  font-size: clamp(16px, 1.5vw + 0.9rem, 20px);
}

.container{
  max-width:1100px;
  margin: 0 auto;
  padding: clamp(16px, 2.2vw, 24px);
}

h1{
  margin: 0 0 18px;
  color:#333;
  font-size: clamp(22px, 2.5vw + 1rem, 34px);
  line-height: 1.2;
  letter-spacing: -0.01em;
}
h2{
  background: var(--head);
  color:#fff;
  padding: 10px 14px;
  border-radius: 6px;
  margin: 28px 0 12px;
  font-size: clamp(18px, 1.2vw + 0.9rem, 22px);
}

/* Topbar */
.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:10px 20px;
  background:#fff;
  border-bottom:1px solid var(--border);
  position:sticky;
  top:0;
  z-index:10;
}
.topbar .brand img{ max-height:48px; }
.toplinks{ display:flex; gap:8px; flex-wrap:wrap; }

/* Buttons & Links */
.btn-primary{
  background: var(--brand);
  color:#fff;
  padding: 12px 18px;
  border:none;
  border-radius: 8px;
  cursor:pointer;
  font-size: clamp(16px, 0.6vw + 0.95rem, 18px);
  line-height: 1;
  min-height: 44px;
}
.btn-primary:hover{ background: var(--brand-hover); }

.btn-link{
  display:inline-block;
  padding:10px 16px;
  background:#6b7280;
  color:#fff;
  border-radius: 8px;
  text-decoration:none;
  font-size: clamp(14px, 0.5vw + 0.85rem, 16px);
  line-height: 1;
  min-height: 40px;
}
.btn-link:hover{ filter:brightness(0.95); }

/* Fokus */
:focus-visible{
  outline: 3px solid rgba(164,130,19,.45);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Alerts */
.alert{
  padding:12px 14px;
  border-radius:8px;
  margin-bottom:16px;
  font-size: clamp(14px, 0.4vw + 0.9rem, 17px);
}
.alert.error{
  background: var(--danger-bg);
  color: var(--danger);
}

/* Form */
.two-col{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
}
.mt-8{ margin-top:8px; }
@media (max-width: 900px){
  .two-col{ grid-template-columns:1fr; }
}

label{ font-weight: 600; font-size: clamp(14px, 0.4vw + 0.85rem, 16px); }

/* Eingaben */
input[type=text], input[type=email], input[type=date], select, textarea{
  width:100%;
  padding: 12px 14px;
  margin-top:6px;
  border:1px solid #cfd3da;
  border-radius: 8px;
  background:#fff;
  font-size: 16px;        /* >=16px verhindert iOS-Zoom */
  line-height: 1.3;
  min-height: 44px;
}
input::placeholder, textarea::placeholder{ color:#9aa3af; }

/* Tabellen/Listen */
.table-wrap{
  overflow-x:auto;
  background:#fff;
  border-radius:10px;
  border:1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0,0,0,0.02);
}
table{ width:100%; border-collapse:collapse; }
th, td{
  padding: 12px;
  border-bottom:1px solid var(--border);
  vertical-align:top;
  font-size: clamp(14px, 0.35vw + 0.9rem, 16px);
}
th{
  background:#f3f4f6;
  text-align:left;
  font-weight:700;
}

/* Menge/Einheit/Wunsch-Zeile – schmaler */
.qty-unit{
  display:grid;
  grid-template-columns: 120px 130px 1fr;
  gap:10px;
  align-items:center;
}
.qty-input, .wish-input{ width:100%; }

small.muted{ color:var(--muted); font-size: clamp(12px, 0.3vw + 0.7rem, 14px); }
.field-error{ color:var(--danger); font-size: clamp(13px, 0.3vw + 0.8rem, 15px); margin-top:6px; }

/* Row highlight */
tr.highlight{ background:#fef9c3; }

/* Form Actions */
.form-actions{
  display:flex;
  justify-content:flex-end;
  margin:20px 0 8px;
  gap:10px;
}
.form-actions-top{
  position:sticky;
  top:64px;
  z-index:9;
  background:rgba(249,250,251,0.9);
  backdrop-filter: blur(3px);
  padding:10px 0;
  border-bottom:1px dashed var(--border);
  margin-bottom:12px;
}

/* Logo */
.logo-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 0;
}
.logo-bar .site-logo {
  display: block;
  width: clamp(180px, 28vw, 340px);
  height: auto;
}
img[alt="Logo"] {
  display: block;
  margin: 0 auto;
  width: clamp(180px, 28vw, 340px);
  height: auto;
}

/* =========================================
   Mobile-Optimierungen (≤ 700px)
========================================= */
@media (max-width: 700px){

  body{
    line-height: 1.75;
    font-size: 20px;
  }

  .topbar{ padding: 12px 16px; gap: 10px; }
  .toplinks{ gap: 6px; }
  .btn-link{ padding: 10px 14px; }

  .container{ padding: 16px; }

  h1{ font-size: 32px; margin-bottom: 16px; }
  h2{ font-size: 24px; padding: 12px 14px; }

  label{ font-size: 18px; }

  input[type=text], input[type=email], input[type=date], select, textarea{
    padding: 16px 18px;
    border-radius: 12px;
    min-height: 54px;
    font-size: 18px;
  }

  .table-wrap{ border-radius: 12px; }
  th, td{ padding: 14px 12px; font-size: 18px; }

  /* Tabelle als Kartenliste */
  table{ border-collapse: separate; border-spacing: 0; }
  thead{ display:none; }
  tbody, tr, td{ display:block; width:100%; }
  tbody > tr{
    background:#fff;
    border:1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    margin: 12px 0;
  }
  tbody > tr td{ border-bottom:none; padding: 8px 0; }
  tbody > tr td:first-child{
    font-weight: 700;
    font-size: 20px;
    margin-bottom: 6px;
  }

  .qty-unit{ grid-template-columns: 1fr; gap: 12px; }
  .qty-input, .wish-input{ font-size: 18px; }

  .form-actions,
  .form-actions-top{ justify-content: center; }
  .form-actions-top{ top: 56px; }

  .btn-primary{
    width: 100%;
    font-size: 20px;
    min-height: 54px;
  }

  small.muted{ font-size: 16px; }
  .field-error{ font-size: 17px; }
}

/* Sehr kleine Phones (≤ 380px) */
@media (max-width: 380px){
  body{ font-size: 21px; }
  h1{ font-size: 34px; }
  h2{ font-size: 24px; }
  th, td{ font-size: 19px; }
  .btn-primary{ font-size: 21px; min-height: 56px; }
  input[type=text],
  input[type=email],
  input[type=date],
  select,
  textarea{ font-size: 19px; min-height: 56px; }
}

/* Sanfte Übergänge */
@media (prefers-reduced-motion: no-preference){
  .btn-primary, .btn-link, input, select, textarea, .table-wrap, tbody > tr{
    transition: box-shadow .2s ease, transform .08s ease, background-color .2s ease, border-color .2s ease, filter .2s ease;
  }
  .btn-primary:active{ transform: translateY(1px); }
}

/* Hover auf Desktop */
@media (hover: hover){
  .btn-primary:hover{ box-shadow: 0 4px 12px rgba(164,130,19,.2); }
  tbody > tr:hover{ box-shadow: 0 1px 12px rgba(0,0,0,.06); }
}

/* ===============================
   iOS Safari Boost (extern)
   =============================== */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 700px) {
    html, body { font-size: 21px !important; line-height: 1.8; }
    h1 { font-size: 34px !important; }
    h2 { font-size: 24px !important; }
    input[type=text],
    input[type=email],
    input[type=date],
    select,
    textarea { font-size: 19px !important; min-height: 56px; }
    .btn-primary { font-size: 21px !important; min-height: 56px; }
    th, td { font-size: 19px !important; }
  }
}
