:root {
  --bg: #f4f5f7; --card: #fff; --text: #1d2430; --muted: #6b7480; --line: #e3e6ea;
  --accent: #0b6bcb; --accent-dark: #0857a6; --ok: #1f8a4c; --err: #c0392b; --open: #b7791f;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { margin: 0 0 .8rem; font-weight: 600; }
h1 { font-size: 1.35rem; } h2 { font-size: 1.1rem; }

.top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem;
       padding: .7rem 1.2rem; background: #1d2430; }
.top .brand { color: #fff; font-weight: 700; }
.top nav a { color: #c9d1dc; margin-left: 1rem; }
.top nav a.active, .top nav a:hover { color: #fff; text-decoration: none; }
.banner { background: #fff4d6; color: #7a5a00; text-align: center; padding: .4rem; font-size: .9rem; }

main { max-width: 1100px; margin: 1.2rem auto; padding: 0 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1.1rem 1.2rem; margin-bottom: 1.2rem; }
.card.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.2rem; }
.grid2 .card { margin-bottom: 0; }
.grid2 + .card { margin-top: 1.2rem; }

label { display: block; margin-bottom: .7rem; font-size: .88rem; color: var(--muted); }
label input, label select { display: block; width: 100%; margin-top: .2rem; }
label.check { display: flex; align-items: center; gap: .4rem; color: var(--text); }
label.check input { width: auto; margin: 0; }
input, select { font: inherit; padding: .45rem .55rem; border: 1px solid #cfd5dc; border-radius: 6px; background: #fff; color: var(--text); }
input:focus, select:focus { outline: 2px solid #b8d6f5; border-color: var(--accent); }

.row { display: flex; gap: .7rem; align-items: flex-end; flex-wrap: wrap; }
.row > label { flex: 1 1 110px; }
.row.between { justify-content: space-between; align-items: center; }
.filter { align-items: center; margin-bottom: .8rem; }
.filter h2 { margin: 0 auto 0 0; }
.filter label { margin: 0; flex: 0 0 auto; }
.filter label input { display: inline-block; width: auto; }

button, .button { font: inherit; padding: .45rem .9rem; border-radius: 6px; border: 1px solid #cfd5dc; background: #fff; cursor: pointer; color: var(--text); display: inline-block; }
button:hover, .button:hover { background: #f0f2f5; text-decoration: none; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover, .button.primary:hover { background: var(--accent-dark); }
button.big { padding: .7rem 1.4rem; font-weight: 600; }
button.small, .button.small { padding: .25rem .6rem; font-size: .85rem; }
button.link { border: 0; background: none; padding: 0; color: var(--accent); }
button.link:hover { text-decoration: underline; background: none; }
.danger { color: var(--err) !important; }
button:disabled { opacity: .5; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .45rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
tfoot td { font-weight: 600; border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { white-space: nowrap; text-align: right; }
td.actions form { display: inline; margin-left: .6rem; }
td form.row { flex-wrap: nowrap; align-items: center; }
tr.selected td { background: #eef5fd; }
tr.archived td { color: var(--muted); }

.tag { display: inline-block; font-size: .78rem; padding: .1rem .5rem; border-radius: 999px; background: #eceff3; color: var(--muted); }
.tag.ok { background: #e3f4ea; color: var(--ok); }
.tag.open { background: #fdf1dc; color: var(--open); }
.tag.err { background: #fbe5e2; color: var(--err); }

.flash { padding: .65rem .9rem; border-radius: 8px; margin-bottom: 1rem; background: #e8f0fb; }
.flash.ok { background: #e3f4ea; color: #155f35; }
.flash.error { background: #fbe5e2; color: #8e2a1f; }
.muted { color: var(--muted); }
.timer { font-size: 2.6rem; font-weight: 600; margin: .2rem 0; font-variant-numeric: tabular-nums; }
.submitbar { margin-top: 1rem; }
pre { background: #f6f8fa; padding: .8rem; border-radius: 6px; overflow: auto; font-size: .82rem; }
details { margin-top: 1rem; }

@media (max-width: 640px) {
  table:not(.keep) th:nth-child(3), table:not(.keep) td:nth-child(3) { display: none; }
  .top nav a { margin-left: .7rem; }
}
iframe.pdf { display: block; width: 100%; height: 85vh; min-height: 600px; border: 1px solid var(--line); border-radius: 6px; background: #525659; }

/* Serviceberichte */
textarea { font: inherit; width: 100%; margin-top: .2rem; padding: .45rem .55rem; border: 1px solid #cfd5dc; border-radius: 6px; }
.small { font-size: .82rem; }
.grow { flex: 1 1 auto; }
.mt { margin-top: 1.2rem; }
.radios { align-items: center; margin-bottom: .4rem; }
.radios label.check { margin: 0; }
table.compact th, table.compact td { padding: .3rem .4rem; }
.vorteil { color: #228C28; }
ul.notes { color: #c42828; margin: .3rem 0 .8rem 1.2rem; padding: 0; }
.sigbox { position: relative; border: 1px solid #9aa3ad; border-radius: 8px; background: #fff; margin-bottom: .8rem; }
.sigbox canvas { display: block; width: 100%; height: 220px; touch-action: none; }
.sigbox .sigx { position: absolute; left: .8rem; bottom: 1.6rem; font-size: 1.6rem; color: #444; pointer-events: none; }
.sigbox::after { content: ""; position: absolute; left: 2.6rem; right: 1rem; bottom: 1.8rem; border-bottom: 1px solid #9aa3ad; pointer-events: none; }
.radios label.check { flex: 0 0 auto; margin-right: .8rem; }
.radios .grow { flex: 1 1 100%; }
@media (min-width: 640px) { .radios .grow { flex: 1 1 auto; } }
.card { overflow-x: auto; }      /* breite Tabellen auf dem Handy seitlich scrollen statt Seite sprengen */
table.compact th.num, table.compact td.num { white-space: nowrap; }

/* Aufgaben */
.badge { display: inline-block; min-width: 1.3em; padding: 0 .35em; border-radius: 999px; background: var(--err);
         color: #fff; font-size: .75rem; line-height: 1.3em; text-align: center; font-weight: 600; }
.taskadd .wide { flex: 3 1 260px; }
ul.tasks { list-style: none; margin: 0 0 .8rem; padding: 0; }
ul.tasks li { display: flex; align-items: flex-start; gap: .7rem; padding: .65rem .2rem; border-bottom: 1px solid var(--line); background: #fff; }
ul.tasks li.ghost { opacity: .4; background: #eef5fd; }
ul.tasks .handle { cursor: grab; color: #9aa3ad; font-size: 1.3rem; line-height: 1.2; padding: 0 .3rem; user-select: none; touch-action: none; }
ul.tasks .body { flex: 1 1 auto; min-width: 0; }
ul.tasks .title { font-weight: 600; color: var(--text); }
ul.tasks .meta { margin-top: .2rem; display: flex; gap: .35rem; flex-wrap: wrap; }
ul.tasks .notes { margin-top: .25rem; white-space: pre-line; }
ul.tasks .act { flex: 0 0 auto; }
details.done summary { list-style: none; }
details.done summary::-webkit-details-marker { display: none; }
details.done[open] summary { display: none; }
details.done { margin: 0; }
.row.nowrap { flex-wrap: nowrap; align-items: center; }
label.inline { display: flex; align-items: center; gap: .3rem; margin: 0; white-space: nowrap; color: var(--text); }
label.inline input { display: inline-block; width: 4.5em; margin: 0; }
@media (max-width: 640px) {
  ul.tasks li { flex-wrap: wrap; }
  ul.tasks .act { flex-basis: 100%; padding-left: 2.2rem; }
}

/* Startseite: Aufgaben links, Statistik rechts */
main.wide { max-width: 1400px; }
.dash { display: grid; grid-template-columns: minmax(0, 3fr) minmax(340px, 2fr); gap: 1.2rem; align-items: start; }
.dash .card { margin-bottom: 1.2rem; }
@media (max-width: 960px) { .dash { grid-template-columns: 1fr; } }
table.stats td, table.stats th { padding: .45rem .35rem; }
table.stats td .small { margin-top: .1rem; }
details.notefield { flex: 1 1 auto; margin: 0; }
details.notefield summary { cursor: pointer; }
details.notefield textarea { margin-top: .4rem; }
table.stats td.num, table.stats th.num { white-space: nowrap; }
