:root {
  --primary: #1f4f8a;
  --primary-dark: #173d6a;
  --primary-soft: #dfeaf7;
  --accent: #4e7eb8;
  --bg: #f7f4ee;
  --surface: #ffffff;
  --text: #182333;
  --muted: #566276;
  --border: #d5dfeb;
  --logo-url: url('/static/pelzankauf_logo/pelz_ankauf_logo.png');
  --radius: 12px;
  --radius-sm: 8px;
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

body.mobile-install-open {
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  min-height: 100vh; /* fallback for browsers without svh */
}

/* ── Top Bar ──────────────────────────────────────────────────────────── */
.top-bar {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: 48px 1fr 48px;
  align-items: end; height: 76px;
  background: linear-gradient(180deg, #2a629f 0%, var(--primary) 100%);
  color: #fff;
  padding: 0 6px 8px;
  border-bottom: 1px solid rgba(23, 61, 106, .32);
  box-shadow: 0 2px 10px rgba(16, 35, 63, .16);
  -webkit-user-select: none; user-select: none;
  position: sticky;
}

.top-bar::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
  width: 42px;
  height: 42px;
  background-image: var(--logo-url);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  pointer-events: none;
  opacity: .98;
}

.tb-title {
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .15);
}

.tb-btn {
  background: none; border: none; color: #fff;
  font-size: 22px; cursor: pointer; padding: 0;
  height: 44px; width: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}
.tb-btn:active { background: rgba(255,255,255,.18); }
.tb-slot { width: 44px; }

