/* Modern look (2026-11-21): loaded last, works with every colour scheme and font set (appearance.py).
   Calmer headings, compact one-line top bar, outlined secondary buttons, lighter lines and shadows.
   Only shared building blocks; module stylesheets keep their own details. */

body {
  --line: color-mix(in srgb, var(--ink) 12%, var(--card));
  --line-strong: color-mix(in srgb, var(--ink) 22%, var(--card));
  --muted: color-mix(in srgb, var(--ink) 68%, var(--card));
  --tint: color-mix(in srgb, var(--green) 7%, var(--card));
  --ring: color-mix(in srgb, var(--green) 28%, transparent);
  --shadow: 0 1px 2px color-mix(in srgb, var(--ink) 5%, transparent), 0 4px 14px color-mix(in srgb, var(--ink) 4%, transparent);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body[data-theme="contrast"] { --line-strong: var(--line); }

/* Headings: smaller and tighter instead of large magazine titles. */
h1 { font-size: clamp(28px, 2.6vw, 36px); line-height: 1.15; letter-spacing: -.02em; font-weight: 650; margin-bottom: 8px; }
h2 { font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
h3 { font-size: 15.5px; font-weight: 650; }
body[data-font="editorial"] h1 { font-weight: 600; }
.lead { font-size: 15.5px; line-height: 1.55; margin-bottom: 0; }
.eyebrow { font-size: 11px; letter-spacing: .08em; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.page-heading { margin-bottom: 26px; }
.back { font-size: 13px; margin-bottom: 10px; }
.stat strong { font-size: 40px; font-weight: 600; letter-spacing: -.02em; }
.stat { min-height: 0; padding: 20px 22px; gap: 4px; }
.stat:hover { transform: none; }

/* Cards: hairline border, soft shadow. */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.panel { padding: 22px; }
.section-heading h2 { margin-bottom: 14px; }

/* Buttons: secondary ones outlined instead of filled grey-green. */
.button { border-radius: 10px; padding: 9px 15px; font-weight: 650; gap: 6px;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, filter .15s ease; }
.button.secondary, .button.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line-strong); }
.button.secondary:hover, .button.ghost:hover { background: var(--tint); border-color: color-mix(in srgb, var(--green) 40%, var(--line)); }
.button.primary { box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 12%, transparent); }
.button.danger { border-radius: 10px; }
.button:focus-visible, a:focus-visible, select:focus-visible, summary:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }

/* Form fields */
.field input, .field select, .field textarea, .filter-bar select, .settings-form select, .class-switcher select {
  border-radius: 10px; border: 1px solid var(--line-strong); background: var(--card); }
.field input:focus, .field select:focus, .field textarea:focus, .settings-form select:focus {
  outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--ring); }
.field label { font-weight: 650; }

/* Tables and calendar headers: light tint instead of filled grey-green. */
th { letter-spacing: .06em; }
.calendar-week thead th, .calendar-time, .week-grid thead th { background: var(--tint); }
.pill { background: var(--tint); color: var(--ink); border: 1px solid var(--line); }
.alert { border-radius: 10px; }

