/* ==========================================================================
   Urlaubsplaner – Stil (angelehnt an Outlook)
   Standard: Dark Mode · Hell über data-theme="light"
   ========================================================================== */
:root,
[data-theme="dark"] {
    color-scheme: dark;
    --bg: #111215;
    --surface: #1b1c20;
    --surface-2: #16171a;
    --surface-3: #24262b;
    --hover: rgba(255, 255, 255, .045);
    --line: #2a2c32;
    --line-strong: #3a3d45;
    --text: #e7e8eb;
    --text-2: #c3c7ce;
    --muted: #8d939d;
    --faint: #5d636d;
    --accent: #5ea8f7;
    --btn: #2f7fd6;
    --btn-hover: #3d8de3;
    --btn-disabled: #2a3a4d;
    --accent-soft: rgba(94, 168, 247, .12);
    --hol: #c9a3aa;
    --hol-bg: rgba(255, 255, 255, .035);
    --we-bg: rgba(255, 255, 255, .018);
    --out-bg: rgba(0, 0, 0, .22);
    --out-text: #5d636d;
    --cell-hover: rgba(94, 168, 247, .07);
    --sel: rgba(94, 168, 247, .22);
    --sel-line: rgba(94, 168, 247, .65);
    --bb: #9a8390;
    --bb-soft: rgba(154, 131, 144, .13);
    --bb-text: #a99aa3;
    --bb-cell: rgba(154, 131, 144, .32);
    --mv: #9c927c;
    --mv-soft: rgba(156, 146, 124, .13);
    --mv-text: #aaa292;
    --mv-cell: rgba(156, 146, 124, .32);
    --ok: #3fb950;
    --ok-rgb: 63, 185, 80;
    --ok-text: #7ee28c;
    --danger: #ff6b81;
    --warn-bg: rgba(245, 159, 0, .12);
    --warn-text: #ffc866;
    --track: #2b2e34;
    --q-used: #69707b;
    --backdrop: rgba(0, 0, 0, .62);
    --toast-bg: #e7e8eb;
    --toast-text: #111215;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .35);
    --ring: #1b1c20;
}

[data-theme="light"] {
    color-scheme: light;
    --bg: #f3f4f6;
    --surface: #ffffff;
    --surface-2: #fafbfc;
    --surface-3: #eef0f3;
    --hover: rgba(0, 0, 0, .04);
    --line: #e4e6ea;
    --line-strong: #cfd3d9;
    --text: #1f2328;
    --text-2: #3b414a;
    --muted: #6b7280;
    --faint: #a3a9b2;
    --accent: #0f6cbd;
    --btn: #0f6cbd;
    --btn-hover: #0c5aa0;
    --btn-disabled: #a8c3de;
    --accent-soft: #e8f1fb;
    --hol: #9b6a73;
    --hol-bg: #f5f3f3;
    --we-bg: #f8f9fa;
    --out-bg: #fbfbfc;
    --out-text: #a3a9b2;
    --cell-hover: #f1f6fc;
    --sel: rgba(15, 108, 189, .16);
    --sel-line: rgba(15, 108, 189, .45);
    --bb: #b39aa7;
    --bb-soft: #f2eef0;
    --bb-text: #7f6a75;
    --bb-cell: #e3d9de;
    --mv: #b5aa90;
    --mv-soft: #f2f0ea;
    --mv-text: #7a705a;
    --mv-cell: #e3ded2;
    --ok: #13a10e;
    --ok-rgb: 19, 161, 14;
    --ok-text: #0b5a08;
    --danger: #c4314b;
    --warn-bg: #fff7e0;
    --warn-text: #7a5300;
    --track: #e6e9ed;
    --q-used: #9aa3ae;
    --backdrop: rgba(17, 24, 39, .38);
    --toast-bg: #1f2328;
    --toast-text: #ffffff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .05);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .18), 0 2px 8px rgba(0, 0, 0, .08);
    --ring: #ffffff;
}

:root { --radius: 8px; --lane: 24px; }

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}
body { display: flex; flex-direction: column; overflow: hidden; }

