:root {
  color-scheme: light dark;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --border: #e1e4e9;
  --border-strong: #c9ced6;
  --text: #1b1f27;
  --muted: #5f6775;
  --faint: #8d95a3;
  --accent: #2563eb;
  --accent-hover: #1d4fd7;
  --accent-soft: #e3ecfd;
  --on-accent: #ffffff;
  --red: #c92a2a;
  --red-soft: #fdeaea;
  --amber: #995800;
  --amber-soft: #fcf0db;
  --green: #23854f;
  --gray-soft: #eceef2;
  --prio-high: #e03131;
  --prio-medium: #e8930c;
  --prio-low: #a3abb8;
  --proj-bg: 75% 94%;
  --proj-fg: 50% 30%;
  --proj-bd: 55% 84%;
  --shadow-sm: 0 1px 2px rgb(16 24 40 / .05);
  --shadow-md: 0 2px 8px rgb(16 24 40 / .08), 0 1px 2px rgb(16 24 40 / .05);
  --shadow-lg: 0 20px 50px rgb(16 24 40 / .22);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f6775' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1014;
    --surface: #171a20;
    --surface-2: #1f232b;
    --border: #2a2f38;
    --border-strong: #3a414d;
    --text: #e6e8ec;
    --muted: #a0a8b5;
    --faint: #6f7785;
    --accent: #6b9bff;
    --accent-hover: #8bb0ff;
    --accent-soft: #1b2944;
    --on-accent: #0a1020;
    --red: #ff7070;
    --red-soft: #3b1d21;
    --amber: #f2a93b;
    --amber-soft: #3a2b12;
    --green: #4cc38a;
    --gray-soft: #262a33;
    --prio-high: #ff6b6b;
    --prio-medium: #f2a93b;
    --prio-low: #6f7785;
    --proj-bg: 35% 19%;
    --proj-fg: 70% 78%;
    --proj-bd: 35% 29%;
    --shadow-sm: none;
    --shadow-md: 0 2px 10px rgb(0 0 0 / .35);
    --shadow-lg: 0 20px 60px rgb(0 0 0 / .6);
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a0a8b5' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230e1014' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }   /* Platz für den Scrollbalken immer freihalten – sonst springt die Seite */
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.app { max-width: 1240px; margin: 0 auto; padding: 32px 16px 40px; }   /* eine Breite für alle Reiter */

