/* Design angelehnt an StrataSync-Reborn (BCOMM): weißer Kopf mit Logo, grüne Linie, Blau #1f4e78 */
:root {
  --blue: #1f4e78; --blue-soft: #e8f0f8; --green: #8fbe1f; --green-dark: #6d9612;
  --ink: #1a1a1a; --muted: #6b6b6b; --line: #e0e3e8; --bg: #f4f5f7; --card: #fff;
  --st-offen: #8a9099; --st-in_bearbeitung: #2f6fde; --st-fehlende_vorleistung: #e0820b; --st-fertig: #2e9e5b;
  --danger: #b23b3b;
}
* { box-sizing: border-box }
body { font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Arial, sans-serif; margin: 0; color: var(--ink); background: var(--bg); -webkit-text-size-adjust: 100% }
a { color: var(--blue) }
header.brand { background: #fff; color: #4a4a4a; border-bottom: 4px solid var(--green); padding: 10px 20px 8px;
  padding-top: max(10px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 18px; flex-wrap: wrap; position: sticky; top: 0; z-index: 20 }
header.brand .logo { height: 46px; width: auto; display: block }
header.brand .ttl { border-left: 2px solid #d5d8dc; padding-left: 16px; min-width: 0; flex: 1 }
header.brand h1 { color: #555; font-weight: 600; font-size: 18px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
header.brand h1 #subtitle { font-weight: 400; color: var(--muted) }
header nav { margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px }
header nav a { color: var(--blue); font-weight: 500; text-decoration: none; padding: 2px 0 }
header nav a:hover, header nav a.on { color: var(--green-dark) }
header nav .me { color: var(--muted); font-size: 13px; margin-left: auto }
main { max-width: 1180px; margin: 0 auto; padding: 16px 20px 80px }
h2 { font-size: 20px; margin: 6px 0 4px } h3 { font-size: 15px; margin: 2px 0 10px; color: var(--blue) }
.muted { color: var(--muted); font-size: 13px }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin: 12px 0 }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center }
.row.end { justify-content: flex-end } .grow { flex: 1 } .spacer { flex: 1 }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin: 12px 0 }
.grid .card { margin: 0 }
label { display: block; font-size: 12px; color: #555; margin: 8px 0 2px }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #bbb; border-radius: 5px; font: inherit; font-size: 15px; background: #fff; color: var(--ink) }
textarea { min-height: 70px; resize: vertical }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue) }
input.mono { font-family: ui-monospace, Consolas, monospace; letter-spacing: .5px }
button, .btn { background: var(--blue); color: #fff; border: 0; border-radius: 5px; padding: 8px 14px; font: inherit; font-size: 14px;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; min-height: 38px }
button.sec, .btn.sec { background: #e9edf2; color: var(--blue) }
button.ghost { background: transparent; color: var(--blue); padding: 6px 8px }
button.danger { background: var(--danger) } button.sec.danger { background: #f6e5e5; color: var(--danger) }
button.small, .btn.small { padding: 4px 10px; font-size: 13px; min-height: 30px }
button:disabled { opacity: .5; cursor: default }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; margin: 10px 0; cursor: pointer; color: var(--ink) }
.check input { width: 22px; height: 22px; accent-color: var(--green-dark) }
.req { color: var(--danger) }
.tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 9px; background: #eef0f3; color: var(--muted); vertical-align: middle }

/* Status */
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap }
.st::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--c) }
.st-offen { --c: var(--st-offen) } .st-in_bearbeitung { --c: var(--st-in_bearbeitung) }
.st-fehlende_vorleistung { --c: var(--st-fehlende_vorleistung) } .st-fertig { --c: var(--st-fertig) }
.statusbar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0 }
.statusbar button { background: #fff; color: var(--ink); border: 2px solid var(--line); flex-direction: column; gap: 2px; min-height: 58px;
  font-size: 13px; line-height: 1.2; white-space: normal; text-align: center; justify-content: center }
