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

html {
  /* Verhindert horizontales Scrollen / weißen Rand rechts auf Mobile */
  overflow-x: hidden;
}

body {
  font-family: Arial, sans-serif;
  margin: 16px;
  /* Kein overflow-x auf body, kein zoom-Trigger */
  max-width: 100%;
  overflow-x: hidden;
}

h1 { margin: 10px 0 16px; font-size: 20px; }
h2 { margin: 0 0 10px; font-size: 16px; }
label { display:block; margin-top: 10px; font-size: 13px; color:#222; }

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="tel"],
textarea,
select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px; /* Mindestens 16px verhindert Auto-Zoom auf iOS */
  box-sizing: border-box;
}

input[type="file"] {
  width: 100%;
  font-size: 14px;
  box-sizing: border-box;
}

/* iOS Safari: checkbox/radio NICHT aufblasen */
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  padding: 0;
  margin: 0;
}

/* ACK Checkbox größer (iOS) */
.ack input[type="checkbox"]{
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
}

.optional-hint {
  font-size: 11px;
  color: #888;
  font-weight: normal;
}

.row { display:flex; gap:10px; }
.row > div { flex:1; min-width: 0; }
.radio { display:flex; gap:14px; margin-top: 6px; flex-wrap: wrap; }
.radio label { display:flex; align-items:center; gap:6px; margin:0; }

.checklist { display:grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top:10px; }
.checklist label { margin:0; display:flex; gap:8px; align-items:center; }

.small { font-size: 12px; color:#555; margin-top:8px; }
.photos { display:grid; grid-template-columns: 1fr; gap: 10px; }

.btn {
  margin-top: 16px;
  padding: 14px;
  width:100%;
  border:0;
  border-radius:10px;
  background:#111;
  color:#fff;
  font-size:16px;
  cursor: pointer;
  -webkit-appearance: none;
}

@media (min-width: 900px) {
  body { max-width: 900px; margin: 16px auto; }
  .photos { grid-template-columns: 1fr 1fr; }
}

/* Mobile: Rows untereinander */
@media (max-width: 520px) {
  .row { flex-direction: column; }
  .checklist { grid-template-columns: 1fr; }
}

/* ========== ACCORDION ========== */
details.section {
  border: 1px solid #eee;
  border-radius: 10px;
  margin-bottom: 14px;
  overflow: hidden;
  background: #fff;
}
details.section > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 12px;
  font-size: 16px;
  font-weight: 700;
  background: #fafafa;
  user-select: none;
  /* Kein Overflow-Problem auf Safari */
  -webkit-user-select: none;
}
details.section > summary::-webkit-details-marker { display:none; }
details.section > summary::after {
  content: "▾";
  float: right;
  transition: transform .15s ease-in-out;
}
details.section[open] > summary::after { transform: rotate(180deg); }
.section-body { padding: 12px; }

/* ========== SIGNATUREN ========== */
.sig-wrap { margin-top: 10px; }
.sig-pad {
  width: 100%;
  height: 180px;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: #fff;
  touch-action: none;
  display: block;
}
.sig-actions { display:flex; gap:10px; margin-top:10px; }
.sig-btn {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
}

