:root {
  --navy: #101D2C;
  --navy-2: #1A2A3D;
  --blue: #1F4E8C;
  --ground: #F2F1ED;
  --surface: #FFFFFF;
  --line: #DEDCD5;
  --line-soft: #ECEAE4;
  --ink: #17191C;
  --ink-2: #4A4F55;
  --ink-3: #6B7076;
  --amber: #F5A524;
  --amber-bg: #FFF4DC;
  --amber-ink: #5C3A00;
  --green: #1D6B4A;
  --green-bg: #E8F5EE;
  --red: #B42318;
  --red-bg: #FDECEA;
  --radius: 12px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
::selection { background: var(--blue); color: #fff; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

.app { max-width: 720px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

/* Kopf */
.top { position: sticky; top: 0; z-index: 5; background: var(--navy); color: #fff; padding: calc(10px + var(--safe-top)) 16px 10px; display: flex; align-items: center; gap: 12px; }
.top h1 { margin: 0; font-size: 18px; font-weight: 750; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .sub { display: block; font-size: 12.5px; font-weight: 500; color: #A9B8CB; }
.icon-btn { width: 44px; height: 44px; border-radius: 10px; border: 1px solid #2B3B4F; background: transparent; color: #fff; display: grid; place-items: center; flex: none; }
.icon-btn svg { width: 22px; height: 22px; }

main { flex: 1; padding: 14px 14px calc(96px + var(--safe-bottom)); }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* Unten-Navigation */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + var(--safe-bottom)); display: flex; justify-content: center; }
.nav-inner { display: flex; gap: 4px; width: 100%; max-width: 720px; }
.nav a { flex: 1; text-decoration: none; color: var(--ink-3); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border-radius: 10px; font-size: 12px; font-weight: 600; position: relative; min-height: 52px; justify-content: center; }
.nav a svg { width: 24px; height: 24px; }
.nav a.on { color: var(--navy); background: var(--ground); }
.nav .dot { position: absolute; top: 4px; right: calc(50% - 22px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.nav a.melden { color: var(--amber-ink); }
.nav a.melden svg { color: #C27C00; }

/* Tage und Einsätze */
.day-head { display: flex; align-items: baseline; justify-content: space-between; margin: 8px 2px 0; }
.day-head h2 { margin: 0; font-size: 19px; font-weight: 800; }
.day-head span { font-size: 13px; color: var(--ink-3); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card.today { border: 2px solid var(--navy); }
svg { width: 20px; height: 20px; flex: none; }
.job-time svg { width: 18px; height: 18px; }
.photo-drop svg { width: 32px; height: 32px; }
.qr-box .steps { text-align: left; align-self: stretch; }
.job-time { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700; border-radius: 999px; padding: 3px 9px; background: var(--ground); color: var(--ink-2); }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.amber { background: var(--amber-bg); color: var(--amber-ink); }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.blue { background: #E6EDF7; color: var(--blue); }
.job-title { margin: 0; font-size: 19px; font-weight: 800; line-height: 1.25; }
.job-site { color: var(--ink-2); font-size: 14.5px; margin-top: -6px; }
.rows { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.row { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; font-size: 15px; }
.row svg { width: 20px; height: 20px; color: var(--ink-3); margin-top: 1px; }
.row b { font-weight: 650; }
.note { white-space: pre-wrap; background: var(--ground); border-radius: 8px; padding: 8px 10px; font-size: 14.5px; }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.btn { min-height: 48px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); padding: 0 14px; font-size: 15.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: var(--ink); }
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.amber { background: var(--amber); border-color: var(--amber); color: #1B1300; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: #F1C4BF; }
.btn.small { min-height: 38px; font-size: 14px; padding: 0 12px; }
.btn[disabled] { opacity: .5; cursor: default; }
.absence { background: repeating-linear-gradient(135deg, #ECEAE4 0 8px, #F6F5F1 8px 16px); border-style: dashed; }
.empty { text-align: center; color: var(--ink-3); padding: 28px 12px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }
.banner { border-radius: 10px; padding: 10px 12px; font-size: 14.5px; background: var(--amber-bg); color: var(--amber-ink); border: 1px solid #F0D49B; }
.banner.red { background: var(--red-bg); color: var(--red); border-color: #F1C4BF; }
.banner.green { background: var(--green-bg); color: var(--green); border-color: #BFDCCD; }
.muted { color: var(--ink-3); font-size: 13.5px; }

/* Chats */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list a { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; text-decoration: none; color: var(--ink); border-top: 1px solid var(--line-soft); min-height: 64px; }
.list a:first-child { border-top: 0; }
.avatar { width: 44px; height: 44px; border-radius: 12px; background: #E4EAF2; color: var(--navy); display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.list .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .s { font-size: 13.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: var(--red); color: #fff; font-size: 12.5px; font-weight: 800; display: grid; place-items: center; }

.chat { display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; }
.msg { max-width: 84%; background: var(--surface); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 8px 10px; align-self: flex-start; }
.msg.mine { align-self: flex-end; background: #E3ECF8; border-color: #C7D6EA; border-radius: 14px 14px 4px 14px; }
.msg.office .who { color: var(--blue); }
.msg .who { font-size: 12.5px; font-weight: 750; color: var(--ink-2); margin-bottom: 2px; }
.msg .txt { white-space: pre-wrap; word-wrap: break-word; font-size: 15.5px; }
.msg .when { font-size: 11.5px; color: var(--ink-3); text-align: right; margin-top: 3px; }
.msg img { border-radius: 10px; margin: 4px 0; max-height: 320px; object-fit: cover; }
.msg .rep { margin-bottom: 4px; }
.msg.pending { opacity: .65; }
.day-sep { align-self: center; font-size: 12px; font-weight: 700; color: var(--ink-3); background: var(--line-soft); border-radius: 999px; padding: 2px 10px; margin: 6px 0; }
.composer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; background: var(--surface); border-top: 1px solid var(--line); padding: 8px 10px calc(8px + var(--safe-bottom)); }
.composer-inner { max-width: 720px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; min-height: 46px; max-height: 140px; resize: none; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; font-size: 16px; background: var(--ground); }
.composer .icon-btn { border-color: var(--line); color: var(--ink-2); }
.composer .send { background: var(--navy); color: #fff; border-color: var(--navy); }
main.with-composer { padding-bottom: calc(120px + var(--safe-bottom)); }
.no-overflow { min-width: 0; }
.preview { max-width: 720px; margin: 0 auto 8px; display: flex; gap: 8px; align-items: center; }
.preview img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }

/* Formulare */
label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14.5px; }
input[type=text], input[type=number], input[type=password], input[type=tel], select, textarea.input { width: 100%; min-height: 50px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 17px; background: var(--surface); font-weight: 500; }
textarea.input { min-height: 96px; resize: vertical; }
.pin { letter-spacing: .5em; text-align: center; font-size: 26px !important; font-weight: 800 !important; }
.types { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type { min-height: 92px; border-radius: var(--radius); border: 1.5px solid var(--line); background: var(--surface); display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; padding: 12px; font-weight: 750; font-size: 15.5px; text-align: left; }
.type svg { width: 28px; height: 28px; color: var(--blue); }
.type.on { border: 2.5px solid var(--navy); background: #EEF2F8; }
.choice { display: flex; flex-direction: column; gap: 8px; }
.choice button { text-align: left; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); padding: 10px 12px; min-height: 56px; }
.choice button.on { border: 2.5px solid var(--navy); background: #EEF2F8; }
.choice b { display: block; }
.photo-drop { border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface); min-height: 120px; display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 700; color: var(--ink-2); padding: 12px; }
.photo-drop img { max-height: 220px; border-radius: 10px; }
.qty { display: grid; grid-template-columns: 1fr 120px; gap: 8px; }
.hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.seg { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.seg button { flex: none; min-height: 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); padding: 0 14px; font-weight: 700; font-size: 14px; }
.seg button.on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Büro */
.report { gap: 8px; }
.report .head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.report h3 { margin: 0; font-size: 16.5px; }
.report img { border-radius: 10px; max-height: 260px; object-fit: cover; }
.person { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line-soft); }
.person:first-child { border-top: 0; }
.qr-box { background: #fff; border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; border: 1px solid var(--line); text-align: center; }
.qr-box img { width: 240px; height: 240px; image-rendering: pixelated; }
.code { font: 800 22px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; }
.center { text-align: center; }
.login { padding: 32px 18px; display: flex; flex-direction: column; gap: 16px; max-width: 420px; margin: 0 auto; width: 100%; }
.login .logo { width: 72px; height: 72px; border-radius: 18px; align-self: center; }
.login h1 { text-align: center; margin: 0; font-size: 24px; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(92px + var(--safe-bottom)); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 650; z-index: 20; max-width: calc(100% - 32px); }

@media print {
  .top, .nav, .no-print { display: none !important; }
  main { padding: 0; }
  .qr-box { border: 0; }
}