button, input { font: inherit; color: inherit; }
.muted { color: var(--muted); font-weight: 400; }
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    height: 34px; padding: 0 14px;
    border-radius: 6px; border: 1px solid transparent;
    background: none; cursor: pointer; font-weight: 600; white-space: nowrap;
    transition: background .12s, border-color .12s, color .12s;
}
.btn.small { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-primary { background: var(--btn); color: #fff; }
.btn-primary:hover { background: var(--btn-hover); }
.btn-primary:disabled { background: var(--btn-disabled); color: rgba(255,255,255,.6); cursor: not-allowed; }
.btn-ghost { border-color: var(--line-strong); background: var(--surface); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger-ghost { color: var(--danger); }
.btn-danger-ghost:hover { background: var(--hol-bg); }
.btn-danger-ghost.confirm { background: var(--danger); color: #fff; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 6px; border: 0;
    background: none; cursor: pointer; font-size: 16px; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.on { color: var(--accent); }
.icon-btn.small { width: 26px; height: 26px; font-size: 13px; }

/* ---------- Kopfzeile ---------- */
.topbar {
    flex: 0 0 56px;
    display: flex; align-items: center; gap: 14px;
    padding: 0 12px 0 8px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 4px; min-width: 200px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.brand i { color: var(--accent); font-size: 20px; }
.topbar-nav { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.nav-arrows { display: flex; }
.period { display: flex; flex-direction: column; min-width: 0; margin-left: 4px; }
.period-title { font-size: 18px; font-weight: 600; margin: 0; white-space: nowrap; line-height: 1.2; }
.period-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.topbar-right .segmented { margin-right: 6px; }
.topbar-right .btn-primary { margin-left: 6px; }

.segmented { display: flex; background: var(--surface-3); border-radius: 7px; padding: 3px; }
.segmented button {
    display: inline-flex; align-items: center; gap: 6px;
    border: 0; background: none; height: 28px; padding: 0 12px;
    border-radius: 5px; cursor: pointer; color: var(--muted); font-weight: 600;
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
[data-theme="dark"] .segmented button.active { background: #33363d; }
.segmented button:not(.active):hover { color: var(--text); }

.banner {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 16px; font-size: 13px; font-weight: 600;
    background: var(--warn-bg); color: var(--warn-text); border-bottom: 1px solid var(--line);
}
.banner span { flex: 1; }

/* ---------- Layout ---------- */
.layout {
    flex: 1; min-height: 0;
    display: grid; grid-template-columns: 250px minmax(0, 1fr) 330px;
}
.layout.no-sidebar { grid-template-columns: 0 minmax(0, 1fr) 330px; }
.layout.no-overview { grid-template-columns: 250px minmax(0, 1fr) 0; }
.layout.no-sidebar.no-overview { grid-template-columns: 0 minmax(0, 1fr) 0; }
.layout.no-sidebar .sidebar, .layout.no-overview .overview { visibility: hidden; padding: 0; border: 0; overflow: hidden; }

.sidebar, .overview {
    overflow-y: auto; overflow-x: hidden;
    background: var(--surface-2);
}
.sidebar { border-right: 1px solid var(--line); padding: 12px 12px 20px; }
.overview { border-left: 1px solid var(--line); padding: 14px 14px 12px; display: flex; flex-direction: column; }
.main { overflow: auto; background: var(--surface); overscroll-behavior: contain; }
.view { height: 100%; }
body[data-view="team"] .view, body[data-view="year"] .view { height: auto; }
body[data-view="year"] .main { background: var(--bg); padding: 16px; }

/* ---------- Linke Leiste ---------- */
.side-section { margin-bottom: 20px; }
.side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.side-head h2, .ov-sub { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0; font-weight: 700; }
.side-empty { color: var(--muted); font-size: 13px; padding: 6px 2px; line-height: 1.9; }

.mini-head { display: flex; align-items: center; gap: 2px; margin-bottom: 4px; }
.mini-title { flex: 1; font-weight: 600; font-size: 13px; padding-left: 4px; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.mini-wd { font-size: 10.5px; color: var(--muted); text-align: center; padding: 3px 0; font-weight: 600; }
.mini-day {
    position: relative; border: 0; background: none; cursor: pointer;
    height: 27px; font-size: 12px; border-radius: 4px; color: var(--text-2);
}
.mini-day:hover { background: var(--surface-3); }
.mini-day.out { color: var(--faint); }
.mini-day.hol { color: var(--hol); }
.mini-day.inview { background: var(--accent-soft); }
.mini-day.today { background: var(--btn); color: #fff; font-weight: 700; border-radius: 50%; }
.mini-day.busy::after {
    content: ""; position: absolute; left: 50%; bottom: 2px; width: 4px; height: 4px;
    margin-left: -2px; border-radius: 50%; background: var(--accent);
}
.mini-day.today.busy::after { background: #fff; }

.upcoming-list { display: flex; flex-direction: column; gap: 2px; }
.up-item {
    display: flex; flex-direction: column; gap: 1px; text-align: left;
    border: 0; background: none; cursor: pointer;
    padding: 6px 8px 6px 10px; border-radius: 6px;
    border-left: 3px solid var(--pc);
}
.up-item:hover { background: var(--surface-3); }
.up-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-date { font-size: 12px; color: var(--muted); }
.up-date .now { color: var(--ok-text); font-weight: 600; }

.layer-group { display: flex; flex-direction: column; gap: 1px; margin-bottom: 10px; }
.layer-title { font-size: 12px; font-weight: 600; color: var(--muted); margin: 2px 0; }
.layer { display: flex; align-items: center; gap: 8px; padding: 4px 2px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.layer input { accent-color: var(--btn); width: 15px; height: 15px; margin: 0; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: 0 0 12px; }
.sw-hol { background: var(--hol); }
.sw-bb { background: var(--bb); }
.sw-mv { background: var(--mv); }


.dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; display: inline-block; background: var(--pc); }
.badge {
    font-size: 10px; font-weight: 700; color: var(--muted);
    border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 4px; line-height: 15px;
}

/* ---------- Rechte Leiste: Übersicht ---------- */
.ov-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ov-head h2 { margin: 0; font-size: 16px; }
.ov-head h2 span { color: var(--muted); font-weight: 400; }
.ov-section { margin-bottom: 18px; }
.ov-sub { margin-bottom: 8px; }

.ov-strips { display: flex; flex-direction: column; gap: 5px; }
.strip-row { display: grid; grid-template-columns: 78px minmax(0, 1fr); align-items: center; gap: 8px; }
.strip-row.is-hidden { opacity: .4; }
.strip-name {
    display: flex; align-items: center; gap: 6px; min-width: 0;
    font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.strip-row.small .strip-name { font-size: 11px; font-weight: 600; }
.strip-name .dot { width: 8px; height: 8px; flex-basis: 8px; }
.strip {
    position: relative; height: 18px; border-radius: 4px;
    background: var(--surface-3); overflow: hidden; cursor: pointer;
}
.strip.thin { height: 8px; cursor: default; }
.strip-months .strip { height: 14px; background: none; overflow: visible; cursor: default; }
.strip-m { position: absolute; top: 0; font-size: 10px; color: var(--muted); font-weight: 600; padding-left: 2px; }
.strip i { position: absolute; top: 0; bottom: 0; display: block; }
.strip-tick { width: 1px; background: var(--line-strong); opacity: .6; }
.strip-window { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--sel-line); border-radius: 2px; }
.strip-today { width: 2px; background: var(--accent); z-index: 2; }
.strip-vac { border-radius: 2px; z-index: 1; cursor: pointer; }
.strip-vac:hover { filter: brightness(1.2); }
.strip-ferien.f-BB { background: var(--bb); opacity: .7; }
.strip-ferien.f-MV { background: var(--mv); opacity: .7; }
.strip-all { background: var(--ok); border-radius: 2px; z-index: 1; cursor: pointer; }
.strip-sum { margin-top: 3px; }
.strip-sum .strip-name { color: var(--ok-text); font-size: 12px; }
.all-free { display: flex; flex-wrap: wrap; gap: 5px; padding-left: 86px; font-size: 12px; }
.tag.ok { --pc: var(--ok); border: 0; border-left: 3px solid var(--ok); cursor: pointer; color: var(--text); }

.ov-people { display: flex; flex-direction: column; gap: 8px; }
.pcard {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 10px 10px 8px 12px; border-left: 3px solid var(--pc);
}
.pcard.is-hidden { opacity: .5; }
.pcard-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.pcard-title {
    display: flex; align-items: center; gap: 7px; flex: 1; min-width: 0;
    border: 0; background: none; padding: 0; cursor: pointer; text-align: left;
}
.pcard-title:hover .person-name { color: var(--accent); }
.person-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-rest { font-size: 12px; color: var(--muted); white-space: nowrap; }
.person-rest strong { font-size: 15px; color: var(--text); }
.person-rest.neg, .person-rest.neg strong { color: var(--danger); }
.person-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.meter { display: block; height: 6px; background: var(--track); border-radius: 3px; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 3px; background: var(--pc); }

.entries { list-style: none; margin: 8px 0 0; padding: 0; border-top: 1px solid var(--line); }
.entry {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center;
    width: 100%; border: 0; background: none; cursor: pointer; text-align: left;
    padding: 5px 4px; border-radius: 5px; font-size: 12.5px;
}
.entry:hover { background: var(--surface-3); }
.entry.past { opacity: .5; }
.e-date { font-variant-numeric: tabular-nums; color: var(--text-2); }
.e-note { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.e-days { font-weight: 700; font-size: 12px; color: var(--text-2); }
.entries-empty { font-size: 12px; color: var(--faint); margin-top: 6px; }


/* ---------- Balken (gemeinsam) ---------- */
.bars { position: absolute; pointer-events: none; }
.bar {
    position: absolute;
    left: calc(var(--c) / var(--n) * 100% + 3px);
    width: calc(var(--s) / var(--n) * 100% - 6px);
    top: var(--t, 0px);
    height: 21px; line-height: 21px;
    padding: 0 8px; border-radius: 5px;
    font-size: 12px; white-space: nowrap; overflow: hidden;
}
.bar span { display: block; overflow: hidden; text-overflow: ellipsis; }
.bar.cl { left: calc(var(--c) / var(--n) * 100%); width: calc(var(--s) / var(--n) * 100% - 3px); border-top-left-radius: 0; border-bottom-left-radius: 0; }
.bar.cr { width: calc(var(--s) / var(--n) * 100% - 3px); border-top-right-radius: 0; border-bottom-right-radius: 0; }
.bar.cl.cr { width: calc(var(--s) / var(--n) * 100%); }

.bar.vac {
    pointer-events: auto; cursor: pointer;
    background: var(--pc); color: var(--pt, #fff); font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
    transition: filter .1s, box-shadow .1s;
}
.bar.vac:hover { filter: brightness(1.12); box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.dragging .bar.vac { pointer-events: none; }

.bar.ferien { height: 15px; line-height: 15px; font-size: 10.5px; font-weight: 500; border-radius: 3px; padding: 0 6px; }
.f-BB.bar { background: var(--bb-soft); color: var(--bb-text); box-shadow: inset 2px 0 0 var(--bb); }
.f-MV.bar { background: var(--mv-soft); color: var(--mv-text); box-shadow: inset 2px 0 0 var(--mv); }
.f-BB.bar.cl, .f-MV.bar.cl { box-shadow: none; }

/* Blätter-Animation beim Mausrad */
.slide-up .mv-body { animation: slideUp .16s ease-out; }
.slide-down .mv-body { animation: slideDown .16s ease-out; }
.slide-left .tl-track, .slide-right .tl-track { animation: slideLeft .16s ease-out; }
.slide-right .tl-track { animation-name: slideRight; }
@keyframes slideUp { from { transform: translateY(28px); opacity: .55; } }
@keyframes slideDown { from { transform: translateY(-28px); opacity: .55; } }
@keyframes slideLeft { from { transform: translateX(24px); opacity: .55; } }
@keyframes slideRight { from { transform: translateX(-24px); opacity: .55; } }

/* ---------- Monatsansicht ---------- */
.month-view { display: flex; flex-direction: column; min-height: 100%; user-select: none; overflow: hidden; }
.mv-head {
    position: sticky; top: 0; z-index: 4;
    display: grid; grid-template-columns: 44px repeat(7, minmax(0, 1fr));
    background: var(--surface); border-bottom: 1px solid var(--line);
    font-size: 12px; font-weight: 600; color: var(--muted);
}
.mv-head > div { padding: 9px 8px; }
.mv-head .we { color: var(--faint); }
.mv-head .short { display: none; }
.mv-kw-h { text-align: center; }

.mv-body { flex: 1; display: flex; flex-direction: column; }
.mv-week {
    position: relative;
    display: grid; grid-template-columns: 44px repeat(7, minmax(0, 1fr));
    flex: 1 1 0;
    min-height: max(96px, calc(34px + var(--bars-h, 0px) + 8px));
    border-bottom: 1px solid var(--line);
}
.mv-kw {
    border: 0; background: none; cursor: pointer;
    font-size: 11px; color: var(--muted); font-weight: 600;
    display: flex; justify-content: center; padding-top: 9px;
}
.mv-kw:hover { background: var(--accent-soft); color: var(--accent); }

.mv-day { border-left: 1px solid var(--line); padding: 4px 6px; min-width: 0; cursor: pointer; }
.mv-day.we { background: var(--we-bg); }
.mv-day.hol { background: var(--hol-bg); }
.mv-day.out { background: var(--out-bg); }
.mv-day.out .mv-num { color: var(--out-text); font-weight: 500; }
.mv-day.first .mv-num { color: var(--accent); }
.mv-day:hover { background: var(--cell-hover); }
.mv-day.sel, .mv-day.sel:hover { background: var(--sel); box-shadow: inset 0 0 0 1px var(--sel-line); }

.mv-day-head { display: flex; align-items: center; gap: 6px; height: 24px; min-width: 0; }
.mv-num {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px;
    font-weight: 600; font-size: 13px; white-space: nowrap;
}
.mv-day.hol .mv-num { color: var(--hol); }
.mv-day.today .mv-num { background: var(--btn); color: #fff; }
.mv-hol { color: var(--hol); font-size: 11px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mv-week .bars { left: 44px; right: 0; top: 32px; }

/* ---------- Team-Zeitleiste ---------- */
.team-view {
    min-width: calc(190px + var(--n) * 26px);
    user-select: none; font-size: 13px; background: var(--surface);
}
.tl-row { display: grid; grid-template-columns: 190px minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.tl-name {
    position: sticky; left: 0; z-index: 3;
    display: flex; align-items: center; gap: 8px; min-width: 0;
    padding: 0 12px; background: var(--surface); border-right: 1px solid var(--line);
}
.tl-name.small { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.tl-track { position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }

.tl-head { position: sticky; top: 0; z-index: 5; background: var(--surface); box-shadow: 0 1px 0 var(--line); }
.tl-head .tl-name { z-index: 6; font-size: 12px; }
.tl-hd {
    position: relative; display: flex; flex-direction: column; align-items: center;
    padding: 17px 0 5px; border-left: 1px solid var(--line); font-size: 11px; line-height: 1.3;
}
.tl-hd .wd { color: var(--muted); }
.tl-hd .dn { font-weight: 700; font-size: 13px; padding: 0 5px; border-radius: 9px; }
.tl-hd .kw {
    position: absolute; top: 2px; left: 3px; z-index: 2;
    font-size: 9.5px; color: var(--accent); font-weight: 700; white-space: nowrap;
}
.tl-hd .kw b { color: var(--text); }
.tl-hd.hol .dn { color: var(--hol); }
.tl-hd.today .dn { background: var(--btn); color: #fff; }

.we.tl-hd, .we.tl-cell, .we.tl-fc, .we.tl-sc { background: var(--we-bg); }
.hol.tl-hd, .hol.tl-cell, .hol.tl-fc, .hol.tl-sc { background: var(--hol-bg); }
.m1.tl-hd, .m1.tl-cell, .m1.tl-fc, .m1.tl-sc { border-left: 2px solid var(--line-strong); }
.today.tl-cell { box-shadow: inset 2px 0 0 var(--accent); }

.tl-ferien .tl-name { height: 16px; }
.tl-fc { height: 16px; border-left: 1px solid var(--line); }
.tl-fc.on.f-BB { background: var(--bb-cell); }
.tl-fc.on.f-MV { background: var(--mv-cell); }

.tl-person .tl-name { cursor: pointer; }
.tl-person .tl-name:hover .nm { color: var(--accent); }
.tl-person .nm { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-person .rest {
    font-size: 11.5px; font-weight: 700; color: var(--muted);
    background: var(--surface-3); border-radius: 10px; padding: 1px 8px;
}
.tl-person .rest.neg { background: var(--hol-bg); color: var(--danger); }
.tl-cells {
    grid-column: 1 / -1;
    display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr));
    min-height: calc(var(--lanes) * var(--lane) + 14px);
}
.tl-cell { border-left: 1px solid var(--line); cursor: pointer; }
.tl-cell:hover { background: var(--cell-hover); }
.tl-cell.sel, .tl-cell.sel:hover { background: var(--sel); box-shadow: inset 0 0 0 1px var(--sel-line); }
.tl-person .bars { left: 0; right: 0; top: 7px; }
.tl-person .bar { padding: 0 6px; }

.tl-sum, .tl-sum .tl-name { background: var(--surface-2); }
.tl-sc {
    height: 32px; display: flex; align-items: center; justify-content: center;
    border-left: 1px solid var(--line); font-size: 11.5px; font-weight: 700; color: var(--ok-text);
}
.tl-sc.has { background: rgba(var(--ok-rgb), calc(.1 + var(--a) * .4)); }
.tl-sc.all { background: var(--ok); color: #fff; font-size: 10px; }

.empty { text-align: center; color: var(--muted); padding: 56px 20px; }
.empty i { font-size: 34px; display: block; margin-bottom: 6px; }
.empty p { margin: 0 0 14px; }

/* ---------- Jahresansicht ---------- */
.year-view {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px; user-select: none;
}
.ym { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 12px; box-shadow: var(--shadow); }
.ym-title { border: 0; background: none; font-weight: 700; font-size: 14px; padding: 2px 4px 6px; cursor: pointer; }
.ym-title:hover { color: var(--accent); }
.ym-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.ym-wd { font-size: 10.5px; color: var(--muted); text-align: center; padding: 2px 0 4px; font-weight: 600; }
.ym-wd.we { color: var(--faint); }
.ym-day {
    position: relative; height: 34px; border-radius: 5px;
    display: flex; flex-direction: column; align-items: center; padding-top: 3px;
    font-size: 12px; cursor: pointer;
}
.ym-day .n { line-height: 17px; padding: 0 5px; border-radius: 9px; }
.ym-day.we { background: var(--we-bg); color: var(--muted); }
.ym-day.hol { background: var(--hol-bg); color: var(--hol); font-weight: 600; }
.ym-day.today .n { background: var(--btn); color: #fff; }
.ym-day:hover { background: var(--cell-hover); }
.ym-day.sel, .ym-day.sel:hover { background: var(--sel); box-shadow: inset 0 0 0 1px var(--sel-line); }
.ym-day .dots { display: flex; gap: 2px; margin-top: 2px; }
.ym-day .dots b { width: 6px; height: 6px; border-radius: 50%; }
.ym-day .fl { position: absolute; left: 3px; right: 3px; height: 2px; border-radius: 1px; }
.ym-day .fl.f-BB { bottom: 2px; background: var(--bb); }
.ym-day .fl.f-MV { bottom: 5px; background: var(--mv); }

/* ---------- Modals ---------- */
.modal {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: flex-start; justify-content: center;
    padding: 6vh 16px 16px; overflow-y: auto;
    background: var(--backdrop);
    opacity: 0; visibility: hidden; transition: opacity .15s, visibility .15s;
}
.modal.open { opacity: 1; visibility: visible; }
.modal-card {
    width: 100%; max-width: 560px; background: var(--surface);
    border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
    transform: translateY(8px) scale(.99); transition: transform .15s;
}
.modal.open .modal-card { transform: none; }
.modal-card.narrow { max-width: 460px; }

.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 6px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-sub { margin: 3px 0 0; color: var(--accent); font-weight: 600; font-size: 13px; }
.modal-body { padding: 10px 20px 6px; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 14px 20px 18px; }
.spacer { flex: 1; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field-row { display: flex; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.w-days { width: 150px; }

input[type="text"], input[type="number"], input[type="date"] {
    height: 36px; padding: 0 10px; width: 100%;
    border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface-2);
    outline: none; transition: border-color .12s, box-shadow .12s;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--hol-bg); }

.radio-row { display: flex; gap: 16px; flex-wrap: wrap; }
.radio { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; }
.radio input { accent-color: var(--btn); margin: 0; }

.person-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    display: inline-flex; align-items: center; gap: 7px;
    height: 34px; padding: 0 12px; border-radius: 17px;
    border: 1px solid var(--line-strong); background: var(--surface-2); cursor: pointer;
    transition: background .12s, border-color .12s, box-shadow .12s;
}
.chip:hover { background: var(--surface-3); }
.chip-name { font-weight: 600; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip small { color: var(--muted); font-size: 11.5px; }
.chip.selected {
    border-color: var(--pc); background: color-mix(in srgb, var(--pc) 16%, var(--surface));
    box-shadow: 0 0 0 1px var(--pc);
}
.chip-new { color: var(--accent); font-weight: 600; border-style: dashed; }
.chip-new.selected { --pc: var(--accent); }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

.new-person {
    margin-top: 10px; padding: 12px 12px 0; border-radius: var(--radius);
    background: var(--surface-2); border: 1px solid var(--line);
}
.new-person input { background: var(--surface); }

.summary {
    background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
    padding: 12px 14px; display: flex; flex-direction: column; gap: 12px; margin-bottom: 6px;
}
.sum-main { display: flex; align-items: center; gap: 12px; }
.sum-big { font-size: 30px; font-weight: 700; color: var(--accent); line-height: 1; min-width: 38px; text-align: center; }
.sum-text { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }

.quota-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; margin-bottom: 6px; flex-wrap: wrap; }
.quota-head .neg { color: var(--danger); font-weight: 700; }
.quota-bar { display: flex; height: 10px; border-radius: 5px; background: var(--track); overflow: hidden; }
.quota-bar i { display: block; height: 100%; }
.q-used { background: var(--q-used); }
.q-this {
    background: repeating-linear-gradient(-45deg, var(--pc), var(--pc) 4px,
        color-mix(in srgb, var(--pc) 65%, transparent) 4px, color-mix(in srgb, var(--pc) 65%, transparent) 8px);
}
.q-this.over { --pc: var(--danger) !important; }
.quota-legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.quota-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

.together { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12.5px; }
.tag {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 9px 2px 8px; border-radius: 11px; font-weight: 600; font-size: 12px;
    background: color-mix(in srgb, var(--pc) 16%, var(--surface)); border: 0; border-left: 3px solid var(--pc);
}
.tag small { color: var(--muted); font-weight: 400; }
.ferien-note { font-size: 12px; color: var(--muted); }
.ferien-note i { color: var(--muted); margin-right: 3px; }

.msg { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; padding: 8px 10px; border-radius: 6px; }
.msg.warn { background: var(--warn-bg); color: var(--warn-text); }
.msg.err { background: var(--hol-bg); color: var(--danger); font-weight: 600; }

.color-row { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch-btn { width: 28px; height: 28px; border-radius: 50%; border: 0; cursor: pointer; }
.swatch-btn.selected { box-shadow: 0 0 0 2px var(--ring), 0 0 0 4px var(--text); }
.form-error { color: var(--danger); font-size: 13px; font-weight: 600; margin: 0 0 8px; }

/* ---------- Toast ---------- */
.toast {
    position: fixed; left: 50%; bottom: 24px; z-index: 200;
    transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
    background: var(--toast-bg); color: var(--toast-text); padding: 10px 18px; border-radius: 8px;
    font-weight: 600; box-shadow: var(--shadow-lg); transition: opacity .2s, transform .2s;
}
.toast.error { background: var(--danger); color: #fff; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 1350px) {
    .mv-head .long { display: none; }
    .mv-head .short { display: inline; }
}
@media (max-width: 1100px) {
    .layout, .layout.no-sidebar, .layout.no-overview, .layout.no-sidebar.no-overview { grid-template-columns: 0 minmax(0, 1fr) 0; }
    .sidebar, .overview { position: fixed; top: 56px; bottom: 0; z-index: 30; box-shadow: var(--shadow-lg); }
    .sidebar { left: 0; width: 260px; }
    .overview { right: 0; width: 330px; }
    .brand span, .segmented span, #btn-new-vacation span { display: none; }
    .topbar-left { min-width: 0; }
}
@media (max-width: 640px) {
    .brand, .period-sub { display: none; }
    .period-title { font-size: 15px; }
    .field-row { flex-direction: column; gap: 0; }
    .w-days { width: 100%; }
}

/* ---------- Datumsfeld TT.MM.JJJJ + Datumswähler ---------- */
.datefield { position: relative; }
.datefield input { padding-right: 38px; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.df-btn {
    position: absolute; right: 3px; top: 3px; width: 30px; height: 30px;
    border: 0; background: none; border-radius: 5px; cursor: pointer; color: var(--muted);
}
.df-btn:hover { background: var(--surface-3); color: var(--text); }
.dp {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; width: 272px;
    background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px;
    box-shadow: var(--shadow-lg); padding: 8px; user-select: none;
}
.field-row .field.grow:last-child .dp { left: auto; right: 0; }
.dp-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: 13px; padding: 0 2px 6px; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-wd { font-size: 10.5px; text-align: center; color: var(--muted); font-weight: 600; padding: 2px 0 4px; }
.dp-day {
    height: 32px; border: 0; background: none; border-radius: 6px; cursor: pointer;
    font-size: 12.5px; color: var(--text-2);
}
.dp-day:hover { background: var(--surface-3); }
.dp-day.out { color: var(--faint); }
.dp-day.we { color: var(--muted); }
.dp-day.hol { color: var(--hol); }
.dp-day.inrange { background: var(--accent-soft); color: var(--text); border-radius: 0; }
.dp-day.today { box-shadow: inset 0 0 0 1px var(--accent); }
.dp-day.selected { background: var(--btn); color: #fff; font-weight: 700; border-radius: 6px; }
.dp-foot { display: flex; justify-content: flex-end; padding-top: 6px; }

/* ---------- Tutorial ---------- */
.tour { position: fixed; inset: 0; z-index: 300; }
.tour-spot {
    position: fixed; pointer-events: none;
    box-shadow: 0 0 0 200vmax rgba(5, 7, 10, .68), 0 0 0 2px var(--accent) inset;
    transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease, border-radius .25s;
}
.tour-spot.none { box-shadow: 0 0 0 200vmax rgba(5, 7, 10, .68); }
[data-theme="light"] .tour-spot { box-shadow: 0 0 0 200vmax rgba(17, 24, 39, .5), 0 0 0 2px var(--accent) inset; }
[data-theme="light"] .tour-spot.none { box-shadow: 0 0 0 200vmax rgba(17, 24, 39, .5); }
.tour-card {
    position: fixed; width: min(380px, calc(100vw - 28px));
    background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px;
    box-shadow: var(--shadow-lg); padding: 16px 18px 14px;
    transition: left .25s ease, top .25s ease;
    animation: tourIn .2s ease-out;
}
@keyframes tourIn { from { opacity: 0; transform: translateY(6px); } }
.tour-step { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.tour-card h3 { margin: 0 0 6px; font-size: 17px; }
.tour-text { font-size: 13.5px; line-height: 1.55; color: var(--text-2); }
.tour-text b { color: var(--text); }
.tour-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.tour-dots { flex: 1; display: flex; justify-content: center; gap: 5px; }
.tour-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
.tour-dots i.on { background: var(--accent); width: 16px; border-radius: 3px; }
.btn-link { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12.5px; padding: 0; }
.btn-link:hover { color: var(--text); text-decoration: underline; }

/* kleine Animation: Tage markieren */
.tour-demo {
    position: relative; display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px;
    margin-top: 12px; padding: 8px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line);
}
.tour-demo span {
    height: 30px; border-radius: 4px; display: flex; align-items: flex-start; justify-content: flex-start;
    padding: 3px 5px; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface-3);
}
.tour-demo .d1, .tour-demo .d2, .tour-demo .d3, .tour-demo .d4 { animation: demoSel 3.2s infinite; }
.tour-demo .d2 { animation-delay: .25s; }
.tour-demo .d3 { animation-delay: .5s; }
.tour-demo .d4 { animation-delay: .75s; }
@keyframes demoSel {
    0%, 8% { background: var(--surface-3); box-shadow: none; color: var(--muted); }
    14%, 80% { background: var(--sel); box-shadow: inset 0 0 0 1px var(--sel-line); color: var(--text); }
    90%, 100% { background: var(--surface-3); box-shadow: none; color: var(--muted); }
}
.tour-cursor {
    position: absolute; top: 22px; left: calc(8px + (100% - 16px) / 7 * 1.5);
    font-size: 16px; color: var(--text); filter: drop-shadow(0 1px 2px rgba(0,0,0,.5));
    animation: demoCursor 3.2s infinite;
}
@keyframes demoCursor {
    0%, 6% { transform: translateX(0); opacity: 0; }
    10% { opacity: 1; }
    40%, 80% { transform: translateX(calc((272px) / 7 * 3)); opacity: 1; }
    92%, 100% { transform: translateX(calc((272px) / 7 * 3)); opacity: 0; }
}
