/* B&S Maschinenverwaltung */
:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --ink: #1c1f24;
  --ink-2: #4b5260;
  --muted: #7a8190;
  --line: #e3e6eb;
  --line-2: #eef0f3;
  --side: #1c1f24;
  --side-ink: #c9ced8;
  --accent: #f5b301;
  --accent-ink: #1c1f24;
  --accent-soft: #fff6d6;
  --red: #d92d20;   --red-soft: #fdecea;
  --orange: #e8660c; --orange-soft: #fff0e5;
  --yellow: #b88a00; --yellow-soft: #fff8db;
  --green: #18864b; --green-soft: #e6f6ed;
  --blue: #1d64c9;  --blue-soft: #e8f0fc;
  --gray-soft: #eef0f3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .9rem; }
h3 { font-size: .95rem; margin: 1.2rem 0 .4rem; }
code { background: var(--gray-soft); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.icon { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.text-red { color: var(--red); font-weight: 600; }
.pre { white-space: pre-wrap; margin: 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9rem; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 236px; background: var(--side); color: var(--side-ink);
  display: flex; flex-direction: column; padding: 18px 12px; z-index: 30; overflow-y: auto;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; padding: 4px 8px 20px; line-height: 1.2; }
.sidebar .brand:hover { text-decoration: none; }
.logo { display: inline-grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 800;
  font-size: .8rem; border-radius: 7px; padding: 6px 7px; letter-spacing: -.02em; line-height: 1; }
.logo-lg { font-size: 1.1rem; padding: 12px 12px; border-radius: 10px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a, .userbox a, .userbox .linkbtn {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px; color: var(--side-ink); font-weight: 500;
}
.sidebar nav a:hover, .userbox a:hover, .userbox .linkbtn:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar nav a.active, .userbox a.active { background: rgba(245,179,1,.14); color: var(--accent); }
.sidebar .count { margin-left: auto; background: var(--accent); color: var(--accent-ink); font-size: .74rem; font-weight: 700; border-radius: 99px; padding: 0 7px; }
.userbox { border-top: 1px solid rgba(255,255,255,.08); padding-top: 10px; margin-top: 10px; }
.userbox small { display: block; color: var(--muted); font-size: .76rem; font-weight: 400; }
.linkbtn { background: none; border: 0; width: 100%; font: inherit; cursor: pointer; text-align: left; }
.topbar { display: none; }
.main { margin-left: 236px; padding: 26px 30px 60px; max-width: 1400px; }
.main.nomenu { margin: 0 auto; }
.nav-backdrop { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { margin: 4px 0 0; color: var(--ink-2); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin: 0 0 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 460px; }
.card.empty { text-align: center; color: var(--ink-2); padding: 36px 20px; }
fieldset.card { min-width: 0; }
fieldset[disabled] input, fieldset[disabled] select, fieldset[disabled] textarea { background: var(--line-2); color: var(--ink); }
.stack > .card { margin-bottom: 16px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: .6rem; }
.section-head h2 { margin: 0; }

/* ---------- Formulare ---------- */
label { display: flex; flex-direction: column; gap: 5px; font-size: .86rem; font-weight: 600; color: var(--ink-2); margin-bottom: 12px; }
input, select, textarea {
  font: inherit; font-weight: 400; color: var(--ink); background: #fff; border: 1px solid #cfd4dc; border-radius: 8px;
  padding: 9px 11px; width: 100%; min-height: 40px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(245,179,1,.55); outline-offset: 0; border-color: var(--accent); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); margin: 0; }
input[type=file] { padding: 7px; }
label.check { flex-direction: row; align-items: center; gap: 9px; font-weight: 500; color: var(--ink); cursor: pointer; }
label.check.big { align-items: flex-start; background: var(--red-soft); border-radius: 8px; padding: 10px 12px; }
label.check.big input { margin-top: 3px; }
.grid { display: grid; gap: 0 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span3 { grid-column: 1 / -1; }
.hint { color: var(--muted); font-size: .86rem; margin: -2px 0 12px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 20px; }
.w-num { width: 110px; }
.input-unit { display: flex; align-items: center; gap: 6px; }
.input-unit span { color: var(--muted); font-size: .88rem; min-width: 24px; }
.input-unit input { max-width: 140px; }
.preview { max-width: 220px; max-height: 160px; border-radius: 8px; border: 1px solid var(--line); object-fit: cover; margin-bottom: 8px; }
.upload label { margin-bottom: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; font: inherit; font-weight: 600; font-size: .92rem; line-height: 1;
  padding: 10px 15px; min-height: 40px; border-radius: 8px; border: 1px solid #cfd4dc; background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--line-2); text-decoration: none; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #e3a600; }
.btn-danger { background: #fff; border-color: #f1b0aa; color: var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-sm { padding: 6px 10px; min-height: 32px; font-size: .84rem; }
.btn-block { width: 100%; justify-content: center; }
.danger-zone { margin-top: 30px; padding-top: 16px; border-top: 1px dashed var(--line); }

.alert { padding: 11px 14px; border-radius: 8px; margin: 0 0 14px; border: 1px solid transparent; }
.alert-success { background: var(--green-soft); color: #0f5c33; border-color: #bfe5cf; }
.alert-error { background: var(--red-soft); color: #9b1c13; border-color: #f6c5c0; }
.alert-warn { background: var(--yellow-soft); color: #7a5b00; border-color: #f0dc97; }
.alert-info { background: var(--blue-soft); color: #164c99; border-color: #c7d9f5; }

/* ---------- Badges ---------- */
.badge { display: inline-block; font-size: .76rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap; letter-spacing: .01em; }
.stufe-ueberfaellig { background: var(--red); color: #fff; }
.stufe-dringend { background: var(--orange); color: #fff; }
.stufe-bald { background: #ffd34d; color: #5a4300; }
.stufe-geplant { background: var(--gray-soft); color: var(--ink-2); }
.stufe-ok { background: var(--green-soft); color: var(--green); }
.status { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--gray-soft); color: var(--ink-2); vertical-align: middle; }
.status-verfuegbar { background: var(--green-soft); color: var(--green); }
.status-vermietet { background: var(--blue-soft); color: var(--blue); }
.status-werkstatt { background: var(--orange-soft); color: var(--orange); }
.status-defekt { background: var(--red-soft); color: var(--red); }
.typ { display: inline-block; font-size: .78rem; font-weight: 700; color: var(--ink-2); margin-right: 6px; text-transform: uppercase; letter-spacing: .03em; }
.typ-auftrag { color: var(--orange); }
.art { font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.art-ersatzteil { background: var(--gray-soft); color: var(--ink-2); }
.art-wartungsteil { background: var(--blue-soft); color: var(--blue); }
.art-fluessigkeit { background: var(--accent-soft); color: #7a5b00; }
.erg { font-weight: 600; }
.erg-ok { color: var(--green); }
.erg-maengel { color: var(--orange); }
.erg-nicht_ok { color: var(--red); }
.pst { font-size: .8rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.pst-ok, .pst-erledigt { background: var(--green-soft); color: var(--green); }
.pst-mangel { background: var(--red-soft); color: var(--red); }
.pst-na { background: var(--gray-soft); color: var(--muted); }
.rolle { font-size: .8rem; font-weight: 600; }
.rolle-it { color: var(--red); }
.rolle-techniker { color: var(--blue); }

/* ---------- Dashboard ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; color: var(--ink-2); font-size: .88rem; font-weight: 600; box-shadow: var(--shadow); }
a.tile:hover { text-decoration: none; border-color: #cfd4dc; }
.tile-num { font-size: 1.9rem; font-weight: 800; color: var(--ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile-ueberfaellig { border-top: 4px solid var(--red); }
.tile-ueberfaellig .tile-num { color: var(--red); }
.tile-dringend { border-top: 4px solid var(--orange); }
.tile-dringend .tile-num { color: var(--orange); }
.tile-bald { border-top: 4px solid #ffd34d; }
.filterbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.filterbar.card { justify-content: flex-start; padding: 12px; }
.filterbar.card input[type=search] { flex: 1 1 260px; width: auto; }
.filterbar.card select { width: auto; flex: 0 1 220px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 7px 13px; border-radius: 99px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); font-weight: 600; font-size: .86rem; }
.chip:hover { text-decoration: none; border-color: #cfd4dc; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- Tabellen ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 11px 14px; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table.compact th, .table.compact td { padding: 8px 10px; }
.card:not(.flush) > .table th { background: none; }
.row-link { cursor: pointer; }
.row-link:hover td { background: #fafbfc; }
tr.done td { opacity: .55; }
.group-row th { background: var(--line-2) !important; color: var(--ink-2); text-transform: none; letter-spacing: 0; font-size: .86rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-form input { min-height: 34px; padding: 5px 8px; }
.inline-form input[name=hinweis] { flex: 1 1 180px; width: auto; }
.add-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.add-row label { margin: 0; flex: 1 1 160px; }
.add-row label:first-of-type { flex: 2 1 280px; }
.add-row .w-num { width: 100%; }
.add-row .btn { margin-bottom: 0; }

/* ---------- Maschine ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); }
.kpi > span { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.kpi strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--ink-2); font-size: .82rem; }
.kpi-ueberfaellig { border-left: 4px solid var(--red); }
.kpi-dringend { border-left: 4px solid var(--orange); }
.kpi-bald { border-left: 4px solid #ffd34d; }
.tabs { display: flex; gap: 4px; margin: 0 0 14px; overflow-x: auto; position: sticky; top: 0; background: var(--bg); padding: 6px 0; z-index: 5; }
.tabs a { padding: 7px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 600; font-size: .88rem; white-space: nowrap; }
.tabs a:hover { background: #fff; text-decoration: none; }
.split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; }
dl.data { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
dl.data dt { color: var(--muted); font-size: .88rem; }
dl.data dd { margin: 0; font-weight: 500; }
.bilder { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-content: start; }
.bilder figure { margin: 0; }
.bilder img { width: 100%; height: 180px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.bilder figcaption { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.placeholder { border: 2px dashed var(--line); border-radius: 8px; padding: 28px 14px; text-align: center; color: var(--muted); font-size: .9rem; }

/* ---------- Checkliste ---------- */
.checklist { display: flex; flex-direction: column; }
.cl-head { margin: 16px 0 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.cl-head:first-of-type { margin-top: 0; }
.cl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(140px, 240px); gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.cl-text { font-weight: 500; }
.cl-komm { min-height: 36px; padding: 6px 9px; }
.seg { display: inline-flex; border: 1px solid #cfd4dc; border-radius: 8px; overflow: hidden; }
.seg label { margin: 0; flex-direction: row; font-weight: 600; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 7px 11px; font-size: .82rem; color: var(--ink-2); border-left: 1px solid #e3e6eb; user-select: none; }
.seg label:first-child span { border-left: 0; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.seg-ok input:checked + span, .seg-erledigt input:checked + span { background: var(--green); color: #fff; }
.seg-mangel input:checked + span { background: var(--red); color: #fff; }
.seg-na input:checked + span { background: #8b93a1; color: #fff; }
.parts-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.part-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.part-row label.check { margin: 0; }
.part-row.extra { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto auto; }
.part-row .part-unit { max-width: 70px; }

/* ---------- Stunden ---------- */
.hours-table .input-unit input { max-width: 160px; font-size: 1.05rem; }
.sticky-actions { position: sticky; bottom: 0; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); padding: 12px 14px; display: flex; justify-content: flex-end; }

/* ---------- Protokoll ---------- */
.protocol h2 { margin-top: 22px; font-size: 1rem; }
.protocol-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 16px; }
.protocol-head .right { text-align: right; }
.protocol-meta { gap: 0 30px; }
.signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 50px; font-size: .82rem; color: var(--muted); }
.sigline { display: block; border-bottom: 1px solid var(--ink); height: 40px; margin-bottom: 6px; }

/* ---------- Kategorien ---------- */
.kat-line { display: flex; align-items: flex-end; gap: 6px; border-bottom: 1px solid var(--line-2); padding: 8px 0; }
.kat-line > form:first-child { flex: 1; }
.kat-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.kat-row label { margin: 0; }
.kat-row label:first-of-type { flex: 1 1 180px; }
.kat-row label.check { padding-bottom: 10px; }
.kat-row .btn { margin-bottom: 4px; }
.kat-row .muted { padding-bottom: 12px; }

/* ---------- Login ---------- */
.login-body { background: var(--side); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; padding: 28px; }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.login-brand strong { display: block; font-size: 1.05rem; }
.login-brand span:not(.logo) { color: var(--muted); font-size: .9rem; }
.debug { white-space: pre-wrap; background: var(--line-2); padding: 10px; border-radius: 6px; font-size: .8rem; }

/* ---------- Mobil ---------- */
@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cl-row { grid-template-columns: minmax(0, 1fr) auto; }
  .cl-komm { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; width: 260px; }
  .nav-open .sidebar { transform: none; }
  .nav-open .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 25; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; background: var(--side); padding: 10px 14px; }
  .topbar .brand { color: #fff; font-weight: 700; display: flex; align-items: center; gap: 8px; }
  .menu-btn { background: none; border: 0; color: #fff; padding: 6px; cursor: pointer; display: grid; }
  .menu-btn .icon { width: 24px; height: 24px; }
  .main { margin-left: 0; padding: 16px 16px 50px; }
  .tabs { top: 52px; }
  .split, .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .span2, .span3 { grid-column: auto; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: 1.3rem; }
  /* Tabellen als Karten */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-bottom: 1px solid var(--line); padding: 10px 14px; }
  .card:not(.flush) .table tr { padding: 10px 0; }
  .table td { border: 0; padding: 3px 0; position: relative; }
  .table td[data-label] { padding-left: 116px; min-height: 26px; }
  .table td[data-label]::before { content: attr(data-label); position: absolute; left: 0; top: 5px; width: 106px; color: var(--muted); font-size: .8rem; font-weight: 600; }
  .table td .inline-form { margin-left: -116px; }
  .group-row th { display: block; padding: 8px 14px; }
  .table.protocol-table td { display: table-cell; }
  .table.protocol-table, .table.protocol-table tbody { display: table; }
  .table.protocol-table tr { display: table-row; }
  .hours-table td[data-label="Neuer Stand"] .input-unit input { max-width: none; }
  .part-row.extra { grid-template-columns: minmax(0, 1fr) auto; }
  .signatures { grid-template-columns: 1fr; }
  .page-head .actions { width: 100%; }
}


/* ---------- Version 2: Fotos, Rollen, Logbuch, Kalender ---------- */
.nowrap { white-space: nowrap; }
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 6px; }
.galerie figure { margin: 0; position: relative; }
.galerie img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; background: var(--line-2); }
.galerie figcaption { font-size: .76rem; color: var(--muted); margin-top: 4px; line-height: 1.3; }
.galerie form { position: absolute; top: 5px; right: 5px; }
.foto-del { background: rgba(255,255,255,.92) !important; color: var(--red) !important; border-color: var(--line) !important; min-height: 28px; padding: 4px 8px; }
.foto-form { margin-top: 10px; }
.foto-form label:first-of-type { flex: 0 1 200px; }
.upload-info { font-size: .8rem; color: var(--muted); font-weight: 400; }
.lightbox { position: fixed; inset: 0; background: rgba(10,12,16,.92); z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 110px); border-radius: 6px; }
.lightbox .lb-cap { color: #dfe3ea; font-size: .9rem; margin-top: 10px; text-align: center; }
.lightbox button { position: absolute; background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 99px; width: 44px; height: 44px; font-size: 1.4rem; cursor: pointer; }
.lightbox .lb-close { top: 14px; right: 14px; }
.lightbox .lb-prev { left: 14px; top: 50%; }
.lightbox .lb-next { right: 14px; top: 50%; }
.rechte-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.rechte-gruppe { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px 4px; margin: 0; }
.rechte-gruppe legend { font-weight: 700; font-size: .84rem; padding: 0 6px; color: var(--ink-2); }
.rechte-gruppe label.check { margin-bottom: 8px; align-items: flex-start; }
.rechte-gruppe label.check input { margin-top: 2px; }
#rechteBox.voll { opacity: .45; pointer-events: none; }
label.check.big-ok { background: var(--green-soft); border-radius: 8px; padding: 10px 12px; }
.table-scroll { overflow-x: auto; }
.rights td.yes { color: var(--green); font-weight: 700; text-align: center; }
.rights td.no { color: var(--muted); text-align: center; }
.rights th:not(:first-child) { text-align: center; }
.copy-row { display: flex; gap: 8px; flex-wrap: wrap; }
.copy-row input { flex: 1 1 320px; width: auto; font-family: ui-monospace, Consolas, monospace; font-size: .84rem; background: var(--line-2); }
.check-list { display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 4px 0 14px; }
.check-list.col { flex-direction: column; }
.check-list.col label { margin-bottom: 6px; }
.form-actions form { margin: 0; }
.howto ol { padding-left: 18px; margin: 6px 0; }
.howto li { margin-bottom: 4px; }
.howto h3 { margin-top: 0; }
.filterbar label.inline { flex-direction: row; align-items: center; margin: 0; gap: 6px; }
.filterbar label.inline input { width: auto; }
.filterbar label.check { margin: 0; }
.la { font-size: .76rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; white-space: nowrap; background: var(--gray-soft); color: var(--ink-2); }
.la-angelegt, .la-hochgeladen { background: var(--green-soft); color: var(--green); }
.la-geaendert { background: var(--blue-soft); color: var(--blue); }
.la-geloescht, .la-anmeldung_fehler, .la-zugriff_verweigert { background: var(--red-soft); color: var(--red); }
.la-anmeldung, .la-abmeldung { background: var(--accent-soft); color: #7a5b00; }
.log-table details { margin-top: 4px; }
.log-table summary { cursor: pointer; color: var(--blue); font-size: .82rem; }
.diff { margin-top: 6px; background: #fafbfc; border-radius: 6px; font-size: .82rem; }
.diff th { text-transform: none !important; letter-spacing: 0 !important; font-size: .8rem !important; color: var(--ink-2) !important; background: none !important; width: 1%; }
.diff td.alt { color: var(--red); text-decoration: line-through; word-break: break-word; }
.diff td.neu { color: var(--green); word-break: break-word; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 10px 0 20px; }
@media (max-width: 860px) {
  .diff, .diff tbody, .diff tr { display: table !important; width: 100%; }
  .diff tr { display: table-row !important; }
  .diff td, .diff th { display: table-cell !important; padding: 4px 6px !important; }
  .rights, .rights tbody { display: table !important; }
  .rights thead { display: table-header-group !important; }
  .rights tr { display: table-row !important; padding: 0 !important; }
  .rights td, .rights th { display: table-cell !important; padding: 6px 8px !important; }
  .galerie { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Druck ---------- */
@media print {
  body { background: #fff; font-size: 11pt; }
  .sidebar, .topbar, .page-head, .no-print, .danger-zone, .alert-success, .nav-backdrop, .galerie form, .foto-form { display: none !important; }
  .galerie { grid-template-columns: repeat(4, 1fr); }
  .main { margin: 0; padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; padding: 0; }
  .table th { background: none !important; }
  .row-link:hover td { background: none; }
  a { color: inherit; }
  .protocol-table tr { break-inside: avoid; }
}

/* ---------- Version 4: Rechte, Schäden, Übergaben ---------- */
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.plain[disabled] input, fieldset.plain[disabled] textarea, [disabled] { cursor: not-allowed; }
.status-form { display: inline-block; margin-left: 6px; }
.status-form select { width: auto; min-height: 30px; padding: 3px 8px; font-size: .84rem; }
.small-strong { font-size: 1rem !important; }
.thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; background: var(--line-2); }
.thumb.leer { display: inline-block; }
.schaden-table td:first-child { width: 76px; }
.schaden-table tr.neu td { background: #fff7f0; }
.vergleich { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.vergleich h3 { margin-top: 0; }
.vergleich-box { border-radius: 8px; padding: 12px 14px; margin: 6px 0 16px; background: var(--line-2); display: flex; flex-direction: column; gap: 2px; }
.vergleich-box.neu { background: var(--orange-soft); border: 1px solid #f6c9a5; }
.vergleich-box.neu strong { color: var(--orange); }
.vergleich-box.ok { background: var(--green-soft); border: 1px solid #bfe5cf; }
.vergleich-box.ok strong { color: var(--green); }
.vorschaeden { display: flex; flex-direction: column; gap: 6px; }
.vorschaden { flex-direction: row !important; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin: 0; cursor: pointer; font-weight: 400; color: var(--ink); }
.vorschaden:has(input:not(:checked)) { background: var(--red-soft); border-color: #f6c5c0; }
.vorschaden .thumb { flex: none; }
.neu-schaden { border: 1px dashed #cfd4dc; border-radius: 8px; padding: 12px 14px 4px; margin-bottom: 12px; background: #fcfcfd; }
.neu-schaden .neu-weg { margin-bottom: 8px; }
.behoben { border-left: 4px solid var(--green); }
@media print {
  .vergleich { grid-template-columns: 1fr 1fr; }
  .status-form { display: none; }
}

/* ---------- Version 5: Markenfarben B&S, Logo ---------- */
:root {
  --brand-green: #31a846;
  --brand-green-dark: #24873a;
  --brand-orange: #e95721;
  --brand-orange-dark: #cf4815;
  --accent: #e95721;
  --accent-ink: #ffffff;
  --accent-soft: #fdeee7;
}
.btn-primary { background: var(--brand-orange); border-color: var(--brand-orange); color: #fff; }
.btn-primary:hover { background: var(--brand-orange-dark); border-color: var(--brand-orange-dark); }
input:focus, select:focus, textarea:focus { outline-color: rgba(233, 87, 33, .35); border-color: var(--brand-orange); }
input[type=checkbox], input[type=radio] { accent-color: var(--brand-green); }
.sidebar .brand { flex-direction: column; align-items: stretch; gap: 8px; padding: 0 2px 18px; }
.brand-logo { display: block; background: #fff; border-radius: 10px; padding: 10px 12px 8px; }
.brand-logo img { display: block; width: 100%; height: auto; }
.brand-sub { color: #9aa1ad; font-size: .74rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; text-align: center; }
.sidebar nav a.active, .userbox a.active { background: rgba(49, 168, 70, .16); color: #6fdc89; }
.sidebar .count { background: var(--brand-orange); color: #fff; }
.topbar .brand-logo-top { height: 30px; width: auto; background: #fff; border-radius: 6px; padding: 3px 6px; }
.login-body { background: radial-gradient(1200px 600px at 50% -10%, #2b3038 0%, #1c1f24 60%); }
.login-card { max-width: 400px; }
.login-brand { flex-direction: column; align-items: center; gap: 8px; margin-bottom: 26px; }
.login-brand img { width: 100%; max-width: 300px; height: auto; }
.login-brand span { color: var(--muted); font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.tile-ueberfaellig { border-top-color: #d92d20; }
a { color: #1f6fd1; }

/* ---------- Dokumente / Protokolle (Bildschirm + Druck) ---------- */
.doc { background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 2px 10px rgba(16,24,40,.06); padding: 34px 40px 24px; margin: 0 auto 18px; max-width: 940px; color: var(--ink); }
.nur-druck, .print-kopf { display: none; }
.doc-kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.doc-marke { display: flex; flex-direction: column; gap: 10px; }
.doc-marke img { width: 240px; height: auto; display: block; }
.doc-firma { display: flex; flex-direction: column; font-size: .76rem; color: var(--ink-2); line-height: 1.45; }
.doc-firma strong { font-size: .82rem; color: var(--ink); }
.doc-titel { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.doc-typ { font-size: .72rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--brand-orange); }
.doc-nr { font-size: 2rem; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.doc-datum { color: var(--ink-2); font-size: .86rem; }
.stempel { display: inline-block; margin-top: 12px; transform: rotate(-4deg); border: 3px solid; border-radius: 8px; padding: 5px 14px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; font-size: .9rem; line-height: 1.2; }
.stempel-gruen { color: var(--brand-green-dark); border-color: var(--brand-green); background: #effaf1; }
.stempel-orange { color: var(--brand-orange-dark); border-color: var(--brand-orange); background: #fff3ed; }
.stempel-rot { color: #b3261e; border-color: #d92d20; background: #fdecea; }
.stempel-grau { color: var(--ink-2); border-color: #9aa1ad; background: #f4f5f7; }
.doc-band { display: flex; height: 5px; margin: 18px 0 20px; border-radius: 3px; overflow: hidden; }
.doc-band span:first-child { flex: 7; background: var(--brand-green); }
.doc-band span:last-child { flex: 3; background: var(--brand-orange); }
.doc-untertitel { margin: -6px 0 14px; color: var(--ink-2); font-weight: 600; }
.doc-felder { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-bottom: 8px; }
.doc-felder.kompakt { grid-template-columns: 1fr 1fr; }
.doc-feld { background: #f5f6f8; border-radius: 8px; padding: 7px 11px; display: flex; flex-direction: column; min-width: 0; }
.doc-feld span { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.doc-feld strong { font-size: .94rem; font-weight: 600; overflow-wrap: anywhere; }
.doc-feld.gross { grid-column: span 2; }
.doc-feld.gross strong { font-size: 1.08rem; font-weight: 800; }
.doc-zweispaltig { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.doc-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 6px; }
.doc-box h3 { margin: 0 0 8px; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--brand-green-dark); }
.doc-h { font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; margin: 26px 0 10px; padding-left: 10px; border-left: 4px solid var(--brand-green); color: var(--ink); }
.doc-h small { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--muted); font-size: .82rem; margin-left: 6px; }
.doc-checkliste { columns: 2; column-gap: 24px; }
.cl-gruppe { break-inside: avoid; margin-bottom: 12px; }
.cl-gruppe h4 { margin: 0 0 4px; font-size: .74rem; color: var(--brand-green-dark); text-transform: uppercase; letter-spacing: .07em; }
.cl-punkt { display: grid; grid-template-columns: 18px 1fr auto; gap: 6px; padding: 4px 4px; border-bottom: 1px dotted #d6dae0; font-size: .86rem; align-items: baseline; }
.cl-sym { font-weight: 900; text-align: center; color: #9aa1ad; }
.st-ok .cl-sym, .st-erledigt .cl-sym { color: var(--brand-green); }
.st-mangel { background: #fdecea; border-radius: 4px; }
.st-mangel .cl-sym, .st-mangel .cl-st { color: #b3261e; }
.cl-txt em { display: block; font-style: normal; color: #b3261e; font-size: .8rem; }
.st-ok .cl-txt em, .st-erledigt .cl-txt em { color: var(--ink-2); }
.cl-st { font-size: .66rem; color: var(--muted); text-transform: uppercase; font-weight: 700; letter-spacing: .04em; }
.doc-tabelle { width: 100%; border-collapse: collapse; font-size: .88rem; }
.doc-tabelle th { text-align: left; font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border-bottom: 2px solid var(--ink); padding: 6px 8px; }
.doc-tabelle td { padding: 7px 8px; border-bottom: 1px solid #e6e8ec; vertical-align: middle; }
.doc-tabelle tr:nth-child(even) td { background: #fafbfc; }
.doc-tabelle .num { text-align: right; }
.doc-text { background: #f5f6f8; border-radius: 8px; padding: 10px 14px; font-size: .92rem; }
.doc-liste { margin: 0; padding-left: 18px; }
.doc-naechste { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.doc-naechste div { flex: 1; min-width: 160px; border: 2px solid var(--brand-green); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; }
.doc-naechste span { font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--brand-green-dark); }
.doc-naechste strong { font-size: 1.1rem; }
.doc-schaeden { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.doc-schaden { border: 1px solid #f6c9a5; background: #fff8f3; border-left: 4px solid var(--brand-orange); border-radius: 8px; padding: 10px 12px; break-inside: avoid; }
.doc-schaden-kopf { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.doc-schaden p { margin: 4px 0; font-size: .86rem; }
.doc-schaden-fotos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 6px 0; }
.doc-schaden-fotos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 5px; display: block; }
.ok-text { color: var(--brand-green-dark); font-weight: 600; }
.doc .galerie { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.doc .vergleich-box { margin: 14px 0 0; }
.doc .vergleich h3 { font-size: .8rem; color: var(--ink-2); }
.doc-fuss { margin-top: 28px; padding-top: 10px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; font-size: .7rem; color: var(--muted); flex-wrap: wrap; }
.doc-vorschau { max-width: none; box-shadow: none; }
/* Unterschriften */
.unterschrift-hinweis { font-size: .84rem; color: var(--ink-2); background: #f5f6f8; border-radius: 8px; padding: 9px 12px; margin: 0; }
.unterschriften-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; margin-top: 10px; }
.unterschrift-feld { display: flex; flex-direction: column; break-inside: avoid; }
.unterschrift-bild { height: 96px; display: flex; align-items: flex-end; }
.unterschrift-bild img { max-height: 92px; max-width: 100%; display: block; }
.unterschrift-linie { border-bottom: 1.5px solid var(--ink); margin-bottom: 4px; }
.unterschrift-name { font-size: .8rem; color: var(--ink-2); }
.unterschrift-meta { font-size: .68rem; color: var(--muted); }
.unterschrift-warnung { font-size: .74rem; color: #b3261e; font-weight: 700; }
.unterschrift-form { margin-top: 10px; }
.unterschrift-feld form .btn-ghost { padding-left: 0; }
/* Unterschriftsfeld (Vollbild auf Handy / Tablet) */
.sign-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(15, 17, 20, .78); display: flex; align-items: center; justify-content: center; padding: 10px; }
.sign-box { background: #fff; border-radius: 14px; width: min(980px, 100%); max-height: 100%; display: flex; flex-direction: column; padding: 16px 18px; gap: 10px; overflow: auto; }
.sign-box h2 { margin: 0; font-size: 1.15rem; }
.sign-hinweis { font-size: .86rem; color: var(--ink-2); margin: 0; background: #f5f6f8; border-radius: 8px; padding: 8px 10px; }
.sign-box label { margin: 0; }
.sign-pad { position: relative; height: min(48vh, 380px); min-height: 170px; border: 2px dashed #c9ced6; border-radius: 10px; background: #fcfcfd; touch-action: none; user-select: none; -webkit-user-select: none; }
.sign-pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.sign-x { position: absolute; left: 6%; right: 6%; bottom: 24%; border-bottom: 1.5px solid #aab0ba; pointer-events: none; }
.sign-x::before { content: '✕'; position: absolute; left: 0; bottom: 4px; color: #aab0ba; }
.sign-leer { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #b2b8c2; pointer-events: none; font-size: 1.05rem; text-align: center; padding: 0 20px; }
.sign-actions { display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; align-items: center; }
.sign-actions div { display: flex; gap: 8px; }
.sign-fehler { color: #b3261e; font-weight: 600; font-size: .86rem; }
.sign-quer { font-size: .78rem; color: var(--muted); }
body.sign-offen { overflow: hidden; }
@media (max-width: 860px) {
  .doc { padding: 18px 16px; border-radius: 10px; }
  .doc-kopf { flex-direction: column; gap: 12px; }
  .doc-titel { align-items: flex-start; text-align: left; }
  .doc-marke img { width: 190px; }
  .doc-zweispaltig, .unterschriften-grid, .doc-schaeden { grid-template-columns: 1fr; }
  .doc-checkliste { columns: 1; }
  .doc-feld.gross { grid-column: auto; }
  .doc-felder.kompakt { grid-template-columns: 1fr; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .sign-pad { height: 52vh; }
  .sign-box { padding: 10px 14px; gap: 6px; }
}

@media print {
  @page {
    size: A4;
    margin: 12mm 12mm 16mm;
    @bottom-right { content: "Seite " counter(page) " von " counter(pages); font-size: 7.5pt; color: #8a919c; font-family: system-ui, Arial, sans-serif; }
    @bottom-left { font-size: 7.5pt; color: #8a919c; font-family: system-ui, Arial, sans-serif; }
  }
  html, body { background: #fff !important; }
  body { font-size: 10pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc { border: 0; box-shadow: none; padding: 0; margin: 0; max-width: none; border-radius: 0; }
  .doc.nur-druck { display: block; }
  body:has(.doc.nur-druck) main > *:not(.doc) { display: none !important; }
  body:has(.doc) .print-kopf { display: none !important; }
  .print-kopf { display: flex; align-items: center; gap: 16px; border-bottom: 3px solid var(--brand-green); padding-bottom: 8px; margin-bottom: 14px; }
  .print-kopf img { width: 45mm; }
  .print-kopf div { display: flex; flex-direction: column; }
  .print-kopf strong { font-size: 14pt; }
  .print-kopf span { font-size: 8pt; color: #666; }
  .doc-marke img { width: 58mm; }
  .doc-nr { font-size: 20pt; }
  .doc-h { break-after: avoid; margin-top: 16px; }
  .doc-feld, .doc-box, .cl-gruppe, .doc-schaden, .doc-naechste, .unterschriften, .vergleich-box { break-inside: avoid; }
  .doc .galerie { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .doc .galerie img { border-radius: 4px; }
  .doc .galerie figcaption { font-size: 6.5pt; }
  .doc a { color: inherit; text-decoration: none; }
  .doc-checkliste { columns: 2; }
  .doc-zweispaltig { grid-template-columns: 1fr 1fr; }
  .unterschriften-grid { grid-template-columns: 1fr 1fr; }
  .no-print, .unterschrift-form, .doc form, .lightbox, .sign-overlay { display: none !important; }
  .tabs, .page-head .actions, .filterbar, .add-row, .status-form, .foto-form, .danger-zone, .form-actions { display: none !important; }
}
/* Unterschriftsfeld füllt den verfügbaren Platz (auch Handy quer) */
.sign-box { height: min(100%, 660px); }
.sign-pad { flex: 1 1 auto; height: auto; min-height: 140px; }
@media (orientation: landscape) and (max-height: 520px) {
  .sign-overlay { padding: 6px; }
  .sign-box { height: 100%; padding: 8px 12px; gap: 6px; }
  .sign-box h2 { font-size: .95rem; }
  .sign-hinweis { font-size: .72rem; padding: 4px 8px; }
  .sign-box label { flex-direction: row; align-items: center; gap: 8px; font-size: .8rem; }
  .sign-box label input { min-height: 32px; padding: 4px 8px; }
  .sign-quer { display: none; }
  .sign-actions .btn { min-height: 34px; padding: 6px 12px; }
  .sign-pad { min-height: 100px; }
}
/* Druck: A4 ist schmaler als 860px – Handy-Layout im Druck wieder aufheben */
@media print {
  .doc-kopf { flex-direction: row !important; gap: 24px !important; }
  .doc-titel { align-items: flex-end !important; text-align: right !important; }
  .doc-felder.kompakt { grid-template-columns: 1fr 1fr !important; }
  .doc-feld.gross { grid-column: span 2 !important; }
  .doc-schaeden { grid-template-columns: 1fr 1fr !important; }
  .doc-felder { grid-template-columns: repeat(4, 1fr) !important; }
  .doc-felder.kompakt { grid-template-columns: 1fr 1fr !important; }
  .vergleich { grid-template-columns: 1fr 1fr !important; }
  .main { margin: 0 !important; padding: 0 !important; }
}
.verkn-schaden { display: flex; gap: 12px; align-items: center; }
.verkn-schaden .thumb { flex: none; }