/* Top bar on wide screens: one compact line over the full width, the menu scrolls instead of wrapping. */
@media (min-width: 851px) {
  .topbar { min-height: 60px; height: 60px; padding: 0 20px; gap: 16px; flex-wrap: nowrap;
    background: color-mix(in srgb, var(--card) 92%, transparent); box-shadow: none; }
  .topbar .brand { font-size: 16px; gap: 9px; }
  .topbar .brand-mark { width: 30px; height: 30px; border-radius: 9px; font-size: 18px; }
  .topbar nav { flex: 1 1 auto; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 2px; min-width: 0; }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav a { padding: 7px 11px; border-radius: 8px; font-size: 14px; font-weight: 550; }
  .topbar nav a[aria-current="page"] { background: var(--tint); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
  .topbar .class-switcher select { height: 36px; padding: 0 30px 0 10px; font-weight: 650; font-size: 14px; }
  .topbar .account-details summary { padding: 7px 10px; font-size: 14px; }
}

/* Class sidebar on wide screens: each area is its own soft panel, the current page a white card with an accent
   bar. Icons unchanged (_class_nav_icon.html). The phone keeps its row of icons (class-navigation.css). */
@media (min-width: 851px) {
  .class-bar { background: var(--paper); border-right: 1px solid var(--line); }
  .class-bar-inner { gap: 10px; padding: 14px 12px 28px; }
  .class-bar-head { margin-bottom: 2px; padding: 2px 2px 0 4px; }
  .class-bar-name { padding: 6px 12px; border-radius: 10px; font-size: 14px; font-weight: 750; letter-spacing: -.01em;
    box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 14%, transparent); }
  .class-bar-toggle { border-radius: 10px; border-color: var(--line); background: var(--card); }
  .class-bar-group, .class-bar-group + .class-bar-group {
    margin: 0; padding: 6px; gap: 1px; border: 1px solid var(--line); border-radius: 14px;
    background: color-mix(in srgb, var(--ink) 2.5%, var(--card)); }
  .class-bar-heading { padding: 6px 8px 6px; color: var(--muted); font-size: 10.5px; font-weight: 750; letter-spacing: .08em; }
  .class-bar .class-bar-group a:not(.class-bar-name) { min-height: 38px; padding: 7px 10px; border-radius: 10px;
    color: color-mix(in srgb, var(--ink) 78%, var(--card)); font-weight: 600; transition: background-color .15s ease, color .15s ease; }
  .class-bar .class-bar-group a:not(.class-bar-name):hover { background: var(--card); color: var(--ink); }
  .class-bar .class-bar-group a[aria-current="page"] { background: var(--card); color: var(--ink); font-weight: 700;
    box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 10%, transparent), inset 0 0 0 1px var(--line); }
  .class-bar .class-bar-group a[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px;
    width: 3px; border-radius: 0 3px 3px 0; background: var(--green); }
  .class-bar .class-bar-group a[aria-current="page"] .class-nav-icon { color: var(--green); }
  .is-collapsed .class-bar-inner { padding-left: 8px; padding-right: 8px; }
  .is-collapsed .class-bar-group, .is-collapsed .class-bar-group + .class-bar-group { padding: 4px; }
}

/* Base for every text, number, date, search and choice field and textarea, also outside «.field» (e.g. the extra
   time in the live view of the online tests): without it the browser default «2px inset» comes back. :where() keeps
   the specificity at zero, so module rules still override size and spacing. Colours follow below. */
:where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="submit"],
  [type="button"], [type="reset"], [type="hidden"], [type="image"]), select, textarea) {
  border: 1px solid var(--field-border, var(--line-strong)); border-radius: 8px; padding: 5px 9px; font: inherit;
  font-size: max(14px, 1em); line-height: 1.3; min-height: 30px; box-sizing: border-box; }
:where(textarea) { min-height: 64px; }
:where(select) { padding-right: 26px; }
/* Number fields: arrows only on hover/focus in Chromium; Firefox keeps its slim arrows. */
:where(input[type="number"])::-webkit-inner-spin-button { opacity: 0; }
:where(input[type="number"]:hover, input[type="number"]:focus)::-webkit-inner-spin-button { opacity: .6; }

/* Input fields stand out from cards: a slightly different background, derived from the scheme (light and dark).
   High enough specificity to beat module rules such as «.field input»; focus returns to the card colour. */
body { --field: color-mix(in srgb, var(--ink) 4.5%, var(--card)); --field-border: color-mix(in srgb, var(--ink) 20%, var(--card)); }
:root body :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="submit"],
  [type="button"], [type="reset"], [type="hidden"], [type="image"]), select, textarea, .richtext-editor) {
  background-color: var(--field); border-color: var(--field-border); color: var(--ink);
}
:root body :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="submit"],
  [type="button"], [type="reset"], [type="hidden"], [type="image"]), select, textarea, .richtext-editor):focus {
  background-color: var(--card); border-color: var(--green);
}
:root body :is(input, select, textarea):disabled, :root body input[readonly] { background-color: color-mix(in srgb, var(--ink) 8%, var(--card)); }

