/* Baudoku – mobile-first, Benda-Design (Blau #3ba3dc, Steel #f6f7f8) */
* { box-sizing: border-box; }
:root {
  --accent: #3ba3dc; --brand: #1f7cb4; --bg: #f6f7f8; --ink: #16191c;
  --line: #e2e5e8; --mut: #6b7480; --danger: #d84a38; --regie: #b7791f;
  --regie-bg: #fdf3e0; --radius: 10px;
}
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: "Libre Franklin", "Segoe UI", system-ui, sans-serif; font-size: 16px; }
.view { min-height: 100vh; min-height: 100dvh; }
[hidden] { display: none !important; }

header { position: sticky; top: 0; z-index: 5; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  padding-top: calc(12px + env(safe-area-inset-top)); }
.hd-title { font-weight: 600; font-size: 17px; flex: 1; min-width: 0; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.hd-user { font-size: 13px; color: var(--mut); white-space: nowrap; }
.backbtn { border: none; background: none; font-size: 26px; line-height: 1; padding: 0 4px;
  color: var(--brand); cursor: pointer; }
.savestate { font-size: 12px; color: var(--mut); white-space: nowrap; }
.savestate.err { color: var(--danger); }

main { padding: 14px; max-width: 560px; margin: 0 auto; padding-bottom: 40px; }

/* Login */
#v-login { display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: #1b2530; color: #fff; border-radius: 14px; padding: 28px 22px;
  width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login-card h1 { font-size: 20px; margin: 0 0 6px; font-weight: 600; }
.logo-dot { width: 44px; height: 44px; border-radius: 10px; background: var(--accent); color: #fff;
  font-size: 26px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin: 0 auto; }
.login-card input { background: #26313d; border: 1px solid #37424f; color: #fff; }
.err { color: #ff9d8f; font-size: 13px; min-height: 18px; }

input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: var(--radius); font: inherit; background: #fff; color: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { min-height: 90px; resize: vertical; }

.btn { display: block; width: auto; padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--line);
  background: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.wide { width: 100%; margin-top: 14px; }
.btn:active { transform: scale(.98); }
.linkbtn { border: none; background: none; color: var(--brand); font: inherit; font-size: 14px;
  padding: 6px 0; cursor: pointer; }

.sec-label { font-size: 13px; font-weight: 600; color: var(--brand); text-transform: uppercase;
  letter-spacing: .04em; margin: 20px 0 8px; padding-left: 10px; border-left: 3px solid var(--accent); }
.sub-label { font-size: 13px; font-weight: 600; color: var(--mut); margin: 14px 0 6px; }
.mut { color: var(--mut); font-size: 12px; font-weight: 400; }
.center { text-align: center; margin-top: 8px; }

.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 10px 0; }

/* Baustellen-Liste */
.site-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  margin-bottom: 8px; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.site-card:active { background: #f0f6fa; }
.site-card .nr { font-weight: 700; color: var(--brand); white-space: nowrap; }
.site-card .nm { flex: 1; min-width: 0; }
.site-card .nm .t { font-weight: 600; font-size: 15px; }
.site-card .nm .s { font-size: 12px; color: var(--mut); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-today { background: #e3f2db; color: #3b6d11; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 10px; white-space: nowrap; }

.site-head { font-size: 13px; color: var(--mut); margin-bottom: 12px; line-height: 1.5; }
.site-head b { color: var(--ink); }

.seg { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.seg button { flex: 1; padding: 11px; border: none; background: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--accent); color: #fff; }
.seg.small { margin: 6px 0; }
.seg.small button { padding: 8px; font-size: 13px; }

.btn.small { padding: 8px 12px; font-size: 13px; color: var(--brand); border-color: var(--accent); white-space: nowrap; }

/* Chat-Blasen: eigene rechts (blau getönt), Kollegen links */
.entry { background: #fff; border: 1px solid var(--line); border-radius: 12px;
  border-bottom-left-radius: 4px; padding: 10px 12px; margin: 0 14% 8px 0; }
.entry.mine { background: #e9f4fb; border-color: #cfe7f5; margin: 0 0 8px 14%;
  border-bottom-left-radius: 12px; border-bottom-right-radius: 4px; }
.entry .who { display: block; font-weight: 700; color: var(--brand); font-size: 12px; margin-bottom: 1px; }
.entry .meta { font-size: 11px; color: var(--mut); display: flex; justify-content: space-between; margin-bottom: 3px; }
.entry .meta > span { min-width: 0; }
.entry .txt { font-size: 14px; white-space: pre-wrap; }
.entry.regie { background: var(--regie-bg); border-color: #ecd9ae; }
.entry.regie .meta { color: var(--regie); font-weight: 600; }
.entry .thumbs { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.entry .thumbs img { width: 62px; height: 62px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.entry .mat { font-size: 13px; color: var(--mut); margin-top: 4px; }
.entry .del { float: right; border: none; background: none; color: var(--mut); font-size: 15px; cursor: pointer; padding: 0 0 0 8px; }

.quickbar { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0; }
.quickbar button { background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 2px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px; }
.quickbar button > :first-child { font-size: 19px; }
.quickbar button.regie { background: var(--regie-bg); border-color: #ecd9ae; color: var(--regie); }
.quickbar button:active { background: #f0f6fa; }

.finalnote { background: #e3f2db; color: #3b6d11; border-radius: var(--radius); padding: 10px 12px;
  font-size: 14px; font-weight: 600; margin-bottom: 10px; }

/* Abschluss */
.crew-row { display: flex; gap: 8px; margin-bottom: 6px; align-items: center; }
.crew-row input.nm { flex: 1; }
.crew-row input.hrs { width: 74px; text-align: right; }
.crew-row .rm { border: none; background: none; color: var(--mut); font-size: 17px; cursor: pointer; padding: 4px; }
.row2 { display: flex; gap: 10px; margin-top: 10px; }
.row2 > * { flex: 1; }
.chk { display: flex; align-items: center; gap: 9px; padding: 7px 0; font-size: 14px; }
.chk input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.fld { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--mut); }
#cl-sign { width: 100%; height: 130px; border: 1px dashed #b9c0c7; border-radius: var(--radius);
  background: #fff; touch-action: none; margin-top: 6px; }

/* Overlay-Sheet */
.overlay { position: fixed; inset: 0; background: rgba(22,25,28,.55); z-index: 20;
  display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; border-radius: 16px 16px 0 0; width: 100%; max-width: 560px;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 86vh; overflow-y: auto; }
.sheet-title { font-weight: 700; font-size: 16px; margin-bottom: 12px; }
.sheet-btns { display: flex; gap: 10px; margin-top: 16px; }
.sheet-btns .btn { flex: 1; }
.matrow { display: flex; gap: 8px; margin-bottom: 6px; }
.matrow .qty { width: 74px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chips button { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 6px 11px;
  font: inherit; font-size: 12px; cursor: pointer; }
.chips button:active { background: #f0f6fa; }
.ov-field { margin-bottom: 10px; }
.ov-label { font-size: 13px; font-weight: 600; color: var(--mut); margin: 10px 0 4px; }
.ov-thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ov-thumbs img { width: 62px; height: 62px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

/* Schnelleingabe-Leiste (Chat-Stil) */
#v-report main { padding-bottom: 120px; }
.composer { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  background: #fff; border-top: 1px solid var(--line);
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto; }
.comp-row { display: flex; gap: 8px; align-items: center; }
#cp-plus { border: none; background: #eef2f5; color: var(--brand); width: 42px; height: 42px;
  border-radius: 50%; font-size: 26px; line-height: 1; cursor: pointer; flex-shrink: 0; }
#cp-plus:active { transform: scale(.94); }
.comp-row input[type="text"], .comp-row input:not([type]) { flex: 1; border-radius: 20px; padding: 10px 14px; }
#cp-send { border: none; background: var(--accent); color: #fff; width: 42px; height: 42px;
  border-radius: 50%; font-size: 17px; cursor: pointer; flex-shrink: 0; }
#cp-send:active { transform: scale(.94); }
.comp-thumbs { display: flex; gap: 6px; flex-wrap: wrap; padding: 4px 0 8px; }
.comp-thumbs .ct { position: relative; }
.comp-thumbs img { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.comp-thumbs .rm { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px;
  border-radius: 50%; border: none; background: var(--ink); color: #fff; font-size: 11px;
  line-height: 20px; padding: 0; cursor: pointer; }
#cp-status { min-height: 14px; padding-top: 2px; }
.pend-regie { display: flex; align-items: center; gap: 10px; background: var(--regie-bg);
  border: 1px solid #ecd9ae; border-radius: var(--radius); padding: 7px 10px; margin-bottom: 8px;
  font-size: 13px; font-weight: 600; color: var(--regie); }
.pend-regie input { width: 74px; padding: 7px 9px; text-align: right; }
.pend-regie button { border: none; background: none; color: var(--regie); font-size: 15px;
  cursor: pointer; margin-left: auto; }
#cp-mat { margin: 6px 0 2px; }
#cp-mat .matrow { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; }
#cp-mat .qty { width: 72px; padding: 8px 9px; }
#cp-mat .nm { flex: 1; padding: 8px 10px; }
#cp-mat .rm { border: none; background: none; color: var(--mut); font-size: 15px; cursor: pointer; padding: 2px; }

.attach-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.attach-grid button { background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 4px; font: inherit; font-weight: 600; font-size: 12.5px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 0; }
.attach-grid button > :first-child { font-size: 26px; }
.attach-grid button:active { background: #f0f6fa; }
.attach-grid button.regie { background: var(--regie-bg); border-color: #ecd9ae; color: var(--regie); }

/* Foto-Editor (Zeichnen + Koten) */
.an-ov { position: fixed; inset: 0; z-index: 40; background: #16191c;
  display: flex; flex-direction: column; }
.an-top { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top)); }
.an-btn { border: 1px solid #3a4450; background: #232b34; color: #dfe5ea; font: inherit;
  font-weight: 600; font-size: 14px; padding: 9px 14px; border-radius: 10px; cursor: pointer; }
.an-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.an-tools { display: flex; gap: 6px; }
.an-tool { width: 44px; height: 44px; border-radius: 10px; border: 1px solid #3a4450;
  background: #232b34; font-size: 20px; color: #dfe5ea; cursor: pointer; }
.an-tool.on { background: var(--accent); border-color: var(--accent); }
.an-canvaswrap { flex: 1; display: flex; align-items: center; justify-content: center;
  overflow: hidden; min-height: 0; touch-action: none; position: relative; }
#an-cv { max-width: 100%; max-height: 100%; touch-action: none; display: block;
  transform-origin: center center; }
.an-zoom { display: flex; gap: 4px; }
.an-zoom button { border: 1px solid #3a4450; background: #232b34; color: #dfe5ea;
  border-radius: 10px; padding: 6px 10px; font: inherit; font-size: 13px; min-width: 34px; cursor: pointer; }
.an-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); }
.an-colors { display: flex; gap: 8px; }
.an-colors button { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #3a4450;
  cursor: pointer; padding: 0; }
.an-colors button.on { border-color: #fff; outline: 2px solid var(--accent); }
.an-widths { display: flex; gap: 6px; }
.an-widths button { border: 1px solid #3a4450; background: #232b34; color: #dfe5ea;
  border-radius: 10px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.an-widths button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
/* Maß-Eingabe MODAL: Abdunkelung fängt ALLE Berührungen ab, nichts erreicht
   die Zeichenfläche, das Eingabefeld verliert nie den Fokus */
.an-dimwrap { position: fixed; inset: 0; z-index: 45; background: rgba(10,13,16,.55);
  display: flex; align-items: flex-start; justify-content: center; padding-top: 16vh; }
.an-dimcard { background: #fff; border-radius: 14px; padding: 16px; width: min(86vw, 320px);
  box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.an-dimtitle { font-weight: 700; margin-bottom: 8px; }
.an-dimbtns { display: flex; gap: 8px; margin-top: 10px; }
.an-dimbtns .btn { flex: 1; }
.comp-thumbs .edit-hint { position: absolute; bottom: -5px; right: -5px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; line-height: 20px;
  text-align: center; pointer-events: none; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 30;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 20px; font-size: 14px;
  max-width: 90vw; text-align: center; }
