:root {
  --green: #50b500;
  --green-d: #3a8700;
  --green-l: #e8f5d6;
  --grey: #3f3f41;
  --grey-l: #f1f1f2;
  --line: #d9d9db;
  --red: #c0392b;
  --amber: #e08e0b;
  --bg: #ffffff;
  --fg: #1e1e1f;
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); }
body { font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 17px; line-height: 1.35; padding-bottom: 96px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
main { padding: 12px 14px; max-width: 720px; margin: 0 auto; }

/* Kopf */
.top { background: var(--grey); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; flex-direction: column; line-height: 1.1; }
.brand-i { font-weight: 700; font-size: 18px; letter-spacing: .2px; }
.brand-i b { color: var(--green); }
.brand-t { font-size: 12px; opacity: .8; }
.top-r { display: flex; align-items: center; gap: 8px; }
.user { font-size: 13px; opacity: .9; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flags { display: flex; gap: 2px; }
.flag { background: transparent; border: 2px solid transparent; border-radius: 8px; font-size: 22px; line-height: 1; padding: 4px 5px; opacity: .6; }
.flag.on { opacity: 1; border-color: var(--green); background: rgba(255,255,255,.12); }
.status { background: var(--grey-l); border-bottom: 1px solid var(--line); font-size: 13px; padding: 6px 14px; color: #444; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; background: #999; }
.dot.on { background: var(--green); }
.dot.off { background: var(--red); }
.pend { color: var(--red); }

/* Elemente */
.btn { background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 12px 16px; min-height: 52px; font-weight: 600; }
.btn.primary { background: var(--green-d); border-color: var(--green-d); color: #fff; }
.btn.big { width: 100%; min-height: 60px; font-size: 19px; }
.btn:active { filter: brightness(.92); }
.link { background: none; border: none; padding: 8px 10px; color: var(--green-d); font-weight: 600; }
.link.big { font-size: 17px; padding: 12px 10px; }
.icon-btn { background: none; border: none; font-size: 28px; line-height: 1; padding: 8px 12px; color: var(--grey); }
.card { background: #fff; margin: 16px auto; }
.login h1 { margin: 8px 0 16px; font-size: 26px; }
.hint { color: #666; font-size: 14px; }
.alert { border-radius: 10px; padding: 10px 12px; margin: 8px 0; font-size: 15px; }
.alert.err { background: #fdecea; color: #8c1d12; border: 1px solid #f3b9b2; }
.alert.warn { background: #fff4de; color: #7a4a00; border: 1px solid #f1d29b; }
.alert.small { font-size: 13px; padding: 6px 8px; margin: 4px 0 0; }
.info { background: var(--green-l); border-radius: 10px; padding: 9px 12px; margin: 8px 0; font-size: 15px; }
.badge { font-size: 12px; background: var(--amber); color: #fff; border-radius: 8px; padding: 2px 6px; }

/* Felder */
.field { display: block; margin: 12px 0; }
.field > span { display: block; font-size: 14px; color: #555; margin-bottom: 4px; font-weight: 600; }
input[type=text], input[type=number], input[type=password], input[type=date], select, textarea {
  width: 100%; border: 2px solid var(--line); border-radius: 12px; padding: 12px; min-height: 52px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.daterow { display: flex; gap: 8px; align-items: center; }
.daterow input { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: #fff; border: 2px solid var(--line); border-radius: 22px; padding: 10px 14px; min-height: 44px; font-weight: 600; }
.chip.sel { background: var(--green-l); border-color: var(--green-d); color: var(--green-d); }
.selrow, .fillrow, .addrow { display: flex; gap: 8px; margin: 8px 0; }
.fillrow input { flex: 1; }
.addrow .btn { flex: 1; font-size: 15px; padding: 10px 8px; }
.targetrow { display: flex; gap: 8px; }

/* Home */
.banner { display: block; width: 100%; text-align: left; border: none; border-radius: var(--radius); padding: 12px 14px; margin: 6px 0; font-weight: 500; color: #fff; }
.banner.red { background: var(--red); }
.banner.amber { background: var(--amber); }
.scanbtn { margin: 10px 0 4px; }
.grp { font-size: 15px; text-transform: uppercase; letter-spacing: .6px; color: #666; margin: 18px 0 8px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.abt { text-align: left; background: #fff; border: 2px solid var(--line); border-left-width: 8px; border-radius: var(--radius); padding: 12px; min-height: 92px; display: flex; flex-direction: column; gap: 2px; }
.abt.green { border-left-color: var(--green); }
.abt.amber { border-left-color: var(--amber); }
.abt.red { border-left-color: var(--red); }
.abt.none { border-left-color: var(--line); opacity: .75; }
.abt-n { font-weight: 700; font-size: 20px; }
.abt-c { font-size: 14px; color: #555; }
.abt-l { font-size: 13px; color: #666; margin-top: auto; display: flex; align-items: center; gap: 6px; }
.lamp { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--line); }
.lamp.green { background: var(--green); } .lamp.amber { background: var(--amber); } .lamp.red { background: var(--red); }
.foot { margin-top: 26px; display: flex; flex-direction: column; align-items: flex-start; }
.ver { color: #999; font-size: 12px; padding: 6px 10px; }

/* Abteil */
.titlebar { display: flex; align-items: center; gap: 4px; padding: 8px 6px; border-bottom: 1px solid var(--line); background: #fff; }
.h-title { font-weight: 700; font-size: 20px; }
.h-sub { font-size: 14px; color: #666; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 6px; }
.tile { background: #fff; border: 2px solid var(--line); border-radius: 18px; min-height: 104px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.tile:active { background: var(--green-l); border-color: var(--green); }
.ti { font-size: 38px; line-height: 1; }
.tl { font-weight: 700; font-size: 17px; }
.satzlist { list-style: none; padding: 0; margin: 0; }
.satzlist li { padding: 10px 0; border-bottom: 1px solid var(--grey-l); display: flex; flex-direction: column; }
.satz { font-variant-numeric: tabular-nums; letter-spacing: .5px; font-size: 18px; }

/* Formular */
.rows { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; border: 2px solid var(--line); border-radius: var(--radius); padding: 10px 12px; min-height: 62px; background: #fff; }
.row input[type=checkbox] { width: 28px; height: 28px; accent-color: var(--green-d); flex: none; }
.row-m { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.row-m small { color: #666; font-size: 13px; }
.elsewhere { color: var(--amber); font-weight: 600; }
.row.qty { flex-wrap: wrap; }
.qty-in { width: 96px; text-align: center; font-size: 20px; font-weight: 700; padding: 8px; }
.unit { font-weight: 700; color: #555; min-width: 36px; }
.seg { display: flex; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; }
.segb { background: #fff; border: none; padding: 10px 12px; font-size: 14px; font-weight: 600; min-height: 48px; }
.segb.on { background: var(--green-d); color: #fff; }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.reason { display: flex; align-items: center; gap: 10px; text-align: left; background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 10px 12px; min-height: 58px; font-weight: 600; }
.reason.sel { background: var(--green-l); border-color: var(--green-d); }
.reason.dis { opacity: .45; }
.ri { font-size: 26px; }
.approve { border-left: 5px solid var(--amber); padding-left: 10px; margin: 8px 0; }
.savebar { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); z-index: 30; }
.savebar .btn { max-width: 720px; margin: 0 auto; display: block; }

/* Letzte Buchungen */
.rec { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--grey-l); align-items: flex-start; }
.rec.gone { opacity: .45; text-decoration: line-through; }
.rec-ic { font-size: 26px; width: 34px; text-align: center; }
.rec-m { flex: 1; min-width: 0; }
.rec-m small { color: #666; }
.rec-a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 20px; }

/* Scanner, Dialog, Toast */
.scan { position: fixed; inset: 0; background: #000; z-index: 100; }
.scan video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; left: 50%; top: 42%; width: 66vmin; height: 66vmin; transform: translate(-50%, -50%); border: 4px solid rgba(80,181,0,.95); border-radius: 22px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); pointer-events: none; }
.scan-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; padding: 12px; }
.scan-top .btn { min-height: 46px; background: rgba(0,0,0,.55); color: #fff; border-color: rgba(255,255,255,.4); }
.scan-top .btn.on { background: var(--green-d); }
.scan-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.85) 40%); color: #fff; }
.scan-msg { font-size: 18px; font-weight: 600; text-align: center; }
.scan-msg.ok { color: #9be15d; }
.scan-msg.warn { color: #ffd27a; }
.scan-list { font-size: 14px; opacity: .85; text-align: center; margin: 6px 0; word-break: break-all; }
.scan-alt { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.scan-alt .btn { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.4); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 120; display: flex; align-items: center; justify-content: center; padding: 18px; }
.dlg { background: #fff; border-radius: 18px; padding: 18px; width: 100%; max-width: 420px; }
.dlg p { margin: 0 0 12px; }
.dlg-b { display: flex; gap: 10px; margin-top: 14px; }
.dlg-b .btn { flex: 1; }
.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: var(--grey); color: #fff; border-radius: 22px; padding: 12px 20px; z-index: 130; font-weight: 600; max-width: 90vw; text-align: center; }
.toast.ok { background: var(--green-d); }
.toast.warn { background: var(--amber); }

.scan-diag { margin-top: 6px; font-size: 11px; text-align: center; color: rgba(255,255,255,.65); }

.scan-flash { position: absolute; left: 0; right: 0; top: 18%; margin: 0 auto; width: 84vw; max-width: 420px; padding: 22px 16px; border-radius: 24px;
  text-align: center; color: #fff; opacity: 0; transform: scale(.85); transition: opacity .15s, transform .15s; pointer-events: none; z-index: 10; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.scan-flash.show { opacity: 1; transform: scale(1); }
.scan-flash.ok { background: #3a8700; }
.scan-flash.warn { background: #d68c00; }
.scan-flash.err { background: #be1e1e; }
.scan-flash .fl-ic { font-size: 72px; line-height: 1; font-weight: 800; }
.scan-flash .fl-t { font-size: 30px; font-weight: 800; margin-top: 6px; letter-spacing: .5px; }
.scan-flash .fl-s { font-size: 17px; margin-top: 4px; opacity: .95; }
.scan-alt .warnbtn { background: #be1e1e; border-color: #be1e1e; }