/* Online tests start page: sets and runs as clearly separate areas. */
.ot-home-section { position: relative; overflow: hidden; padding-top: 0; }
.ot-home-section + .ot-home-section { margin-top: 26px; }
.ot-home-section::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--section-accent, var(--green)); }
.ot-home-runs { --section-accent: color-mix(in srgb, var(--green) 45%, #4f7cff); }
.ot-home-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 -22px 14px;
  padding: 16px 22px 14px; background: color-mix(in srgb, var(--section-accent, var(--green)) 8%, var(--card)); border-bottom: 1px solid var(--line); }
.ot-home-head h2 { margin: 0; }
.ot-home-head .eyebrow { margin-bottom: 2px; }
.ot-home-head .pill { min-width: 28px; justify-content: center; }
/* Cards placed directly one after the other on a page keep a gap. */
.shell > .card + .card { margin-top: 22px; }

/* Class tiles: the name fits the badge in every font set (long names like «Demo 7a» wrap smaller). */
.class-badge { font-family: var(--heading-font, sans-serif); font-size: 17px; font-weight: 700; line-height: 1.05;
  text-transform: none; text-align: center; padding: 6px; overflow: hidden; overflow-wrap: anywhere; border-radius: 16px; }

/* Page heading actions stay together on the right and wrap as a group instead of leaving one button behind. */
/* Only side by side (wide screens): there the heading text takes the free width. On phones the heading is a
   column, where a flex basis would become a minimum height. */
@media (min-width: 851px) { .page-heading:not(.class-heading) > div:first-child { flex: 1 1 320px; min-width: 0; } }
.page-heading:not(.class-heading) > :last-child:not(:first-child):has(> .button, > form > .button) {
  flex: 0 1 auto; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px;
  max-width: min(620px, 58%);
}
@media (max-width: 850px) {
  .page-heading:not(.class-heading) > :last-child:not(:first-child):has(> .button, > form > .button) { max-width: none; justify-content: flex-start; }
}
.class-heading .class-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }

/* One focus ring for every field, also where module styles set none (e.g. the sign-in form). */
:root body :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="submit"],
  [type="button"], [type="reset"], [type="hidden"], [type="image"]), select, textarea):focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--ring);
}

/* Phone: the class switcher uses the free width in the top bar. */
@media (max-width: 850px) {
  .topbar .class-switcher { flex: 1 1 auto; min-width: 0; }
  .topbar .class-switcher select { width: 100%; max-width: none; }
}

/* Sign-in and other bare forms: fields look like everywhere else (no inset browser frame). */
.auth-card :is(input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="submit"]), select) {
  width: 100%; padding: 11px 12px; border: 1px solid var(--field-border); border-radius: 10px; font: inherit; }

/* Every popup (page popups, grades, PDF options, draws, quick task, formula editor) dims and softly blurs the page
   behind it in the same way, with or without the glass effect. Fallback without backdrop-filter: dimming only. */
