/*
 * POP Swatch Editorial UI
 *
 * This file owns the shared visual language. style.css continues to contain
 * feature-specific mechanics (session states, calendar geometry, live layout),
 * while every colour, surface and shell decision is normalized here.
 */

:root {
  --bg: #f3efe7;
  --surface: #fffdf9;
  --surface-2: #ebe5da;
  --surface-tint: #eee5dd;
  --border: #d5cdc0;
  --border-strong: #b9afa1;
  --text: #25211d;
  --text-muted: #6a6258;
  --accent: #c74632;
  --accent-2: #8e3024;
  --good: #1c6b48;
  --bad: #a8322c;
  --warn: #835707;
  --radius: 10px;
  --radius-large: 18px;
  --sidebar-width: 15.75rem;
  --content-width: 74rem;
  --shadow-soft: 0 16px 42px rgba(54, 45, 35, 0.08);
  --font-body: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-playful: "Fredoka", "Nunito", "Segoe UI", system-ui, sans-serif;
}

/* Die linke Navigation wechselt zwischen servergerenderten Dokumenten. Die
   native Same-Origin-Transition hält beim Wechsel den bisherigen Frame bis
   der nächste fertig gezeichnet ist, statt kurz die ganze Seite freizulegen.
   Browser ohne View-Transitions-Unterstützung ignorieren die Regel und
   behalten ihre normale Navigation. */
@view-transition {
  navigation: auto;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color-scheme: light;
  scroll-behavior: smooth;
}

/* dvh statt vh: iOS Safari loest vh gegen den GROSSEN Viewport auf (Toolbars
   eingeklappt), sichtbare Adressleiste schneidet unten also ab. vh-Zeile
   bleibt als Fallback fuer Browser ohne dvh davor stehen. */
body,
body:has(.live-studio) {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(circle at 82% -10%, rgba(199, 70, 50, 0.07), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(199, 70, 50, 0.2);
}

a {
  color: var(--accent-2);
  text-underline-offset: 0.16em;
  text-decoration-thickness: 1px;
}

a:hover {
  color: var(--accent);
}

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid rgba(199, 70, 50, 0.34);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  transform: translateY(-150%);
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  background: var(--text);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* App shell ----------------------------------------------------------- */

.app-content {
  min-width: 0;
}

.role-teacher .app-content {
  margin-left: var(--sidebar-width);
}

.container {
  width: min(100%, var(--content-width));
  max-width: none;
  margin: 0 auto;
  padding: 3rem clamp(1.25rem, 3.2vw, 3.75rem) 5rem;
}

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  overflow-y: auto;
  padding: 1.4rem 1rem 1rem;
  border-right: 1px solid var(--border);
  background: rgba(255, 253, 249, 0.92);
  backdrop-filter: blur(18px);
}

/* Der Scrim liegt bewusst NICHT mehr nur im 900px-Block: dort war er auf
   Desktop ein hoehenloses Block-Element im Fluss und konnte das
   Glocken-Popover nicht wegfangen. z-index 38 sitzt absichtlich zwischen
   .teacher-mobile-header/.student-header (35) und .app-sidebar (40) - der
   Header MUSS mitabgedunkelt und unklickbar werden, solange die Schublade
   offen ist. Vorher gewann eine ID-Regel aus dem inzwischen geloeschten
   .topbar-Block (#nav-scrim:not([hidden]), Spezifitaet 1-1-0) gegen diese
   Klassenregel und drueckte den Scrim auf z-index 5 - gemessen bei 393px:
   Scrim 5, Header 35, der Header schwebte also undimmed darueber. */
.nav-scrim {
  position: fixed;
  inset: 0;
  z-index: 38;
  display: block;
  background: rgba(37, 33, 29, 0.42);
  backdrop-filter: blur(2px);
}

/* Das Glocken-Popover soll die Seite nicht abdunkeln - hier faengt der Scrim
   ausschliesslich den Tap ab (siehe app/static/nav-menu.js::setScrimVisible). */
.nav-scrim.nav-scrim-soft {
  background: transparent;
  backdrop-filter: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  color: var(--text);
}

.brand-logo-picture {
  display: block;
  line-height: 0;
}

.brand-logo-image {
  display: block;
  width: auto;
  height: 3.1rem;
  max-width: 11.5rem;
  object-fit: contain;
}

.sidebar-brand {
  margin: 0 0.45rem 2rem;
}

.sidebar-brand .brand-logo-image {
  height: 3.35rem;
  max-width: 11rem;
}

.student-header .brand-logo-image {
  height: 3rem;
  max-width: 10rem;
}

.teacher-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-primary,
.nav-disclosure-links {
  display: flex;
  flex-direction: column;
  gap: 0.16rem;
}

.nav-primary {
  margin-bottom: 0.2rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border);
}

.nav-disclosure {
  border-bottom: 1px solid var(--border);
}

.nav-disclosure-summary {
  display: flex;
  min-height: 2.4rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
  list-style: none;
}

.nav-disclosure-summary::-webkit-details-marker {
  display: none;
}

.nav-disclosure-summary:hover {
  background: rgba(37, 33, 29, 0.045);
  color: var(--text);
}

.nav-disclosure-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.nav-disclosure-chevron {
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  opacity: 0.65;
  transform: rotate(45deg) translate(-0.1rem, 0.1rem);
  transition: transform 0.15s ease;
}

.nav-disclosure[open] > .nav-disclosure-summary .nav-disclosure-chevron {
  transform: rotate(225deg) translate(-0.1rem, 0.1rem);
}

.nav-disclosure-links {
  padding: 0.1rem 0 0.55rem 0.5rem;
}

.app-nav-link {
  position: relative;
  display: flex;
  min-height: 2.25rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.48rem 0.65rem;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 650;
  text-decoration: none;
}

.app-nav-link:hover {
  background: rgba(37, 33, 29, 0.045);
  color: var(--text);
}

.app-nav-link.nav-active {
  background: rgba(199, 70, 50, 0.1);
  color: var(--accent-2);
  font-weight: 800;
}

.app-nav-link.nav-active::before {
  position: absolute;
  top: 0.5rem;
  bottom: 0.5rem;
  left: -0.35rem;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
  content: "";
}

/* Praesenz-Anzeige am "Live"-Nav-Link: Dot + Kurztext, vier klar getrennte
   Zustaende offline/online/Session/Pruefung (Zustand per data-state aus nav-live.js). Der
   Text traegt die Klarheit, die Farbe verstaerkt sie nur. */
.nav-live-status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.nav-live-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.nav-live-status[data-state="offline"] {
  color: var(--text-muted);
  opacity: 0.65;
}

.nav-live-status[data-state="online"] {
  color: var(--warn);
}

.nav-live-status[data-state="session"] {
  color: var(--good);
}

.nav-live-status[data-state="exam"] {
  color: var(--accent);
}

.nav-live-status[data-state="session"] .nav-live-dot,
.nav-live-status[data-state="exam"] .nav-live-dot {
  animation: nav-live-pulse 1.2s ease-in-out infinite;
}

/* Wenn Christian aktiv lernt, soll der ganze Link auffallen, nicht nur der
   kleine Status-Chip. */
.app-nav-link[data-live-state="session"] {
  color: var(--good);
  font-weight: 800;
}

.app-nav-link[data-live-state="exam"] {
  color: var(--accent);
  font-weight: 800;
}

@keyframes nav-live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(28, 107, 72, 0.55); }
  70% { box-shadow: 0 0 0 5px rgba(28, 107, 72, 0); }
  100% { box-shadow: 0 0 0 0 rgba(28, 107, 72, 0); }
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }

  .nav-live-status[data-state="session"] .nav-live-dot,
  .nav-live-status[data-state="exam"] .nav-live-dot {
    animation: none;
  }
}

