/* Prüfungsplaner – Optik angelehnt an tfobz.it (TFO Max Valier):
   dunkle Leiste oben, weiße Kopfzeile mit Menü, Titelbereich mit bunten Chips, Schriften Poppins + Open Sans. */

@font-face { font-family: "Poppins"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/poppins-400.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/poppins-500.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/poppins-600.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/poppins-700.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 300 800; font-display: swap; src: url("/fonts/open-sans.woff2") format("woff2"); }

:root {
  --slate: #303d4d;
  --slate-dark: #222d3a;
  --teal: #056f95;
  --teal-dark: #04587a;
  --blue: #52a5ff;
  --orange: #f08f04;
  --accent: #e4572e;
  --olive: #b2c000;

  --ink: #303d4d;
  --muted: #667585;
  --line: #e3e8ee;
  --bg: #f4f7fa;
  --card: #ffffff;
  --field: #f4f7fa;
  --tile: #eaf1f7;

  --ok: #566000;
  --ok-bg: #f1f6c9;
  --info: #12508f;
  --info-bg: #e3f0ff;
  --warn: #8a5000;
  --warn-bg: #fff0d9;
  --bad: #b3261e;
  --bad-bg: #fde8e6;

  --radius: 24px;
  --shadow: 0 10px 30px rgb(48 61 77 / 8%);
  --head: Poppins, "Segoe UI", Helvetica, Arial, sans-serif;
  --body: "Open Sans", "Segoe UI", Helvetica, Arial, sans-serif;
  --tabbar-h: 66px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font: 16px/1.6 var(--body);
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4 { font-family: var(--head); line-height: 1.25; margin: 0 0 .5rem; color: var(--ink); }
h1 { font-size: 1.7rem; font-weight: 600; }
h2 { font-size: 1.3rem; font-weight: 600; letter-spacing: -.01em; }
h3 { font-size: 1.05rem; font-weight: 600; margin-top: 1.5rem; }
h4 { margin: 1.1rem 0 .4rem; font-size: .95rem; font-weight: 600; }
p { margin: 0 0 .75rem; }
a { color: var(--teal); }
code { font: .92em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--field); padding: .1em .4em; border-radius: 6px; }
small { font-size: .82rem; }

.boot { padding: 2rem; text-align: center; color: var(--muted); }
.muted, .hint { color: var(--muted); }
.hint { display: block; font-size: .85rem; margin-top: .15rem; }
.center { text-align: center; }
.spacer { flex: 1; }
.offscreen { position: fixed; left: -9999px; opacity: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 28px; }

/* ---------- Leiste, Kopfzeile, Titelbereich, Fuß ---------- */

.topbar { background: var(--slate); color: #fff; font-size: .78rem; }
.topbar .container { display: flex; align-items: center; gap: 22px; min-height: 36px; }
.topbar a { color: #fff; font-weight: 700; text-decoration: none; }
.topbar a:hover { text-decoration: underline; }
.topbar .claim { opacity: .9; }

.site-header { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line); }
.site-header .container { display: flex; align-items: center; gap: 28px; min-height: 80px; }

.brand { display: flex; align-items: center; gap: 12px; color: var(--slate); text-decoration: none; }
.mark { width: 46px; height: 46px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 14px; background: var(--slate); }
.mark svg { width: 30px; height: 30px; }
.wordmark { display: flex; flex-direction: column; line-height: 1; font-family: var(--head); }
.wordmark strong { font-size: 1.55rem; font-weight: 600; letter-spacing: -.035em; color: var(--slate); }
.wordmark strong em { font-style: normal; color: var(--accent); }
.wordmark small { margin-top: 5px; font-size: .62rem; font-weight: 500; letter-spacing: .3em; text-transform: uppercase; color: var(--accent); }

.main-nav { display: flex; gap: 6px; margin-left: auto; }
.main-nav a {
  position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; color: var(--slate);
  font-family: var(--head); font-size: 1rem; text-decoration: none; border-radius: 12px;
}
.main-nav a svg { width: 19px; height: 19px; color: var(--accent); }
.main-nav a:hover { background: var(--bg); }
.main-nav a.active { font-weight: 600; }
.main-nav a.active::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 3px; border-radius: 2px; background: var(--accent); }