:root dialog::backdrop { background: rgba(10, 16, 14, .38); }
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root dialog::backdrop { background: rgba(10, 16, 14, .28); -webkit-backdrop-filter: blur(6px) saturate(115%); backdrop-filter: blur(6px) saturate(115%); }
}
@media (prefers-reduced-transparency: reduce) {
  :root dialog::backdrop { background: rgba(10, 16, 14, .5); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* Empty states: icon, short text, optional button to get started. */
.empty { gap: 6px; padding: 30px 18px; }
.empty::before { content: ""; width: 40px; height: 40px; margin-bottom: 4px; background: var(--green); opacity: .5;
  -webkit-mask: var(--empty-icon) center / contain no-repeat; mask: var(--empty-icon) center / contain no-repeat;
  --empty-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 13l2.2-7.2A2 2 0 0 1 8.1 4.4h7.8a2 2 0 0 1 1.9 1.4L20 13'/%3E%3Cpath d='M4 13v5a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5h-4.5l-1 2h-5l-1-2z'/%3E%3C/svg%3E"); }
.empty strong { font-size: 15px; }
.empty span { max-width: 46ch; }
.empty .button { margin-top: 8px; }
td > .empty { padding: 22px 8px; }

/* «Heute»: overview strip above the timetable. */
.today-overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.today-tile { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border: 1px solid var(--line);
  border-radius: 14px; background: var(--card); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; min-width: 0;
  transition: border-color .15s ease, transform .15s ease; }
a.today-tile:hover { border-color: color-mix(in srgb, var(--green) 45%, var(--line)); transform: translateY(-1px); }
.today-icon { flex: 0 0 auto; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
  background: var(--tint); color: var(--green); }
.today-text { display: flex; flex-direction: column; min-width: 0; }
.today-text small { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.today-text strong { font-size: 17px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today-text span { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today-tile.is-attention .today-icon { background: color-mix(in srgb, #e08a1e 18%, var(--card)); color: #b8650b; }
.today-tile.is-quiet { box-shadow: none; }
@media (max-width: 1100px) { .today-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .today-overview { grid-template-columns: 1fr; gap: 10px; } }

/* Sign-in page: short overview of what the planner offers, soft colour behind. */
.auth-card { position: relative; }
.auth-card::before { content: ""; position: absolute; z-index: -1; inset: -40px auto auto -60px; width: 520px; height: 420px;
  border-radius: 50%; filter: blur(60px); opacity: .55; pointer-events: none;
  background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--green) 30%, transparent), transparent 70%); }
.auth-features { list-style: none; display: grid; gap: 14px; margin: 28px 0 0; padding: 0; max-width: 460px; }
.auth-features li { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: start; }
.auth-features .today-icon { width: 40px; height: 40px; }
.auth-features strong { display: block; font-size: 15px; }
.auth-features span { color: var(--muted); font-size: 14px; }

/* Phone: list tables as one card per row (responsive-tables.js sets the column labels). */
@media (max-width: 640px) {
  .table-card:has(.stack-table) { overflow: visible; background: transparent; border: 0; box-shadow: none; }
  table.stack-table, table.stack-table tbody, table.stack-table tr, table.stack-table td { display: block; width: 100%; }
  table.stack-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stack-table tr { margin-bottom: 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px;
    background: var(--card); box-shadow: var(--shadow); }
  table.stack-table { min-width: 0 !important; table-layout: auto; }
  table.stack-table td { padding: 6px 0; border: 0; min-width: 0; max-width: none; white-space: normal; overflow-wrap: anywhere; text-align: left; }
  table.stack-table td + td { border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
  table.stack-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; color: var(--muted);
    font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
  table.stack-table td[data-label=""]::before { content: none; }
}

/* Quick switch light/dark/system in the header (left of the user menu) */
.mode-switch { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; margin: 0 4px 0 auto; }
.mode-switch button { display: grid; place-items: center; width: 30px; height: 28px; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer; }
.mode-switch button:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.mode-switch button[aria-pressed="true"] { background: var(--green); color: var(--accent-ink); }
.mode-switch .class-nav-icon { width: 16px; height: 16px; }
@media (max-width: 850px) { .mode-switch { margin-left: 0; } .mode-switch button { width: 28px; } }
@media print { .mode-switch { display: none; } }
/* Medium widths (laptops): menu entries closer together so that all fit beside class choice and switch */
@media (min-width: 851px) and (max-width: 1599px) {
  .topbar { gap: 10px; }
  .topbar nav a { padding: 7px 7px; font-size: 13.5px; }
  .topbar .class-switcher select { max-width: 170px; }
  .topbar .brand > span:not(.brand-mark) { display: none; }  /* logo «S» only; the link keeps its label */
}

/* =====================================================================================================================
   Design 2026-11 (docs/DESIGN.md), Stufe 1: tokens, buttons, fields with unit, cards, header.
   Flat with depth through surface tones and 1 px lines; shadows only for floating layers. All colours derive from the
   scheme (--green = accent, --ink, --card, --paper), so the colour schemes and custom colours keep working.
   ":root body" beats the generated dark.css (same selectors, loaded later).
   ===================================================================================================================== */
body {
  --surface-0: var(--paper);
  --surface-1: var(--card);
  --surface-2: color-mix(in srgb, var(--ink) 5%, var(--card));
  --line: color-mix(in srgb, var(--ink) 11%, var(--card));
  --line-strong: color-mix(in srgb, var(--ink) 20%, var(--card));
  --muted: color-mix(in srgb, var(--ink) 70%, var(--card));
  --accent: var(--green);
  --accent-hover: color-mix(in srgb, var(--green) 84%, var(--ink));
  --accent-soft: color-mix(in srgb, var(--green) 13%, var(--card));
  --accent-soft-ink: color-mix(in srgb, var(--green) 70%, var(--ink));
  --success-bg: light-dark(#e7f5ee, #12301f); --success-ink: light-dark(#1a6b43, #7fdcaa); --success-dot: light-dark(#1f9d5c, #5fd497);
  --warning-bg: light-dark(#fdf3dc, #33270c); --warning-ink: light-dark(#7a4f00, #f1c66b); --warning-dot: light-dark(#c98a12, #f1c66b);
  --danger-bg: light-dark(#fdecea, #3a1715); --danger-ink: light-dark(#a3221a, #f4a29b); --danger-dot: light-dark(#d63b30, #f4a29b);
  --danger-solid: light-dark(#b42318, #c2392f);
  --neutral-bg: light-dark(#eef1f4, #222a33); --neutral-ink: light-dark(#46515d, #b7c1cb);
  --radius-s: 8px; --radius-m: 10px; --radius-l: 16px; --radius-note: 12px;
  --ring: light-dark(color-mix(in srgb, var(--green) 22%, transparent), color-mix(in srgb, var(--green) 28%, transparent));
  --shadow: none;
  --shadow-float: 0 10px 28px color-mix(in srgb, var(--ink) 12%, transparent), 0 2px 6px color-mix(in srgb, var(--ink) 6%, transparent);
  background: var(--surface-0);
}
body[data-theme="contrast"] { --line: color-mix(in srgb, var(--ink) 30%, var(--card)); --line-strong: color-mix(in srgb, var(--ink) 55%, var(--card));
  --muted: color-mix(in srgb, var(--ink) 82%, var(--card)); }

/* Type: Inter for «Modern» (fonts.css, self-hosted); numbers line up */
:root body { font-family: var(--body-font, system-ui, sans-serif); }
:root body :is(h1, h2, h3, h4) { font-family: var(--heading-font, var(--body-font, system-ui, sans-serif)); }
:root body h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
:root body h2 { font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
:root body h3 { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
:root body :is(table, .stat strong, .ot-clock, .badge, .counter, td, .tabular) { font-variant-numeric: tabular-nums; }

/* Cards and tiles: surface, hairline, radius 16, no shadow */
:root body .card { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: none; }
:root body .stat { padding: 16px 20px; }
:root body .stat > span, :root body .stat small { font-size: 13px; }
:root body .stat strong { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin: 6px 0 2px; }
:root body .alert { border-radius: var(--radius-note); }

/* Buttons: height 40 (compact 32), radius 10, 600/15, icon gap 8, no shadow, rank by role */
:root body .button { min-height: 40px; padding: 0 16px; border-radius: var(--radius-m); font-size: 15px; font-weight: 600; gap: 8px;
  line-height: 1.2; box-shadow: none; border: 1px solid transparent;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease, transform .12s ease; }
:root body .button.compact { min-height: 32px; padding: 0 10px; font-size: 13px; }
:root body .button:active:not(:disabled) { transform: scale(.98); }
:root body .button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
:root body .button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
:root body :is(.button.secondary, .button:not(.primary):not(.ghost):not(.danger)) { background: var(--surface-1); color: var(--ink); border-color: var(--line-strong); }
:root body :is(.button.secondary, .button:not(.primary):not(.ghost):not(.danger)):hover { background: var(--surface-2); border-color: var(--line-strong); }
:root body .button.ghost { background: transparent; color: var(--ink); border-color: transparent; }
:root body .button.ghost:hover { background: var(--surface-2); }
:root body .button.danger { background: var(--surface-1); color: var(--danger-ink); border-color: var(--line-strong); }
:root body .button.danger:hover { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger-ink) 35%, var(--line)); }
/* filled red only where the deletion is confirmed (confirmation page or popup) */
:root body :is(#page-popup, .confirm-card, .account-delete-zone) form .button.danger[type="submit"],
:root body form.confirm .button.danger { background: var(--danger-solid); color: #ffffff; border-color: var(--danger-solid); }
/* row and icon actions: quiet */
:root body .button.icon-action:not(.primary) { background: transparent; border-color: transparent; color: var(--ink); }
:root body .button.icon-action.danger { color: var(--danger-ink); }
:root body .button.icon-action:not(.primary):hover { background: var(--surface-2); }
:root body .button:disabled, :root body .button[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) { :root body .button { transition: none; } :root body .button:active:not(:disabled) { transform: none; } }

/* Focus: ring in the accent plus accent edge */
:root body :is(a, button, .button, summary, [tabindex]):focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
:root body :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="hidden"]), select, textarea):focus,
:root body :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="hidden"]), select, textarea):focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
:root body :is(input[type="checkbox"], input[type="radio"]):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Fields: height 40, radius 8, label above 13/600 */
:where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="submit"],
  [type="button"], [type="reset"], [type="hidden"], [type="image"]), select) { min-height: 40px; border-radius: var(--radius-s); padding: 7px 11px; }
:root body .field label, :root body .field > span:first-child { font-size: 13px; font-weight: 600; }
:root body .field :is(input, select, textarea) { border-radius: var(--radius-s); }
/* compact contexts keep 32 px (next to compact buttons) */
:root body :is(.ot-extra, .compact-form, td) :is(input, select) { min-height: 32px; padding-top: 4px; padding-bottom: 4px; }
/* Unit as an add-on inside the field («Min.», «P.»), surface-2 with a dividing line */
.input-unit { display: inline-flex; align-items: stretch; max-width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  background: var(--field, var(--surface-1)); overflow: hidden; }
:root body .input-unit > :is(input, select) { border: 0; border-radius: 0; box-shadow: none; min-width: 0; flex: 1 1 auto; background: transparent; }
.input-unit > .unit { display: grid; place-items: center; padding: 0 10px; background: var(--surface-2); color: var(--muted);
  border-left: 1px solid var(--line-strong); font-size: 13px; font-weight: 600; white-space: nowrap; }
.input-unit:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.field .input-unit { width: 100%; }
.ot-extra .input-unit { width: auto; }
.ot-extra .input-unit input { width: 56px; }

/* Header: card with a line below; active item as tinted pill; logo square in the accent; account as initials */
:root body .topbar { background: var(--surface-1); border-bottom: 1px solid var(--line); box-shadow: none; }
:root body .topbar nav a { color: var(--muted); font-weight: 500; border-radius: var(--radius-s); }
:root body .topbar nav a:hover { background: var(--surface-2); color: var(--ink); }
:root body .topbar nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-soft-ink); box-shadow: none; font-weight: 600; }
:root body .brand-mark { background: var(--accent); color: var(--accent-ink); border-radius: var(--radius-m); font-family: var(--heading-font, inherit); font-weight: 700; }
.account-initials { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent-soft-ink); font-size: 13px; font-weight: 700; letter-spacing: .02em; }
:root body .account-details summary { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px; }
:root body .account-details summary .account-name { font-weight: 600; font-size: 14px; color: var(--ink); }
@media (max-width: 1599px) { :root body .account-details summary .account-name { display: none !important; } }
/* floating layers keep a soft shadow */
:root body :is(.account-dropdown, #page-popup, .ot-reading-panel) { box-shadow: var(--shadow-float); }
.input-unit[hidden] { display: none; }
/* active menu item keeps its focus ring */
:root body .topbar nav a[aria-current="page"]:focus-visible { box-shadow: 0 0 0 3px var(--ring); }
/* Phone: the icon bar of the class scrolls inside itself instead of widening the page */
@media (max-width: 850px) {
  :root body .class-bar { max-width: 100vw; overflow: hidden; }
  :root body .class-bar-inner { max-width: 100%; scrollbar-width: none; }
  :root body .class-bar-group { flex-shrink: 0; }
}
/* Quick access to the class functions on «Heute»: never wider than the card (phone) */
:root body .class-quick-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 130px), 1fr)); }
:root body .class-quick-grid a { min-width: 0; background: var(--surface-1); border-radius: var(--radius-note); }
:root body .class-quick-grid a:hover { background: var(--surface-2); border-color: var(--line-strong); }
:root body .class-quick-grid a { overflow-wrap: anywhere; hyphens: auto; }
/* «Gefahr» also for delete buttons marked as danger-link (secondary with the error colour) */
:root body .button.danger-link { background: var(--surface-1); color: var(--danger-ink); border-color: var(--line-strong); }
:root body .button.danger-link:hover { background: var(--danger-bg); border-color: color-mix(in srgb, var(--danger-ink) 35%, var(--line)); }
/* initials circle: centred (appearance.css forces inline on spans in the summary) */
:root body .account-details summary .account-initials { display: inline-grid !important; place-items: center; line-height: 1; }
:root body .class-layout:not(.is-collapsed) .class-bar-heading { letter-spacing: .02em; font-weight: 700; font-size: 10.5px; }

