@font-face { font-family: 'Source Sans 3'; src: url(../schrift/source_sans_3_400.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Source Sans 3'; src: url(../schrift/source_sans_3_600.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Source Sans 3'; src: url(../schrift/source_sans_3_700.woff2) format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --rot: #ed1c24;
  --rot-flaeche: #d4171e;
  --rot-text: #b5161c;
  --anthrazit: #231f20;
  --anthrazit-2: #3a3536;
  --grau: #a8a9ad;
  --ringgrau: #f0efef;
  --text-2: #5a5557;
  --text-3: #c9c9cc;
  --linie: #dddcdc;
  --linie-2: #ecebeb;
  --rahmen: #c9c8c8;
  --ok: #1d7a3a;
  --ok-bg: #e3f3e8;
  --ok-text: #155c2c;
  --ok-hell: #5cc98a;
  --warn: #9a6a00;
  --warn-bg: #fdf3dc;
  --warn-punkt: #f5a524;
  --fehler: #a3121a;
  --fehler-bg: #fdeced;
  --schrift: Aller, 'Source Sans 3', system-ui, sans-serif;
  --unten: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--schrift); color: var(--anthrazit); background: var(--ringgrau); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg { flex: none; }
a { color: var(--rot-text); }

.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.laden { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text-2); }

