/* Arbeitsnachweise Lege. Farben aus dem Logo (wie die digitale Visitenkarte), Schrift Jost (OFL). */
@font-face { font-family: "Jost"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/jost-400.woff2") format("woff2"); }
@font-face { font-family: "Jost"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/jost-500.woff2") format("woff2"); }

:root {
  --violett: #43399A;
  --violett-tief: #2E2670;
  --violett-hauch: #EEEDF7;
  --eisblau: #2FB8E1;
  --tinte: #1E1B3A;
  --text-leise: #545A66;
  --linie: #DCDFE5;
  --stahl: #E2E6EA;
  --stahl-kante: #BCC4CC;
  --papier: #FFFFFF;
  --grund: #F4F5F8;
  --rot: #B42318;
  --rot-hauch: #FDECEA;
  --gruen: #1E7B4D;
  --gruen-hauch: #E6F4EC;
  --radius: 10px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Jost", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  color: var(--tinte);
  background: var(--grund);
}
strong, b, th { font-weight: 500; } /* Jost ist nur in 400 und 500 eingebettet */
h1, h2, h3 { font-weight: 500; line-height: 1.2; margin: 0 0 .6em; }
h1 { font-size: 1.6rem; color: var(--violett-tief); }
h2 { font-size: 1.15rem; color: var(--violett-tief); }
h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-leise); }
a { color: var(--violett); }
p { margin: 0 0 .8em; }
.muted { color: var(--text-leise); }
.small { font-size: .85rem; }
.nr { color: var(--violett); white-space: nowrap; }

/* ------------------------------------------------------------ Gerüst */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--violett); color: #fff;
  border-bottom: 3px solid var(--eisblau);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand img { display: block; height: 34px; width: auto; }
