/* Markenlook (#110): Lexend, Navy, Teal, Lime; Hell und Dunkel ueber [data-theme] auf <html>. */
@font-face { font-family: "Lexend"; font-weight: 100; font-style: normal; font-display: swap; src: url("/css/fonts/lexend-latin-100-normal.woff2") format("woff2"); }
@font-face { font-family: "Lexend"; font-weight: 300; font-style: normal; font-display: swap; src: url("/css/fonts/lexend-latin-300-normal.woff2") format("woff2"); }
@font-face { font-family: "Lexend"; font-weight: 400; font-style: normal; font-display: swap; src: url("/css/fonts/lexend-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Lexend"; font-weight: 500; font-style: normal; font-display: swap; src: url("/css/fonts/lexend-latin-500-normal.woff2") format("woff2"); }

:root {
  color-scheme: light;
  /* Markenfarben */
  --teal: #5AAFC8; --lime: #E4FF2A; --navy: #0E2535;
  --bg: #EEF2F4; --sheet: #FFFFFF; --sheet-2: #E6EBEE;
  --ink: #0E2535; --ink-2: #4B6171; --ink-3: #8696A2; --line: #DCE3E7;
  --teal-ink: #1B718C; --focus: #1B718C;
  --mark-a: #E4FF2A; --mark-b: #BFE3EE; --mark-c: #FFD0E4;
  --alert: #B00020;
  --shadow: 0 1px 0 rgba(14, 37, 53, .04), 0 14px 30px -18px rgba(14, 37, 53, .28);
  --r: 20px;
  --font: "Lexend", system-ui, sans-serif;
  /* Kategoriepunkte aus der CI-Palette (#114); das Wort bleibt neutral. Rand --dot-ring >= 3 : 1 auf --sheet und --bg */
  --cat-blue: #0D2535; --cat-teal: #59B1C8; --cat-green: #E6FF2C; --cat-purple: #3D525C;
  --cat-red: #BFE3EE; --cat-orange: #2E7F96; --cat-brown: #B1BABE; --cat-gray: #8B979D;
  --dot-ring: #6B7F8C;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08151F; --sheet: #0F2536; --sheet-2: #183349;
  --ink: #EDF3F6; --ink-2: #A6B9C5; --ink-3: #67808F; --line: #1C384D;
  --teal-ink: #6CC3DC; --focus: #6CC3DC;
  --mark-a: rgba(228, 255, 42, .34); --mark-b: rgba(90, 175, 200, .42); --mark-c: rgba(255, 140, 190, .38);
  --alert: #FF8A96;
  --shadow: 0 0 0 1px rgba(255, 255, 255, .03), 0 14px 30px -18px rgba(0, 0, 0, .6);
  --cat-blue: #9DB7C6; --cat-teal: #59B1C8; --cat-green: #E6FF2C; --cat-purple: #6F8793;
  --cat-red: #BFE3EE; --cat-orange: #2E7F96; --cat-brown: #B1BABE; --cat-gray: #8B979D;
  --dot-ring: #8AA0AE;
}

* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.45 var(--font); -webkit-tap-highlight-color: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
:where(button, input, textarea, select) { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--teal-ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
ul { list-style: none; margin: 0; padding: 0; }
.dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--ink-3)); box-shadow: 0 0 0 1px var(--dot-ring); }
[data-cat-color="blue"] { --c: var(--cat-blue); } [data-cat-color="teal"] { --c: var(--cat-teal); }
[data-cat-color="green"] { --c: var(--cat-green); } [data-cat-color="purple"] { --c: var(--cat-purple); }
[data-cat-color="red"] { --c: var(--cat-red); } [data-cat-color="orange"] { --c: var(--cat-orange); }
[data-cat-color="brown"] { --c: var(--cat-brown); } [data-cat-color="gray"] { --c: var(--cat-gray); }

/* Seite: mittig, max. 680 px; die Eingabezeile klebt unten */
.page { display: flex; flex-direction: column; max-width: 680px; min-height: 100vh; min-height: 100dvh; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px 0; }
.page > * { flex: none; }
.page > #composer { margin-top: auto; }

/* Kopf: Bildmarke links, Umschalter und Nutzerchip rechts */
#account { position: relative; display: flex; align-items: center; justify-content: space-between; height: 44px; margin: 0; }
.brand { display: block; width: 28px; height: 28px; }
.top-r { display: flex; align-items: center; gap: 6px; }
#theme-toggle { display: grid; place-items: center; width: 40px; height: 40px; margin: 0; padding: 0; color: var(--ink); background: var(--sheet); border: 0; border-radius: 20px; box-shadow: var(--shadow); }
#theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#theme-toggle[aria-pressed="true"] { background: var(--lime); color: var(--navy); }
#user-menu { max-width: 55vw; height: 40px; margin: 0; padding: 0 16px; font-size: 14px; color: var(--ink); background: var(--sheet); border: 0; border-radius: 20px; box-shadow: var(--shadow); }
#user-menu[aria-expanded="true"] { background: var(--sheet-2); }
#user-menu #user { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#user-panel { position: absolute; z-index: 20; right: 0; top: 48px; width: min(320px, calc(100vw - 32px)); display: flex; flex-direction: column; padding: 6px; text-align: left; background: var(--sheet); border-radius: 18px; box-shadow: 0 24px 48px -16px rgba(14, 37, 53, .45), 0 0 0 1px var(--line); }
#user-panel[hidden] { display: none; }
#user-panel form { margin: 0; }
#user-panel > button, #user-panel form:not(#due-warn-form) > button[type="submit"] { display: block; width: 100%; min-height: 44px; margin: 0; padding: 0 12px; font-size: 15px; text-align: left; background: none; border: 0; border-radius: 12px; }
#user-panel > button:hover, #user-panel form:not(#due-warn-form) > button[type="submit"]:hover { background: var(--sheet-2); }

