/* Studienplaner */
:root {
  --bg: #f4f2ed;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --ink: #1c1d21;
  --muted: #6c6f76;
  --line: #e3dfd6;
  --line-soft: #efece6;
  --today: #fbf6ea;

  --lec: #f3857e;      /* Vorlesung (rot) */
  --lec-ink: #3b0f0b;
  --exe: #a9c8ec;      /* Übung (blau) */
  --exe-ink: #0c2848;

  --urgent: #d42f22;
  --urgent-bg: #fdeceb;
  --ok: #2f8a4a;
  --amber: #a86400;
  --amber-bg: #fff2dc;
  --violet: #6b3fb5;
  --violet-bg: #f0e9fb;
  --slate: #475569;
  --slate-bg: #eef1f5;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 20, 20, .04), 0 6px 24px rgba(20, 20, 20, .05);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121316;
    --surface: #1b1c20;
    --surface-2: #202227;
    --ink: #ecebe6;
    --muted: #9b9ea6;
    --line: #2e3036;
    --line-soft: #26282d;
    --today: #22231f;
    --lec: #a9473f;
    --lec-ink: #fff0ee;
    --exe: #2f5c8f;
    --exe-ink: #eaf3ff;
    --urgent: #ff6b5e;
    --urgent-bg: #3a1d1b;
    --ok: #4fbf72;
    --amber: #f0b45a;
    --amber-bg: #3a2c14;
    --violet: #b99af0;
    --violet-bg: #2c2340;
    --slate: #b4bfce;
    --slate-bg: #262b33;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--font);
  font-variant-numeric: tabular-nums;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.empty { color: var(--muted); padding: 10px 16px; margin: 0; font-size: 14px; }

/* ------------------------------------------------------------------ Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 9px;
  padding: 8px 14px; cursor: pointer; font-weight: 600; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-sm { padding: 5px 11px; font-size: 13.5px; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--ink); opacity: .88; }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.danger { color: var(--urgent); }
.icon-btn {
  display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 6px;
  border: 0; background: transparent; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 17px;
}
.icon-btn:hover { background: var(--line-soft); color: var(--ink); }
.icon-btn:disabled { opacity: .3; cursor: default; background: transparent; }
.icon-btn svg { fill: currentColor; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.pill {
  display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  padding: 1px 8px; border-radius: 99px; background: var(--ink); color: var(--bg); margin-left: 8px; vertical-align: 1px;
}
.pill-red { background: var(--urgent); color: #fff; }
.pill-soft { background: var(--line-soft); color: var(--muted); }

/* ------------------------------------------------------------------ Kopfzeile */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: -.01em; font-size: 16px; }
.brand-mark { display: grid; grid-template-columns: 9px 9px; gap: 2px; }
.sq { display: block; width: 9px; height: 9px; border-radius: 2.5px; }
.sq-v { background: var(--lec); }
.sq-u { background: var(--exe); }
.sem-picker select {
  border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 6px 10px; font-weight: 600;
}
.general-links { display: flex; align-items: center; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.general-links::-webkit-scrollbar { display: none; }
@media (min-width: 721px) {
  /* am Desktop umbrechen statt seitlich scrollen, damit alle Lesezeichen sichtbar sind */
  .general-links { flex-wrap: wrap; overflow: visible; row-gap: 2px; }
}
.gl {
  text-decoration: none; padding: 5px 10px; border-radius: 8px; font-size: 13.5px; color: var(--muted); white-space: nowrap;
}
.gl:hover { background: var(--line-soft); color: var(--ink); }
.gl-edit { flex: none; }
.gl-folder {
  display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; color: var(--ink); font-weight: 600; flex: none;
}
.gl-folder:hover { background: var(--line-soft); }
.gl-folder svg { color: var(--muted); }
.gl-caret { font-size: 10px; color: var(--muted); }
.dropdown {
  position: fixed; z-index: 40; min-width: 240px; max-width: 300px; max-height: 70vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.18);
  padding: 6px; display: flex; flex-direction: column;
}
.dropdown-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px 10px 4px; }
.dropdown a { display: flex; flex-direction: column; text-decoration: none; padding: 7px 10px; border-radius: 8px; line-height: 1.3; }
.dropdown a:hover { background: var(--line-soft); }
.dropdown hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.dropdown button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 13.5px; }
.dropdown button:hover { background: var(--line-soft); color: var(--ink); }
.dropdown-empty { padding: 4px 10px; margin: 0; }
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: 40px; min-width: 260px; z-index: 30;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.15);
  padding: 6px; display: flex; flex-direction: column;
}
.menu button { text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 8px; cursor: pointer; }
.menu button:hover:not(:disabled) { background: var(--line-soft); }
.menu button:disabled { color: var(--muted); cursor: default; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* ------------------------------------------------------------------ Seite */
.page { max-width: 1240px; margin: 0 auto; padding: 20px; display: grid; gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.card-head h2 { margin: 0; font-size: 19px; letter-spacing: -.015em; margin-right: auto; display: flex; align-items: center; gap: 10px; }
.week-nav { display: flex; align-items: center; gap: 4px; }
.week-label { min-width: 0; font-size: 14px; padding: 0 4px; }
.week-label .pill { margin-left: 6px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); width: 100%; order: 3; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.lg-v { background: var(--lec); }
.lg-u { background: var(--exe); }
.legend .lg-times { display: none; }

/* ------------------------------------------------------------------ Stundenplan */
.tt-wrap { overflow-x: auto; }
.tt-grid {
  display: grid;
  grid-template-columns: 92px repeat(var(--cols), minmax(112px, 1fr));
  grid-template-rows: auto calc(var(--rows) * var(--row));
  padding: 0 10px 12px 0;
}
.tt-corner {
  border-bottom: 1px solid var(--line); padding: 8px 8px 6px 0; text-align: right;
  display: flex; flex-direction: column; justify-content: flex-end; line-height: 1.2; font-size: 10.5px;
}
.tz { color: var(--ink); font-weight: 600; }
.th1 { color: var(--muted); }
.th2 { color: var(--muted); opacity: .8; }
.tt-dayhead {
  padding: 10px 6px 8px; text-align: center; border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; line-height: 1.2;
}
.tt-dayhead span { font-weight: 700; font-size: 14px; }
.tt-dayhead small { color: var(--muted); font-size: 12px; }
.tt-dayhead.is-today span { color: var(--urgent); }
.tt-times { position: relative; }
.tt-time {
  height: var(--row); padding: 5px 8px 0 0; text-align: right; line-height: 1.3;
  display: flex; flex-direction: column; font-size: 11px; white-space: nowrap; cursor: default;
}
.tt-time .tz { font-size: 11.5px; }
.tt-col { position: relative; border-left: 1px solid var(--line-soft); }
.tt-col.is-today { background: var(--today); }
.tt-cell { position: absolute; left: 0; right: 0; height: var(--row); border-top: 1px solid var(--line-soft); }

.ev {
  position: absolute; z-index: 2; border: 0; border-radius: 9px; padding: 6px 8px 5px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 0; text-align: left;
  cursor: pointer; overflow: hidden; line-height: 1.25;
  transition: transform .12s ease, box-shadow .12s ease;
}
.ev:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.14); }
.ev-v { background: var(--lec); color: var(--lec-ink); }
.ev-u { background: var(--exe); color: var(--exe-ink); }
.ev-title { font-weight: 800; font-size: 13.5px; letter-spacing: -.005em; }
.ev-room { font-size: 12px; font-weight: 400; }
.ev-main { font-weight: 800; }
.ev-flag { font-size: 10.5px; font-style: italic; margin-top: auto; opacity: .85; }
.ev-off { opacity: .4; background-image: repeating-linear-gradient(135deg, transparent 0 7px, rgba(255,255,255,.45) 7px 13px); }
.ev-short { padding-top: 3px; }
.ev-short .ev-flag { display: none; }
.tt-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--urgent); z-index: 3; pointer-events: none; }
.tt-now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--urgent); }

