/* ==========================================================================
   Berufsschule – Stylesheet
   Aufbau: 1 Tokens · 2 Grundlagen · 3 Kopfzeile · 4 Bausteine
           5 Statistik · 6 Ordner · 7 Dateien · 8 Betrachter
           9 Dialoge/Hinweise · 10 Login/Freigabe · 11 Responsiv
   ========================================================================== */

/* ---------- 1 Tokens ---------- */
:root {
  --bg:            #f5f6f9;
  --bg-soft:       #eef0f5;
  --surface:       #ffffff;
  --surface-2:     #f4f6fa;
  --surface-3:     #eaedf3;
  --border:        #e2e6ee;
  --border-strong: #cfd5e2;
  --text:          #111624;
  --text-soft:     #414a5c;
  --muted:         #6b7488;
  --accent:        #3b6cf0;
  --accent-soft:   rgba(59, 108, 240, .10);
  --accent-text:   #2b55c9;
  --danger:        #d93a3a;
  --danger-soft:   rgba(217, 58, 58, .10);
  --success:       #1f9d55;
  --warning:       #c77700;

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(16, 22, 36, .06);
  --shadow:    0 6px 24px -12px rgba(16, 22, 36, .22);
  --shadow-lg: 0 24px 60px -24px rgba(16, 22, 36, .38);
  --ring:      0 0 0 3px rgba(59, 108, 240, .22);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --c-blau:    #3b6cf0;
  --c-gruen:   #1f9d55;
  --c-gelb:    #d99b00;
  --c-rot:     #d93a3a;
  --c-lila:    #7c4dd8;
  --c-tuerkis: #0e9a9a;
  --c-pink:    #d13f8c;
  --c-grau:    #6b7488;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #0d1017;
    --bg-soft:       #11151d;
    --surface:       #151a23;
    --surface-2:     #1b212c;
    --surface-3:     #222936;
    --border:        #262e3c;
    --border-strong: #38424f;
    --text:          #e9edf5;
    --text-soft:     #c2cad8;
    --muted:         #8b95a8;
    --accent:        #5f8bff;
    --accent-soft:   rgba(95, 139, 255, .14);
    --accent-text:   #9db6ff;
    --danger:        #ff6b6b;
    --danger-soft:   rgba(255, 107, 107, .14);
    --success:       #3ecf8e;
    --warning:       #ffb020;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow:    0 8px 28px -14px rgba(0, 0, 0, .7);
    --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, .85);
    --ring:      0 0 0 3px rgba(95, 139, 255, .28);
    --c-blau:    #5f8bff;
    --c-gruen:   #3ecf8e;
    --c-gelb:    #ffb020;
    --c-rot:     #ff6b6b;
    --c-lila:    #a582ff;
    --c-tuerkis: #2fc7c7;
    --c-pink:    #ff74b8;
    --c-grau:    #8b95a8;
  }
}

:root[data-theme="dark"] {
  --bg:            #0d1017;
  --bg-soft:       #11151d;
  --surface:       #151a23;
  --surface-2:     #1b212c;
  --surface-3:     #222936;
  --border:        #262e3c;
  --border-strong: #38424f;
  --text:          #e9edf5;
  --text-soft:     #c2cad8;
  --muted:         #8b95a8;
  --accent:        #5f8bff;
  --accent-soft:   rgba(95, 139, 255, .14);
  --accent-text:   #9db6ff;
  --danger:        #ff6b6b;
  --danger-soft:   rgba(255, 107, 107, .14);
  --success:       #3ecf8e;
  --warning:       #ffb020;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow:    0 8px 28px -14px rgba(0, 0, 0, .7);
  --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, .85);
  --ring:      0 0 0 3px rgba(95, 139, 255, .28);
  --c-blau:    #5f8bff;
  --c-gruen:   #3ecf8e;
  --c-gelb:    #ffb020;
  --c-rot:     #ff6b6b;
  --c-lila:    #a582ff;
  --c-tuerkis: #2fc7c7;
  --c-pink:    #ff74b8;
  --c-grau:    #8b95a8;
}

