:root {
  --green: #00963f;
  --green-dark: #007a33;
  --green-soft: #eaf6ed;
  --ink: #101510;
  --muted: #667066;
  --bg: #f7faf7;
  --card: #ffffff;
  --border: #dde8df;
  --red: #c62828;
  --red-soft: #fdecec;
  --amber: #a15c00;
  --amber-soft: #fff4e0;
  --navy: #22356b;
  --radius: 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); min-height: 100vh; }
a { color: var(--green-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 48px; text-align: center; color: var(--muted); }

/* Layout */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side {
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.side .logo { width: 150px; margin: 4px 10px 18px; }
.side a.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
  font-size: 15px;
}
.side a.nav:hover { background: var(--green-soft); }
.side a.nav.active { background: var(--green); color: #fff; }
.side .section { margin: 14px 12px 4px; font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.side .who { margin-top: auto; padding: 12px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.side .who strong { display: block; color: var(--ink); font-size: 14px; }
.main { padding: 28px 32px 60px; max-width: 1100px; width: 100%; }
.topbar { display: none; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; position: fixed; inset: 0; z-index: 30; height: 100%; width: 100%; }
  .side.open { display: flex; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 20;
  }
  .topbar img { height: 30px; }
  .main { padding: 20px 16px 60px; }
}

h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -0.02em; }
h2 { font-size: 18px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 22px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

/* Buttons & Felder */
.btn {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 10px;
  padding: 9px 14px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { border-color: var(--green); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); background: var(--red-soft); }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.55; cursor: default; }
.icon-btn { background: none; border: 0; font-size: 22px; cursor: pointer; padding: 4px 8px; }

label.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 700; color: var(--muted); }
.field input, .field select, .field textarea {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--green); border-color: var(--green); }
.field textarea { min-height: 110px; resize: vertical; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; font-weight: 600; }
.form { display: grid; gap: 14px; }
.form .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }

/* Tabellen & Listen */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--green-soft); }
.list { display: grid; gap: 10px; }
.item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.item .meta { font-size: 13px; color: var(--muted); }
.empty { color: var(--muted); padding: 18px 4px; }

.badge { display: inline-block; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px; background: var(--green-soft); color: var(--green-dark); }
.badge.beta { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.grey { background: #eef0ee; color: var(--muted); }

.notice { padding: 12px 14px; border-radius: 12px; background: var(--amber-soft); color: var(--amber); font-size: 14px; margin-bottom: 16px; }
.error { padding: 10px 12px; border-radius: 10px; background: var(--red-soft); color: var(--red); font-size: 14px; }
.ok { padding: 10px 12px; border-radius: 10px; background: var(--green-soft); color: var(--green-dark); font-size: 14px; }

.msg { border: 1px solid var(--border); border-left: 4px solid var(--green); border-radius: 12px; padding: 14px 16px; background: #fff; }
.msg.wichtig { border-left-color: var(--red); }
.msg.unread { box-shadow: 0 0 0 2px var(--green-soft); }
.msg h3 { margin: 0 0 6px; font-size: 16px; }
.msg p { margin: 0; white-space: pre-wrap; line-height: 1.45; }
.msg .meta { margin-top: 8px; font-size: 12px; color: var(--muted); }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--border); border-radius: 22px; padding: 30px 26px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.06); }
.login img { width: 190px; display: block; margin: 0 auto 8px; }
.login h1 { text-align: center; font-size: 20px; margin: 10px 0 4px; }
.login .sub { text-align: center; }

/* Dialog */
.overlay { position: fixed; inset: 0; background: rgba(16, 21, 16, 0.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.dialog { background: #fff; border-radius: 20px; padding: 22px; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; }
.dialog.wide { max-width: 980px; height: 92vh; display: flex; flex-direction: column; }
.dialog iframe, .dialog .viewer { flex: 1; width: 100%; border: 1px solid var(--border); border-radius: 12px; background: #f2f4f2; }
.viewer img { max-width: 100%; display: block; margin: 0 auto; }
.qr svg { width: 220px; height: 220px; display: block; margin: 10px auto; }
.copy { font-family: ui-monospace, Menlo, monospace; font-size: 12px; word-break: break-all; background: var(--bg); padding: 10px; border-radius: 10px; border: 1px solid var(--border); }

.audit td { font-size: 13px; }
.audit .when { white-space: nowrap; color: var(--muted); }
.audit details { margin-top: 4px; }
.audit pre { white-space: pre-wrap; font-size: 12px; background: var(--bg); padding: 8px; border-radius: 8px; margin: 6px 0 0; }

@media print {
  .side, .topbar, .no-print { display: none !important; }
}