/* =====================================================================================================================
   Design Stufe 2: status badges, segmented control, list rows with meta line and progress (docs/DESIGN.md 3–5)
   ===================================================================================================================== */
:root body .badge { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; line-height: 1; white-space: nowrap; border: 0; letter-spacing: 0; text-transform: none;
  background: var(--neutral-bg); color: var(--neutral-ink); }
:root body .badge.is-success { background: var(--success-bg); color: var(--success-ink); }
:root body .badge.is-warning { background: var(--warning-bg); color: var(--warning-ink); }
:root body .badge.is-danger { background: var(--danger-bg); color: var(--danger-ink); }
:root body .badge.is-info { background: var(--accent-soft); color: var(--accent-soft-ink); }
:root body .badge.is-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--success-dot); }

/* Segmented control: 2–5 options, role=group, aria-pressed (radios without JavaScript) */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius-m);
  background: var(--surface-2); }
.segmented > :is(a, button, label) { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border: 0;
  border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap; }
.segmented > :is(a, button, label):hover { color: var(--ink); }
.segmented > :is([aria-pressed="true"], [aria-current="page"], label:has(input:checked)) { background: var(--surface-1); color: var(--ink);
  box-shadow: 0 0 0 1px var(--line); }
.segmented > label > input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented > label:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--ring); }
.field .segmented { align-self: flex-start; }

