/* Deluxe Estate Baustelle — native-feeling field app */

:root {
  --bg: #14100c;
  --bg-2: #1c1712;
  --card: #241e17;
  --ink: #f7f1ea;
  --muted: #b7aa9a;
  --gold: #d4a85a;
  --gold-ink: #1a140e;
  --line: rgba(212, 168, 90, 0.22);
  --warn: #e08a5a;
  --ok: #5aa872;
  --danger: #d4654a;
  --radius: 16px;
  --tab-h: 64px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Mulish, system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  overscroll-behavior: none;
  touch-action: manipulation;
}

.app {
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(212, 168, 90, 0.12), transparent 50%),
    var(--bg);
  padding-top: env(safe-area-inset-top);
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
}

.app-top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, var(--bg) 70%, transparent);
  padding: 10px 16px 8px;
}
.app-top__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.app-top__logo { height: 26px; width: auto; }
.app-top__user { font-size: 13px; color: var(--muted); font-weight: 600; }

.project-bar span {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}
.project-bar__select,
.field {
  width: 100%;
  min-height: 52px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 12px 14px;
}
.field[rows] { min-height: 84px; resize: vertical; }

.app-flash { padding: 0 16px; }
.flash {
  margin: 0 0 8px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
}
.flash--err { background: rgba(212, 101, 74, 0.2); color: #f3c4b6; }
.flash--ok { background: rgba(90, 168, 114, 0.2); color: #cfe8d6; }

.app-body { flex: 1; min-height: 0; }
.screen { display: none; }
.screen--active { display: block; }

.hello {
  margin: 4px 16px 6px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.25;
}
.hello-sub {
  margin: 0 16px 16px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
}
.project-bar__select.is-empty {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 168, 90, 0.28);
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 0 16px 18px;
}
.stat {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: inherit;
  border-radius: 16px;
  padding: 12px 8px 10px;
  text-align: left;
  font: inherit;
  min-height: 76px;
}
.stat strong { display: block; font-size: 22px; font-weight: 800; line-height: 1; }
.stat span { display: block; margin-top: 8px; font-size: 11px; font-weight: 700; color: var(--muted); line-height: 1.25; }
.stat--warn strong { color: var(--warn); }

.block-title {
  margin: 0 16px 10px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-right: 16px;
}

.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 16px 22px;
}
.tile {
  appearance: none;
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  color: inherit;
  text-align: left;
  padding: 14px;
  font: inherit;
}
.tile:active, .stat:active, .tab:active, .chip:active, .primary:active {
  transform: scale(0.98);
}
.tile--gold {
  background: linear-gradient(180deg, #3a2f20, #2a2219);
  border-color: rgba(212, 168, 90, 0.45);
}
.tile__icon { display: block; font-size: 22px; margin-bottom: 8px; }
.tile__t { display: block; font-weight: 800; font-size: 15px; }
.tile__d { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; font-weight: 600; line-height: 1.35; }

.cards { display: flex; flex-direction: column; gap: 10px; padding: 0 16px 24px; }
#bau-defect-list-full { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.card strong { display: block; font-size: 16px; }
.card small { display: block; margin-top: 4px; color: var(--muted); font-weight: 600; }
.empty {
  margin: 0 16px 24px;
  padding: 28px 16px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
  font-weight: 600;
  line-height: 1.45;
}

.pill {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(212, 168, 90, 0.15);
  color: var(--gold);
}
.pill--offen { background: rgba(224, 138, 90, 0.2); color: var(--warn); }
.pill--in_arbeit { background: rgba(212, 168, 90, 0.2); color: var(--gold); }
.pill--behoben, .pill--abgenommen { background: rgba(90, 168, 114, 0.2); color: var(--ok); }

.status-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.status-row button {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}
.status-row button[disabled] { opacity: 0.4; }
.photos { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; }
.photos img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }

.sheet {
  min-height: calc(100dvh - var(--tab-h) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 92px);
  display: flex;
  flex-direction: column;
}
.sheet-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 8px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}
.sheet-top h1 { margin: 0; font-size: 18px; font-weight: 800; flex: 1; }
.sheet-body { flex: 1; padding: 8px 16px 16px; }
.sheet-bar {
  margin-top: auto;
  padding: 12px 16px 16px;
  background: var(--bg);
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 20px;
}
.text-btn {
  background: none;
  border: 0;
  color: var(--gold);
  font: inherit;
  font-weight: 800;
  padding: 8px 0;
}
.hint { margin: 0 0 14px; color: var(--muted); font-weight: 600; line-height: 1.4; }
.label {
  margin: 14px 0 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.sheet-body > label {
  display: block;
  margin: 14px 0 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.cam-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 4px 0 12px;
}
.cam-split--3 {
  grid-template-columns: 1fr 1fr 1fr;
}
.cam-split--3 .cam {
  min-height: 108px;
  padding: 10px 6px;
}
.cam-split--3 .cam strong { font-size: 13px; }
.cam-split--3 .cam small { font-size: 11px; }
.cam-split--3 .cam--gallery {
  min-height: 108px;
  flex-direction: column;
}
.cam {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 132px;
  margin: 0;
  border: 1.5px dashed var(--gold);
  border-radius: 20px;
  background: rgba(212, 168, 90, 0.08);
  color: var(--gold);
  text-align: center;
  padding: 16px;
  cursor: pointer;
}
.cam input { display: none; }
.cam__plus { font-size: 28px; }
.cam strong { font-size: 15px; color: var(--ink); }
.cam small { color: var(--muted); font-weight: 600; }
.cam--gallery small { display: none; }
.cam--sm {
  min-height: 56px;
  margin: 8px 0 12px;
  flex-direction: row;
  gap: 8px;
  font-weight: 800;
}
.bau-previews { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; }
.preview {
  position: relative;
  width: 76px;
  height: 76px;
  padding: 0;
  border: 0;
  background: none;
}
.preview img, .bau-previews img, .preview video {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}
.preview i {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-style: normal;
  font-size: 18px;
  pointer-events: none;
}
.preview span {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(20, 16, 12, 0.8);
  color: #fff;
  font-size: 14px;
  line-height: 22px;
}

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips--wrap { flex-wrap: wrap; overflow: visible; }
.chip {
  flex-shrink: 0;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
}
.chip.is-on { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }

.primary {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 16px;
  background: var(--gold);
  color: var(--gold-ink);
  font: inherit;
  font-size: 16px;
  font-weight: 800;
}
.primary:disabled { opacity: 0.5; }

.check { border: 1px solid var(--line); border-radius: 16px; padding: 8px 12px; margin: 8px 0 14px; }
.check legend { padding: 0 6px; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.check label { display: flex; align-items: center; gap: 12px; min-height: 48px; font-size: 16px; font-weight: 600; }
.check input { width: 22px; height: 22px; }
.sign {
  width: 100%;
  height: 168px;
  background: #f4ece3;
  border-radius: 14px;
  touch-action: none;
}

.row-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px;
  margin-bottom: 10px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  color: inherit;
  text-decoration: none;
  font: inherit;
}
.row-btn span { display: block; font-weight: 800; }
.row-btn small { display: block; margin-top: 4px; color: var(--muted); }
.row-btn--danger { color: var(--warn); }

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #1a1510;
  border-top: 1px solid var(--line);
  z-index: 30;
}
.tab {
  appearance: none;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.tab span { font-size: 18px; line-height: 1; }
.tab small { font-size: 10px; font-weight: 800; }
.tab--on { color: var(--gold); }

.archive-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.archive-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.archive-card__top time { color: var(--muted); font-size: 12px; font-weight: 700; }
.archive-card__detail { white-space: pre-wrap; margin-top: 6px; }
.photo-hit {
  position: relative;
  padding: 0;
  border: 0;
  background: none;
  width: 88px;
  height: 88px;
  flex-shrink: 0;
}
.photo-hit img, .photos img, .photo-hit video {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}
.photo-hit i {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-style: normal;
  font-size: 20px;
  text-shadow: 0 1px 6px #000;
  pointer-events: none;
}
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(10, 8, 6, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 16px 16px;
}
.lightbox[hidden] { display: none; }
.lightbox img, .lightbox video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.lightbox video { width: min(100%, 900px); background: #000; }

@media (min-width: 700px) {
  .app, .tabbar { max-width: 900px; }
  .app-top, .app-body { padding-left: 8px; padding-right: 8px; }
  .hello { font-size: 28px; }
  .hello-sub { font-size: 16px; }
  .tiles { gap: 14px; }
  .tile { min-height: 140px; padding: 18px; }
  .tile__t { font-size: 17px; }
  .tile__d { font-size: 13px; }
  .stat { min-height: 88px; }
  .stat strong { font-size: 26px; }
  .field, .project-bar__select { min-height: 56px; font-size: 17px; }
  .chip { min-height: 46px; font-size: 15px; }
  .primary { min-height: 58px; font-size: 17px; }
  .cam-split--3 .cam { min-height: 140px; }
  .cam-split--3 .cam strong { font-size: 16px; }
  .tab { min-height: 70px; }
  .tab span { font-size: 22px; }
  .tab small { font-size: 12px; }
  .sheet-top h1 { font-size: 22px; }
  .archive-card__top time { font-size: 14px; }
  .sign { height: 220px; }
  .preview, .preview img, .bau-previews img, .preview video { width: 96px; height: 96px; }
  .photo-hit, .photo-hit img, .photos img, .photo-hit video { width: 110px; height: 110px; }
  .check label { min-height: 52px; font-size: 17px; }
}

@media (min-width: 700px) and (orientation: landscape) {
  .app, .tabbar { max-width: 1100px; }
  .sheet { max-width: 760px; margin-left: auto; margin-right: auto; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
}
.lightbox__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}