.day-tabs { display: none; }

/* ------------------------------------------------------------------ Aufgaben */
.task-tools { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.toggle { display: inline-flex; gap: 6px; align-items: center; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.count-badge { font-size: 12.5px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--urgent-bg); color: var(--urgent); }
.count-badge.calm { background: var(--line-soft); color: var(--muted); font-weight: 600; }

.course-filter { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 18px 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 99px; padding: 4px 11px; font-size: 13px; cursor: pointer; color: var(--muted);
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.overview { padding: 14px 18px 0; }
.overview-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.overview-head .link-btn { border: 0; background: none; color: var(--muted); font-size: 13px; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 2px; }
.overview-head .link-btn:hover { color: var(--ink); }
.wk-tiles { display: grid; grid-template-columns: repeat(var(--n), minmax(44px, 1fr)); gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.wk-tile {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 9px; padding: 6px 6px 5px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 44px; position: relative;
}
.wk-tile:hover { border-color: var(--muted); }
.wk-n { font-weight: 800; font-size: 14px; line-height: 1; }
.wk-c { font-size: 11px; color: var(--muted); line-height: 1; }
.wk-bar { width: 100%; height: 4px; border-radius: 99px; background: var(--line-soft); overflow: hidden; }
.wk-bar span { display: block; height: 100%; background: var(--ok); }
.wk-tile.is-current { border: 2px solid var(--ink); padding: 5px 5px 4px; }
.wk-tile.is-past .wk-n { color: var(--muted); }
.wk-tile.is-complete { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.wk-tile.is-complete .wk-n { color: var(--ok); }
.wk-tile.has-soon, .wk-tile.has-overdue { background: var(--urgent-bg); border-color: color-mix(in srgb, var(--urgent) 50%, transparent); }
.wk-tile.has-soon .wk-n, .wk-tile.has-overdue .wk-n, .wk-tile.has-overdue .wk-c { color: var(--urgent); }
.wk-tile.has-overdue::after { content: ""; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--urgent); }

.next-up:empty { display: none; }
.next-wrap { padding: 14px 18px 4px; }
.next-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.next-list { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.next-card {
  flex: 0 0 auto; width: 200px; scroll-snap-align: start; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 10px; background: var(--surface-2);
  padding: 9px 11px; display: flex; flex-direction: column; gap: 1px;
}
.next-card:hover { border-color: var(--muted); border-left-color: var(--c); }
.next-course { font-size: 11.5px; font-weight: 700; color: color-mix(in srgb, var(--c) 75%, var(--ink)); }
.next-title { font-weight: 650; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-due { font-size: 12.5px; color: var(--muted); }
.next-rel { font-size: 12.5px; font-weight: 600; }
.next-card.is-urgent { background: var(--urgent-bg); border-color: color-mix(in srgb, var(--urgent) 45%, transparent); border-left-color: var(--urgent); }
.next-card.is-urgent .next-rel, .next-card.is-urgent .next-due { color: var(--urgent); }

.weeks { padding: 8px 0 6px; }
.week { border-top: 1px solid var(--line); }
.week:first-child { border-top: 0; }
.week-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px; background: none; border: 0; cursor: pointer; text-align: left;
}
.week-head.static { cursor: default; }
.week-head:hover:not(.static) { background: var(--surface-2); }
.week-title b { font-size: 15.5px; }
.week-dates { color: var(--muted); font-size: 13px; margin-left: 10px; }
.week-progress { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); flex: none; }
.bar { width: 90px; height: 6px; border-radius: 99px; background: var(--line-soft); overflow: hidden; display: inline-block; }
.bar span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.chev { transition: transform .15s; font-size: 12px; }
.week.is-collapsed .chev { transform: rotate(-90deg); }
.week.is-current { background: linear-gradient(to right, var(--ink) 0 3px, transparent 3px); }
.week.is-past .week-title b { color: var(--muted); }
.week.is-undated .week-title b { color: var(--amber); }

.tasks { list-style: none; margin: 0; padding: 0 0 8px; }
.task {
  display: grid; grid-template-columns: 28px 74px minmax(0, 1fr) auto 32px; align-items: center; gap: 10px;
  padding: 8px 12px 8px 18px; border-top: 1px solid var(--line-soft);
}
.task:hover { background: var(--surface-2); }
.task.is-urgent { background: var(--urgent-bg); }
.task.is-urgent .due-date, .task.is-urgent .due-rel { color: var(--urgent); font-weight: 700; }
.task.is-overdue .task-title { color: var(--urgent); }
.task.is-done .task-title { text-decoration: line-through; color: var(--muted); }
.task.is-done .course-tag, .task.is-done .task-meta, .task.is-done .due-date { opacity: .55; }
.task.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 40% { background: color-mix(in srgb, var(--c) 25%, transparent); } }

.check { position: relative; display: inline-grid; place-items: center; width: 24px; height: 24px; cursor: pointer; }
.check input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.check .box {
  width: 20px; height: 20px; border: 2px solid color-mix(in srgb, var(--muted) 70%, transparent); border-radius: 6px;
  display: grid; place-items: center; transition: background .12s, border-color .12s;
}
.check input:checked + .box { background: var(--ok); border-color: var(--ok); }
.check input:checked + .box::after {
  content: ""; width: 10px; height: 5px; border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff; transform: translateY(-1px) rotate(-45deg);
}
.check input:focus-visible + .box { outline: 2px solid var(--ink); outline-offset: 2px; }
.task.is-urgent .check .box { border-color: var(--urgent); }

.course-tag {
  justify-self: start; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; white-space: nowrap;
  background: color-mix(in srgb, var(--c) 15%, transparent); color: color-mix(in srgb, var(--c) 72%, var(--ink));
}
.task-main { min-width: 0; }
.task-title { font-weight: 600; text-decoration: none; }
a.task-title:hover { text-decoration: underline; }
.task-meta { display: flex; align-items: center; gap: 6px; margin-top: 2px; min-width: 0; }
.task-note { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.course-mini { display: none; font-size: 12px; font-weight: 700; color: color-mix(in srgb, var(--c) 72%, var(--ink)); }
.task-due { text-align: right; display: flex; flex-direction: column; line-height: 1.25; white-space: nowrap; }
.due-date { font-size: 13.5px; font-weight: 600; }
.due-rel { font-size: 12.5px; color: var(--muted); }
.due-rel.ok { color: var(--ok); }
.task-edit { opacity: .55; }
.task:hover .task-edit { opacity: 1; }

.badge { display: inline-block; flex: none; font-size: 11px; font-weight: 700; letter-spacing: .02em; padding: 1px 7px; border-radius: 5px; border: 1px solid transparent; }
.kind-bonus { background: var(--amber-bg); color: var(--amber); }
.kind-korrektur { background: var(--slate-bg); color: var(--slate); }
.kind-benotet { background: var(--violet-bg); color: var(--violet); }
.kind-freiwillig { border-color: var(--line); color: var(--muted); }
.kind-unklar { border: 1px dashed color-mix(in srgb, var(--muted) 60%, transparent); color: var(--muted); }
.badge-open { background: var(--amber-bg); color: var(--amber); font-size: 12px; padding: 2px 8px; }
.badge-soft { background: var(--line-soft); color: var(--muted); font-weight: 600; }

/* ------------------------------------------------------------------ Dialoge */
.dlg {
  border: 0; padding: 0; border-radius: 16px; width: min(580px, calc(100vw - 24px)); max-height: min(86vh, 900px);
  background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.3);
}
.dlg[open] { display: flex; flex-direction: column; }
.dlg::backdrop { background: rgba(15, 15, 18, .42); }
.dlg-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--line);
}
.dlg-head.is-v { border-top: 6px solid var(--lec); }
.dlg-head.is-u { border-top: 6px solid var(--exe); }
.dlg-head h3 { margin: 2px 0 0; font-size: 19px; letter-spacing: -.01em; }
.dlg-kicker { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.dlg-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.dlg-body { padding: 14px 20px 20px; overflow-y: auto; }
.dlg-body h4 { margin: 18px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

.rooms { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-soft); }
.rooms-list { display: grid; gap: 2px; font-size: 14.5px; }
.rooms-form { display: grid; gap: 10px; width: 100%; }
.ev-note { font-size: 13.5px; color: var(--muted); margin: 10px 0 0; }

.links { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.link-row { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; border-top: 1px solid var(--line-soft); }
.link-row:first-child { border-top: 0; }
.link-row.editing { padding: 10px 12px; }
.link-main { flex: 1; min-width: 0; text-decoration: none; padding: 6px 0; display: flex; flex-direction: column; }
.link-main:hover .link-title { text-decoration: underline; }
.link-title { font-weight: 650; }
.link-url { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-actions { display: flex; flex: none; }
.link-form { display: grid; gap: 8px; width: 100%; margin-top: 8px; }
.link-row .link-form { margin-top: 0; }
.add-link { margin-top: 10px; }
.bm-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.bm-actions .btn svg { color: var(--muted); }
.bm-editor > .link-form { margin: 0 0 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.bm-folder { border-top: 1px solid var(--line-soft); padding: 4px 6px 8px 12px; background: var(--surface-2); }
.bm-folder:first-child { border-top: 0; }
.bm-folder-head { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.bm-folder-head svg { color: var(--muted); flex: none; }
.bm-folder-head .link-actions { margin-left: auto; }
.bm-folder .folder-form { padding: 8px 0; }
.bm-sub { list-style: none; margin: 0 0 0 22px; padding: 0; border-left: 2px solid var(--line); }
.bm-sub .link-row { background: var(--surface); }
.bm-add-in { margin: 6px 0 0 22px; }

.mini-tasks { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.mini-tasks li { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.mini-due { color: var(--muted); font-size: 13px; text-align: right; }
.mini-tasks li.is-urgent .mini-due { color: var(--urgent); font-weight: 700; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid .span2 { grid-column: 1 / -1; }
label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
input:not([type=checkbox]), select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 9px; padding: 8px 10px; font-size: 14.5px; font-weight: 400;
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--ink) 35%, transparent); outline-offset: 0; border-color: var(--ink); }
input:disabled { opacity: .5; }
textarea { resize: vertical; }
.check-row { display: flex; align-items: center; gap: 8px; font-weight: 500; align-self: end; padding-bottom: 8px; }
.row-btns { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.err-list { padding-left: 18px; color: var(--urgent); font-size: 13.5px; }

/* ------------------------------------------------------------------ Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600;
  transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--urgent); color: #fff; }

/* ------------------------------------------------------------------ Login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); padding: 30px 28px 26px;
}
.login-card h1 { margin: 14px 0 0; font-size: 26px; letter-spacing: -.02em; }
.login-sub { margin: 2px 0 20px; color: var(--muted); }
.login-card form { display: grid; gap: 14px; }
.login-mark { display: grid; grid-template-columns: repeat(2, 14px); gap: 3px; }
.login-mark .sq { width: 14px; height: 14px; border-radius: 4px; }
.login-error { background: var(--urgent-bg); color: var(--urgent); padding: 9px 12px; border-radius: 9px; font-size: 14px; font-weight: 600; }

/* ------------------------------------------------------------------ Mobil */
@media (max-width: 720px) {
  body { font-size: 14.5px; }
  .topbar-inner { padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
  .brand-name { display: none; }
  .sem-picker { flex: 1; }
  .sem-picker select { width: 100%; }
  .general-links { order: 3; flex-basis: 100%; }
  .page { padding: 12px; gap: 14px; }
  .card-head { padding: 12px 14px; }
  .week-nav { width: 100%; justify-content: space-between; }
  .legend { flex-wrap: wrap; gap: 10px; }
  .day-tabs { display: flex; gap: 4px; padding: 10px 12px 4px; }
  .day-tab {
    flex: 1; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 6px 0;
    display: flex; flex-direction: column; align-items: center; line-height: 1.15; cursor: pointer;
  }
  .day-tab span { font-weight: 700; }
  .day-tab small { font-size: 11px; color: var(--muted); }
  .day-tab.is-today span { color: var(--urgent); }
  .day-tab[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
  .day-tab[aria-selected="true"] small, .day-tab[aria-selected="true"].is-today span { color: var(--bg); }
  .tt-grid { grid-template-columns: 78px 1fr; padding: 6px 8px 12px 0; }
  .tt-time { font-size: 10px; padding-right: 6px; }
  .tt-time .tz { font-size: 10.5px; }
  .legend .lg-times { display: inline-flex; gap: 3px; }
  .tt-grid.mobile { grid-template-rows: calc(var(--rows) * var(--row)); }
  .ev-title { font-size: 14.5px; }
  .ev-room { font-size: 13px; }
  .course-filter { padding: 10px 14px 0; }
  .next-wrap { padding: 12px 14px 2px; }
  .week-head { padding: 12px 14px; }
  .week-dates { display: block; margin: 0; }
  .bar { width: 48px; }
  .task {
    grid-template-columns: 28px minmax(0, 1fr) 30px;
    grid-template-areas: "chk main edit" "chk due edit";
    padding: 10px 8px 10px 14px; row-gap: 4px;
  }
  .task .check { grid-area: chk; align-self: start; margin-top: 2px; }
  .task .course-tag { display: none; }
  .task-main { grid-area: main; }
  .course-mini { display: inline-block; }
  .task-due { grid-area: due; text-align: left; flex-direction: row; gap: 8px; align-items: baseline; }
  .task-edit { grid-area: edit; opacity: 1; }
  .task-note { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .dlg { width: calc(100vw - 16px); max-height: 92vh; }
}