.sidebar-utility {
  display: grid;
  gap: 0.25rem;
  margin-top: 1.5rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.sidebar-utility .nav-dropdown {
  position: static;
}

.nav-bell-toggle,
.nav-logout {
  display: flex;
  width: 100%;
  min-height: 2.35rem;
  align-items: center;
  justify-content: flex-start;
  gap: 0.65rem;
  padding: 0.5rem 0.65rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font: 650 0.84rem var(--font-body);
  text-align: left;
}

.nav-bell-toggle:hover,
.nav-logout:hover {
  background: rgba(37, 33, 29, 0.045);
  color: var(--text);
  filter: none;
}

.nav-bell-icon {
  flex: 0 0 auto;
  fill: currentColor;
}

.nav-bell-badge {
  position: static;
  display: inline-grid;
  min-width: 1.35rem;
  height: 1.35rem;
  margin-left: auto;
  place-items: center;
  border: 2px solid var(--surface);
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.66rem;
  line-height: 1;
}

.nav-dropdown-panel.nav-bell-panel {
  position: fixed;
  z-index: 90;
  display: none;
  width: min(24rem, calc(100vw - 1rem));
  max-height: min(34rem, calc(100vh - 2rem));
  max-height: min(34rem, calc(100dvh - 2rem));
  overscroll-behavior: contain;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 20px 60px rgba(45, 37, 29, 0.2);
}

.nav-dropdown-panel.nav-bell-panel.open {
  display: flex;
}

.nav-bell-header {
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border);
}

.nav-bell-mark-read {
  width: auto;
  min-height: 0;
  padding: 0;
  background: transparent;
  color: var(--accent-2);
  font-size: 0.76rem;
}

.nav-bell-list .nav-bell-item {
  padding: 0.8rem 1.1rem;
  border-bottom-color: var(--border);
  color: var(--text);
}

.nav-bell-list .nav-bell-item:hover,
.nav-bell-list .nav-bell-item.unread {
  background: rgba(199, 70, 50, 0.06);
}

.nav-bell-panel .nav-bell-footer {
  padding: 0.75rem 1.1rem;
  color: var(--accent-2);
}

.teacher-mobile-header {
  display: none;
}

.student-header {
  position: sticky;
  top: 0;
  z-index: 35;
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 1rem;
  min-height: 4.6rem;
  padding: 0.75rem clamp(1rem, 3vw, 2.5rem);
  border-bottom: 1px solid rgba(185, 175, 161, 0.75);
  background: rgba(243, 239, 231, 0.9);
  backdrop-filter: blur(18px);
}

.student-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
}

.student-nav .app-nav-link {
  padding-inline: 0.8rem;
}

.student-nav .app-nav-link.nav-active::before {
  inset: auto 0.8rem -0.83rem;
  width: auto;
  height: 3px;
}

.student-header .logout-form {
  margin: 0;
}

.student-header .nav-logout {
  width: auto;
}

/* Typography and page rhythm ----------------------------------------- */

h1,
h2,
h3 {
  color: var(--text);
  font-family: var(--font-display);
  text-wrap: balance;
}

h1 {
  max-width: 18ch;
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.02;
}

h2 {
  margin: clamp(2.5rem, 6vw, 4.5rem) 0 1rem;
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1rem;
}

.section-title {
  margin-top: 0;
}

.live-buffalo-total {
  margin-left: 0.4rem;
}

p.subtitle {
  max-width: 68ch;
  margin: 0.5rem 0 1rem;
  color: var(--text-muted);
  font-size: 1rem;
}

.container > p.subtitle,
.page-header > p.subtitle,
.live-studio > p.subtitle,
.settings-studio > p.subtitle {
  margin-bottom: 2.5rem;
}

.muted {
  color: var(--text-muted);
}

.settings-eyebrow,
.page-eyebrow {
  margin: 0 0 0.55rem;
  color: var(--accent-2);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* Flat sections and object surfaces ---------------------------------- */

.card {
  margin: 0;
  padding: 1.45rem 0;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
}

.card + .card {
  margin-top: 0;
}

.card-header,
.live-section-title {
  margin-bottom: 0.85rem;
  color: #81776b;
  font-size: 0.67rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.card-title {
  font-size: 1.2rem;
  font-weight: 800;
}

.flashcard,
.flashcard-mini,
.login-card,
.empty-state,
dialog,
#live-picker-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.flashcard::before {
  content: none;
}

.flashcard-mini {
  min-width: 0;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(54, 45, 35, 0.05);
}

.flashcard-mini .muted,
.flashcard-mini p {
  min-width: 0;
  overflow-wrap: anywhere;
}

.empty-state {
  max-width: 46rem;
  margin: 3rem auto;
  padding: clamp(2rem, 6vw, 4.5rem);
  text-align: center;
}

.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 1rem;
}

.login-card {
  width: min(100%, 28rem);
  max-width: 28rem;
  padding: clamp(2rem, 7vw, 3.25rem);
}

.login-brand-logo {
  display: block;
  width: min(100%, 21rem);
  height: auto;
  margin: 0 auto 1.5rem;
}

.login-card h1:not(.visually-hidden) {
  max-width: none;
  margin-bottom: 1.5rem;
  color: var(--text);
  font-size: clamp(1.8rem, 7vw, 2.6rem);
  text-align: center;
}

.empty-state h1,
.empty-state .subtitle {
  margin-inline: auto;
}

#custom-exam-create-card,
#vacation-create-card,
#vacation-direct-card,
#goal-create-card,
#catalog-import-card,
#report-generate-card,
#buffalos-manual-card,
.buffalos-manual-card {
  margin: 1.25rem 0 2rem;
  padding: clamp(1.15rem, 2.5vw, 1.75rem);
  border: 1px solid rgba(199, 70, 50, 0.2);
  border-radius: 14px;
  background: rgba(255, 253, 249, 0.66);
}

#goals-list .goal-card,
#custom-exams-list .custom-exam-card {
  margin: 1rem 0;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 253, 249, 0.64);
}

#notifications-list .goal-card,
#reports-list .goal-card,
#vacation-student-list .goal-card,
#vacation-pending-list .goal-card,
#vacation-history-list .goal-card {
  padding-block: 1.15rem;
  border-top: 0;
  border-bottom: 1px solid var(--border);
}

/* Metrics become one readable strip, not a wall of boxes. */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0;
  margin: 1.75rem 0;
  border-block: 1px solid var(--border);
}

.stat-box {
  min-width: 0;
  padding: 1.15rem clamp(0.75rem, 2vw, 1.4rem);
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  text-align: left;
}

.stat-box:last-child {
  border-right: 0;
}

