/* Bauprotokoll Tool — mobile-first single page */

:root {
  --bg: #f5f5f4;
  --card: #ffffff;
  --fg: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e5e5;
  --accent: #b91c1c;
  --accent-dark: #991b1b;
  --ok: #15803d;
  --warn: #b45309;
  --hoch: #b91c1c;
  --mittel: #b45309;
  --niedrig: #6b7280;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --radius: 14px;
  --pad: 20px;
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px var(--pad);
  max-width: 680px;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(185,28,28,0.15);
}
.brand-name { font-size: 17px; letter-spacing: -0.01em; }
.header-btn {
  background: transparent;
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--fg);
  font-weight: 500;
}
.header-btn[aria-expanded="true"] {
  background: var(--fg);
  color: #fff;
  border-color: var(--fg);
}

/* ---------- project card ---------- */
.project-card {
  background: var(--card);
  margin: 12px var(--pad) 0;
  padding: 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.project-card label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.project-card label.full { grid-column: 1 / -1; }
.project-card label .optional {
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  opacity: 0.7;
  margin-left: 4px;
}
.project-card .hint-line {
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.35;
}
.project-card input {
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  background: #fafafa;
  color: var(--fg);
  font-family: inherit;
}
.project-card input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  background: #fff;
}

/* ---------- main area ---------- */
main {
  flex: 1;
  padding: 24px var(--pad);
  display: flex;
  flex-direction: column;
}

.view {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
}
.view[hidden] { display: none; }

.hint {
  color: var(--muted);
  font-size: 15px;
  max-width: 320px;
  margin: 24px auto 32px;
}
.sub {
  color: var(--muted);
  font-size: 14px;
  margin: 16px 0 0;
  max-width: 320px;
}
.record-label {
  font-size: 18px;
  font-weight: 600;
  margin: 20px 0 0;
}

/* ---------- record button ---------- */
.record-btn, .stop-btn {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: none;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 6px 24px rgba(185,28,28,0.35),
              0 0 0 0 rgba(185,28,28,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  margin-top: 12px;
  touch-action: manipulation;
}
.record-btn:active, .stop-btn:active {
  transform: scale(0.96);
  background: var(--accent-dark);
}
.stop-btn {
  background: #1f2937;
  box-shadow: 0 6px 24px rgba(0,0,0,0.25);
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 6px 24px rgba(0,0,0,0.25), 0 0 0 0    rgba(185,28,28,0.55); }
  70%  { box-shadow: 0 6px 24px rgba(0,0,0,0.25), 0 0 0 22px rgba(185,28,28,0);    }
  100% { box-shadow: 0 6px 24px rgba(0,0,0,0.25), 0 0 0 0    rgba(185,28,28,0);    }
}

.rec-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 28px;
  font-size: 28px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.rec-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent);
  animation: blink 1s infinite;
}
@keyframes blink { 50% { opacity: 0.3; } }

/* ---------- processing ---------- */
.spinner {
  width: 52px; height: 52px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 40px 0 24px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: left;
  max-width: 260px;
  width: 100%;
}
.steps li {
  padding: 10px 0 10px 32px;
  position: relative;
  color: var(--muted);
  font-size: 16px;
}
.steps li::before {
  content: "";
  position: absolute;
  left: 0; top: 14px;
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-radius: 50%;
}
.steps li.active {
  color: var(--fg);
  font-weight: 500;
}
.steps li.active::before {
  border-color: var(--accent);
  border-top-color: transparent;
  animation: spin 0.9s linear infinite;
}
.steps li.done { color: var(--ok); }
.steps li.done::before {
  border-color: var(--ok);
  background: var(--ok);
}
.steps li.done::after {
  content: "✓";
  position: absolute;
  left: 3px; top: 9px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

/* ---------- result view ---------- */
.view-result {
  align-items: stretch;
  text-align: left;
}
.result-head {
  margin: 8px 0 20px;
}
.result-head h1 {
  font-size: 24px;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.result-meta {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.auto-email {
  margin: 0 0 14px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.auto-email::before {
  font-weight: 700;
  flex-shrink: 0;
}
.auto-email.ok {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.auto-email.ok::before { content: "✓"; }
.auto-email.err {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.auto-email.err::before { content: "!"; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 18px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 12px;
  font-weight: 600;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.card-head h2 { margin: 0; }
.badge {
  background: var(--fg);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
}

.editable {
  outline: none;
  border-left: 3px solid transparent;
  padding: 2px 0 2px 10px;
  margin: 0 0 0 -10px;
  transition: border-color 0.15s, background 0.15s;
  border-radius: 4px;
}
.editable:focus {
  border-left-color: var(--accent);
  background: #fffbeb;
}

.section-block {
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.section-block:first-child { border-top: 0; padding-top: 0; }
.section-block h3 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
}
.section-block ul {
  margin: 6px 0 0;
  padding-left: 18px;
}
.section-block li {
  margin: 4px 0;
  line-height: 1.4;
}

.pendenz {
  padding: 14px 0;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
}
.pendenz:first-child { border-top: 0; padding-top: 4px; }
.pendenz-desc {
  grid-column: 1 / -1;
  font-size: 16px;
  line-height: 1.4;
  font-weight: 500;
}
.pendenz-meta {
  grid-column: 1;
  font-size: 14px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.pendenz-meta span strong {
  color: var(--fg);
  font-weight: 500;
}
.prio {
  grid-column: 2;
  align-self: start;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.prio-hoch    { background: #fee2e2; color: var(--hoch); }
.prio-mittel  { background: #fef3c7; color: var(--mittel); }
.prio-niedrig { background: #f3f4f6; color: var(--niedrig); }

.transcript-wrap {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.transcript-wrap summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.transcript {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
  white-space: pre-wrap;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0 8px;
}
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 20px;
  border: none;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary {
  background: var(--fg);
  color: #fff;
}
.btn-primary:active { background: #000; }
.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
}

/* ---------- email box ---------- */
.email-box {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  box-shadow: var(--shadow);
  margin: 4px 0 14px;
}
.email-box label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.email-row {
  display: flex;
  gap: 8px;
}
.email-row input[type="email"] {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  background: #fafafa;
  color: var(--fg);
  font-family: inherit;
}
.email-row input[type="email"]:focus {
  outline: 2px solid var(--accent);
  background: #fff;
}
.btn-inline {
  padding: 12px 18px;
  font-size: 15px;
  white-space: nowrap;
}
.email-status {
  margin: 10px 0 0;
  font-size: 14px;
  min-height: 1em;
}
.email-status.ok { color: var(--ok); }
.email-status.err { color: var(--accent); }

/* ---------- error ---------- */
.view-error { justify-content: center; }
.error-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: #fee2e2;
  color: var(--accent);
  font-size: 36px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 40px 0 16px;
}
.error-msg {
  color: var(--muted);
  max-width: 320px;
  margin: 0 0 24px;
  font-size: 15px;
}

/* ---------- footer ---------- */
.site-footer {
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- wider screens ---------- */
/* The header spans full width (full-bleed bar). Everything else is
 * constrained to 680px and centered, matching the .site-header-inner
 * container so items visually line up with the header brand/button.
 */
@media (min-width: 640px) {
  main, .project-card, .site-footer {
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
  }
  .project-card { grid-template-columns: 1fr 1fr; }
}
