:root {
  /* Warme Paper-Palette — harmonisch mit der Landing-Ästhetik */
  --bg: #f6efdf;
  --surface: #fbf7ea;
  --surface-warm: #f2e8cf;
  --border: #e2d8c0;
  --text: #231c12;
  --muted: #6d5f48;
  --ink-deep: #192d21;
  /* Accents */
  --accent: #b5643a;          /* terracotta — primary accent */
  --accent-strong: #944d27;
  --accent-soft: #d6865f;
  --forest: #2d4a3a;
  --forest-deep: #192d21;
  --ochre: #d89a3c;
  --leaf: #7dc063;
  --leaf-deep: #4a7530;
  --danger: #a83232;
  --good: #4a7530;
  --bad: #b5643a;
  --shadow: 0 8px 24px -10px rgba(69, 40, 15, 0.12);
  --shadow-strong: 0 18px 40px -16px rgba(69, 40, 15, 0.22);
  --radius: 16px;
  --radius-s: 10px;
  --font: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  font-feature-settings: "ss01" on, "cv11" on;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 48, "SOFT" 40;
  font-weight: 480;
  letter-spacing: -.01em;
  color: var(--forest-deep);
  line-height: 1.15;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.2rem; }

#top-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .75rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  font-weight: 700;
  font-size: 1.35rem;
  cursor: pointer;
  user-select: none;
}
.brand-text {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 60, "SOFT" 60, "WONK" 1;
  font-weight: 500;
  color: var(--forest-deep);
  letter-spacing: -.01em;
}
.brand-version {
  font-family: var(--font);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .04em;
  padding: .15rem .5rem;
  border-radius: 999px;
  background: var(--surface-warm);
  color: var(--muted);
  align-self: center;
  margin-left: -.2rem;
  text-transform: lowercase;
}
.brand-env {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  padding: .2rem .55rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--surface);
  align-self: center;
  box-shadow: 0 2px 8px rgba(181,100,58,.3);
  animation: dev-pulse 2s ease-in-out infinite;
}
body.env-dev {
  background: repeating-linear-gradient(
    45deg,
    #fafaf7,
    #fafaf7 20px,
    #fff3e0 20px,
    #fff3e0 21px
  );
}
@keyframes dev-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.owl {
  width: 62px;
  height: 62px;
  display: block;
  transition: transform .3s ease;
  overflow: visible;
}
.owl-body {
  transform-origin: 50% 90%;
  animation: owl-bob 2.8s ease-in-out infinite;
}
.owl .branch {
  transform-origin: 50% 100%;
  animation: owl-branch-sway 5s ease-in-out infinite;
}
.owl .owl-head {
  transform-origin: 50% 80%;
  animation: owl-head-turn 7s ease-in-out infinite;
}
.brand:hover .owl {
  transform: scale(1.12);
}
.brand:hover .owl-body { animation-duration: 1s; }
.brand:hover .owl-head { animation-duration: 2s; }

.owl .wing-left {
  transform-origin: 28% 50%;
  animation: owl-wing-left 2.2s ease-in-out infinite;
}
.owl .wing-right {
  transform-origin: 72% 50%;
  animation: owl-wing-right 2.2s ease-in-out infinite;
}
.owl .tuft-left {
  transform-origin: 32px 30px;
  animation: owl-tuft-left 3s ease-in-out infinite;
}
.owl .tuft-right {
  transform-origin: 88px 30px;
  animation: owl-tuft-right 3s ease-in-out infinite;
  animation-delay: -1.5s;
}
.owl .leaves {
  transform-origin: 105px 100px;
  animation: owl-leaves 4s ease-in-out infinite;
}
@keyframes owl-leaves {
  0%, 100% { transform: rotate(0); }
  50% { transform: rotate(3deg); }
}
.owl .eyelid {
  transform-origin: 50% 46px;
  transform: scaleY(0);
  animation: owl-blink 4.5s infinite;
}
.owl .eye-disc-left .eyelid {
  transform-origin: 44px 46px;
}
.owl .eye-disc-right .eyelid {
  transform-origin: 76px 46px;
}
.owl .eye-shift {
  animation: owl-look 6s ease-in-out infinite;
  transform-origin: 50% 48%;
}
.owl .cheek {
  animation: owl-cheek 3s ease-in-out infinite;
  transform-origin: 50% 58%;
}

@keyframes owl-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2.5px); }
}
@keyframes owl-branch-sway {
  0%, 100% { transform: rotate(0); }
  50% { transform: rotate(.8deg); }
}
@keyframes owl-head-turn {
  0%, 40%, 100% { transform: rotate(0); }
  50% { transform: rotate(-10deg); }
  60% { transform: rotate(0); }
  75% { transform: rotate(8deg); }
  85% { transform: rotate(0); }
}
@keyframes owl-wing-left {
  0%, 60%, 100% { transform: rotate(0); }
  70% { transform: rotate(-15deg) translateX(-2px); }
  80% { transform: rotate(-3deg); }
  90% { transform: rotate(-8deg); }
}
@keyframes owl-wing-right {
  0%, 60%, 100% { transform: rotate(0); }
  70% { transform: rotate(15deg) translateX(2px); }
  80% { transform: rotate(3deg); }
  90% { transform: rotate(8deg); }
}
@keyframes owl-tuft-left {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(4deg); }
}
@keyframes owl-tuft-right {
  0%, 100% { transform: rotate(2deg); }
  50% { transform: rotate(-4deg); }
}
@keyframes owl-blink {
  0%, 88%, 100% { transform: scaleY(0); }
  91% { transform: scaleY(22); }
  94% { transform: scaleY(0); }
}
@keyframes owl-look {
  0%, 25%, 55%, 100% { transform: translateX(0); }
  35% { transform: translateX(-2.5px); }
  65% { transform: translateX(2.5px); }
}
@keyframes owl-cheek {
  0%, 100% { opacity: .35; }
  50% { opacity: .55; }
}

@media (max-width: 600px) {
  .owl { width: 40px; height: 46px; }
}

@media (max-width: 600px) {
  .owl { width: 36px; height: 36px; }
  .brand { font-size: 1.15rem; }
}

#crumbs {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: .9rem;
}

#crumbs a { color: var(--accent-strong); cursor: pointer; text-decoration: none; }
#crumbs a:hover { text-decoration: underline; }
#crumbs .sep { color: var(--muted); }

.spacer { flex: 1; }

#profile-chip {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .3rem .8rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: .9rem;
  font-weight: 600;
}

.profile-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

main {
  max-width: 960px;
  margin: 1.5rem auto;
  padding: 0 1.25rem 4rem;
}

h1 { font-size: 1.8rem; margin: 0 0 1rem; }
h2 { font-size: 1.3rem; margin: 2rem 0 .75rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
  box-shadow: var(--shadow);
  position: relative;
}