/* Datum */
.date { margin: 22px 0 0; }
.date .wd { display: block; font-weight: 300; font-size: clamp(40px, 11vw, 56px); line-height: 1.05; letter-spacing: -.02em; }
.date .dm { display: block; margin-top: 2px; font-weight: 300; font-size: clamp(22px, 6vw, 28px); color: var(--teal-ink); font-variant-numeric: tabular-nums; }

/* Hinweise */
#notice, #session-expired, #login-error, #login-idp { margin: 14px 0 0; padding: 10px 14px; color: var(--alert); background: var(--sheet); border-left: 3px solid var(--alert); border-radius: 12px; overflow-wrap: anywhere; }
#notice[hidden], #session-expired[hidden] { display: none; }
#session-expired a { color: inherit; }

/* Filter: Chips, horizontal scrollbar; rechts Toggle-Chip */
#view-bar { margin: 20px 0 14px; }
.filters { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
#filter-chips { display: contents; }
.f { flex: none; display: flex; align-items: center; gap: 8px; height: 40px; margin: 0; padding: 0 14px; font-size: 14px; color: var(--ink-2); background: transparent; border: 1px solid var(--line); border-radius: 20px; white-space: nowrap; }
.f[aria-pressed="true"] { color: var(--navy); font-weight: 500; background: var(--lime); border-color: var(--lime); }
.f.group { margin-left: auto; }
.f .dot { background: var(--c, var(--ink-3)); }
#filter-status { margin: 10px 0 0; padding: 8px 14px; font-weight: 500; color: var(--ink); background: var(--sheet); border-left: 3px solid var(--teal-ink); border-radius: 12px; overflow-wrap: anywhere; }
#filter-status[hidden], #filter-empty[hidden] { display: none; }
#filter-status button { min-height: 40px; margin-left: 8px; padding: 0 14px; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 20px; }
#filter-empty { margin: 0 0 14px; padding: 18px; font-size: 14px; color: var(--ink-2); text-align: center; background: var(--sheet); border-radius: var(--r); }

/* Frueher: eine eingeklappte Zeile */
#earlier { margin: 0 0 14px; }
#earlier[hidden] { display: none; }
#earlier-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; margin: 0; padding: 10px 12px; font-size: 14px; color: var(--ink-2); background: transparent; border: 0; border-radius: 12px; text-align: left; }
#earlier-toggle b { font-weight: 500; color: var(--ink); }
#earlier-toggle .cnt { margin-left: auto; font-size: 13px; }
#earlier-toggle::after { content: ""; flex: none; width: 8px; height: 8px; margin-left: 10px; border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: rotate(-45deg); transition: transform .15s; }
#earlier-toggle[aria-expanded="true"]::after { transform: rotate(45deg); }
#entries.earlier-closed section.day:not(.today) { display: none; }

/* Blatt: ein Tag */
#entries { margin: 0; }
#entries ul.day-entries { margin: 0; padding: 0; }
#entries ul[hidden] { display: none; }
#entries section.day { margin: 0 0 14px; overflow: hidden; background: var(--sheet); border-radius: var(--r); box-shadow: var(--shadow); }
#entries section.day[hidden] { display: none; }
#entries section.day > h2 { margin: 0; font-weight: 500; font-size: 13px; color: var(--ink-2); }
#entries section.day > h2 > button { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; margin: 0; padding: 10px 18px; font: inherit; text-align: left; color: var(--ink-2); background: transparent; border: 0; border-radius: 0; font-variant-numeric: tabular-nums; }
#entries section.day > h2 > button::before { content: ""; flex: none; width: 7px; height: 7px; border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: rotate(-45deg); transition: transform .15s; }
#entries section.day > h2 > button[aria-expanded="true"]::before { transform: rotate(45deg); }
#entries section.day > h2 > button:focus-visible { outline-offset: -2px; }
.day-head { padding: 16px 18px 6px; }
.day-head h2 { margin: 0; font-weight: 500; font-size: 13px; color: var(--ink-2); }

/* Aufgabenzeile: Raster 56 px | 1fr | auto */
#entries li { scroll-margin-bottom: 110px; position: relative; display: grid; grid-template-columns: 56px minmax(0, 1fr) auto auto; align-items: start; min-height: 56px; margin: 0; padding: 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
#entries li:last-child { border-bottom: 0; }
#entries li[hidden] { display: none; }
#entries li.group-head { display: block; min-height: 0; padding: 14px 18px 6px; border-bottom: 0; }
#entries li.group-head h3 { margin: 0; font-weight: 500; font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
#entries li.group-head h3::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: var(--c, transparent); box-shadow: 0 0 0 1px var(--dot-ring); }
.body { display: contents; }
.box { position: relative; grid-column: 1; grid-row: 1 / span 2; width: 56px; height: 56px; }
.box input[type="checkbox"] { position: absolute; inset: 0; width: 56px; height: 56px; margin: 0; padding: 0; opacity: 0; cursor: pointer; }
.box svg { position: absolute; left: 16px; top: 16px; width: 24px; height: 24px; overflow: visible; pointer-events: none; }
.box .frame { fill: none; stroke: var(--ink-3); stroke-width: 1.6; transition: fill .15s, stroke .15s; }
.box .tick { fill: none; stroke: var(--navy); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 22; stroke-dashoffset: 22; transition: stroke-dashoffset .2s ease-out .05s; }
.box input:checked + svg .frame { fill: var(--lime); stroke: var(--lime); }
.box input:checked + svg .tick { stroke-dashoffset: 0; }
.box input:focus-visible { outline: none; }
.box input:focus-visible + svg { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: 8px; }

.text { grid-column: 2; grid-row: 1 / span 2; min-width: 0; padding: 15px 0; cursor: text; }
.ink {
  margin: 0 -.2em; padding: 0 .2em; border-radius: .3em; -webkit-box-decoration-break: clone; box-decoration-break: clone;
  background-repeat: no-repeat; background-image: linear-gradient(currentColor, currentColor); background-position: 0 56%; background-size: 0% 1.5px;
  transition: background-size .28s ease-out, color .25s;
}
li.done .ink { background-size: 100% 1.5px; color: var(--ink-3); }

/* Textmarker: zweite Hintergrundebene, ca. 60 % der Zeilenhoehe, nur Textbreite */
li[data-color] .ink { --mk: var(--mark-a); background-image: linear-gradient(currentColor, currentColor), linear-gradient(transparent 28%, var(--mk) 28% 90%, transparent 90%); background-position: 0 56%, 0 0; background-size: 0% 1.5px, 100% 100%; }
li[data-color="green"] .ink { --mk: var(--mark-b); }
li[data-color="pink"] .ink { --mk: var(--mark-c); }
li[data-color].done .ink { background-size: 100% 1.5px, 100% 100%; color: var(--ink); }

/* Meta rechts: seit TT.MM. und Kategorie (Punkt + Wort) */
.since, .category { align-self: center; padding: 0 8px; font-size: 13px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.since { grid-column: 3; grid-row: 1 / span 2; }
.category { display: inline-flex; align-items: center; gap: 7px; grid-column: 4; grid-row: 1 / span 2; max-width: 14ch; padding-right: 16px; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.category::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--ink-3)); box-shadow: 0 0 0 1px var(--dot-ring); }
li:not(:has(.category)) .since { padding-right: 16px; }
@media (max-width: 560px) {
  .since, .category { grid-column: 3 / 5; justify-self: end; padding: 0 14px 0 8px; line-height: 1.25; font-size: 12.5px; }
  .since { grid-row: 1; align-self: end; }
  .category { grid-row: 2; align-self: start; max-width: 16ch; }
  li:not(:has(.category)) .since { grid-row: 1 / span 2; align-self: center; }
  li:not(:has(.since)) .category { grid-row: 1 / span 2; align-self: center; }
}

