/* Betriebssoftware – eigenes, schlankes Stylesheet (keine Build-Werkzeuge nötig) */
:root {
  --bg: #f4f5f7; --surface: #ffffff; --border: #e3e6ea; --text: #1c1f24; --muted: #6b7280;
  --primary: #1f6f8b; --primary-dark: #17566b; --accent: #2f7d32;
  --green: #16a34a; --yellow: #d97706; --red: #dc2626; --blue: #2563eb;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 1px 8px rgba(0,0,0,.04);
  --nav-w: 220px;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.45; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
small, .muted { color: var(--muted); }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: .9em; }

/* Layout */
.shell { display: flex; min-height: 100vh; }
.nav { width: var(--nav-w); background: #14202b; color: #cbd5e1; padding: 1rem .75rem; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: .25rem; flex-shrink: 0; }
.nav .brand { color: #fff; font-weight: 700; font-size: 1.05rem; padding: .5rem .75rem 1rem; }
.nav a { color: #cbd5e1; padding: .55rem .75rem; border-radius: 8px; display: flex; align-items: center; gap: .6rem; }
.nav a:hover, .nav a.active { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.nav .spacer { flex: 1; }
.nav .user { font-size: .85rem; padding: .5rem .75rem; color: #94a3b8; }
.nav .badge { margin-left: auto; }
.main { flex: 1; min-width: 0; padding: 1.5rem 2rem 4rem; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.topbar h1 { margin: 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* Karten & Tabellen */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card h2 { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .02em; }
tr:hover td { background: #fafbfc; }
.table-wrap { overflow-x: auto; }
dl.props { display: grid; grid-template-columns: 130px 1fr; gap: .3rem 1rem; margin: 0; }
dl.props dt { color: var(--muted); font-size: .85rem; }
dl.props dd { margin: 0; }

/* Buttons & Formulare */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .9rem; border-radius: 8px; border: 1px solid var(--border); background: #fff; color: var(--text); font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f1f3f5; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-danger { color: var(--red); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: .3rem .6rem; font-size: .85rem; }
.btn-link { border: none; background: none; color: var(--primary); padding: .2rem; }
form.inline { display: inline; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .2rem; }
input:not([type]), input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=datetime-local], input[type=password], input[type=url], select, textarea {
  width: 100%; padding: .5rem .65rem; border: 1px solid #cfd5dc; border-radius: 8px; font: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(31,111,139,.35); border-color: var(--primary); }
.field { margin-bottom: .9rem; }
.field .help { font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.field .errors { color: var(--red); font-size: .85rem; margin-top: .2rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.checkbox { display: flex; align-items: center; gap: .5rem; }
.checkbox input { width: auto; }
.errorlist { color: var(--red); margin: 0 0 .75rem; padding-left: 1.2rem; }
.search { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.search input, .search select { width: auto; min-width: 160px; }

/* Badges & Ampel */
.badge { display: inline-block; padding: .15rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: #e5e7eb; color: #374151; white-space: nowrap; }
.badge-brand { color: #fff; }
.ampel { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 600; }
.ampel::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.ampel-green { color: var(--green); } .ampel-yellow { color: var(--yellow); } .ampel-red { color: var(--red); } .ampel-done { color: var(--muted); }
.ampel-red { animation: pulse 1.5s infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.stat { text-align: center; }
.stat .num { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.stat .num.red { color: var(--red); }
.stat .lbl { color: var(--muted); font-size: .85rem; }

/* Kanban */
.board { display: flex; gap: .85rem; overflow-x: auto; padding-bottom: 1rem; align-items: stretch; min-height: 60vh; }
.column { flex: 0 0 280px; background: #e9ecf0; border-radius: var(--radius); padding: .6rem; max-height: calc(100vh - 160px); display: flex; flex-direction: column; }
.column-head { display: flex; justify-content: space-between; align-items: center; padding: .25rem .4rem .6rem; font-weight: 600; font-size: .9rem; }
.column-head .count { color: var(--muted); font-weight: 400; }
.column-body { overflow-y: auto; min-height: 120px; flex: 1; display: flex; flex-direction: column; gap: .5rem; }
.dcard { background: #fff; border-radius: 8px; padding: .6rem .7rem; box-shadow: var(--shadow); cursor: grab; border-left: 4px solid var(--border); }
.dcard:active { cursor: grabbing; }
.dcard.sortable-ghost { opacity: .4; }
.dcard .title { font-weight: 600; display: block; color: var(--text); }
.dcard .meta { font-size: .8rem; color: var(--muted); display: flex; justify-content: space-between; gap: .5rem; margin-top: .35rem; flex-wrap: wrap; }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: .6rem 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 90px 1fr; gap: .75rem; }
.timeline .when { font-size: .8rem; color: var(--muted); }
.timeline .kind { font-weight: 600; font-size: .85rem; margin-right: .4rem; }
.timeline .text { white-space: pre-wrap; }

/* Meldungen */
.messages { position: fixed; top: 1rem; right: 1rem; z-index: 100; display: flex; flex-direction: column; gap: .5rem; }
.msg { background: #14202b; color: #fff; padding: .6rem 1rem; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.2); animation: fadeout .5s 4s forwards; }
.msg.error { background: var(--red); }
.msg.success { background: var(--green); }
@keyframes fadeout { to { opacity: 0; visibility: hidden; } }
.empty { color: var(--muted); padding: 1rem; text-align: center; font-style: italic; }
.list-item { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--border); align-items: center; }
.list-item:last-child { border-bottom: 0; }
.list-item.unread { font-weight: 600; }
details summary { cursor: pointer; color: var(--primary); }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card { width: 100%; max-width: 380px; }

/* Mobil */
@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .nav { width: auto; height: auto; position: fixed; top: auto; bottom: 0; left: 0; right: 0; flex-direction: row; padding: .3rem .15rem calc(.3rem + env(safe-area-inset-bottom)); z-index: 50; gap: 0; }
  .nav .brand, .nav .user, .nav .spacer, .nav .desktop-only { display: none; }
  .nav a { flex: 1; min-width: 0; flex-direction: column; gap: .1rem; font-size: .62rem; padding: .3rem .1rem; position: relative; }
  .nav a span:last-of-type { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav .badge { margin: 0; position: absolute; top: -2px; right: 6px; transform: none; }
  .main { padding: 1rem 1rem 5.5rem; }
  .column { flex-basis: 85vw; max-height: none; }
  dl.props { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: .1rem; }
  html { font-size: 16px; }
}

/* Zwei-Faktor-Anmeldung */
.qr svg { display: block; width: 200px; height: auto; margin: .5rem auto; background: #fff; }
.codes { columns: 2; padding-left: 1.4rem; line-height: 1.8; }