/* Kopfbereich */
.top { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 20px; }
.titles { flex: 1; min-width: 0; }
.eyebrow { margin: 0 0 2px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
h1 { margin: 0; font-size: 28px; line-height: 1.15; letter-spacing: -.02em; }
.stats { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.stats .warn { color: var(--red); font-weight: 600; }
.stats .hl { color: var(--accent); font-weight: 600; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); font-weight: 500; white-space: nowrap; cursor: pointer; transition: background-color .15s, border-color .15s, color .15s; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: transparent; border-color: transparent; color: var(--red); }
.btn.danger:hover { background: var(--red-soft); }
.btn.icon-only { width: 36px; padding: 0; }
.btn.small { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.small.icon-only { width: 28px; padding: 0; }
.link { padding: 0; border: 0; background: none; color: var(--accent); cursor: pointer; font-size: inherit; }
.link:hover { text-decoration: underline; }
#notifBtn[data-state="default"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
#notifBtn[data-state="granted"] { color: var(--muted); }
#notifBtn[data-state="denied"] { color: var(--red); }

/* Werkzeugleiste */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.search { position: relative; flex: 1 1 220px; }
.search .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.control { height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 8px; background-color: var(--surface); }
.search .control { width: 100%; padding-left: 34px; }
select { appearance: none; -webkit-appearance: none; padding-right: 30px !important; background-image: var(--chevron); background-repeat: no-repeat; background-position: right 10px center; background-size: 12px; cursor: pointer; }
.control:focus, .field :is(input, textarea, select):focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.seg { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.seg button { height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 500; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }

/* Liste */
.group { margin-bottom: 22px; }
.group-title { display: flex; align-items: center; gap: 8px; margin: 0 0 8px 2px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.g-overdue .group-title { color: var(--red); }
.g-today .group-title { color: var(--accent); }
.group-title .count { font-weight: 500; color: var(--faint); }
.group-title .link { margin-left: auto; font-size: 13px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.items { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; }
.item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.item.flash { animation: flash 1.4s ease-out; }
@keyframes flash { from { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); } }
.check { --pc: var(--prio-medium); appearance: none; -webkit-appearance: none; flex: none; width: 20px; height: 20px; margin: 1px 0 0; border: 2px solid var(--pc); border-radius: 50%; background: transparent; cursor: pointer; transition: background-color .15s; }
.check:hover { background-color: color-mix(in srgb, var(--pc) 16%, transparent); }
.check:checked { background: var(--pc) var(--check) center / 12px no-repeat; }
.prio-high .check { --pc: var(--prio-high); }
.prio-low .check { --pc: var(--prio-low); }
.item.done .check { --pc: var(--green); }
.main { flex: 1; min-width: 0; cursor: pointer; }
.row1 { display: flex; align-items: baseline; gap: 12px; }
.title { flex: 1; min-width: 0; margin: 0; padding: 0; border: 0; background: none; font-weight: 600; line-height: 1.4; text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.title:hover { color: var(--accent); }
.due { flex: none; font-size: 13px; color: var(--muted); white-space: nowrap; }
.due.overdue { color: var(--red); font-weight: 600; }
.due.today { color: var(--accent); font-weight: 600; }
.group-title .dot { width: 8px; height: 8px; border-radius: 50%; background: hsl(var(--h) 60% 50%); }
.g-project .group-title { color: var(--text); font-size: 13px; letter-spacing: .02em; text-transform: none; }
.desc { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; margin: 3px 0 0; color: var(--muted); font-size: 14px; white-space: pre-line; overflow-wrap: anywhere; }
.desc a { color: var(--accent); }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pill, .chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border: 1px solid transparent; border-radius: 999px; font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap; text-decoration: none; }
.pill.prio-high { background: var(--red-soft); color: var(--red); }
.pill.prio-medium { background: var(--amber-soft); color: var(--amber); }
.pill.prio-low { background: var(--gray-soft); color: var(--muted); }
.chip { border-color: var(--border); background: var(--surface-2); color: var(--muted); }
.chip .ic { width: 13px; height: 13px; }
a.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.project { border-color: hsl(var(--h) var(--proj-bd)); background: hsl(var(--h) var(--proj-bg)); color: hsl(var(--h) var(--proj-fg)); cursor: pointer; }
.chip.project:hover { filter: brightness(.97) saturate(1.2); }
.chip.remind.past { opacity: .6; }
.item.done { background: transparent; box-shadow: none; }
.item.done .title { color: var(--muted); font-weight: 500; text-decoration: line-through; text-decoration-color: var(--faint); }
.item.done .meta { opacity: .75; }
.empty { padding: 56px 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--muted); text-align: center; }
.empty p { margin: 0; }
.empty .empty-title { margin-bottom: 4px; color: var(--text); font-size: 16px; font-weight: 600; }
.start { padding: 28px 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.start p { margin: 0 0 10px; }
.start .empty-title { margin-bottom: 8px; font-size: 16px; font-weight: 600; }
.start pre { margin: 0 0 12px; padding: 10px 12px; overflow-x: auto; border-radius: 8px; background: var(--surface-2); font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.start .note { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 14px; }
.blocked :is(.tabs, .toolbar, #calendar, #newBtn, #notifBtn, #stats, .foot) { display: none !important; }
.sync-banner { margin: 0 0 16px; padding: 10px 14px; border-radius: var(--radius); background: var(--red-soft); color: var(--red); font-size: 14px; font-weight: 500; }

/* Reiter + Kalender */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tabs button { margin-bottom: -1px; padding: 8px 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-weight: 600; cursor: pointer; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--text); }
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-head h2 { margin: 0 0 0 6px; font-size: 16px; }
.cal-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.cal { display: grid; grid-template-columns: 64px repeat(7, minmax(110px, 1fr)); }
.span-3 .cal { grid-template-columns: 64px repeat(3, minmax(0, 1fr)); }
.cal-top, .cal-body { min-width: 834px; overflow-y: hidden; scrollbar-gutter: stable; }   /* gleiche Spaltenbreiten oben und unten */
.span-3 :is(.cal-top, .cal-body) { min-width: 0; }
.cal-top { border-bottom: 1px solid var(--border-strong); }
.cal-body { overflow-y: auto; overscroll-behavior: contain; }
.range-work .cal-body { height: calc(10 * var(--hour) + 24px); max-height: 72vh; }   /* 08:00–18:00 samt Beschriftungen */
.cal-ev.mid strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cal-range { margin-left: auto; }
.range-fixed .cal-body, .range-full .cal-body { overflow-y: hidden; }
.cal-times span.first { transform: translateY(2px); }
.cal-times span.last { transform: translateY(calc(-100% - 2px)); }
.cal-more { position: absolute; left: 4px; right: 4px; z-index: 2; padding: 1px 6px; border: 1px dashed var(--border-strong); border-radius: 6px;
  background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--muted); font-size: 11.5px; text-align: left; cursor: pointer; }
.cal-more:hover { color: var(--accent); border-color: var(--accent); }
.cal-more.top { top: 2px; }
.cal-more.bottom { bottom: 2px; }
.cal-corner, .cal-label { padding: 6px; border-bottom: 1px solid var(--border); color: var(--faint); font-size: 11px; text-align: right; }
.cal-corner { align-self: stretch; padding-top: 14px; }
.cal-dayhead { padding: 6px; border-left: 1px solid var(--border); border-bottom: 1px solid var(--border); color: var(--muted); font-size: 12px; text-align: center; }
.cal-dayhead strong { display: block; color: var(--text); font-size: 18px; line-height: 1.2; }
.cal-dayhead.today strong { color: var(--accent); }
.cal-dayhead small { display: block; overflow: hidden; color: var(--red); font-size: 10px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
:is(.cal-day, .cal-allday, .cal-dayhead).holiday { background-color: color-mix(in srgb, var(--red) 6%, transparent); }
.cal-allday { display: flex; flex-direction: column; gap: 3px; min-height: 34px; padding: 4px; border-left: 1px solid var(--border); border-bottom: 1px solid var(--border); cursor: copy; }
.cal-allday:hover { background: var(--surface-2); }
.cal-ev, .cal-chip { --pc: var(--prio-medium); border: 0; border-left: 3px solid var(--pc); background: color-mix(in srgb, var(--pc) 15%, var(--surface)); color: var(--text); font-size: 12px; text-align: left; cursor: pointer; }
:is(.cal-ev, .cal-chip).prio-high { --pc: var(--prio-high); }
:is(.cal-ev, .cal-chip).prio-low { --pc: var(--prio-low); }
:is(.cal-ev, .cal-chip).no-ticket { --pc: var(--faint); background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--faint) 16%, var(--surface)) 0 6px, var(--surface) 6px 12px); }
:is(.cal-ev, .cal-chip).done { opacity: .55; text-decoration: line-through; }
.cal-chip { display: block; width: 100%; padding: 2px 6px; overflow: hidden; border-radius: 4px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.cal-times { position: relative; }
.cal-times span { position: absolute; right: 6px; transform: translateY(-50%); color: var(--faint); font-size: 11px; }
.cal-day { position: relative; border-left: 1px solid var(--border); background-image: repeating-linear-gradient(to bottom, var(--border) 0 1px, transparent 1px 48px); cursor: crosshair; user-select: none; }
.cal-day.today { background-color: color-mix(in srgb, var(--accent) 5%, transparent); }
.cal-ev { position: absolute; overflow: hidden; padding: 3px 6px; border-radius: 6px; line-height: 1.3; box-shadow: var(--shadow-sm); }
.cal-ev strong { display: block; overflow: hidden; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.cal-ev span { color: var(--muted); }
.cal-ev.flash { animation: flash 1.4s ease-out; }
.cal-ev, .cal-chip { touch-action: none; }
.cal-ev { cursor: grab; }
.cal-chip { cursor: grab; }
.cal-ev.dragging, .cal-chip.dragging { opacity: .35; }
.cal-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; cursor: ns-resize; }
.cal-ev:hover .cal-resize { background: linear-gradient(to bottom, transparent 3px, color-mix(in srgb, var(--pc) 70%, transparent) 3px 5px, transparent 5px); }
.cal-allday.drop { outline: 2px dashed var(--accent); outline-offset: -3px; background: var(--accent-soft); }
.cal-ghost { position: absolute; left: 2px; right: 2px; padding: 3px 6px; border: 1px dashed var(--accent); border-radius: 6px; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); font-size: 12px; font-weight: 600; pointer-events: none; }
.cal-now { position: absolute; left: 0; right: 0; z-index: 1; height: 2px; background: var(--red); pointer-events: none; }
.cal-hint { margin: 8px 2px 0; color: var(--faint); font-size: 13px; }

/* Zeiterfassung + Pomodoro */
.timer-btn { display: inline-flex; flex: none; align-items: center; gap: 4px; height: 26px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; cursor: pointer; }
.timer-btn:hover { border-color: var(--accent); color: var(--accent); }
.timer-btn .ic { width: 12px; height: 12px; }
.timer-btn.running { border-color: var(--green); background: color-mix(in srgb, var(--green) 14%, var(--surface)); color: var(--green); font-weight: 600; }
.timer-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: -6px 0 16px; padding: 8px 12px; border: 1px solid color-mix(in srgb, var(--green) 40%, var(--border)); border-radius: var(--radius); background: color-mix(in srgb, var(--green) 8%, var(--surface)); font-size: 14px; }
.timer-bar .spacer { flex: 1; }
.timer-bar.idle { border-color: var(--border); background: var(--surface); color: var(--muted); }
.timer-bar.unplanned { border-color: color-mix(in srgb, var(--prio-medium) 50%, var(--border)); background: color-mix(in srgb, var(--prio-medium) 10%, var(--surface)); }
.tb-topic { flex-basis: 140px; max-width: 200px; }
.tb-ticket { flex-basis: 130px; max-width: 170px; }
.catalog-rows { display: grid; gap: 8px; }
.catalog-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 8px; align-items: center; }
.catalog-row input { height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); }
.tticket { margin-right: 8px; vertical-align: middle; }
.tb-name { flex: 1 1 180px; min-width: 140px; max-width: 320px; height: 28px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); }
.times-group h3.unplanned { color: var(--amber); }
.tb-task { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.tb-task strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tb-clock { font-variant-numeric: tabular-nums; font-weight: 600; }
.tb-pomo.break { color: var(--green); }
.tb-pomo.ready { color: var(--accent); font-weight: 600; }
#pomoBtn.active { border-color: var(--red); background: var(--red-soft); }
.foot input[type="number"] { width: 56px; height: 26px; padding: 0 6px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); font-size: 12px; }
.times-total { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.week-strip { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; margin-bottom: 20px; }
.wday { display: grid; gap: 2px; padding: 8px 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); text-align: center; cursor: pointer; }
.wday small { color: var(--muted); font-size: 12px; }
.wday strong { font-size: 13px; font-variant-numeric: tabular-nums; }
.wday.today small { color: var(--accent); font-weight: 600; }
.wday.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.wday.week-sum { background: var(--surface-2); cursor: default; }
.times-group { margin-bottom: 18px; }
.times-group h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px 2px; font-size: 14px; }
.times-group h3 .dot { width: 8px; height: 8px; border-radius: 50%; background: hsl(var(--h) 60% 50%); }
.times-group h3 .count { margin-left: auto; font-variant-numeric: tabular-nums; }
.times-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.times-list li { display: grid; grid-template-columns: minmax(0, 2fr) minmax(60px, 1.5fr) auto auto auto; align-items: center; gap: 12px; padding: 8px 8px 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.tname { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tname small { color: var(--muted); }
.tbar { height: 8px; overflow: hidden; border-radius: 4px; background: var(--surface-2); }
.tbar span { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.tdur { font-variant-numeric: tabular-nums; font-weight: 600; }
@media (max-width: 560px) {
  .week-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .times-list li { grid-template-columns: minmax(0, 1fr) auto auto auto; }
  .tbar { display: none; }
}

/* Lesbarkeit im Kalender */
/* Beim Wechsel der Reiter bleibt alles an seinem Platz: Seite gleich breit, nur der Kalender tritt breiter hervor */
body:not(.view-list) #groupBy, .view-time .toolbar .seg { visibility: hidden; }
.cal-dayhead { font-size: 13px; }
.cal-dayhead strong { font-size: 20px; }
.cal-times span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.cal-day { background-image: repeating-linear-gradient(to bottom, var(--border) 0 1px, transparent 1px var(--hour)),
  repeating-linear-gradient(to bottom, transparent 0 calc(var(--hour) / 2), color-mix(in srgb, var(--border) 55%, transparent) calc(var(--hour) / 2) calc(var(--hour) / 2 + 1px), transparent calc(var(--hour) / 2 + 1px) var(--hour)); }
.range-full .cal-day { background-image: repeating-linear-gradient(to bottom, var(--border) 0 1px, transparent 1px var(--hour)); }
.cal-ev { padding: 4px 6px 4px 7px; border-left-width: 4px; background: color-mix(in srgb, var(--pc) 22%, var(--surface)); font-size: 13px; line-height: 1.25; }
.cal-ev strong { white-space: normal; text-overflow: clip; overflow-wrap: break-word; hyphens: auto; }
.cal-ev.narrow { padding: 3px 4px 3px 5px; font-size: 12px; }
.cal-ev.narrow .cal-time { font-size: 11px; }
.cal-ev .cal-time { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.cal-ev.short { display: flex; align-items: center; gap: 6px; padding-top: 0; padding-bottom: 0; }
.cal-ev.short .cal-time { flex: none; margin: 0; color: var(--text); font-weight: 600; }
.cal-ev.short strong { min-width: 0; overflow: hidden; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; }
.cal-chip { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; padding: 0 6px; border-left-width: 4px;
  border-top: 3px solid transparent; border-bottom: 3px solid transparent;   /* statt Innenabstand: dort wird die 3. Zeile sauber abgeschnitten */
  background: color-mix(in srgb, var(--pc) 22%, var(--surface)); font-size: 12.5px; line-height: 1.25; white-space: normal; overflow-wrap: break-word; hyphens: auto; }
:is(.cal-ev, .cal-chip).no-ticket { background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--faint) 18%, var(--surface)) 0 6px, var(--surface) 6px 12px); }

/* Fußzeile */
.foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--faint); font-size: 13px; }
.foot .link { color: var(--muted); }
.foot .afternoon { display: inline-flex; align-items: center; gap: 6px; }
.foot .afternoon input { height: 26px; padding: 0 6px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); font-size: 12px; }
.foot .afternoon .jira-input { width: 230px; }
.check-row { display: flex; align-items: flex-start; gap: 8px; color: var(--muted); font-size: 13px; cursor: pointer; }
.check-row input { flex: none; width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--accent); }
.check-row:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.field .quick { justify-self: start; font-size: 13px; }
.foot .path { color: var(--muted); font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.foot .keys { margin-left: auto; }
kbd { padding: 1px 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); }