.stat-box .value {
  color: var(--text);
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  font-weight: 850;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.stat-box .label {
  margin-top: 0.4rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.card-stats {
  border-top: 1px solid var(--border);
}

.stat-row {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.stat-value {
  color: var(--text);
  font-weight: 800;
}

/* Controls ------------------------------------------------------------ */

button,
.btn {
  min-height: 2.75rem;
  padding: 0.7rem 1.2rem;
  border: 1px solid var(--accent);
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font: 800 0.9rem var(--font-body);
  box-shadow: none;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

/* Hover-Zustaende nur dort, wo es einen echten Zeiger gibt. iOS wendet :hover
   beim Antippen an und LAESST ES STEHEN, bis woanders hingetippt wird - ohne
   diese Schranke bleibt jeder angetippte Knopf dunkel und 1px angehoben, ein
   .btn-secondary kippt komplett auf invertiert, und eine angetippte
   Tabellenzeile bleibt markiert, was wie eine Auswahl aussieht, die es nicht
   gibt. :active und :focus-visible bleiben unangetastet - die sind auf Touch
   das richtige Feedback. */
@media (hover: hover) and (pointer: fine) {
  button:hover,
  .btn:hover {
    background: var(--accent-2);
    border-color: var(--accent-2);
    color: #fff;
    filter: none;
    transform: translateY(-1px);
  }
}

button:active,
.btn:active {
  transform: translateY(0);
}

.btn-secondary {
  border-color: var(--border-strong);
  background: transparent;
  color: var(--text);
}

@media (hover: hover) and (pointer: fine) {
  .btn-secondary:hover {
    border-color: var(--text);
    background: var(--text);
    color: #fff;
  }
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="file"],
select,
textarea {
  min-height: 2.75rem;
  padding: 0.62rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.7);
  color: var(--text);
  font-family: var(--font-body);
}

input:focus,
select:focus,
textarea:focus,
.settings-studio input[type="text"]:focus,
.settings-studio input[type="number"]:focus,
.settings-studio select:focus,
.settings-studio textarea:focus {
  outline: 3px solid rgba(199, 70, 50, 0.18);
  border-color: var(--accent);
  box-shadow: none;
}

label {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.actions {
  align-items: center;
  gap: 0.6rem;
}

.settings-tabs {
  gap: 1.4rem;
  overflow-x: auto;
  flex-wrap: nowrap;
  margin: 0 0 1.5rem;
  padding: 0;
  border-bottom: 1px solid var(--border);
  scrollbar-width: thin;
}

.tab-btn,
.settings-studio .tab-btn {
  min-height: 2.75rem;
  flex: 0 0 auto;
  padding: 0.2rem 0 0.65rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  font: 700 0.86rem var(--font-body);
  box-shadow: none;
}

.tab-btn:hover,
.settings-studio .tab-btn:hover {
  border: 0;
  background: transparent;
  color: var(--text);
  transform: none;
}

.tab-btn.active,
.settings-studio .tab-btn.active {
  border: 0;
  background: transparent;
  color: var(--accent-2);
  box-shadow: inset 0 -3px 0 var(--accent);
}

/* Statistics --------------------------------------------------------- */

.stats-main-tabs {
  margin-top: 2rem;
}

.stats-tab-panel {
  min-width: 0;
}

.stats-section {
  margin-top: clamp(2rem, 5vw, 3.5rem);
}

.stats-section > h2,
.stats-summary-card > h2 {
  margin: 0 0 0.9rem;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  letter-spacing: -0.02em;
}

.stats-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: clamp(2rem, 5vw, 3.5rem);
}

.stats-summary-card {
  margin: 0;
}

.stats-summary-card-wide {
  grid-column: 1 / -1;
}

.stats-summary-card p:last-child {
  margin-bottom: 0;
}

.stats-period-tabs {
  margin-bottom: 0.5rem;
}

.stats-export-card {
  max-width: 52rem;
}

.stats-export-card label {
  display: block;
  margin-bottom: 0.35rem;
}

.stats-export-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.stats-export-range input,
.stats-export-card select {
  width: 100%;
}

.competency-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 750;
  text-align: left;
}

.competency-detail-row > td {
  padding-top: 0;
  background: rgba(142, 48, 36, 0.035);
}

.competency-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  padding: 1rem;
}

.competency-detail-grid ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
}

.competency-detail-grid li + li { margin-top: 0.35rem; }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
}

.pill-good { background: rgba(28, 107, 72, 0.11); color: var(--good); }
.pill-bad { background: rgba(168, 50, 44, 0.11); color: var(--bad); }
.pill-warn { background: rgba(131, 87, 7, 0.12); color: var(--warn); }
.pill-box { background: rgba(199, 70, 50, 0.1); color: var(--accent-2); }

/* Tables -------------------------------------------------------------- */

.table-scroll {
  margin-inline: -0.65rem;
  padding-inline: 0.65rem;
}

table {
  font-size: 0.86rem;
}

th,
td {
  padding: 0.72rem 0.6rem;
  border-bottom-color: var(--border);
}

th {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

tr:hover td {
  background: rgba(255, 253, 249, 0.55);
}

.box-detail-row td {
  background: rgba(255, 253, 249, 0.45);
}

.box-card-item {
  border-color: var(--border);
  background: var(--surface);
}

/* Student dashboard --------------------------------------------------- */

.role-student .container {
  max-width: 67rem;
}

.role-student h1,
.role-student .session-arcade h1,
.role-student .session-arcade .card-title,
.role-student .session-arcade #feedback-headline {
  font-family: var(--font-playful);
}

.student-page-header {
  max-width: 50rem;
}

.student-dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.75fr) minmax(22rem, 1.25fr);
  align-items: end;
  gap: clamp(1.5rem, 4vw, 4.5rem);
}

.student-dashboard-hero .page-header > .subtitle {
  margin-bottom: 0;
}

.today-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  margin: 0;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border-radius: var(--radius-large);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 20px 45px rgba(142, 48, 36, 0.16);
}

.today-panel h2 {
  margin: 0.2rem 0 0.35rem;
  color: #fff;
  font: 700 clamp(1.35rem, 3vw, 2rem) var(--font-playful);
  letter-spacing: -0.025em;
}

.today-panel p {
  max-width: 52ch;
  margin: 0;
  color: #fff;
}

.today-kicker {
  color: #fff;
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.today-panel .today-action {
  flex: 0 0 auto;
  border-color: #fff;
  background: #fff;
  color: var(--accent-2);
  white-space: nowrap;
}

.today-panel .today-action:hover {
  border-color: var(--text);
  background: var(--text);
  color: #fff;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.25rem;
  margin-top: clamp(2.5rem, 7vw, 5rem);
}

.student-dashboard-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(20rem, 0.9fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  margin-top: clamp(2.5rem, 5vw, 4rem);
}

.student-dashboard-section {
  min-width: 0;
}

.student-dashboard-section .section-heading {
  margin-top: 0;
}

.student-dashboard-section .grid-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 1.25rem 0 0.45rem;
}

.student-dashboard-section .stat-box:nth-child(2n) {
  border-right: 0;
}

.student-dashboard-section .stat-box:nth-child(n + 3) {
  border-top: 1px solid var(--border);
}

.student-dashboard-plan .calendar-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 1.25rem 0 0;
}

.student-dashboard-plan .calendar-preview-item {
  min-width: 0;
  padding: 0.85rem 0.9rem;
}

.student-dashboard-plan .calendar-preview-item:nth-child(2n) {
  border-right: 0;
}

.student-dashboard-plan .calendar-preview-item:nth-child(n + 3) {
  border-top: 1px solid var(--border);
}

.section-heading h2 {
  margin: 0;
}

.section-heading .page-eyebrow {
  margin-bottom: 0.3rem;
}

.section-heading > a {
  flex: 0 0 auto;
  font-size: 0.82rem;
  font-weight: 800;
}

.student-goal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.role-student .student-goal-card {
  margin: 0;
  padding: 1.25rem;
  border: 1px solid rgba(199, 70, 50, 0.2);
  background: rgba(255, 253, 249, 0.72);
}

.role-student .student-goal-card .progress-bar {
  margin: 1rem 0 0.5rem;
}

.role-student .student-goal-card p:last-child {
  margin-bottom: 0;
}

.role-student .buffalo-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 1rem;
}

.role-student .buffalo-card .pop-header {
  width: 100%;
}

