:root {
  --bg: #f4f5f2; --card: #fff; --ink: #1d2320; --muted: #69716c; --line: #dfe3de;
  --brand: #1f5f4a; --brand-ink: #fff; --brand-soft: #e5efe9;
  --err: #b42318; --err-soft: #fdecea; --warn: #8a5a00; --warn-soft: #fff4dc; --ok: #1f7a4d; --ok-soft: #e3f4ea; --info-soft: #e8f0fb;
  --r: 12px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); }
h1 { font-size: 1.6rem; margin: .2rem 0 .8rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .8rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 .5rem; color: var(--muted); }
code { background: #eef0ec; padding: .1em .35em; border-radius: 4px; font-size: .88em; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .danger { color: var(--err); } .mt { margin-top: 1rem; } .r { text-align: right; }

.top { background: var(--brand); color: var(--brand-ink); display: flex; align-items: center; gap: 1.5rem; padding: .7rem 1rem; flex-wrap: wrap; }
.brand { font-weight: 700; letter-spacing: .02em; }
.nav { display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; flex: 1; }
.nav a { color: var(--brand-ink); text-decoration: none; padding: .35rem .7rem; border-radius: 8px; opacity: .85; }
.nav a.active, .nav a:hover { background: rgba(255,255,255,.15); opacity: 1; }
.nav .who { margin-left: auto; display: flex; align-items: center; gap: .3rem; }
.nav .logout { margin: 0; }
.nav .logout .link { color: var(--brand-ink); opacity: .8; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 1.2rem 1rem 4rem; }
body.public .wrap { max-width: 720px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1.2rem; margin-bottom: 1rem; }
.card.narrow { max-width: 440px; margin: 2rem auto; }
.card.center { text-align: center; padding: 2.5rem 1.2rem; }
.card.highlight { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: .8rem; }
.row form { margin: 0; }

.grid { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
@media (min-width: 640px) { .grid { grid-template-columns: 1fr 1fr; } }
.field { margin-bottom: .9rem; display: flex; flex-direction: column; }
.field[hidden] { display: none; }
.field.check label { display: flex; gap: .55rem; align-items: flex-start; font-weight: 400; }
.field.check input { margin-top: .3rem; width: 1.1rem; height: 1.1rem; flex: none; }
label { font-weight: 600; font-size: .92rem; margin-bottom: .3rem; }
.req { color: var(--err); }
input, select, textarea {
  font: inherit; color: inherit; width: 100%; padding: .6rem .7rem; border: 1px solid #c9cec8; border-radius: 8px; background: #fff; min-height: 44px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[readonly] { background: #f6f7f5; }
.invalid { border-color: var(--err); background: var(--err-soft); }
.hint { color: var(--muted); font-size: .8rem; margin-top: .2rem; }
.err { color: var(--err); font-size: .82rem; min-height: 0; }
.err:empty { display: none; }
textarea.code { font: 13px/1.45 ui-monospace, Menlo, Consolas, monospace; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 600; border: 1px solid var(--brand);
  background: var(--brand); color: var(--brand-ink); padding: .6rem 1.1rem; border-radius: 8px; cursor: pointer; text-decoration: none; min-height: 44px; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--brand); }
.btn.small { padding: .35rem .8rem; min-height: 36px; font-size: .9rem; }
.btn.danger { background: var(--err); border-color: var(--err); }
.btn.ok { background: var(--ok); border-color: var(--ok); }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); cursor: pointer; text-decoration: underline; }
.link.danger { color: var(--err); }