/* Dialog */
dialog { width: min(600px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; overflow: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgb(10 14 20 / .45); }
.dlg-head { display: flex; align-items: center; gap: 8px; padding: 16px 16px 4px 20px; }
.dlg-head h2 { flex: 1; margin: 0; font-size: 18px; }
.dlg-body { display: grid; gap: 14px; padding: 10px 20px 6px; }
.dlg-foot { display: flex; align-items: center; gap: 8px; padding: 16px 20px 20px; }
.dlg-foot .spacer { flex: 1; }
.field { display: grid; align-content: start; gap: 6px; min-width: 0; }
.field > span, .field > label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 8px; background-color: var(--surface); }
.field textarea { height: auto; min-height: 92px; padding: 8px 10px; line-height: 1.45; resize: vertical; }
.field :disabled { opacity: .5; cursor: not-allowed; }
.field [aria-invalid="true"] { border-color: var(--red); }
.req { color: var(--red); font-weight: 600; }
.hint, .error { font-size: 12.5px; }
.hint { color: var(--faint); }
.error { color: var(--red); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.remind-row { display: flex; gap: 8px; }
.remind-row select { flex: 1; min-width: 0; }
.remind-row input { flex: none; width: 108px; }

/* Hinweise (Toasts) */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 10; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 14px; border-radius: 10px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 14px; pointer-events: auto; animation: toast-in .18s ease-out; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .18s, transform .18s; pointer-events: none; }
.toast-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-sub { opacity: .75; font-size: 13px; }
.toast .btn { border-color: color-mix(in srgb, currentColor 35%, transparent); background: transparent; color: inherit; }
.toast .btn:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
.toast .btn.ghost { border-color: transparent; font-size: 18px; }
.toast.remind { border: 1px solid var(--border); border-left: 4px solid var(--prio-medium); background: var(--surface); color: var(--text); }
.toast.remind > .ic { color: var(--prio-medium); }
.toast.error { background: var(--red); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 560px) {
  .app { padding-top: 20px; }
  h1 { font-size: 24px; }
  .top { flex-wrap: wrap; gap: 12px 8px; }
  .titles { flex-basis: 100%; }
  #newBtn { flex: 1; }
  .search { flex-basis: 100%; }
  .toolbar select { flex: 1 1 0; min-width: 0; }
  .seg button { padding: 0 10px; }
  .grid2 { grid-template-columns: 1fr; }
  #notifBtn .label { display: none; }
  #notifBtn { width: 36px; padding: 0; }
  .foot .keys { display: none; }
  .toasts { right: 16px; left: 16px; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { animation: none !important; transition: none !important; }
}

/* ===== Server-Variante: Handy (Notch/Home-Balken), Konto ===== */
.app { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); padding-bottom: max(40px, env(safe-area-inset-bottom)); }
.toasts { bottom: max(16px, env(safe-area-inset-bottom)); }
.account section { display: grid; gap: 10px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.account section:last-child { border-bottom: 0; }
.account h3 { margin: 0; font-size: 14px; }
.account p { margin: 0; color: var(--muted); font-size: 13px; }
.account ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.account li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.account li .grow { flex: 1; min-width: 0; }
.account li small { display: block; color: var(--faint); }
.account form { display: grid; gap: 8px; }
.account input:not([type="checkbox"]) { height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); }
.account .row { display: flex; flex-wrap: wrap; gap: 8px; }
.hint-box { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--accent-soft); color: var(--text); font-size: 14px; }
.login-wrap { display: grid; place-items: center; min-height: 100vh; padding: 24px 16px; }
.login-card { width: min(400px, 100%); padding: 28px 24px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-md); }
.login-card h1 { margin-bottom: 4px; }
.login-card > p { margin: 0 0 20px; color: var(--muted); }
.login-card form { display: grid; gap: 12px; }
.login-card .btn { width: 100%; height: 42px; }
.login-card .or { margin: 16px 0; color: var(--faint); font-size: 13px; text-align: center; }
.login-card .error { margin: 12px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--red-soft); }

