/* MMB melden – Stadtplan: gelber Umschlag, Kartenpapier, Planquadrate. */

@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/barlow-condensed-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("assets/fonts/barlow-condensed-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("assets/fonts/barlow-condensed-700-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+A720-A7FF;
}

:root {
  /* Umschlag */
  --cover: #f4c600;
  --cover-ink: #1a1605;
  --cover-ink-2: #4d4000;
  /* Papier und Tinte */
  --ground: #eef0ef;
  --sheet: #ffffff;
  --sheet-2: #f6f7f6;
  --ink: #15191c;
  --ink-2: #4c5459;
  --ink-3: #69727a;
  --rule: #d7dcda;
  --rule-strong: #b9c0bd;
  /* Karte: Farben nur für Zustände */
  --pin: #d9352a;
  --park: #2f7d3e;
  --water: #1f6fb3;
  --road: #fff3b8;
  --warn-tint: #fff4cc;
  --warn-ink: #5b4500;
  --danger: #c42c22;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --font-plan: "Barlow Condensed", "Arial Narrow", sans-serif;
  --r: 14px;
  --r-sm: 10px;
  --gutter: 16px;
  --tabbar-h: 58px;
  --shadow: 0 1px 2px rgba(20, 25, 28, .06), 0 6px 18px rgba(20, 25, 28, .07);
  --ease: cubic-bezier(.22, 1, .36, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --cover: #e0b400;
    --cover-ink: #171303;
    --cover-ink-2: #3d3200;
    --ground: #0d1318;
    --sheet: #172029;
    --sheet-2: #1d2731;
    --ink: #eef2f3;
    --ink-2: #b4bec4;
    --ink-3: #8d989f;
    --rule: #2a3540;
    --rule-strong: #3a4753;
    --pin: #ff5a4b;
    --park: #7fd08c;
    --water: #8cc4f5;
    --road: #3a3317;
    --warn-tint: #3a3010;
    --warn-ink: #ffe38a;
    --danger: #ff6b60;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 22px rgba(0, 0, 0, .28);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--ground);
  color: var(--ink);
  font: 17px/1.42 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  caret-color: var(--ink);
  min-height: 100dvh;
}
::selection { background: var(--cover); color: var(--cover-ink); }
[hidden] { display: none !important; }
a { color: var(--water); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--water); outline-offset: 2px; border-radius: 6px; }

svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.inline-icon { width: 17px; height: 17px; vertical-align: -3px; margin-right: 6px; }

main { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px); }

/* ---------- Umschlag (Kopf jedes Screens) ---------- */

.cover {
  background: var(--cover);
  color: var(--cover-ink);
  padding: calc(env(safe-area-inset-top) + 22px) var(--gutter) 22px;
  position: relative;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .12), 0 4px 10px -6px rgba(0, 0, 0, .25);
}
.cover h1 { font-size: 34px; line-height: 1.08; font-weight: 800; letter-spacing: -0.025em; margin: 0; }
.cover p { margin: 6px 0 0; color: var(--cover-ink-2); font-size: 15px; font-weight: 500; }

.body { padding: 20px var(--gutter) 0; max-width: 560px; margin: 0 auto; }
h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.015em; margin: 28px 0 6px; }

.hint { color: var(--ink-2); font-size: 15px; margin: 8px 0; }
.hint.center { text-align: center; }
.error { color: var(--danger); font-weight: 600; font-size: 15px; }
.ok { color: var(--park); font-weight: 600; font-size: 15px; }
em { font-style: normal; color: var(--ink-3); font-weight: 400; }

/* ---------- Buttons ---------- */

.btn {
  font: inherit; font-weight: 600; letter-spacing: -0.01em;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 20px; width: 100%;
  border-radius: var(--r); border: 0; cursor: pointer;
  transition: transform .15s var(--ease), background-color .2s var(--ease), opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--cover); color: var(--cover-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 4px 10px -4px rgba(0, 0, 0, .22); }
