:root {
  --paper: #f3f2ee;
  --paper-raised: #ffffff;
  --ink: #17221e;
  --ink-soft: #4c5650;
  --line: #dad6cc;
  --teal: #2b4a47;
  --teal-dark: #1c3230;
  --amber: #d98e29;
  --amber-dark: #b8721b;
  --brick: #a83b2e;
  --moss: #4c7a5d;
  --radius: 4px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--paper);
  display: flex;
  flex-direction: column;
}

/* HEADER */
.app-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--line);
}
.app-header__mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--teal);
  color: #fff;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.app-header__title {
  flex: 1 1 auto;
  min-width: 0;
}
.app-header__title h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header__title p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* STEP NAV */
.steps {
  display: flex;
  padding: 14px 16px;
  gap: 4px;
  border-bottom: 1px solid var(--line);
}
.steps__item {
  flex: 1;
  background: none;
  border: none;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 11px;
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  cursor: default;
}
.steps__item span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--ink-soft);
}
.steps__item.is-active { color: var(--teal-dark); font-weight: 600; }
.steps__item.is-active span { border-color: var(--teal); color: var(--teal); background: #fff; }
.steps__item.is-done span { border-color: var(--moss); color: #fff; background: var(--moss); }

/* PANELS */
main { flex: 1; padding: 20px; padding-bottom: 60px; }
.panel { display: none; }
.panel.is-active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.panel h2 {
  font-size: 17px;
  margin: 0 0 4px;
}
.hint {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 18px;
}

/* CAPTURE */
.capture-options {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}
.capture-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 22px 10px;
  cursor: pointer;
  background: var(--paper-raised);
  transition: border-color .15s ease;
  text-align: center;
}
.capture-option:hover { border-color: var(--teal); }
.capture-option .capture-box__icon { font-size: 22px; color: var(--teal); line-height: 1; }
.capture-option .capture-box__text { font-size: 12px; color: var(--ink-soft); }

.room-field { margin-bottom: 20px; }
.room-field label {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.room-field input {
  width: 100%;
}

/* DAMAGE LIST (step 1 summary) */
.damage-list, .doc-list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.damage-list li, .doc-list li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
}
.damage-list img, .doc-list img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
}
.item-info { flex: 1; min-width: 0; }
.item-info__title {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 2px;
}
.item-info__meta {
  font-size: 12px;
  color: var(--ink-soft);
  margin: 0;
}
.item-info__cost {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--teal-dark);
  margin-top: 4px;
}
.severity-tag {
  display: inline-block;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'IBM Plex Mono', monospace;
  margin-top: 4px;
}
.severity-tag--gering { background: rgba(76,122,93,.12); color: var(--moss); }
.severity-tag--mittel { background: rgba(217,142,41,.15); color: var(--amber-dark); }
.severity-tag--hoch { background: rgba(168,59,46,.12); color: var(--brick); }

/* FORM FIELDS (review + document) */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.field-row {
  display: flex;
  gap: 12px;
}
.field-row .field { flex: 1; }

input[type="text"], input[type="number"], select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 10px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(43,74,71,.12);
}

/* REVIEW CARD */
.review-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
}
.review-card img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  display: block;
}
.review-card__body { padding: 16px; }
.disclaimer {
  font-size: 12px;
  color: var(--amber-dark);
  background: rgba(217,142,41,.1);
  border: 1px solid rgba(217,142,41,.3);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin: 4px 0 0;
}

/* DOCUMENT META */
.doc-meta { margin-bottom: 18px; }

/* SIGNATURE */
.sig-block { margin-bottom: 22px; }
.sig-block label {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.sig-pad {
  width: 100%;
  height: 140px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  touch-action: none;
  display: block;
  margin-bottom: 6px;
}
.status {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 12px;
}

/* BUTTONS */
.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
}
.btn--primary { background: var(--teal); color: #fff; }
.btn--primary:hover { background: var(--teal-dark); }
.btn--ghost { background: transparent; color: var(--teal-dark); border: 1px solid var(--line); }
.btn--ghost:hover { border-color: var(--teal); }
.btn--small { width: auto; padding: 6px 12px; font-size: 12px; margin-top: 0; }

.app-header { position: relative; }
.app-header__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.app-header__settings {
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 14px;
  color: var(--ink-soft);
  cursor: pointer;
  flex-shrink: 0;
}
.app-header__settings:hover { border-color: var(--teal); color: var(--teal); }

@media (max-width: 380px) {
  .app-header__actions { gap: 4px; }
  .app-header__settings { width: 27px; height: 27px; font-size: 12px; }
}

.field-note {
  font-size: 11px;
  color: var(--amber-dark);
  margin: 4px 0 0;
}
#costReasoningHint {
  color: var(--ink-soft);
  font-style: italic;
  margin: 6px 0 14px;
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.btn-icon {
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 30px;
  height: 30px;
  cursor: pointer;
  color: var(--ink-soft);
}

.contact-group {
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
  padding: 14px;
}
.contact-group h3 {
  font-size: 14px;
  margin: 0 0 10px;
}
.contact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.contact-row:last-of-type { border-bottom: none; }
.contact-row__info { min-width: 0; }
.contact-row__name { font-weight: 600; }
.contact-row__email { color: var(--ink-soft); font-family: 'IBM Plex Mono', monospace; font-size: 12px; }
.contact-row__delete {
  background: none;
  border: none;
  color: var(--brick);
  cursor: pointer;
  font-size: 12px;
  flex-shrink: 0;
}
.contact-empty {
  font-size: 12px;
  color: var(--ink-soft);
  font-style: italic;
  padding: 6px 0;
}
.contact-add {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.contact-add input {
  flex: 1;
  font-size: 13px;
  padding: 7px 8px;
}
.contact-add button {
  flex-shrink: 0;
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0 14px;
  font-size: 13px;
  cursor: pointer;
}

.send-block {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.send-block select {
  font-size: 13px;
  padding: 7px 8px;
  margin-bottom: 6px;
}
.send-block button {
  width: 100%;
  background: var(--amber);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.send-block button:disabled { background: var(--line); cursor: not-allowed; }
.send-status { font-size: 12px; margin-top: 6px; color: var(--ink-soft); }
.send-status.is-success { color: var(--moss); }
.send-status.is-error { color: var(--brick); }

.suggest-results { margin-top: 10px; }
.suggest-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  margin-top: 8px;
  background: #fff;
}
.suggest-card__name { font-size: 13px; font-weight: 600; margin: 0 0 4px; }
.suggest-card__meta { font-size: 12px; color: var(--ink-soft); margin: 2px 0; }
.suggest-card__meta a { color: var(--teal-dark); }
.suggest-card__source { font-size: 11px; color: var(--ink-soft); font-style: italic; margin: 4px 0 8px; }

@media (min-width: 540px) {
  .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