.ack {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #eee;
  border-radius: 10px;
  background: #fafafa;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.ack input { margin-top: 3px; }

/* ========== SCHÄDEN ========== */
.damage-map{
  position:relative;
  border:1px solid #eee;
  border-radius:10px;
  padding:10px;
  background:#fff;
}
.car-svg{ width:100%; height:auto; display:block; pointer-events:none; }

.plus-btn{
  position:absolute;
  right:10px;
  bottom:10px;
  width:44px;
  height:44px;
  border-radius:12px;
  border:1px solid #ddd;
  background:#111;
  color:#fff;
  font-size:24px;
  z-index:5;
  cursor: pointer;
}

.damage-card{
  border:1px solid #eee;
  border-radius:10px;
  padding:10px;
  margin-top:10px;
  background:#fafafa;
}
.damage-card .row{ margin-top:8px; }

.damage-remove{
  border:0;
  border-radius:10px;
  padding:8px 10px;
  background:#111;
  color:#fff;
  cursor:pointer;
}

.hint{ font-size:12px; color:#666; margin-top:8px; }

.marker{
  position:absolute;
  width:34px;
  height:34px;
  border-radius:50%;
  border:3px solid #d00;
  color:#d00;
  font-weight:700;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(255,255,255,0.9);
  touch-action:none;
  user-select:none;
  /* transform zentriert den Marker auf den Klickpunkt */
  transform: translate(-50%, -50%);
}

.car-stage{
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.car-img{
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
}

.marker-layer{
  position: absolute;
  inset: 0;
  z-index: 3;
}

/* ========== FOTO SLOTS ========== */
.mini-btn{
  width:100%;
  padding:10px 12px;
  border:1px solid #ddd;
  border-radius:10px;
  background:#fff;
  font-size:14px;
}

.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.thumb{
  width:92px;
  height:92px;
  border:1px solid #eee;
  border-radius:10px;
  overflow:hidden;
  position:relative;
  background:#fff;
  flex-shrink: 0;
}

.thumb img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.thumb button{
  position:absolute;
  right:4px;
  top:4px;
  width:22px;
  height:22px;
  border-radius:999px;
  border:0;
  background:#111;
  color:#fff;
  font-size:14px;
  line-height:22px;
  padding:0;
  cursor: pointer;
}

/* ========== APP SHELL ========== */
.app-shell { margin:0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; }

.topbar{
  position: sticky; top:0; z-index: 20;
  display:flex; align-items:center; gap:12px;
  padding:12px 14px;
  background:#111; color:#fff;
}
.burger{
  border:1px solid rgba(255,255,255,.25);
  background:transparent; color:#fff;
  border-radius:10px; padding:6px 10px; font-size:18px;
  cursor: pointer;
}
.brand{ font-weight:700; }

.sidebar{
  position: fixed; top: 52px; left: 0;
  width: 260px; height: calc(100vh - 52px);
  background:#f7f7f7; border-right:1px solid #e5e5e5;
  transform: translateX(-100%);
  transition: transform .18s ease;
  z-index: 10;
  /* Verhindert Overflow-Probleme */
  overflow-y: auto;
}
.sidebar.open{ transform: translateX(0); }

.content{
  padding: 14px;
  margin-top: 0;
  /* Kein overflow nach rechts */
  overflow-x: hidden;
  min-width: 0;
}

.nav{ display:flex; flex-direction:column; padding: 10px; gap: 8px; }
.nav-item{
  display:block; padding:10px 12px; border-radius:12px;
  color:#111; text-decoration:none; border:1px solid #e6e6e6; background:#fff;
}
.nav-item.active{ border-color:#111; }

@media (min-width: 980px){
  .sidebar{ transform:none; top:52px; }
  .content{ margin-left: 260px; }
  .burger{ display:none; }
}

.page {
  padding: 16px;
}

.menu-grid {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.menu-card {
  display: block;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid #e5e5e5;
  text-decoration: none;
  color: #111;
  background: #fff;
  transition: 0.2s ease;
}

.menu-card:hover {
  background: #f7f7f7;
}

.brand,
.brand:visited,
.brand:active {
  color: #fff;
  text-decoration: none;
}

/* ========== ORDERS LIST ========== */
.order-list{
  display:flex;
  flex-direction:column;
  gap:12px;
  margin-top:16px;
}

.order-card{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 14px;
  background:#fff;
  border:1px solid #eaeaea;
  border-radius:12px;
  /* Kein Overflow auf kleinen Screens */
  flex-wrap: wrap;
}

.order-title{
  font-size:15px;
  line-height:1.4;
  min-width: 0;
  flex: 1;
}

.order-actions{
  flex:0 0 auto;
}

.handover-btn{
  display:inline-block;
  padding:7px 12px;
  border-radius:10px;
  background:#111;
  color:#fff;
  text-decoration:none;
  font-size:13px;
  border:1px solid #111;
  white-space: nowrap;
}

.handover-btn:hover{
  background:#333;
  border-color:#333;
}

@media (max-width: 520px){
  .order-card{ padding:10px 12px; }
  .handover-btn{ padding:6px 10px; font-size:12px; border-radius:9px; }
}

/* ========== INLINE VALIDATION ========== */
#formErrors.form-errors {
  display: none;
  margin: 14px 0 10px;
  padding: 12px 14px;
  border: 1px solid #ff4d4f;
  border-radius: 10px;
  background: rgba(255, 77, 79, 0.08);
  color: #b10012;
  font-size: 14px;
  line-height: 1.5;
}

#formErrors.form-errors ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

#formErrors.form-errors li {
  margin-bottom: 4px;
}

.field-error {
  border: 2px solid #ff4d4f !important;
  outline: none !important;
  box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.18) !important;
  border-radius: 10px;
}

.radio-group-error {
  border: 2px solid #ff4d4f;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.12);
}

.damage-card-error {
  border: 2px solid #ff4d4f !important;
  border-radius: 14px;
  box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.12);
}

.ack-error {
  border: 2px solid #ff4d4f !important;
  border-radius: 12px;
  box-shadow: 0 0 0 2px rgba(255, 77, 79, 0.12);
}

/* Login-Seite / keine Sidebar */
.no-sidebar {
  margin-left: 0 !important;
}

.nav {
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 8px;
  height: 100%;
}
