/* =====================================================================
   SCHEDULE.CSS — Plan: Werkzeugleiste, Tages-Leiste, Zeitleiste (Tag),
   Wochenraster, Monatsraster, Farbwahl im Formular.
   Fach-Farben kommen als --c (= var(--subject-N) aus colors.css) pro Element.
   ===================================================================== */

/* ---------- Werkzeugleiste ---------- */
.plan-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 12px; }
.plan-nav { display: flex; align-items: center; gap: 6px; flex: 1 1 260px; min-width: 0; }
.plan-range { flex: 1; text-align: center; font-weight: 650; font-size: 16px; min-width: 0; }
.plan-tools { display: flex; align-items: center; gap: 8px; }
.select-compact { width: auto; max-width: 180px; min-height: 40px; padding-left: 12px; padding-right: 38px; font-size: 14px; }
.select-compact:not([multiple]) { background-position: calc(100% - 20px) 52%, calc(100% - 14px) 52%; }
.plan-add { margin: 20px 0 0; }
.plan-add .btn { width: 100%; }

/* ---------- Wochentage (Tagesansicht) ---------- */
.day-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 16px; }
.daychip {
    min-height: 68px; border-radius: 16px; padding: 4px 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    background: var(--surface); border: 1px solid var(--line); color: var(--text);
}
.daychip .dc-wd { font-size: 13px; color: var(--muted); }
.daychip b { font-size: 17px; }
.dc-dot { width: 6px; height: 6px; border-radius: 50%; background: transparent; }
.dc-dot.has { background: var(--accent); }
.daychip.today { border: 2px solid var(--accent); }
.daychip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.daychip.on .dc-wd { color: var(--on-accent); }
.daychip.on .dc-dot.has { background: var(--on-accent); }

/* ---------- Zeitleiste (Tag) ---------- */
.tl-row { display: flex; align-items: stretch; gap: 12px; margin-bottom: 10px; }
.tl-time { width: 52px; flex: none; text-align: right; font-size: 14px; color: var(--text); padding-top: 14px; line-height: 1.3; }
.tl-time span { display: block; color: var(--muted); margin-top: 2px; }
.tl-card { flex: 1; margin: 0; padding: 0; border-left: 4px solid var(--c, var(--accent)); overflow: hidden; }
.tl-main {
    display: block; width: 100%; padding: 14px 16px; background: none; border: 0; text-align: left;
    color: var(--text); text-decoration: none; cursor: pointer;
}
.tl-main b { font-size: 17px; }
.tl-title { display: block; }
.tl-foot { display: flex; justify-content: space-between; align-items: center; padding: 0 12px 6px 16px; min-height: 0; }
.tl-foot:empty { display: none; }
.tl-card.cancelled { background: transparent; border-style: dashed; border-left-style: solid; }
.tl-card.cancelled .tl-title { text-decoration: line-through; color: var(--muted); }
.tl-gap { display: flex; align-items: center; gap: 10px; padding-left: 64px; margin: 4px 0 14px; font-size: 14px; color: var(--muted); }
.tl-gap::before, .tl-gap::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.tl-gap span { flex: none; }