.buffalo-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.3rem 0;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.buffalo-line strong {
  color: var(--bad);
}

.buffalo-line a {
  font-weight: 750;
}

.calendar-preview {
  gap: 0;
  margin: 1.75rem 0;
  border-block: 1px solid var(--border);
}

.calendar-preview-item,
.calendar-preview-link {
  padding: 1rem;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
}

.calendar-preview-item:last-of-type,
.calendar-preview-link:last-child {
  border-right: 0;
}

.calendar-preview-today {
  background: rgba(199, 70, 50, 0.055);
}

.calendar-preview-label {
  color: var(--text-muted);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
}

.calendar-preview-link {
  color: var(--accent-2);
}

/* Teacher dashboard --------------------------------------------------- */

.teacher-status-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  margin: 1rem 0 2.5rem;
  padding: clamp(1.4rem, 3vw, 2rem);
  border-radius: var(--radius-large);
  background: var(--text);
  color: #fff;
  box-shadow: var(--shadow-soft);
}

.teacher-status-hero h2 {
  margin: 0.25rem 0;
  color: #fff;
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.teacher-status-hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
}

.teacher-status-hero .today-kicker {
  color: rgba(255, 255, 255, 0.58);
}

.teacher-status-hero .status-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: #91887d;
}

.teacher-status-hero .status-dot.is-live {
  background: #57c68b;
  box-shadow: 0 0 0 5px rgba(87, 198, 139, 0.12);
}

.teacher-status-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.55rem;
}

.teacher-status-actions form {
  margin: 0;
}

.teacher-status-hero .btn-secondary {
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}

.teacher-status-hero .btn-secondary:hover {
  border-color: #fff;
  background: #fff;
  color: var(--text);
}

.teacher-action-center {
  margin: -1rem 0 2.5rem;
  padding: clamp(1.25rem, 3vw, 1.75rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  background: var(--surface);
}

.teacher-action-center-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.teacher-action-center-head h2 {
  margin: 0.2rem 0 0;
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
}

.teacher-action-count {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 50%;
  background: var(--text);
  color: #fff;
  font-weight: 700;
}

.teacher-action-list {
  display: grid;
}

.teacher-action-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 0 1.1rem 1rem;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--accent-2);
}

.teacher-action-item:last-child {
  border-bottom: 0;
}

.teacher-action-item.is-urgent { border-left-color: var(--bad); }
.teacher-action-item.is-attention { border-left-color: #b87917; }
.teacher-action-item.is-info { border-left-color: var(--accent-2); }

.teacher-action-copy h3 {
  margin: 0.15rem 0;
  font-size: 1rem;
}

.teacher-action-copy p,
.teacher-action-empty span {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.teacher-action-tone {
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.teacher-action-empty {
  display: flex;
  gap: 0.5rem;
  padding-top: 1rem;
}

/* Session-Debrief ---------------------------------------------------- */

.session-debrief,
.student-difficulty-card,
.session-teacher-message {
  margin-top: 2rem;
}

/* Curriculum-/Freischaltungsplan ------------------------------------ */

.learning-plan-section { margin-top: clamp(2rem, 5vw, 3.5rem); }
.learning-plan-section h2 { margin-bottom: 0.25rem; }

.learning-plan-preview {
  display: grid;
  grid-template-columns: repeat(7, minmax(8rem, 1fr));
  gap: 0.6rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.learning-plan-day {
  display: grid;
  align-content: start;
  gap: 0.35rem;
  min-height: 9rem;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent-2);
  border-radius: var(--radius-small);
  background: var(--surface);
}

.learning-plan-day.is-exam { border-top-color: #b87917; }
.learning-plan-day time { color: var(--text-muted); font-size: 0.78rem; }
.learning-plan-day-cards { display: flex; flex-wrap: wrap; gap: 0.3rem; }

.learning-plan-queue { display: grid; gap: 0.7rem; }

.learning-plan-item {
  display: grid;
  grid-template-columns: auto minmax(12rem, 1fr) minmax(10rem, auto) auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface);
}

.learning-plan-position {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 50%;
  background: var(--text);
  color: #fff;
  font-weight: 800;
}

.learning-plan-item-copy { display: grid; gap: 0.2rem; }
.learning-plan-item-copy > span { color: var(--text-muted); }
.learning-plan-date { display: grid; gap: 0.25rem; font-size: 0.75rem; color: var(--text-muted); }
.learning-plan-order-actions { display: flex; gap: 0.35rem; }

.learning-plan-picker { margin-top: clamp(2rem, 5vw, 3.5rem); }
.learning-plan-picker-controls {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 0.75rem;
}
.learning-plan-picker-controls label { display: grid; gap: 0.3rem; }

.learning-plan-candidates {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 0.6rem;
  max-height: 28rem;
  margin: 1rem 0;
  overflow-y: auto;
}

.learning-plan-candidate {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.55rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  cursor: pointer;
}

.learning-plan-candidate.is-selected {
  border-color: var(--accent-2);
  background: rgba(199, 70, 50, 0.06);
}
.learning-plan-candidate small,
.learning-plan-candidate .card-tally { grid-column: 2; color: var(--text-muted); }

.session-debrief-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.session-debrief-head h2,
.student-difficulty-card h2,
.session-teacher-message h2 {
  margin: 0.2rem 0 0.5rem;
}

.session-debrief-errors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.6rem;
  margin: 1rem 0;
}

.session-debrief-error {
  display: grid;
  gap: 0.1rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  color: var(--text);
  text-decoration: none;
}

.session-debrief-error:hover { border-color: var(--accent-2); }
.session-debrief-error span,
.session-debrief-error small { color: var(--text-muted); }

.session-debrief-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 1rem 0 1.5rem;
}

.session-debrief-actions details {
  flex: 1 1 15rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
}

.session-debrief-actions summary {
  cursor: pointer;
  font-weight: 700;
}

.session-debrief-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.session-debrief-form {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.session-debrief-grid .session-debrief-form {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
}

.session-debrief-form h3 { margin: 0; }
.session-debrief-form label { display: grid; gap: 0.3rem; }
.session-debrief-form textarea { resize: vertical; }

.student-difficulty-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.student-difficulty-options .is-selected {
  border-color: var(--accent-2);
  background: var(--accent-2);
  color: #fff;
}

.session-teacher-message {
  border-left: 4px solid var(--accent-2);
}

.teacher-overview-stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.teacher-dashboard-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 2.5rem;
  margin-top: 2rem;
  border-top: 1px solid var(--border);
}

.teacher-dashboard-grid .card {
  padding: 1.5rem 0 2rem;
  border-top: 0;
  border-bottom: 1px solid var(--border);
}

.teacher-dashboard-grid .card:nth-child(odd):not(.card-exam-termine) {
  padding-right: 2.5rem;
  border-right: 1px solid var(--border);
}

.teacher-dashboard-grid .card-exam-termine {
  padding-top: 2rem;
}

.learning-scope-formula {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.55rem;
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.dashboard-week h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1rem;
}

.dashboard-week .stat-value-text {
  max-width: 55%;
  font-size: 0.95rem;
  line-height: 1.25;
  text-align: right;
}

/* Session, Live and Settings share the same family ------------------- */

.session-arcade,
.live-studio,
.settings-studio {
  --bg: #f3efe7;
  --surface: #fffdf9;
  --surface-2: #ebe5da;
  --border: #d5cdc0;
  --text: #25211d;
  --text-muted: #6a6258;
  --accent: #c74632;
  --accent-2: #8e3024;
  --good: #1c6b48;
  --bad: #a8322c;
  --warn: #835707;
  --radius: 10px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
}

.session-arcade button,
.session-arcade .btn,
.settings-studio button,
.settings-studio .btn {
  color: #fff;
}

.session-arcade .btn-secondary,
.settings-studio .btn-secondary {
  color: var(--text);
}

.session-arcade .flashcard,
.session-arcade .flashcard-mini,
.live-studio .flashcard,
.live-studio .flashcard-mini {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.session-arcade .flashcard::before,
.live-studio .flashcard::before {
  content: none;
}

.session-arcade .flashcard-stage {
  border-radius: var(--radius-large);
}

.session-arcade #start-prompt h1::after,
.session-arcade #learn-phase h1::after,
.session-arcade #quiz-phase h1::after,
.session-arcade #pop-year-phase h1::after {
  content: none;
}

.session-arcade .option-btn {
  border-color: var(--border-strong);
  background: rgba(255, 253, 249, 0.8);
  color: var(--text);
  box-shadow: none;
}

.session-arcade .option-btn:hover,
.session-arcade .option-btn.selected {
  border-color: var(--accent);
  background: rgba(199, 70, 50, 0.08);
  color: var(--accent-2);
}

.session-arcade .progress-bar,
.live-studio .progress-bar {
  border: 0;
  background: var(--surface-2);
}

.session-arcade .progress-bar .fill,
.live-studio .progress-bar .fill {
  background: var(--accent);
}

/* Fokus-Strafe-Countdown (#session-focus-penalty/#live-focus-penalty-fill via
   renderTimingStats) - muss die obige themenweite .fill-Regel ueberstimmen. */
.session-arcade .progress-bar .fill.penalty-caution,
.live-studio .progress-bar .fill.penalty-caution {
  background: var(--warn);
}
.session-arcade .progress-bar .fill.penalty-warn,
.live-studio .progress-bar .fill.penalty-warn {
  background: var(--bad);
  animation: quiz-timer-pulse 1s ease-in-out infinite;
}

.session-arcade #feedback-box {
  margin-top: 1rem;
  padding: 1.2rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.live-layout {
  grid-template-columns: minmax(0, 1fr) minmax(14rem, 17rem);
  gap: clamp(2rem, 4vw, 4rem);
}

.live-sidebar {
  position: static;
  gap: 0;
}

.live-sidebar .card,
.live-main .card {
  padding: 1.1rem 0;
  border-top: 1px solid var(--border);
  box-shadow: none;
}

.live-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 2rem;
}