.flash { padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; background: var(--ok-soft); color: var(--ok); }
.flash.err { background: var(--err-soft); color: var(--err); }
.flash.warn { background: var(--warn-soft); color: var(--warn); }
.flash.info { background: var(--info-soft); color: #1d4f91; }
.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: .15rem .55rem; border-radius: 99px; background: #eceeea; color: var(--muted); white-space: nowrap; }
.s-ausgefuellt { background: var(--warn-soft); color: var(--warn); }
.s-geprueft { background: var(--info-soft); color: #1d4f91; }
.s-exportiert { background: var(--ok-soft); color: var(--ok); }
.s-warn { background: var(--err-soft); color: var(--err); }

.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filters select, .filters input { width: auto; }
.table-wrap { overflow-x: auto; padding: 0; }
table { border-collapse: collapse; width: 100%; }
.list th, .list td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.list th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafbf9; }
.list input { min-height: 36px; padding: .35rem .5rem; }
.list tr:last-child td { border-bottom: 0; }

.grid-table th, .grid-table td { border-bottom: 1px solid var(--line); padding: .35rem .4rem; text-align: left; }
.grid-table th { font-size: .82rem; background: #fafbf9; min-width: 110px; vertical-align: bottom; }
.grid-table th small, .grid-table td small { display: block; font-weight: 400; color: var(--muted); font-size: .75rem; }
.grid-table .sticky { position: sticky; left: 0; background: #fff; min-width: 180px; z-index: 1; padding-left: .8rem; }
.grid-table th.sticky { background: #fafbf9; }
input.num { text-align: right; font-variant-numeric: tabular-nums; min-width: 90px; }
.grid-table input { min-height: 38px; }

.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.inline-form input { flex: 1 1 140px; width: auto; }
.fz-form { display: grid; grid-template-columns: 1fr; gap: .5rem; margin-top: 1rem; }
@media (min-width: 800px) { .fz-form { grid-template-columns: 1.4fr 1.4fr 1fr 1fr .7fr 1.2fr auto; } }

dl.kv { display: grid; grid-template-columns: 1fr; gap: .15rem 1rem; margin: 0; }
@media (min-width: 640px) { dl.kv { grid-template-columns: 260px 1fr; } }
dl.kv dt { color: var(--muted); font-size: .9rem; }
dl.kv dd { margin: 0 0 .4rem; }
details summary { cursor: pointer; font-weight: 600; color: var(--brand); margin-top: 1rem; }
img.sig { max-width: 320px; width: 100%; border-bottom: 1px solid var(--ink); background: #fff; }

.files { list-style: none; padding: 0; margin: .5rem 0 0; }
.files li { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.copy { display: flex; gap: .5rem; }
.copy input { font-size: .85rem; }

/* Fragebogen */
.intro p { color: var(--muted); }
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 1rem 0 .6rem; }
.progress .bar { height: 100%; width: 0; background: var(--brand); transition: width .3s; }
.steps { list-style: none; display: flex; gap: .3rem; padding: 0; margin: 0 0 1rem; overflow-x: auto; scrollbar-width: none; }
.steps li { font-size: .78rem; padding: .3rem .6rem; border-radius: 99px; background: #e9ece8; color: var(--muted); white-space: nowrap; cursor: pointer; }
.steps li.done { background: var(--brand-soft); color: var(--brand); }
.steps li.active { background: var(--brand); color: #fff; }
.actions { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .8rem 0;
  background: linear-gradient(transparent, var(--bg) 30%); }
.upload { display: flex; gap: .5rem; flex-wrap: wrap; }
.upload select { flex: 1 1 220px; width: auto; }
.filebtn { cursor: pointer; }
.sigwrap { border: 2px dashed #c9cec8; border-radius: 8px; background: #fff; max-width: 600px; }
.sigwrap canvas { display: block; width: 100%; touch-action: none; cursor: crosshair; }
.done-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); font-size: 2rem; line-height: 64px; margin: 0 auto 1rem; }

/* Druck */
.print { background: #fff; padding: 1.5rem; border-radius: var(--r); }
.ptable { width: 100%; margin-bottom: 1rem; font-size: .92rem; }
.ptable th, .ptable td { border-bottom: 1px solid #ddd; padding: .3rem .4rem; text-align: left; vertical-align: top; }
.ptable th { width: 40%; font-weight: 600; color: #444; }
.ptable.grid th { width: auto; }
body.public .wrap:has(.print.wide) { max-width: 1200px; }
@media print {
  body { background: #fff; font-size: 11pt; }
  .top, .noprint { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .print { padding: 0; }
  h2 { break-after: avoid; margin-top: 1rem; }
  tr { break-inside: avoid; }
}

/* Anmeldung, 2FA, Benutzer */
.qr { width: 220px; height: 220px; margin: 1rem auto; }
.qr svg { width: 100%; height: 100%; }
.center-text { text-align: center; }
code.secret { letter-spacing: .08em; word-break: break-all; }
input.otp { font-size: 1.5rem; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.codes { columns: 2; list-style: none; padding: 0; margin: 1rem 0; }
.codes li { padding: .3rem 0; font-size: 1.1rem; }
.row.tight { margin: 0; gap: .8rem; }
.block { display: block; }
tr.inactive td { opacity: .55; }
.status-card p { margin: 0 0 .6rem; }
.status-card .inline-form { margin: 0; }
.narrow-form { max-width: 420px; }

.foot { display: flex; gap: 1.2rem; justify-content: center; flex-wrap: wrap; padding: 1rem 1rem 2rem; font-size: .85rem; }
.foot a { color: var(--muted); }
@media print { .foot { display: none; } }

/* DATEV-Abgleich und Anlegen */
.tabs { display: flex; gap: .3rem; margin: 2rem auto .8rem; flex-wrap: wrap; justify-content: center; }
.tabs a { padding: .55rem 1rem; border-radius: 8px; text-decoration: none; color: var(--brand); border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: .92rem; }
.tabs a.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.tabs + .card.narrow { margin-top: 0; }
.stats { display: flex; flex-wrap: wrap; gap: 1.5rem 2.5rem; }
.stats div { display: flex; flex-direction: column; }
.stats strong { font-size: 1.8rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); font-size: .88rem; }
.stats .bad strong { color: var(--err); }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: .3rem 0; }
label.inline { display: inline-flex; gap: .5rem; align-items: center; font-weight: 400; margin: 0; }
label.inline input { width: auto; min-height: 0; }
.chg { font-size: .9rem; }
.small-table td, .small-table th { font-size: .85rem; white-space: nowrap; }
.table-wrap > h2 { padding: 1.2rem 1.2rem .4rem; margin: 0; }

/* Meldungen, Rechnungen, Berichte */
.tabs.left { justify-content: flex-start; margin: 0 0 1rem; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.report-card { text-decoration: none; color: inherit; margin: 0; transition: border-color .15s; }
.report-card:hover, .report-card:focus-visible { border-color: var(--brand); }
.report-card h2 { color: var(--brand); font-size: 1.05rem; }
.report-card p { margin: 0; font-size: .92rem; }
.quick { margin: 0 0 .4rem; }
.quick a { font-size: .9rem; }
input.unit { max-width: 140px; }
.inv-edit td { vertical-align: top; }
.inv-edit input.num { max-width: 120px; }
.danger-text { color: var(--err) !important; border-color: var(--err) !important; }
.zeit-form { grid-template-columns: 1fr; }
@media (min-width: 800px) { .zeit-form { grid-template-columns: 1.3fr 1fr .8fr 2.5fr auto; } }
.invoice { max-width: 780px; }
.inv-head { display: flex; justify-content: space-between; gap: 2rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.inv-sender { font-size: .75rem; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: .2rem; margin-bottom: .5rem; }
.inv-meta { text-align: right; font-size: .9rem; }
.inv-table { width: 100%; margin: 1rem 0; }
.inv-table th, .inv-table td { padding: .45rem .4rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.inv-table th { border-bottom: 2px solid var(--ink); font-size: .85rem; }
.inv-table th.r, .inv-table td.r { text-align: right; white-space: nowrap; }
.inv-table tfoot td { border-bottom: 0; }
.inv-table small { color: var(--muted); }
.inv-foot { font-size: .75rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: .5rem; margin-top: 2rem; }
@media print { .invoice { max-width: none; } .card { border: 0; padding: 0; } }

.brand { white-space: nowrap; }
@media (max-width: 1200px) { .nav a { padding: .35rem .5rem; } .top { gap: 1rem; } }