/* ===== Server-Variante: Desktop, Tablet, Handy ===== */
/* Dialoge: Kopf und Knöpfe bleiben beim Scrollen sichtbar */
dialog > form, dialog { overscroll-behavior: contain; }
.dlg-head { position: sticky; top: 0; z-index: 2; background: var(--surface); }
.dlg-foot { position: sticky; bottom: 0; z-index: 2; margin-top: 10px; border-top: 1px solid var(--border); background: var(--surface); }
/* Tablet / schmale Fenster: die Woche passt ohne seitliches Scrollen */
@media (max-width: 1000px) {
  .cal { grid-template-columns: 52px repeat(7, minmax(0, 1fr)); }
  .cal-top, .cal-body { min-width: 0; }
  .cal-dayhead strong { font-size: 16px; }
  .cal-corner, .cal-label { padding: 4px 3px; font-size: 10px; }
}
/* Touch: größere Trefferflächen */
@media (pointer: coarse) {
  .check { width: 24px; height: 24px; }
  .seg button { height: 34px; }
  .btn.small { height: 34px; }
  .btn.small.icon-only { width: 34px; }
}
/* Handy */
@media (max-width: 640px) {
  .app { padding-top: max(16px, env(safe-area-inset-top)); padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .top { flex-wrap: nowrap; align-items: flex-start; gap: 8px; margin-bottom: 14px; }
  .titles { flex: 1 1 auto; }
  .stats { font-size: 13px; }
  /* „Neue Aufgabe“ als schwebender Knopf unten rechts – mit dem Daumen erreichbar */
  #newBtn { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 9;
    flex: none; height: 52px; padding: 0 20px; border-radius: 26px; font-size: 16px; font-weight: 600; box-shadow: 0 6px 20px rgb(37 99 235 / .35), var(--shadow-lg); }
  .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .tabs { margin-bottom: 12px; }
  .tabs button { flex: 1; padding: 10px 8px; }
  /* Werkzeugleiste: Suche, dann Filter nebeneinander, darunter Offen/Erledigt/Alle über die volle Breite */
  .toolbar { gap: 8px; margin-bottom: 16px; }
  .toolbar select { flex: 1 1 140px; min-width: 0; }
  body:not(.view-list) #groupBy { display: none; }
  .toolbar .seg { flex: 1 1 100%; }
  .toolbar .seg button { flex: 1; }
  /* Eingaben mit 16 px, sonst zoomt iOS beim Antippen hinein */
  .control, .field input, .field select, .field textarea, .account input, .login-card input { font-size: 16px; }
  .field input, .field select { height: 44px; }
  .control { height: 42px; }
  /* Kalender-Kopf in zwei Zeilen */
  .cal-head { flex-wrap: wrap; row-gap: 10px; }
  .cal-head .btn { flex: none; height: 40px; }
  .cal-head .btn.icon-only { width: 40px; }
  .cal-head h2 { flex: 1 1 auto; margin-left: 4px; font-size: 15px; white-space: nowrap; }
  .cal-range { flex: 1 1 100%; margin-left: 0; }
  .cal-range button { flex: 1; }
  .cal-corner, .cal-label { padding: 4px; font-size: 10.5px; }
  .cal-chip { font-size: 12px; }
  .cal-hint { display: none; }
  /* Dialoge bildschirmfüllend, Knöpfe immer unten sichtbar */
  dialog { width: 100%; max-width: 100%; height: 100%; max-height: 100%; margin: 0; border: 0; border-radius: 0; }
  dialog > form { min-height: 100%; display: flex; flex-direction: column; }
  dialog > form > .dlg-body { flex: 1; align-content: start; }
  dialog[open]:not(:has(> form)) { display: flex; flex-direction: column; }
  dialog:not(:has(> form)) > .dlg-body { flex: 1; align-content: start; }
  .dlg-head { padding-top: max(14px, env(safe-area-inset-top)); }
  .dlg-foot { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .dlg-foot .btn { height: 44px; }
  .dlg-foot .btn.primary { flex: 1; }
  .foot { gap: 10px 16px; }
}
.foot .briefing { display: inline-flex; align-items: center; gap: 6px; }
.foot .briefing input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.foot .briefing input:disabled { opacity: .5; }
.sync-banner.offline { background: color-mix(in srgb, var(--prio-medium) 16%, var(--surface)); color: var(--text); }
/* Touch: im Kalender scrollt Wischen die Seite; Ziehen erst nach langem Drücken (siehe LONG_PRESS) */
@media (pointer: coarse) {
  .cal-ev, .cal-chip { touch-action: manipulation; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
  .cal-resize { touch-action: none; }
  .cal-day { cursor: default; }
  .cal-ev.dragging, .cal-chip.dragging { outline: 2px solid var(--accent); }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 500px) {
  .cal-hint { display: block; }
}
/* Touch: Der Kalender darf kein eigener Scroll-Bereich sein – sonst „fängt“ er das Wischen und die Seite bleibt stehen
   (overscroll-behavior: contain am inneren Bereich). overflow: clip schneidet ab, ohne einen Scroll-Bereich zu bilden. */
@media (pointer: coarse) {
  .cal-scroll, .cal-scroll .cal-top, .cal-scroll .cal-body { overflow: clip; overscroll-behavior: auto; scrollbar-gutter: auto; }
}
/* Handy hochkant: ganze Woche, kompakt */
@media (max-width: 640px) {
  .cal { grid-template-columns: 30px repeat(7, minmax(0, 1fr)); }
  .cal-corner, .cal-label { padding: 3px 1px; font-size: 9px; }
  .cal-label { font-size: 0; }
  .cal-label::after { content: 'ganzt.'; font-size: 8.5px; }
  .cal-corner { padding-top: 8px; }
  .cal-times span { font-size: 9px; }
  .cal-dayhead { padding: 4px 0; font-size: 10px; }
  .cal-dayhead strong { font-size: 14px; }
  .cal-dayhead small { font-size: 8px; }
  .cal-allday { padding: 2px; min-height: 28px; }
  .cal-chip { padding: 0 3px; border-left-width: 3px; font-size: 10px; line-height: 1.2; }
  .cal-ev { padding: 2px 3px 2px 4px; border-left-width: 3px; font-size: 10.5px; line-height: 1.2; }
  .cal-ev .cal-time, .cal-ev.narrow .cal-time { font-size: 9.5px; }
  .cal-ev.short { gap: 3px; }
  .cal-more { left: 1px; right: 1px; padding: 0 2px; font-size: 9.5px; }
}
/* Termine (nur Kalender): ruhig blau statt gestreift */
:is(.cal-ev, .cal-chip).no-ticket { --pc: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.kind-seg { display: flex; }
.kind-seg button { flex: 1; height: 32px; }