.statusbar button::before { content: ''; width: 14px; height: 14px; border-radius: 50%; background: var(--c) }
.statusbar button.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, #fff); font-weight: 600 }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 }
.chip { background: #fff; border: 1px solid var(--line); color: var(--ink); border-radius: 16px; padding: 3px 12px; min-height: 30px; font-size: 13px }
.chip.on { background: var(--blue); color: #fff; border-color: var(--blue) }
.chip.st.on::before { box-shadow: 0 0 0 2px #fff }

/* Fortschritt */
.progress { height: 10px; border-radius: 5px; background: #eef0f3; overflow: hidden; display: flex; margin: 8px 0 4px }
.progress span { display: block; height: 100% }
.progress.big { height: 16px; border-radius: 8px }
.pct { font-size: 28px; font-weight: 700; color: var(--blue); line-height: 1 }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--muted) }

/* Projekte */
.pcard { cursor: pointer; display: block; color: inherit; text-decoration: none; transition: border-color .15s }
.pcard:hover { border-color: var(--blue) }
.pcard h3 { margin: 0 0 2px; color: var(--ink); font-size: 16px }

/* Räume */
.site-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap }
.site-head h3 { margin: 0; font-size: 16px }
.rooms { list-style: none; margin: 10px -16px -14px; padding: 0; border-top: 1px solid var(--line) }
.rooms li a { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none }
.rooms li:last-child a { border-bottom: 0 }
.rooms li a:hover { background: #f7f9fc }
.rooms .nm { font-weight: 600 } .rooms .sub { grid-column: 1; color: var(--muted); font-size: 12px }
.rooms .st { grid-row: 1 / span 2; grid-column: 2; align-self: center }
.empty { color: var(--muted); padding: 10px 0 }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 2px } .crumbs a { color: var(--blue); text-decoration: none }

/* Raum-Editor */
.missing { background: #fff6e8; border: 1px solid #f0d3a5; color: #7a4a00; border-radius: 6px; padding: 8px 12px; font-size: 13px }
.ok-box { background: #edf7ef; border: 1px solid #bfe2c8; color: #1d6b3a; border-radius: 6px; padding: 8px 12px; font-size: 13px }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 14px }
.fields .wide { grid-column: 1 / -1 }
.device { border: 1px solid var(--line); border-left: 4px solid var(--c, var(--st-offen)); border-radius: 6px; padding: 8px 12px 12px; margin: 10px 0; background: #fcfdfe }
.device .dh { display: flex; align-items: center; gap: 8px; flex-wrap: wrap }
.device .dh strong { font-size: 15px }
.input-btn { display: flex; gap: 6px } .input-btn input { flex: 1 } .input-btn button { flex: none }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-top: 10px }
.photo { position: relative; border-radius: 6px; overflow: hidden; background: #eef0f3; aspect-ratio: 4/3; cursor: pointer }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block }
.photo .cap { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(transparent, rgba(0,0,0,.65)); color: #fff; font-size: 11px; padding: 14px 6px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.uploading { opacity: .6 }
.savebar { position: fixed; right: 16px; bottom: 16px; z-index: 30; font-size: 13px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 4px 12px; box-shadow: 0 2px 8px rgba(0,0,0,.08); color: var(--muted) }
.savebar.saving { color: var(--blue) } .savebar.saved { color: var(--st-fertig) } .savebar.err { color: var(--danger) }
.pager { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px }

/* Vorlagen-Editor */
.fdef { display: grid; grid-template-columns: 1fr 150px auto; gap: 6px 8px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line) }
.fdef .opts { grid-column: 1 / -1 }
.fdef .flags { display: flex; gap: 12px; align-items: center; font-size: 13px }
.fdef .flags label { display: flex; align-items: center; gap: 4px; margin: 0; font-size: 13px }
.fdef .acts { display: flex; gap: 2px }

/* Tabellen */
.tbl-wrap { overflow-x: auto }
table { border-collapse: collapse; width: 100%; font-size: 13px }
th, td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top }
th { background: #f0f3f7; font-weight: 600; color: #555 }
td.mono { font-family: ui-monospace, Consolas, monospace }

/* Dialog & Toast */
dialog { border: 0; border-radius: 10px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: 0 10px 40px rgba(0,0,0,.25) }
dialog::backdrop { background: rgba(20,30,45,.45) }
dialog form { padding: 18px 20px }
dialog h3 { font-size: 17px; margin-top: 0 }
dialog .row.end { margin-top: 16px }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120px); background: #233; color: #fff; padding: 10px 16px;
  border-radius: 8px; font-size: 14px; transition: transform .25s; z-index: 50; max-width: calc(100vw - 32px) }
#toast.show { transform: translateX(-50%) translateY(0) } #toast.err { background: var(--danger) }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px }
.lightbox img { max-width: 100%; max-height: calc(100vh - 120px); object-fit: contain }
.lightbox .row { margin-top: 12px }
.scanner video { width: 100%; border-radius: 8px; background: #000 }

/* Login */
.login { max-width: 420px; margin: 8vh auto; text-align: center }
.login .card { padding: 28px }
.ms { background: #2f2f2f; font-size: 15px; padding: 10px 18px }
input[type=password] { width: 100%; padding: 8px 10px; border: 1px solid #bbb; border-radius: 5px; font: inherit; font-size: 15px }
.local-login { margin-top: 22px; text-align: left; border-top: 1px solid var(--line); padding-top: 12px }
.local-login summary { cursor: pointer; color: var(--blue); font-size: 13px; text-align: center }
.warn-text { color: var(--danger); font-size: 13px; margin: 8px 0 0 }

@media (max-width: 640px) {
  header.brand { padding: 8px 12px 6px; gap: 10px }
  header.brand .logo { height: 32px }
  header.brand .ttl { padding-left: 10px }
  header.brand h1 { font-size: 16px }
  header nav .me { display: none }
  main { padding: 12px 12px 90px }
  .statusbar { grid-template-columns: repeat(2, 1fr) }
  .fdef { grid-template-columns: 1fr 120px }
  .fdef .acts { grid-column: 1 / -1; justify-content: flex-end }
  .hide-m { display: none !important }
}
@media print { header.brand nav, .no-print { display: none !important } }