.live-sidebar > * + * {
  margin-top: 1.25rem;
}

.live-interruptions-card > summary,
.live-buffalo-card > summary,
.live-secondary-actions > summary {
  cursor: pointer;
}

.live-interruptions-card[open] > summary,
.live-buffalo-card[open] > summary,
.live-secondary-actions[open] > summary {
  margin-bottom: 0.75rem;
}

.live-coaching-control {
  display: grid;
  gap: 0.45rem;
}

.live-coaching-control label {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.live-secondary-actions .live-actions-stacked {
  margin-top: 0.65rem;
}

.live-control-error {
  color: var(--bad);
}

.session-coaching-banner {
  margin-bottom: 1rem;
  border-left: 3px solid var(--accent);
}

.session-help-tools {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.live-presence-card {
  text-align: left;
}

.live-presence-head {
  justify-content: flex-start;
}

.live-attempt-card {
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
}

.live-attempt-card:hover,
.live-studio .live-attempt-card:hover {
  border-color: var(--border);
  background: rgba(255, 253, 249, 0.5);
}

.live-studio .card {
  box-shadow: none;
}

.live-ai-collapsible {
  margin-bottom: 1.75rem;
}

.settings-studio .settings-eyebrow {
  color: var(--accent-2);
  font: 850 0.68rem var(--font-body);
}

.settings-studio .settings-card {
  padding-top: 0;
  border-top: 0;
}

.settings-studio input[type="text"],
.settings-studio input[type="number"],
.settings-studio select,
.settings-studio textarea {
  font-family: var(--font-body);
  font-weight: 650;
}

.settings-studio .field-group-heading {
  color: var(--text-muted);
  font: 850 0.68rem var(--font-body);
}

.settings-studio .field-value {
  color: var(--accent-2);
  font-family: var(--font-body);
}

.settings-studio .mode-toggle {
  border-color: var(--border);
  background: var(--surface-2);
}

.settings-studio .mode-option.active {
  background: var(--accent);
}

.settings-studio .mode-option.active strong,
.settings-studio .mode-option.active span {
  color: #fff;
}

.settings-studio .toggle-switch-label input[type="checkbox"]:checked {
  border-color: var(--accent);
  background: var(--accent);
}

.settings-studio .toggle-switch-label input[type="checkbox"]:checked::before {
  background: #fff;
}

.settings-studio .settings-collapsible,
.settings-studio .mehr-card {
  border-color: var(--border);
  background: transparent;
}

.settings-studio .settings-savebar {
  position: sticky;
  bottom: 0.75rem;
  z-index: 5;
  /* Steht seit dem Umzug ans Studio-Ende nicht mehr im Karten-Innenabstand,
     der negative Ausgleich dafuer entfaellt entsprechend. */
  margin-top: 1.25rem;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 253, 249, 0.94);
  box-shadow: 0 12px 35px rgba(54, 45, 35, 0.11);
  backdrop-filter: blur(12px);
}

/* Calendar and utility views ----------------------------------------- */

#calendar-card {
  padding: clamp(1rem, 2.5vw, 1.5rem);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 253, 249, 0.55);
}

.armband-facts-panel {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 253, 249, 0.55);
}

.calendar-day {
  border-color: var(--border);
  background: rgba(255, 253, 249, 0.5);
}

.heatmap-legend {
  min-width: 0;
  flex-wrap: wrap;
  gap: 0.55rem 1.1rem;
}

.goal-form {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
}

.goal-form > * {
  min-width: 0;
}

.cal-menu,
#live-picker-dialog {
  border-color: var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.forced-session-banner {
  border-bottom-color: rgba(131, 87, 7, 0.28);
  background: #f5e8c9;
  color: #684400;
}

.toast {
  border-color: var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.receipt-page,
.receipt-page body {
  background: var(--bg);
  color: var(--text);
}

/* Responsive ---------------------------------------------------------- */

/* Christian Status 360 ------------------------------------------------ */
.status-page {
  --status-blue: #416f86;
  --status-mint: #4f8d78;
  --status-coral: #d8674f;
  --status-buffalo: #9e4a3c;
}

.status-page-header,
.status-section-heading,
.status-card-heading,
.status-chart-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.status-page-header {
  margin-bottom: 1.5rem;
}

.status-page-header h1,
.status-section-heading h2,
.status-card-heading h3,
.status-chart-heading h3 {
  margin-bottom: 0;
}

.status-updated {
  white-space: nowrap;
}

.status-glass {
  border: 1px solid rgba(74, 63, 50, 0.14);
  border-radius: 1.2rem;
  padding: clamp(1.1rem, 2vw, 1.6rem);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(255, 250, 241, 0.54)),
    rgba(255, 253, 249, 0.62);
  box-shadow: 0 18px 42px rgba(63, 50, 37, 0.08);
  backdrop-filter: blur(18px) saturate(120%);
}

.status-presence {
  display: grid;
  grid-template-columns: minmax(15rem, 1.1fr) minmax(23rem, 1.7fr) auto;
  align-items: center;
  gap: clamp(1rem, 3vw, 2.5rem);
  overflow: hidden;
  position: relative;
}