[data-color="blau"]    { --folder: var(--c-blau); }
[data-color="gruen"]   { --folder: var(--c-gruen); }
[data-color="gelb"]    { --folder: var(--c-gelb); }
[data-color="rot"]     { --folder: var(--c-rot); }
[data-color="lila"]    { --folder: var(--c-lila); }
[data-color="tuerkis"] { --folder: var(--c-tuerkis); }
[data-color="pink"]    { --folder: var(--c-pink); }
[data-color="grau"]    { --folder: var(--c-grau); }

/* ---------- 2 Grundlagen ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -.015em; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.1rem; }
p  { margin: 0 0 .8em; }

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--surface); padding: .7rem 1rem; border-radius: var(--radius);
}
.skip-link:focus { left: 1rem; top: 1rem; }

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3rem;
}

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.tabnum { font-variant-numeric: tabular-nums; }

/* ---------- 3 Kopfzeile ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem 1.25rem;
}
.brand { display: flex; align-items: center; gap: .65rem; color: var(--text); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--c-lila)));
  color: #fff; font-size: 1rem;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: .98rem; letter-spacing: -.01em; }
.brand-text small { color: var(--muted); font-size: .72rem; }

.search {
  position: relative; flex: 1; max-width: 460px; margin-inline: auto;
  display: flex; align-items: center;
}
.search i {
  position: absolute; left: .85rem; color: var(--muted); font-size: .85rem; pointer-events: none;
}
.search input {
  width: 100%; padding: .58rem 2.6rem .58rem 2.3rem;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-2); color: var(--text); font: inherit; font-size: .88rem;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; box-shadow: var(--ring); border-color: var(--accent); background: var(--surface); }
.search kbd {
  position: absolute; right: .6rem; color: var(--muted);
  font-family: var(--mono); font-size: .7rem;
  border: 1px solid var(--border-strong); border-radius: 5px; padding: 0 .35rem;
}

.topbar-actions { display: flex; align-items: center; gap: .25rem; margin-left: auto; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  display: inline-grid; place-items: center;
  border: 1px solid transparent; background: transparent;
  color: var(--text-soft); cursor: pointer; font-size: .95rem;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); text-decoration: none; }
.icon-btn.danger-hover:hover { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* ---------- 4 Bausteine ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.section { margin-top: 2rem; }
.section-head {
  display: flex; align-items: center; gap: .75rem; margin-bottom: .9rem; flex-wrap: wrap;
}
.section-head h2 { display: flex; align-items: center; gap: .5rem; }
.section-head h2 i { color: var(--muted); font-size: .85em; }
.section-head .spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .55rem .95rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-size: .875rem; font-weight: 550;
  cursor: pointer; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, transform .06s ease;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn i { font-size: .9em; }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: .35rem .6rem; font-size: .8rem; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .2rem .6rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: .75rem; color: var(--muted); white-space: nowrap;
}
.chip i { font-size: .8em; }
.chip-accent { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.chip-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.chip-warn   { background: color-mix(in srgb, var(--warning) 14%, transparent); border-color: transparent; color: var(--warning); }
.chip-live   { color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, var(--border)); background: transparent; }
.chip-live .pulse {
  width: 7px; height: 7px; border-radius: 50%; background: var(--success);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.75); } }

.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .9rem; }
.field label { font-size: .8rem; font-weight: 600; color: var(--text-soft); }
.field .hint { font-size: .74rem; color: var(--muted); }
input[type="text"], input[type="password"], input[type="date"], input[type="number"], select, textarea {
  width: 100%; padding: .55rem .7rem;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--text); font: inherit; font-size: .875rem;
}
input:focus, select:focus, textarea:focus { outline: none; box-shadow: var(--ring); border-color: var(--accent); background: var(--surface); }
textarea { resize: vertical; min-height: 120px; font-family: var(--mono); font-size: .85rem; line-height: 1.6; }

.switch-row { display: flex; align-items: center; gap: .6rem; font-size: .85rem; }
.switch-row input[type="checkbox"] { width: auto; accent-color: var(--accent); }

.empty {
  text-align: center; padding: 2.5rem 1rem; color: var(--muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
}
.empty i { font-size: 1.7rem; opacity: .5; display: block; margin-bottom: .6rem; }
.empty p { margin: .2rem 0 1rem; }

.breadcrumb {
  display: flex; align-items: center; gap: .35rem; flex-wrap: wrap;
  font-size: .85rem; color: var(--muted); margin-bottom: .35rem;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .sep { opacity: .5; font-size: .7rem; }
.breadcrumb .current { color: var(--text); font-weight: 600; }

/* ---------- 5 Statistik ---------- */
.stats-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.stat {
  position: relative; overflow: hidden;
  padding: 1.05rem 1.15rem 1.15rem;
}
.stat-head {
  display: flex; align-items: center; gap: .55rem;
  font-size: .78rem; font-weight: 600; letter-spacing: .02em;
  text-transform: uppercase; color: var(--muted);
}
.stat-head i { color: var(--stat-color, var(--accent)); font-size: .95rem; }
.stat-value {
  display: flex; align-items: baseline; gap: .35rem; flex-wrap: wrap;
  margin-top: .55rem; font-size: 1.85rem; font-weight: 660;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.stat-value .unit { font-size: .95rem; font-weight: 550; color: var(--muted); }
.stat-sub {
  font-size: .8rem; color: var(--muted); margin-top: .15rem;
  font-variant-numeric: tabular-nums; min-height: 1.25rem;
}
.stat-foot {
  display: flex; justify-content: space-between; gap: .5rem;
  margin-top: .7rem; font-size: .74rem; color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.bar {
  height: 7px; border-radius: 999px; background: var(--surface-3);
  overflow: hidden; margin-top: .85rem;
}
.bar span {
  display: block; height: 100%; border-radius: 999px;
  background: var(--stat-color, var(--accent));
  width: 0; transition: width .55s cubic-bezier(.22, .8, .28, 1), background .3s ease;
}
.stat[data-level="warn"] { --stat-color: var(--warning); }
.stat[data-level="high"] { --stat-color: var(--danger); }

.server-meta {
  display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem;
}

/* ---------- 6 Ordner ---------- */
.folder-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.folder-card {
  position: relative; display: flex; flex-direction: column; gap: .55rem;
  padding: 1rem 1.05rem 1.05rem; overflow: hidden;
  transition: transform .12s ease, box-shadow .18s ease, border-color .18s ease;
}
.folder-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 4px;
  background: var(--folder, var(--accent));
}
.folder-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.folder-top { display: flex; align-items: flex-start; gap: .75rem; }
.folder-icon {
  width: 40px; height: 40px; flex: none; border-radius: 11px;
  display: grid; place-items: center; font-size: 1.05rem;
  color: var(--folder, var(--accent));
  background: color-mix(in srgb, var(--folder, var(--accent)) 13%, transparent);
}
.folder-name {
  font-weight: 620; letter-spacing: -.01em; color: var(--text);
  display: block; overflow-wrap: anywhere;
}
.folder-name:hover { text-decoration: none; color: var(--accent-text); }
.folder-note { font-size: .78rem; color: var(--muted); overflow-wrap: anywhere; }
.folder-meta { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: auto; padding-top: .35rem; }
.folder-actions { display: flex; gap: .15rem; margin-left: auto; }
.pin-flag { color: var(--folder, var(--accent)); font-size: .75rem; }

.deadline-list { display: flex; flex-direction: column; }
.deadline-row {
  display: flex; align-items: center; gap: .8rem;
  padding: .7rem 1.05rem; border-bottom: 1px solid var(--border);
}
.deadline-row:last-child { border-bottom: none; }
.deadline-row .dot {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: var(--folder, var(--accent));
}
.deadline-row .name { font-weight: 570; }
.deadline-row .when { margin-left: auto; font-size: .8rem; color: var(--muted); text-align: right; }
.deadline-row.overdue .when { color: var(--danger); font-weight: 600; }
.deadline-row.soon .when { color: var(--warning); font-weight: 600; }

/* ---------- 7 Dateien ---------- */
.dropzone {
  position: relative; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg);
  padding: 1.6rem 1rem; text-align: center; color: var(--muted);
  background: var(--surface); transition: border-color .15s ease, background .15s ease;
}
.dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.dropzone i.big { font-size: 1.5rem; display: block; margin-bottom: .5rem; opacity: .7; }
.dropzone strong { color: var(--text); }

