@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ─── Design Tokens ──────────────────────────────────────────────────────── */
:root {
  --bg:             oklch(1.000 0.000 0);
  --surface:        oklch(0.970 0.003 248);
  --surface-alt:    oklch(0.950 0.004 248);
  --border:         oklch(0.882 0.005 248);
  --border-strong:  oklch(0.760 0.008 248);

  --ink:            oklch(0.110 0.005 248);
  --ink-sec:        oklch(0.360 0.008 248);
  --muted:          oklch(0.475 0.012 248);

  --primary:        oklch(0.120 0.005 248);
  --primary-hover:  oklch(0.250 0.005 248);

  --accent:         oklch(0.530 0.235 293);
  --accent-hover:   oklch(0.450 0.220 293);

  --success:        oklch(0.40 0.13 145);
  --success-bg:     oklch(0.960 0.028 145);
  --success-border: oklch(0.82 0.070 145);

  --error:          oklch(0.42 0.16 25);
  --error-bg:       oklch(0.968 0.022 25);
  --error-border:   oklch(0.82 0.080 25);

  --shadow-xs:  0 1px 2px oklch(0 0 0 / 0.07);
  --shadow-sm:  0 1px 4px oklch(0 0 0 / 0.09), 0 0 1px oklch(0 0 0 / 0.05);
  --shadow:     0 4px 16px oklch(0 0 0 / 0.10), 0 1px 2px oklch(0 0 0 / 0.06);

  --radius:     8px;
  --radius-sm:  5px;
  --radius-lg:  12px;
  --radius-full:9999px;

  --ease-out-expo:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
}

/* ─── Reset & Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

/* Tastatur-Fokus: deutlich sichtbarer Ring (nur bei Tastatur, nicht bei Maus) */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
*:focus:not(:focus-visible) { outline: none; }

/* ─── Navbar ─────────────────────────────────────────────────────────────── */
.navbar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  height: 56px;
  padding: 0 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  transition: box-shadow 0.25s ease;
}
.navbar.scrolled {
  box-shadow: 0 2px 20px oklch(0 0 0 / 0.07), 0 1px 3px oklch(0 0 0 / 0.05);
}

.navbar-brand {
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.navbar-brand:hover { text-decoration: none; color: var(--ink); }

.logo-dot {
  width: 7px;
  height: 7px;
  background: var(--ink);
  border-radius: 50%;
  display: inline-block;
}

.navbar-logo {
  height: 44px;
  width: auto;
  display: block;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.navbar-nav a {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  transition: color 0.12s, background 0.12s;
  text-decoration: none;
}
.navbar-nav a:hover {
  color: var(--ink);
  background: var(--surface);
  text-decoration: none;
}

.navbar-user-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.65rem 0.2rem 0.2rem;
  transition: border-color 0.15s, background 0.15s;
}
.navbar-user-btn:hover { border-color: var(--ink); background: var(--surface); }

.navbar-user-avatar {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

.navbar-user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.28rem 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  transition: color 0.12s, border-color 0.12s;
}
.btn-logout:hover {
  color: var(--ink);
  border-color: var(--border-strong);
}

/* ─── Flash Messages ─────────────────────────────────────────────────────── */
.flash-container {
  max-width: 960px;
  margin: 1rem auto 0;
  padding: 0 1.75rem;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid transparent;
}

.flash-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}

.flash-error {
  background: var(--error-bg);
  color: var(--error);
  border-color: var(--error-border);
}

/* ─── Toasts ─────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  max-width: 340px;
}
.toast {
  pointer-events: auto;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  box-shadow: var(--shadow);
  animation: toastIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
  border: 1px solid transparent;
}
.toast.toast-removing {
  animation: toastOut 0.25s ease-in both;
}
.toast-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}
.toast-error {
  background: var(--error-bg);
  color: var(--error);
  border-color: var(--error-border);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(110%) scale(0.9); }
  to   { opacity: 1; transform: translateX(0)   scale(1);   }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(60%); }
}
@media (max-width: 600px) {
  .toast-container { left: 1rem; right: 1rem; bottom: 1rem; max-width: none; }
}

/* ─── Layout ─────────────────────────────────────────────────────────────── */
.container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 2.25rem 1.75rem;
}

.page-title {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-wrap: balance;
}

/* ─── Dashboard ──────────────────────────────────────────────────────────── */
.dashboard-welcome {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.dashboard-welcome p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

/* Stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 2.5rem;
}

.stat-card {
  background: var(--bg);
  padding: 1.25rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--ink);
  line-height: 1;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.stats-row .stat-card:nth-child(1) .stat-value { color: oklch(0.50 0.17 145); }
.stats-row .stat-card:nth-child(2) .stat-value { color: oklch(0.50 0.15 250); }
.stats-row .stat-card:nth-child(3) .stat-value { color: oklch(0.45 0.18 310); }
.stats-row .stat-card:nth-child(4) .stat-value { color: oklch(0.55 0.18 55);  }

/* Hot-Stat: hervorheben, wenn es was zu tun gibt (offene HÜ, Prüfung diese Woche) */
.stats-row .stat-card.stat-card-hot { background: oklch(0.55 0.22 293 / 0.09); }
.stats-row .stat-card.stat-card-hot .stat-value { color: var(--accent) !important; }

/* "Neu seit deinem letzten Besuch"-Banner */
.new-since-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
  margin-bottom: 1.5rem;
  background: oklch(0.55 0.22 293 / 0.08);
  border: 1px solid oklch(0.55 0.22 293 / 0.22);
  border-radius: var(--radius);
  font-size: 0.85rem;
}
.new-since-label { font-weight: 700; color: var(--ink); }
.new-since-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.65rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--ink-sec);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.new-since-chip::before {
  content: '';
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--sc, var(--border-strong));
  flex-shrink: 0;
}
.new-since-chip:hover { border-color: var(--sc, var(--accent)); color: var(--ink); }
.new-since-chip strong { color: var(--sc, var(--accent)); font-weight: 800; }

/* Sections */
.dash-section {
  margin-bottom: 2rem;
}

.dash-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.85rem;
}

.dash-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.file-badge {
  display: inline-block;
  padding: 0.08rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
}

.dash-link {
  font-size: 0.8rem;
  color: var(--muted);
  transition: color 0.12s;
}
.dash-link:hover { color: var(--accent); text-decoration: none; }

/* ─── Fächer-Grid ────────────────────────────────────────────────────────── */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  grid-auto-rows: 120px;
  gap: 0.75rem;
}

.subject-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1rem;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  position: relative;
  overflow: hidden;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.22s var(--ease-out-quart);
  animation: cardIn 0.45s var(--ease-out-expo) both;
  will-change: transform;
}

.subject-card:hover {
  border-color: color-mix(in srgb, var(--card-color, var(--border-strong)) 60%, var(--border));
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  text-decoration: none;
  color: var(--ink);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .subject-card { animation: none; }
  .subject-card:hover { transform: none; }
}

.subject-name {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

/* ─── Fach-Badges (Monoline-Icon in farbiger Kachel) ─────────────────────── */
.subj-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius-sm);
  background: var(--sc, var(--ink));
  color: var(--tc, #fff);
  line-height: 0;
}
.subj-badge svg {
  width: 64%;
  height: 64%;
  display: block;
}
.subj-badge-sm  { width: 1.35rem; height: 1.35rem; border-radius: 6px; }
.subj-badge-lg  { width: 2.9rem;  height: 2.9rem;  border-radius: var(--radius); }
.subj-badge-xl  { width: 3.4rem;  height: 3.4rem;  border-radius: var(--radius-lg); }
.subj-badge-muted { background: var(--surface-alt); color: var(--muted); }

/* ─── File List ──────────────────────────────────────────────────────────── */
.file-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.file-item {
  background: var(--bg);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.14s var(--ease-out-quart);
}

.file-item:last-child { border-bottom: none; }

.file-item:hover { background: var(--surface); }

.file-icon { font-size: 1.2rem; flex-shrink: 0; opacity: 0.7; transition: opacity 0.14s ease; }
.file-item:hover .file-icon { opacity: 1; }

.file-info { flex: 1; min-width: 0; }

.file-name {
  font-weight: 600;
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}

.file-meta {
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 0.1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}

