*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue: #1a73e8;
  --blue-dark: #1557b0;
  --blue-light: #e8f0fd;
  --gray: #666;
  --light: #f8f9fa;
  --border: #dde1e7;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--light);
  color: #222;
  min-height: 100vh;
}

/* ── Header ── */
.app-header {
  background: var(--blue);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(26,115,232,0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}
.app-header .logo {
  width: 36px; height: 36px;
  background: white;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.app-header h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.app-header .subtitle {
  font-size: 11px;
  opacity: 0.8;
  margin-top: 1px;
}

/* ── Progress bar ── */
.progress-bar {
  background: white;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
}
.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
  min-width: 60px;
}
.progress-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 16px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.progress-step.done:not(:last-child)::after,
.progress-step.active:not(:last-child)::after {
  background: var(--blue);
}
.step-circle {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--border);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  position: relative;
  z-index: 1;
  transition: background 0.3s;
}
.progress-step.done .step-circle { background: var(--blue); }
.progress-step.active .step-circle { background: var(--blue); box-shadow: 0 0 0 4px var(--blue-light); }
.step-label {
  font-size: 10px;
  color: var(--gray);
  margin-top: 4px;
  text-align: center;
  line-height: 1.2;
}
.progress-step.active .step-label { color: var(--blue); font-weight: 600; }

/* ── Main content ── */
.main-content {
  padding: 20px;
  max-width: 640px;
  margin: 0 auto;
}

/* ── Card ── */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--blue-light);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title .icon { font-size: 18px; }

/* ── Form elements ── */
.form-group {
  margin-bottom: 14px;
}
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
}
label .required { color: #e53935; margin-left: 2px; }

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  color: #222;
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.12);
}
input[readonly] {
  background: var(--light);
  color: var(--gray);
}

/* ── Row layout ── */
.form-row {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ── Radio buttons ── */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}
.radio-option {
  position: relative;
}
.radio-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}
.radio-option label {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  text-transform: none;
  letter-spacing: 0;
  background: white;
  transition: all 0.2s;
}
.radio-option input[type="radio"]:checked + label {
  border-color: var(--blue);
  background: var(--blue-light);
  color: var(--blue);
  font-weight: 700;
}

/* ── Checkboxes ── */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.checkbox-option {
  position: relative;
}
.checkbox-option input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}
.checkbox-option label {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #333;
  text-transform: none;
  letter-spacing: 0;
  background: white;
  transition: all 0.2s;
}
.checkbox-option input[type="checkbox"]:checked + label {
  border-color: var(--blue);
  background: var(--blue-light);
  color: var(--blue);
  font-weight: 700;
}

/* ── Messung table ── */
.messung-table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1.5px solid var(--border);
}
.messung-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 700px;
  font-size: 13px;
}
.messung-table th {
  background: var(--blue-light);
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 8px 6px;
  text-align: center;
  border: 1px solid #c5d7f8;
}
.messung-table .group-header th {
  background: #d4e3fc;
  font-size: 12px;
  text-transform: none;
  white-space: normal;
  padding: 6px 4px;
  vertical-align: middle;
  line-height: 1.3;
}
.messung-table .col-header th {
  background: var(--blue-light);
  font-size: 10px;
  text-transform: none;
  white-space: normal;
  padding: 4px 3px;
  vertical-align: middle;
  line-height: 1.2;
}
.messung-table td {
  border: 1px solid var(--border);
  padding: 4px;
}
.messung-table td input {
  padding: 6px 4px;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  width: 100%;
  background: transparent;
  min-width: 40px;
}
.messung-table td input:focus {
  background: var(--blue-light);
  outline: 1px solid var(--blue);
}
.messung-table tr:nth-child(even) { background: #fafafa; }
.messung-table td.row-nr {
  text-align: center;
  color: var(--gray);
  font-weight: 700;
  font-size: 12px;
  padding: 0 6px;
  width: 30px;
}
.btn-add-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1.5px dashed var(--blue);
  color: var(--blue);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.2s;
}
.btn-add-row:hover { background: var(--blue-light); }
.btn-remove-row {
  background: none;
  border: none;
  color: #e53935;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  border-radius: 4px;
}

/* ── Signature canvas ── */
.signature-wrap {
  border: 2px solid var(--border);
  border-radius: 10px;
  background: white;
  overflow: hidden;
  position: relative;
}
.signature-wrap canvas {
  display: block;
  width: 100%;
  touch-action: none;
  cursor: crosshair;
}
.signature-controls {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}
.btn-clear-sig {
  background: none;
  border: 1.5px solid var(--border);
  color: var(--gray);
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.signature-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ccc;
  font-size: 15px;
  pointer-events: none;
  text-align: center;
  transition: opacity 0.3s;
}

/* ── Buttons ── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.3px;
}
.btn-primary {
  background: var(--blue);
  color: white;
  box-shadow: 0 3px 10px rgba(26,115,232,0.25);
}
.btn-primary:hover { background: var(--blue-dark); box-shadow: 0 4px 14px rgba(26,115,232,0.35); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { background: #ccc; box-shadow: none; cursor: not-allowed; }
.btn-secondary {
  background: white;
  color: var(--blue);
  border: 2px solid var(--blue);
}
.btn-secondary:hover { background: var(--blue-light); }

.btn-row {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}
.btn-row .btn { flex: 1; }

/* ── Alert / status ── */
.alert {
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-error { background: #fdecea; color: #c62828; border: 1px solid #ffcdd2; }
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.alert-info { background: var(--blue-light); color: var(--blue); border: 1px solid #c5d7f8; }

/* ── Loading spinner ── */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Success screen ── */
.success-screen {
  text-align: center;
  padding: 40px 20px;
}
.success-icon {
  width: 72px; height: 72px;
  background: #e8f5e9;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  margin: 0 auto 20px;
}
.success-screen h2 { color: #2e7d32; font-size: 22px; margin-bottom: 10px; }
.success-screen p { color: var(--gray); font-size: 15px; line-height: 1.5; }

/* ── Expired screen ── */
.expired-screen {
  text-align: center;
  padding: 60px 20px;
}
.expired-icon {
  font-size: 60px;
  margin-bottom: 16px;
}
.expired-screen h2 { color: #e53935; font-size: 22px; margin-bottom: 10px; }
.expired-screen p { color: var(--gray); font-size: 15px; }

/* ── Admin page specifics ── */
.admin-page .card-title { color: #333; }
.admin-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 18px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}
.admin-section-title:first-of-type { border-top: none; margin-top: 0; padding-top: 0; }

/* ── Hidden ── */
.hidden { display: none !important; }

/* ── Responsive tweaks ── */
@media (max-width: 480px) {
  .main-content { padding: 12px; }
  .form-row.cols-3 { grid-template-columns: 1fr 1fr; }
  .btn { padding: 15px; font-size: 15px; }
}