/* Aktionen: verborgen; Desktop beim Ueberfahren, Touch per Tipp auf den Text (.open), Tastaturfokus */
.acts { display: none; grid-column: 3 / 5; grid-row: 1 / span 2; align-items: center; height: 56px; padding-right: 6px; }
.acts button { display: grid; place-items: center; width: 40px; height: 44px; margin: 0; padding: 0; color: var(--ink-2); background: none; border: 0; border-radius: 10px; }
.acts button:hover { color: var(--ink); background: var(--sheet-2); }
.acts button[aria-expanded="true"] { color: var(--ink); background: var(--sheet-2); }
.acts svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
li.open .acts, li:has(:focus-visible) .acts { display: flex; animation: acts-in .15s ease-out; }
li.open .since, li.open .category, li:has(:focus-visible) .since, li:has(:focus-visible) .category { display: none; }
@keyframes acts-in { from { opacity: 0; } to { opacity: 1; } }
@media (hover: hover) {
  li:hover .acts { display: flex; }
  li:hover .since, li:hover .category { display: none; }
}

/* Erklaerung, Bearbeiten-Formular, Kategorie-Leiste: unter der Zeile */
#entries .note, #entries .edit-form, #entries .category-bar { grid-column: 2 / -1; min-width: 0; margin: 0; }
#entries .note { padding: 0 16px 14px 0; white-space: pre-wrap; font-weight: 300; color: var(--ink-2); }
#entries .note[hidden] { display: none; }
#entries .edit-form, #entries .category-bar { padding: 0 16px 14px 0; }
#entries .edit-form label, #categories label { display: block; margin: 6px 0 4px; font-size: 13px; color: var(--ink-2); }
input[type="text"], input[type="number"], input[type="date"], input[type="time"], textarea, select { font-size: 16px; }
#entries .edit-form input, #entries .edit-form textarea, #entries .category-bar input, #categories input[type="text"], #time-dialog input, #due-warn-form input {
  display: block; width: 100%; margin: 0; padding: 0 12px; color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; }
