/* LUNA Keramik Markenfarben (wie in der Kasse). Handy-first: grosse Tasten, Navigation unten. */
:root {
  --luna-50: #fdf1e6;
  --luna-100: #f9ddc0;
  --luna-500: #dd7c3c;
  --luna-600: #c85103;
  --luna-700: #a34403;
  --luna-900: #4a1f01;
  --cream: #fdf7f0;
  --sage: #9eaea0;
  --sage-dark: #7b8a76;
  --sage-bg: #e4eae5;
  --tan: #c8a47b;
  --tan-bg: #f3ead9;
  --amber-bg: #fdf0d5;
  --amber: #b45309;
  --red-bg: #fdeceb;
  --red: #a3231a;
  --text: #3a2c1d;
  --muted: #8a7a68;
  --hairline: #ecdfd0;
  --tap-target: 44px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: var(--cream); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 16px; -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
body { overscroll-behavior-y: none; }
button, a, input, select, label { touch-action: manipulation; }
h1:focus { outline: none; }
a { color: var(--luna-600); text-decoration: none; }
h1 { font-size: 1.3rem; margin: 0; color: var(--luna-900); }
h2 { font-size: 0.8rem; margin: 0.5rem 0 0; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
p { margin: 0; }

.icon { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.icon.sm { width: 1rem; height: 1rem; }
.icon.lg { width: 1.75rem; height: 1.75rem; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 0.5rem;
  padding: calc(0.6rem + env(safe-area-inset-top)) 1rem 0.6rem;
  background: rgba(253, 247, 240, 0.95); backdrop-filter: blur(8px); border-bottom: 1px solid var(--luna-100);
}
.topbar-logo { width: 32px; height: 32px; border-radius: 8px; }
.topbar-title { font-weight: 700; font-size: 1.1rem; color: var(--luna-900); }
.page { max-width: 42rem; margin: 0 auto; padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }

.bottomnav {
  position: fixed; inset: auto 0 0 0; z-index: 30; display: flex; justify-content: space-around; align-items: flex-end;
  background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(8px); border-top: 1px solid var(--luna-100);
  padding: 0 0.5rem env(safe-area-inset-bottom);
}
.bn-item, .bn-primary { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; font-size: 11px; font-weight: 500; color: #6b7280; padding: 0.5rem 0; min-width: 56px; }
.bn-item .icon { width: 1.5rem; height: 1.5rem; }
.bn-item.active { color: var(--luna-700); }
.bn-primary { margin-top: -1.3rem; color: var(--luna-700); }
.bn-primary-circle { display: flex; width: 3.5rem; height: 3.5rem; border-radius: 999px; background: var(--luna-600); color: white; align-items: center; justify-content: center; box-shadow: 0 8px 20px rgba(200, 81, 3, 0.3); }
.bn-primary-circle .icon { width: 1.75rem; height: 1.75rem; }

/* ---------- Bausteine ---------- */
.card { background: white; border-radius: 1rem; box-shadow: 0 1px 3px rgba(58, 44, 29, 0.08); padding: 1rem; }
.card.tight { padding: 0.75rem; }
.card.flush { padding: 0; }
.card.accent { border: 2px solid var(--luna-500); }
.card.dashed { border: 2px dashed var(--luna-500); }
.card.danger { background: var(--red-bg); color: var(--red); }
.section { background: rgba(255, 255, 255, 0.6); border-radius: 1.5rem; padding: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }
.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.stack-sm { display: flex; flex-direction: column; gap: 0.4rem; }
.row { display: flex; align-items: center; gap: 0.5rem; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.4rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.xs { font-size: 0.72rem; }
.bold { font-weight: 600; }
.title { font-weight: 600; color: var(--luna-900); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.center { text-align: center; }
.back { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.9rem; font-weight: 500; color: var(--luna-700); background: none; border: 0; padding: 0; min-height: auto; cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: var(--tap-target); padding: 0.75rem 1rem; border-radius: 0.75rem; border: 0;
  font-size: 1rem; font-weight: 500; cursor: pointer; text-decoration: none; width: auto;
}
.btn.block { width: 100%; }
.btn.big { font-size: 1.1rem; padding: 0.9rem 1rem; }
.btn-primary { background: var(--luna-600); color: white; }
.btn-primary:active { background: var(--luna-700); }
.btn-secondary { background: white; color: var(--luna-900); border: 1px solid var(--luna-100); }
.btn-danger { background: white; color: var(--red); border: 1px solid #f5c2bf; }
.btn-ghost { background: transparent; color: var(--luna-700); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0.25rem; color: var(--luna-700); font-weight: 500; display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer; font-size: 0.9rem; }

.badge { display: inline-flex; align-items: center; gap: 0.2rem; border-radius: 999px; padding: 0.1rem 0.5rem; font-size: 0.72rem; font-weight: 600; white-space: nowrap; }
.b-luna { background: var(--luna-100); color: var(--luna-900); }
.b-luna-strong { background: var(--luna-600); color: white; }
.b-sage { background: var(--sage-bg); color: var(--sage-dark); }
.b-tan { background: var(--tan-bg); color: var(--luna-900); }
.b-gray { background: #eee; color: #555; }
.b-red { background: var(--red-bg); color: var(--red); }
.b-amber { background: var(--amber-bg); color: var(--amber); }
.b-white { background: white; color: #9ca3af; border: 1px solid #e5e7eb; }

.icon-badge { display: flex; align-items: center; justify-content: center; border-radius: 999px; background: var(--luna-50); color: var(--luna-600); flex-shrink: 0; width: 2.75rem; height: 2.75rem; }
.icon-badge.sm { width: 2.25rem; height: 2.25rem; }
.icon-badge.strong { background: var(--luna-600); color: white; }
.icon-badge.amber { background: var(--amber-bg); color: var(--amber); }

.thumb { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 0.75rem; background: #f3f4f6; }
.thumb-empty { display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 1; border-radius: 0.75rem; background: var(--luna-50); color: var(--luna-500); font-size: 0.72rem; text-align: center; }

.fill { height: 0.75rem; width: 100%; background: #f3f4f6; border-radius: 999px; overflow: hidden; }
.fill > div { height: 100%; border-radius: 999px; background: var(--luna-500); transition: width .3s; }
.fill > div.mid { background: var(--tan); }
.fill > div.full { background: var(--sage-dark); }
.progress { height: 0.5rem; background: var(--luna-50); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--luna-500); }

.note { border-radius: 0.75rem; padding: 0.5rem 0.75rem; font-size: 0.9rem; display: flex; gap: 0.5rem; align-items: flex-start; }
.note.error { background: var(--red-bg); color: var(--red); }
.note.ok { background: var(--sage-bg); color: var(--sage-dark); }
.note.warn { background: var(--amber-bg); color: var(--amber); }

/* ---------- Formulare ---------- */
label.field { display: block; }
label.field > span { display: block; font-size: 0.85rem; font-weight: 500; color: #374151; margin-bottom: 0.25rem; }
input, select, textarea {
  width: 100%; min-height: var(--tap-target); font-size: 1rem; border-radius: 0.75rem;
  border: 1px solid var(--luna-100); background: white; padding: 0.7rem 0.75rem; font-family: inherit; color: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--luna-500); outline-offset: 1px; }
input[type=checkbox] { width: 1.25rem; height: 1.25rem; min-height: auto; accent-color: var(--luna-600); }
.check { display: flex; align-items: center; gap: 0.6rem; font-size: 0.95rem; }

.seg { display: grid; gap: 0.5rem; }
.seg button { border: 1px solid var(--luna-100); background: white; color: var(--luna-900); border-radius: 0.75rem; padding: 0.55rem 0.25rem; text-align: center; cursor: pointer; min-height: var(--tap-target); }
.seg button .l { display: block; font-size: 0.9rem; font-weight: 600; }
.seg button .h { display: block; font-size: 0.68rem; color: #6b7280; }
.seg button.on { background: var(--luna-600); border-color: var(--luna-600); color: white; }
.seg button.on .h { color: var(--luna-50); }

.chips { display: flex; gap: 0.5rem; overflow-x: auto; margin: 0 -1rem; padding: 0 1rem 0.25rem; }
.chip { flex-shrink: 0; border: 0; border-radius: 999px; padding: 0.4rem 0.8rem; font-size: 0.85rem; font-weight: 500; background: white; color: var(--luna-900); cursor: pointer; min-height: auto; }
.chip.on { background: var(--luna-600); color: white; }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.25rem; background: white; border-radius: 0.75rem; padding: 0.25rem; box-shadow: 0 1px 3px rgba(58,44,29,.08); }
.tabs a, .tabs button { display: flex; align-items: center; justify-content: center; gap: 0.35rem; border-radius: 0.5rem; padding: 0.6rem 0; font-size: 0.9rem; font-weight: 600; color: var(--luna-900); background: none; border: 0; cursor: pointer; min-height: auto; }
.tabs .on { background: var(--luna-600); color: white; }

/* ---------- Kacheln ---------- */
.tile { position: relative; display: block; background: white; border-radius: 1rem; padding: 0.35rem; box-shadow: 0 1px 3px rgba(58,44,29,.08); text-align: left; border: 0; cursor: pointer; color: inherit; width: 100%; }
.tile.sel { outline: 4px solid var(--luna-500); }
.tile.loaded { outline: 4px solid var(--sage-dark); }
.tile.damaged { outline: 4px solid #f87171; }
.tile-check { position: absolute; top: 0.6rem; right: 0.6rem; width: 2rem; height: 2rem; border-radius: 999px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.9); color: #d1d5db; }
.tile-check.on { background: var(--luna-600); color: white; }
.tile.loaded .tile-check.on { background: var(--sage-dark); }
.tile-x { position: absolute; top: 0.6rem; left: 0.6rem; width: 2rem; height: 2rem; border-radius: 999px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.9); color: #4b5563; border: 0; cursor: pointer; min-height: auto; min-width: auto; padding: 0; }
.tile-body { padding: 0.35rem 0.25rem 0.1rem; }
.collage { display: grid; grid-template-columns: 1fr 1fr; gap: 0.25rem; }
.collage .thumb, .collage .thumb-empty { border-radius: 0.5rem; }
.collage .thumb-empty.wide { grid-column: span 2; aspect-ratio: 2 / 1; }

.list-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; color: inherit; }
.list-row + .list-row { border-top: 1px solid var(--luna-50); }

.sticky-action { position: fixed; left: 0; right: 0; bottom: calc(5.5rem + env(safe-area-inset-bottom)); z-index: 25; padding: 0 1rem; }
.sticky-action > div { max-width: 42rem; margin: 0 auto; display: flex; gap: 0.5rem; }
.sticky-action .btn { box-shadow: 0 8px 20px rgba(58,44,29,.2); }

/* ---------- Bottom-Sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 32rem; max-height: 92vh; overflow-y: auto; background: var(--cream); border-radius: 1.5rem 1.5rem 0 0; padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 1rem; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { font-size: 1.1rem; text-transform: none; letter-spacing: 0; color: var(--luna-900); margin: 0; }
@media (min-width: 640px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 1.5rem; } }

.photo-btn { display: flex; align-items: center; gap: 0.75rem; width: 100%; background: white; border: 2px dashed var(--luna-100); border-radius: 1rem; padding: 0.75rem; cursor: pointer; position: relative; }
.photo-btn img, .photo-btn .ph { width: 5rem; height: 5rem; border-radius: 0.75rem; object-fit: cover; }
.photo-btn .ph { display: flex; align-items: center; justify-content: center; background: var(--luna-50); color: var(--luna-600); }
.photo-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.stat-num { font-size: 1.25rem; font-weight: 600; color: var(--luna-900); }

.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; border-radius: 0.75rem; }
.blazor-error-boundary::after { content: "Ein Fehler ist aufgetreten – bitte Seite neu laden."; }

/* Weitere Fotos im Stueck-Editor */
.extra-main { position: absolute; left: 0.25rem; right: 0.25rem; bottom: 0.25rem; border: 0; border-radius: 0.4rem; background: rgba(255,255,255,.9); color: var(--luna-700); font-size: 0.65rem; font-weight: 600; padding: 0.15rem 0; min-height: auto; cursor: pointer; }
.extra-confirm { position: absolute; inset: 0; border-radius: 0.75rem; background: rgba(253,236,235,.95); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.25rem; color: var(--red); }
