:root {
  --navy: #14248f;
  --navy-dark: #0c1764;
  --accent: #d6402b;
  --bg: #f3f5fa;
  --card: #ffffff;
  --text: #1c2033;
  --muted: #687088;
  --line: #dde1ec;
  --ok: #1d7a46;
  --ok-bg: #e6f4ec;
  --warn-bg: #fff6e0;
  --err: #b42318;
  --err-bg: #fdecea;
  --done: #9aa1b5;
  --radius: 8px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
a { color: var(--navy); }
h1 { font-size: 1.55rem; margin: .2em 0 .5em; color: var(--navy-dark); }
h2 { font-size: 1.15rem; margin: 0 0 .6em; color: var(--navy-dark); }
h3 { font-size: 1rem; margin: 1.2em 0 .4em; }
code, .mono { font-family: Consolas, "Cascadia Mono", ui-monospace, monospace; }
.break { word-break: break-all; }
.pre { white-space: pre-wrap; }
pre { background: #f6f7fb; border: 1px solid var(--line); border-radius: 6px; padding: .5em .7em; white-space: pre-wrap; margin: .3em 0; }

/* Kopf */
header.top { background: var(--navy); color: #fff; border-bottom: 4px solid var(--accent); }
header.top .wrap { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; padding-top: .6rem; padding-bottom: .6rem; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: .55rem; }
.logo { width: 26px; height: 26px; border-radius: 6px; background: #fff url("/static/icon.svg") center / 18px no-repeat; }
nav.main { display: flex; align-items: center; gap: .2rem; flex: 1; flex-wrap: wrap; }
nav.main a, nav.main button.link { color: #dfe4ff; text-decoration: none; padding: .35rem .6rem; border-radius: 6px; font-size: .95rem; }
nav.main a:hover, nav.main a[aria-current] { background: rgba(255,255,255,.14); color: #fff; }
nav.main .spacer { flex: 1; }
nav.main .me { font-weight: 600; }

.wrap { max-width: 1060px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.wrap.wide { max-width: 1320px; }
main.wrap { padding-top: 1.4rem; padding-bottom: 3rem; }

/* Karten, Raster */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; margin: 0 0 1.2rem; box-shadow: 0 1px 2px rgba(20,36,143,.05); }
.card.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.hero { text-align: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.grid2 > .card { margin: 0 0 1.2rem; }
.row { display: flex; align-items: center; gap: .5rem; }
.row.between { justify-content: space-between; }
.row.gap { gap: .5rem; flex-wrap: wrap; }
.wrap-gap { flex-wrap: wrap; gap: 1rem; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .87rem; }
.inline { display: inline; }

/* Formulare */
.stack { display: flex; flex-direction: column; gap: .35rem; }
.stack label { font-weight: 600; margin-top: .55rem; }
.stack label.sub { font-weight: 500; font-size: .9rem; color: var(--muted); margin-top: .3rem; }
.stack label.switch, label.switch { font-weight: 500; display: flex; gap: .55rem; align-items: center; margin-top: .8rem; }
.stack h2 { margin-top: 1rem; }
input, select, textarea { font: inherit; color: inherit; width: 100%; padding: .55rem .65rem; border: 1px solid #c4cada; border-radius: 6px; background: #fff; }
input[type=checkbox] { width: 1.15rem; height: 1.15rem; padding: 0; accent-color: var(--navy); }
input:focus, select:focus, textarea:focus { outline: 2px solid #8ea0ff; outline-offset: 0; border-color: var(--navy); }
input.short { max-width: 9rem; }
.code-input { font-family: Consolas, ui-monospace, monospace; font-size: 1.6rem; letter-spacing: .15em; text-align: center; text-transform: uppercase; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field.has-err input { border-color: var(--err); }
.hint { color: var(--muted); font-size: .87rem; margin: 0 0 .2rem; }
.err { color: var(--err); font-size: .9rem; margin: .1rem 0 0; font-weight: 600; }
.pw { display: flex; gap: .4rem; }
.pw input { flex: 1; }
.grid-form { display: grid; grid-template-columns: minmax(170px, 260px) 1fr; gap: .55rem 1rem; align-items: center; }
.grid-form label { font-weight: 600; }
.settings .card label { display: block; font-weight: 600; margin-top: .8rem; }
.settings .card label.switch { display: flex; }

/* Knöpfe */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .3rem; font: inherit; font-weight: 600; padding: .5rem .95rem; border-radius: 6px; border: 1px solid #c4cada; background: #fff; color: var(--navy); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--navy); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-dark); }
.btn.danger { color: var(--err); border-color: #f0b8b2; margin-top: .6rem; }
.btn.big { padding: .75rem 1.3rem; font-size: 1.05rem; }
.btn.small { padding: .2rem .55rem; font-size: .85rem; font-weight: 600; }
.btn.copied { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
button.link { background: none; border: 0; font: inherit; color: inherit; cursor: pointer; padding: 0; text-decoration: underline; }

/* Meldungen, Kennzeichen */
.flash { padding: .65rem .9rem; border-radius: 6px; margin: .6rem 0 1rem; border: 1px solid; }
.flash.info { background: #eef1ff; border-color: #c9d1ff; }
.flash.ok { background: var(--ok-bg); border-color: #a8d8bb; color: #145233; }
.flash.error { background: var(--err-bg); border-color: #f3b4ad; color: var(--err); }
.flash.inline { display: inline-block; margin: 0; padding: .35rem .7rem; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: .15rem .55rem; border-radius: 999px; vertical-align: middle; letter-spacing: .02em; }
.st-angelegt { background: var(--warn-bg); color: #8a5a00; }
.st-eingegangen { background: #e4e9ff; color: var(--navy); }
.st-in_arbeit { background: #e3f2fd; color: #0b5a91; }
.st-abgeschlossen { background: var(--ok-bg); color: var(--ok); }
.tag { display: inline-block; font-size: .72rem; font-weight: 700; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 .35rem; vertical-align: middle; }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
table.list th, table.list td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list thead th { font-size: .82rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
table.list tbody tr:hover { background: #f8f9fd; }
table.kv th { text-align: left; width: 42%; font-weight: 600; color: var(--muted); padding: .45rem .5rem .45rem 0; vertical-align: top; }
table.kv td { padding: .4rem 0; }
table.kv tr.todo th { color: #8a5a00; }
table.kv .val { font-weight: 600; margin-right: .3rem; }
.search { margin: 0 0 1rem; max-width: 560px; }
progress { width: 90px; height: 10px; accent-color: var(--navy); vertical-align: middle; }

/* Code-Anzeige */
.big-url { font-size: 1.5rem; font-weight: 700; color: var(--navy); margin: .2rem 0; }
.big-code { font-family: Consolas, ui-monospace, monospace; font-size: 2.6rem; font-weight: 700; letter-spacing: .12em; color: var(--navy-dark); background: #eef1ff; border-radius: 10px; padding: .4rem 1rem; display: inline-block; margin: .3rem 0 .8rem; }
.qr { width: 220px; max-width: 100%; margin: .5rem auto; background: #fff; }
.qr svg { width: 100%; height: auto; display: block; }
.secret .mask { letter-spacing: .1em; margin-right: .3rem; }
.secret.shown .mask { font-family: Consolas, ui-monospace, monospace; letter-spacing: 0; font-weight: 700; }

/* Checkliste */
.cl-head { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: .6rem 0 .5rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.cl-head h1 { margin: .1rem 0 .1rem; }
.cl-progress { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.cl-progress progress { width: 180px; height: 14px; }
#progtext { font-weight: 700; color: var(--navy); }
.cl-section { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 1.2rem; overflow: hidden; }
.cl-section h2 { background: #eef1ff; padding: .65rem 1rem; margin: 0; font-size: 1.05rem; border-bottom: 1px solid var(--line); }
.item { display: flex; gap: .9rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); transition: background .2s, opacity .2s; }
.item:last-child { border-bottom: 0; }
.item .chk { flex: none; }
.item .box { width: 2.4rem; height: 2.4rem; border: 2px solid var(--navy); border-radius: 7px; background: #fff; font-size: 1.4rem; font-weight: 700; color: #fff; cursor: pointer; line-height: 1; }
.item .box:hover { background: #eef1ff; }
.item .body { flex: 1; min-width: 0; }
.item .text { font-weight: 600; }
.item .detail { color: var(--muted); font-size: .9rem; margin-top: .15rem; }
.item .extras { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-top: .4rem; font-size: .92rem; }
.item .kvp code { background: #f1f3f9; padding: .1rem .35rem; border-radius: 4px; }
.item .meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1rem; margin-top: .35rem; color: var(--muted); font-size: .85rem; }
.item .note { width: 100%; }
.item .note summary { cursor: pointer; }
.item .note-form { display: flex; flex-direction: column; gap: .3rem; margin-top: .3rem; max-width: 640px; }
.item .note-form .btn { align-self: flex-start; }
.item.is-done { background: #f6f7fa; }
.item.is-done .text, .item.is-done .detail, .item.is-na .text, .item.is-na .detail { color: var(--done); text-decoration: line-through; }
.item.is-done .box { background: var(--ok); border-color: var(--ok); }
.item.is-na { background: #fafafa; }
.item.is-na .box { background: #c9cdd8; border-color: #c9cdd8; }
.item.is-done .extras, .item.is-na .extras { opacity: .55; }
body.hide-done .item.is-done, body.hide-done .item.is-na { display: none; }
.item.busy { opacity: .6; }

/* Druckansicht */
.printdoc { background: #fff; border: 1px solid var(--line); padding: 1.5rem 1.8rem; max-width: 900px; margin: 1rem auto; font-size: .92rem; }
.printdoc h1 { text-align: center; font-size: 1.35rem; margin: 0 0 .2rem; }
.printdoc h2 { font-size: 1rem; margin: 1.1rem 0 .3rem; border-bottom: 1px solid #999; padding-bottom: .15rem; text-align: center; }
.pmeta { text-align: center; color: var(--muted); font-size: .82rem; margin: 0 0 .8rem; }
table.phead { margin-bottom: .6rem; }
table.phead th { text-align: left; white-space: nowrap; padding: .2rem .5rem .2rem 0; width: 1%; }
table.phead td { border-bottom: 1px solid #bbb; padding: .2rem .8rem .2rem .2rem; min-width: 10rem; }
table.pitems td { padding: .22rem .3rem; vertical-align: top; border-bottom: 1px dotted #ddd; }
.pbox { width: 1.6rem; font-size: 1.15rem; line-height: 1.1; }
.pwhen { width: 8.5rem; white-space: nowrap; color: var(--muted); font-size: .8rem; text-align: right; }
.pdetail { color: #555; font-size: .82rem; }
.pnote { font-style: italic; font-size: .85rem; }
table.pitems tr.is-na td:nth-child(2) { color: #999; text-decoration: line-through; }
.pfoot { text-align: center; color: var(--muted); font-size: .78rem; margin-top: 1rem; }

@media print {
  @page { size: A4; margin: 12mm; }
  header.top, .noprint { display: none !important; }
  body { background: #fff; }
  main.wrap { padding: 0; max-width: none; }
  .printdoc { border: 0; padding: 0; margin: 0; max-width: none; font-size: 10pt; }
  table.pitems tr { break-inside: avoid; }
}

@media (max-width: 760px) {
  .grid2 { grid-template-columns: 1fr; }
  .grid-form { grid-template-columns: 1fr; }
  .big-code { font-size: 2rem; }
  h1 { font-size: 1.3rem; }
  nav.main .spacer { display: none; }
}