.header-user { display: flex; align-items: center; gap: 12px; }
.who { color: var(--muted); font-size: .9rem; font-weight: 600; }
.bell {
  position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  color: var(--slate); text-decoration: none; background: var(--bg); border-radius: 50%;
}
.bell:hover, .bell.active { background: var(--tile); }
.bell svg { width: 22px; height: 22px; }
.nav-badge {
  position: absolute; top: -3px; right: -3px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
  background: var(--accent); color: #fff; font: 700 .72rem/19px var(--body); text-align: center;
}

.hero { position: relative; overflow: hidden; color: #fff; background: linear-gradient(120deg, #222d3a 0%, #303d4d 55%, #3e5269 100%); }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgb(255 255 255 / 5%) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 5%) 1px, transparent 1px);
  background-size: 72px 72px; transform: skewX(-18deg); transform-origin: top;
}
.hero .container { position: relative; padding-top: 52px; padding-bottom: 44px; }
.hero h1 { margin: 0 0 12px; color: #fff; font-size: clamp(2rem, 4.6vw, 3.4rem); font-weight: 600; letter-spacing: -.02em; }
.hero p { margin: 0 0 20px; max-width: 40rem; color: rgb(255 255 255 / 86%); font-size: 1.1rem; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.pill {
  display: inline-flex; align-items: center; padding: 10px 14px; font: 700 .8rem/1.1 var(--body); text-decoration: none;
  color: var(--slate-dark); background: var(--blue); border-radius: 8px;
}
.pill.blue { background: var(--blue); }
.pill.orange { background: var(--orange); }
.pill.teal { background: var(--teal); color: #fff; }
.pill.olive { background: var(--olive); }

.site-footer { margin-top: 40px; color: rgb(255 255 255 / 80%); background: var(--slate); font-size: .86rem; }
.site-footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 30px; padding-top: 26px; padding-bottom: 26px; }
.site-footer a { color: #fff; }
.site-footer .links { display: flex; flex-wrap: wrap; gap: 6px 22px; }

main { padding-top: 28px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: none; justify-content: center; gap: 2px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1; max-width: 140px; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font: 500 .7rem var(--head); text-decoration: none; border-radius: 14px;
}
.tabbar a.active { color: var(--teal); background: var(--tile); font-weight: 600; }
.tabbar svg { width: 22px; height: 22px; }

@media (max-width: 899px) {
  .main-nav, .who { display: none; }
  .tabbar { display: flex; }
  .site-header .container { min-height: 66px; }
  .header-user { margin-left: auto; }
  .mark { width: 40px; height: 40px; border-radius: 12px; }
  .mark svg { width: 26px; height: 26px; }
  .wordmark strong { font-size: 1.3rem; }
  .topbar .claim { display: none; }
  .topbar .container { justify-content: flex-start; gap: 16px; overflow-x: auto; white-space: nowrap; }
  .hero .container { padding-top: 30px; padding-bottom: 28px; }
  .hero p { font-size: 1rem; }
  .site-footer { margin-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
}

@media (max-width: 560px) {
  .container { padding: 0 16px; }
  main { padding-top: 18px; }
}

/* ---------- Karten, Formulare, Knöpfe ---------- */

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 18px; }
.card.auth { max-width: 500px; margin: 0 auto 18px; }
.lead { color: var(--muted); }

.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 20px; margin: 34px 0 16px; }
.section-head h2 { margin: 0; font-size: 1.7rem; font-weight: 600; letter-spacing: -.02em; }
.section-head span { color: var(--muted); }

.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-weight: 700; font-size: .88rem; margin-bottom: 5px; }

input, select, textarea {
  width: 100%; padding: 12px 14px; font: inherit; color: var(--ink);
  background: #fff; border: 1px solid #cfd8e1; border-radius: 12px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid rgb(82 165 255 / 55%); outline-offset: 1px;
}
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--teal); }
input.num { width: 4.6rem; padding: 9px; }
input.time { width: 5.4rem; padding: 9px; }
textarea { resize: vertical; min-height: 7rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: 9px 18px; font: 600 .95rem var(--head); text-decoration: none; cursor: pointer;
  color: var(--slate); background: #fff; border: 1px solid #cfd8e1; border-radius: 12px;
}
.btn:hover { border-color: var(--slate); }
.btn.primary { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn.primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn.danger { color: var(--bad); border-color: #efc2be; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg); }
.btn.big { width: 100%; min-height: 52px; font-size: 1.05rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.icon-btn { min-width: 40px; min-height: 40px; font: inherit; cursor: pointer; color: var(--muted); background: transparent; border: 0; border-radius: 12px; }
.icon-btn:hover { background: var(--bg); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.form-error { color: var(--bad); background: var(--bad-bg); padding: 9px 13px; border-radius: 12px; }
.form-error[hidden] { display: none; }

.check { display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.radios { display: grid; gap: 8px; margin-bottom: 12px; }
.radio { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; }
.radio:has(input:checked) { border-color: var(--teal); background: var(--info-bg); }
.radio small { display: block; }
.inline { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; }

.callout { padding: 14px 16px; border-radius: 16px; margin: 0 0 14px; }
.callout p { margin: .3rem 0 .6rem; }
.callout.ok { background: var(--ok-bg); color: var(--ok); }
.callout.warn { background: var(--warn-bg); color: var(--warn); }
.callout .btn { margin-top: 4px; }

.banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 18px;
  background: var(--info-bg); color: var(--info); border-radius: 18px; border-left: 5px solid var(--blue);
}
.banner span { flex: 1 1 200px; font-weight: 600; }

/* ---------- Badges, Personen ---------- */

.tag { display: inline-block; margin-left: .4rem; padding: .08rem .6rem; border-radius: 999px; background: var(--info-bg); color: var(--info); font-size: .78rem; font-weight: 700; vertical-align: middle; }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag + .tag { margin-left: .3rem; }

.badge {
  display: inline-block; padding: .14rem .65rem; border-radius: 999px; font-size: .8rem; font-weight: 700;
  background: var(--field); color: var(--muted); white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }

.person { display: inline-block; margin: 0 4px 2px 0; padding: .06rem .6rem; border-radius: 999px; background: var(--field); font-size: .88rem; }
.person.me { background: var(--info-bg); color: var(--info); font-weight: 700; }

/* ---------- Tabellen ---------- */

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.toolbar h2, .toolbar p { margin: 0; }
.toolbar-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar-controls select { width: auto; }

.table-wrap { overflow-x: auto; }
.table-wrap.tall { max-height: 320px; overflow-y: auto; }
table.slots { width: 100%; border-collapse: collapse; }
table.slots th { text-align: left; font: 600 .72rem var(--head); color: var(--muted); letter-spacing: .06em; text-transform: uppercase; padding: 8px 10px; border-bottom: 2px solid var(--line); }
table.slots td { padding: 13px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.slots tr.past { opacity: .6; }
table.slots .actions { margin-top: 0; }
table.slots.edit input { padding: 8px 10px; }

@media (max-width: 719px) {
  table.slots thead { display: none; }
  table.slots, table.slots tbody, table.slots tr, table.slots td { display: block; width: 100%; }
  table.slots tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  table.slots td { border: 0; padding: 3px 0; }
  table.slots td[data-label]:not([data-label=""])::before { content: attr(data-label); display: block; font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }

  /* Terminliste: Fach als Titel, Datum und Stunde nebeneinander, ohne Beschriftungen */
  table.overview tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }
  table.overview td { grid-column: span 2; }
  table.overview td[data-label="Fach"] { order: -1; font: 600 1.1rem var(--head); }
  table.overview td[data-label="Datum"], table.overview td[data-label="Stunde"] { grid-column: span 1; }
  table.overview td[data-label="Datum"]::before, table.overview td[data-label="Stunde"]::before,
  table.overview td[data-label="Fach"]::before, table.overview td[data-label="Status"]::before { display: none !important; }
  table.overview td.no-vols { display: none; }
  table.overview td[data-label="Status"] { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; }
  table.overview td[data-label="Status"] .hint { margin: 0; }
  table.overview td[data-label=""] { margin-top: 4px; }
}

/* ---------- Woche, Kalender ---------- */

.week .badge { margin-right: 6px; }
.week p { margin-bottom: .55rem; }

.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.cal-head { text-align: center; font: 600 .72rem var(--head); color: var(--muted); letter-spacing: .06em; text-transform: uppercase; padding: 5px 0; }
.cell { min-height: 84px; padding: 5px; border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.cell.blank { border-color: transparent; background: transparent; }
.cell.weekend { background: var(--field); }
.cell.free { background: var(--warn-bg); }
.cell.today { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.cell-head { display: flex; justify-content: space-between; align-items: center; }
.cell-day { font-size: .82rem; font-weight: 700; }
.cell-add { width: 22px; height: 22px; padding: 0; font: inherit; line-height: 1; color: var(--muted); background: transparent; border: 1px dashed #cfd8e1; border-radius: 7px; cursor: pointer; }
.cell-free { display: block; font-size: .68rem; color: var(--warn); line-height: 1.2; }
.legend .cell-free { display: inline; font-size: .75rem; }
.chip {
  display: block; width: 100%; margin-top: 3px; padding: 3px 6px; font: inherit; font-size: .7rem; font-weight: 700; text-align: left;
  border: 0; border-radius: 7px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.info { background: var(--info-bg); color: var(--info); }
.legend { margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.legend .chip { display: inline-block; width: auto; cursor: default; margin: 0; }

@media (max-width: 560px) {
  .cell { min-height: 66px; padding: 3px; border-radius: 9px; }
  .chip { font-size: .62rem; padding: 2px 3px; }
  .cell-free { font-size: .6rem; }
}

/* ---------- Meldungen ---------- */

.notes { display: grid; gap: 10px; }
.note { padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; }
.note.unread { border-color: var(--blue); background: var(--info-bg); }
.note header { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.note time { color: var(--muted); font-size: .8rem; }
.note p { margin: .4rem 0 0; white-space: pre-line; }

/* ---------- Verwaltung ---------- */

.tabs { display: flex; gap: 8px; overflow-x: auto; margin: 8px 0 4px; padding-bottom: 2px; }
.tab { flex: 0 0 auto; min-height: 42px; padding: 7px 16px; font: 500 .92rem var(--head); color: var(--slate); background: #fff; border: 1px solid #cfd8e1; border-radius: 999px; cursor: pointer; }
.tab.active { background: var(--slate); color: #fff; border-color: var(--slate); }

.rows { list-style: none; margin: 0 0 12px; padding: 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.row.add { align-items: flex-end; border: 0; }
.row .field { margin: 0; }
.row-name { min-width: 8rem; }
.row > input { flex: 1 1 10rem; width: auto; }
.row select { width: auto; flex: 0 0 auto; }
.row.add input:not(.num):not(.time):not([type="checkbox"]):not([type="date"]) { flex: 1 1 11rem; width: auto; }
.row.add input[type="date"] { width: auto; }
.day-block { margin-bottom: 8px; }

.cred { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 14px; background: var(--field); border-radius: 14px; }
.cred code { font-size: 1.1rem; background: transparent; }

/* ---------- Stundenplan ---------- */

.timetable-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); gap: 14px; }
.day h3 { margin-top: 0; }
.lessons, .overrides, .changes { list-style: none; margin: 0; padding: 0; }
.lesson {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "time control" "subject subject"; align-items: center; gap: 6px 8px;
  padding: 10px 12px; margin-bottom: 8px; background: var(--field); border: 1px solid var(--line); border-radius: 14px;
}
.lesson.examined { background: var(--info-bg); border-color: #b9d8fb; }
.lesson-time { grid-area: time; display: flex; align-items: baseline; gap: 8px; line-height: 1.2; }
.lesson-subject { grid-area: subject; font-weight: 700; overflow-wrap: break-word; hyphens: auto; line-height: 1.3; }
.lesson > :last-child { grid-area: control; justify-self: end; }

.switch { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.switch input { appearance: none; width: 44px; height: 26px; margin: 0; padding: 0; border: 0; border-radius: 13px; background: #b8c3cf; position: relative; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgb(0 0 0 / 30%); }
.switch input:checked { background: var(--teal); }
.switch input:checked::after { transform: translateX(18px); }

.override { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.override > span:nth-child(2) { flex: 1 1 200px; }
.changes li { padding: 9px 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: baseline; }
.changes time { margin-left: auto; margin-top: 0; }

/* ---------- Weitere TFO-Dienste (Kacheln) ---------- */

.services { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.tile {
  position: relative; display: flex; gap: 14px; min-height: 130px; padding: 20px 20px 22px; color: var(--ink); text-decoration: none;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
}
.tile:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.tile-icon { flex: 0 0 auto; width: 56px; height: 56px; display: grid; place-items: center; color: var(--slate); background: var(--tile); border-radius: 18px; }
.tile-icon svg { width: 28px; height: 28px; }
.tile-text { display: flex; flex-direction: column; gap: 4px; padding-right: 34px; }
.tile-text strong { font: 600 1.05rem var(--head); }
.tile-text small { color: var(--muted); font-size: .88rem; line-height: 1.45; }
.tile-arrow { position: absolute; right: 16px; bottom: 16px; width: 34px; height: 34px; display: grid; place-items: center; color: var(--accent); background: var(--bg); border-radius: 50%; }
.tile-arrow svg { width: 16px; height: 16px; }

/* ---------- Installationsanleitung ---------- */

.detected { color: var(--muted); }
.steps { list-style: none; counter-reset: step; margin: 0 0 12px; padding: 0; display: grid; gap: 14px; }
.steps li { counter-increment: step; position: relative; padding: 4px 0 4px 46px; min-height: 36px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 2px; width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: #fff; font: 600 1rem var(--head); display: grid; place-items: center;
}
.linkbox { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.linkbox code { word-break: break-all; }

/* ---------- Dialog, Hinweis ---------- */

dialog {
  width: min(680px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; color: var(--ink);
  background: #fff; border: 0; border-radius: 26px; box-shadow: 0 24px 70px rgb(20 30 45 / 40%);
}
dialog::backdrop { background: rgb(20 30 45 / 55%); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 10px 0 24px; }
.dlg-head h2 { margin: 0; }
.dlg-body { padding: 12px 24px 24px; }

#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 22px + env(safe-area-inset-bottom)); z-index: 50;
  transform: translate(-50%, 20px); max-width: min(92vw, 480px); padding: 11px 18px; border-radius: 14px;
  background: var(--slate); color: #fff; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  box-shadow: var(--shadow);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--bad); color: #fff; }
@media (min-width: 900px) { #toast { bottom: 28px; } }
dialog[open] ~ #toast { z-index: 1000; }

@media print {
  body > *:not(dialog) { display: none !important; }
  dialog { position: static; width: 100%; max-height: none; box-shadow: none; }
  .actions, .dlg-head .icon-btn { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Kopfzeile: auf mittleren Bildschirmbreiten den Namen weglassen, damit die Glocke Platz hat */
@media (max-width: 1280px) { .who { display: none; } .main-nav a { padding: 10px 11px; } }

/* ======================================================================
   TFO-Farben: Blau, Orange, Petrol, Limette (+ Rotorange als Akzent)
   ====================================================================== */

:root {
  --c-blue: #52a5ff;  --c-blue-d: #1f6fd0;
  --c-orange: #f08f04; --c-orange-d: #b86a00;
  --c-teal: #056f95;
  --c-olive: #b2c000;  --c-olive-d: #6b7600;
  --c-red: #e4572e;
  --band: linear-gradient(90deg, var(--c-blue) 0 25%, var(--c-orange) 25% 50%, var(--c-teal) 50% 75%, var(--c-olive) 75% 100%);
}

.c-blue { --item: var(--c-blue-d); }
.c-orange { --item: var(--c-orange); }
.c-teal { --item: var(--c-teal); }
.c-olive { --item: var(--c-olive-d); }
.c-red { --item: var(--c-red); }
.s-blue { --dot: var(--c-blue); }
.s-orange { --dot: var(--c-orange); }
.s-teal { --dot: var(--c-teal); }
.s-olive { --dot: var(--c-olive); }
.s-red { --dot: var(--c-red); }

body {
  background:
    radial-gradient(900px 420px at 100% 0, rgb(82 165 255 / 12%), transparent 70%),
    radial-gradient(800px 420px at 0 100%, rgb(240 143 4 / 9%), transparent 70%),
    var(--bg);
}

/* Streifen aus allen vier Farben: ganz oben, unter dem Titelbereich und über der Fußzeile */
.colorbar { height: 6px; background: var(--band); }
.hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 7px; top: auto; width: auto; border: 0; border-radius: 0;
  background: var(--band);
}
.site-footer { border-top: 7px solid; border-image: var(--band) 1; }

/* Titelbereich mit farbigen Lichtflecken */
.hero {
  background:
    radial-gradient(520px 260px at 88% 12%, rgb(82 165 255 / 38%), transparent 70%),
    radial-gradient(460px 260px at 64% 105%, rgb(240 143 4 / 30%), transparent 70%),
    radial-gradient(380px 220px at 12% 115%, rgb(178 192 0 / 22%), transparent 70%),
    linear-gradient(120deg, #222d3a 0%, #303d4d 55%, #3e5269 100%);
}

/* Menü: jede Seite hat ihre Farbe */
.main-nav a svg { color: var(--item, var(--c-orange)); }
.main-nav a.active::after { background: var(--item, var(--c-orange)); }
.main-nav a.active { color: var(--item, var(--slate)); }
.tabbar a svg { color: var(--item, var(--muted)); }
.tabbar a.active { color: var(--item, var(--teal)); background: color-mix(in srgb, var(--item, var(--teal)) 14%, #fff); }

/* Karten: farbiger Streifen oben, reihum in den TFO-Farben */
section.card { border-top: 5px solid var(--card-accent, var(--line)); }
main section.card:nth-of-type(4n + 1) { --card-accent: var(--c-orange); }
main section.card:nth-of-type(4n + 2) { --card-accent: var(--c-blue); }
main section.card:nth-of-type(4n + 3) { --card-accent: var(--c-teal); }
main section.card:nth-of-type(4n + 4) { --card-accent: var(--c-olive); }
.card.auth { --card-accent: var(--c-orange) !important; }

.section-head h2::before {
  content: ""; display: inline-block; width: 8px; height: 1.05em; margin-right: 12px; border-radius: 4px; vertical-align: -.14em;
  background: linear-gradient(180deg, var(--c-orange), var(--c-red));
}

/* Fächer: eine Farbe pro Fach */
.dot { display: inline-block; width: 11px; height: 11px; margin-right: 8px; border-radius: 50%; background: var(--dot, var(--muted)); }
.lesson { border-left: 6px solid var(--dot, var(--line)); }

/* Kacheln mit den TFO-Diensten */
.tile { border-bottom: 5px solid var(--item, var(--line)); }
.tile .tile-icon { background: color-mix(in srgb, var(--item, var(--slate)) 16%, #fff); color: var(--item, var(--slate)); }
.tile .tile-arrow { color: #fff; background: var(--item, var(--accent)); }
.tile:hover { border-color: var(--item, var(--accent)); }
.tile:hover { border-bottom-color: var(--item, var(--accent)); }

/* Installieren: auffälliger Knopf und wiederkehrender Hinweis */
.btn.install {
  color: #fff; border: 0; border-radius: 16px; min-height: 52px; padding: 10px 22px; font-size: 1.02rem;
  background: linear-gradient(135deg, var(--c-orange), var(--c-red)); box-shadow: 0 8px 20px rgb(228 87 46 / 28%);
}
.btn.install:hover { filter: brightness(.94); border: 0; }
.btn.install svg { width: 22px; height: 22px; }
.install-cta { margin-top: 20px; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.install-cta .btn.install { width: 100%; min-height: 60px; font-size: 1.12rem; }

.nudge {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; padding: 16px 18px; margin-bottom: 18px;
  background: linear-gradient(135deg, #fff4e0, #ffe8df); border: 1px solid #f6c9a8; border-left: 6px solid var(--c-orange); border-radius: 20px;
}
.nudge-icon { flex: 0 0 auto; width: 48px; height: 48px; display: grid; place-items: center; color: #fff; border-radius: 15px; background: linear-gradient(135deg, var(--c-orange), var(--c-red)); }
.nudge-icon svg { width: 26px; height: 26px; }
.nudge-text { flex: 1 1 230px; display: flex; flex-direction: column; gap: 2px; }
.nudge-text small { color: var(--muted); font-size: .86rem; line-height: 1.4; }
.nudge .btn.ghost { color: var(--muted); }

.install-cta .btn.install { font-size: 1rem; gap: 10px; white-space: nowrap; }
@media (max-width: 380px) { .install-cta .btn.install { font-size: .94rem; padding: 10px 14px; } }

/* Abmelden: immer sichtbar neben der Glocke */
.logout {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; font: 600 .92rem var(--head); color: var(--slate);
  background: var(--bg); border: 0; border-radius: 22px; cursor: pointer;
}
.logout:hover { background: #fde8e6; color: var(--bad); }
.logout svg { width: 20px; height: 20px; color: var(--c-red); }
@media (max-width: 1180px) { .logout { width: 44px; padding: 0; justify-content: center; border-radius: 50%; } .logout span { display: none; } }
@media (max-width: 1020px) { .main-nav a svg { display: none; } }
@media (max-width: 1100px) {
  .site-header .container { gap: 14px; }
  .main-nav { gap: 2px; }
  .main-nav a { padding: 10px 9px; font-size: .9rem; }
  .wordmark strong { font-size: 1.3rem; }
  .wordmark small { letter-spacing: .2em; }
}

/* TFO groß im Namen */
.wordmark .tfo { font-weight: 800; font-size: 1.18em; letter-spacing: .03em; }

/* Wochenplan: Stunden zum Antippen */
.week-grid { grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); }
.day.today h3 { color: var(--teal); }
.day h3 small { margin-left: 8px; font-weight: 500; }
.free-note { color: var(--warn); }
.wlesson {
  display: grid; width: 100%; grid-template-columns: 1fr auto; grid-template-areas: "t p" "s s" "c c"; align-items: center; gap: 3px 8px;
  padding: 10px 12px; margin-bottom: 8px; text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  background: var(--field); border: 1px solid var(--line); border-left: 6px solid var(--dot, var(--line)); border-radius: 14px;
}
.wlesson:hover { border-color: var(--dot, var(--slate)); }
.wlesson.on { background: var(--info-bg); border-color: #b9d8fb; border-left-color: var(--dot, var(--c-teal)); }
.wlesson.off { opacity: .55; }
.wlesson .t { grid-area: t; font-size: .8rem; color: var(--muted); }
.wlesson .p { grid-area: p; }
.wlesson .s { grid-area: s; font-weight: 700; line-height: 1.3; overflow-wrap: break-word; hyphens: auto; }
.wlesson .c { grid-area: c; margin: 0; }
.empty { padding: 8px 0 4px; }

/* Wochenplan als Raster: Tage = Spalten, Stunden = Zeilen */
.wgrid { width: 100%; border-collapse: separate; border-spacing: 5px; table-layout: fixed; }
.wgrid th { padding: 4px 2px; font: 600 .92rem var(--head); text-align: center; }
.wgrid th small { display: block; font: 500 .72rem var(--body); color: var(--muted); }
.wgrid th.today { color: var(--teal); }
.wgrid th.per { width: 48px; }
.wgrid th.per strong { display: block; font-size: 1rem; }
.wgrid .short { display: none; }
.wgrid .free-note { color: var(--warn); }
.wgrid td { padding: 0; vertical-align: top; }
.gcell {
  position: relative; display: flex; align-items: flex-start; gap: 6px; width: 100%; min-height: 52px; margin-bottom: 4px; padding: 7px 8px;
  font: inherit; font-size: .84rem; text-align: left; color: var(--ink); cursor: pointer;
  background: var(--field); border: 1px solid var(--line); border-left: 6px solid var(--dot, var(--line)); border-radius: 12px;
}
.gcell:hover { border-color: var(--dot, var(--slate)); }
.gcell .s { display: flex; flex-direction: column; min-width: 0; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.gcell .abbr { display: none; }
.gcell .x { font-size: .7rem; font-weight: 500; color: var(--muted); }
.gcell .chk { color: var(--teal); font-weight: 800; }
.gcell.on { background: var(--info-bg); border-color: #9fc7f7; border-left-color: var(--dot, var(--teal)); }
.gcell.off { opacity: .5; }
.gcell.extra { border-style: dashed; border-left-style: solid; }
.choice { margin-top: 18px; padding-top: 6px; border-top: 1px solid var(--line); }
.subst { margin-top: 12px; }
.subst select { width: auto; max-width: 100%; flex: 1 1 12rem; }

@media (max-width: 700px) {
  .card:has(.wgrid) { padding: 14px 6px; }
  .card:has(.wgrid) .toolbar, .card:has(.wgrid) > .hint { padding: 0 8px; }
  .wgrid { border-spacing: 3px; }
  .wgrid th .long { display: none; }
  .wgrid th .short { display: inline; }
  .wgrid th.per { width: 30px; }
  .wgrid th small { font-size: .58rem; }
  .gcell { gap: 3px; min-height: 48px; padding: 5px 3px 5px 5px; font-size: .64rem; border-left-width: 4px; border-radius: 9px; }
  .gcell .full { display: none; }
  .gcell .abbr { display: inline; }
  .gcell .x { font-size: .56rem; }
}

.nudge.swap { align-items: flex-start; }
.swap-line { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.swap-line small { color: var(--muted); }
