:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --primary: #2c5f8a;
  --primary-dark: #234c6e;
  --border: #d9dee5;
  --text: #1f2a36;
  --muted: #6b7785;
  --danger: #c0392b;
  --ok: #2e7d32;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: system-ui, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
[hidden] { display: none !important; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.empty { padding: 30px; text-align: center; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 360px; }
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 26px; box-shadow: 0 2px 12px rgba(0,0,0,.05);
}
.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-card label { display: block; margin: 14px 0 5px; font-weight: 600; }
.login-card input { width: 100%; }

/* Inputs */
input, select, textarea {
  padding: 9px 10px; border: 1px solid var(--border); border-radius: 7px;
  font-size: 14px; width: 100%; font-family: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); border-color: var(--primary); }

/* Buttons */
.btn {
  padding: 9px 16px; border: 1px solid var(--border); border-radius: 7px;
  background: #fff; cursor: pointer; font-weight: 600; font-size: 14px;
}
.btn:hover { background: #f0f3f7; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: #fbecea; }

/* Topbar */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card); border-bottom: 1px solid var(--border); padding: 12px 20px;
}
.brand { font-weight: 700; font-size: 16px; }
.userbox { display: flex; align-items: center; gap: 12px; }

/* Layout */
.container { max-width: 1200px; margin: 20px auto; padding: 0 20px; }
.toolbar { display: flex; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.toolbar-left { flex: 1; max-width: 360px; }
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: auto; }

/* Table */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: #f0f3f7; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); position: sticky; top: 0; }
tbody tr:hover { background: #fafbfc; }
td.aktionen { white-space: nowrap; }
td.aktionen button { margin-right: 6px; padding: 5px 10px; font-size: 13px; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(20,30,40,.45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal-card { background: #fff; border-radius: 12px; width: 520px; max-width: 100%; max-height: 90vh; overflow: auto; padding: 24px; }
.modal-card.wide { width: 640px; }
.modal-card h2 { margin: 0 0 16px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid .full { grid-column: 1 / -1; }
.grid label { display: block; margin-bottom: 4px; font-weight: 600; font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* User modal */
.usertoolbar { display: flex; gap: 10px; margin-bottom: 10px; }
.usertable th, .usertable td { padding: 8px 10px; }

/* Messages / Toast */
.msg { margin-top: 12px; padding: 9px 12px; border-radius: 7px; font-size: 13px; }
.msg.error { background: #fbecea; color: var(--danger); border: 1px solid #f1c0ba; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ok); color: #fff; padding: 12px 20px; border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.2); z-index: 100; font-weight: 600;
}
.toast.error { background: var(--danger); }
