:root {
  --bg: #f5f6f8; --panel: #fff; --ink: #1d2530; --muted: #6b7280;
  --line: #e6e8ec; --brand: #4f46e5; --brand-2: #6366f1;
  --green: #16a34a; --amber: #d97706; --red: #dc2626; --blue: #2563eb;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar { width: 230px; background: #0f172a; color: #cbd5e1; padding: 18px 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { font-size: 20px; font-weight: 800; color: #fff; padding: 0 20px 14px; }
.brand span { color: var(--brand-2); }
.sidebar nav { display: flex; flex-direction: column; flex: 1; }
.sidebar nav a { color: #cbd5e1; text-decoration: none; padding: 9px 20px; font-size: 14px; }
.sidebar nav a:hover { background: #1e293b; color: #fff; }
.sidebar nav a.active { background: var(--brand); color: #fff; border-left: 3px solid #fff; }
.navgroup { color: #64748b; font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  padding: 14px 20px 4px; margin: 0; }
.navgroup small { color: var(--brand-2); }
.syncform { padding: 14px 16px 0; }
.syncform button { width: 100%; background: var(--brand); color: #fff; border: 0;
  padding: 10px; border-radius: 8px; font-weight: 600; cursor: pointer; }
.syncform button:hover { background: var(--brand-2); }

/* Content */
.content { flex: 1; padding: 28px 36px; max-width: 1100px; }
h1 { margin: 0 0 4px; font-size: 26px; }
h3 { margin: 22px 0 10px; }
.muted { color: var(--muted); }
.back { color: var(--brand); text-decoration: none; font-size: 14px; }
.badge { background: #eef2ff; color: var(--brand); font-size: 12px; padding: 2px 8px;
  border-radius: 20px; vertical-align: middle; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash.ok { background: #dcfce7; color: #166534; }
.flash.err { background: #fee2e2; color: #991b1b; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 14px; margin: 18px 0; }
.card { background: var(--panel); border: 1px solid #e5e7eb; border-radius: 12px; padding: 18px;
  text-decoration: none; color: var(--ink); transition: .15s; }
.card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.08); transform: translateY(-2px); }
.card .num { font-size: 32px; font-weight: 800; color: var(--brand); }
.card .lbl { color: var(--muted); font-size: 14px; }
.empty { background: var(--panel); border: 1px dashed #cbd5e1; border-radius: 12px; padding: 24px; margin-top: 18px; }

/* Tables */
table.data { width: 100%; border-collapse: collapse; background: var(--panel);
  border-radius: 12px; overflow: hidden; border: 1px solid #e5e7eb; }
table.data th { text-align: left; font-size: 12px; text-transform: uppercase; color: var(--muted);
  background: #f9fafb; padding: 10px 14px; }
table.data td { padding: 11px 14px; border-top: 1px solid #f0f1f4; font-size: 14px; }
table.data a { color: var(--ink); text-decoration: none; }
table.data a:hover { color: var(--brand); }

.pill { font-size: 12px; padding: 2px 9px; border-radius: 20px; font-weight: 600; }
.pill.green { background: #dcfce7; color: #166534; }
.pill.amber { background: #fef3c7; color: #92400e; }
.pill.red { background: #fee2e2; color: #991b1b; }
.pill.gray { background: #e5e7eb; color: #374151; }
.pill.blue { background: #dbeafe; color: #1e40af; }

.search, .filterbar { margin: 14px 0; display: flex; gap: 8px; }
.search input { flex: 1; padding: 9px 12px; border: 1px solid #d1d5db; border-radius: 8px; }
.search button, .grid2 button, .inline button { background: var(--brand); color: #fff; border: 0;
  padding: 9px 16px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.filterbar a { padding: 6px 12px; border-radius: 20px; text-decoration: none; color: var(--muted);
  background: var(--panel); border: 1px solid #e5e7eb; font-size: 14px; }
.filterbar a.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Profile */
.profile { display: flex; gap: 16px; align-items: center; margin: 14px 0; }
.avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 24px; font-weight: 700; }
img.avatar { object-fit: cover; }
.pavatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; vertical-align: middle;
  margin-right: 8px; background: #eef2ff; }
.pavatar.fallback { display: inline-grid; place-items: center; color: var(--brand);
  font-size: 11px; font-weight: 700; }
.orgcard .pavatar { width: 22px; height: 22px; }
.detailgrid { display: grid; grid-template-columns: repeat(auto-fill,minmax(200px,1fr)); gap: 12px; margin: 12px 0; }
.field { background: var(--panel); border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px; }
.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.reports { list-style: none; padding: 0; }
.reports li { background: var(--panel); border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px 14px; margin-bottom: 6px; }

/* Firmen-Avatare */
.cavatar { width: 28px; height: 28px; border-radius: 6px; object-fit: cover;
  vertical-align: middle; margin-right: 8px; background: #fff; border: 1px solid #e5e7eb; }
.cavatar.fallback { display: inline-grid; place-items: center; color: #fff; font-weight: 700;
  font-size: 14px; border: 0; }
.companyhead .cavatar { width: 32px; height: 32px; }

/* Org-Chart interaktiv */
.orgtoolbar { display: flex; gap: 10px; margin: 12px 0 18px; }
.orgcompany { margin-bottom: 24px; }
.companyhead { background: var(--panel); border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 12px 16px; margin-bottom: 8px; font-size: 16px; }
.companyhead.dragover { background: #eef2ff; outline: 2px dashed var(--brand); }
.orgcard { cursor: grab; }
.orgcard .drag { color: #cbd5e1; margin-right: 6px; cursor: grab; }
.orgcard.dragging { opacity: .45; }
.orgcard.dragover { outline: 2px dashed var(--brand); background: #eef2ff; }

/* Org tree */
.orgtree, .orgtree ul { list-style: none; padding-left: 22px; }
.orgtree { padding-left: 0; }
.orgcard { display: inline-flex; flex-direction: column; background: var(--panel);
  border: 1px solid #e5e7eb; border-left: 3px solid var(--brand); border-radius: 8px;
  padding: 8px 14px; margin: 5px 0; }
.orgcard a { text-decoration: none; color: var(--ink); }
.orgcard .muted { font-size: 12px; }

/* Goals */
.goaltree, .goaltree ul, .goalchildren { list-style: none; padding-left: 24px; }
.goaltree { padding-left: 0; }
.goalcard { background: var(--panel); border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 14px; margin: 8px 0; }
.goalhead { display: flex; justify-content: space-between; align-items: center; }
.progress { height: 8px; background: #eef0f3; border-radius: 6px; margin: 8px 0; overflow: hidden; }
.progress .bar { height: 100%; background: linear-gradient(90deg,var(--brand),var(--brand-2)); }
.goalmeta { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.goalcard form.inline { margin-top: 10px; display: flex; gap: 8px; }
.goalcard form.inline input { width: 90px; }

/* Forms */
.newform { background: var(--panel); border: 1px solid #e5e7eb; border-radius: 10px; padding: 8px 14px; margin: 12px 0; }
.newform summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 0; }
.grid2 label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); gap: 4px; }
.grid2 .full { grid-column: 1 / -1; }
.grid2 input, .grid2 select, .grid2 textarea, .inline input, .inline select {
  padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; color: var(--ink); }

.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.cyclelist, .feedlist { list-style: none; padding: 0; }
.cyclelist li, .feedlist li { background: var(--panel); border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 10px 14px; margin-bottom: 8px; }
.feedlist li { display: flex; gap: 10px; }
.feedlist .kind { font-size: 20px; }
.feedlist p { margin: 4px 0 0; }

/* Surveys */
.surveyform { max-width: 640px; }
.qcard { background: var(--panel); border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px 16px; margin: 10px 0; }
.qtext { font-weight: 600; margin: 0 0 10px; }
.qcard label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.qcard select, .qcard textarea { padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px; font: inherit; }
.scale { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.scale label { display: inline-flex; flex-direction: column; align-items: center; cursor: pointer; color: var(--ink); }
.scale input { margin: 0 0 2px; }
.scale span { font-size: 13px; }
.scalehint { color: var(--muted); font-size: 12px; margin-left: 8px; }
.bigbtn { background: var(--brand); color: #fff; border: 0; padding: 12px 22px; border-radius: 10px;
  font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; display: inline-block; }
.bigbtn:hover { background: var(--brand-2); }
.bigbtn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.bigbtn:disabled { opacity: .5; cursor: not-allowed; }
.actionsrow { display: flex; gap: 12px; align-items: center; margin: 16px 0; flex-wrap: wrap; }
.npsbar { display: flex; height: 34px; border-radius: 8px; overflow: hidden; margin: 8px 0 4px; font-size: 12px; }
.npsbar .seg { display: flex; align-items: center; justify-content: center; color: #fff; white-space: nowrap; overflow: hidden; }
.npsbar .det { background: #dc2626; } .npsbar .pas { background: #9ca3af; } .npsbar .pro { background: #16a34a; }
.minibar { display: inline-block; width: 120px; height: 7px; background: #eef0f3; border-radius: 5px; vertical-align: middle; margin-right: 6px; overflow: hidden; }
.minibar .bar { height: 100%; background: linear-gradient(90deg,var(--brand),var(--brand-2)); }

/* Review-Zyklus */
.subjcard { background: var(--panel); border: 1px solid #e5e7eb; border-radius: 12px; padding: 16px; margin: 14px 0; }
.subjhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.subjmeta { display: flex; gap: 8px; align-items: center; }

/* Edit-Sperre */
.lockbar { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px;
  padding: 8px 12px; margin: 12px 0; font-size: 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.lockbar button { background: #fff; border: 1px solid #d1d5db; border-radius: 6px;
  padding: 4px 10px; cursor: pointer; font-size: 13px; }

/* Verwaltung / Aktionen */
.dangerbtn { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; border-radius: 8px;
  padding: 9px 16px; cursor: pointer; font-weight: 600; }
.dangerbtn:hover { background: #fecaca; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; margin-right: 4px; }
.inlineedit { display: inline-block; }
.inlineedit summary { cursor: pointer; list-style: none; }
.inlineedit[open] { position: relative; }
.inlineedit[open] form { position: absolute; z-index: 5; background: #fff; border: 1px solid #e5e7eb;
  border-radius: 8px; padding: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.12); width: 260px; }

/* Benutzerverwaltung */
.useractions { display: flex; gap: 4px; }
.useractions button { background: #f1f3f5; border: 1px solid #e5e7eb; border-radius: 6px;
  cursor: pointer; font-size: 14px; padding: 3px 7px; }
.useractions button:hover { background: #e5e7eb; }
td .inline select { padding: 4px 6px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 12px; margin-right: 4px; }

/* Login */
.loginbody { display: grid; place-items: center; min-height: 100vh; background: linear-gradient(135deg,#eef2ff,#faf5ff); }
.logincard { background: #fff; border: 1px solid #e5e7eb; border-radius: 16px; padding: 32px;
  width: 340px; box-shadow: 0 10px 40px rgba(0,0,0,.08); }
.logincard form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.logincard label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.logincard input { padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 15px; }

/* User-Box in Sidebar */
.userbox { padding: 12px 16px 4px; border-top: 1px solid #1e293b; margin-top: 8px; }
.userbox a { color: #cbd5e1; text-decoration: none; font-size: 13px; display: block; padding: 4px 0; word-break: break-all; }
.userbox a:hover { color: #fff; }
.rolechip { display: inline-block; background: var(--brand); color: #fff; font-size: 11px;
  padding: 2px 8px; border-radius: 20px; margin: 4px 0; }
.userbox .logout { color: #f87171; margin-top: 6px; }
.userbox .syncform { padding: 8px 0 4px; }

/* Learning */
.coursegrid { display: grid; grid-template-columns: repeat(auto-fill,minmax(260px,1fr)); gap: 14px; margin-top: 14px; }
.coursecard { background: var(--panel); border: 1px solid #e5e7eb; border-radius: 12px; padding: 16px;
  text-decoration: none; color: var(--ink); transition: .15s; }
.coursecard:hover { box-shadow: 0 6px 20px rgba(0,0,0,.08); transform: translateY(-2px); }
.coursecard h3 { margin: 6px 0; }
.ccat { font-size: 12px; color: var(--brand); text-transform: uppercase; letter-spacing: .4px; }
.cfoot { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin-top: 10px; }
.lessonlist, .enrolllist { padding-left: 18px; }
.enrolllist { list-style: none; padding: 0; }
.enrolllist li { background: var(--panel); border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.enrolllist .progress { margin: 6px 0; }
.lessonprogress { list-style: none; padding: 0; margin-top: 14px; }
.lessonprogress li { display: flex; gap: 12px; align-items: flex-start; background: var(--panel);
  border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; }
.lessonprogress li.done { background: #f0fdf4; border-color: #bbf7d0; }
.lessonprogress li p { margin: 3px 0 0; }
.check { background: none; border: 0; font-size: 22px; cursor: pointer; line-height: 1; padding: 0; }

/* KI-Box */
.aibox { background: linear-gradient(135deg,#eef2ff,#faf5ff); border: 1px solid #ddd6fe;
  border-radius: 12px; padding: 16px 18px; margin: 16px 0 24px; }
.aibox h3 { margin-top: 4px; }
.aidraft { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px; margin-top: 12px; }
.aisummary { white-space: pre-wrap; font-family: inherit; font-size: 14px; line-height: 1.5; margin: 6px 0 0; }
.summbtn { display: inline; }
.summbtn button { background: #ede9fe; color: #5b21b6; border: 0; border-radius: 6px;
  font-size: 11px; padding: 2px 7px; cursor: pointer; }
.summbtn button:disabled { opacity: .4; cursor: not-allowed; }
button:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 800px) {
  .twocol, .grid2 { grid-template-columns: 1fr; }
  .sidebar { width: 64px; } .brand span, .navgroup, .sidebar nav a span { display: none; }
}