.upload-list { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; }
.upload-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .8rem; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); font-size: .84rem;
}
.upload-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item .state { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.upload-item.done .state { color: var(--success); }
.upload-item.failed .state { color: var(--danger); }
.upload-item .mini-bar { width: 90px; height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.upload-item .mini-bar span { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s ease; }

.file-table { width: 100%; border-collapse: collapse; }
.file-table thead th {
  text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 600; padding: .6rem 1rem; border-bottom: 1px solid var(--border);
}
.file-table tbody tr { border-bottom: 1px solid var(--border); }
.file-table tbody tr:last-child { border-bottom: none; }
.file-table tbody tr:hover { background: var(--surface-2); }
.file-table td { padding: .6rem 1rem; vertical-align: middle; }
.file-table td.right { text-align: right; white-space: nowrap; }
.file-cell { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.file-cell i.type { font-size: 1.05rem; color: var(--muted); width: 1.3rem; text-align: center; }
.file-cell i.type.pdf { color: var(--c-rot); }
.file-cell i.type.markdown, .file-cell i.type.text { color: var(--c-blau); }
.file-cell i.type.image { color: var(--c-lila); }
.file-cell i.type.code { color: var(--c-tuerkis); }
.file-cell i.type.archive { color: var(--c-gelb); }
.file-cell i.type.folder { color: var(--folder, var(--accent)); }
.file-cell .name { font-weight: 550; color: var(--text); overflow-wrap: anywhere; }
.file-cell .name:hover { color: var(--accent-text); text-decoration: none; }
.file-cell .sub { font-size: .74rem; color: var(--muted); }
.row-actions { display: flex; gap: .1rem; justify-content: flex-end; }

.toolbar {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  margin-bottom: 1rem;
}
.toolbar .spacer { flex: 1; }

/* ---------- 8 Betrachter ---------- */
.viewer-head {
  display: flex; align-items: center; gap: .9rem; flex-wrap: wrap;
  padding: 1rem 1.15rem; border-bottom: 1px solid var(--border);
}
.viewer-head .title { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.viewer-head .title i { font-size: 1.2rem; color: var(--muted); }
.viewer-head h1 { font-size: 1.05rem; overflow-wrap: anywhere; }
.viewer-head .actions { display: flex; gap: .4rem; margin-left: auto; flex-wrap: wrap; }
.viewer-body { padding: 1.4rem 1.6rem 2rem; }
.viewer-frame { width: 100%; height: min(78vh, 900px); border: none; display: block; background: var(--surface-2); }
.viewer-image { display: grid; place-items: center; padding: 1.5rem; background: var(--surface-2); }
.viewer-image img { max-width: 100%; max-height: 76vh; border-radius: var(--radius); box-shadow: var(--shadow); }

.toc {
  float: right; width: 220px; margin: 0 0 1rem 1.5rem; padding: .85rem 1rem;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .82rem;
}
.toc strong { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: .5rem; }
.toc a { display: block; padding: .15rem 0; color: var(--text-soft); overflow-wrap: anywhere; }
.toc a.lvl-2 { padding-left: .7rem; }
.toc a.lvl-3 { padding-left: 1.4rem; font-size: .78rem; }

.md-body { max-width: 74ch; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 { margin: 1.6em 0 .5em; scroll-margin-top: 5rem; }
.md-body h1 { font-size: 1.6rem; }
.md-body h2 { font-size: 1.25rem; padding-bottom: .3em; border-bottom: 1px solid var(--border); }
.md-body h3 { font-size: 1.05rem; }
.md-body > *:first-child { margin-top: 0; }
.md-body p, .md-body li { color: var(--text-soft); }
.md-body ul, .md-body ol { padding-left: 1.35em; margin: 0 0 1em; }
.md-body li { margin: .25em 0; }
.md-body li.md-task { list-style: none; margin-left: -1.2em; }
.md-body li.md-task i { color: var(--accent); margin-right: .4em; }
.md-body li.md-task-done { color: var(--muted); text-decoration: line-through; }
.md-body li.md-task-done i { color: var(--success); }
.md-body blockquote {
  margin: 1em 0; padding: .5em 1em; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-soft);
}
.md-body code {
  font-family: var(--mono); font-size: .86em;
  background: var(--surface-3); padding: .12em .4em; border-radius: 5px;
}
.md-body pre {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .9rem 1rem; overflow-x: auto; margin: 0 0 1em;
}
.md-body pre code { background: none; padding: 0; font-size: .84rem; line-height: 1.55; }
.md-body table { border-collapse: collapse; width: 100%; margin: 0 0 1em; font-size: .88rem; display: block; overflow-x: auto; }
.md-body th, .md-body td { border: 1px solid var(--border); padding: .45rem .7rem; text-align: left; }
.md-body th { background: var(--surface-2); font-weight: 600; }
.md-body img { max-width: 100%; border-radius: var(--radius); }
.md-body hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }

.code-view {
  margin: 0; padding: 0; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: auto;
  max-height: 78vh;
}
.code-view table { border-collapse: collapse; width: 100%; font-family: var(--mono); font-size: .84rem; }
.code-view td.ln {
  width: 1%; padding: 0 .8rem; text-align: right; color: var(--muted);
  user-select: none; border-right: 1px solid var(--border); background: var(--surface-3);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.code-view td.code { padding: 0 1rem; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-soft); }
.code-view tr:hover td.code { background: var(--surface-3); }

.editor-wrap { padding: 1.15rem; }
.editor-wrap textarea { min-height: 62vh; background: var(--surface-2); }
.editor-bar { display: flex; align-items: center; gap: .6rem; margin-top: .8rem; flex-wrap: wrap; }

/* ---------- 9 Dialoge und Hinweise ---------- */
.modal-root {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center; padding: 1.25rem;
  background: rgba(10, 14, 22, .55); backdrop-filter: blur(3px);
  animation: fade .15s ease;
}
.modal-root[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(520px, 100%); max-height: 88vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  animation: rise .18s cubic-bezier(.22, .8, .28, 1);
}
.modal.wide { width: min(680px, 100%); }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; gap: .7rem;
  padding: 1rem 1.15rem; border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 1rem; }
.modal-head i.lead { color: var(--accent); }
.modal-head .close { margin-left: auto; }
.modal-body { padding: 1.15rem; }
.modal-foot {
  display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap;
  padding: .9rem 1.15rem; border-top: 1px solid var(--border); background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.color-picker, .icon-picker { display: flex; flex-wrap: wrap; gap: .45rem; }
.color-dot {
  width: 30px; height: 30px; border-radius: 9px; cursor: pointer;
  border: 2px solid transparent; background: var(--folder); position: relative;
}
.color-dot[aria-pressed="true"] { border-color: var(--text); }
.color-dot[aria-pressed="true"]::after {
  content: "\f00c"; font-family: "Font Awesome 6 Free"; font-weight: 900;
  position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: .7rem;
}
.icon-pick {
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-soft);
  display: grid; place-items: center; font-size: .85rem;
}
.icon-pick[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }

.copy-row { display: flex; gap: .4rem; }
.copy-row input { font-family: var(--mono); font-size: .78rem; }

.share-item {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: .65rem 0; border-top: 1px solid var(--border); font-size: .82rem;
}
.share-item .link { font-family: var(--mono); font-size: .74rem; color: var(--muted); overflow-wrap: anywhere; flex: 1; min-width: 160px; }

.toast-stack {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 80;
  display: flex; flex-direction: column; gap: .5rem; max-width: min(360px, calc(100vw - 2rem));
}
.toast {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .7rem .9rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); font-size: .85rem;
  animation: rise .18s ease;
}
.toast i { margin-top: .15rem; }
.toast.ok i { color: var(--success); }
.toast.err i { color: var(--danger); }
.toast.info i { color: var(--accent); }

/* ---------- 10 Login und Freigabe ---------- */
.auth-page {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background:
    radial-gradient(900px 500px at 15% -10%, var(--accent-soft), transparent 65%),
    radial-gradient(700px 400px at 110% 110%, color-mix(in srgb, var(--c-lila) 14%, transparent), transparent 60%),
    var(--bg);
}
.auth-card { width: min(400px, 100%); padding: 1.9rem 1.7rem; }
.auth-mark {
  width: 52px; height: 52px; border-radius: 15px; margin-bottom: 1.1rem;
  display: grid; place-items: center; font-size: 1.4rem; color: #fff;
  background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--c-lila)));
}
.auth-card h1 { font-size: 1.3rem; margin-bottom: .25rem; }
.auth-card .lead { color: var(--muted); font-size: .88rem; margin-bottom: 1.4rem; }
.auth-error {
  display: flex; align-items: center; gap: .55rem;
  background: var(--danger-soft); color: var(--danger);
  padding: .6rem .8rem; border-radius: 10px; font-size: .83rem; margin-bottom: 1rem;
}
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 2.6rem; }
.pw-wrap button {
  position: absolute; right: .3rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--muted); cursor: pointer;
  width: 32px; height: 32px; border-radius: 8px;
}
.pw-wrap button:hover { background: var(--surface-3); color: var(--text); }
.auth-foot { margin-top: 1.2rem; text-align: center; font-size: .76rem; color: var(--muted); }
.auth-theme { position: fixed; top: 1rem; right: 1rem; }

