:root {
  --c: #002F5C; --c2: #00535E; --bg: #f4f5f7; --card: #fff; --line: #e1e4e8;
  --text: #1d2228; --muted: #676D71; --red: #b3261e; --green: #2e7d32; --orange: #c46a00; --blue: #1d5fa8;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--blue); }
h1 { font-size: 1.5rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .8rem; }
h3 { font-size: 1rem; margin: .3rem 0; }
main { max-width: 1150px; margin: 0 auto; padding: 1.2rem; }

.top { background: var(--c); color: #fff; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem; padding: .6rem 1.2rem; }
.brand { color: #fff; font-weight: 700; text-decoration: none; }
.top nav { display: flex; flex-wrap: wrap; gap: .2rem; flex: 1; }
.top nav a { color: #dfe8f1; text-decoration: none; padding: .35rem .7rem; border-radius: 6px; }
.top nav a:hover, .top nav a.on { background: rgba(255,255,255,.15); color: #fff; }
.top nav .logout { margin-left: auto; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.2rem; margin-bottom: 1rem; }
.narrow { max-width: 420px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--c2); border-radius: 10px; padding: .8rem 1rem; display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat strong { font-size: 1.5rem; }
.stat small { color: var(--muted); }
.stat.warn { border-left-color: var(--red); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 1rem; }

.flash { background: #e8f1fb; border: 1px solid #b8d2ee; padding: .6rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.muted { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; }
tfoot th { color: var(--text); border-top: 2px solid var(--line); }
.num { text-align: right; white-space: nowrap; }
.neg { color: var(--red); font-weight: 600; }
.tw { overflow-x: auto; }

label { display: flex; flex-direction: column; gap: .2rem; margin-bottom: .7rem; font-size: .9rem; color: var(--muted); flex: 1; min-width: 160px; }
label.check { flex-direction: row; align-items: center; gap: .4rem; color: var(--text); min-width: 0; flex: 0 0 auto; }
input, select, textarea { font: inherit; color: var(--text); padding: .45rem .55rem; border: 1px solid #c8cdd3; border-radius: 6px; background: #fff; width: 100%; }
input[type=checkbox] { width: auto; }
input[type=file] { border: 1px dashed #c8cdd3; }
textarea { resize: vertical; }
.row { display: flex; flex-wrap: wrap; gap: 0 1rem; }

button, .btn { display: inline-block; font: inherit; font-weight: 600; background: var(--c); color: #fff; border: 0; border-radius: 6px; padding: .5rem 1rem; cursor: pointer; text-decoration: none; }
button:hover, .btn:hover { filter: brightness(1.15); }
button.light, .btn.light { background: #e6eaef; color: var(--text); }
button.red { background: var(--red); }
button.link { background: none; color: var(--red); padding: 0; font-weight: 400; text-decoration: underline; }
form.inline { display: inline; }
form.sub { border-top: 1px dashed var(--line); margin-top: .8rem; padding-top: .8rem; }
form.danger { margin: 2rem 0 1rem; }
form.filter { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
form.filter select, form.filter input[name=q] { width: auto; min-width: 180px; }
form.book { display: flex; gap: .3rem; }
form.book input { width: 7.5rem; padding: .3rem .4rem; }
form.book input[type=date] { width: 9.5rem; }
form.book button { padding: .3rem .7rem; }

.b { display: inline-block; font-size: .78rem; font-weight: 600; padding: .1rem .5rem; border-radius: 99px; background: #eee; white-space: nowrap; }
.b.red { background: #fde7e6; color: var(--red); }
.b.green { background: #e5f4e6; color: var(--green); }
.b.orange { background: #fdf0e0; color: var(--orange); }
.b.blue { background: #e4eefa; color: var(--blue); }
.b.gray { background: #eceef0; color: var(--muted); }

.entry { border-bottom: 1px solid var(--line); padding: .7rem 0; }
.entry:last-child { border-bottom: 0; }
.entry-head { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; font-size: .9rem; }
.entry-head .date { font-weight: 700; }
.entry-head .edit { margin-left: auto; font-size: .85rem; }
.text { white-space: normal; }
.files { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.file { font-size: .85rem; background: #f0f3f6; padding: .15rem .6rem; border-radius: 6px; text-decoration: none; }
.filelist { padding-left: 1rem; }
.filelist li { margin-bottom: .3rem; }

table.year td.c, table.year th { text-align: center; }
table.year td.c a { color: inherit; text-decoration: none; display: block; }
.c.ok { background: #e5f4e6; } .c.part { background: #fdf0e0; } .c.open { background: #fde7e6; } .c.over { background: #e4eefa; }
td.na { background: #f7f7f7; }
.legend span { display: inline-block; padding: .1rem .6rem; border-radius: 4px; font-size: .85rem; }

@media (max-width: 640px) {
  main { padding: .8rem; }
  .top nav .logout { margin-left: 0; }
  form.book { flex-wrap: wrap; }
}
@media print {
  .top, .noprint, form, .flash { display: none !important; }
  body { background: #fff; }
  .card { border: 0; padding: 0; }
  main { max-width: none; padding: 0; }
  .entry { break-inside: avoid; }
}

/* --- BK-Abrechnung --- */
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset[disabled] { opacity: .65; }
.steps { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: 1rem; }
.steps a { padding: .35rem .75rem; border-radius: 99px; background: #e6eaef; color: var(--text); text-decoration: none; font-size: .9rem; }
.steps a.on { background: var(--c); color: #fff; }
.pos { color: var(--green); }
.small { font-size: .82rem; }
table.small td, table.small th { padding: .25rem .35rem; }
input.short { width: 6.5rem; padding: .3rem .4rem; }
label.block { display: flex; margin-bottom: .5rem; }
ul.checks { list-style: none; padding: 0; }
ul.checks li { padding: .35rem .6rem; border-radius: 6px; margin-bottom: .25rem; }
ul.checks li.error { background: #fde7e6; color: var(--red); }
ul.checks li.warn { background: #fdf0e0; color: var(--orange); }
ul.checks li.ok { background: #e5f4e6; color: var(--green); }
form.quick { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: flex-end; }
form.quick label { flex: 0 1 220px; margin-bottom: 0; }
table.md td { padding: .25rem .3rem; }

footer.version { margin: 2rem 0 1rem; text-align: right; font-size: .8rem; color: var(--muted); }
table.grid td, table.grid th { padding: .2rem .25rem; text-align: center; }
table.grid td:first-child, table.grid th:first-child { text-align: left; white-space: nowrap; }
table.grid input { width: 4.6rem; padding: .25rem .3rem; text-align: right; border-color: transparent; background: rgba(255,255,255,.7); }
table.grid input:focus { border-color: var(--c); background: #fff; }
table.grid td.c.open { background: #fdeeed; }
tr.editing td { background: #fffbe6; }