.file-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.empty-state .empty-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

.empty-state p { font-size: 0.85rem; }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.12s, color 0.12s, border-color 0.12s, transform 0.1s var(--ease-out-quart), box-shadow 0.12s;
  line-height: 1;
  white-space: nowrap;
}

.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.96); }

.btn-primary {
  background: var(--accent);
  color: oklch(1 0 0);
}
.btn-primary:hover {
  background: var(--accent-hover);
  color: oklch(1 0 0);
}

.btn-block { width: 100%; justify-content: center; }

.btn-lg {
  padding: 0.7rem 1.4rem;
  font-size: 1rem;
  border-radius: var(--radius);
}

.btn-sm {
  padding: 0.28rem 0.65rem;
  font-size: 0.76rem;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--ink-sec);
}
.btn-outline:hover {
  background: var(--surface);
  color: var(--ink);
}

.btn-danger {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error-border);
}
.btn-danger:hover { background: oklch(0.940 0.035 25); }

.btn-success {
  background: var(--primary);
  color: oklch(1 0 0);
}
.btn-success:hover { background: var(--primary-hover); }

/* ─── Auth Forms ─────────────────────────────────────────────────────────── */
.auth-wrapper {
  min-height: calc(100vh - 56px);
  min-height: calc(100dvh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(62% 48% at 50% 0%, oklch(0.55 0.22 293 / 0.12), transparent 72%),
    var(--surface);
}

.auth-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

.auth-logo-img {
  display: block;
  height: 64px;
  width: auto;
  max-width: 100%;
  margin: 0 auto 0.7rem;
}

.auth-tagline {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 1.75rem;
}

.auth-card h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.3rem;
  text-wrap: balance;
}

.auth-subtitle {
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 1.75rem;
}

.auth-footer {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.84rem;
  color: var(--muted);
}

.remember-forgot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}
.remember-forgot-row .remember-row {
  margin-top: 0;
}
.forgot-link {
  font-size: 0.84rem;
  white-space: nowrap;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.85rem;
  cursor: pointer;
  font-size: 0.84rem;
  color: var(--muted);
  user-select: none;
}
.remember-row input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
}

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--ink-sec);
  letter-spacing: 0.01em;
}

.form-control {
  width: 100%;
  padding: 0.58rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--ink);
  transition: border-color 0.12s, box-shadow 0.12s;
  appearance: none;
}

.form-control::placeholder { color: var(--muted); }

.form-control:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px oklch(0.110 0.005 248 / 0.08);
}

.form-hint {
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

/* File input */
input[type="file"].form-control {
  color: var(--ink-sec);
  cursor: pointer;
  padding: 0.48rem 0.85rem;
}

input[type="file"].form-control::file-selector-button {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.28rem 0.65rem;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  margin-right: 0.75rem;
  transition: background 0.12s;
}

input[type="file"].form-control::file-selector-button:hover {
  background: var(--surface-alt);
}

/* ─── Fachseite ──────────────────────────────────────────────────────────── */
.breadcrumb {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
  font-weight: 500;
}

.breadcrumb a {
  color: var(--muted);
  transition: color 0.12s;
}
.breadcrumb a:hover { color: var(--ink); text-decoration: none; }

.subject-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid color-mix(in srgb, var(--sc, var(--border-strong)) 40%, transparent);
}

.subject-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

/* Upload box */
.upload-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  margin-bottom: 2rem;
}

.upload-box h2 {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.9rem;
}

.upload-row {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex-wrap: wrap;
}

.upload-hint {
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 0.55rem;
}

/* ─── Upload Fortschrittsbalken ──────────────────────────────────────────── */
.upload-progress {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.75rem;
}
.upload-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 100%;
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.15s ease;
}

/* Files section */
.files-section h2 {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.85rem;
}

/* ─── 404 / Error ────────────────────────────────────────────────────────── */
.error-page {
  text-align: center;
  padding: 6rem 1rem;
}

.error-page .error-code {
  font-size: 7rem;
  font-weight: 900;
  color: var(--ink);
  opacity: 0.06;
  line-height: 1;
  letter-spacing: -0.04em;
}

.error-page h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}

.error-page p {
  color: var(--muted);
  margin-bottom: 1.75rem;
  font-size: 0.88rem;
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 1.75rem 1rem;
  color: var(--muted);
  font-size: 0.76rem;
  margin-top: 3rem;
  border-top: 1px solid var(--border);
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .dash-two-col { grid-template-columns: 1fr; gap: 1.25rem; }
}

@media (max-width: 600px) {
  .subjects-grid { grid-template-columns: repeat(2, 1fr); }
  .upload-row { flex-direction: column; align-items: stretch; }
  .upload-row .btn { justify-content: center; }
  .file-item { flex-wrap: wrap; }
  .file-actions { width: 100%; justify-content: flex-end; }
  .navbar-user-name { display: none; }
  .container { padding: 1.5rem 1rem; }
  .navbar { padding: 0 1rem; }
}

@media (max-width: 400px) {
  .subjects-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 1.75rem 1.25rem; }
  .stat-value { font-size: 1.65rem; }
}

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

/* ─── Dark Mode ──────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  color-scheme: dark;
  --bg:             oklch(0.10 0.000 0);
  --surface:        oklch(0.155 0.004 248);
  --surface-alt:    oklch(0.200 0.005 248);
  --border:         oklch(0.265 0.008 248);
  --border-strong:  oklch(0.390 0.012 248);
  --ink:            oklch(0.942 0.005 248);
  --ink-sec:        oklch(0.760 0.009 248);
  --muted:          oklch(0.540 0.011 248);
  --primary:        oklch(0.47 0.148 248);
  --primary-hover:  oklch(0.39 0.148 248);
  --shadow-xs:      0 1px 2px oklch(0 0 0 / 0.45);
  --shadow-sm:      0 1px 4px oklch(0 0 0 / 0.55), 0 0 1px oklch(0 0 0 / 0.30);
  --shadow:         0 4px 16px oklch(0 0 0 / 0.65), 0 1px 2px oklch(0 0 0 / 0.40);
}

/* Dark mode component overrides */
[data-theme="dark"] .btn-success {
  background: oklch(0.38 0.130 145);
}
[data-theme="dark"] .tt-period.tt-irregular {
  background: oklch(0.22 0.055 85);
}

/* ─── Push Notification Bell ─────────────────────────────────────────────── */
.push-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
  flex-shrink: 0;
}
.push-btn:hover { color: var(--ink); border-color: var(--border-strong); }
.push-btn.push-active {
  background: oklch(0.96 0.05 85);
  border-color: oklch(0.72 0.12 85);
  color: oklch(0.45 0.15 85);
}
[data-theme="dark"] .push-btn.push-active {
  background: oklch(0.22 0.05 85);
  border-color: oklch(0.45 0.12 85);
  color: oklch(0.75 0.12 85);
}

/* ─── Theme Toggle Button ────────────────────────────────────────────────── */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.12s, border-color 0.12s;
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--border-strong); }
.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark  { display: inline; }