/* ---------- Wochenraster ---------- */
.schedule-week-scroll { overflow: clip; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.schedule-week-grid { display: grid; grid-template-columns: 56px repeat(7, minmax(0, 1fr)); }
.schedule-week-head { display: contents; }
.schedule-week-head > div {
    padding: 8px 4px; font-size: 13px; color: var(--muted); text-align: center;
    border-bottom: 1px solid var(--line); border-left: 1px solid var(--line);
    position: sticky; top: 0; background: var(--surface);
}
.schedule-week-head > div:first-child { border-left: 0; }
.schedule-week-head .today { color: var(--accent); font-weight: 700; }
.schedule-allday > div { padding: 3px; min-height: 28px; }
.schedule-allday .allday-label { font-size: 11px; display: flex; align-items: center; justify-content: flex-end; padding: 0 6px 0 0; hyphens: manual; text-align: right; }
.schedule-hour-label { font-family: var(--font-mono); font-size: 11px; color: var(--muted); padding: 2px 6px; text-align: right; border-top: 1px solid var(--line); }
.schedule-day-col { position: relative; border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.schedule-day-col.today { background: var(--accent-soft); }

.schedule-entry-block {
    position: absolute; padding: 4px 6px; overflow: hidden; text-align: left;
    border: 0; border-left: 4px solid var(--c); border-radius: 6px;
    background: color-mix(in srgb, var(--c) 24%, var(--surface));
    color: var(--text); font-size: 12px; line-height: 1.3; text-decoration: none; cursor: pointer;
}
.schedule-entry-block:focus-visible { z-index: 5; }
@media (hover: hover) { .schedule-entry-block:hover { background: color-mix(in srgb, var(--c) 36%, var(--surface)); } }
.schedule-entry-title { font-weight: 700; display: block; }
.schedule-entry-time { display: block; color: var(--text); opacity: 1; }
.schedule-entry-block.cancelled { background: var(--surface); border: 1px dashed var(--border-ui); border-left: 4px solid var(--c); color: var(--muted); }
.schedule-entry-block.cancelled .schedule-entry-title { text-decoration: line-through; }
.schedule-entry-block.cancelled .schedule-entry-time { color: var(--muted); }

/* ---------- Pillen (Monat & ganztägig) ---------- */
.pill {
    display: block; width: 100%; padding: 2px 6px; margin-bottom: 2px; min-height: 22px;
    border: 0; border-left: 3px solid var(--c, var(--accent)); border-radius: 4px; text-align: left;
    background: color-mix(in srgb, var(--c, var(--accent)) 24%, var(--surface));
    color: var(--text); font-size: 12px; line-height: 1.4; text-decoration: none;
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer;
}
.pill.exam { --c: var(--accent); }

/* ---------- Monatsraster ---------- */
.schedule-month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.schedule-month-head { padding: 8px 4px; text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--line); }
.schedule-month-cell { min-height: 92px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); padding: 4px; min-width: 0; }
.schedule-month-cell:nth-child(7n + 8) { border-left: 0; }
.schedule-month-cell.other { background: var(--bg); }
.schedule-month-cell.other .schedule-month-daynum { color: var(--muted); }
.schedule-month-daynum {
    display: block; min-width: 28px; min-height: 28px; margin-bottom: 2px; padding: 0 4px; border-radius: 14px;
    background: none; border: 0; color: var(--text); font-size: 13px; font-weight: 600; text-align: left;
}
.schedule-month-daynum.today { background: var(--accent); color: var(--on-accent); font-weight: 700; text-align: center; }

@media (max-width: 640px) {
    /* Wochenraster passt komplett auf den Bildschirm (kein Scrollen im Scrollen) */
    .schedule-week-grid { grid-template-columns: 40px repeat(7, minmax(0, 1fr)); }
    .schedule-week-head > div { padding: 6px 0; font-size: 11px; }
    .schedule-week-head .num { font-size: 10px; }
    .schedule-allday .allday-label { font-size: 9px; padding-right: 3px; }
    .schedule-hour-label { font-size: 10px; padding: 2px 3px; }
    .schedule-entry-block { padding: 2px 3px; font-size: 10px; border-left-width: 3px; }
    .schedule-entry-time { display: none; }
    .schedule-allday .pill { font-size: 0; height: 8px; min-height: 8px; padding: 0; }
    .schedule-month-cell { min-height: 64px; padding: 2px; }
    .schedule-month-cell .pill { font-size: 0; padding: 0; min-height: 8px; height: 8px; margin-bottom: 3px; }   /* auf dem Handy nur Farbbalken; Tippen auf die Zahl öffnet den Tag */
}

/* ---------- Farbwahl im Formular ---------- */
.schedule-color-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.schedule-color-swatch {
    width: 44px; height: 44px; border-radius: 50%; padding: 0;
    border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border-ui);
    display: grid; place-items: center; color: var(--on-accent);
}
.schedule-color-swatch.selected { box-shadow: 0 0 0 3px var(--text); }
.schedule-color-swatch .ico { stroke-width: 3; }

/* Karten der Zeitleiste: keine künstliche Mindesthöhe */
.tl-card { display: block; }
.tl-main { min-height: 0; height: auto; }