.btn-primary:active { background: color-mix(in oklab, var(--cover), #000 8%); }
.btn-quiet { background: var(--sheet); color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.btn-text { background: none; color: var(--ink-2); min-height: 44px; }
.btn-text.danger, .danger { color: var(--danger); }
.btn-sm { min-height: 40px; width: auto; padding: 0 14px; font-size: 15px; border-radius: var(--r-sm); }
.btn-sm svg { width: 18px; height: 18px; }

/* Untere Aktionsleiste: eine Entscheidung, ein Knopf */
.actionbar {
  position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  margin: 20px calc(-1 * var(--gutter)) 0;
  padding: 16px var(--gutter) 10px;
  background: linear-gradient(to bottom, transparent, var(--ground) 28%);
  display: grid; gap: 2px;
  z-index: 5;
}

/* ---------- Foto-Kacheln ---------- */

.pick { display: grid; grid-template-columns: 1.25fr 1fr; gap: 12px; }
.tile {
  display: flex; flex-direction: column; justify-content: flex-end; gap: 2px;
  min-height: 148px; padding: 16px; border-radius: var(--r);
  cursor: pointer; position: relative;
  transition: transform .15s var(--ease);
}
.tile:active { transform: scale(.98); }
.tile-icon { width: 34px; height: 34px; stroke-width: 1.6; position: absolute; top: 16px; left: 16px; }
.tile-title { font-weight: 700; font-size: 18px; letter-spacing: -0.015em; }
.tile-sub { font-size: 14px; }
.tile-camera { background: var(--ink); color: var(--ground); }
.tile-camera .tile-icon { color: var(--cover); }
.tile-camera .tile-sub { color: color-mix(in oklab, var(--ground), var(--ink) 30%); }
.tile-library { background: var(--sheet); color: var(--ink); box-shadow: var(--shadow); }
.tile-library .tile-sub { color: var(--ink-2); }
.tile:has(input:focus-visible) { outline: 3px solid var(--water); outline-offset: 2px; }

.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 4px; }
.thumbs:empty { display: none; }
.thumb { position: relative; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; background: var(--rule); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button {
  position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; padding: 0;
  border-radius: 50%; background: rgba(15, 18, 20, .66); color: #fff; border: 0;
  font-size: 20px; line-height: 32px; cursor: pointer;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.thumbs.strip { grid-template-columns: repeat(3, 84px); margin: 0 0 16px; }

/* ---------- Karte mit Planquadrat-Linealen ---------- */

.mapframe {
  position: relative;
  display: grid;
  grid-template-columns: 22px 1fr;
  grid-template-rows: 22px 1fr;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--cover);
  box-shadow: var(--shadow);
  margin-top: 10px;
}
.mapframe .map { grid-column: 2; grid-row: 2; height: 320px; z-index: 0; }
.mapframe.small .map { height: 210px; }
.ruler {
  background: var(--cover); color: var(--cover-ink);
  font: 700 13px/1 var(--font-plan); letter-spacing: .02em;
  position: relative; overflow: hidden;
}
.ruler-x { grid-column: 2; grid-row: 1; box-shadow: inset 0 -1px 0 rgba(0,0,0,.2); }
.ruler-y { grid-column: 1; grid-row: 2; box-shadow: inset -1px 0 0 rgba(0,0,0,.2); }
.ruler span { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; }
.ruler-x span { top: 50%; }
.ruler-y span { left: 50%; }
.ruler i { position: absolute; background: rgba(0,0,0,.4); }
.ruler-x i { bottom: 0; height: 7px; width: 1px; }
.ruler-y i { right: 0; width: 7px; height: 1px; }

.pq {
  position: absolute; left: 32px; top: 32px; z-index: 500;
  background: var(--ink); color: var(--cover);
  font: 700 13px/1 var(--font-plan); letter-spacing: .08em; text-transform: uppercase;
  padding: 6px 10px 5px; border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  pointer-events: none;
}
.pq b { font-size: 20px; letter-spacing: .02em; margin-left: 5px; color: #fff; vertical-align: -1px; }

.addr-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-top: 12px; }
.addr { margin: 10px 0 0; font-weight: 600; font-size: 16px; min-height: 1.4em; }
.addr-row .addr { margin: 0; }

/* Leaflet an die Welt anpassen */
.leaflet-container { font: 13px var(--font); background: var(--road); }
.leaflet-control-layers, .leaflet-bar { border: 0 !important; box-shadow: 0 1px 6px rgba(0,0,0,.25) !important; border-radius: 10px !important; overflow: hidden; }
.leaflet-bar a { width: 34px !important; height: 34px !important; line-height: 34px !important; color: var(--ink) !important; background: var(--sheet) !important; border-color: var(--rule) !important; }
.leaflet-control-layers { background: var(--sheet) !important; color: var(--ink) !important; }
.leaflet-control-attribution { font-size: 10px; }
.pin-icon svg { width: 34px; height: 44px; stroke: none; filter: drop-shadow(0 3px 3px rgba(0,0,0,.35)); }

/* ---------- Formulare ---------- */

.field { display: block; margin-top: 18px; font-size: 15px; font-weight: 600; color: var(--ink-2); }
.field span { display: block; margin-bottom: 6px; }
input, select, textarea {
  font: inherit; font-size: 17px; font-weight: 400; color: var(--ink);
  background: var(--sheet); border: 1px solid var(--rule-strong); border-radius: var(--r-sm);
  width: 100%; padding: 13px 14px; margin: 0;
  -webkit-appearance: none; appearance: none;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in oklab, var(--cover), transparent 40%); }

/* Gruppierte Liste wie in den iOS-Einstellungen */
.group { background: var(--sheet); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.row-field { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 8px; padding: 4px 4px 4px 16px; border-bottom: 1px solid var(--rule); font-size: 15px; font-weight: 600; }
.row-field:last-child { border-bottom: 0; }
.row-field > span { color: var(--ink-2); }
.row-field input, .row-field select, .row-field textarea { border: 0; background-color: transparent; padding: 12px; box-shadow: none !important; font-weight: 400; }
.row-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2369727a' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 20px;
  padding-right: 34px; font-weight: 600; text-overflow: ellipsis;
}
.row-text { grid-template-columns: 1fr; padding: 12px 16px 4px; }
.row-text > span { display: flex; justify-content: space-between; }
.row-text textarea { padding: 6px 0 12px; resize: none; line-height: 1.45; }
.counter { font-variant-numeric: tabular-nums; font-family: var(--font-plan); font-size: 15px; }
#profile-form .btn { margin-top: 18px; }
.alt { margin: 0; padding: 10px 16px; border-bottom: 1px solid var(--rule); font-size: 14px; color: var(--ink-2); background: var(--sheet-2); }
.alt .btn-link { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--water); cursor: pointer; text-align: left; }

/* ---------- Hinweise ---------- */

.notice { display: flex; gap: 12px; align-items: flex-start; border-radius: var(--r); padding: 14px 16px; margin: 0 0 12px; font-size: 15px; }
.notice p { margin: 0 0 6px; }
.notice p:last-child { margin: 0; }
.notice-icon { width: 22px; height: 22px; margin-top: 1px; }
.notice-warn { background: var(--warn-tint); color: var(--warn-ink); }

/* ---------- Warten ---------- */

.screen-busy { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 24px calc(var(--tabbar-h) + 24px); text-align: center; }
.scan { position: relative; width: 220px; height: 220px; border-radius: 20px; overflow: hidden; background: var(--sheet); box-shadow: var(--shadow); }
.scan .scan-photo { position: absolute; inset: 0; background: center / cover no-repeat var(--sheet-2); }
.scan-line {
  position: absolute; left: 0; right: 0; height: 70px; top: -70px;
  background: linear-gradient(to bottom, transparent, color-mix(in oklab, var(--cover), transparent 40%) 88%, var(--cover));
  animation: scan 1.8s var(--ease) infinite;
}
@keyframes scan { to { top: 100%; } }
.busy-title { font-size: 20px; font-weight: 700; letter-spacing: -0.015em; margin: 24px 0 2px; }

/* ---------- Fertig ---------- */

.screen-done { min-height: 100dvh; padding: calc(env(safe-area-inset-top) + 40px) var(--gutter) calc(var(--tabbar-h) + 40px); background: var(--cover); display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.screen-done > * { width: 100%; max-width: 520px; margin-left: auto; margin-right: auto; }
.screen-done .btn-primary { background: var(--ink); color: var(--cover); margin-top: 18px; box-shadow: none; }
.screen-done .btn-text { color: var(--cover-ink); }
.ticket { background: var(--sheet); color: var(--ink); border-radius: var(--r); padding: 28px 22px 20px; box-shadow: 0 2px 4px rgba(0, 0, 0, .08), 0 14px 30px -10px rgba(0, 0, 0, .3); text-align: center; }
.stamp {
  display: inline-flex; align-items: center; gap: 6px;
  font: 700 20px/1 var(--font-plan); letter-spacing: .08em; text-transform: uppercase;
  color: var(--park); border: 2.5px solid currentColor; border-radius: 8px; padding: 7px 12px 6px;
  transform: rotate(-3deg);
  animation: stamp .5s var(--ease) both;
}
.stamp svg { width: 20px; height: 20px; stroke-width: 2.6; }
@keyframes stamp { from { transform: rotate(-3deg) scale(1.6); opacity: 0; filter: blur(2px); } }
.ticket-label { margin: 18px 0 0; color: var(--ink-2); font-size: 14px; font-weight: 600; }
.ticket-id { font: 700 46px/1.05 var(--font-plan); letter-spacing: .01em; margin: 2px 0 0; font-variant-numeric: tabular-nums; }
.ticket-pq { font: 700 15px/1 var(--font-plan); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin: 10px 0 14px; }
.ticket .hint { margin-bottom: 0; }

/* ---------- Verlauf als Planregister ---------- */

.index { list-style: none; margin: 0; padding: 0; background: var(--sheet); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.index:empty { display: none; }
.index > li { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--rule); }
.index > li:last-child { border-bottom: 0; }
.index .thumbimg { width: 58px; height: 58px; border-radius: 10px; object-fit: cover; background: var(--rule); display: block; }
.index .noimg { width: 58px; height: 58px; border-radius: 10px; background: var(--sheet-2); }
.index .meta { min-width: 0; }
.index .title { font-weight: 650; font-size: 16px; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.index .sub { color: var(--ink-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.index .when { display: flex; gap: 8px; align-items: center; color: var(--ink-3); font-size: 13px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.index .loading-row { display: block; color: var(--ink-3); }
.chip-pq { font: 700 13px/1 var(--font-plan); letter-spacing: .04em; background: var(--cover); color: var(--cover-ink); border-radius: 5px; padding: 3px 5px 2px; }

.badge { font: 700 13px/1 var(--font-plan); letter-spacing: .06em; text-transform: uppercase; padding: 5px 7px 4px; border-radius: 6px; border: 1.5px solid currentColor; white-space: nowrap; }
.badge.draft { color: var(--warn-ink); background: var(--warn-tint); border-color: transparent; }
.badge.sending, .badge.sent { color: var(--ink-2); }
.badge.open { color: var(--water); }
.badge.closed { color: var(--park); }
.badge.failed { color: var(--danger); }

.city-status { padding: 2px 16px 14px 84px; border-bottom: 1px solid var(--rule); font-size: 14px; }
.city-status:last-child { border-bottom: 0; }
.city-status .note { padding: 10px 0; border-bottom: 1px dashed var(--rule); }
.city-status .note-head { font-weight: 650; color: var(--ink); margin-bottom: 2px; }
.city-status .note div:not(.note-head) { color: var(--ink-2); }
.city-status p { color: var(--ink-2); margin: 8px 0 0; }
.city-status a { display: inline-block; margin-top: 10px; font-weight: 600; }

.empty { text-align: center; padding: 36px 20px; background: var(--sheet); border-radius: var(--r); box-shadow: var(--shadow); }
.empty p { margin: 4px 0; }
.empty .btn { margin-top: 14px; }

/* ---------- Anmelden ---------- */

.screen-login { min-height: 100dvh; display: flex; flex-direction: column; }
.login-cover { background: var(--cover); color: var(--cover-ink); padding: calc(env(safe-area-inset-top) + 64px) var(--gutter) 40px; }
.login-cover h1 { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; margin: 18px 0 6px; line-height: 1.05; }
.login-cover .lead { margin: 0; font-size: 17px; color: var(--cover-ink-2); font-weight: 500; max-width: 26ch; }
.mark { width: 58px; height: 58px; border-radius: 16px; background: var(--ink); color: var(--cover); display: grid; place-items: center; }
.mark svg { width: 30px; height: 30px; }
.sheet { padding: 24px var(--gutter); max-width: 560px; width: 100%; margin: 0 auto; }
.sheet > p { margin: 0 0 4px; color: var(--ink-2); }
.stack > * + * { margin-top: 14px; }

.legal { margin-top: 28px; }
#btn-logout { margin-top: 8px; }

/* ---------- Tableiste ---------- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in oklab, var(--sheet), transparent 6%);
  -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--rule);
}
.tab {
  font: 600 11px/1 var(--font); letter-spacing: .01em; color: var(--ink-3);
  background: none; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  cursor: pointer;
}
.tab svg { width: 25px; height: 25px; }
.tab.active { color: var(--ink); }
.tab.active svg { fill: var(--cover); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Korrekturen nach Sichtprüfung ---------- */
.index > li.city-status { display: block; padding: 0 16px 14px 84px; }
.index .title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.index .when span { white-space: nowrap; }
.index .when { flex-wrap: wrap; }
.addr-row .addr { flex: 1; min-width: 0; }
.addr-row .btn { white-space: nowrap; flex: none; }
.row-cat { grid-template-columns: 1fr; padding: 12px 16px 2px; }
.row-cat select { padding: 4px 34px 12px 0; font-size: 17px; background-position: right 0 center; }
.ticket-pq { text-transform: none; letter-spacing: .02em; font-size: 17px; line-height: 1.25; }
.ticket-pq .chip-pq { font-size: 15px; margin-right: 6px; text-transform: uppercase; }
/* Feste Tinte auf Gelb bzw. Schild-Schwarz, unabhängig vom Modus */
.pq { background: #15191c; color: #f4c600; }
.screen-done .btn-primary { background: #15191c; color: #f4c600; }
.mark { background: #15191c; color: #f4c600; }
@media (prefers-color-scheme: dark) {
  .tile-camera { background: var(--cover); color: var(--cover-ink); }
  .tile-camera .tile-icon { color: var(--cover-ink); }
  .tile-camera .tile-sub { color: var(--cover-ink-2); }
  .leaflet-control-attribution { background: rgba(23, 32, 41, .8) !important; color: var(--ink-2); }
}
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-brand img { width: 56px; height: 56px; border-radius: 13px; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.login-brand h1 { margin: 0; }
.login-cover .lead { margin-top: 14px; }