.tile:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.08); }
.tile h3 { margin: 0 0 .3rem; font-size: .98rem; line-height: 1.25; }
.tile .meta { color: var(--muted); font-size: .85rem; }

.tile .del {
  position: absolute; top: .35rem; right: .4rem;
  background: transparent; border: none; color: var(--muted);
  font-size: 1.1rem; cursor: pointer; padding: .25rem .5rem;
  border-radius: 6px;
  z-index: 3;
}
.tile .del:hover { color: var(--danger); background: #f6e9ea; }

.tile.locked {
  opacity: .55;
  background: #f4f2ec;
  cursor: not-allowed;
}
.tile.locked:hover { transform: none; box-shadow: var(--shadow); }
.tile.completed {
  border-color: var(--good);
  background: #f0faf7;
}
.tile.completed::after {
  content: '✓';
  position: absolute;
  top: .5rem; right: 2.2rem;
  color: var(--good);
  font-size: 1.4rem;
  font-weight: 700;
}
.tile.attempted {
  border-color: #e0a96d;
  background: #fbf4ea;
}
.tile.attempted .order-num { background: #e0a96d; }
.badge.tried { background: #f7e6cf; color: #8a5a1f; }
.tile .order-num {
  position: absolute;
  top: .55rem; left: .7rem;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .85rem;
}
.tile.locked .order-num { background: #b8b3a7; }
.tile.completed .order-num { background: var(--good); }
.tile h3 { margin-left: 2.4rem; padding-right: 1.5rem; }

.badge {
  display: inline-block;
  padding: .12rem .55rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
}
.badge.good { background: #cdeee4; color: #1d6d5f; }
.badge.lock { background: #e8e4d8; color: #6b6150; }
.badge.open { background: #dff3f2; color: #2a7d77; }

.profile-tile {
  text-align: center;
  padding: 2rem 1rem;
}
.profile-tile .avatar {
  width: 84px; height: 84px; border-radius: 50%;
  margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem; font-weight: 700; color: white;
}
.profile-tile .profile-owl,
.profile-tile .profile-avatar {
  width: 92px; height: 92px;
  margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center;
}
.profile-tile .profile-owl svg,
.profile-tile .profile-avatar svg { width: 100%; height: 100%; display: block; }
.profile-owl .mo-wing,
.profile-owl .mo-tuft,
.profile-owl .mo-head,
.profile-owl .mo-body { fill: var(--owl-c, #7d4e2d); }
.profile-owl .mo-face,
.profile-owl .mo-eye-ring { fill: color-mix(in srgb, var(--owl-c, #7d4e2d) 22%, #fff); }
.profile-owl .mo-eye { fill: #fbbf24; stroke: var(--owl-c, #7d4e2d); stroke-width: 1.2; }
.profile-owl .mo-pupil { fill: #1a1a1a; }
.profile-owl .mo-beak { fill: #e88c3f; stroke: #a85f1c; stroke-width: 0.6; stroke-linejoin: round; }
.profile-owl .mo-feet path { fill: none; stroke: #e88c3f; stroke-width: 2.2; stroke-linecap: round; }
.profile-tile h3 { font-size: 1.35rem; }
.count-circles {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 1rem;
}
.count-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
}
.count-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.count-label {
  font-size: .75rem;
  color: var(--muted);
  font-weight: 500;
}

button, .btn {
  background: var(--forest-deep);
  color: var(--surface);
  border: 1px solid transparent;
  padding: .7rem 1.3rem;
  border-radius: 999px;
  font-size: .95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .18s ease, transform .15s ease, box-shadow .18s;
  font-family: inherit;
  letter-spacing: .01em;
}
button:hover, .btn:hover { background: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* App-Scope: btn-primary immer mit lesbarer heller Schrift */
body:not(.landing-active) .btn-primary,
button.btn-primary {
  background: var(--forest-deep);
  color: var(--surface);
}
body:not(.landing-active) .btn-primary:hover,
button.btn-primary:hover { background: var(--accent); }
button.btn-primary:disabled { background: #cfc9bc; color: #7a7363; }

button.ghost, .btn.ghost {
  background: transparent;
  color: var(--forest-deep);
  border: 1px solid var(--forest-deep);
}
button.ghost:hover, .btn.ghost:hover { background: var(--forest-deep); color: var(--surface); }

button.danger { background: var(--danger); }
button.danger:hover { background: #8a2929; }

input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
  padding: .6rem .8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--surface);
  width: 100%;
}
textarea { resize: vertical; min-height: 80px; }

.form-row { display: flex; gap: .75rem; align-items: flex-start; }
.form-row > * { flex: 1; }
.form-row label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .3rem; }

.toolbar { display: flex; gap: .75rem; margin-bottom: 1.25rem; align-items: center; }
.toolbar .title { font-size: 1.4rem; font-weight: 700; flex: 1; }

.markdown {
  line-height: 1.7;
}
.markdown h1 { font-size: 1.9rem; margin-top: 0; }
.markdown h2 { font-size: 1.4rem; border-bottom: 1px solid var(--border); padding-bottom: .3rem; }
.markdown h3 { font-size: 1.15rem; }
.markdown p, .markdown ul, .markdown ol { margin: .7rem 0; }
.markdown code {
  background: #f2efe8;
  padding: .1rem .4rem;
  border-radius: 4px;
  font-size: .92em;
}
.markdown pre {
  background: #2b2b2b;
  color: #f8f8f2;
  padding: 1rem;
  border-radius: var(--radius-s);
  overflow-x: auto;
}
.markdown pre code { background: transparent; color: inherit; padding: 0; }
.markdown blockquote {
  margin: 1rem 0;
  padding: .75rem 1rem;
  border-left: 4px solid var(--accent);
  background: #eefcfa;
  border-radius: 6px;
  font-style: italic;
}
.markdown .mermaid,
.markdown .mermaid-container {
  background: white;
  padding: 1rem;
  border-radius: var(--radius-s);
  text-align: center;
  border: 1px solid var(--border);
  margin: 1rem 0;
}
.markdown .mermaid-container svg {
  max-width: 100%;
  height: auto;
}
.markdown .mermaid-fallback {
  background: #faf7ee;
  padding: .8rem 1rem;
  border-radius: var(--radius-s);
  border: 1px dashed var(--border);
  margin: 1rem 0;
}
.markdown .mermaid-fallback pre {
  background: transparent;
  color: var(--text);
  padding: 0;
  font-size: .88rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.markdown table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
}
.markdown th, .markdown td {
  border: 1px solid var(--border);
  padding: .5rem .75rem;
  text-align: left;
}
.markdown th { background: #f7f5ef; }

.chat {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin-top: 1rem;
}
.chat-msg {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  max-width: 85%;
  line-height: 1.55;
}
.chat-msg.user {
  background: var(--accent);
  color: white;
  align-self: flex-end;
}
.chat-msg.assistant {
  background: var(--surface);
  border: 1px solid var(--border);
  align-self: flex-start;
}

.chat-form {
  display: flex;
  gap: .5rem;
  margin-top: 1rem;
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding: .75rem 0;
}
.chat-form textarea { flex: 1; min-height: 50px; max-height: 200px; }
.chat-form button { align-self: flex-end; }

.exam-q {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.exam-q h4 { margin: 0 0 .75rem; font-size: 1.05rem; }
.exam-q .options { display: flex; flex-direction: column; gap: .5rem; }
.exam-q .option {
  display: flex;
  gap: .6rem;
  align-items: flex-start;
  padding: .6rem .8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  cursor: pointer;
}
.exam-q .option:hover { background: var(--bg); }
.exam-q .option input { width: auto; }

.exam-result {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: var(--radius-s);
  border-left: 4px solid;
}
.exam-result.good { border-color: var(--good); background: #eaf7f3; }
.exam-result.bad  { border-color: var(--bad); background: #fbeee6; }

.status {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
}
.status.good { background: #cdeee4; color: #1d6d5f; }
.status.bad  { background: #fad9cd; color: #a64524; }

.muted { color: var(--muted); }
.center { text-align: center; padding: 3rem 1rem; }
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-bar {
  display: flex; align-items: center; gap: .6rem;
  color: var(--muted); font-size: .9rem; margin: 1rem 0;
}

.error { color: var(--danger); padding: 1rem; background: #fbe9eb; border-radius: var(--radius-s); }

.svg-container svg { max-width: 100%; height: auto; }

@media (max-width: 600px) {
  main { margin: 1rem auto; padding: 0 .75rem 3rem; }
  .form-row { flex-direction: column; }
  .chat-msg { max-width: 95%; }
}

/* ===== v0.2: Auth screens ===== */
.auth-wrap {
  min-height: 70vh;
  display: flex; align-items: center; justify-content: center;
}
.auth-card {
  width: 100%; max-width: 440px;
}
.auth-hero {
  text-align: center;
  margin: -.5rem 0 1rem;
}
.auth-owl { display: flex; justify-content: center; }
.auth-owl .owl.owl-big {
  width: 140px !important;
  height: 160px !important;
}
.auth-title {
  margin-top: .3rem;
  font-family: var(--font-display);
  font-variation-settings: "opsz" 80, "SOFT" 60, "WONK" 1;
  font-weight: 500;
  font-size: 2rem;
  letter-spacing: -.01em;
  color: var(--forest-deep);
}

.auth-tabs {
  display: flex; gap: .4rem; margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.auth-tab {
  flex: 1;
  background: transparent; color: var(--muted);
  border: none; border-bottom: 3px solid transparent;
  border-radius: 0;
  padding: .65rem;
  font-weight: 700;
  font-family: inherit; font-size: 1rem;
  cursor: pointer;
}
.auth-tab.active { color: var(--accent-strong); border-bottom-color: var(--accent); }
.auth-tab:hover { background: #f6f5ef; }
.auth-linkbtn {
  display: block; width: 100%;
  background: none; border: none;
  color: var(--accent-strong); text-decoration: underline;
  font-family: inherit; font-size: .85rem;
  cursor: pointer; padding: .6rem 0 0; margin: 0;
  text-align: center;
}
.auth-linkbtn:hover { color: var(--accent); }
.form-field { margin-bottom: .85rem; }
.form-field label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .3rem; font-weight: 600; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%;
  font: inherit;
  padding: .65rem .8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.form-field input:disabled { background: var(--surface-warm); color: var(--muted); }
/* Site-Footer mit Legal-Links */
#site-footer {
  max-width: 1100px;
  margin: 3rem auto 1rem;
  padding: 1rem 1.5rem;
  font-size: .8rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  border-top: 1px solid var(--border);
}
#site-footer a { color: var(--muted); text-decoration: underline; }
#site-footer a:hover { color: var(--accent-strong); }
#site-footer .sep { opacity: .5; }

/* Consent-Box in Formularen */
.consent-box {
  background: #fafaf7;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-s);
  padding: .7rem .9rem;
  margin: 1rem 0 .5rem;
}
.consent-box a { color: var(--accent-strong); text-decoration: underline; }
.consent-box-head { font-weight: 600; margin-bottom: .15rem; }
.consent-box-sub { font-size: .85rem; color: var(--muted); margin-bottom: .6rem; }

.consent-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .6rem;
  padding: .4rem .1rem;
  border-top: 1px solid var(--border);
}
.consent-row:first-of-type { border-top: none; }
.consent-status {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: #e8e5db;
  color: #888;
  font-weight: 700;
  display: grid;
  place-items: center;
  font-size: .95rem;
  transition: background .2s, color .2s;
}
.consent-row.accepted .consent-status { background: #6a8f5c; color: #fff; }
.consent-row.rejected .consent-status { background: #b55; color: #fff; }
.consent-row .consent-label { font-size: .95rem; }
.consent-row .consent-state { font-style: italic; color: var(--muted); font-size: .85rem; }
.consent-row.accepted .consent-state { color: #4a6d3c; font-style: normal; }
.consent-row.rejected .consent-state { color: #b55; font-style: normal; }
.consent-open-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: .38rem .9rem;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.consent-open-btn:hover { background: var(--accent-strong); }
.consent-row.accepted .consent-open-btn { background: #8aa580; }

/* Modal-Buttons für Consent-Flow */
.consent-modal-actions {
  display: flex;
  justify-content: space-between;
  gap: .6rem;
  margin-top: 1rem;
  padding-top: .8rem;
  border-top: 1px solid var(--border);
}
.consent-modal-actions .btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: .55rem 1.4rem;
  font-weight: 600;
  cursor: pointer;
}
.consent-modal-actions .btn-primary:hover { background: var(--accent-strong); }
.consent-modal-actions .btn-danger {
  background: transparent;
  color: #b55;
  border: 1px solid #b55;
  border-radius: 999px;
  padding: .55rem 1.4rem;
  font-weight: 600;
  cursor: pointer;
}
.consent-modal-actions .btn-danger:hover { background: #fde8e8; }
.consent-modal-actions .btn-primary:disabled {
  background: #cfc9bc;
  color: #fff;
  cursor: not-allowed;
}
.consent-modal-actions .btn-primary:disabled:hover { background: #cfc9bc; }
.consent-doc-viewer { max-height: 55vh; }
.consent-scroll-hint {
  margin-top: .6rem;
  padding: .5rem .8rem;
  background: #f5efe0;
  border-left: 3px solid var(--ochre, #c9a94b);
  border-radius: var(--radius-s);
  font-size: .85rem;
  color: #6b5a30;
  transition: background .25s, color .25s, border-color .25s;
}
.consent-scroll-hint.is-satisfied {
  background: #e7f2de;
  border-left-color: #6a8f5c;
  color: #3e5b30;
}

#rf-submit:disabled {
  opacity: .45;
  cursor: not-allowed;
}

/* Coin-System */
.coin-chip {
  background: linear-gradient(135deg, #f3d9a8, #e8b86e);
  color: #6b4423;
  border: none;
  border-radius: 999px;
  padding: .38rem .85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .9rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  transition: transform .15s, box-shadow .15s;
  margin-right: .2rem;
}
.coin-chip:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.coin-chip .coin-icon { font-size: 1rem; }
.coin-chip .coin-val { letter-spacing: .02em; }

.coin-balance-card {
  background: linear-gradient(135deg, #fdf6e8 0%, #f9ead0 100%);
  border-left: 4px solid #e8b86e;
}
.balance-label { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; }
.balance-big {
  font-family: 'Fraunces', serif;
  font-size: 3.5rem;
  font-weight: 700;
  color: #6b4423;
  line-height: 1;
  margin: .2rem 0;
}
.balance-unit { font-size: 1rem; font-weight: 400; color: #a08159; margin-left: .5rem; letter-spacing: .05em; }

.coin-pkgs { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.coin-pkg {
  position: relative;
  padding: 1.2rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  text-align: center;
  background: #fffdf9;
  transition: border-color .15s, transform .15s;
}
.coin-pkg:hover { border-color: var(--accent); transform: translateY(-2px); }
.coin-pkg.popular { border-color: var(--accent); border-width: 2px; background: #fdf9ef; }
.pkg-ribbon { position: absolute; top: -.6rem; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff; font-size: .7rem; padding: .1rem .6rem; border-radius: 999px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.pkg-title { font-weight: 600; color: var(--accent-strong); margin-bottom: .4rem; }
.pkg-coins { font-family: 'Fraunces', serif; font-size: 1.8rem; font-weight: 700; }
.pkg-price { color: var(--muted); margin-bottom: .8rem; }
.coin-pkg button { width: 100%; }

.sub-active, .sub-inactive { padding: .8rem; background: #faf7f0; border-radius: var(--radius-s); }
.sub-active { background: #e7f2de; border-left: 3px solid #6a8f5c; }

.discount-form { display: flex; gap: .6rem; align-items: stretch; }
.discount-form input { flex: 1; text-transform: uppercase; }
.discount-form button { white-space: nowrap; }

.ledger-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.ledger-table th, .ledger-table td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--border); }
.ledger-table th { font-weight: 600; background: #faf7f0; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ledger-table td.credit { color: #4a7a3c; font-weight: 600; }
.ledger-table td.debit { color: #a84a3c; font-weight: 600; }

.invoices-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.invoices-table th, .invoices-table td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.invoices-table th { font-weight: 600; background: #faf7f0; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); position: sticky; top: 0; z-index: 1; }
.invoices-table td.num { font-family: 'Instrument Sans', sans-serif; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--accent-strong); white-space: nowrap; }
.invoices-table td.amount { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; }
.invoices-table td.coins { white-space: nowrap; font-variant-numeric: tabular-nums; }
.invoices-table td.desc { max-width: 360px; }
.invoices-table a.invoice-dl { text-decoration: none; padding: .3rem .7rem; font-size: .82rem; background: var(--accent-strong); color: #fff; border-radius: 999px; font-weight: 600; display: inline-block; white-space: nowrap; }
.invoices-table a.invoice-dl:hover { background: #5a3820; }
.invoices-table tr:nth-child(even) td { background: #fcfaf3; }
.invoices-table tr:hover td { background: #f5f0df; }

.invoices-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.summary-tile { background: linear-gradient(180deg, #fffdf5, #fdf4dc); border: 1px solid var(--border); border-radius: var(--radius-m); padding: 1rem 1.2rem; }
.summary-label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .3rem; }
.summary-val { font-family: 'Fraunces', serif; font-size: 1.7rem; font-weight: 700; color: var(--accent-strong); font-variant-numeric: tabular-nums; }

.invoices-card { padding: 0 !important; overflow: hidden; }
.invoices-toolbar { padding: .8rem 1rem; border-bottom: 1px solid var(--border); background: #fdfbf4; }
.invoices-toolbar input { width: 100%; font-size: .95rem; padding: .5rem .8rem; }
.invoices-scroll { max-height: 60vh; overflow-y: auto; }
@media (max-width: 700px) {
  .invoices-table td.desc { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .invoices-scroll { max-height: 70vh; }
}

/* Familien-Coin-Transfer */
.family-coin-card { background: linear-gradient(180deg, #fffdf5, #fff9ea); }
.family-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.family-table th, .family-table td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.family-table th { font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: transparent; }
.family-parent-row { background: #fdf4dc; }
.family-parent-row td:first-child { border-left: 3px solid var(--accent-strong); }
.family-you-tag { color: var(--accent-strong); font-weight: 600; font-size: .78rem; margin-left: .3rem; }
.family-name { font-family: 'Fraunces', serif; font-size: 1.05rem; }
.family-balance { white-space: nowrap; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.family-balance .coin-num { font-size: 1.1rem; color: var(--accent-strong); }
.family-table td.family-balance,
.family-table th.family-balance-head { text-align: right; padding-right: 1.5rem; }
.family-actions { display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; }
.family-actions .btn-pill { min-width: 48px; padding: .3rem .6rem; font-size: .85rem; font-weight: 700; }
.family-take, .family-take-custom { background: #fdeae4; color: #a84a3c; }
.family-take:hover, .family-take-custom:hover { background: #fcd9cf; }
.family-give, .family-give-custom { background: #e8f3de; color: #4a7a3c; }
.family-give:hover, .family-give-custom:hover { background: #d4ebc2; }
.family-custom { width: 70px; padding: .25rem .4rem; font-size: .85rem; border: 1px solid var(--border); border-radius: var(--radius-s); text-align: center; }
.family-result { margin-top: .8rem; min-height: 1.2rem; }
.family-result .notice.good { background: #e8f3de; border: 1px solid #b5d89a; color: #3a5f2e; padding: .5rem .7rem; border-radius: var(--radius-s); }
.family-result .error { background: #fdeae4; border: 1px solid #e9b2a4; color: #8a2e1f; padding: .5rem .7rem; border-radius: var(--radius-s); }
@media (max-width: 700px) {
  .family-actions { flex-direction: column; align-items: stretch; }
  .family-custom { width: 100%; }
}

/* Session-Cost-Dialog */
.cost-topic { font-family: 'Fraunces', serif; font-size: 1.2rem; margin-bottom: 1rem; }
.cost-section { background: #faf7f0; border-radius: var(--radius-s); padding: .8rem 1rem; margin-bottom: .8rem; }
.cost-section.cost-empty-pool { background: #f5f2ea; color: var(--muted); font-size: .9rem; }
.cost-section-title { font-weight: 600; margin-bottom: .5rem; display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.cost-pill { background: #fff; color: var(--accent-strong); padding: .15rem .6rem; border-radius: 999px; font-size: .82rem; font-weight: 700; border: 1px solid var(--border); }
.cost-explain { font-size: .88rem; color: var(--muted); }
.cost-reuse-list { display: flex; flex-direction: column; gap: .4rem; }
.cost-reuse-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; background: #fff; padding: .5rem .7rem; border-radius: var(--radius-s); border: 1px solid var(--border); }
.cost-reuse-topic { font-weight: 500; }
.cost-reuse-meta { font-size: .78rem; color: var(--muted); }
.btn-pill { background: var(--accent); color: #fff; border: none; border-radius: 999px; padding: .35rem .8rem; font-size: .82rem; font-weight: 600; cursor: pointer; }
.btn-pill:disabled { background: #cfc9bc; cursor: not-allowed; }
.btn-pill:hover:not(:disabled) { background: var(--accent-strong); }
.cost-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--border); gap: 1rem; }
.cost-balance { font-size: .9rem; color: var(--muted); }
.cost-balance strong { color: #6b4423; font-size: 1.1rem; }
.cost-actions { display: flex; gap: .5rem; }
.cost-warn { margin-top: .8rem; background: #fff4e5; border-left: 3px solid #d98b3a; padding: .6rem .8rem; border-radius: var(--radius-s); font-size: .85rem; color: #8a5a20; }

/* Legal-Viewer im Modal */
.legal-viewer {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: .5rem;
  margin-top: 1rem;
  font-size: .92rem;
  line-height: 1.55;
}
.legal-viewer h1 { font-size: 1.3rem; margin-top: 0; }
.legal-viewer h2 { font-size: 1.1rem; margin-top: 1.2rem; }
.legal-viewer h3 { font-size: .98rem; }
.legal-viewer table { border-collapse: collapse; font-size: .88rem; }
.legal-viewer table td, .legal-viewer table th { border: 1px solid var(--border); padding: .25rem .5rem; }

/* KI-Disclaimer (permanenter Hinweis über jeder Erklärung) */
.ai-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  padding: .7rem 1rem;
  margin-bottom: .8rem;
  background: #fff8ea;
  border: 1px solid #f0d47a;
  border-left: 4px solid #e0a82e;
  border-radius: var(--radius-s);
  font-size: .88rem;
  line-height: 1.4;
  color: #6b4e00;
}
.ai-disclaimer-icon { font-size: 1.15rem; line-height: 1; }

/* Explanation-Footer mit "Fehler melden"-Button */
.explanation-footer {
  display: flex;
  justify-content: flex-end;
  margin: .4rem 0 .2rem;
}
.explanation-footer .chip-btn { font-size: .82rem; }

/* Report-Button pro Prüfungsaufgabe — klein & unauffällig */
.q-report-btn {
  margin-left: .6rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: .85rem;
  padding: .1rem .4rem;
  border-radius: var(--radius-s);
  cursor: pointer;
  line-height: 1.2;
  vertical-align: middle;
}
.q-report-btn:hover {
  border-color: #e0a82e;
  color: #8a5a10;
  background: #fff8ea;
}

/* Verify-Banner (Kritiker-Pass) */
.verify-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
  margin: 0 0 1rem;
  padding: .6rem .9rem;
  border-radius: var(--radius-s);
  font-size: .9rem;
  line-height: 1.4;
}
.verify-banner .verify-icon { font-size: 1.1rem; }
.verify-banner details { flex: 0 0 100%; margin-top: .3rem; font-size: .85rem; }
.verify-banner details summary { cursor: pointer; color: var(--muted); }
.verify-banner details ul { margin: .3rem 0 0 1.3rem; color: var(--muted); }
.verify-pending {
  background: #f6f5ef;
  color: var(--muted);
  border: 1px dashed var(--border);
}
.verify-ok {
  background: #e6f7ef;
  color: #1d6d5f;
  border: 1px solid #9cd8c1;
}
.verify-improved {
  background: #eef3ff;
  color: #3652a4;
  border: 1px solid #b5c7f0;
}
.verify-warn {
  background: #fff4e0;
  color: #8a5a10;
  border: 1px solid #f0c97a;
}
.verify-error {
  background: #fdecea;
  color: #9a2a2a;
  border: 1px solid #f2b8b3;
}

/* Subject tiles (Fächer-Grid) */
.subject-tile { text-align: center; padding: 1.6rem 1rem 1.2rem; }
.subject-tile .subject-icon {
  font-size: 2.6rem;
  line-height: 1;
  margin-bottom: .6rem;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.04));
}
.subject-tile h3 { margin: 0 0 .2rem; font-size: 1.1rem; }
.subject-tile-add {
  border: 2px dashed var(--border);
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  transition: border-color .15s, color .15s, background .15s;
}
.subject-tile-add:hover {
  border-color: var(--accent-strong);
  color: var(--accent-strong);
  background: #f7fefd;
}
.subject-tile-add .subject-icon { font-size: 2.4rem; font-weight: 300; color: var(--accent-strong); }

/* Subject-Picker Modal */
.subject-picker { max-height: 60vh; overflow-y: auto; padding-right: .3rem; }
.subject-pick-group { margin-bottom: 1.2rem; }
.subject-pick-group h4 {
  margin: 0 0 .5rem;
  font-size: .75rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.subject-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: .6rem;
}
.subject-pick {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .35rem;
  padding: .9rem .4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.subject-pick:hover:not(.used) {
  border-color: var(--accent-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.subject-pick-icon { font-size: 1.9rem; line-height: 1; }
.subject-pick-name { font-size: .88rem; font-weight: 600; }
.subject-pick.used {
  opacity: .45;
  cursor: not-allowed;
  background: #f4f2ec;
}
.subject-pick-check {
  position: absolute;
  top: 4px; right: 6px;
  font-size: .85rem;
  color: var(--good);
  font-weight: 700;
}

.check-row { display: flex; align-items: center; gap: .6rem; padding: .45rem 0; }
.check-row input[type=checkbox] { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--accent-strong); cursor: pointer; }
.check-row label { margin: 0; font-weight: 500; color: var(--ink); cursor: pointer; font-size: .95rem; }

/* Global busy indicator (top-of-page indeterminate progress bar) */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent-strong) 30%, var(--accent) 50%, var(--accent-strong) 70%, transparent);
  background-size: 200% 100%;
  background-position: 100% 0;
  opacity: 0;
  transform: translateZ(0);
  pointer-events: none;
  z-index: 10000;
  transition: opacity .12s ease;
}
body.api-busy::before {
  opacity: 1;
  animation: api-busy-bar 1.1s linear infinite;
}
@keyframes api-busy-bar {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
/* While busy: keep normal cursor but float a color-cycling mini-owl next to it */
#cursor-owl {
  position: fixed;
  top: -100px; left: -100px;
  width: 28px; height: 28px;
  pointer-events: none;
  z-index: 100000;
  opacity: 0;
  transform: translate(12px, 14px);
  transition: opacity .12s ease;
  --owl-c: #ff6b9d;
  animation: owl-color-cycle 2.4s linear infinite;
}
#cursor-owl svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }
#cursor-owl .mo-wing,
#cursor-owl .mo-tuft,
#cursor-owl .mo-head,
#cursor-owl .mo-body { fill: var(--owl-c); transition: fill .15s linear; }
#cursor-owl .mo-face,
#cursor-owl .mo-eye-ring { fill: color-mix(in srgb, var(--owl-c) 22%, #fff); transition: fill .15s linear; }
#cursor-owl .mo-eye { fill: #fbbf24; stroke: var(--owl-c); stroke-width: 1.2; transition: stroke .15s linear; }
#cursor-owl .mo-pupil { fill: #1a1a1a; }
#cursor-owl .mo-beak { fill: #e88c3f; stroke: #a85f1c; stroke-width: .6; stroke-linejoin: round; }
#cursor-owl .mo-feet path { fill: none; stroke: #e88c3f; stroke-width: 2.2; stroke-linecap: round; }
body.api-busy #cursor-owl { opacity: 1; }
body.api-busy button:not(.btn-busy):not([data-no-busy]) { opacity: .85; }

/* Per-button busy state: inline owl + dimmed */
button.btn-busy {
  position: relative;
  opacity: .85;
  cursor: wait;
  pointer-events: none;
}

/* Color-cycling mini-owl as busy indicator (replaces old spinner wheel) */
@property --owl-c {
  syntax: '<color>';
  inherits: true;
  initial-value: #ff6b9d;
}
.busy-owl {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  vertical-align: -.2em;
  margin-right: .4em;
  --owl-c: #ff6b9d;
  animation: owl-color-cycle 2.4s linear infinite;
}
.busy-owl svg { width: 100%; height: 100%; display: block; }
.busy-owl .mo-wing,
.busy-owl .mo-tuft,
.busy-owl .mo-head,
.busy-owl .mo-body { fill: var(--owl-c); transition: fill .15s linear; }
.busy-owl .mo-face,
.busy-owl .mo-eye-ring { fill: color-mix(in srgb, var(--owl-c) 22%, #fff); transition: fill .15s linear; }
.busy-owl .mo-eye { fill: #fbbf24; stroke: var(--owl-c); stroke-width: 1.2; transition: stroke .15s linear; }
.busy-owl .mo-pupil { fill: #1a1a1a; }
.busy-owl .mo-beak { fill: #e88c3f; stroke: #a85f1c; stroke-width: .6; stroke-linejoin: round; }
.busy-owl .mo-feet path { fill: none; stroke: #e88c3f; stroke-width: 2.2; stroke-linecap: round; }

.busy-owl-lg { width: 32px; height: 32px; vertical-align: middle; margin-right: .6rem; }

/* Zeichnende Eule — Platzhalter während im Chat eine Grafik (SVG/Mermaid) generiert wird */
.stream-owl {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin: .25rem 0;
  font-size: .92rem;
  color: #8a7f72;
  vertical-align: middle;
}
.stream-owl .stream-owl-icon {
  display: inline-block;
  width: 2em;
  height: 2em;
  --owl-c: #ff6b9d;
  transform-origin: 50% 60%;
  animation: owl-fly 3s ease-in-out infinite, owl-color-cycle 3s linear infinite;
  will-change: transform;
}
.stream-owl .stream-owl-icon svg { width: 100%; height: 100%; display: block; }
.stream-owl .stream-owl-icon .mo-wing,
.stream-owl .stream-owl-icon .mo-tuft,
.stream-owl .stream-owl-icon .mo-head,
.stream-owl .stream-owl-icon .mo-body { fill: var(--owl-c); }
.stream-owl .stream-owl-icon .mo-face,
.stream-owl .stream-owl-icon .mo-eye-ring { fill: color-mix(in srgb, var(--owl-c) 22%, #fff); }
.stream-owl .stream-owl-icon .mo-eye { fill: #fbbf24; stroke: var(--owl-c); stroke-width: 1.2; }
.stream-owl .stream-owl-icon .mo-pupil { fill: #1a1a1a; }
.stream-owl .stream-owl-icon .mo-beak { fill: #e88c3f; stroke: #a85f1c; stroke-width: .6; stroke-linejoin: round; }
.stream-owl .stream-owl-icon .mo-feet path { fill: none; stroke: #e88c3f; stroke-width: 2.2; stroke-linecap: round; }
.stream-owl .stream-owl-icon .mo-wing { transform-box: fill-box; transform-origin: 50% 14%; animation: owl-flap .3s ease-in-out infinite; }
.stream-owl .stream-owl-label { font-style: italic; opacity: .85; }

@keyframes owl-fly {
  0%   { transform: translate(0,0) rotate(0deg) scale(1); }
  14%  { transform: translate(13px,-16px) rotate(14deg) scale(1.05); }
  28%  { transform: translate(22px,-3px) rotate(-8deg); }
  42%  { transform: translate(8px,-22px) rotate(10deg) scale(1.08); }
  58%  { transform: translate(-11px,-9px) rotate(355deg); }
  72%  { transform: translate(-21px,-1px) rotate(372deg) scale(1.05); }
  86%  { transform: translate(-7px,-15px) rotate(350deg); }
  100% { transform: translate(0,0) rotate(360deg) scale(1); }
}
@keyframes owl-flap {
  0%,100% { transform: rotate(0deg); }
  50%     { transform: rotate(-34deg); }
}
@media (prefers-reduced-motion: reduce) {
  .stream-owl .stream-owl-icon { animation: owl-color-cycle 3s linear infinite; }
  .stream-owl .stream-owl-icon .mo-wing { animation: none; }
}

@keyframes owl-color-cycle {
  0%   { --owl-c: #ff6b9d; }   /* pink */
  20%  { --owl-c: #4ecdc4; }   /* türkis */
  40%  { --owl-c: #ffd93d; }   /* gelb */
  60%  { --owl-c: #a78bfa; }   /* violett */
  80%  { --owl-c: #f97316; }   /* orange */
  100% { --owl-c: #ff6b9d; }
}

/* Fallback for browsers without @property support: swap via keyframes on fill directly. */
@supports not (background: paint(something)) {
  .busy-owl .mo-head,
  .busy-owl .mo-body,
  .busy-owl .mo-wing,
  .busy-owl .mo-tuft { animation: owl-fill-cycle 2.4s linear infinite; }
  @keyframes owl-fill-cycle {
    0%,100% { fill: #ff6b9d; }
    20% { fill: #4ecdc4; }
    40% { fill: #ffd93d; }
    60% { fill: #a78bfa; }
    80% { fill: #f97316; }
  }
}
.notice { padding: .7rem 1rem; border-radius: var(--radius-s); margin-bottom: .9rem; }
.notice.good { background: #dff5ed; color: #1d6d5f; border: 1px solid #9cd8c1; }

/* ===== Role tags + user chip ===== */
.role-tag {
  display: inline-block;
  padding: .1rem .5rem;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .03em;
  margin-left: .35rem;
  text-transform: uppercase;
}
.role-admin { background: #fbe5e9; color: #a6242f; }
.role-parent { background: #cdeee4; color: #1d6d5f; }
.role-child { background: #fde8f0; color: #b9275e; }

.chip-menu-btn {
  background: transparent; border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0 .2rem;
  margin-left: .2rem;
}

.user-menu {
  position: fixed; top: 3.3rem; right: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0,0,0,.1);
  min-width: 220px;
  padding: .35rem;
  z-index: 20;
  display: flex; flex-direction: column;
}
.user-menu-item {
  background: transparent;
  color: var(--text);
  border: none;
  text-align: left;
  padding: .55rem .8rem;
  border-radius: var(--radius-s);
  cursor: pointer;
  font: inherit;
}
.user-menu-item:hover { background: var(--bg); }

/* ===== Parent-Dashboard tiles ===== */
.child-tile { padding-bottom: 1rem; }
.child-actions {
  display: flex; gap: .4rem; justify-content: center;
  margin-top: .8rem; flex-wrap: wrap;
}
.chip-btn {
  background: var(--accent); color: white;
  border: none; padding: .35rem .8rem;
  border-radius: 999px; font-size: .85rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.chip-btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.chip-btn.danger { background: var(--danger); }
.chip-btn:hover { filter: brightness(1.05); }

/* ===== Admin: user table ===== */
.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
}
.users-table th, .users-table td {
  padding: .55rem .7rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.users-table th { background: #f7f5ef; font-weight: 700; font-size: .85rem; }
.users-table tbody tr:hover { background: #fafaf5; }
.row-actions { display: flex; gap: .35rem; flex-wrap: wrap; }
.error-text { color: var(--danger); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.3);
  display: flex; align-items: center; justify-content: center;
  z-index: 30;
  padding: 1rem;
}
.modal-card {
  width: 100%; max-width: 480px;
  background: var(--surface);
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
  max-height: 90vh; overflow-y: auto;
}

/* ===== Mini-Owl Rating ===== */
.owl-rating { display: inline-flex; align-items: center; gap: 2px; }
.owl-rating-sm .mini-owl-svg { width: 18px; height: 18px; }
.owl-rating-md .mini-owl-svg { width: 24px; height: 24px; }
.owl-rating-lg .mini-owl-svg { width: 34px; height: 34px; }
.owl-rating.empty-rating em { font-size: .82rem; }
.rating-score { font-size: .8rem; color: var(--muted); margin-left: .35rem; font-weight: 600; }

.mini-owl { display: inline-flex; }
.mini-owl-svg { display: block; }

.mini-owl.filled .mo-wing { fill: #6d3f22; }
.mini-owl.filled .mo-tuft { fill: #7d4e2d; }
.mini-owl.filled .mo-head { fill: #7d4e2d; }
.mini-owl.filled .mo-body { fill: #7d4e2d; }
.mini-owl.filled .mo-face { fill: #e5c299; }
.mini-owl.filled .mo-eye-ring { fill: #f3d9a8; }
.mini-owl.filled .mo-eye { fill: #fbbf24; stroke: #7d4e2d; stroke-width: 1.2; }
.mini-owl.filled .mo-pupil { fill: #1a1a1a; }
.mini-owl.filled .mo-beak { fill: #e88c3f; stroke: #a85f1c; stroke-width: 0.6; stroke-linejoin: round; }
.mini-owl.filled .mo-feet path { fill: none; stroke: #e88c3f; stroke-width: 2.2; stroke-linecap: round; }

.mini-owl.empty .mo-wing,
.mini-owl.empty .mo-tuft,
.mini-owl.empty .mo-head,
.mini-owl.empty .mo-body,
.mini-owl.empty .mo-eye,
.mini-owl.empty .mo-beak {
  fill: none;
  stroke: #7d4e2d;
  stroke-width: 3;
  stroke-linejoin: round;
  opacity: 0.38;
}
.mini-owl.empty .mo-eye { stroke-width: 2.5; }
.mini-owl.empty .mo-beak { stroke-width: 2.5; }
.mini-owl.empty .mo-feet path {
  fill: none;
  stroke: #7d4e2d;
  stroke-width: 2.5;
  stroke-linecap: round;
  opacity: 0.38;
}
.mini-owl.empty .mo-face,
.mini-owl.empty .mo-eye-ring,
.mini-owl.empty .mo-pupil { display: none; }

.tile-rating { margin-top: .4rem; }
.session-rating { display: inline-flex; align-items: center; }

/* Lehrplan-Badge (Session-Header, Preview-Cards) */
.lehrplan-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .55rem;
  font-size: .78rem; font-weight: 500;
  background: #f2e8cf; color: #4a3a1f;
  border: 1px solid #d4bf8a; border-radius: 999px;
  cursor: help; white-space: nowrap;
}
.lehrplan-badge.compact { font-size: .72rem; padding: .12rem .45rem; }

/* Parent-Dashboard */
.dash-card { background: linear-gradient(180deg, #fffdf5, #fff9ea); }
.dash-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .8rem; margin: .8rem 0 1.2rem; }
.dash-summary .summary-tile { padding: .7rem .9rem; }
.dash-summary .summary-val { font-size: 1.4rem; }
.dash-spark { margin: 0 0 1rem; }
.dash-spark-svg { width: 100%; height: 70px; display: block; }
.dash-spark-bar { fill: var(--accent-strong); }
.dash-spark-bar.empty { fill: #eadbb6; }
.dash-subjects { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .7rem; }
.dash-subject { background: #fdfbf4; border: 1px solid var(--border); border-radius: var(--radius-s); padding: .6rem .8rem; }
.dash-subject-head { display: flex; justify-content: space-between; gap: .6rem; margin-bottom: .4rem; font-size: .92rem; flex-wrap: wrap; }
.dash-bar { position: relative; height: 8px; background: #eadbb6; border-radius: 4px; overflow: hidden; }
.dash-bar-fill { height: 100%; background: linear-gradient(90deg, #d5a85a, var(--accent-strong)); border-radius: 4px; transition: width .4s ease; }
.dash-bar-label { font-size: .78rem; color: var(--muted); margin-top: .2rem; font-variant-numeric: tabular-nums; }
.dash-recent-wrap { overflow-x: auto; }
.dash-recent { width: 100%; border-collapse: collapse; font-size: .9rem; }
.dash-recent td { padding: .4rem .5rem; border-bottom: 1px solid var(--border); }
.dash-recent tr:last-child td { border-bottom: none; }
.dash-score { font-weight: 600; color: var(--accent-strong); font-variant-numeric: tabular-nums; }

/* Tutorial / Onboarding */
.btn-ghost {
  background: transparent;
  color: var(--accent-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: .55rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-ghost:hover { background: #faf6ea; }
.btn-ghost:disabled { opacity: .5; cursor: not-allowed; }

.tut-gate {
  max-width: 640px;
  margin: 3rem auto;
  padding: 2rem 2rem 2.2rem;
  background: linear-gradient(180deg, #fffdf5, #fdf4dc);
  border: 1px solid var(--border);
  border-radius: var(--radius-l, 16px);
  text-align: center;
  box-shadow: 0 12px 40px rgba(125, 78, 45, 0.08);
}
.tut-gate-owl { font-size: 3.5rem; margin-bottom: .6rem; }
.tut-gate-title {
  font-family: 'Fraunces', serif;
  font-size: 1.9rem;
  font-weight: 600;
  color: var(--accent-strong);
  margin: 0 0 .6rem;
}
.tut-gate-lead { font-size: 1.05rem; color: #5a4a38; margin: 0 auto 1.6rem; max-width: 480px; line-height: 1.5; }
.tut-gate-actions { display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1.4rem; }
.tut-gate-actions .btn-primary { padding: .7rem 1.4rem; font-size: 1.02rem; }
.tut-gate-check {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .6rem;
  align-items: start;
  font-size: .9rem;
  color: #6a5843;
  max-width: 520px;
  margin: 0 auto .9rem;
  text-align: left;
  cursor: pointer;
  line-height: 1.45;
}
.tut-gate-check input { margin-top: .2rem; }
.tut-gate-check span { min-width: 0; }
.tut-gate-hint { font-size: .82rem; margin-top: .4rem; }

.tut-wrap { max-width: 720px; margin: 1.5rem auto 3rem; }
.tut-progress {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 .4rem .7rem;
}
.tut-dots { display: flex; gap: .4rem; }
.tut-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #e5dbc4;
  cursor: pointer;
  transition: background .15s, transform .15s;
}
.tut-dot:hover { transform: scale(1.2); }
.tut-dot.on { background: var(--accent-strong); }
.tut-slide {
  padding: 2rem 2rem 2.2rem;
  background: linear-gradient(180deg, #fffdf5, #fcf7e9);
}
.tut-icon { font-size: 2.8rem; margin-bottom: .5rem; line-height: 1; }
.tut-title {
  font-family: 'Fraunces', serif;
  font-size: 1.7rem;
  color: var(--accent-strong);
  margin: 0 0 .4rem;
  font-weight: 600;
}
.tut-lead { font-size: 1.05rem; color: #5a4a38; margin: 0 0 1.4rem; font-style: italic; }
.tut-body p { margin: 0 0 .7rem; line-height: 1.55; color: #3c2e20; }
.tut-body p strong { color: var(--accent-strong); }
.tut-nav {
  display: flex; justify-content: space-between; gap: .6rem;
  margin-top: 1.2rem;
}
.tut-nav .btn-primary { padding: .6rem 1.3rem; font-size: 1rem; }
.tut-nav .btn-ghost { padding: .6rem 1.1rem; }
@media (max-width: 560px) {
  .tut-gate { margin: 1rem; padding: 1.5rem 1.2rem; }
  .tut-slide { padding: 1.3rem 1.2rem 1.5rem; }
  .tut-title { font-size: 1.4rem; }
  .tut-gate-title { font-size: 1.5rem; }
}

/* Tutorial im Modal (Landing-Variante) */
#modal-overlay .modal-card:has(.tut-modal),
#modal-overlay .modal-card.modal-card-tut { max-width: 760px; padding: 1rem 1.2rem 1.2rem; }
#modal-overlay .tut-modal { width: 100%; }
#modal-overlay .tut-modal .tut-wrap { margin: 0; max-width: none; }
#modal-overlay .tut-modal .tut-slide { padding: 1.6rem 1.4rem 1.8rem; }
#modal-overlay .tut-modal .tut-progress { padding: 0 .2rem .6rem; position: relative; }
.tut-close {
  position: absolute; right: 0; top: -.3rem;
  background: transparent; border: none; color: #8a7654;
  font-size: 1.8rem; line-height: 1; cursor: pointer;
  padding: .15rem .5rem; border-radius: 50%;
  transition: background .15s, color .15s;
}
.tut-close:hover { background: #f0e6cd; color: var(--accent-strong); }

/* Avatar-System (10 Tiere, einheitliches Farbschema via --avatar-c) */
.avatar-svg { width: 100%; height: 100%; display: block; }
.avatar-svg .a-body,
.avatar-svg .a-head,
.avatar-svg .a-ear,
.avatar-svg .a-wing { fill: var(--avatar-c, #7d4e2d); }
.avatar-svg .a-face,
.avatar-svg .a-belly,
.avatar-svg .a-ear-inner { fill: #fff9ea; }
.avatar-svg .a-eye,
.avatar-svg .a-pupil,
.avatar-svg .a-nose,
.avatar-svg .a-accent-dark { fill: #2a1a0a; }
.avatar-svg .a-white { fill: #fffefa; }

.profile-avatar {
  --avatar-c: #7d4e2d;
  width: 100%;
  height: 100%;
}

/* Avatar-Picker-Grid im Dialog */
.avatar-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .55rem;
  margin-top: .4rem;
}
.avatar-opt {
  background: #fdfbf4;
  border: 2px solid var(--border);
  border-radius: var(--radius-s);
  padding: .4rem;
  cursor: pointer;
  transition: border-color .15s, transform .1s;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.avatar-opt:hover { border-color: var(--accent-strong); transform: translateY(-1px); }
.avatar-opt.selected { border-color: var(--accent-strong); background: #fdf4dc; }
.avatar-opt.selected::after {
  content: "✓"; position: absolute; top: 2px; right: 4px;
  font-size: .75rem; color: var(--accent-strong); font-weight: 700;
}
.avatar-opt .avatar-svg { width: 70%; height: 70%; pointer-events: none; }
.avatar-opt svg, .avatar-opt svg * { pointer-events: none; }
.avatar-opt-label {
  display: none;
}
@media (max-width: 520px) {
  .avatar-picker { grid-template-columns: repeat(4, 1fr); }
}

/* Avatar-Preview groß (im Formular) */
.avatar-preview {
  width: 84px; height: 84px;
  margin: 0 auto .6rem;
  border-radius: 50%;
  background: #fdfbf4;
  border: 2px solid var(--border);
  padding: .4rem;
  display: flex; align-items: center; justify-content: center;
}