#entries .edit-form input, #entries .category-bar input, #categories input[type="text"], #time-dialog input { height: 44px; }
#entries .edit-form textarea { height: 112px; padding: 10px 12px; resize: vertical; }
#entries .edit-form button, #categories button:not(.category-color), #category-list button, a.button, #api-key-actions button, #time-actions button {
  display: inline-block; min-height: 40px; margin: 8px 8px 0 0; padding: 0 18px; font-size: 15px; color: var(--ink); text-decoration: none; background: transparent; border: 1.5px solid var(--line); border-radius: 12px; }
#entries .edit-form button[type="submit"], #time-actions button[type="submit"], a.button { color: var(--navy); font-weight: 500; background: var(--lime); border-color: var(--lime); }
#entries .category-bar { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
#entries .category-bar button { min-height: 40px; max-width: 100%; margin: 0; padding: 0 14px; font-size: 14px; color: var(--ink-2); background: transparent; border: 1px solid var(--line); border-radius: 20px; overflow-wrap: anywhere; }
#entries .category-bar button[aria-pressed="true"] { color: var(--navy); font-weight: 500; background: var(--lime); border-color: var(--lime); }
#entries .category-bar form { flex: 1 0 100%; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin: 0; }
#entries .category-bar label { flex: 1 0 100%; margin: 0; }
#entries .category-bar form button { margin: 0; border-radius: 12px; min-height: 40px; }
#entries .edit-form .due-fields { display: flex; gap: 8px; flex-wrap: wrap; }
#entries .edit-form .due-fields label { flex: 1 1 140px; min-width: 0; }
#entries .edit-form input[type="date"], #entries .edit-form input[type="time"] { color-scheme: light dark; }

