/* QualiCheck — Hausfarbe #00a7b7 */
:root {
  --primary: #00a7b7;
  --primary-dark: #008a99;
  --primary-soft: #e0f7f9;
  --gruen: #10b981;
  --gelb: #f59e0b;
  --rot: #dc2626;
  --gray: #6b7280;
  --light: #f9fafb;
  --border: #e5e7eb;
  --dark: #1f2937;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--light);
  color: var(--dark);
  font-size: 15px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

/* Header */
.app-header {
  background: linear-gradient(135deg, #00a7b7 0%, #008a99 100%);
  color: white;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo {
  height: 38px;
  width: auto;
  display: block;
  flex-shrink: 0;
}
.brand-text strong { display: block; font-size: 17px; line-height: 1.2; }
.brand-text small { display: block; opacity: 0.9; font-size: 11.5px; }
.env-badge {
  background: rgba(255,255,255,0.18);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-family: monospace;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  background: white;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  position: sticky;
  top: 66px;
  z-index: 40;
}
.tab {
  flex: 1 1 auto;
  min-width: 130px;
  background: none;
  border: 0;
  padding: 12px 14px;
  cursor: pointer;
  color: var(--gray);
  font-size: 14px;
  font-weight: 500;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--primary-soft);
}

/* Main */
main {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px;
}
.view { display: none; }
.view.active { display: block; }
.hidden { display: none !important; }

h1 { font-size: 22px; margin: 4px 0 14px 0; color: var(--dark); }
h2 { font-size: 16px; margin: 0 0 10px 0; color: var(--primary-dark); }

/* Card */
.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.kpi {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow);
}
.kpi-label { font-size: 12px; color: var(--gray); text-transform: uppercase; letter-spacing: 0.4px; }
.kpi-value { font-size: 26px; font-weight: bold; color: var(--primary-dark); }
.kpi-value.warn { color: var(--rot); }
.kpi-value.tiny { font-size: 16px; font-family: monospace; }

/* Forms */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.form-row label {
  font-size: 12px;
  color: var(--gray);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
select, input[type=text], input[type=email], textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
  font-family: inherit;
}
select:focus, input:focus, textarea:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,167,183,0.15);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--dark);
  text-decoration: none;
  transition: all 0.15s;
}
.btn:hover { background: var(--light); border-color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: white; }
.btn-success { background: var(--gruen); border-color: var(--gruen); color: white; }
.btn-success:hover { background: #059669; border-color: #059669; color: white; }
.btn-large { padding: 14px 22px; font-size: 16px; }
.actions-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* Begehungs-Meta */
.bg-meta {
  background: var(--primary-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.badge {
  background: white;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-dark);
  border: 1px solid var(--primary);
}

/* Item-Karte */
.item-card {
  background: white;
  border: 1px solid var(--border);
  border-left: 4px solid var(--gray);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  transition: border-left-color 0.2s;
}
.item-card.gruen { border-left-color: var(--gruen); background: #ecfdf5; }
.item-card.gelb { border-left-color: var(--gelb); background: #fffbeb; }
.item-card.rot { border-left-color: var(--rot); background: #fef2f2; }
.item-bereich {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--gray);
  letter-spacing: 0.5px;
  font-weight: 600;
}
.item-bezeichnung { font-size: 16px; font-weight: 600; margin: 2px 0 8px 0; }
.item-pflicht-marker { color: var(--rot); font-weight: bold; margin-left: 4px; }

/* Ampel-Buttons */
.ampel-row { display: flex; gap: 6px; margin-bottom: 8px; }
.ampel-btn {
  flex: 1;
  padding: 12px 8px;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: white;
  transition: all 0.15s;
  user-select: none;
}
.ampel-btn.gruen { background: #d1fae5; color: #065f46; border-color: transparent; }
.ampel-btn.gelb { background: #fef3c7; color: #92400e; }
.ampel-btn.rot { background: #fee2e2; color: #991b1b; }
.ampel-btn.active.gruen { background: var(--gruen); color: white; border-color: var(--gruen); }
.ampel-btn.active.gelb { background: var(--gelb); color: white; border-color: var(--gelb); }
.ampel-btn.active.rot { background: var(--rot); color: white; border-color: var(--rot); }

.item-extras { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.item-extras .btn { font-size: 12px; padding: 6px 10px; }
.item-card textarea { min-height: 60px; }
.item-photos { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.item-photo {
  width: 60px; height: 60px;
  border-radius: 6px;
  background: var(--border);
  display: grid;
  place-items: center;
  font-size: 11px;
  color: var(--gray);
  background-size: cover;
  background-position: center;
}

/* Score-Display */
.score-display {
  font-size: 32px;
  font-weight: bold;
  text-align: center;
  padding: 18px;
  border-radius: var(--radius);
  margin: 14px 0;
  color: white;
}
.score-display.gruen { background: var(--gruen); }
.score-display.gelb { background: var(--gelb); }
.score-display.rot { background: var(--rot); }

/* Begehungs-Liste & Maßnahmen-Liste */
.list-row {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.list-meta { flex: 1; min-width: 0; }
.list-meta strong { display: block; }
.list-meta small { color: var(--gray); font-size: 12px; }
.score-pill {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
}
.score-pill.gruen { background: var(--gruen); }
.score-pill.gelb { background: var(--gelb); }
.score-pill.rot { background: var(--rot); }
.score-pill.offen { background: var(--gray); }

/* Filter chips */
.filter-row { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.chip {
  padding: 6px 14px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 18px;
  cursor: pointer;
  font-size: 13px;
  color: var(--gray);
  font-weight: 600;
}
.chip.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 16px;
}
.modal-card {
  background: white;
  border-radius: var(--radius);
  padding: 22px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.rec-circle {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--rot);
  color: white;
  display: grid;
  place-items: center;
  font-size: 36px;
  margin: 16px auto;
  opacity: 0.4;
  transition: all 0.15s;
}
.rec-circle.recording {
  opacity: 1;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* Mängel-Zeile */
.maenge-zeile {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.maenge-zeile:last-child { border-bottom: 0; }
.maenge-count {
  background: var(--primary);
  color: white;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
}

/* ── Modus-Toggle (Phase 4) ─────────────────────────────────────────── */
.modus-row { display: flex; flex-direction: column; gap: 6px; }
.modus-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
.modus-opt input[type="radio"] { margin: 0; }
.modus-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.modus-vorschlag { font-size: 12.5px; color: var(--gray); }

.extras-block {
  margin: 8px 0 14px 0;
  padding: 8px 12px;
  background: var(--light);
  border-radius: 6px;
  border: 1px dashed var(--border);
}
.extras-block summary { cursor: pointer; font-size: 13.5px; color: var(--gray); padding: 4px 0; }
.extras-block[open] summary { color: var(--primary-dark); font-weight: 500; margin-bottom: 8px; }

/* ── Modus-Badges ───────────────────────────────────────────────────── */
.badge-modus { font-weight: 600; }
.badge-stichprobe { background: #fef3c7; color: #92400e; }
.badge-voll       { background: var(--primary-soft); color: var(--primary-dark); }

/* ── Info-Box / Workflow / Objekt-Status ────────────────────────────── */
.info-box {
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  padding: 10px 14px;
  border-radius: 4px;
  margin: 12px 0;
  font-size: 14px;
}

.workflow-steps {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0;
  flex-wrap: wrap;
}
.wf-step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  color: var(--gray);
}
.wf-step .wf-num {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--border);
  color: white;
  font-size: 11px;
  font-weight: bold;
  display: inline-flex; align-items: center; justify-content: center;
}
.wf-step.done { background: var(--primary-soft); color: var(--primary-dark); border-color: var(--primary); }
.wf-step.done .wf-num { background: var(--gruen); }

.objekt-status-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.objekt-status-row:last-child { border-bottom: 0; }
.os-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.os-name strong { font-size: 14.5px; }
.os-name small { font-size: 12.5px; }
.os-modus { display: flex; gap: 4px; flex-wrap: wrap; flex-shrink: 0; }

/* Mobile */
@media (max-width: 600px) {
  .app-header { padding: 10px 12px; }
  .brand strong { font-size: 15px; }
  .brand small { font-size: 11px; }
  .tabs .tab { font-size: 12.5px; padding: 10px 8px; min-width: 100px; }
  main { padding: 12px; }
  h1 { font-size: 19px; }
  .kpi-value { font-size: 22px; }
  .ampel-btn { font-size: 13px; padding: 10px 4px; }
}