/* ── Content ──────────────────────────────────────────────────────────── */
.content {
  flex: 1;
  padding: 16px 16px calc(24px + var(--safe-bot));
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

/* ── Cards ────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(35, 24, 18, .06);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.card:active { opacity: .85; }
.card-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; gap: 8px; }
.card-title { font-weight: 600; font-size: 16px; }
.card-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }

/* ── Badges ───────────────────────────────────────────────────────────── */
.badge {
  font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 20px;
  white-space: nowrap; flex-shrink: 0;
}
.badge-offen      { background: #fef3c7; color: #92400e; }
.badge-progress   { background: #e4ebff; color: #25408f; }
.badge-done       { background: #d8f2e4; color: #15603a; }
.badge-rejected   { background: #fee2e2; color: #991b1b; }

/* ── Forms ────────────────────────────────────────────────────────────── */
.label {
  display: block;
  font-size: 13px; font-weight: 500; color: var(--muted);
  margin: 14px 0 4px;
}
.hint-inline { font-weight: 400; font-size: 12px; }

.input {
  display: block; width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px; /* prevents iOS auto-zoom */
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
  -webkit-appearance: none; appearance: none;
}
.input:focus { outline: none; border-color: var(--primary); }
.input:focus-visible {
  box-shadow: 0 0 0 3px rgba(78, 126, 184, .28);
  background: #fff;
}
.textarea { resize: vertical; min-height: 64px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: block; width: 100%;
  padding: 14px; margin-top: 16px;
  background: linear-gradient(180deg, #2f6cae 0%, var(--primary) 100%);
  color: #fff;
  border: none; border-radius: var(--radius);
  font-size: 16px; font-weight: 600; font-family: inherit;
  cursor: pointer; text-align: center;
  transition: background .15s, transform .06s ease-out;
  -webkit-tap-highlight-color: transparent;
}
.btn:active {
  background: var(--primary-dark);
  transform: translateY(1px);
}
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-secondary {
  background: #fff;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-secondary:active { background: rgba(78,126,184,.10); }
.btn-new { margin-top: 20px; }

.btn-remove {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 16px; padding: 4px 8px;
  font-family: inherit;
}

/* ── Section Titles ───────────────────────────────────────────────────── */
.section-title {
  font-size: 13px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  margin: 20px 0 6px; padding: 0;
}

/* ── Item Blocks (new evaluation) ─────────────────────────────────────── */
.item-block {
  background: linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}
.item-header {
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; font-size: 14px; margin-bottom: 4px;
}

/* ── Detail View ──────────────────────────────────────────────────────── */
.detail-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 14px; padding: 7px 0; border-bottom: 1px solid var(--border);
  color: var(--muted);
}
.detail-row span:last-child { color: var(--text); text-align: right; max-width: 60%; word-break: break-word; }

.detail-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px;
}
.detail-item-title { font-weight: 600; margin-bottom: 4px; font-size: 15px; }
.detail-item-note { font-size: 14px; color: var(--muted); margin-bottom: 8px; }

.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.thumb { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; background: var(--bg); }

/* ── Upload ───────────────────────────────────────────────────────────── */
.upload-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; color: var(--primary); font-weight: 500;
  cursor: pointer; padding: 6px 0;
  -webkit-tap-highlight-color: transparent;
}
.upload-input { display: none; }
.draft-files {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.draft-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f5f9ff;
}
.draft-file-name {
  font-size: 13px;
  color: var(--text);
  word-break: break-word;
}
.draft-files-empty,
.flow-note,
.readonly-note {
  font-size: 13px;
  color: var(--muted);
  margin: 10px 0 0;
}
.cta-row {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

/* ── Standalone Gate (production browser access) ─────────────────────── */
.standalone-gate {
  padding-top: 22px;
}
.standalone-gate__hero {
  border: 1px solid rgba(213, 223, 235, .95);
  border-radius: 18px;
  padding: 18px 16px;
  background: linear-gradient(155deg, #f3f8ff 0%, #ffffff 55%, #f7f4ee 100%);
  box-shadow: 0 10px 26px rgba(31, 79, 138, .10);
}
.standalone-gate__eyebrow {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 700;
}
.standalone-gate__title {
  margin: 10px 0 8px;
  font-size: 26px;
  line-height: 1.1;
  color: #122333;
}
.standalone-gate__copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 15px;
}
.standalone-gate__card {
  margin-top: 14px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 16px;
  padding: 14px;
}
.standalone-gate__actions {
  margin-top: 14px;
}
.standalone-gate__steps {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}
.standalone-gate__steps p {
  margin: 0;
  font-size: 14px;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(213, 223, 235, .95);
  background: #f8fbff;
  line-height: 1.45;
}

/* ── iOS Install Hint (/mobile/ only) ────────────────────────────────── */
.mobile-install-hint-footer {
  display: flex;
  justify-content: center;
  margin-top: 18px;
  padding: 8px 0 2px;
}
.mobile-install-hint-link {
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.mobile-install-hint-link:focus-visible,
.mobile-install-hint-link:active {
  outline: none;
  color: var(--primary);
  background: rgba(78, 126, 184, .10);
}
.mobile-install-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(18, 35, 51, .26);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 12px calc(16px + var(--safe-bot));
}
.mobile-install-sheet-backdrop[hidden] {
  display: none !important;
}
.mobile-install-sheet {
  width: min(100%, 480px);
  background: linear-gradient(180deg, rgba(255,255,255,.98) 0%, #fdfcf8 100%);
  border: 1px solid rgba(213, 223, 235, .95);
  border-radius: 20px;
  box-shadow: 0 20px 48px rgba(18, 35, 51, .18);
  padding: 12px 14px 18px;
}
.mobile-install-handle {
  width: 42px;
  height: 4px;
  border-radius: 999px;
  margin: 2px auto 12px;
  background: rgba(86, 98, 118, .22);
}
.mobile-install-title {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.15;
  color: var(--text);
}
.mobile-install-copy {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}
.mobile-install-steps {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.mobile-install-step {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f5f9ff;
  border: 1px solid rgba(213, 223, 235, .95);
  font-size: 14px;
  color: var(--text);
}
.mobile-install-note {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}
.mobile-install-close {
  margin-top: 14px;
}

/* ── Messages ─────────────────────────────────────────────────────────── */
.form-error { font-size: 13px; color: #dc2626; margin: 8px 0 0; }
.form-ok    { font-size: 13px; color: #16a34a; margin: 8px 0 0; }
.form-hint  { font-size: 14px; color: var(--muted); margin: 0 0 16px; }
.form-link  { text-align: center; font-size: 14px; color: var(--muted); margin-top: 14px; }
.form-link a { color: var(--primary); text-decoration: none; font-weight: 500; }
.form-link a:focus-visible,
.btn:focus-visible,
.btn-secondary:focus-visible,
.tb-btn:focus-visible {
  outline: 2px solid rgba(120, 166, 219, .9);
  outline-offset: 2px;
}

/* ── Misc ─────────────────────────────────────────────────────────────── */
.loading    { color: var(--muted); text-align: center; margin-top: 48px; font-size: 15px; }
.empty-hint { text-align: center; color: var(--muted); font-size: 14px; margin-top: 48px; }