/* List rows: title 15/600, meta line 13 muted, right figure, badge and chevron; whole row clickable */
.list-rows { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.list-row-link { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 16px; padding: 12px 14px;
  border-top: 1px solid var(--line); color: inherit; text-decoration: none; border-radius: var(--radius-s); }
.list-rows > li:first-child > .list-row-link { border-top: 0; }
.list-row-link:hover { background: var(--surface-2); }
.list-row-title { font-size: 15px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.list-row-meta { font-size: 13px; color: var(--muted); }
.list-row-side { display: inline-flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.list-row-side .chevron { font-size: 18px; color: var(--muted); }
.list-row-figure { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.progress { display: block; height: 4px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 6px; max-width: 240px; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
@media (max-width: 600px) { .list-row-link { grid-template-columns: 1fr; } }

/* Django renders radio groups as div > div > label: the segmented control styles these too */
.segmented > div { display: contents; }
.segmented > div > label { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: 8px; color: var(--muted);
  font-size: 14px; font-weight: 600; cursor: pointer; position: relative; }
.segmented > div > label:has(input:checked) { background: var(--surface-1); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.segmented > div > label > input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented > div > label:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--ring); }
/* header switch in the segmented look */
:root body .mode-switch.segmented { padding: 2px; background: var(--surface-2); border-color: var(--line); }
:root body .mode-switch.segmented button { color: var(--muted); }
:root body .mode-switch.segmented button[aria-pressed="true"] { background: var(--surface-1); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.ot-run-filter { margin: 0 0 14px; }

/* =====================================================================================================================
   Design Stufe 3: notices at the bottom, popups, icons, motion (docs/DESIGN.md 8, 10–12)
   ===================================================================================================================== */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px));
  pointer-events: none; }
.toast { pointer-events: auto; display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 10px; padding: 12px 12px 12px 14px;
  border-radius: var(--radius-note); background: var(--ink); color: var(--card); box-shadow: var(--shadow-float); font-size: 14px; line-height: 1.4;
  animation: toast-in .18s ease-out; }
.toast-icon { display: grid; place-items: center; margin-top: 1px; }
.toast-icon svg, .toast-close svg { width: 18px; height: 18px; }
.toast.is-success .toast-icon { color: light-dark(#7fdcaa, #1a6b43); }
.toast.is-warning .toast-icon { color: light-dark(#f1c66b, #7a4f00); }
.toast.is-error .toast-icon { color: light-dark(#f4a29b, #a3221a); }
.toast-close { display: grid; place-items: center; width: 28px; height: 28px; margin: -4px -4px -4px 0; border: 0; border-radius: 8px;
  background: transparent; color: inherit; opacity: .75; cursor: pointer; }
.toast-close:hover { opacity: 1; background: color-mix(in srgb, var(--card) 14%, transparent); }
.toast-close:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity .18s ease, transform .18s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 600px) { .toasts { left: 12px; right: 12px; bottom: 12px; width: auto; } }
@media print { .toasts { display: none; } }

/* Popups: radius 16, soft shadow, title 20/600, quiet close button */
:root body #page-popup { border-radius: var(--radius-l); border: 1px solid var(--line); background: var(--surface-1); }
:root body #page-popup .page-popup-bar .button { width: 36px; min-height: 36px; padding: 0; justify-content: center; }
:root body #page-popup :is(h1, .page-heading h1) { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
:root body #page-popup .page-heading { margin-bottom: 14px; }
:root body #page-popup .card { border-radius: var(--radius-note); }

/* Icons: stroke icons in one style (Lucide-like), currentColor */
:root body :is(.class-nav-icon, .conference-icon, .journal-icon, .chore-icon, .coaching-icon) { stroke-width: 1.9; flex: none; }
:root body .button > .class-nav-icon { width: 18px; height: 18px; }
:root body .button.compact > .class-nav-icon { width: 16px; height: 16px; }

/* Motion: 120–200 ms on colour, opacity and transform; page cross-fade where the browser supports it */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .16s; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .toast { animation: none; } .toast.is-leaving { transition: none; }
}

/* =====================================================================================================================
   Design Stufe 4: command palette ⌘K / Ctrl+K (docs/DESIGN.md 9)
   ===================================================================================================================== */
.palette-trigger { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 8px 0 10px; border: 1px solid var(--line);
  border-radius: var(--radius-m); background: var(--surface-2); color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap; }
.palette-trigger:hover { color: var(--ink); border-color: var(--line-strong); }
.palette-trigger .class-nav-icon { width: 16px; height: 16px; }
.palette-kbd, .command-palette kbd { padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface-1);
  color: var(--muted); font: 600 11px/1.6 var(--body-font, system-ui); }
@media (max-width: 1599px) { .palette-trigger-text, .palette-kbd { display: none; } .palette-trigger { padding: 0 9px; } }
.command-palette { width: min(640px, calc(100vw - 24px)); max-height: min(560px, calc(100vh - 80px)); margin: 10vh auto auto; padding: 0;
  border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface-1); color: var(--ink); box-shadow: var(--shadow-float); }
.command-palette[open] { display: flex; flex-direction: column; }
.command-palette::backdrop { background: color-mix(in srgb, #000 35%, transparent); backdrop-filter: blur(4px); }
.palette-field { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
:root body .palette-field input { flex: 1; min-height: 40px; border: 0; background: transparent; box-shadow: none; font-size: 16px; padding: 0; }
:root body .palette-field input:focus { box-shadow: none; }
.palette-results { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.palette-group { padding: 10px 10px 4px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.palette-item a { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 10px; border-radius: var(--radius-s);
  color: var(--ink); text-decoration: none; }
.palette-item[aria-selected="true"] a { background: var(--accent-soft); color: var(--accent-soft-ink); }
.palette-label { font-weight: 600; overflow-wrap: anywhere; }
.palette-hint { color: var(--muted); font-size: 13px; white-space: nowrap; }
.palette-status { margin: 0; padding: 8px 14px 12px; color: var(--muted); font-size: 13px; }
.palette-status:empty { display: none; }
@media print { .palette-trigger, .command-palette { display: none !important; } }

/* Fusszeile: Versionsnummer führt zu den Neuerungen */
footer a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
footer a:hover { color: var(--ink); text-decoration-color: currentColor; }
.changelog h3 { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.changelog h3:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.changelog h4 { margin: 16px 0 6px; font-size: 14px; color: var(--muted); }
.changelog ul { margin: 0 0 8px; padding-left: 20px; line-height: 1.55; }
