* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  background: #f4f6fa;
  color: #1f2430;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  background: #1e293b;
  color: #e2e8f0;
}
.topbar .brand { color: #fff; font-weight: 700; font-size: 18px; }
.topbar .nav-links { display: flex; gap: 16px; }
.topbar .nav-links a { color: #cbd5e1; }
.topbar .nav-links a:hover { color: #fff; text-decoration: none; }
.topbar .nav-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar .user-name { color: #cbd5e1; }

.badge {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.role-admin   { background: #dc2626; color: #fff; }
.role-manager { background: #f59e0b; color: #1f2430; }
.role-user    { background: #10b981; color: #fff; }

/* Layout */
.container {
  max-width: 980px;
  margin: 32px auto;
  padding: 0 20px;
}

h1 { margin-top: 0; }

.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  margin-bottom: 20px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat { text-align: center; padding: 24px 16px; margin: 0; }
.stat-number { font-size: 32px; font-weight: 700; color: #2563eb; }
.stat-label { color: #64748b; font-size: 14px; }

/* Forms */
label { display: block; margin-bottom: 14px; font-weight: 600; color: #334155; }
input[type=text], input[type=password], select, textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  font-weight: normal;
}
textarea { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
input:focus, textarea:focus, select:focus {
  outline: 2px solid #2563eb33;
  border-color: #2563eb;
}

.btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #1f2430;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #f1f5f9; text-decoration: none; }
.btn.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn.primary:hover { background: #1d4ed8; }
.btn.danger  { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.btn.danger:hover { background: #fecaca; }
.btn.small   { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.inline-form { display: inline-block; margin: 0 4px 0 0; }
.inline-form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline-form-row input, .inline-form-row select { width: auto; margin: 0; }

.actions-col { white-space: nowrap; }

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.data-table th, .data-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  font-size: 14px;
  vertical-align: middle;
}
.data-table th { background: #f8fafc; font-weight: 700; color: #475569; }
.data-table tr:last-child td { border-bottom: none; }

/* Flash */
.flash {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}
.flash-success { background: #dcfce7; color: #166534; }
.flash-error   { background: #fee2e2; color: #991b1b; }

/* Login */
.login-wrap { display: flex; justify-content: center; margin-top: 60px; }
.login-card { width: 100%; max-width: 420px; }
.login-card h1 { margin-bottom: 4px; }
.hint { margin-top: 20px; font-size: 14px; color: #475569; }
.hint pre { background: #f1f5f9; padding: 12px; border-radius: 8px; }

.muted { color: #64748b; font-size: 14px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-head h1 { margin: 0; }

/* Trainer */
.prompt-box {
  background: #f8fafc;
  border-radius: 10px;
  padding: 16px 20px;
  margin: 16px 0;
}
.prompt-box .label { font-size: 12px; text-transform: uppercase; color: #64748b; font-weight: 700; letter-spacing: .05em; }
.prompt-text { font-size: 22px; margin-top: 6px; font-weight: 600; }

.answer-label { font-size: 14px; }

.feedback {
  padding: 12px 14px;
  background: #eff6ff;
  border-left: 4px solid #2563eb;
  border-radius: 6px;
  margin-top: 16px;
  font-size: 15px;
  white-space: pre-line;
}
.score { margin-top: 12px; font-weight: 700; }
.failed-box { margin-top: 20px; padding-top: 16px; border-top: 1px solid #e2e8f0; font-size: 14px; }
#failed { margin-top: 6px; color: #15803d; white-space: pre-line; }

/* Ergebnis-Anzeige */
.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.pill-correct { background: #dcfce7; color: #166534; }
.pill-wrong   { background: #fee2e2; color: #991b1b; }
.pill-neutral { background: #e2e8f0; color: #334155; }

.row-correct td { background: #f0fdf4; }
.row-wrong   td { background: #fef2f2; }

.kv-table {
  border-collapse: collapse;
  width: 100%;
}
.kv-table th {
  text-align: left;
  padding: 6px 12px 6px 0;
  color: #475569;
  width: 140px;
  vertical-align: top;
}
.kv-table td { padding: 6px 0; }