/* Kopf */
.hd { background: var(--anthrazit); color: #fff; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 14px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; z-index: 5; }
.hd .zeile { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hd .logo { height: 22px; }
.hd .titel { display: flex; align-items: center; gap: 4px; min-width: 0; }
.hd .titel b { font-size: 20px; }
.hd .titel small { display: block; font-size: 13px; color: var(--text-3); }
.zurueck { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: #fff; margin-left: -10px; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--anthrazit-2); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; }
.pill i { width: 9px; height: 9px; border-radius: 50%; background: var(--ok-hell); }
.pill.offline i { background: var(--warn-punkt); }

/* Inhalt */
.inhalt { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 16px 16px calc(96px + var(--unten)); display: flex; flex-direction: column; gap: 16px; }
.karte { background: #fff; border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.karte h2 { margin: 0; font-size: 17px; }
.karte p { margin: 0; line-height: 1.45; color: var(--text-2); }
.sec-hd { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sec-hd h2 { margin: 0; font-size: 18px; }
.hinweis { font-size: 13px; color: var(--text-2); line-height: 1.4; margin: 0; }
.hinweis.warn { background: var(--warn-bg); color: var(--warn); border-radius: 12px; padding: 10px 12px; font-weight: 600; font-size: 14px; }
.meldung { border-radius: 12px; padding: 10px 12px; font-weight: 600; font-size: 15px; }
.meldung.fehler { background: var(--fehler-bg); color: var(--fehler); }
.meldung.ok { background: var(--ok-bg); color: var(--ok-text); }

/* Formulare */
.feld { display: flex; flex-direction: column; gap: 6px; }
.lbl { font-size: 14px; font-weight: 700; }
.input { width: 100%; min-width: 0; font-size: 17px; padding: 12px 14px; border: 1px solid var(--rahmen); border-radius: 12px; background: #fff; min-height: 50px; }
.input:focus { outline: 2px solid var(--anthrazit); outline-offset: 1px; }
.mit-knopf { display: flex; gap: 8px; }
.icon-btn { width: 50px; height: 50px; flex: none; display: flex; align-items: center; justify-content: center; background: #fff; border: 1px solid var(--rahmen); border-radius: 12px; }
.segm { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #fff; border: 1px solid var(--rahmen); border-radius: 12px; padding: 4px; gap: 4px; }
.segm button { border-radius: 9px; padding: 11px 6px; font-size: 16px; font-weight: 600; min-height: 44px; }
.segm button.an { background: var(--anthrazit); color: #fff; font-weight: 700; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--rahmen); background: #fff; border-radius: 12px; padding: 12px 16px; font-size: 16px; font-weight: 700; min-height: 48px; }
.btn.rot { background: var(--rot-flaeche); border-color: var(--rot-flaeche); color: #fff; }
.btn.dunkel { background: var(--anthrazit); border-color: var(--anthrazit); color: #fff; }
.btn.voll { width: 100%; }
.btn.gross { font-size: 19px; min-height: 56px; border-radius: 14px; }
.btn.klein { min-height: 38px; padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: .55; cursor: default; }
.link-btn { color: var(--rot-text); font-weight: 700; font-size: 15px; }

/* Listen */
.liste { background: #fff; border-radius: 14px; overflow: hidden; }
.zeile-e { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; border-bottom: 1px solid var(--linie-2); text-align: left; min-height: 60px; }
.zeile-e:last-child { border-bottom: 0; }
a.zeile-e { color: inherit; text-decoration: none; }
a.zeile-e svg { color: var(--rot-text); }
.zeile-e .l { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.zeile-e .l b { font-size: 16px; }
.zeile-e .l small { font-size: 13px; color: var(--text-2); }
.zeile-e .r { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.b-admin { background: var(--anthrazit); color: #fff; }
.b-monteur { background: var(--ringgrau); color: var(--text-2); }
.b-ok { background: var(--ok-bg); color: var(--ok-text); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-fehler { background: var(--fehler-bg); color: var(--fehler); }

.kacheln { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.kachel { background: #fff; border-radius: 14px; padding: 14px 6px; min-height: 92px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-size: 15px; font-weight: 600; color: var(--grau); }
.kachel svg { color: var(--grau); }

.dl { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 6px 10px; margin: 0; font-size: 15px; }
.dl dt { color: var(--text-2); }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.geheim { font-family: ui-monospace, Consolas, monospace; font-size: 20px; letter-spacing: 1px; }

/* Projektauswahl im Kopf */
.projekt-btn { display: flex; justify-content: space-between; align-items: center; width: 100%; background: var(--anthrazit-2); border-radius: 12px; padding: 10px 14px; text-align: left; color: #fff; min-height: 52px; }
.projekt-btn small { display: block; font-size: 12px; color: var(--text-3); }
.projekt-btn b { font-size: 17px; }

/* Positionen und Standorte */
.knopf-zeile { display: flex; gap: 8px; flex-wrap: wrap; }
.knopf-zeile .btn { flex: 1 1 160px; }
.zahlen { display: flex; gap: 8px 16px; flex-wrap: wrap; font-size: 14px; color: var(--text-2); }
.zahlen b { color: var(--anthrazit); }
.karte.zahlen { flex-direction: row; }
.such { position: relative; }
.such > span { position: absolute; left: 13px; top: 15px; color: var(--text-2); display: flex; }
.such .input { padding-left: 42px; }
.gruppe-pos { display: flex; flex-direction: column; gap: 8px; }
.bereich { font-size: 14px; color: var(--text-2); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bereich span { font-weight: 700; color: var(--anthrazit); margin-right: 4px; }
.bereich.e1 { font-size: 16px; font-weight: 700; color: var(--anthrazit); margin-top: 6px; }
.bereich small { font-weight: 400; color: var(--text-2); }
.pos { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; border-bottom: 1px solid var(--linie-2); text-align: left; min-height: 56px; }
.pos:last-child { border-bottom: 0; }
.pos-oz { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.pos-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 15px; }
.pos-text > span:first-child { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pos-text small { font-size: 13px; color: var(--text-2); }
.pos-menge { display: flex; flex-direction: column; align-items: flex-end; text-align: right; white-space: nowrap; font-size: 14px; }
.pos-menge small { font-size: 13px; color: var(--text-2); }
.pos:not(:has(.pos-oz)) { grid-template-columns: minmax(0, 1fr) auto; }
.knopf-flach { text-align: left; flex: 1; min-width: 0; }

/* Auswahllisten im Sheet */
.opt { display: flex; justify-content: space-between; gap: 10px; background: #fff; border-radius: 12px; padding: 12px 14px; text-align: left; font-size: 15px; min-height: 56px; align-items: center; width: 100%; }
.opt span { display: flex; flex-direction: column; gap: 2px; }
.opt small { color: var(--text-2); }
.opt.an { outline: 2px solid var(--anthrazit); }
.opt.neu { color: var(--rot-text); font-weight: 700; justify-content: center; flex-direction: row; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: #fff; border: 1px solid var(--rahmen); border-radius: 10px; padding: 10px 12px; font-size: 15px; font-weight: 600; min-height: 44px; }
.chip.an { background: var(--anthrazit); color: #fff; border-color: var(--anthrazit); }
.zwei-sp { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
textarea.input { display: block; resize: vertical; font-size: 16px; line-height: 1.35; }
details.karte summary { cursor: pointer; }
.langtext { white-space: pre-line; font-size: 14px; color: var(--text-2); margin: 8px 0 0; }

/* Import */
.datei-wahl { display: block; }
.datei-wahl .btn { cursor: pointer; justify-content: flex-start; font-weight: 600; }
.datei-wahl .btn.gewaehlt { border-color: var(--ok); color: var(--ok-text); background: var(--ok-bg); }
.pruefliste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.pruefliste li { display: flex; gap: 8px; align-items: flex-start; }
.pruefliste li.ok svg { color: var(--ok); }
.pruefliste li.nein svg { color: var(--warn); }
.haken { display: flex; gap: 10px; align-items: center; font-weight: 700; font-size: 16px; min-height: 44px; }
.haken input { width: 22px; height: 22px; }
.zuordnung { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.tabelle-wrap { overflow-x: auto; background: #fff; border-radius: 14px; }
.tabelle { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabelle th { background: #f7f6f6; text-align: left; font-size: 13px; color: var(--text-2); padding: 9px 10px; white-space: nowrap; }
.tabelle td { padding: 8px 10px; border-top: 1px solid var(--linie-2); vertical-align: top; }
.tabelle .r { text-align: right; white-space: nowrap; }
.tabelle .oz { font-weight: 700; white-space: nowrap; }

/* Navigation */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #fff; border-top: 1px solid var(--linie); padding: 6px 4px calc(8px + var(--unten)); }
.nav button { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; color: var(--text-2); min-height: 48px; justify-content: center; }
.nav button.an { color: var(--rot-flaeche); font-weight: 700; }

/* Anmelden */
.login { flex: 1; background: var(--anthrazit); display: flex; flex-direction: column; align-items: center; padding: calc(60px + env(safe-area-inset-top, 0px)) 18px calc(24px + var(--unten)); gap: 10px; }
.login-logo { width: 250px; max-width: 80%; }
.login-t { color: #fff; font-size: 22px; font-weight: 700; margin-bottom: 24px; }
.login-karte { background: var(--ringgrau); border-radius: 18px; padding: 18px; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 12px; margin-top: auto; }

/* Bottom-Sheet und Toast */
.sheet-bg { position: fixed; inset: 0; background: rgba(35, 31, 32, .5); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet { background: var(--ringgrau); width: 100%; max-width: 640px; max-height: 88vh; border-radius: 20px 20px 0 0; display: flex; flex-direction: column; }
.sheet-hd { display: flex; justify-content: space-between; align-items: center; padding: 16px 16px 10px; }
.sheet-hd b { font-size: 19px; }
.sheet-body { overflow-y: auto; padding: 0 16px calc(26px + var(--unten)); display: flex; flex-direction: column; gap: 14px; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(86px + var(--unten)); max-width: 520px; margin: 0 auto; background: var(--anthrazit); color: #fff; border-radius: 12px; padding: 12px 14px; font-size: 15px; font-weight: 600; z-index: 30; display: flex; gap: 8px; align-items: center; }
.toast svg { color: var(--ok-hell); }
.toast.fehler svg { color: var(--warn-punkt); }

/* Büro-PC: Navigation links */
@media (min-width: 900px) {
  .app.mit-nav { padding-left: 220px; }
  .nav { top: 0; right: auto; width: 220px; grid-auto-flow: row; grid-auto-rows: min-content; align-content: start; gap: 2px; padding: 84px 10px 16px; border-top: 0; border-right: 1px solid var(--linie); }
  .nav button { flex-direction: row; justify-content: flex-start; gap: 10px; font-size: 15px; padding: 10px 12px; border-radius: 10px; color: var(--anthrazit); }
  .nav button.an { background: var(--ringgrau); }
  .hd { position: sticky; }
  .app.mit-nav .hd { margin-left: -220px; padding-left: 236px; }
  .inhalt { padding-bottom: 40px; }
  .toast { bottom: 24px; }
  .sheet-bg { align-items: center; }
  .sheet { border-radius: 20px; }
}