.status-presence::after {
  content: "";
  position: absolute;
  width: 15rem;
  height: 15rem;
  right: 18%;
  top: -10rem;
  border-radius: 50%;
  background: rgba(78, 143, 125, 0.12);
  pointer-events: none;
}

.status-presence-main {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.status-presence-main h2,
.status-presence-main p {
  margin: 0;
}

.status-presence .today-kicker {
  color: var(--accent);
}

.status-presence-dot {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #9a9288;
  box-shadow: 0 0 0 0.45rem rgba(154, 146, 136, 0.12);
}

.status-presence-dot.is-online {
  background: var(--status-mint);
  box-shadow: 0 0 0 0.45rem rgba(79, 141, 120, 0.14);
}

.status-presence-dot.is-learning {
  background: var(--status-coral);
  box-shadow: 0 0 0 0.45rem rgba(216, 103, 79, 0.15);
}

.status-contact-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
}

.status-contact-grid > div {
  min-width: 0;
  padding: 0.25rem 1rem;
  border-left: 1px solid var(--border);
}

.status-contact-grid span,
.status-contact-grid strong {
  display: block;
}

.status-contact-grid span {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status-contact-grid strong {
  margin-top: 0.25rem;
  font-size: 0.95rem;
}

.status-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 1.5rem 0 2.5rem;
}

.status-stat-box {
  min-height: 8rem;
}

.status-stat-detail {
  margin-top: 0.45rem;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.status-section-heading {
  margin: 2.75rem 0 1rem;
}

.status-progress-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(18rem, 0.8fr);
  gap: 1rem;
}

.status-progress-meter + .status-progress-meter {
  margin-top: 1rem;
}

.status-progress-meter > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.status-progress-meter .progress-bar {
  margin: 0;
}

.status-box-distribution {
  display: flex;
  min-height: 5rem;
  margin: 1.35rem 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
}

.status-box-segment {
  display: flex;
  min-width: 2rem;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: #332d27;
  border-right: 1px solid rgba(255, 255, 255, 0.68);
}

.status-box-segment:last-child {
  border-right: 0;
}

.status-box-segment span {
  font-size: 0.68rem;
  opacity: 0.7;
}

.status-box-segment.is-compact span {
  display: none;
}

