:root {
  --bg: #f4f6f8; --card: #fff; --ink: #1c2833; --muted: #6b7785; --line: #e2e7ec;
  --brand: #1f4e79; --brand-2: #2f6fa8; --sea: #e8f1f8;
  --ok: #1e7b4f; --ok-bg: #e6f4ec; --warn: #a15c00; --warn-bg: #fff3e0; --err: #b3261e; --err-bg: #fdecea; --info: #2659a6; --info-bg: #e8effb;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .2rem; }
h2 { font-size: 1.2rem; margin: 0 0 .6rem; }
h3 { font-size: 1.05rem; margin: 0 0 .6rem; }
h4 { font-size: .95rem; margin: 1rem 0 .4rem; color: var(--muted); }
code { font-size: .85em; background: #eef1f4; padding: 1px 5px; border-radius: 4px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 56px; padding: 0 1.2rem; background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 40; }
.top a { color: #fff; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; }

/* Hamburger-Menü – bei jeder Bildschirmbreite eingeklappt */
.menu-btn { width: 42px; height: 38px; display: flex; flex-direction: column; justify-content: center; gap: 5px; padding: 0 9px; background: transparent; border: 1px solid rgba(255,255,255,.35); border-radius: 8px; cursor: pointer; }
.menu-btn:hover { background: rgba(255,255,255,.12); }
.menu-btn span { display: block; height: 2px; background: #fff; border-radius: 2px; transition: transform .2s, opacity .2s; }
.menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.menu-backdrop { position: fixed; inset: 56px 0 0 0; background: rgba(15,30,45,.35); z-index: 25; }
.menu { position: fixed; top: 56px; right: 0; bottom: 0; width: min(300px, 85vw); background: #fff; color: var(--ink); z-index: 30; display: flex; flex-direction: column; padding: 1rem 0; box-shadow: -8px 0 30px rgba(0,0,0,.18); overflow-y: auto; animation: menu-in .18s ease-out; }
.menu[hidden], .menu-backdrop[hidden] { display: none; }
@keyframes menu-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.menu a { color: var(--ink); padding: .7rem 1.4rem; font-weight: 500; }
.menu a:hover { background: var(--sea); color: var(--brand); text-decoration: none; }
.menu a.on { color: var(--brand); background: var(--sea); box-shadow: inset 3px 0 0 var(--brand); }
.menu-user { display: flex; flex-direction: column; padding: .3rem 1.4rem 1rem; border-bottom: 1px solid var(--line); margin-bottom: .5rem; }
.menu-user span { font-size: .8rem; color: var(--muted); word-break: break-all; }
.menu-sep { margin: .6rem 1.4rem .3rem; padding-top: .6rem; border-top: 1px solid var(--line); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.menu-logout { width: 100%; text-align: left; background: none; border: 0; padding: .7rem 1.4rem; font: inherit; font-weight: 500; color: var(--err); cursor: pointer; }
.menu-logout:hover { background: var(--err-bg); }
body.menu-open { overflow: hidden; }

main { max-width: 1280px; margin: 0 auto; padding: 1.2rem; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 2rem 1rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.card.narrow { max-width: 480px; margin: 2rem auto; }
.card.sealed { border-color: var(--ok); background: var(--ok-bg); }
.card.inactive { opacity: .6; }
.auth { min-height: 80vh; display: grid; place-items: center; }
.auth-brand { display: flex; gap: .7rem; align-items: center; margin-bottom: .5rem; }
.auth-brand img { width: 40px; }
.auth-brand h1 { font-size: 1.3rem; margin: 0; }

.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: .4rem; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.r { text-align: right; }
.warn-text { color: var(--err); font-weight: 600; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; color: var(--muted); }
.kpi span { display: block; font-size: 1.9rem; font-weight: 700; color: var(--ink); line-height: 1.1; }
.kpi.warn { border-color: #f0c48a; background: var(--warn-bg); }
.kpi.info { border-color: #b9cdf0; background: var(--info-bg); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .8rem; }
.unit-card { display: flex; flex-direction: column; gap: .25rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.unit-card:hover { text-decoration: none; border-color: var(--brand-2); box-shadow: 0 2px 10px rgba(31,78,121,.1); }
.uc-head { display: flex; justify-content: space-between; align-items: center; font-size: 1.05rem; }
.uc-foot { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .4rem; }
.cond { font-size: .75rem; color: var(--muted); }

.pill { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: #eef1f4; color: var(--ink); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--err-bg); color: var(--err); }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill.role { background: var(--sea); color: var(--brand); }

.status, .prio { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.status.big { font-size: .9rem; padding: 4px 12px; }
.status.offen { background: var(--err-bg); color: var(--err); }
.status.in_arbeit { background: var(--warn-bg); color: var(--warn); }
.status.erledigt_gemeldet { background: var(--info-bg); color: var(--info); }
.status.abgenommen { background: var(--ok-bg); color: var(--ok); }
.status.abgelehnt { background: #f6e7fb; color: #7a2a99; }
.prio.niedrig { background: #eef1f4; color: var(--muted); }
.prio.normal { background: #eef1f4; color: var(--ink); }
.prio.hoch { background: var(--warn-bg); color: var(--warn); }
.prio.dringend { background: var(--err); color: #fff; }

.tabs { display: flex; gap: .2rem; border-bottom: 2px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tabs a { padding: .55rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs a.on { color: var(--brand); border-color: var(--brand); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--brand); }

table.list { width: 100%; border-collapse: collapse; }
.list th, .list td { text-align: left; padding: .5rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.list th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.list th.r, .list td.r { text-align: right; }
.list.compact td, .list.compact th { padding: .3rem .4rem; }
.list tr.done td { color: var(--muted); }
.list td:first-child a { white-space: nowrap; }
.list tr:hover td { background: #fafbfc; }
.card:has(> table.list) { overflow-x: auto; }
td.details { max-width: 520px; word-break: break-word; font-family: ui-monospace, monospace; font-size: .75rem; color: var(--muted); }
.hash { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .75rem; color: var(--muted); word-break: break-all; }

form { margin: 0; }
form.inline { display: inline; }
label { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: .4rem; color: var(--ink); }
input, select, textarea { font: inherit; color: var(--ink); padding: .5rem .6rem; border: 1px solid #cdd5dd; border-radius: 7px; background: #fff; width: 100%; }
input[type=checkbox] { width: auto; }
input[type=file] { padding: .35rem; background: #fafbfc; }
input:focus, select:focus, textarea:focus { outline: 2px solid #b9d3ec; border-color: var(--brand-2); }
input:disabled, select:disabled, textarea:disabled { background: #f6f8fa; color: var(--ink); }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; }
legend { font-size: .85rem; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: .7rem; }
.row { display: flex; gap: .7rem; align-items: flex-end; flex-wrap: wrap; margin-top: .6rem; }
.row > label { flex: 1 1 160px; }
.row .grow { flex: 1; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .7rem 1rem; }
.form-grid .wide { grid-column: 1 / -1; }
.boxed { background: #f8fafb; border: 1px solid var(--line); border-radius: 8px; padding: .8rem; margin-top: .8rem; }
.boxed.ok { background: var(--ok-bg); border-color: #b5dcc6; }
.boxed.warn { background: var(--warn-bg); border-color: #f0c48a; }
.checkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: .2rem .6rem; margin: .5rem 0; padding: .5rem; border: 1px solid var(--line); border-radius: 8px; max-height: 220px; overflow: auto; }
.checkgrid.disabled, .disabled .checkgrid, .disabled .pick-head { opacity: .4; pointer-events: none; }
.pick-group { margin-top: .4rem; }
.pick-head { margin-top: .3rem; }
.site-head { display: flex; align-items: baseline; gap: .8rem; margin: 1.2rem 0 .6rem; padding-bottom: .3rem; border-bottom: 2px solid var(--sea); }
.site-head h3 { margin: 0; color: var(--brand); }
details { margin-top: .8rem; }
summary { cursor: pointer; color: var(--brand-2); font-weight: 600; margin-bottom: .6rem; }
.filters { align-items: flex-end; }
.filter { max-width: 240px; }

.btn { display: inline-block; font: inherit; font-weight: 600; padding: .5rem 1rem; border-radius: 7px; border: 1px solid #c3ced8; background: #fff; color: var(--brand); cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; background: var(--sea); }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-2); }
button.link { background: none; border: 0; padding: 0; color: var(--brand-2); cursor: pointer; font: inherit; }
button.link.danger { color: var(--err); }
button.link.small { font-size: .75rem; }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; word-break: break-word; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #b5dcc6; }
.flash.err { background: var(--err-bg); color: var(--err); border: 1px solid #f3b8b3; }

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 1rem; align-items: start; }
.cols > .card { margin-bottom: 0; }
.cols + .card, .cols + section { margin-top: 1rem; }
dl.kv { display: grid; grid-template-columns: 140px 1fr; gap: .35rem .8rem; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .85rem; }
dl.kv dd { margin: 0; }
ul.plain { list-style: none; padding: 0; margin: 0 0 1rem; }
ul.plain li { padding: .25rem 0; border-bottom: 1px solid var(--line); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .7rem; }
.gallery figure { margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fafbfc; }
.gallery img, .gallery .noimg { width: 100%; height: 140px; object-fit: cover; display: block; }
.gallery .noimg { display: grid; place-items: center; font-size: .8rem; color: var(--muted); padding: .5rem; text-align: center; }
.gallery figcaption { padding: .4rem .5rem; font-size: .72rem; color: var(--muted); }
.hidden-file { opacity: .4; }

.timeline { list-style: none; padding: 0 0 0 1rem; margin: 0 0 1rem; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 .9rem .8rem; }
.timeline li::before { content: ""; position: absolute; left: -1.38rem; top: .35rem; width: 10px; height: 10px; border-radius: 50%; background: var(--line); border: 2px solid #fff; }
.timeline li.ev-status::before { background: var(--brand-2); }
.timeline li.ev-kommentar::before { background: #9aa8b5; }
.result { margin-top: 1rem; }

@media (max-width: 640px) {
  main { padding: .7rem; }
  .top { padding: 0 .8rem; }
  .brand span { font-size: .95rem; }
  .cols { grid-template-columns: 1fr; }
  dl.kv { grid-template-columns: 1fr; }
  dl.kv dt { margin-top: .4rem; }
  .list th:nth-child(n+6), .list td:nth-child(n+6) { display: none; }
}