/* ─── Stundenplan ────────────────────────────────────────────────────────── */
.tt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.tt-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.tt-table {
  display: grid;
  grid-template-columns: 2.8rem repeat(5, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 460px;
  font-size: 0.74rem;
}

.tt-corner {
  background: var(--surface);
  border-right: 1px solid var(--border);
  border-bottom: 2px solid var(--border);
}

.tt-hday {
  background: var(--surface);
  padding: 0.4rem 0.5rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.66rem;
  color: var(--muted);
  border-right: 1px solid var(--border);
  border-bottom: 2px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tt-hday:last-child { border-right: none; }
.tt-hday-today { color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.tt-hdate { display: block; font-size: 0.58rem; font-weight: 400; letter-spacing: 0; text-transform: none; opacity: 0.7; margin-top: 0.1rem; }

.tt-break {
  grid-column: 1 / -1;
  background: var(--surface);
  padding: 0.18rem 0.75rem;
  font-size: 0.62rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  text-align: center;
  font-style: italic;
}

.tt-plabel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.2rem;
  background: var(--surface);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  gap: 0.06rem;
}
.tt-pnum  { font-weight: 800; font-size: 0.78rem; color: var(--ink); line-height: 1; }
.tt-ptime { font-size: 0.54rem; color: var(--muted); }

.tt-cell {
  padding: 0.5rem 0.55rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-height: 3rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.tt-cell:last-child { border-right: none; }

/* Geteilte Zelle: parallele Gruppen nebeneinander */
.tt-cell-split { padding: 0; flex-direction: row; gap: 0; }
.tt-split-item { flex: 1 1 0; min-width: 0; padding: 0.5rem 0.4rem; display: flex; flex-direction: column; gap: 0.1rem; }
.tt-split-item + .tt-split-item { border-left: 1px solid var(--border); }

.tt-lesson { background: color-mix(in srgb, var(--sc) 10%, var(--bg)); }

.tt-lesson-subj  { font-weight: 700; font-size: 0.76rem; color: var(--sc); line-height: 1.1; }
.tt-lesson-teacher,
.tt-lesson-room  { font-size: 0.58rem; color: var(--muted); line-height: 1.2; }
.tt-lesson-info  { font-size: 0.55rem; color: var(--accent); line-height: 1.15; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

.tt-lesson-tag {
  font-size: 0.56rem;
  font-weight: 700;
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  align-self: flex-start;
  margin-top: 0.1rem;
}
.tt-tag-cancelled { background: oklch(0.93 0.06 15); color: oklch(0.40 0.20 15); }
.tt-tag-irregular { background: oklch(0.95 0.06 80); color: oklch(0.45 0.18 80); }

.tt-cell-cancelled              { background: oklch(0.975 0.015 15); }
.tt-cell-cancelled .tt-lesson-subj { text-decoration: line-through; opacity: 0.55; }
.tt-cell-irregular              { background: oklch(0.978 0.022 85); }

.tt-free {
  align-items: center;
  justify-content: center;
  font-size: 0.64rem;
  color: var(--muted);
  font-style: italic;
  opacity: 0.5;
}

.tt-empty-week, .tt-loading {
  text-align: center;
  padding: 1.25rem;
  color: var(--muted);
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.tt-error {
  text-align: center;
  padding: 1.25rem;
  font-size: 0.85rem;
  border-radius: var(--radius);
  color: var(--error);
  background: var(--error-bg);
  border: 1px solid var(--error-border);
}

[data-theme="dark"] .tt-lesson        { background: color-mix(in srgb, var(--sc) 18%, var(--surface)); }
[data-theme="dark"] .tt-cell-cancelled { background: oklch(0.14 0.02 15); }
[data-theme="dark"] .tt-cell-irregular { background: oklch(0.14 0.02 80); }
[data-theme="dark"] .tt-tag-cancelled  { background: oklch(0.20 0.08 15); color: oklch(0.80 0.15 15); }
[data-theme="dark"] .tt-tag-irregular  { background: oklch(0.20 0.08 80); color: oklch(0.80 0.12 80); }

/* ─── Subject-Seite Upgrades ─────────────────────────────────────────────── */
.subject-file-count { font-size:.8rem; color:var(--muted); font-weight:400; }

.subject-search-row { display:flex; align-items:center; gap:.75rem; flex-wrap:wrap; margin-bottom:1.25rem; }
.subject-search-row .form-control { flex:1; min-width:180px; }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
}
.drop-zone:hover, .drop-zone.drop-active { border-color: var(--ink); background: var(--surface); }
.drop-icon { font-size: 1.5rem; opacity:.5; }

.upload-selected-file {
  display:flex; align-items:center; justify-content:space-between; gap:.75rem;
  padding:.6rem .75rem; background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); font-size:.85rem; margin-bottom:.75rem;
}

.tag-checkboxes { display:flex; flex-wrap:wrap; gap:.4rem; }
.tag-check-label {
  display:flex; align-items:center; gap:.3rem; cursor:pointer;
  font-size:.8rem; padding:.25rem .6rem; border:1px solid var(--border);
  border-radius:var(--radius-full); transition:background .12s, border-color .12s;
}
.tag-check-label:has(input:checked) { background:var(--ink); color:var(--bg); border-color:var(--ink); }
.tag-check-label input { display:none; }

.file-desc { font-size:.78rem; color:var(--muted); margin:.1rem 0 .15rem; }

.file-tag {
  display:inline-block; padding:.06rem .45rem; border-radius:var(--radius-full);
  font-size:.65rem; font-weight:600; background:var(--surface); border:1px solid var(--border); color:var(--muted);
}

.tag-filter { display:flex; gap:.4rem; flex-wrap:wrap; }
.tag-pill {
  padding:.2rem .6rem; border-radius:var(--radius-full); font-size:.72rem; cursor:pointer;
  border:1px solid var(--border); background:var(--bg); color:var(--muted); transition:.12s;
}
.tag-pill:hover { border-color:var(--ink); }
.tag-pill.active { background:var(--ink); color:var(--bg); border-color:var(--ink); }

/* Kommentare */
.comments-section { grid-column:1/-1; padding:.75rem 1rem; background:var(--surface); border-top:1px solid var(--border); }
.comments-list { display:flex; flex-direction:column; gap:.4rem; margin-bottom:.6rem; }
.comment-item { display:flex; align-items:baseline; gap:.5rem; font-size:.8rem; }
.comment-user { font-weight:700; color:var(--ink); }
.comment-text { flex:1; color:var(--ink); }
.comment-delete-btn { margin-left:auto; background:none; border:none; color:var(--muted); cursor:pointer; font-size:.75rem; padding:0 .25rem; opacity:0; transition:opacity .15s; line-height:1; }
.comment-item:hover .comment-delete-btn { opacity:1; }
.comment-delete-btn:hover { color:#e74c3c; }
.comment-date { font-size:.68rem; color:var(--muted); white-space:nowrap; }
.comment-empty, .comment-loading { font-size:.78rem; color:var(--muted); font-style:italic; }
.comment-form { display:flex; gap:.5rem; }
.comment-input { flex:1; }

/* Vorschau-Modal */
.modal-backdrop {
  position:fixed; inset:0; background:rgba(0,0,0,.55); z-index:500;
  display:flex; align-items:center; justify-content:center; padding:1rem;
}
.modal-box {
  background:var(--bg); border-radius:var(--radius); overflow:hidden;
  width:min(900px,100%); max-height:92vh; display:flex; flex-direction:column;
  box-shadow:0 24px 64px rgba(0,0,0,.25);
}
.modal-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:.65rem 1rem; border-bottom:1px solid var(--border);
  font-weight:600; font-size:.9rem;
}
.modal-close { background:none; border:none; cursor:pointer; font-size:1rem; color:var(--muted); padding:.2rem .4rem; }
.modal-body { flex:1; overflow:auto; display:flex; align-items:center; justify-content:center; }
.preview-iframe { width:100%; height:80vh; border:none; }
.preview-img { max-width:100%; max-height:80vh; object-fit:contain; }

/* ─── Events & Hausaufgaben ──────────────────────────────────────────────── */
.quick-form { display:flex; flex-direction:column; gap:.5rem; padding:.75rem; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); margin:.5rem 0 .85rem; }

.event-item {
  display:flex; align-items:center; gap:.65rem; padding:.5rem .25rem;
  border-bottom:1px solid var(--border); font-size:.84rem;
}
.event-item:last-child { border-bottom:none; }
.event-type-dot { width:.55rem; height:.55rem; border-radius:50%; flex-shrink:0; }
.event-type-exam     { background:#e74c3c; }
.event-type-homework { background:#f1c40f; }
.event-type-info     { background:#3498db; }
.event-type-other    { background:#9b59b6; }
.event-info { flex:1; display:flex; flex-direction:column; gap:.05rem; min-width:0; }
.event-title { font-weight:600; color:var(--ink); }
.event-date { font-size:.72rem; color:var(--muted); }
.event-creator { font-size:.68rem; color:var(--muted); opacity:.8; }

.hw-item {
  display:flex; align-items:center; gap:.65rem; padding:.45rem .25rem;
  border-bottom:1px solid var(--border); font-size:.84rem;
  transition:opacity .3s;
}
.hw-item:last-child { border-bottom:none; }
.hw-item.hw-done { opacity:.4; }
.hw-check {
  background:none; border:1.5px solid var(--border); border-radius:4px;
  width:1.2rem; height:1.2rem; cursor:pointer; font-size:.9rem; padding:0;
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
  transition:border-color .12s;
}
.hw-check:hover { border-color:var(--ink); }
.hw-info { flex:1; display:flex; flex-direction:column; gap:.05rem; min-width:0; }
.hw-title { font-weight:500; color:var(--ink); }
.hw-date  { font-size:.7rem; color:var(--muted); }
.hw-meta  { display:flex; gap:.5rem; align-items:center; flex-wrap:wrap; }

/* ── Datum-Chips (Multi-Datum) ───────────────────────────────────────────── */
.date-picker-multi { display:flex; flex-direction:column; gap:.35rem; }
.date-chips { display:flex; flex-wrap:wrap; gap:.3rem; min-height:0; }
.date-chip {
  display:inline-flex; align-items:center; gap:.3rem;
  background:var(--accent,#3498db)22; color:var(--accent,#3498db);
  border:1px solid var(--accent,#3498db)55; border-radius:999px;
  padding:.15rem .55rem; font-size:.75rem; font-weight:600;
}
.date-chip-remove {
  background:none; border:none; cursor:pointer; color:inherit;
  font-size:.9rem; line-height:1; padding:0; opacity:.7;
}
.date-chip-remove:hover { opacity:1; }

/* ── Inline-Edit ─────────────────────────────────────────────────────────── */
.inline-edit-input {
  padding:.15rem .4rem !important; font-size:.84rem !important;
  height:auto !important; min-width:0; width:100%;
}

/* ── Umbenennen-Button ───────────────────────────────────────────────────── */
.btn-icon {
  background:none; border:none; cursor:pointer; padding:.1rem .25rem;
  font-size:.85rem; opacity:.55; transition:opacity .15s;
}
.btn-icon:hover { opacity:1; }

/* ─── Profil ─────────────────────────────────────────────────────────────── */
.profile-card {
  display:flex; align-items:center; gap:1.25rem; padding:1.5rem;
  border:1px solid var(--border); border-radius:var(--radius); background:var(--surface);
}
.profile-avatar {
  width:3.5rem; height:3.5rem; border-radius:50%; background:var(--ink); color:var(--bg);
  font-size:1.4rem; font-weight:800; display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.profile-info { flex:1; }
.profile-name  { font-size:1.1rem; font-weight:700; color:var(--ink); }
.profile-email { font-size:.8rem; color:var(--muted); }
.profile-stat  { text-align:center; }
.profile-stat-value { display:block; font-size:1.8rem; font-weight:900; color:oklch(0.50 0.17 145); line-height:1; }
.profile-stat-label { font-size:.7rem; color:var(--muted); text-transform:uppercase; letter-spacing:.06em; }

/* ─── Subject-Card Badge ─────────────────────────────────────────────────── */
.subject-count-badge {
  font-size:.62rem; font-weight:700; padding:.08rem .4rem; border-radius:var(--radius-full);
  background:var(--card-color,var(--border-strong)); color:#fff; min-width:1.4rem; text-align:center;
}

/* ─── Section Divider ────────────────────────────────────────────────────── */
.section-hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.25rem 0 2rem;
}

/* ─── Lager Card (in subjects grid) ─────────────────────────────────────── */
.lager-card {
  border-style: dashed;
  background: var(--surface);
}
.lager-card-hint {
  font-size: .62rem;
  color: var(--muted);
  font-weight: 500;
}

/* ─── Mein Lager Seite ───────────────────────────────────────────────────── */
.lager-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px dashed var(--border);
}
.lager-header-icon { font-size: 1.75rem; flex-shrink: 0; }
.lager-header h1  { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.03em; }
.lager-subtitle   { font-size: .8rem; color: var(--muted); font-weight: 400; }

/* ─── Subject Card gleiche Größe (über grid-auto-rows gesteuert) ─────────── */

/* ─── Dashboard Suche ────────────────────────────────────────────────────── */
.dash-search-row { margin-bottom:1rem; }
.dash-search-row .form-control { max-width:340px; }

/* ─── Sterne-Bewertungen ─────────────────────────────────────────────────── */
.star-rating {
  display:flex; align-items:center; gap:.15rem;
  flex-wrap:nowrap;
}
.star {
  font-size:1.05rem; color:var(--border-strong); cursor:pointer;
  transition:color .1s, transform .1s;
  line-height:1;
  user-select:none;
}
.star.star-on   { color:#f59e0b; }
.star.star-hover { color:#fbbf24; transform:scale(1.15); }
.star-count {
  font-size:.72rem; color:var(--muted); margin-left:.3rem; white-space:nowrap;
}
.star-count-empty { opacity:.5; }
[data-theme="dark"] .star { color:oklch(0.4 0 0); }
[data-theme="dark"] .star.star-on { color:#f59e0b; }

/* ─── View Tabs (Liste / Kalender) ──────────────────────────────────────── */
.view-tabs {
  display:flex; border:1px solid var(--border); border-radius:var(--radius-sm); overflow:hidden;
}
.view-tab {
  background:none; border:none; padding:.25rem .65rem; font-size:.78rem; cursor:pointer;
  color:var(--muted); font-weight:500; transition:background .15s, color .15s;
}
.view-tab.active { background:var(--ink); color:var(--bg); }
.view-tab:not(.active):hover { background:var(--surface-alt); }

/* ─── Monatskalender ─────────────────────────────────────────────────────── */
.cal-nav {
  display:flex; align-items:center; justify-content:center; gap:.5rem; margin:.6rem 0 .8rem;
}
.cal-head {
  display:grid; grid-template-columns:repeat(7,1fr); gap:2px;
  margin-bottom:3px;
}
.cal-head span {
  text-align:center; font-size:.68rem; font-weight:600;
  color:var(--muted); padding:.2rem 0;
}
.cal-body {
  display:grid; grid-template-columns:repeat(7,1fr); gap:3px;
}
.cal-cell {
  aspect-ratio:1; border-radius:6px; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:2px;
  cursor:pointer; transition:background .12s;
  position:relative;
}
.cal-cell:hover { background:var(--surface-alt); }
.cal-empty { cursor:default; }
.cal-today .cal-day-num {
  background:var(--ink); color:var(--bg);
  border-radius:50%; width:1.45rem; height:1.45rem;
  display:flex; align-items:center; justify-content:center;
}
.cal-selected { background:var(--surface-alt); outline:2px solid var(--border-strong); outline-offset:-1px; }
.cal-day-num  { font-size:.78rem; font-weight:500; line-height:1; }
.cal-dots { display:flex; gap:2px; }
.cal-dot  { width:.35rem; height:.35rem; border-radius:50%; }
.cal-dot-exam     { background:#e74c3c; }
.cal-dot-homework { background:#f1c40f; }
.cal-dot-info     { background:#3498db; }
.cal-overflow-row {
  display:flex; flex-wrap:wrap; gap:.3rem; margin-top:.4rem; padding-top:.35rem;
  border-top:1px dashed var(--border);
}
.cal-overflow-day {
  font-size:.72rem; font-weight:500; color:var(--muted);
  padding:.15rem .35rem; border-radius:4px; cursor:pointer;
  position:relative; transition:background .12s;
}
.cal-overflow-day:hover { background:var(--surface-alt); color:var(--ink); }
.cal-today-overflow { color:var(--ink); font-weight:700; }
.cal-overflow-dot {
  display:inline-block; width:.35rem; height:.35rem; border-radius:50%;
  vertical-align:middle; margin-left:.15rem;
}
.cal-day-events {
  margin-top:.75rem; padding:.65rem .75rem;
  border:1px solid var(--border); border-radius:var(--radius); background:var(--surface);
}
.cal-day-title {
  font-weight:700; font-size:.82rem; color:var(--ink); margin-bottom:.4rem;
}
.cal-legend {
  display:flex; gap:1rem; margin-top:.65rem; flex-wrap:wrap;
}
.cal-legend-item {
  display:flex; align-items:center; gap:.35rem;
  font-size:.72rem; color:var(--muted);
}

/* ─── Aktivitäts-Feed ────────────────────────────────────────────────────── */
.activity-item {
  display:flex; align-items:flex-start; gap:.65rem;
  padding:.45rem .1rem; border-bottom:1px solid var(--border);
  font-size:.84rem;
}
.activity-item:last-child { border-bottom:none; }
.activity-icon { font-size:1rem; flex-shrink:0; line-height:1.4; }
.activity-body { flex:1; color:var(--ink-sec); line-height:1.45; }
.activity-user { font-weight:600; color:var(--ink); }
.activity-time { font-size:.72rem; color:var(--muted); white-space:nowrap; }

/* ─── Klassen-Chat ───────────────────────────────────────────────────────── */
.chat-page { display:flex; flex-direction:column; height:calc(100vh - 100px); height:calc(100dvh - 84px); }
.chat-header {
  display:flex; align-items:center; justify-content:space-between;
  padding-bottom:1rem; border-bottom:1px solid var(--border); margin-bottom:1rem;
}
.chat-online { font-size:.75rem; color:var(--muted); }
.chat-box {
  flex:1; overflow-y:auto; display:flex; flex-direction:column; gap:.55rem;
  padding:.5rem 0; scroll-behavior:smooth;
}
.chat-msg {
  display:flex; align-items:flex-end; gap:.5rem; max-width:80%;
}
.chat-msg-mine { align-self:flex-end; flex-direction:row-reverse; }
.chat-avatar {
  width:2rem; height:2rem; border-radius:50%; background:var(--ink); color:var(--bg);
  font-size:.75rem; font-weight:700; display:flex; align-items:center; justify-content:center;
  flex-shrink:0;
}
.chat-bubble {
  display:flex; flex-direction:column; gap:.15rem;
  background:var(--surface); border:1px solid var(--border); border-radius:12px;
  padding:.5rem .8rem; max-width:100%;
}
.chat-msg-mine .chat-bubble {
  background:var(--ink); color:var(--bg); border-color:var(--ink);
}
.chat-username {
  font-size:.72rem; font-weight:600; color:var(--accent); line-height:1;
}
.chat-text { font-size:.88rem; word-break:break-word; line-height:1.45; }
.chat-msg-mine .chat-text { color:var(--bg); }
.chat-time {
  font-size:.65rem; color:var(--muted); align-self:flex-end; margin-top:.1rem;
}
.chat-msg-mine .chat-time { color:oklch(0.7 0 0); }
.chat-input-row {
  display:flex; gap:.5rem; padding-top:.75rem; border-top:1px solid var(--border);
  margin-top:.5rem;
}
.chat-input-row .form-control { flex:1; }
.chat-send-btn { flex-shrink:0; }

/* Chat dark mode tweaks */
[data-theme="dark"] .chat-bubble { background:oklch(0.20 0.005 248); border-color:oklch(0.28 0.006 248); }
[data-theme="dark"] .chat-msg-mine .chat-bubble { background:oklch(0.85 0 0); }
[data-theme="dark"] .chat-msg-mine .chat-text { color:oklch(0.1 0 0); }

/* Navbar Chat-Link */
.navbar-chat-link {
  font-size:1.1rem; line-height:1; padding:.25rem .3rem;
  border-radius:var(--radius-sm); transition:background .15s;
  text-decoration:none;
}
.navbar-chat-link:hover { background:var(--surface-alt); text-decoration:none; }

/* ─── Animationen ────────────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes formReveal {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes backdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modalScale {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes commentReveal {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Dashboard welcome + stats entrance */
.dashboard-welcome { animation: fadeUp 0.5s var(--ease-out-expo) both; }
.stats-row .stat-card:nth-child(1) { animation: fadeUp 0.42s var(--ease-out-expo) 0.07s both; }
.stats-row .stat-card:nth-child(2) { animation: fadeUp 0.42s var(--ease-out-expo) 0.13s both; }
.stats-row .stat-card:nth-child(3) { animation: fadeUp 0.42s var(--ease-out-expo) 0.19s both; }
.stats-row .stat-card:nth-child(4) { animation: fadeUp 0.42s var(--ease-out-expo) 0.25s both; }

/* File list stagger (first 8 items) */
.file-list .file-item:nth-child(1) { animation: fadeUp 0.3s var(--ease-out-quart) 0.04s both; }
.file-list .file-item:nth-child(2) { animation: fadeUp 0.3s var(--ease-out-quart) 0.07s both; }
.file-list .file-item:nth-child(3) { animation: fadeUp 0.3s var(--ease-out-quart) 0.10s both; }
.file-list .file-item:nth-child(4) { animation: fadeUp 0.3s var(--ease-out-quart) 0.13s both; }
.file-list .file-item:nth-child(5) { animation: fadeUp 0.3s var(--ease-out-quart) 0.16s both; }
.file-list .file-item:nth-child(6) { animation: fadeUp 0.3s var(--ease-out-quart) 0.19s both; }
.file-list .file-item:nth-child(7) { animation: fadeUp 0.3s var(--ease-out-quart) 0.22s both; }
.file-list .file-item:nth-child(8) { animation: fadeUp 0.3s var(--ease-out-quart) 0.25s both; }

/* Event & Hausaufgaben items */
.event-item { animation: fadeUp 0.28s var(--ease-out-quart) both; }
.hw-item    { animation: fadeUp 0.28s var(--ease-out-quart) both; }

/* Quick-form animated reveal */
.quick-form.form-visible { animation: formReveal 0.22s var(--ease-out-quart) both; }

/* Modal */
.modal-backdrop { animation: backdropIn 0.18s ease both; }
.modal-box      { animation: modalScale 0.26s var(--ease-out-expo) both; }

/* Comment section reveal */
.comments-section.comment-open { animation: commentReveal 0.18s ease both; }

/* Homework done transition */
.hw-item { transition: opacity 0.35s ease, transform 0.35s ease; }
.hw-item.hw-done { opacity: 0.35; transform: translateX(3px); }

/* Form focus ring improvement */
.form-control:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px oklch(0.110 0.005 248 / 0.10);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Tag pill smooth transition */
.tag-pill { transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease; }
.tag-check-label { transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease; }

/* Reduced motion: suppress all new animations */
@media (prefers-reduced-motion: reduce) {
  .dashboard-welcome,
  .stats-row .stat-card,
  .file-list .file-item,
  .event-item,
  .hw-item,
  .quick-form.form-visible,
  .modal-backdrop,
  .modal-box,
  .comments-section.comment-open { animation: none !important; }
  .hw-item { transition: opacity 0.15s ease; }
}

/* ─── Mitglieder-Panel ───────────────────────────────────────────────────── */
.members-wrapper { position:relative; }
.members-btn {
  display:flex; align-items:center; gap:.3rem;
  background:none; border:1.5px solid var(--border); border-radius:var(--radius);
  padding:.25rem .6rem; cursor:pointer; font-size:.8rem; color:var(--ink);
  transition:border-color .15s, background .15s;
}
.members-btn:hover, .members-btn-active { border-color:var(--accent,#3498db); background:var(--accent,#3498db)11; }
.members-icon { font-size:.95rem; }
.members-count { font-weight:700; font-size:.78rem; color:var(--accent,#3498db); min-width:1.8rem; text-align:center; }
.members-panel {
  position:absolute; top:calc(100% + .5rem); right:0;
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:0 8px 32px rgba(0,0,0,.18); width:200px; z-index:999;
  animation:formReveal .18s var(--ease-out-quart) both;
}
.members-panel-header {
  font-size:.72rem; font-weight:700; color:var(--muted);
  text-transform:uppercase; letter-spacing:.06em;
  padding:.55rem .85rem .3rem; border-bottom:1px solid var(--border);
}
.members-list { padding:.35rem 0; max-height:280px; overflow-y:auto; }
.members-loading { display:block; padding:.5rem .85rem; color:var(--muted); font-size:.8rem; }
.member-item {
  display:flex; align-items:center; gap:.55rem;
  padding:.35rem .85rem; font-size:.83rem;
}
.member-dot {
  width:.55rem; height:.55rem; border-radius:50%; flex-shrink:0;
}
.member-dot-online  { background:#2ecc71; box-shadow:0 0 0 2px #2ecc7133; }
.member-dot-offline { background:var(--border); }
.member-name { flex:1; color:var(--ink); }
.member-status-label { font-size:.65rem; color:#2ecc71; font-weight:600; }

/* ─── Gruppen-System ─────────────────────────────────────────────────────── */
.group-badge {
  display:inline-flex; align-items:center; padding:.2rem .65rem;
  border-radius:999px; font-size:.73rem; font-weight:700; text-decoration:none;
}
.group-badge-a { background:#3498db22; color:#3498db; border:1px solid #3498db55; }
.group-badge-b { background:#e91e6322; color:#e91e63; border:1px solid #e91e6355; }
.group-badge-none { background:var(--border); color:var(--muted); border:1px solid var(--border); }
.group-badge-none:hover { background:var(--accent,#3498db)22; color:var(--accent,#3498db); }

.group-notice {
  background:#f1c40f22; border:1px solid #f1c40f55; border-radius:var(--radius);
  padding:.6rem 1rem; font-size:.84rem; color:var(--ink); margin-bottom:1rem;
}
.group-notice a { color:var(--accent,#3498db); }

.group-select-row { display:flex; gap:.5rem; flex-wrap:wrap; }
.group-radio-label {
  display:flex; align-items:center; gap:.4rem;
  padding:.3rem .7rem; border-radius:999px;
  border:1.5px solid var(--border); cursor:pointer; font-size:.83rem;
  transition:border-color .13s, background .13s;
}
.group-radio-label:has(input:checked) { border-color:var(--accent,#3498db); background:var(--accent,#3498db)11; }
.group-radio-a:has(input:checked) { border-color:#3498db; background:#3498db11; color:#3498db; font-weight:600; }
.group-radio-b:has(input:checked) { border-color:#e91e63; background:#e91e6311; color:#e91e63; font-weight:600; }
.group-radio-label input { display:none; }

.file-group-badge {
  display:inline-block; padding:.08rem .45rem;
  border-radius:999px; font-size:.68rem; font-weight:700;
}
.file-group-a { background:#3498db22; color:#3498db; }
.file-group-b { background:#e91e6322; color:#e91e63; }

/* ─── Avatar ─────────────────────────────────────────────────────────────── */
.profile-avatar-wrap { position:relative; flex-shrink:0; }
.profile-avatar {
  width:64px; height:64px; border-radius:50%;
  background:var(--accent,#3498db); color:#fff;
  display:flex; align-items:center; justify-content:center;
  font-size:1.6rem; font-weight:800; flex-shrink:0; overflow:hidden;
}
.profile-avatar-img { object-fit:cover; }
.profile-avatar-emoji { font-size:2rem; line-height:1; }

.navbar-user-avatar { position:relative; overflow:hidden; }
.navbar-avatar-img { width:28px; height:28px; border-radius:50%; object-fit:cover; display:block; }

.avatar-upload-form { margin-bottom:.75rem; }
.avatar-divider {
  display:flex; align-items:center; gap:.75rem; margin:.85rem 0;
  color:var(--muted); font-size:.75rem;
}
.avatar-divider::before, .avatar-divider::after {
  content:''; flex:1; height:1px; background:var(--border);
}

/* Emoji Grid */
.emoji-grid {
  display:flex; flex-wrap:wrap; gap:.3rem;
}
.emoji-btn {
  width:2.4rem; height:2.4rem; border-radius:8px;
  border:2px solid transparent; background:var(--surface);
  cursor:pointer; font-size:1.25rem; display:flex; align-items:center; justify-content:center;
  transition:border-color .12s, transform .1s;
}
.emoji-btn:hover { border-color:var(--border); transform:scale(1.15); }
.emoji-btn-active { border-color:var(--accent,#3498db) !important; background:var(--accent,#3498db)11; }
.emoji-btn-none { font-size:.9rem; font-weight:800; color:var(--muted); }

/* Color Palette */
.color-palette { display:flex; gap:.4rem; flex-wrap:wrap; margin-top:.35rem; }
.color-swatch {
  width:1.7rem; height:1.7rem; border-radius:50%; cursor:pointer;
  border:2.5px solid transparent; transition:transform .12s, box-shadow .12s;
}
.color-swatch:hover { transform:scale(1.2); }
.color-swatch-active { box-shadow:0 0 0 3px var(--surface), 0 0 0 5px currentColor; }
.color-swatch-custom {
  background:var(--surface); border:2px dashed var(--border);
  display:flex; align-items:center; justify-content:center;
  font-size:.9rem; color:var(--muted);
}

/* ─── Gruppen Farben (Index-basiert, bis zu 4 Gruppen) ───────────────────── */
.group-color-0 { background:#3498db22; color:#3498db; border-color:#3498db55; }
.group-color-1 { background:#e91e6322; color:#e91e63; border-color:#e91e6355; }
.group-color-2 { background:#2ecc7122; color:#2ecc71; border-color:#2ecc7155; }
.group-color-3 { background:#ff980022; color:#ff9800; border-color:#ff980055; }
.group-badge { border:1px solid; }
.group-radio-idx-0:has(input:checked) { border-color:#3498db; background:#3498db11; color:#3498db; font-weight:600; }
.group-radio-idx-1:has(input:checked) { border-color:#e91e63; background:#e91e6311; color:#e91e63; font-weight:600; }
.group-radio-idx-2:has(input:checked) { border-color:#2ecc71; background:#2ecc7111; color:#2ecc71; font-weight:600; }
.group-radio-idx-3:has(input:checked) { border-color:#ff9800; background:#ff980011; color:#ff9800; font-weight:600; }
.file-group-badge { display:inline-block; padding:.08rem .45rem; border-radius:999px; font-size:.68rem; font-weight:700; border:1px solid; }

/* ═══════════════════════════════════════════════════════════════════
   NEUE FEATURES – Kalender, Suche, Chat, Polls, Geburtstag, Deeplinks
   ═══════════════════════════════════════════════════════════════════ */

/* ── Navbar icon buttons ─────────────────────────────────────────── */
.navbar-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: .3rem .45rem;
  border-radius: .4rem;
  color: var(--text);
  text-decoration: none;
  transition: background .15s;
}
.navbar-icon-btn:hover { background: var(--hover); }

/* ── Kalender ────────────────────────────────────────────────────── */
.cal-legend { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; font-size: .78rem; color: var(--muted); margin-bottom: .75rem; }
.cal-grid-header { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; text-align: center; font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; margin-bottom: 2px; }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; }
.cal-cell { min-height: 72px; background: var(--surface); border-radius: .4rem; padding: .3rem .35rem; cursor: pointer; position: relative; transition: background .12s; }
.cal-cell:hover { background: var(--hover); }
.cal-cell-empty { background: transparent; cursor: default; }
.cal-today { outline: 2px solid var(--accent); }
.cal-day-num { font-size: .8rem; font-weight: 600; color: var(--muted); }
.cal-today .cal-day-num { color: var(--accent); }
.cal-dots { display: flex; gap: 2px; flex-wrap: wrap; margin-top: .2rem; }
.cal-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.cal-dot-exam    { background: #e74c3c; }
.cal-dot-homework { background: #f39c12; }
.cal-dot-info    { background: #3498db; }
.cal-dot-other   { background: #9b59b6; }
.cal-dot-hw-due  { background: #2ecc71; }
.cal-item-preview { font-size: .65rem; color: var(--text); margin-top: .2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; line-height: 1.3; }
.cal-day-detail { margin-top: 1.2rem; background: var(--surface); border-radius: .6rem; padding: 1rem 1.25rem; }
.cal-day-detail-header { display: flex; align-items: center; justify-content: space-between; font-weight: 600; margin-bottom: .75rem; }
.cal-detail-item { display: flex; align-items: center; gap: .5rem; padding: .4rem 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.cal-detail-item:last-child { border-bottom: none; }
.event-type-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.event-type-exam    { background: #e74c3c; }
.event-type-homework { background: #f39c12; }
.event-type-info    { background: #3498db; }
.event-type-other   { background: #9b59b6; }
@media (max-width: 500px) {
  .cal-cell { min-height: 50px; }
  .cal-item-preview { display: none; }
}

/* ── Suche Modal ─────────────────────────────────────────────────── */
.search-modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 9999; display: flex; align-items: flex-start; justify-content: center; padding-top: 15vh; backdrop-filter: blur(4px); }
.search-modal-box { background: var(--card); border-radius: .75rem; width: min(580px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.5); overflow: hidden; }
.search-modal-inner { display: flex; align-items: center; gap: .6rem; padding: .85rem 1rem; border-bottom: 1px solid var(--border); }
.search-icon-big { font-size: 1.1rem; flex-shrink: 0; opacity: .6; }
.search-modal-input { flex: 1; background: none; border: none; outline: none; font-size: 1rem; color: var(--text); font-family: inherit; }
.search-results { max-height: 360px; overflow-y: auto; padding: .4rem 0; }
.search-group-title { padding: .3rem 1rem; font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .06em; }
.search-result { display: flex; align-items: center; gap: .6rem; padding: .6rem 1rem; cursor: pointer; text-decoration: none; color: var(--text); transition: background .1s; }
.search-result:hover { background: var(--hover); }
.search-result-icon { font-size: 1rem; flex-shrink: 0; }
.search-result-text { display: flex; flex-direction: column; min-width: 0; }
.search-result-text strong { font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-sub { font-size: .73rem; color: var(--muted); }
.search-empty { text-align: center; padding: 1.5rem; color: var(--muted); font-size: .85rem; }

/* ── KI Chat Widget ──────────────────────────────────────────────── */
.chat-widget { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 1000; display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; }
.chat-fab { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); border: none; cursor: pointer; font-size: 1.5rem; box-shadow: 0 4px 16px rgba(0,0,0,.3); transition: transform .15s, box-shadow .15s; display: flex; align-items: center; justify-content: center; color: #fff; }
.chat-fab:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.chat-panel { background: var(--card); border-radius: .75rem; width: 320px; max-height: 420px; display: flex; flex-direction: column; box-shadow: 0 8px 32px rgba(0,0,0,.4); border: 1px solid var(--border); }
.chat-header { display: flex; align-items: center; gap: .5rem; padding: .7rem 1rem; border-bottom: 1px solid var(--border); font-weight: 600; font-size: .88rem; }
.chat-header span:last-of-type { margin-left: auto; }
.chat-messages { flex: 1; overflow-y: auto; padding: .75rem; display: flex; flex-direction: column; gap: .5rem; }
.chat-msg { max-width: 85%; font-size: .83rem; padding: .5rem .75rem; border-radius: .6rem; line-height: 1.45; word-break: break-word; }
.chat-msg-user { background: var(--accent); color: #fff; align-self: flex-end; border-bottom-right-radius: .15rem; }
.chat-msg-bot { background: var(--surface); color: var(--text); align-self: flex-start; border-bottom-left-radius: .15rem; }
.chat-input-row { display: flex; gap: .4rem; padding: .6rem; border-top: 1px solid var(--border); }
.chat-input { flex: 1; font-size: .83rem; }
@media (max-width: 400px) { .chat-panel { width: calc(100vw - 2rem); } }

/* ── Polls ───────────────────────────────────────────────────────── */
.poll-item { background: var(--surface); border-radius: .5rem; padding: .85rem 1rem; margin-bottom: .6rem; border: 1px solid var(--border); }
.poll-question { font-weight: 600; font-size: .9rem; margin-bottom: .6rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.poll-options { display: flex; flex-direction: column; gap: .4rem; }
.poll-option-btn { text-align: left; background: var(--hover); border: 1px solid var(--border); border-radius: .4rem; padding: .45rem .75rem; cursor: pointer; font-size: .83rem; color: var(--text); transition: background .12s, border-color .12s; display: flex; align-items: center; gap: .5rem; }
.poll-option-btn:hover:not(:disabled) { background: var(--accent); color: #fff; border-color: var(--accent); }
.poll-option-btn:disabled { cursor: default; }
.poll-option-btn.poll-voted { background: var(--accent); color: #fff; border-color: var(--accent); }
.poll-bar { flex: 1; height: 4px; background: rgba(255,255,255,.2); border-radius: 2px; overflow: hidden; }
.poll-bar span { display: block; height: 100%; background: rgba(255,255,255,.7); border-radius: 2px; transition: width .5s; }
.poll-pct { font-size: .75rem; opacity: .8; min-width: 28px; text-align: right; }
.poll-meta { font-size: .72rem; color: var(--muted); margin-top: .4rem; }

/* ── Geburtstag Banner ───────────────────────────────────────────── */
.birthday-banner { background: linear-gradient(135deg,#f6d365,#fda085); color: #333; border-radius: .6rem; padding: .7rem 1.1rem; display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; font-size: .88rem; font-weight: 500; }
.birthday-banner-today { background: linear-gradient(135deg,#fa709a,#fee140); color: #3a0a1e; font-weight: 600; box-shadow: 0 4px 14px rgba(250,112,154,.35); }
.birthday-emoji { font-size: 1.3rem; flex-shrink: 0; }
.birthday-banner-today .birthday-emoji { animation: bday-pop 1.4s ease-in-out infinite; }
@keyframes bday-pop { 0%,100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.18) rotate(-8deg); } }
@media (prefers-reduced-motion: reduce) { .birthday-banner-today .birthday-emoji { animation: none; } }

/* Achievements */
.ach-group-label { font-weight: 700; font-size: .9rem; color: var(--ink); margin: 1.2rem 0 .5rem; }
.ach-group-label:first-of-type { margin-top: 0; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; }
.ach-grid + .ach-group-label { margin-top: 1.5rem; }
.ach-badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .25rem; padding: 1rem .6rem; border-radius: .7rem; border: 1px solid var(--border); background: var(--surface); transition: transform .18s cubic-bezier(.22,1,.36,1), box-shadow .18s; }
.ach-badge.ach-earned { border-color: color-mix(in oklab, var(--accent) 45%, var(--border)); background: color-mix(in oklab, var(--accent) 8%, var(--surface)); box-shadow: 0 2px 10px color-mix(in oklab, var(--accent) 14%, transparent); }
.ach-badge.ach-earned:hover { transform: translateY(-3px); box-shadow: 0 6px 18px color-mix(in oklab, var(--accent) 22%, transparent); }
.ach-badge.ach-locked { opacity: .55; filter: grayscale(.6); }
.ach-icon { font-size: 1.9rem; line-height: 1; }
.ach-name { font-weight: 700; font-size: .85rem; color: var(--ink); }
.ach-desc { font-size: .72rem; color: var(--muted); }
.ach-progress-wrap { margin-top: 1rem; }
.ach-progress-text { font-size: .82rem; color: var(--muted); margin-bottom: .4rem; }
.ach-progress-bar { height: 8px; border-radius: 99px; background: var(--border); overflow: hidden; }
.ach-progress-fill { height: 100%; border-radius: 99px; background: var(--accent); transition: width .5s cubic-bezier(.22,1,.36,1); }
.ach-alldone { margin-top: 1rem; font-weight: 600; color: var(--accent); }

/* Datei-Editor */
.editor-modal-box { width: min(900px, 95vw); max-width: 95vw; }
.editor-textarea {
  width: 100%; min-height: 55vh; resize: vertical;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: .85rem; line-height: 1.5; tab-size: 2;
  color: var(--ink); background: var(--bg);
  border: 1px solid var(--border); border-radius: .5rem; padding: .75rem .9rem;
  white-space: pre; overflow: auto;
}
.editor-textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.editor-textarea:disabled { opacity: .6; }
/* Ace-Editor (Enhancement über der Textarea) */
.editor-ace {
  width: 100%; min-height: 55vh; height: 55vh;
  border: 1px solid var(--border); border-radius: .5rem;
  overflow: hidden; font-size: 13.5px;
}
.editor-ace .ace_gutter { background: var(--surface); }
/* Word-Dokument-Ansicht im Vorschau-Modal */
.docx-view { max-height: 72vh; overflow: auto; padding: .5rem .25rem; }
.docx-view img { max-width: 100%; height: auto; }
.docx-view table { border-collapse: collapse; margin: .8em 0; width: 100%; }
.docx-view td, .docx-view th { border: 1px solid var(--border); padding: .35em .6em; }
.editor-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .75rem; flex-wrap: wrap; }
.editor-status { font-size: .8rem; color: var(--muted); }
.editor-actions { display: flex; gap: .5rem; margin-left: auto; }
.editor-versions { margin-top: .75rem; border: 1px solid var(--border); border-radius: .5rem; padding: .6rem .8rem; background: var(--surface); max-height: 30vh; overflow: auto; }
.editor-versions-title { font-weight: 700; font-size: .8rem; margin-bottom: .4rem; color: var(--ink); }
.editor-version-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .35rem 0; font-size: .82rem; color: var(--muted); border-top: 1px solid var(--border); }
.editor-version-row:first-of-type { border-top: none; }
.editor-tabs { display: flex; gap: .25rem; margin-bottom: .6rem; }
.editor-tab { font: inherit; font-size: .82rem; font-weight: 600; padding: .35rem .9rem; border-radius: .45rem; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; }
.editor-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.editor-preview { min-height: 55vh; max-height: 70vh; overflow: auto; border: 1px solid var(--border); border-radius: .5rem; padding: 1rem 1.2rem; background: var(--surface); }
.markdown-body { color: var(--ink); line-height: 1.6; font-size: .92rem; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 { margin: 1.1em 0 .5em; line-height: 1.25; }
.markdown-body h1 { font-size: 1.6rem; } .markdown-body h2 { font-size: 1.35rem; } .markdown-body h3 { font-size: 1.15rem; }
.markdown-body p { margin: .6em 0; }
.markdown-body ul, .markdown-body ol { margin: .6em 0; padding-left: 1.4em; }
.markdown-body li { margin: .2em 0; }
.markdown-body code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85em; background: var(--bg); padding: .1em .35em; border-radius: .3em; }
.markdown-body pre { background: var(--bg); border: 1px solid var(--border); border-radius: .5rem; padding: .8rem 1rem; overflow: auto; }
.markdown-body pre code { background: none; padding: 0; }
.markdown-body blockquote { margin: .6em 0; padding: .3em .9em; border-left: 3px solid var(--accent); color: var(--muted); }
.markdown-body a { color: var(--accent); }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 1em 0; }
.ki-disclaimer { margin-top: 1rem; padding-top: .6rem; border-top: 1px solid var(--border); font-size: .72rem; color: var(--muted); }

/* ── Modal-Close Button ──────────────────────────────────────────── */
.modal-close { background: none; border: none; cursor: pointer; font-size: 1rem; color: var(--muted); padding: .2rem .35rem; border-radius: .3rem; line-height: 1; }
.modal-close:hover { color: var(--text); background: var(--hover); }

/* ── Breadcrumb ──────────────────────────────────────────────────── */
.breadcrumb { font-size: .82rem; color: var(--muted); margin-bottom: 1rem; }
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ── Form hint ───────────────────────────────────────────────────── */
.form-hint { font-size: .75rem; color: var(--muted); margin-top: .3rem; }

/* ── Feedback ────────────────────────────────────────────────────── */
.feedback-form-section { background: var(--surface); border: 1px solid var(--border); border-radius: .7rem; padding: 1.1rem; margin-bottom: 1.75rem; }
.feedback-form { display: flex; flex-direction: column; gap: .75rem; }
.feedback-cats { display: flex; flex-wrap: wrap; gap: .5rem; }
.feedback-cat { position: relative; cursor: pointer; }
.feedback-cat input { position: absolute; opacity: 0; pointer-events: none; }
.feedback-cat span { display: inline-block; padding: .4rem .75rem; border: 1px solid var(--border); border-radius: 999px; font-size: .82rem; font-weight: 500; color: var(--ink-sec, var(--muted)); transition: all .15s; user-select: none; }
.feedback-cat input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.feedback-cat input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.feedback-textarea { resize: vertical; min-height: 90px; font-family: inherit; }
.feedback-form .btn-primary { align-self: flex-start; }

.feedback-list { display: flex; flex-direction: column; gap: .75rem; }
.feedback-item { background: var(--surface); border: 1px solid var(--border); border-radius: .65rem; padding: .85rem 1rem; transition: opacity .2s; }
.feedback-item.feedback-status-erledigt { opacity: .55; }
.feedback-item-head { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-bottom: .5rem; }
.feedback-badge { font-size: .73rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; background: var(--surface-alt, var(--hover)); color: var(--ink); white-space: nowrap; }
.feedback-badge-bug { background: rgba(231,76,60,.15); color: #e74c3c; }
.feedback-badge-idee { background: rgba(241,196,15,.18); color: #c79a00; }
.feedback-badge-lob { background: rgba(46,204,113,.15); color: #27ae60; }
.feedback-author { font-weight: 600; font-size: .82rem; color: var(--ink); }
.feedback-date { font-size: .73rem; color: var(--muted); margin-left: auto; }
.feedback-msg { font-size: .88rem; line-height: 1.5; color: var(--ink); white-space: pre-wrap; word-break: break-word; margin: 0 0 .6rem; }
.feedback-actions { display: flex; gap: .5rem; }
.feedback-done-tag { font-size: .73rem; color: #27ae60; font-weight: 600; }

/* ── Handy-Optimierung ───────────────────────────────────────────── */
@media (max-width: 600px) {
  .navbar { padding: 0 .5rem; gap: .35rem; }
  .navbar-brand { font-size: .95rem; flex-shrink: 0; }
  /* Icon-Leiste horizontal scrollbar statt abgeschnitten */
  .navbar-nav { gap: .1rem; overflow-x: auto; overflow-y: hidden; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; min-width: 0; }
  .navbar-nav::-webkit-scrollbar { display: none; }
  .navbar-nav > * { flex-shrink: 0; }
  .navbar-icon-btn { font-size: 1.05rem; padding: .35rem; min-width: 38px; min-height: 38px; }
  .navbar-user-btn { padding: .25rem; }
  .btn-logout { padding: .28rem .55rem; font-size: .78rem; }
  .stat-card { padding: .9rem .6rem; }
  .page-title { font-size: 1.4rem; }
  .feedback-cat span { padding: .45rem .7rem; }
  /* Container-Padding etwas knapper */
  .container { padding: 1.5rem 1rem; overflow-x: hidden; }

  /* iOS zoomt beim Fokus rein, wenn die Schrift < 16px ist → fix auf 16px */
  input, select, textarea, .form-control { font-size: 16px; }

  /* Touch-Targets vergrößern */
  .btn, .btn-sm { min-height: 40px; }
  .poll-option-btn { min-height: 40px; }

  /* Sauberes Tap-Feedback ohne grauen iOS/Android-Kasten */
  a, button, .subject-card, .file-item, .poll-option-btn { -webkit-tap-highlight-color: transparent; }

  /* Tabellen/Listen nicht seitlich rauslaufen lassen */
  .file-item, .event-item, .hw-item, .poll-item { word-break: break-word; }

  /* Dashboard-Kalender-Widget: Zellen quadratisch statt von der /calendar-Seite
     geerbten min-height:72px (sonst auf dem Handy zu hoch) */
  .cal-body .cal-cell { min-height: 0; }
}

@media (max-width: 420px) {
  .navbar-icon-btn { font-size: .98rem; min-width: 34px; padding: .3rem; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .stat-value { font-size: 1.6rem; }
  .feedback-date { margin-left: 0; width: 100%; }
}

/* ─── Install-/App-Seite ─────────────────────────────────────────────────── */
.install-page { max-width: 760px; margin: 1.5rem auto 3rem; }
.install-hero {
  text-align: center;
  padding: 2.25rem 1.5rem 2.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(70% 60% at 50% 0%, oklch(0.55 0.22 293 / 0.10), transparent 70%),
    var(--bg);
  box-shadow: var(--shadow-sm);
}
.install-app-icon {
  border-radius: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.install-hero h1 { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.03em; text-wrap: balance; }
.install-lead { color: var(--ink-sec); max-width: 46ch; margin: 0.5rem auto 1.5rem; line-height: 1.55; }
.install-hint { color: var(--muted); font-size: 0.8rem; margin-top: 0.75rem; }

.install-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.install-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
  background: var(--bg);
}
.install-card-head { margin-bottom: 0.75rem; }
.install-os { font-weight: 700; font-size: 1.02rem; }
.install-steps { margin: 0; padding-left: 1.2rem; color: var(--ink-sec); }
.install-steps li { margin: 0.4rem 0; line-height: 1.5; }
.ios-share { display: inline-block; transform: translateY(1px); }
.install-foot { text-align: center; color: var(--muted); font-size: 0.82rem; margin-top: 1.75rem; }