.status-box-0 { background: #eee8df; }
.status-box-1 { background: #f1c2b6; }
.status-box-2 { background: #efd49d; }
.status-box-3 { background: #d9dfa8; }
.status-box-4 { background: #b9d8c7; }
.status-box-5 { background: #8cc2ad; }

.status-progress-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.status-progress-facts > div {
  padding: 0.75rem;
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.58);
}

.status-progress-facts span,
.status-progress-facts strong {
  display: block;
}

.status-progress-facts span {
  color: var(--text-muted);
  font-size: 0.76rem;
}

.status-goal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}

.status-goal-row:last-child {
  border-bottom: 0;
}

.status-goal-row strong,
.status-goal-row span {
  display: block;
}

.status-goal-row > div > span {
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.status-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.status-chart-wide {
  grid-column: 1 / -1;
}

.status-chart-heading {
  align-items: baseline;
}

.status-chart-heading span {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.status-chart {
  min-height: 14rem;
  margin-top: 0.8rem;
}

.status-chart-empty {
  display: grid;
  min-height: 13rem;
  place-items: center;
  margin: 0;
}

.status-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

/* Groesse kommt aus app/static/charts.js::applyChartLabels und richtet sich
   nach der tatsaechlich gerenderten Breite - 18 feste Einheiten der 720er
   viewBox landeten auf dem Telefon als 8.1px. Der Literalwert bleibt als
   Fallback stehen, falls das Skript die Eigenschaft nicht setzt. */
.status-chart-svg text {
  fill: var(--text-muted);
  font-family: "Nunito", sans-serif;
  font-size: var(--chart-label-size, 18px);
}

/* Unsichtbares Trefferfeld ueber Balken/Punkt - siehe charts.js::bindValue. */
.status-chart-hit {
  fill: transparent;
  cursor: pointer;
}

.status-chart-hit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.status-chart-bar.is-selected,
.status-chart-point.is-selected {
  fill: var(--accent);
}

.status-chart-point.is-selected {
  r: 7;
}

/* Antwortzeile fuer den angetippten Wert. Leer nimmt sie keinen Platz weg. */
.status-chart-readout {
  margin: 0.4rem 0 0;
  min-height: 1.35em;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
}

.status-chart-readout:empty {
  min-height: 0;
}

/* Vollstaendige Werte, zugeklappt: der Weg, der auch dann traegt, wenn ein Tap
   auf einem SVG-Kindelement nicht ankommt. */
.status-chart-table {
  margin-top: 0.5rem;
}

.status-chart-table > summary {
  color: var(--accent-2);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  min-height: 2.75rem;
  display: flex;
  align-items: center;
}

.status-chart-table table {
  font-size: 0.82rem;
}

.status-chart-bar {
  fill: var(--status-blue);
}

.status-chart-bar.is-coral {
  fill: var(--status-coral);
}

.status-chart-bar.is-buffalo {
  fill: var(--status-buffalo);
}

.status-chart-line {
  stroke: var(--status-blue);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.status-chart-point {
  fill: #fffdf9;
  stroke: var(--status-blue);
  stroke-width: 4;
}

.status-error {
  margin-top: 1rem;
  border-color: rgba(176, 55, 42, 0.35);
}

/* Teacher-only POP detail --------------------------------------------- */

.pop-detail-link {
  color: inherit;
  font-weight: inherit;
  text-decoration-color: rgba(199, 70, 50, 0.42);
  text-underline-offset: 0.16em;
}

.pop-detail-link:hover {
  color: var(--accent-2);
  text-decoration-color: currentColor;
}

.pop-detail-hero {
  display: grid;
  grid-template-columns: minmax(16rem, 0.78fr) minmax(0, 1.22fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: center;
  margin: 1.5rem 0 3rem;
}

.pop-detail-photo {
  display: grid;
  min-height: 24rem;
  overflow: hidden;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.pop-detail-photo img {
  display: block;
  width: 100%;
  max-height: 34rem;
  object-fit: contain;
}

.pop-detail-photo .photo-placeholder {
  color: var(--text-muted);
}

.pop-detail-intro h1 {
  margin: 0.7rem 0 0;
  overflow-wrap: anywhere;
}

.pop-detail-name {
  margin: 0.25rem 0 0;
  color: var(--text);
  font-size: clamp(1.25rem, 3vw, 2rem);
  font-weight: 800;
}

.pop-detail-actions {
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.pop-detail-actions form {
  margin: 0;
}

.pop-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.5rem, 4vw, 3rem);
  margin: 2rem 0;
}

.pop-detail-grid > section {
  min-width: 0;
}

.pop-detail-facts > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}

.pop-detail-facts > div:last-child {
  border-bottom: 0;
}

.pop-detail-facts span {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.pop-detail-facts strong {
  max-width: 62%;
  overflow-wrap: anywhere;
  text-align: right;
}

.pop-detail-facts .is-missing strong {
  color: var(--bad);
}

.pop-detail-message {
  margin-block: 1rem;
}

.notification-pop-links {
  display: inline;
  margin-left: 0.35rem;
  font-size: 0.82rem;
}

@media (max-width: 1100px) {
  .status-presence {
    grid-template-columns: 1fr;
  }

  .status-contact-grid > div:first-child {
    border-left: 0;
  }

  .status-presence > .btn {
    justify-self: start;
  }

  .status-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .pop-detail-hero,
  .pop-detail-grid {
    grid-template-columns: 1fr;
  }

  .pop-detail-photo {
    min-height: 16rem;
  }

  .pop-detail-actions,
  .pop-detail-actions form,
  .pop-detail-actions button,
  .pop-detail-actions .btn {
    width: 100%;
  }

  .pop-detail-actions .btn {
    text-align: center;
  }

  .status-page-header,
  .status-section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-updated {
    white-space: normal;
  }

  .status-contact-grid,
  .status-progress-grid,
  .status-chart-grid {
    grid-template-columns: 1fr;
  }

  .status-contact-grid > div {
    padding: 0.65rem 0;
    border-left: 0;
    border-bottom: 1px solid var(--border);
  }

  .status-contact-grid > div:last-child {
    border-bottom: 0;
  }

  .status-chart-wide {
    grid-column: auto;
  }

  .status-progress-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .role-teacher .app-content {
    margin-left: 0;
  }

  .teacher-mobile-header {
    position: sticky;
    top: 0;
    z-index: 35;
    display: flex;
    min-height: 4.25rem;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    background: rgba(243, 239, 231, 0.92);
    backdrop-filter: blur(18px);
  }

  .app-sidebar {
    width: min(20rem, 88vw);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .nav-hamburger {
    display: flex;
    width: 2.75rem;
    height: 2.75rem;
    min-height: 2.75rem;
    padding: 0.7rem;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: transparent;
  }

  .nav-hamburger:hover {
    border-color: var(--text);
    background: transparent;
  }

  .nav-hamburger-bar {
    background: var(--text);
  }

  .container {
    padding-top: 2.25rem;
  }

  .student-dashboard-hero,
  .student-dashboard-overview {
    grid-template-columns: 1fr;
  }

  .student-dashboard-hero {
    gap: 1.25rem;
  }

  .student-dashboard-overview {
    gap: 2.5rem;
  }

  .teacher-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .teacher-overview-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .teacher-overview-stats .stat-box:nth-child(3) {
    border-right: 0;
  }

  .teacher-overview-stats .stat-box:nth-child(n + 4) {
    border-top: 1px solid var(--border);
  }

  .teacher-dashboard-grid .card:nth-child(odd):not(.card-exam-termine) {
    padding-right: 0;
    border-right: 0;
  }

  .live-layout {
    grid-template-columns: 1fr;
  }

  .live-sidebar {
    position: static;
  }

  .live-main {
    position: static;
  }
}

@media (max-width: 700px) {
  body.role-student {
    padding-bottom: 4.6rem;
  }

  .live-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    padding-bottom: 7rem;
  }

  .live-sidebar,
  .live-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .live-sidebar > * + * {
    margin-top: 0;
  }

  .live-actions-card {
    position: sticky;
    bottom: max(0.5rem, env(safe-area-inset-bottom));
    z-index: 24;
    padding: 0.85rem !important;
    border: 1px solid var(--border) !important;
    border-radius: 14px;
    background: rgba(255, 253, 249, 0.96);
    box-shadow: 0 12px 35px rgba(54, 45, 35, 0.2) !important;
    backdrop-filter: blur(18px);
  }

  .live-actions-card > .live-actions-stacked {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }

  #live-control-feedback,
  #live-help-ack-btn,
  .live-secondary-actions {
    grid-column: 1 / -1;
  }

  .live-coaching-control {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .live-coaching-control label {
    grid-column: 1 / -1;
  }

  .live-coaching-control select,
  .live-coaching-control button {
    min-width: 0;
  }

  .session-help-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .stats-summary-grid,
  .stats-export-range {
    grid-template-columns: 1fr;
  }

  .competency-detail-grid {
    grid-template-columns: 1fr;
  }

  .stats-main-tabs {
    margin-inline: -0.25rem;
    padding-inline: 0.25rem;
  }

  .student-header {
    grid-template-columns: 1fr auto auto;
    min-height: 4.1rem;
    padding: 0.55rem 0.85rem;
    backdrop-filter: none;
  }

  .student-header .brand-logo-image {
    height: 3rem;
    max-width: 3rem;
  }

  .student-header .nav-logout {
    min-height: 2.2rem;
    padding: 0.35rem 0.55rem;
    font-size: 0.72rem;
  }

  .student-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    padding: 0.4rem max(0.25rem, env(safe-area-inset-right)) max(0.45rem, env(safe-area-inset-bottom)) max(0.25rem, env(safe-area-inset-left));
    border-top: 1px solid var(--border);
    background: rgba(255, 253, 249, 0.96);
    box-shadow: 0 -8px 28px rgba(54, 45, 35, 0.07);
    backdrop-filter: blur(18px);
  }

  .student-nav .app-nav-link {
    min-height: 3.25rem;
    justify-content: center;
    padding: 0.35rem 0.2rem;
    text-align: center;
    font-size: clamp(0.62rem, 2.6vw, 0.72rem);
  }

  .student-nav .app-nav-link.nav-active::before {
    inset: -0.42rem 22% auto;
    height: 3px;
  }

  .container {
    padding: 1.75rem 1rem 3rem;
  }

  .today-panel {
    align-items: stretch;
    flex-direction: column;
    gap: 1.25rem;
  }

  .student-dashboard-overview {
    margin-top: 2.5rem;
  }

  .student-dashboard-plan .calendar-preview {
    grid-template-columns: 1fr;
  }

  .student-dashboard-plan .calendar-preview-item {
    border-right: 0;
  }

  .student-dashboard-plan .calendar-preview-item + .calendar-preview-item {
    border-top: 1px solid var(--border);
  }

  .teacher-status-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .teacher-status-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .teacher-status-actions .btn,
  .teacher-status-actions button {
    width: 100%;
    text-align: center;
  }

  .teacher-action-item {
    grid-template-columns: 1fr;
  }

  .teacher-action-item .btn {
    width: 100%;
    text-align: center;
  }

  .teacher-action-empty {
    flex-direction: column;
  }

  .session-debrief-grid {
    grid-template-columns: 1fr;
  }

  .session-debrief-actions {
    flex-direction: column;
  }

  .session-debrief-actions > * {
    width: 100%;
  }

  .learning-plan-item {
    grid-template-columns: auto 1fr;
  }

  .learning-plan-date,
  .learning-plan-order-actions {
    grid-column: 2;
  }

  .learning-plan-order-actions { flex-wrap: wrap; }

  .learning-plan-picker-controls {
    grid-template-columns: 1fr;
  }

  .teacher-overview-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .teacher-overview-stats .stat-box:nth-child(3) {
    border-right: 1px solid var(--border);
  }

  .teacher-overview-stats .stat-box:nth-child(2n) {
    border-right: 0;
  }

  .teacher-overview-stats .stat-box:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }

  .today-panel .today-action {
    width: 100%;
    text-align: center;
  }

  h1 {
    font-size: clamp(1.9rem, 10vw, 2.7rem);
  }

  .container > p.subtitle,
  .page-header > p.subtitle,
  .live-studio > p.subtitle,
  .settings-studio > p.subtitle {
    margin-bottom: 1.75rem;
  }

  .grid-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-box:nth-child(2n) {
    border-right: 0;
  }

  .stat-box:nth-child(n + 3) {
    border-top: 1px solid var(--border);
  }

  .calendar-preview {
    grid-template-columns: 1fr;
  }

  .calendar-preview-item,
  .calendar-preview-link {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .calendar-preview-link:last-child {
    border-bottom: 0;
  }

  .settings-studio .settings-savebar {
    bottom: 4.9rem;
  }

  .role-teacher .settings-studio .settings-savebar {
    bottom: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  body {
    background: #fff;
  }

  .app-sidebar,
  .teacher-mobile-header,
  .student-header,
  .forced-session-banner,
  .actions,
  .settings-savebar {
    display: none !important;
  }

  .role-teacher .app-content {
    margin-left: 0;
  }

  .container {
    width: 100%;
    padding: 0;
  }

  .card,
  .grid-stats {
    break-inside: avoid;
  }
}

/* Hinweistexte und Aufmerksamkeits-Signale --------------------------- */

.card-hint {
  margin: 0 0 0.9rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* Import-Vertrag auf /katalog: bewusst aufklappbar, damit die Seite fuer
   Wiederholungstaeter kurz bleibt und beim ersten Mal trotzdem alles dasteht. */
.csv-spec {
  margin-top: 1.1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

.csv-spec > summary {
  cursor: pointer;
  font-weight: 650;
}

.csv-spec h3 {
  margin: 1.1rem 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.csv-spec p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.csv-spec-list {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.9rem;
  line-height: 1.65;
}

.csv-spec-list code {
  overflow-wrap: anywhere;
}

/* Foto-Platzhalter auf der POP-Detailseite: sagt jetzt auch, wie man ihn
   loswird - Fotos haben weder Spalte noch Upload, nur eine Namenskonvention. */
.pop-detail-photo .photo-placeholder {
  display: grid;
  gap: 0.45rem;
  padding: 1.25rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.55;
  text-align: left;
}

.pop-detail-photo .photo-placeholder strong {
  color: var(--text);
  font-size: 1rem;
}

/* Login-Seite: Ausweg fuer alle, die noch keinen Link haben. */
.login-help {
  margin-top: 1.4rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
  text-align: left;
}

/* Der einzige Bedienpunkt der ganzen Anmeldeseite - und ausgerechnet der
   Notausgang fuer jemanden ohne Link. Gemessen waren es 24px Hoehe. */
.login-help > summary {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  cursor: pointer;
  font-weight: 650;
}

.login-help p {
  margin: 0.8rem 0 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

.login-help pre {
  overflow-x: auto;
  /* Der Befehl ist laenger als die Karte breit ist; ohne diese Abkopplung
     zieht ein Wisch daran die Zurueck-Geste des Browsers auf. */
  overscroll-behavior-x: contain;
  margin: 0.7rem 0 0;
  padding: 0.7rem 0.8rem;
  border-radius: 9px;
  background: rgba(54, 45, 35, 0.06);
  font-size: 0.8rem;
}

.login-help-note {
  color: var(--text-muted);
}

/* Offene Entscheidung in der Navigation - dieselbe Farbe wie pill-warn, aber
   als eigener Name, damit "es liegt etwas an" nicht mit einem Statuswert
   verwechselt wird. */
.pill-attention {
  background: rgba(131, 87, 7, 0.14);
  color: var(--warn);
}

/* Routine-Logins im Benachrichtigungs-Feed: schmale Zeile statt voller Karte,
   damit ein banaler Seitenaufruf nicht so schwer wiegt wie eine Pruefungsnote. */
.notification-minor {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  padding: 0.55rem 0.2rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.notification-minor-time {
  font-variant-numeric: tabular-nums;
}

.notification-minor-text {
  color: var(--text);
}

.notification-minor-more > summary {
  cursor: pointer;
  font-size: 0.8rem;
}

.notification-minor-more p {
  margin: 0.3rem 0 0;
  overflow-wrap: anywhere;
  font-size: 0.78rem;
}

@media (max-width: 900px) {
  /* Zusammengefasstes "irgendetwas ist offen" auf dem Hamburger - mobil das
     einzige Aufmerksamkeitssignal, weil beide Zaehler in der zugeklappten
     Seitenleiste stecken (siehe app/static/nav-attention.js). */
  .nav-hamburger {
    position: relative;
  }

  .nav-hamburger-dot {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--bad);
  }

  .nav-hamburger-dot[hidden] {
    display: none;
  }
}

/* .today-kicker ist fuer den dunklen Hero gebaut (color: #fff). Auf der hellen
   Karte hier war die Zeile dadurch weiss auf weiss und praktisch unsichtbar -
   dieselbe Stelle hatte die frueher entfernte Handlungszentrale schon. */
.teacher-action-center .today-kicker {
  color: var(--text-muted);
}

/* Antippbare Detailtexte (app/static/touch-detail.js) ------------------- */

/* Ein gepunkteter Unterstrich, damit ueberhaupt zu sehen ist, dass hinter dem
   Element noch etwas steckt - vorher war das nur per Hover zu entdecken. */
.has-detail {
  cursor: pointer;
  text-decoration: underline dotted currentColor 1px;
  text-underline-offset: 3px;
}

.has-detail:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.detail-note {
  display: block;
  margin: 0.35rem 0;
  padding: 0.5rem 0.7rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

/* In einer Tabellenzelle darf die Notiz die Spaltenbreite nicht sprengen. */
td .detail-note,
th .detail-note {
  max-width: 16rem;
}

/* Touch-Grundlagen ------------------------------------------------------ */

/* Ohne touch-action: manipulation behaelt Safari die Doppeltipp-zum-Zoomen-
   Heuristik auf Bedienelementen bei und wartet vor jedem Tap darauf, ob noch
   ein zweiter kommt. Der graue Blitz beim Antippen kommt vom Standardwert von
   -webkit-tap-highlight-color; :active und :focus-visible sind das bessere,
   gestaltete Feedback. Beides bewusst nur auf Bedienelementen, nicht global -
   Doppeltipp-Zoom auf Text und Bildern bleibt erhalten. */
button,
.btn,
a,
summary,
label,
input,
select,
textarea,
[data-detail],
[role="button"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Mindestens 44px Tippflaeche in der Navigation. Gemessen bei 393px waren es
   36px (.app-nav-link), 38px (.nav-disclosure-summary, .nav-bell-toggle,
   .nav-logout) - und .nav-bell-mark-read hatte ueberhaupt keine Untergrenze.
   Der Hamburger war mit 44x44 schon richtig. */
@media (max-width: 900px) {
  .app-sidebar .app-nav-link,
  .app-sidebar .nav-disclosure-summary,
  .app-sidebar .nav-bell-toggle,
  .app-sidebar .nav-logout {
    min-height: 2.75rem;
  }
}

.nav-bell-mark-read {
  min-height: 2.75rem;
  padding-inline: 0.35rem;
}

/* Scrollketten abkoppeln: sonst zieht ein Wisch am Ende einer breiten Tabelle
   die Seite bzw. die Zurueck-Geste des Browsers mit. */
.table-scroll {
  overscroll-behavior-x: contain;
}

.app-sidebar {
  overscroll-behavior: contain;
}

/* Fusszeile der Katalog-Liste: Trefferzahl plus "Mehr laden". */
.catalog-paging {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.catalog-paging p {
  margin: 0;
}

/* Bestaetigungs-/Hinweis-Dialog (app/static/dialogs.js) ------------------ */

.pop-dialog {
  width: min(28rem, calc(100vw - 2rem));
  max-height: min(32rem, calc(100vh - 2rem));
  max-height: min(32rem, calc(100dvh - 2rem));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.pop-dialog::backdrop {
  background: rgba(37, 33, 29, 0.45);
}

.pop-dialog-body {
  padding: 1.4rem;
}

.pop-dialog-message {
  margin: 0 0 1.2rem;
  /* Mehrzeilige Meldungen kommen mit echten Zeilenumbruechen an. */
  white-space: pre-line;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.pop-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.pop-dialog-actions button {
  flex: 1 1 auto;
  min-width: 8rem;
}

.pop-dialog-danger {
  background: var(--bad, #b3261e);
}
