/* =========================================================================
   Wind Clean - Digitale Abnahme
   Alle Markenfarben kommen aus /api/config (siehe branding.js) und sind
   hier nur als Fallback hinterlegt - nichts ist hartcodiert verdrahtet.
   ========================================================================= */

:root {
  --color-primary: #4aa6cd;
  --color-secondary: #000000;
  --color-bg: #f4f6f8;
  --color-surface: #ffffff;
  --color-border: #dde3e8;
  --color-text: #1c2529;
  --color-muted: #66757e;
  --color-danger: #c0392b;
  --color-warning: #b7791f;
  --color-success: #1e8e5a;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(16, 32, 40, 0.06);
  --shadow: 0 4px 14px rgba(16, 32, 40, 0.08);
  --space: 16px;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tap-size: 52px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* ------------------------------- Layout ---------------------------------- */

.app-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px var(--space);
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-secondary);
  font-weight: 700;
  text-decoration: none;
  flex-shrink: 0;
}

.brand img {
  height: 34px;
  width: auto;
  display: block;
  color: var(--color-primary);
}

.app-header__spacer { flex: 1; }

.app-header__user {
  font-size: 0.85rem;
  color: var(--color-muted);
  text-align: right;
}

.app-header__user strong { display: block; color: var(--color-text); }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space);
}

.container--narrow { max-width: 720px; }

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--space);
  margin-bottom: var(--space);
}

.card__title {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
}

.card__subtitle {
  margin: 0 0 12px;
  color: var(--color-muted);
  font-size: 0.88rem;
}

.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row--between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.hidden { display: none !important; }

/* -------------------------------- Buttons -------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
  transition: filter 0.15s ease, transform 0.05s ease;
  min-height: 46px;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn--primary { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.btn--primary:hover:not(:disabled) { filter: brightness(0.94); }
.btn--secondary { background: var(--color-secondary); border-color: var(--color-secondary); color: #fff; }
.btn--danger { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }
.btn--ghost { background: transparent; }
.btn--block { width: 100%; }
.btn--lg { min-height: var(--tap-size); padding: 15px 22px; font-size: 1.02rem; }
.btn--sm { min-height: 36px; padding: 7px 12px; font-size: 0.85rem; }

/* -------------------------------- Formulare ------------------------------ */

.field { display: block; margin-bottom: 14px; }
.field__label { display: block; font-size: 0.86rem; font-weight: 600; margin-bottom: 6px; }

input[type='text'],
input[type='email'],
input[type='password'],
input[type='tel'],
input[type='number'],
input[type='date'],
select,
textarea {
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--color-text);
  min-height: 46px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
  border-color: var(--color-primary);
}

textarea { min-height: 96px; resize: vertical; }

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
}
.checkbox input { width: 20px; height: 20px; min-height: 0; }

/* PIN-Eingabe: grosse, klar antippbare Ziffernfelder */
.pin-input {
  font-size: 2rem !important;
  letter-spacing: 0.6em;
  text-align: center;
  font-weight: 700;
  min-height: 64px !important;
}

/* ------------------------------- Tabellen -------------------------------- */

.table-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

table.data th,
table.data td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

table.data th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  white-space: nowrap;
}

table.data tbody tr:hover { background: rgba(74, 166, 205, 0.06); }

/* --------------------------------- Badges -------------------------------- */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.badge--draft { background: #eef1f4; color: var(--color-muted); }
.badge--completed { background: rgba(30, 142, 90, 0.14); color: var(--color-success); }
.badge--confirmed { background: rgba(74, 166, 205, 0.18); color: #2b7fa3; }
.badge--danger { background: rgba(192, 57, 43, 0.12); color: var(--color-danger); }

/* -------------------------------- Checkliste ----------------------------- */

.checklist { list-style: none; margin: 0; padding: 0; }

.checklist__item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.checklist__item.is-checked {
  border-color: var(--color-primary);
  background: rgba(74, 166, 205, 0.08);
}

.checklist__box {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 2px solid var(--color-border);
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: transparent;
  background: #fff;
}

.checklist__item.is-checked .checklist__box {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.checklist__label { font-weight: 600; }
.checklist__hint { font-size: 0.82rem; color: var(--color-muted); }

/* ---------------------------- Foto-Galerie ------------------------------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.gallery__item { position: relative; }

.gallery__item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  display: block;
}

.gallery__remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}

/* ------------------------------ Unterschrift ----------------------------- */

.signature {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  touch-action: none;
  width: 100%;
  display: block;
}

.signature-wrap { position: relative; }

/* --------------------------------- Hinweise ------------------------------ */

.alert {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.9rem;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.alert--error { background: rgba(192, 57, 43, 0.08); border-color: rgba(192, 57, 43, 0.35); color: #8e2b20; }
.alert--success { background: rgba(30, 142, 90, 0.1); border-color: rgba(30, 142, 90, 0.35); color: #16663f; }
.alert--info { background: rgba(74, 166, 205, 0.1); border-color: rgba(74, 166, 205, 0.35); color: #265f79; }

.muted { color: var(--color-muted); }
.small { font-size: 0.84rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.center { text-align: center; }

/* --------------------------------- Tabs ---------------------------------- */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space);
  overflow-x: auto;
}

.tab {
  border: none;
  background: transparent;
  padding: 12px 16px;
  font: inherit;
  font-weight: 600;
  color: var(--color-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.tab.is-active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* -------------------------------- Login ---------------------------------- */

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space);
  background: var(--color-bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 30px 26px;
  border: 1px solid var(--color-border);
}

.auth-card__logo {
  height: 44px;
  margin: 0 auto 18px;
  display: block;
  color: var(--color-primary);
}

/* ------------------------------- Modal ----------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(16, 32, 40, 0.55);
  display: grid;
  place-items: center;
  padding: var(--space);
  z-index: 50;
  overflow-y: auto;
}

.modal__panel {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 720px;
  padding: 22px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

/* ------------------------------ Mobile-Feinschliff ----------------------- */

@media (max-width: 640px) {
  .app-header__user { display: none; }
  .container { padding: 12px; }
  .card { padding: 14px; }
  .btn--lg { width: 100%; }
  table.data { font-size: 0.86rem; }
  table.data th, table.data td { padding: 8px 8px; }
}

@media print {
  .app-header, .btn, .no-print { display: none !important; }
  body { background: #fff; }
}