/* EduPlan Server – Anmeldung & Verwaltung (ohne externe Abhängigkeiten) */
:root {
  --bg: #f1f5f9; --panel: #fff; --ink: #0f172a; --ink2: #334155; --mute: #64748b; --line: #e2e8f0; --line2: #cbd5e1;
  --brand: #ea580c; --brand-d: #c2410c; --brand-50: #fff7ed; --navy: #0f172a; --navy2: #1e293b;
  --ok: #059669; --ok-50: #ecfdf5; --warn: #d97706; --warn-50: #fffbeb; --bad: #dc2626; --bad-50: #fef2f2; --info: #2563eb; --info-50: #eff6ff;
  --r: 10px; --shadow: 0 1px 2px rgba(15,23,42,.06), 0 8px 24px -12px rgba(15,23,42,.18);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--brand-d); }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--mute); }
.small { font-size: 12px; }
.hidden { display: none !important; }

/* Marke */
.brand { display: flex; align-items: center; gap: .7rem; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, #dc2626, #f97316 55%, #fbbf24); display: grid; place-items: center; box-shadow: inset 0 -2px 6px rgba(0,0,0,.18); flex-shrink: 0; }
.brand-mark svg { width: 20px; height: 20px; fill: #fff; }
.brand-name { font-weight: 800; font-size: 16px; color: #fff; }
.brand-name em { font-style: normal; color: #fb923c; }
.brand-sub { font-size: 11px; color: #94a3b8; }

/* Formulare */
label.f { display: block; font-size: 12px; font-weight: 600; color: var(--ink2); margin-bottom: .3rem; }
.in, select.in, textarea.in { width: 100%; padding: .55rem .7rem; border: 1px solid var(--line2); border-radius: 8px; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
.in:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(234,88,12,.15); }
textarea.in { min-height: 70px; resize: vertical; }
.check { display: inline-flex; align-items: center; gap: .45rem; font-size: 13px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.hint { font-size: 11.5px; color: var(--mute); margin-top: .3rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .9rem 1rem; }
.span2 { grid-column: span 2; }
@media (max-width: 720px) { .grid2, .grid3 { grid-template-columns: 1fr; } .span2 { grid-column: auto; } }

.btn { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .9rem; border-radius: 8px; border: 1px solid var(--line2); background: #fff; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--ink2); }
.btn:hover { background: #f8fafc; border-color: #94a3b8; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-d); border-color: var(--brand-d); }
.btn-dark { background: var(--navy2); border-color: var(--navy2); color: #fff; }
.btn-dark:hover { background: var(--navy); }
.btn-danger { color: var(--bad); border-color: #fecaca; background: #fff; }
.btn-danger:hover { background: var(--bad-50); border-color: #fca5a5; }
.btn-sm { padding: .3rem .6rem; font-size: 12px; border-radius: 7px; }
.btn-icon { padding: .35rem .5rem; }
.btn svg { width: 15px; height: 15px; fill: currentColor; }

.alert { padding: .65rem .85rem; border-radius: 8px; font-size: 13px; border: 1px solid; margin-bottom: 1rem; }
.alert-bad { background: var(--bad-50); border-color: #fecaca; color: #991b1b; }
.alert-ok { background: var(--ok-50); border-color: #a7f3d0; color: #065f46; }
.alert-warn { background: var(--warn-50); border-color: #fcd34d; color: #92400e; }
.alert-info { background: var(--info-50); border-color: #bfdbfe; color: #1e40af; }

/* ---------------- Anmeldung ---------------- */
.login-page { min-height: 100%; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-side { background: radial-gradient(1200px 600px at -10% 110%, rgba(234,88,12,.35), transparent 60%), linear-gradient(160deg, #0f172a, #1e293b); color: #e2e8f0; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.login-side h1 { font-size: 30px; color: #fff; line-height: 1.15; margin-top: 3rem; max-width: 460px; }
.login-side p { color: #94a3b8; max-width: 440px; }
.login-feats { list-style: none; padding: 0; margin: 1.6rem 0 0; display: grid; gap: .7rem; }
.login-feats li { display: flex; gap: .6rem; align-items: flex-start; font-size: 13.5px; color: #cbd5e1; }
.login-feats li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fb923c; margin-top: .45rem; flex-shrink: 0; }
.login-main { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 22px; margin-bottom: .25rem; }
.login-card .sub { color: var(--mute); margin-bottom: 1.6rem; }
.login-card .field { margin-bottom: 1rem; }
.login-card .btn-primary { width: 100%; justify-content: center; padding: .7rem; font-size: 14px; }
@media (max-width: 860px) { .login-page { grid-template-columns: 1fr; } .login-side { display: none; } }

/* ---------------- Verwaltung ---------------- */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100%; }
.side { background: var(--navy); color: #cbd5e1; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-top { padding: 1.1rem 1.1rem 1rem; border-bottom: 1px solid #1e293b; }
.side nav { padding: .7rem .6rem; display: grid; gap: 2px; overflow-y: auto; }
.side nav .grp { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #64748b; padding: .9rem .6rem .3rem; font-weight: 700; }
.side nav a { display: flex; align-items: center; gap: .65rem; padding: .55rem .7rem; border-radius: 8px; color: #cbd5e1; text-decoration: none; font-size: 13.5px; font-weight: 500; }
.side nav a:hover { background: #1e293b; color: #fff; }
.side nav a.active { background: rgba(234,88,12,.16); color: #fff; box-shadow: inset 3px 0 0 #f97316; }
.side nav a svg { width: 16px; height: 16px; fill: currentColor; opacity: .8; flex-shrink: 0; }
.side-foot { margin-top: auto; padding: .9rem 1.1rem; border-top: 1px solid #1e293b; font-size: 12px; }
.side-foot b { color: #fff; display: block; font-size: 13px; }
.side-foot .row { display: flex; gap: .4rem; margin-top: .6rem; }
.side-foot .btn { background: #1e293b; border-color: #334155; color: #e2e8f0; }
.side-foot .btn:hover { background: #334155; }
@media (max-width: 900px) { .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; } .side nav { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } .side nav .grp { display: none; } }

main { padding: 1.6rem 2rem 3rem; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head p { margin: .2rem 0 0; color: var(--mute); }
.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 1.2rem; }
.card-h { padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.card-h h3 { font-size: 14.5px; }
.card-b { padding: 1.1rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .9rem; margin-bottom: 1.2rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; box-shadow: var(--shadow); }
.stat .v { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.stat .l { font-size: 12px; color: var(--mute); }

table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--mute); font-weight: 700; padding: .6rem .8rem; border-bottom: 1px solid var(--line); background: #f8fafc; position: sticky; top: 0; z-index: 1; }
table.t td { padding: .6rem .8rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
table.t tr:hover td { background: #fafafa; }
table.t td.actions { white-space: nowrap; text-align: right; }
.table-wrap { overflow: auto; max-height: calc(100vh - 260px); }
.empty { padding: 2rem; text-align: center; color: var(--mute); }

.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .5rem; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: #f1f5f9; color: var(--ink2); border: 1px solid var(--line); margin: 1px 3px 1px 0; white-space: nowrap; }
.chip-brand { background: var(--brand-50); border-color: #fed7aa; color: #9a3412; }
.chip-ok { background: var(--ok-50); border-color: #a7f3d0; color: #065f46; }
.chip-bad { background: var(--bad-50); border-color: #fecaca; color: #991b1b; }
.chip-warn { background: var(--warn-50); border-color: #fde68a; color: #92400e; }
.chip-info { background: var(--info-50); border-color: #bfdbfe; color: #1e40af; }
.chip small { font-weight: 500; opacity: .8; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: .35rem; }

/* Rollen */
.roles-layout { display: grid; grid-template-columns: 260px 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 860px) { .roles-layout { grid-template-columns: 1fr; } }
.role-list { padding: .4rem; }
.role-item { display: block; width: 100%; text-align: left; padding: .65rem .75rem; border-radius: 9px; border: 1px solid transparent; background: none; cursor: pointer; margin-bottom: 2px; }
.role-item:hover { background: #f8fafc; }
.role-item.active { background: var(--brand-50); border-color: #fed7aa; }
.role-item b { display: block; font-size: 13.5px; }
.role-item small { color: var(--mute); font-size: 11.5px; }
table.matrix { border-collapse: collapse; width: 100%; font-size: 13px; }
table.matrix th, table.matrix td { padding: .45rem .55rem; border-bottom: 1px solid #f1f5f9; }
table.matrix th:first-child { text-align: left; }
table.matrix th { font-size: 11px; text-transform: uppercase; color: var(--mute); letter-spacing: .04em; background: #f8fafc; }
table.matrix td.c, table.matrix th.c { text-align: center; width: 84px; }
table.matrix input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; }
table.matrix tr:hover td { background: #fffaf5; }
table.matrix .mod { font-weight: 600; }
.cell-all { color: var(--ok); font-weight: 700; }
.cell-some { color: var(--warn); font-size: 11.5px; font-weight: 600; }
.cell-none { color: #cbd5e1; }
.spec-grp { margin-top: 1.1rem; }
.spec-grp h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--mute); margin-bottom: .5rem; }
.spec-list { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem 1.2rem; }
@media (max-width: 900px) { .spec-list { grid-template-columns: 1fr; } }
.compare { overflow: auto; }
.compare table { border-collapse: collapse; font-size: 12px; }
.compare th, .compare td { padding: .35rem .5rem; border: 1px solid #f1f5f9; text-align: center; white-space: nowrap; }
.compare th.rl { writing-mode: vertical-rl; transform: rotate(180deg); text-align: left; height: 150px; font-weight: 600; }
.compare td.l { text-align: left; font-weight: 500; }

/* Dialog */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(760px, 96vw); box-shadow: 0 30px 80px -20px rgba(15,23,42,.55); max-height: 92vh; }
dialog::backdrop { background: rgba(15,23,42,.55); backdrop-filter: blur(2px); }
.dlg-h { padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: #fff; z-index: 2; }
.dlg-h h3 { font-size: 16px; }
.dlg-b { padding: 1.2rem 1.25rem; overflow-y: auto; }
.dlg-f { padding: .85rem 1.25rem; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: .5rem; background: #f8fafc; position: sticky; bottom: 0; }
.x { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--mute); }
.assign { border: 1px solid var(--line); border-radius: 10px; padding: .75rem; margin-bottom: .6rem; background: #fcfcfd; }
.assign-row { display: grid; grid-template-columns: 1.2fr 1.3fr auto; gap: .6rem; align-items: center; }
.course-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .3rem .9rem; margin-top: .6rem; padding-top: .6rem; border-top: 1px dashed var(--line2); }
.pw-box { font-family: ui-monospace, Consolas, monospace; font-size: 18px; letter-spacing: .04em; background: #0f172a; color: #fbbf24; padding: .8rem 1rem; border-radius: 10px; text-align: center; user-select: all; }
.sep { height: 1px; background: var(--line); margin: 1.1rem 0; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--mute); font-weight: 700; margin: 0 0 .6rem; }

.toast-host { position: fixed; right: 18px; bottom: 18px; display: grid; gap: .5rem; z-index: 9999; }
.toast { padding: .65rem .9rem; border-radius: 9px; background: var(--navy2); color: #fff; font-size: 13px; box-shadow: 0 12px 30px -10px rgba(0,0,0,.4); max-width: 420px; animation: tin .2s ease-out; }
.toast.bad { background: #991b1b; } .toast.ok { background: #065f46; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
.pager { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1rem; font-size: 12.5px; color: var(--mute); }

/* Eingebettet in die Anwendung (Seitenleiste der App übernimmt die Navigation) */
body.embed .shell { display: block; }
body.embed .side { display: none; }
body.embed main { padding: 1rem 1.25rem 2rem; }
body.embed .table-wrap { max-height: calc(100vh - 230px); }

@media (max-width: 700px) {
  main { padding: 1rem .75rem 2rem; }
  .page-head h1 { font-size: 19px; }
  .card-h, .card-b { padding: .75rem; }
  .toolbar .in { width: 100% !important; }
  table.t th, table.t td { padding: .5rem .55rem; }
  dialog { width: 100vw !important; max-width: 100vw; max-height: 100vh; height: 100%; border-radius: 0; margin: 0; }
  .in, select.in, textarea.in { font-size: 16px; }
  .assign-row { grid-template-columns: 1fr; }
}