.brand-name { font-weight: 500; font-size: 1.05rem; }
.mainnav { display: flex; gap: 4px; }
.mainnav a { color: #fff; text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: .95rem; }
.mainnav a.active, .mainnav a:hover { background: rgba(255,255,255,.16); }
@media (max-width: 560px) {
  .brand-name { display: none; }
  .mainnav a { padding: 8px; font-size: .9rem; }
}
.container { max-width: 980px; margin: 0 auto; padding: 20px 16px 120px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.back { text-decoration: none; font-weight: 500; }

/* ------------------------------------------------------------ Bausteine */
.card { background: var(--papier); border: 1px solid var(--linie); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.narrow { max-width: 460px; }
.stack { display: grid; gap: 12px; }
.grid-2 { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-end { display: flex; align-items: flex-end; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

label { display: block; font-size: .9rem; font-weight: 500; color: var(--text-leise); }
label > input, label > select { display: block; margin-top: 4px; }
input, select, textarea {
  font: inherit; font-size: 1rem; color: var(--tinte);
  width: 100%; min-height: 44px; padding: 9px 11px;
  background: #fff; border: 1px solid var(--stahl-kante); border-radius: 8px;
}
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--eisblau); outline-offset: 0; border-color: var(--violett); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 9px 16px;
  font: inherit; font-weight: 500; font-size: 1rem; text-decoration: none; cursor: pointer;
  color: var(--violett-tief); background: #fff; border: 1px solid var(--stahl-kante); border-radius: 8px;
}
.btn:hover { border-color: var(--violett); }
.btn-primary { background: var(--violett); border-color: var(--violett); color: #fff; }
.btn-primary:hover { background: var(--violett-tief); }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; padding: 6px 0; font: inherit; font-size: .9rem; color: var(--violett); cursor: pointer; text-decoration: underline; }
.btn-link.danger, .danger { color: var(--rot); }
.btn-icon { width: 44px; min-height: 44px; flex: none; font-size: 1.4rem; line-height: 1; background: none; border: 1px solid var(--linie); border-radius: 8px; color: var(--text-leise); cursor: pointer; }

.demo-band { background: #FFF4DB; color: #8A5A00; border-bottom: 2px solid #D99A00; padding: 8px 14px; text-align: center; font-size: .9rem; }
.demo-druck { margin: 0 0 8px; padding: 4px 8px; background: #FFF4DB; color: #8A5A00; border: 1px solid #D99A00; text-align: center; font-size: .8rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.flash { padding: 12px 14px; border-radius: 8px; margin-bottom: 12px; border: 1px solid transparent; }
.flash-ok { background: var(--gruen-hauch); border-color: #B7DFC8; color: var(--gruen); }
.flash-error { background: var(--rot-hauch); border-color: #F5C2BC; color: var(--rot); }
.hint { background: var(--violett-hauch); border-left: 4px solid var(--violett); padding: 12px 14px; border-radius: 0 8px 8px 0; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .8rem; font-weight: 500; white-space: nowrap; }
.badge-entwurf { background: var(--stahl); color: var(--text-leise); }
.badge-unterschrieben { background: #DFF3FA; color: #0F6A86; }
.badge-abgerechnet { background: var(--gruen-hauch); color: var(--gruen); }
.badge-ohne { background: #FFF4DB; color: #8A5A00; }

/* ------------------------------------------------------------ Login */
.page-login .container { max-width: 420px; padding-top: 48px; }
.login { text-align: center; }
.login-logo { width: 220px; height: auto; margin-bottom: 12px; }
.login form { text-align: left; }

/* ------------------------------------------------------------ Liste */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; }
.tabs a { padding: 8px 14px; border-radius: 99px; text-decoration: none; white-space: nowrap; background: #fff; border: 1px solid var(--linie); color: var(--text-leise); font-weight: 500; }
.tabs a.active { background: var(--violett); border-color: var(--violett); color: #fff; }
.search { display: flex; gap: 8px; margin-bottom: 14px; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list-item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 12px 14px; background: #fff; border: 1px solid var(--linie); border-radius: var(--radius);
  text-decoration: none; color: inherit;
}
.list-item:hover { border-color: var(--violett); }
.list-nr { font-weight: 500; color: var(--violett); white-space: nowrap; }
.list-main { display: grid; min-width: 0; }
.list-main strong { font-weight: 500; }
.list-main .muted { font-size: .88rem; }
.empty { padding: 32px 0; text-align: center; color: var(--text-leise); }
@media (max-width: 520px) {
  .list-item { grid-template-columns: 1fr auto; }
  .list-nr { grid-column: 1 / -1; font-size: .85rem; }
}

/* ------------------------------------------------------------ Formular */
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip { display: inline-flex; position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.chip span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px;
  border: 1px solid var(--stahl-kante); border-radius: 8px; background: #fff; color: var(--tinte); font-weight: 500;
}
.chip input:checked + span { background: var(--violett); border-color: var(--violett); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--eisblau); outline-offset: 2px; }

details.sub { margin-top: 4px; }
details.sub summary { cursor: pointer; color: var(--violett); font-weight: 500; padding: 6px 0; }
details.sub[open] summary { margin-bottom: 8px; }

.anlagen { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.anlage { display: grid; grid-template-columns: 130px 1fr; gap: 8px; }
.anlage .chip span { width: 130px; }
@media (max-width: 640px) { .anlagen { grid-template-columns: minmax(0, 1fr); } }

.stunde { border: 1px solid var(--linie); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; background: #FBFBFD; }
.stunde-kopf { display: flex; gap: 8px; flex-wrap: wrap; }
.stunde-kopf .grow { flex: 1 1 180px; }
.w-beruf { flex: 0 1 150px; }
.w-km { flex: 0 0 80px; }
.tage { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.tage label { text-align: center; font-size: .8rem; }
.tage label span { display: grid; line-height: 1.15; }
.tage label small { font-weight: 400; font-size: .72rem; color: var(--text-leise); }
.tage input { text-align: center; padding: 8px 2px; }
.zuschlaege { display: grid; grid-template-columns: auto repeat(3, 72px); align-items: end; gap: 6px; margin-top: 10px; }
.zuschlaege label { text-align: center; font-size: .8rem; }
.zuschlaege input { text-align: center; }
.zu-label { font-size: .85rem; color: var(--text-leise); padding-bottom: 12px; }
@media (max-width: 420px) {
  .zuschlaege { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .zu-label { grid-column: 1 / -1; padding-bottom: 0; }
}
.stunde-fuss { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; font-size: .92rem; }
.stunde-fuss strong { font-weight: 500; color: var(--violett-tief); }
.stunde-fuss strong.warn { color: var(--rot); }

.material { display: flex; gap: 8px; margin-bottom: 8px; }
.material .w-menge { width: 110px; flex: none; }
.material .grow { flex: 1; }

.actionbar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; gap: 10px; justify-content: flex-end;
  margin: 0 -16px; padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: rgba(244,245,248,.96); border-top: 1px solid var(--linie);
}
.actionbar .btn { flex: 0 1 220px; }
@media (max-width: 520px) { .actionbar .btn { flex: 1; } }
.danger-zone { margin-top: 24px; text-align: center; }

.foto-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
.foto { margin: 0; display: grid; gap: 4px; }
.foto img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--linie); background: var(--stahl); }
.foto-weg { display: flex; gap: 6px; align-items: center; font-weight: 400; font-size: .85rem; }
.foto-weg input { width: auto; min-height: 0; margin: 0; }
.foto-knopf { position: relative; overflow: hidden; }
.foto-knopf input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }

/* ------------------------------------------------------------ Ansicht (Blatt) */
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.blatt { background: #fff; border: 1px solid var(--linie); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.blatt-kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; border-bottom: 2px solid var(--violett); padding-bottom: 10px; margin-bottom: 4px; }
.blatt-kopf h2 { font-size: 1.4rem; margin: 0; }
.kv { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0; }
.kv div { display: grid; }
.kv dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-leise); }
.kv dd { margin: 0; font-weight: 500; min-height: 1.3em; }
.kv-stack { display: grid; gap: 6px; margin-top: 8px; }
.blatt-feld { padding: 12px 0; border-bottom: 1px solid var(--linie); }
.blatt-feld h3 { margin-bottom: .4em; }
.blatt-feld p:last-child { margin-bottom: 0; }
.blatt-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.blatt-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 24px; }
@media (max-width: 700px) { .blatt-2, .blatt-3 { grid-template-columns: minmax(0, 1fr); } }
.marks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.marks li { color: #9AA1AC; }
.marks li::before { content: ""; display: inline-block; width: .85em; height: .85em; margin-right: 6px; vertical-align: -1px; border: 1.5px solid var(--stahl-kante); border-radius: 3px; }
.marks li.on { color: var(--tinte); font-weight: 500; }
.marks li.on::before { background: var(--violett); border-color: var(--violett); box-shadow: inset 0 0 0 2px #fff; }
.anlage-liste { margin: 0; padding: 0; list-style: none; }
.pre { white-space: pre-wrap; min-height: 1.4em; }
.table-wrap { overflow-x: auto; }
.stunden-tabelle, .material-tabelle { border-collapse: collapse; width: 100%; font-size: .9rem; }
.stunden-tabelle th, .stunden-tabelle td { border: 1px solid var(--linie); padding: 5px 6px; text-align: center; white-space: nowrap; }
.stunden-tabelle th { font-weight: 500; font-size: .75rem; color: var(--text-leise); background: var(--grund); }
.stunden-tabelle .l { text-align: left; }
.stunden-tabelle .sum { font-weight: 500; color: var(--violett-tief); }
.material-tabelle td { border-bottom: 1px solid var(--linie); padding: 5px 6px; vertical-align: top; }
.material-tabelle .menge { width: 90px; white-space: nowrap; }
.unterschriften .blatt-feld { border-bottom: 0; }
.sig-img { display: block; width: 100%; max-width: 360px; height: auto; aspect-ratio: 3 / 1; object-fit: contain; border-bottom: 1px solid var(--tinte); }
.sig-name { margin-top: 4px; font-size: .9rem; }
.sig-zeit { margin: 0; }
.ohne-unterschrift { background: #FFF4DB; border-left: 4px solid #D99A00; padding: 10px 12px; border-radius: 0 6px 6px 0; }

.versand-liste { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.versand-liste strong { font-weight: 500; }
.versand-aktionen { display: grid; gap: 10px; border-top: 1px solid var(--linie); padding-top: 12px; }
.anbindungen { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 4px; }
.meta { margin-top: 4px; }

/* ------------------------------------------------------------ Unterschrift */
.sig-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 760px) { .sig-grid { grid-template-columns: minmax(0, 1fr); } }
.sig-card { margin: 0; }
.sig-pad {
  display: block; width: 100%; aspect-ratio: 3 / 1; touch-action: none;
  background: #fff linear-gradient(to top, transparent 22%, var(--stahl-kante) 22%, var(--stahl-kante) calc(22% + 1px), transparent calc(22% + 1px));
  border: 1px dashed var(--stahl-kante); border-radius: 8px; cursor: crosshair;
}
.sig-tools { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.sig-tools input { flex: 1; }
.sig-form .actionbar { margin-top: 14px; }

/* ------------------------------------------------------------ Verwaltung */
.user-list { list-style: none; margin: 0; padding: 0; }
.user-list li { border-bottom: 1px solid var(--linie); }
.user-list li.inactive summary { opacity: .55; }
.user-list summary { cursor: pointer; padding: 10px 0; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.user-list summary strong { font-weight: 500; }
.user-edit { display: grid; gap: 10px; padding: 4px 0 14px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.inline-form label { flex: 1 1 180px; }

/* ------------------------------------------------------------ Druck */
.page-druck { background: var(--stahl); }
.druck-seite { max-width: 210mm; margin: 0 auto 40px; background: #fff; padding: 14mm 14mm 12mm; }
.briefkopf { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; border-bottom: 1px solid var(--tinte); padding-bottom: 8px; margin-bottom: 10px; }
.briefkopf img { width: 52mm; height: auto; }
.absender { margin: 0; font-size: .78rem; color: var(--text-leise); }
.druck-seite .blatt { border: 0; padding: 0; margin: 0; border-radius: 0; }

@page { size: A4; margin: 10mm 12mm; }
@media print {
  body, .page-druck { background: #fff; font-size: 10.5pt; }
  .no-print, .topbar, .actions, .actionbar { display: none !important; }
  .druck-seite { max-width: none; margin: 0; padding: 0; }
  .blatt-2 { grid-template-columns: 1fr 1fr; }
  .blatt-3 { grid-template-columns: 1fr 1fr 1fr; }
  .blatt-feld { padding: 6px 0; break-inside: avoid; }
  .stunden-tabelle { font-size: 8.5pt; }
  .stunden-tabelle th, .stunden-tabelle td { padding: 3px 4px; }
  .table-wrap { overflow: visible; }
  .unterschriften { break-inside: avoid; }
  .sig-img { max-width: 70mm; }
  .blatt-kopf { flex-wrap: nowrap; }
  .blatt-kopf h2 { flex: none; }
  .blatt-kopf .kv { display: table; flex: none; }
  .blatt-kopf .kv div { display: table-cell; padding-left: 6mm; }
  .kv dt { white-space: nowrap; }
  .blatt-fotos { break-before: page; border-bottom: 0; }
  .blatt-fotos .foto-raster { grid-template-columns: 1fr 1fr; gap: 6mm; }
  .blatt-fotos .foto img { aspect-ratio: auto; height: 62mm; object-fit: contain; border: 0; background: none; }
  a { color: inherit; text-decoration: none; }
}