/* Frist (#83): Text unter dem Stichpunkt; Markierung mit Text, nicht nur Farbe */
.due { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
li.due-soon .due, li.overdue .due { color: var(--alert); font-weight: 500; }
li.due-soon .due-label::before { content: "\23F0\00a0"; }
li.overdue .due-label::before { content: "\26A0\00a0"; }
li.done .due-flag { display: none; }
li.done .due { color: var(--ink-3); font-weight: 400; }

/* Eingabezeile: unten angedockt, Verlauf nach oben ausblendend */
#composer { position: sticky; bottom: 0; z-index: 5; padding: 18px 0 max(14px, env(safe-area-inset-bottom)); background: linear-gradient(to bottom, transparent, var(--bg) 38%); }
#capture { display: flex; align-items: center; gap: 6px; margin: 0; padding: 6px 6px 6px 8px; background: var(--sheet); border-radius: 28px; box-shadow: 0 0 0 1px var(--line), 0 18px 34px -18px rgba(14, 37, 53, .5); }
#capture:focus-within { box-shadow: 0 0 0 2px var(--focus), 0 18px 34px -18px rgba(14, 37, 53, .5); }
#capture label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#capture .mode { flex: none; display: inline-flex; align-items: center; height: 32px; max-width: 34%; padding: 0 12px; font-size: 12.5px; color: var(--ink-2); background: var(--sheet-2); border-radius: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#capture input[type="text"] { flex: 1; min-width: 0; height: 44px; margin: 0; padding: 0 8px; font: 400 16px/22px var(--font); color: var(--ink); background: none; border: 0; border-radius: 0; box-shadow: none; caret-color: var(--teal-ink); }
#capture input[type="text"]::placeholder { color: var(--ink-2); opacity: 1; }
#capture input[type="text"]:focus-visible { outline: none; }
.kbd { display: none; margin: 0; padding: 8px 14px 0; font-size: 12px; color: var(--ink-2); }
@media (hover: hover) and (min-width: 700px) { .kbd { display: block; } }

/* Meldungen: Toast ueber der Eingabezeile */
#time-status { position: fixed; z-index: 30; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); margin: 0; padding: 12px 18px; font-size: 14px; color: #fff; background: var(--navy); border-radius: 16px; box-shadow: 0 12px 28px -12px rgba(14, 37, 53, .6); overflow-wrap: anywhere; }
:root[data-theme="dark"] #time-status { color: var(--navy); background: var(--lime); }
#time-dialog { position: relative; }
#entries li > #time-dialog { grid-column: 1 / -1; margin: 0 12px 12px; scroll-margin-bottom: 110px; }
#time-dialog #time-title { padding-right: 48px; }
#time-dialog button#time-close, #categories button#categories-close { position: absolute; top: 4px; right: 4px; display: flex; align-items: center; justify-content: center; width: 44px; min-width: 44px; height: 44px; min-height: 44px; margin: 0; padding: 0; color: var(--ink-2); background: transparent; border: 0; border-radius: 50%; }
#categories { position: relative; }
#categories h2 { padding-right: 48px; }
#time-close svg, #categories-close svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
#time-status[hidden], #time-dialog[hidden], #time-hint[hidden], #time-section[hidden] { display: none; }

/* Kategorien verwalten, API-Schluessel: Blaetter */
#categories, #api-key-section { margin: 14px 0 0; padding: 14px 16px; background: var(--sheet); border-radius: var(--r); box-shadow: var(--shadow); }
#categories { max-height: 50vh; overflow-y: auto; }
#categories[hidden], #api-key-section[hidden] { display: none; }
#categories h2, #api-key-section h2 { margin: 0 0 6px; font-weight: 500; font-size: 18px; }
#category-list li { margin: 0 0 18px; }
#category-list form, #category-create { display: flex; flex-wrap: wrap; align-items: flex-end; margin: 0; }
#category-list label, #category-create label { flex: 1 0 100%; overflow-wrap: anywhere; }
#categories input[type="text"] { flex: 1 1 8rem; width: auto; min-width: 0; margin: 0 8px 0 0; }
#categories button { max-width: 100%; overflow-wrap: anywhere; }
.category-colors { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 0; }
#categories button.category-color { width: 40px; min-width: 40px; height: 40px; min-height: 40px; padding: 0; margin: 0; background: var(--c); border: 4px solid var(--sheet); border-radius: 50%; box-shadow: 0 0 0 1px var(--dot-ring); }
#categories button.category-color[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); }
.category-color[data-key] { --c: var(--ink-3); }
.category-color[data-key="blue"] { --c: var(--cat-blue); } .category-color[data-key="teal"] { --c: var(--cat-teal); }
.category-color[data-key="green"] { --c: var(--cat-green); } .category-color[data-key="purple"] { --c: var(--cat-purple); }
.category-color[data-key="red"] { --c: var(--cat-red); } .category-color[data-key="orange"] { --c: var(--cat-orange); }
.category-color[data-key="brown"] { --c: var(--cat-brown); } .category-color[data-key="gray"] { --c: var(--cat-gray); }

#api-key-value { margin: 0; font: 400 14px/1.4 ui-monospace, monospace; overflow-wrap: anywhere; user-select: all; }
#api-key-actions { display: flex; flex-wrap: wrap; gap: 0; padding: 0; }
#api-key-actions button[hidden] { display: none; }
#api-key-status, #due-warn-status { margin: 4px 0 0; font-size: 14px; }
#api-key-status[hidden], #due-warn-status[hidden] { display: none; }

/* Menue: Erinnerung, Zeiten */
#due-warn-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; font-size: 14px; color: var(--ink-2); }
#due-warn-form input { width: 4.5em; height: 40px; padding: 0 6px; text-align: center; }
#user-panel #due-warn-save { width: auto; background: none; min-height: 40px; padding: 0 14px; font-size: 14px; text-align: center; border: 1px solid var(--line); border-radius: 12px; }
#due-warn-status { padding: 0 12px 6px; }
#time-section { padding: 6px 12px; max-width: 100%; font-size: 14px; border-top: 1px solid var(--line); }
#time-section h2 { margin: 0; font-weight: 500; font-size: 14px; }
#time-list li { padding: 4px 0; overflow-wrap: anywhere; }
#user-panel #time-list button { display: inline-block; width: auto; min-height: 40px; margin-left: 6px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; }

/* Zeit erfassen (#12): Formular vor der Eingabezeile, sperrt die Liste nicht */
#time-dialog { margin: 0 0 14px; padding: 16px; font-size: 15px; background: var(--sheet-2); border-radius: 16px; }
#time-dialog p, #time-dialog label { display: block; margin: 0 0 6px; overflow-wrap: anywhere; }
#time-dialog input { max-width: 14em; }
#time-hint { color: var(--alert); font-size: 13px; }
#time-actions { display: flex; flex-wrap: wrap; }
#time-actions button { background: var(--sheet); }
#time-actions button[type="submit"] { background: var(--lime); }

/* Login */
.login { padding-top: max(32px, env(safe-area-inset-top)); }
.login .brand { width: 40px; height: 40px; }
.login h1 { margin: 22px 0 0; font-weight: 300; font-size: clamp(40px, 11vw, 56px); line-height: 1.05; letter-spacing: -.02em; }
.login p { margin: 0; }
.login p:last-child { padding-top: 28px; }
a.button { display: inline-flex; align-items: center; min-height: 48px; margin: 0; padding: 0 28px; border-radius: 24px; font-size: 16px; }
.login #login-error, .login #login-idp { margin: 18px 0 0; }

/* Reduzierte Bewegung: keine Uebergaenge, keine Animationen */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Meetings (#117): Tabs, Liste, Notizblatt. Tokens und Muster aus #110, Quill (snow) auf die Tokens umgestylt. */
#tabs { display: flex; gap: 28px; margin: 10px 0 0; border-bottom: 1px solid var(--line); }
#tabs [role="tab"] { display: inline-flex; align-items: center; min-height: 44px; margin: 0; padding: 8px 0; font: 500 16px var(--font); color: var(--ink-2); background: none; border: 0; border-radius: 0; }
#tabs [role="tab"] .lb { padding: 0 .3em; margin: 0 -.3em; border-radius: .3em; }
#tabs [role="tab"][aria-selected="true"] { color: var(--ink); }
#tabs [role="tab"][aria-selected="true"] .lb { background: linear-gradient(transparent 52%, var(--mark-a) 52% 94%, transparent 94%); }
#tabs [role="tab"]:focus-visible { outline-offset: 2px; }

.page:not([data-view="entries"]) > :is(#today-date, #view-bar, #earlier, #entries, #filter-empty, #time-dialog) { display: none; }
.page[data-view="meetings-sheet"] > #composer { display: none; }
#meetings { margin: 0 0 14px; }
#meetings[hidden], #meeting-list-view[hidden], #meeting-sheet-view[hidden], #meeting-empty[hidden], #meeting-list-error[hidden],
#meeting-upload[hidden], #meeting-error[hidden], #meeting-conflict[hidden], #meeting-retry[hidden], #meeting-markdown[hidden], #toast[hidden] { display: none; }

.m-head { margin: 22px 0 12px; font-weight: 300; font-size: clamp(28px, 8vw, 36px); line-height: 1.1; letter-spacing: -.01em; }
#meeting-list-error, #meeting-error { margin: 10px 0 0; padding: 10px 14px; color: var(--alert); background: var(--sheet); border-left: 3px solid var(--alert); border-radius: 12px; overflow-wrap: anywhere; }
#meeting-list section { margin: 0 0 14px; overflow: hidden; background: var(--sheet); border-radius: var(--r); box-shadow: var(--shadow); }
#meeting-list .gh { margin: 0; padding: 14px 18px 6px; font-weight: 500; font-size: 13px; color: var(--ink-2); }
#meeting-list li { border-bottom: 1px solid var(--line); }
#meeting-list li:last-child { border-bottom: 0; }
#meeting-list .row { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px; width: 100%; min-height: 56px; margin: 0; padding: 14px 18px; text-align: left; color: var(--ink); background: none; border: 0; border-radius: 0; }
#meeting-list .row:focus-visible { outline-offset: -2px; }
#meeting-list .time { font-weight: 300; font-size: 21px; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
#meeting-list .main { display: block; min-width: 0; }
#meeting-list .title { display: block; font-weight: 500; font-size: 16px; line-height: 1.3; color: var(--ink); overflow-wrap: anywhere; }
#meeting-list .preview { display: block; margin-top: 3px; font-weight: 300; font-size: 14.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#meeting-list .meta { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 6px; font-size: 13px; color: var(--ink-2); }
#meeting-list .meta .cat { display: inline-flex; align-items: center; gap: 6px; }
#meeting-empty { margin: 0 0 14px; padding: 28px 18px; font-size: 14px; color: var(--ink-2); text-align: center; background: var(--sheet); border-radius: var(--r); }

#meeting-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 14px 0 12px; }
#meeting-back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: 0; padding: 0 14px 0 8px; font-size: 15px; color: var(--ink-2); background: none; border: 0; border-radius: 22px; }
#meeting-back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#meeting-status { flex: 1; margin: 0; font-size: 13px; color: var(--ink-2); text-align: right; }
#meeting-retry { min-height: 44px; padding: 0 14px; color: var(--navy); font-weight: 500; background: var(--lime); border: 0; border-radius: 22px; }

#meeting-sheet { margin: 0; padding: 26px 20px 18px; background: var(--sheet); border-radius: 38px 20px 20px 20px; box-shadow: var(--shadow); overflow-wrap: anywhere; }
#meeting-title { display: block; width: 100%; min-height: 44px; margin: 0; padding: 0; color: var(--ink); font: 300 clamp(26px, 7vw, 34px)/1.2 var(--font); letter-spacing: -.01em; background: none; border: 0; border-radius: 6px; }
#meeting-title::placeholder { color: var(--ink-2); opacity: 1; }
#meeting-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 10px; }
.m-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; font-size: 13.5px; color: var(--ink-2); background: var(--sheet-2); border-radius: 20px; }
.m-chip select { min-height: 40px; max-width: 60vw; padding: 0 2px 0 0; color: inherit; font: inherit; background: none; border: 0; appearance: none; cursor: pointer; }
.m-chip .dot { background: var(--c, var(--ink-3)); }

#meeting-toolbar.ql-toolbar.ql-snow { display: flex; flex-wrap: wrap; padding: 4px 0; border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: none; font-family: var(--font); }
#meeting-toolbar.ql-snow .ql-formats { display: flex; flex-wrap: wrap; margin: 0; }
#meeting-toolbar.ql-snow button { display: grid; place-items: center; float: none; width: 40px; height: 40px; margin: 0; padding: 10px; color: var(--ink); background: none; border: 0; border-radius: 10px; }
#meeting-toolbar.ql-snow button svg { float: none; width: 20px; height: 20px; }
#meeting-toolbar.ql-snow button .ql-stroke, #meeting-toolbar.ql-snow button .ql-stroke-miter { stroke: var(--ink); }
#meeting-toolbar.ql-snow button .ql-fill { fill: var(--ink); }
#meeting-toolbar.ql-snow button:hover, #meeting-toolbar.ql-snow button.ql-active { background: var(--sheet-2); color: var(--teal-ink); }
#meeting-toolbar.ql-snow button:hover .ql-stroke, #meeting-toolbar.ql-snow button.ql-active .ql-stroke, #meeting-toolbar.ql-snow button.ql-active .ql-stroke-miter { stroke: var(--teal-ink); }
#meeting-toolbar.ql-snow button.ql-active .ql-fill { fill: var(--teal-ink); }
#meeting-toolbar.ql-snow button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
#meeting-toolbar .ql-attach svg { fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

#meeting-editor.ql-container.ql-snow { border: 0; font-family: var(--font); font-size: 16px; }
#meeting-editor .ql-editor { min-height: 220px; padding: 14px 0; color: var(--ink); font-weight: 300; line-height: 1.55; overflow-wrap: anywhere; }
#meeting-editor .ql-editor.ql-blank::before { left: 0; right: 0; color: var(--ink-2); font-style: normal; }
#meeting-editor .ql-editor:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
#meeting-editor .ql-editor h1, #meeting-editor .ql-editor h2, #meeting-editor .ql-editor h3 { font-weight: 500; }
#meeting-editor .ql-editor img { display: block; max-width: 100%; height: auto; margin: 6px 0; border-radius: 10px; }
#meeting-editor .ql-editor a { color: var(--teal-ink); }
#meeting-editor .ql-editor a.pdf-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 40px; margin: 2px 0; padding: 0 14px; color: var(--ink); font-weight: 400; font-size: 14px; text-decoration: none; background: var(--sheet-2); border-radius: 20px; }
#meeting-editor .ql-editor a.pdf-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#meeting-editor .ql-editor a.pdf-chip small { color: var(--ink-2); font-size: 12px; }
.ql-snow .ql-tooltip { z-index: 10; color: var(--ink); background: var(--sheet); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); font-family: var(--font); }
.ql-snow .ql-tooltip input[type=text] { color: var(--ink); background: var(--sheet-2); border: 1px solid var(--line); border-radius: 8px; font-family: var(--font); }
.ql-snow .ql-tooltip a.ql-action::after, .ql-snow .ql-tooltip a.ql-remove::before, .ql-snow .ql-tooltip a { color: var(--teal-ink); }
.ql-snow .ql-tooltip::before { content: "Link öffnen:"; }
.ql-snow .ql-tooltip a.ql-action::after { content: "Ändern"; }
.ql-snow .ql-tooltip.ql-editing a.ql-action::after { content: "Speichern"; }
.ql-snow .ql-tooltip a.ql-remove::before { content: "Entfernen"; }
.ql-snow .ql-tooltip[data-mode=link]::before { content: "Link eingeben:"; }

#meeting-upload { margin: 8px 0 0; font-size: 13px; color: var(--ink-2); }
#meeting-conflict { margin: 12px 0 0; padding: 12px 14px; background: var(--sheet-2); border-left: 3px solid var(--teal-ink); border-radius: 12px; }
#meeting-conflict p { margin: 0 0 8px; font-weight: 500; }
#meeting-conflict button { min-height: 44px; margin: 0 8px 0 0; padding: 0 14px; color: var(--ink); background: var(--sheet); border: 1px solid var(--line); border-radius: 22px; }
#meeting-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
#meeting-actions button { min-height: 44px; margin: 0; padding: 0 16px; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 22px; }
#meeting-delete { color: var(--alert); }
#meeting-markdown { display: block; width: 100%; margin: 12px 0 0; padding: 10px; color: var(--ink); font: 400 13px/1.45 ui-monospace, monospace; background: var(--sheet-2); border: 1px solid var(--line); border-radius: 12px; }
#toast { position: fixed; z-index: 30; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); margin: 0; padding: 12px 18px; font-size: 14px; color: #fff; background: var(--navy); border-radius: 16px; box-shadow: 0 12px 28px -12px rgba(14, 37, 53, .6); overflow-wrap: anywhere; }
:root[data-theme="dark"] #toast { color: var(--navy); background: var(--lime); }

/* Meeting-Zeit (#118): Zaehler am Tab, Pillen in der Liste, Zeit-Formular im Notizblatt */
#tabs [role="tab"] .n { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; margin-left: 8px; padding: 0 6px; font-size: 12px; font-weight: 500; color: var(--navy); background: var(--lime); border-radius: 10px; }
#meeting-time-summary { margin: -6px 0 12px; font-size: 14px; color: var(--ink-2); }
#meeting-time-summary[hidden], #meeting-time-form[hidden], #meeting-time-hint[hidden], #meeting-time-state[hidden] { display: none; }
#meeting-list .time .dur { display: block; margin-top: 2px; font-weight: 400; font-size: 12px; color: var(--ink-2); letter-spacing: 0; }
#meeting-list .state { padding: 0 18px 12px 90px; }
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; margin: 0; padding: 0 14px; font: 400 13px var(--font); color: var(--ink-2); background: var(--sheet-2); border: 0; border-radius: 20px; max-width: 100%; text-align: left; }
.pill svg { flex: none; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
button.pill.open { color: var(--navy); font-weight: 500; background: var(--lime); }
button.pill.fail { color: var(--alert); font-weight: 500; background: var(--sheet-2); border: 1px solid var(--alert); }
#meeting-save { min-height: 44px; margin: 0; padding: 0 18px; color: var(--navy); font-weight: 500; background: var(--lime); border: 0; border-radius: 22px; }
#meeting-time-state svg { flex: none; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
#meeting-time-state.fail { color: var(--alert); }
#meeting-time-state .again { min-height: 40px; margin: 0 0 0 4px; padding: 0 12px; color: var(--ink); background: var(--sheet); border: 1px solid var(--line); border-radius: 20px; }
#meeting-time-form { margin: 4px 0 14px; padding: 16px; font-size: 15px; background: var(--sheet-2); border-radius: 16px; }
#meeting-time-form label { display: block; margin: 0 0 10px; overflow-wrap: anywhere; }
#meeting-time-form .quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
#meeting-time-form .quick button { min-height: 40px; margin: 0; padding: 0 14px; color: var(--ink); background: var(--sheet); border: 1px solid var(--line); border-radius: 20px; }
#meeting-time-form .quick button[aria-pressed="true"] { color: var(--navy); font-weight: 500; background: var(--lime); border-color: var(--lime); }
#meeting-time-duration { display: block; box-sizing: border-box; width: 100%; max-width: 14em; min-height: 44px; margin: 0 0 8px; padding: 0 12px; color: var(--ink); font: inherit; background: var(--sheet); border: 1px solid var(--line); border-radius: 12px; }
#meeting-time-duration[aria-invalid="true"] { border-color: var(--alert); }
#meeting-time-hint { margin: 0 0 8px; color: var(--alert); font-size: 13px; overflow-wrap: anywhere; }
#meeting-time-form .tacts { display: flex; flex-wrap: wrap; gap: 8px; }
#meeting-time-form .tacts button { min-height: 44px; margin: 0; padding: 0 18px; color: var(--ink); background: var(--sheet); border: 1px solid var(--line); border-radius: 22px; }
#meeting-time-form .tacts button[type="submit"] { color: var(--navy); font-weight: 500; background: var(--lime); border-color: var(--lime); }

/* Wiederholen im Bearbeiten-Formular und Serien-Blatt (#129) */

#entries .edit-form select { display: block; width: 100%; height: 44px; margin: 0; padding: 0 12px; color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; color-scheme: light dark; }
#entries .edit-form .repeat-days { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
#entries .edit-form .repeat-days label { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; margin: 0; padding: 0 12px; font-size: 14px; color: var(--ink); border: 1.5px solid var(--line); border-radius: 20px; }
#entries .edit-form .repeat-days input { display: inline-block; width: 18px; height: 18px; margin: 0; padding: 0; }
#entries .edit-form .repeat-fields label { flex: 1 1 120px; }
.repeat { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
li.done .repeat { color: var(--ink-3); }
#series-section { position: relative; margin: 14px 0 0; padding: 14px 16px; background: var(--sheet); border-radius: var(--r); box-shadow: var(--shadow); max-height: 50vh; overflow-y: auto; }
#series-section[hidden] { display: none; }
#series-section h2 { margin: 0 0 6px; padding-right: 48px; font-weight: 500; font-size: 18px; }
#series-section button#series-close { position: absolute; top: 4px; right: 4px; display: flex; align-items: center; justify-content: center; width: 44px; min-width: 44px; height: 44px; min-height: 44px; margin: 0; padding: 0; color: var(--ink-2); background: transparent; border: 0; border-radius: 50%; }
#series-close svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
#series-list { margin: 0; padding: 0; list-style: none; }
#series-list li { display: flex; flex-direction: column; gap: 2px; margin: 0 0 16px; }
#series-list .s-text { overflow-wrap: anywhere; }
#series-list .s-rule { font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
#series-list .s-acts { display: flex; flex-wrap: wrap; }
#series-list button { min-height: 40px; margin: 8px 8px 0 0; padding: 0 18px; font-size: 15px; color: var(--ink); background: transparent; border: 1.5px solid var(--line); border-radius: 12px; }
#entries .edit-form [hidden], #series-section [hidden] { display: none; }
