/* 089Dach-Branding (Nutzeranfrage 25.08.2026 "fix das design endlich",
 * "erstelle alles kompl neu"): Farben real aus dem Firmen-PDF extrahiert
 * (companies/089dach-gmbh/05_templates/regiebericht.pdf, page.get_drawings()
 * fill=(0.545,0.102,0.102) = #8B1A1A), kein generisches Platzhalter-Theme
 * mehr. Hell statt dunkel -- passt zum Papier-Regiebericht, den die
 * Monteure kennen. */
:root {
  color-scheme: light;
  --bg: #f4f1ef;
  --panel: #ffffff;
  --panel-2: #f7f2f0;
  --border: #e3d9d6;
  --text: #241c1a;
  --muted: #7a6d68;
  --brand: #8b1a1a;
  --brand-dark: #6e1414;
  --accent: #8b1a1a;
  --on-accent: #ffffff;
  --ok: #2e7d4f;
  --warn: #b06a12;
  --err: #b3261e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

header .brand img {
  height: 30px;
  width: auto;
  border-radius: 4px;
  background: #fff;
  padding: 2px 4px;
}

header .brand select {
  width: auto;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid #fff;
  border-radius: 8px;
  background: #fff;
  color: var(--brand);
}
header .brand select option { color: var(--text); }

header h1 {
  font-size: 15px;
  margin: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  flex-shrink: 0;
}

#status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6fe094;
}

body.offline #status-pill .dot { background: #ffb3ac; }
body.offline #status-pill .label::after { content: "Offline"; }
body:not(.offline) #status-pill .label::after { content: "Online"; }

main {
  padding: 16px;
  max-width: 640px;
  margin: 0 auto;
}

.screen { display: none; }
.screen.active { display: block; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(36, 28, 26, 0.06);
}

.card h2 {
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--brand);
  font-size: 13px;
  color: var(--brand);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0 6px;
  font-weight: 500;
}

input, select, textarea {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 16px;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
}

button {
  appearance: none;
  border: none;
  border-radius: 10px;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-top: 14px;
}

button.primary { background: var(--brand); color: var(--on-accent); }
button.primary:active:not(:disabled) { background: var(--brand-dark); }
button.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
button.toggle.active { background: var(--brand); color: var(--on-accent); border-color: var(--brand); }
button.toggle { margin-top: 0; line-height: 1.4; }
button.toggle small { display: block; font-weight: 400; font-size: 11px; opacity: 0.85; margin-top: 2px; }
.row.wrap { flex-wrap: wrap; }
.row.wrap > * { flex: 1 1 auto; }

.az-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  background: var(--panel-2);
}
.az-monteur-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.az-monteur-row label {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.az-monteur-row button {
  margin: 0;
  width: auto;
  padding: 4px 8px;
  font-size: 11px;
  background: transparent;
  border: none;
  color: var(--err);
  font-weight: 600;
}
.az-monteur-select {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
}
.az-block input[data-field="monteurCustom"] { margin-bottom: 10px; }
.az-row { display: flex; gap: 6px; align-items: center; margin-bottom: 0; }
.az-row input { margin: 0; font-size: 14px; padding: 10px; }

#photo-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
#photo-list img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

textarea { resize: vertical; font-family: inherit; }
button.danger { background: var(--err); color: #fff; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button:active:not(:disabled) { transform: scale(0.99); }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.hint { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.5; }
.hint.warn { color: var(--warn); }
.hint.err { color: var(--err); }

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.list-item:last-child { border-bottom: none; }
.list-item .meta { color: var(--muted); font-size: 12px; }

.badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.badge.pending { color: var(--warn); border-color: var(--warn); }
.badge.synced { color: var(--ok); border-color: var(--ok); }
.badge.error { color: var(--err); border-color: var(--err); }

#signature-pad {
  width: 100%;
  height: 220px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: #fff;
  touch-action: none;
  display: block;
}

.top-actions { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.link-btn {
  background: none;
  border: none;
  color: var(--brand);
  text-decoration: underline;
  width: auto;
  padding: 4px;
  font-size: 13px;
  margin-top: 0;
}

footer.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}
footer.tabbar button {
  margin: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  padding: 10px 0 8px;
}
footer.tabbar button.active { color: var(--brand); }