.share-hero {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 1.4rem 1.5rem; border-bottom: 1px solid var(--border);
}
.share-hero .folder-icon { width: 48px; height: 48px; font-size: 1.25rem; }
.share-hero h1 { font-size: 1.35rem; }
.share-hero .sub { color: var(--muted); font-size: .85rem; }
.share-hero .cta { margin-left: auto; }

.site-footer {
  max-width: 1180px; margin: 0 auto; padding: 1.5rem 1.25rem 2.5rem;
  color: var(--muted); font-size: .76rem; display: flex; gap: .5rem; flex-wrap: wrap;
  border-top: 1px solid var(--border);
}
.site-footer .dot { opacity: .5; }

/* ---------- 11 Responsiv ---------- */
@media (max-width: 860px) {
  .topbar-inner { flex-wrap: wrap; gap: .6rem; }
  .search { order: 3; flex-basis: 100%; max-width: none; margin: 0; }
  .search kbd { display: none; }
  .toc { float: none; width: auto; margin: 0 0 1.2rem; }
  .viewer-body { padding: 1.1rem; }
  .file-table td.hide-sm, .file-table th.hide-sm { display: none; }
}

@media (max-width: 560px) {
  .page { padding: 1.15rem .9rem 2.5rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: .7rem; }
  .stat { padding: .85rem .9rem; }
  .stat-value { font-size: 1.4rem; }
  .folder-grid { grid-template-columns: 1fr; }
  .viewer-frame { height: 70vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- 12 Rechenblätter (Aufgaben, Formeln, Lösungen) ---------- */
.calc-box {
  margin: 1.3em 0;
  border: 1px solid var(--border);
  border-left: 4px solid var(--folder, var(--accent));
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.calc-head {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .9rem;
  background: color-mix(in srgb, var(--folder, var(--accent)) 9%, transparent);
  color: var(--folder, var(--accent));
  font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.calc-head i { font-size: .9em; }
.calc-body { padding: .85rem 1rem; }

.calc-step {
  display: grid;
  grid-template-columns: minmax(2.4rem, max-content) 1.2rem 1fr;
  align-items: baseline; gap: .1rem .3rem;
  padding: .2rem 0;
  font-family: var(--mono); font-size: .96rem; line-height: 1.75;
  color: var(--text);
}
.calc-step .lhs { text-align: right; white-space: nowrap; }
.calc-step .eq { text-align: center; color: var(--muted); }
.calc-step .rhs, .calc-step .full { overflow-wrap: anywhere; }
.calc-step .full { grid-column: 1 / -1; }
.calc-step .note {
  grid-column: 3; font-family: var(--font); font-size: .78rem; color: var(--muted);
}
.calc-step.is-result {
  margin-top: .25rem; padding: .35rem .55rem; border-radius: 8px;
  background: color-mix(in srgb, var(--c-gruen) 12%, transparent);
  font-weight: 700; color: var(--text);
  box-shadow: inset 2px 0 0 var(--c-gruen);
}
.calc-gap { height: .7rem; }

.calc-box .unit { color: var(--folder, var(--accent)); font-weight: 600; }
.calc-box .num  { font-variant-numeric: tabular-nums; }
.calc-box sub   { font-size: .7em; }
.calc-box sup   { font-size: .7em; }

.calc-formula {
  font-family: var(--mono); font-size: 1.12rem; font-weight: 650;
  text-align: center; padding: .55rem .4rem; color: var(--text);
}
.calc-formula + .calc-formula { border-top: 1px dashed var(--border); }

.calc-values { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.calc-values li {
  font-family: var(--mono); font-size: .93rem; color: var(--text);
  padding: .2rem .5rem; border-radius: 7px; background: var(--surface-2); width: fit-content;
}
.calc-text { font-size: .93rem; color: var(--text-soft); }
.calc-inline {
  font-family: var(--mono); background: var(--surface-3);
  padding: .05em .35em; border-radius: 5px; font-size: .9em;
}

/* Editor mit Vorschau */
.split {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start;
}
.split .pane { min-width: 0; }
.split textarea { min-height: 60vh; }
.preview-pane {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 1rem 1.1rem;
  max-height: 72vh; overflow: auto;
}
.snippet-bar { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .7rem; }
.snippet-bar .btn { font-size: .78rem; padding: .3rem .6rem; }
.editor-status { font-size: .78rem; color: var(--muted); margin-left: auto; }

/* Rechner */
.calc-tool-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.calc-tool { padding: 1.1rem 1.2rem; }
.calc-tool h3 { font-size: .95rem; margin-bottom: .2rem; display: flex; align-items: center; gap: .5rem; }
.calc-tool h3 i { color: var(--accent); }
.calc-tool .hint { font-size: .78rem; color: var(--muted); margin-bottom: .9rem; }
.calc-inputs { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.calc-inputs .field { margin: 0; }
.calc-output { margin-top: .9rem; }
.calc-output:empty { display: none; }

@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .split textarea { min-height: 40vh; }
  .preview-pane { max-height: none; }
  .calc-step { grid-template-columns: max-content 1rem 1fr; font-size: .9rem; }
}

/* Erledigte Dateien dezenter darstellen */
.file-table tbody tr.is-done .file-cell .name { color: var(--muted); text-decoration: line-through; }
.file-table tbody tr.is-done .file-cell i.type { opacity: .55; }

/* ---------- 13 Lehrkräfte ---------- */
.teacher-avatar {
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  font-size: .82rem; font-weight: 700; letter-spacing: .02em;
  color: var(--folder, var(--accent));
  background: color-mix(in srgb, var(--folder, var(--accent)) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--folder, var(--accent)) 35%, transparent);
}
.teacher-chip { gap: .35rem; padding-left: .25rem; }
.teacher-badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px;
  padding: 0 .3rem; border-radius: 999px; font-size: .64rem; font-weight: 700;
  color: #fff; background: var(--folder, var(--accent));
}
.teacher-folders { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .2rem; }
.teacher-folder {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .2rem .55rem; border-radius: 8px; font-size: .76rem;
  color: var(--folder, var(--accent)); text-decoration: none;
  background: color-mix(in srgb, var(--folder, var(--accent)) 11%, transparent);
}
.teacher-folder:hover { text-decoration: none; background: color-mix(in srgb, var(--folder, var(--accent)) 20%, transparent); }
