[v-cloak] { display: none !important; }
:root {
  --bg: #f5f6f3;
  --panel: #ffffff;
  --ink: #17211b;
  --ink-2: #4f5a53;
  --ink-3: #8a938d;
  --line: #dfe3de;
  --line-2: #c3c9c3;
  --hsg: #0b6b3a;
  --hsg-soft: #e3f1e8;
  --p: #1d9e75; --p-bg: #e1f5ee; --p-ink: #04342c;
  --k: #534ab7; --k-bg: #eeedfe; --k-ink: #26215c;
  --w: #378add; --w-bg: #e6f1fb; --w-ink: #042c53;
  --x: #d85a30; --x-bg: #faece7; --x-ink: #4a1b0c;
  --t: #888780; --t-bg: #f1efe8; --t-ink: #2c2c2a;
  --e: #ba7517; --e-bg: #faeeda; --e-ink: #412402;
  --err: #a32d2d; --err-bg: #fcebeb;
  --warn: #854f0b; --warn-bg: #faeeda;
  --ok: #3b6d11; --ok-bg: #eaf3de;
  --radius: 8px;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 6px 12px; }
button:hover { border-color: var(--ink-3); }
button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--hsg); outline-offset: 2px; }
button.primary { background: var(--hsg); color: #fff; border-color: var(--hsg); }
button.primary:hover { background: #095a31; }
button.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
button.ghost:hover { background: var(--hsg-soft); border-color: transparent; color: var(--ink); }
button.small { padding: 3px 9px; font-size: 13px; }
button.icon { padding: 4px 7px; line-height: 1; }
input[type=text], input[type=number], select { background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 6px 9px; height: 34px; }
input[type=number] { width: 76px; font-family: var(--mono); }
input[type=range] { accent-color: var(--hsg); }
input[type=checkbox] { accent-color: var(--hsg); width: 16px; height: 16px; }
a { color: var(--hsg); }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
h1, h2, h3, h4 { font-weight: 500; margin: 0; line-height: 1.25; }
h1 { font-size: 26px; letter-spacing: -0.01em; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 0.75rem; }
.muted { color: var(--ink-2); }
.hint { color: var(--ink-3); font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- shell ---------- */
.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .mark { width: 30px; height: 30px; border-radius: 7px; background: var(--hsg); color: #fff; display: grid; place-items: center; font-family: var(--mono); font-size: 13px; font-weight: 500; }
.brand .title { font-weight: 500; }
.brand .sub { font-size: 12px; color: var(--ink-3); }
.topbar .spacer { flex: 1; }
.planname { border: 1px solid transparent; background: transparent; padding: 4px 8px; width: 220px; }
.planname:hover, .planname:focus { border-color: var(--line-2); background: var(--panel); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 13px; background: var(--hsg-soft); color: var(--hsg); white-space: nowrap; }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.err { background: var(--err-bg); color: var(--err); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
nav.tabs { display: flex; gap: 2px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; }
nav.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 10px 14px; color: var(--ink-2); white-space: nowrap; }
nav.tabs button.active { color: var(--hsg); border-bottom-color: var(--hsg); }
nav.tabs button:hover { color: var(--ink); }
main { padding: 20px; max-width: 1400px; margin: 0 auto; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 8px 14px; border-radius: var(--radius); font-size: 14px; z-index: 50; }

/* ---------- cards & layout ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.card + .card { margin-top: 14px; }
.card h2, .card h3 { margin-bottom: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 10px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(130px, 100%), 1fr)); gap: 10px; }
.metric { background: var(--bg); border-radius: var(--radius); padding: 10px 12px; }
.metric .lbl { font-size: 12px; color: var(--ink-2); }
.metric .val { font-size: 22px; font-weight: 500; font-family: var(--mono); }
.metric .val small { font-size: 12px; color: var(--ink-3); font-family: var(--sans); }
.metric.bad .val { color: var(--err); }
.metric.warnv .val { color: var(--warn); }
.badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge.P { background: var(--p-bg); color: var(--p-ink); border-color: transparent; }
.badge.K { background: var(--k-bg); color: var(--k-ink); border-color: transparent; }
.badge.W { background: var(--w-bg); color: var(--w-ink); border-color: transparent; }
.badge.F, .badge.S, .badge.L, .badge.X { background: var(--x-bg); color: var(--x-ink); border-color: transparent; }
.badge.T { background: var(--t-bg); color: var(--t-ink); border-color: transparent; }
.badge.E { background: var(--e-bg); color: var(--e-ink); border-color: transparent; }
.note { padding: 8px 12px; border-radius: var(--radius); font-size: 14px; display: flex; gap: 8px; align-items: flex-start; }
.note.err { background: var(--err-bg); color: var(--err); }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.note.ok { background: var(--ok-bg); color: var(--ok); }
.note.info { background: var(--hsg-soft); color: var(--hsg); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-weight: 500; color: var(--ink-2); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.t td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }

/* ---------- wizard ---------- */
.wizard { max-width: 820px; margin: 0 auto; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.steps span { font-size: 12px; padding: 4px 10px; border-radius: 999px; color: var(--ink-3); border: 1px solid transparent; }
.steps span.done { background: var(--hsg-soft); color: var(--hsg); }
.steps span.cur { border-color: var(--hsg); color: var(--hsg); }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 8px; }
.choice { border: 1px solid var(--line-2); border-radius: var(--radius); padding: 10px 12px; cursor: pointer; background: var(--panel); text-align: left; }
.choice:hover { border-color: var(--ink-3); }
.choice.sel { border: 2px solid var(--hsg); padding: 9px 11px; }
.choice .sub { font-size: 12px; color: var(--ink-2); }
.choice.disabled { opacity: 0.5; cursor: not-allowed; }
.dayset { display: flex; gap: 6px; flex-wrap: wrap; }
.dayset label { border: 1px solid var(--line-2); border-radius: var(--radius); padding: 6px 12px; cursor: pointer; background: var(--panel); }
.dayset label.on { background: var(--hsg-soft); border-color: var(--hsg); color: var(--hsg); }
.dayset input { display: none; }

/* ---------- planner ---------- */
.planner { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; align-items: start; }
/* minmax(0, ...) statt 1fr: '1fr' ist 'minmax(auto, 1fr)' und laesst das
   Semesterband nicht unter seine min-content-Breite schrumpfen. */
@media (max-width: 900px) { .planner { grid-template-columns: minmax(0, 1fr); } }
.catalog { position: sticky; top: 104px; max-height: calc(100vh - 120px); overflow: auto; }
.catalog .areas { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0; }
.catalog .areas button { font-size: 12px; padding: 3px 8px; }
.catalog .areas button.active { background: var(--hsg-soft); border-color: var(--hsg); color: var(--hsg); }
.catalog input[type=text] { width: 100%; }
.citem { display: flex; align-items: flex-start; gap: 8px; padding: 7px 4px; border-bottom: 1px solid var(--line); cursor: grab; }
.citem:hover { background: var(--bg); }
.citem .ti { flex: 1; min-width: 0; }
.citem .name { font-size: 13px; line-height: 1.3; }
.citem .meta { font-size: 11px; color: var(--ink-3); font-family: var(--mono); }
.citem .meta span + span::before { content: " · "; }
.semband { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(210px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.semcol { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; min-height: 300px; display: flex; flex-direction: column; }
.semcol.over { border-color: var(--hsg); background: #f8fcf9; }
.semcol.exchange { border-color: var(--e); }
.semcol .head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; margin-bottom: 6px; }
.semcol .head .sem { font-weight: 500; }
.semcol .head .idx { font-size: 11px; color: var(--ink-3); }
.semcol .head .ects { font-family: var(--mono); font-size: 13px; }
.semcol .head .ects.over40 { color: var(--err); }
.gauge { height: 4px; background: var(--bg); border-radius: 2px; margin-bottom: 8px; overflow: hidden; }
.gauge i { display: block; height: 100%; background: var(--hsg); }
.gauge i.hot { background: var(--warn); }
.gauge i.over { background: var(--err); }
.item { border-radius: 6px; padding: 6px 8px; font-size: 13px; margin-bottom: 4px; display: flex; gap: 6px; align-items: flex-start; cursor: grab; border-left: 3px solid transparent; }
.item.P { background: var(--p-bg); color: var(--p-ink); border-left-color: var(--p); }
.item.K { background: var(--k-bg); color: var(--k-ink); border-left-color: var(--k); }
.item.W { background: var(--w-bg); color: var(--w-ink); border-left-color: var(--w); }
.item.F, .item.S, .item.L { background: var(--x-bg); color: var(--x-ink); border-left-color: var(--x); }
.item.T { background: var(--t-bg); color: var(--t-ink); border-left-color: var(--t); }
.item.flag { outline: 2px solid var(--err); }
.item .body { flex: 1; min-width: 0; }
.item .title { line-height: 1.3; }
.item .sub { font-size: 11px; opacity: 0.85; font-family: var(--mono); }
.item select { height: 24px; padding: 0 4px; font-size: 11px; border-radius: 4px; }
.item .rm { opacity: 0.5; background: transparent; border: 0; padding: 0 2px; font-size: 14px; line-height: 1; }
.item .rm:hover { opacity: 1; }
.dropzone { border: 1px dashed var(--line-2); border-radius: 6px; padding: 10px; text-align: center; font-size: 12px; color: var(--ink-3); margin-top: auto; }
.checks { display: flex; flex-direction: column; gap: 6px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: 4px; }

/* ---------- timetable ---------- */
.tt { display: grid; grid-template-columns: 46px repeat(6, minmax(0, 1fr)); gap: 4px; }
.tt .dayhead { text-align: center; font-size: 13px; padding: 4px 0; border-radius: 6px 6px 0 0; }
.tt .dayhead small { display: block; font-size: 11px; color: var(--ink-3); }
.tt .dayhead.work { background: repeating-linear-gradient(135deg, var(--bg), var(--bg) 6px, #e9ece6 6px, #e9ece6 12px); }
.tt .daycol { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 0 0 6px 6px; }
.tt .daycol.work { background: repeating-linear-gradient(135deg, #fbfbfa, #fbfbfa 6px, #f0f2ee 6px, #f0f2ee 12px); }
.tt .timecol { position: relative; }
.tt .tick { position: absolute; left: 0; font-size: 11px; color: var(--ink-3); font-family: var(--mono); transform: translateY(-50%); }
.tt .hline { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); }
.ev { position: absolute; border-radius: 5px; padding: 3px 6px; font-size: 11px; line-height: 1.25; overflow: hidden; border-left: 3px solid; cursor: default; }
.ev .n { font-weight: 500; }
.ev .s { opacity: 0.8; font-family: var(--mono); font-size: 10px; }
.ev.P { background: var(--p-bg); color: var(--p-ink); border-color: var(--p); }
.ev.K { background: var(--k-bg); color: var(--k-ink); border-color: var(--k); }
.ev.W { background: var(--w-bg); color: var(--w-ink); border-color: var(--w); }
.ev.F, .ev.S, .ev.L { background: var(--x-bg); color: var(--x-ink); border-color: var(--x); }
.ev.clash { outline: 2px solid var(--err); }
.ev.workconf { border-style: dashed; }
.ev.soft { opacity: 0.6; }
.groups table td { padding: 4px 6px; }
.conflicts { display: flex; flex-direction: column; gap: 6px; }

/* ---------- bidding ---------- */
.bidrow { display: grid; grid-template-columns: 110px minmax(0, 1fr) 150px 60px 90px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.bidrow.head { font-size: 12px; color: var(--ink-2); }
.bidrow .num { font-family: var(--mono); font-size: 13px; }
.bidrow.chosen { background: #f8fcf9; }
.budget { display: flex; gap: 14px; flex-wrap: wrap; }
textarea.export { width: 100%; min-height: 160px; font-family: var(--mono); font-size: 12px; border: 1px solid var(--line-2); border-radius: var(--radius); padding: 8px; }

/* ---------- timeline ---------- */
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; border-left: 2px solid var(--line-2); }
.tl { position: relative; padding: 4px 0 12px; }
.tl::before { content: ""; position: absolute; left: -17px; top: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--hsg); }
.tl.past::before { background: var(--ink-3); }
.tl .d { font-family: var(--mono); font-size: 13px; color: var(--ink-2); }
.tl .w { font-size: 14px; }

@media (prefers-reduced-motion: no-preference) { .semcol, .item, button { transition: border-color .15s, background-color .15s; } }
@media (max-width: 700px) { .topbar { flex-wrap: wrap; } .planname { width: 140px; } main { padding: 12px; } .bidrow { grid-template-columns: 90px 1fr 70px; } .bidrow .r3, .bidrow .r4 { display: none; } }

/* ---------- language switch & per-semester targets ---------- */
.langsw { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; }
.langsw button { border: 0; border-radius: 0; padding: 4px 10px; font-size: 13px; background: var(--panel); color: var(--ink-2); }
.langsw button.on { background: var(--hsg-soft); color: var(--hsg); }
.targets { display: flex; flex-direction: column; gap: 6px; }
.trow { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr) minmax(0, 84px) minmax(0, 118px); gap: 10px; align-items: center; }
.trow.open { opacity: 0.75; }
.trow .tlbl { font-size: 14px; }
.trow .tlbl small { color: var(--ink-3); font-size: 12px; margin-left: 5px; }
.trow .tlbl small.exsm { color: var(--e); }
.trow .tval { font-size: 13px; text-align: right; }
@media (max-width: 640px) { .trow { grid-template-columns: 1fr auto; } .trow input[type=range] { grid-column: 1 / -1; } }

/* --- Schmale Bildschirme --------------------------------------------------
   Grundsatz: nichts wird abgeschnitten. Breite Inhalte (Semesterband,
   Wochenraster, Tabellen) scrollen in ihrem eigenen Rahmen, statt die ganze
   Seite zu verbreitern. Geprueft bei 320, 375, 768, 1024 und 1440 px. */

.tablewrap, .ttwrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 900px) {
  /* Der Katalog steht hier ueber den Semestern statt daneben. Klebend und
     bildschirmhoch wuerde er alles darunter verdecken. */
  .catalog { position: static; max-height: 320px; top: auto; }

  /* Kopfbereich: ohne Zutun bricht er in fuenf Zeilen um und wird bis zu
     196 px hoch. Untertitel weg, Planname und Statusanzeigen nach unten.
     Die Statusanzeige bleibt sichtbar, das ist ein Produktentscheid. */
  .topbar { flex-wrap: wrap; gap: 6px 8px; padding: 6px 12px; }
  .brand .sub { display: none; }
  .brand .title { font-size: 14px; }
  .brand .mark { width: 26px; height: 26px; font-size: 12px; }
  .topbar .planname { order: 5; flex: 1 1 120px; width: auto; }
  .topbar .pill { order: 6; font-size: 11px; padding: 1px 7px; }
  .topbar button { order: 4; }
  .langsw { order: 3; }

  /* Die Tab-Leiste scrollt bereits waagrecht; der Balken stoert dabei nur. */
  nav.tabs { padding: 0 12px; scrollbar-width: none; }
  nav.tabs::-webkit-scrollbar { display: none; }

  /* Zielwerte je Semester untereinander statt in vier Spalten. Die Karte ist
     hier schmaler als die Zeile breit waere. */
  .trow { grid-template-columns: 1fr auto; }
  .trow input[type=range] { grid-column: 1 / -1; }

  /* Wochenraster: sechs Spalten auf 351 px waeren 40 px breit, darin ist kein
     Kursname lesbar. Stattdessen eine Mindestbreite je Spalte; das Raster
     scrollt waagrecht mitsamt Kopfzeile, weil beides im selben Grid liegt. */
  .tt { grid-template-columns: 40px repeat(6, minmax(92px, 1fr)); min-width: 604px; }

  /* Semesterspalten breiter und einrastend, damit das Wischen zwischen
     Semestern nicht zwischen zwei Spalten stehen bleibt. */
  .semband { grid-auto-columns: minmax(240px, 1fr); scroll-snap-type: x proximity; }
  .semcol { scroll-snap-align: start; }

  /* Safari auf iOS zoomt beim Fokus in jedes Feld unter 16 px hinein. */
  input, select, textarea { font-size: 16px; }
  input[type=number] { width: 68px; }
}

@media (pointer: coarse) {
  /* Mit dem Finger bedient: die Schaltflaechen sind sonst 26 bis 28 px hoch. */
  button, select, input[type=text], input[type=number] { min-height: 40px; }
  button.small, .langsw button { min-height: 34px; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; }
}

/* Kurse zwischen Semestern verschieben. Am Zeiger geht das per Ziehen; Touch
   kennt kein natives HTML5-Drag-and-drop, dort braucht es ein Bedienelement.
   Ohne das liesse sich ein gesetzter Kurs auf dem Handy nur loeschen und neu
   anlegen -- und verloere dabei Gruppen-, Bereichs- und Fachwahl. */
.movesel { display: none; margin-top: 4px; }
.movesel select { font-size: 12px; padding: 1px 4px; }
@media (pointer: coarse) {
  .movesel { display: block; }
  .movesel select { min-height: 32px; }
}
