/* Gestaltungswerte wie im Desktop-Programm (Theme.qml). Referenz: Apple Kalender 16, helles Erscheinungsbild. */
:root {
  --font: "Inter", system-ui, sans-serif, "Noto Color Emoji";
  --font-display: "Inter Display", "Inter", system-ui, sans-serif, "Noto Color Emoji";
  --window-bg: #FFFFFF; --sidebar-bg: #F4F4F6; --sidebar-border: #E4E4E7;
  --glass-bg: #FCFCFD; --glass-border: #E2E2E5; --panel-bg: #F5F5F7;
  --control-bg: #EDEDF0; --control-hover: #E4E4E8; --control-pressed: #D9D9DE; --segment-selected: #E6E6E9;
  --weekend-bg: #F7F7F8; --hover-bg: rgba(0, 0, 0, .04);
  --separator: #E3E3E6; --grid-line: #E8E8EB; --hour-line: #ECECEE; --allday-divider: #E8E8EA;
  --text: #1D1D1F; --secondary: #86868B; --tertiary: #B8B8BD;
  --red: #FF3B30; --accent: #007AFF; --selection-bg: #E1E1E6;
  --gutter: 64px; --allday-row: 21px; --month-item: 18px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font); font-size: 13px; color: var(--text); background: var(--window-bg);
  -webkit-font-smoothing: antialiased; overflow: hidden; user-select: none; -webkit-user-select: none;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; margin: 0; cursor: default; }
:focus { outline: none; }
:focus-visible { outline: 3px solid rgba(10, 122, 255, .6); outline-offset: 2px; }
.tnum { font-feature-settings: "tnum" 1; }
.hidden { display: none !important; }
svg.icon { display: block; flex: none; }

#app { display: flex; height: 100%; min-width: 0; }

/* ------------------------------------------------------------ Seitenleiste */
#sidebar {
  flex: none; width: 232px; margin: 8px; border-radius: 16px; background: var(--sidebar-bg);
  border: .5px solid var(--sidebar-border); box-shadow: 0 1px 9px rgba(0, 0, 0, .12);
  display: flex; flex-direction: column; min-height: 0;
}
.sb-head { height: 46px; display: flex; align-items: center; justify-content: flex-end; padding-right: 10px; flex: none; }
.sb-list { flex: 1; overflow-y: auto; min-height: 0; padding-top: 6px; }
.sb-group { margin-bottom: 14px; }
.sb-account { height: 22px; display: flex; align-items: center; padding: 0 14px 0 16px; color: var(--secondary);
  font-size: 11px; font-weight: 600; }
.sb-account span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-status { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; }
.sb-status.error { color: var(--red); } .sb-status.warning { color: #E8A200; }
.spinner { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid rgba(0,0,0,.15); border-top-color: var(--secondary);
  animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sb-cal { display: flex; align-items: center; width: calc(100% - 16px); height: 26px; margin: 1px 8px; padding: 0 8px;
  border-radius: 6px; text-align: left; }
.sb-cal:hover { background: rgba(0, 0, 0, .05); }
.sb-box { width: 14px; height: 14px; border-radius: 4px; flex: none; display: flex; align-items: center; justify-content: center;
  color: #fff; border: 1.5px solid transparent; }
.sb-cal span { flex: 1; margin-left: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-cal .lock { color: var(--tertiary); }
.sb-mini { flex: none; margin: 6px 14px 12px; padding-top: 8px; border-top: 1px solid var(--separator); }

/* Mini-Monat (Seitenleiste, rechte Spalte der Tagesansicht) */
.mini { --cell: 29px; width: calc(var(--cell) * 7); margin: 0 auto; }
.mini-head { height: 28px; display: flex; align-items: center; }
.mini-title { flex: 1; text-align: center; font-weight: 600; }
.mini-nav { width: 22px; height: 22px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  color: var(--secondary); }
.mini-nav:hover { background: var(--control-hover); }
.mini-grid { display: grid; grid-template-columns: repeat(7, var(--cell)); }
.mini-wd { height: calc(var(--cell) * .8); display: flex; align-items: center; justify-content: center; font-size: 10px;
  font-weight: 600; color: var(--secondary); }
.mini-day { width: var(--cell); height: var(--cell); display: flex; align-items: center; justify-content: center; font-size: 11px;
  font-feature-settings: "tnum" 1; }
.mini-day i { font-style: normal; width: calc(var(--cell) - 3px); height: calc(var(--cell) - 3px); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; }
.mini-day:hover i { background: var(--hover-bg); }
.mini-day.out { color: var(--tertiary); }
.mini-day.sel i { background: var(--selection-bg); }
.mini-day.today i { background: var(--red); color: #fff; font-weight: 600; }
.mini.bold .mini-day:not(.out) { font-weight: 600; }
.mini.bold .mini-day { font-size: 12px; }

/* ----------------------------------------------------------- Hauptbereich */
#content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#toolbar { height: 54px; flex: none; position: relative; display: flex; align-items: center; padding: 6px 14px 0 4px; }
#app.no-sidebar #toolbar { padding-left: 14px; }
#toolbar .left, #toolbar .right { display: flex; gap: 8px; align-items: center; }
#toolbar .right { margin-left: auto; position: relative; }
.glass {
  width: 34px; height: 34px; border-radius: 17px; background: var(--glass-bg); border: .5px solid var(--glass-border);
  box-shadow: 0 1px 6px rgba(0, 0, 0, .15); display: flex; align-items: center; justify-content: center; position: relative;
}
.glass:hover { background: #F3F3F5; } .glass:active { background: var(--control-pressed); }
.glass.checked { background: var(--segment-selected); }
.badge { position: absolute; right: 0; top: 0; width: 10px; height: 10px; border-radius: 5px; background: var(--red);
  border: 1.5px solid #fff; }
.segmented {
  position: absolute; left: 50%; transform: translateX(-50%); top: 13px; height: 34px; padding: 4px; display: flex;
  border-radius: 17px; background: var(--glass-bg); border: .5px solid var(--glass-border); box-shadow: 0 1px 7px rgba(0, 0, 0, .14);
}
.segmented button { min-width: 62px; padding: 0 15px; border-radius: 13px; font-weight: 500; }
.segmented button:hover { background: #F1F1F3; }
.segmented button[aria-checked="true"] { background: var(--segment-selected); font-weight: 600; }
@media (max-width: 760px) { .segmented button { min-width: 40px; padding: 0 9px; } }

#heading { flex: none; height: 56px; position: relative; padding: 6px 16px 0 20px; display: flex; align-items: flex-start; }
#heading.day { height: 78px; }
.h-title { font-family: var(--font-display); font-size: 27px; letter-spacing: -.3px; line-height: 1.2; white-space: nowrap; }
.h-title b { font-weight: 700; }
.h-sub { position: absolute; left: 21px; top: 41px; font-size: 18px; }
.h-nav { margin-left: auto; display: flex; gap: 6px; align-items: center; padding-top: 4px; }
.round { width: 26px; height: 26px; border-radius: 13px; background: var(--control-bg); display: flex; align-items: center;
  justify-content: center; }
.round:hover, .pill:hover { background: var(--control-hover); } .round:active, .pill:active { background: var(--control-pressed); }
.round.checked { background: var(--segment-selected); }
.round:disabled { opacity: .4; }
.pill { height: 26px; padding: 0 12px; border-radius: 13px; background: var(--control-bg); font-weight: 500; }

#view { flex: 1; min-height: 0; position: relative; }
#view:focus-visible { outline: none; }
.empty-note { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--tertiary); }

/* ------------------------------------------------------------ Monatsansicht */
.month { position: absolute; inset: 0; display: flex; flex-direction: column; }
.m-head { flex: none; height: 30px; display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--grid-line); }
.m-head div { text-align: right; padding-right: 10px; line-height: 29px; color: var(--secondary); }
.m-weeks { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.m-week { flex: 1; position: relative; min-height: 0; display: grid; grid-template-columns: repeat(7, 1fr); }
.m-cell { position: relative; border-bottom: 1px solid var(--grid-line); border-right: 1px solid var(--grid-line); min-width: 0; }
.m-cell:last-of-type { border-right: 0; }
.m-cell.weekend { background: var(--weekend-bg); }
.m-kw { position: absolute; left: 6px; top: 7px; font-size: 10px; color: var(--tertiary); }
.m-day { position: absolute; top: 4px; right: 6px; min-width: 22px; height: 22px; padding: 0 2px; border-radius: 11px;
  font-feature-settings: "tnum" 1; }
.m-day:hover { background: var(--hover-bg); }
.m-cell.out .m-day { color: var(--tertiary); }
.m-cell.sel .m-day { background: var(--selection-bg); }
.m-cell.today .m-day { background: var(--red); color: #fff; font-weight: 600; padding: 0 6px; }
.m-more { position: absolute; left: 10px; font-size: 11px; font-weight: 500; color: var(--secondary); }
.m-item { position: absolute; height: 17px; border-radius: 4px; display: flex; align-items: center; text-align: left;
  overflow: hidden; white-space: nowrap; }
.m-item.bar { padding: 0 4px 0 6px; font-size: 11px; font-weight: 600; }
.m-item.bar span { overflow: hidden; text-overflow: ellipsis; }
.m-item.bar.cl { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.m-item.bar.cr { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.m-item .dot { width: 7px; height: 7px; border-radius: 50%; margin-left: 5px; flex: none; }
.m-item .title { flex: 1; margin: 0 4px 0 5px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.m-item .time { margin-right: 4px; font-size: 11px; color: var(--secondary); font-feature-settings: "tnum" 1; }
.m-item.selected, .m-item.selected .time { color: #fff; }
.m-item.selected .dot { background: #fff !important; }

/* ------------------------------------------------------------- Stundenraster */
.tg { position: absolute; inset: 0; display: flex; flex-direction: column; }
.tg-head { flex: none; height: 34px; display: flex; }
.tg-kw { width: var(--gutter); flex: none; text-align: right; padding-right: 8px; line-height: 34px; font-size: 11px;
  color: var(--secondary); }
.tg-days { flex: 1; display: grid; }
.tg-dayhead { display: flex; align-items: center; justify-content: center; gap: 5px; font-size: 14px; }
.tg-dayhead.weekend { color: var(--secondary); }
.tg-dayhead .num { min-width: 24px; height: 24px; padding: 0 5px; border-radius: 12px; display: flex; align-items: center;
  justify-content: center; font-feature-settings: "tnum" 1; }
.tg-dayhead.sel .num { background: var(--selection-bg); }
.tg-dayhead.today { font-weight: 600; color: var(--text); }
.tg-dayhead.today .num { background: var(--red); color: #fff; }
.tg-allday { flex: none; position: relative; border-bottom: 2px solid var(--allday-divider); }
.tg-allday .label { position: absolute; left: 0; width: var(--gutter); top: 5px; text-align: right; padding-right: 8px;
  font-size: 11px; color: var(--secondary); }
.tg-allday .more { top: auto; bottom: 4px; }
.tg-cols { position: absolute; left: var(--gutter); right: 0; top: 0; bottom: 0; display: grid; }
.tg-col { position: relative; border-left: 1px solid var(--grid-line); min-width: 0; }
.tg-col.weekend { background: var(--weekend-bg); }
.tg-col.sel-col { background: rgba(0, 122, 255, .035); }
.tg-items { position: absolute; left: var(--gutter); right: 0; top: 0; bottom: 0; pointer-events: none; }
.tg-items > * { pointer-events: auto; }
.allday-item { position: absolute; height: 19px; border-radius: 4px; padding: 0 4px 0 6px; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; text-align: left; overflow: hidden; white-space: nowrap; }
.allday-item span { overflow: hidden; text-overflow: ellipsis; }
.allday-item.cl { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.allday-item.cr { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.allday-item.selected { color: #fff !important; }
.tg-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; position: relative; scrollbar-width: thin; }
.tg-canvas { position: relative; }
.tg-hour { position: absolute; left: calc(var(--gutter) - 6px); right: 0; height: 1px; background: var(--hour-line);
  pointer-events: none; }
.tg-hourlabel { position: absolute; left: 0; width: calc(var(--gutter) - 11px); text-align: right; font-size: 11px;
  color: var(--secondary); transform: translateY(-50%); font-feature-settings: "tnum" 1; }
.tg-evcols { pointer-events: none; }
.tg-evcol { position: relative; min-width: 0; }
.tg-inner { position: absolute; left: 2px; right: 6px; top: 0; bottom: 0; }
.tg-inner > * { pointer-events: auto; }
/* Spaltenweise von oben: Firefox würde den Inhalt eines Knopfes sonst senkrecht mittig setzen. */
.ev { position: absolute; border-radius: 4px; overflow: hidden; text-align: left; display: flex; flex-direction: column;
  justify-content: flex-start; align-items: stretch; padding: 3px 4px 0 8px; }
.ev::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: 1.5px; background: var(--c); }
.ev.multi { box-shadow: 0 0 0 1px #fff; }
.ev .t { font-size: 12px; font-weight: 600; line-height: 1.15; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.ev .l { font-size: 11px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.ev .r { font-size: 11px; opacity: .9; display: flex; align-items: center; gap: 3px; margin-top: 1px; white-space: nowrap;
  font-feature-settings: "tnum" 1; }
.ev.compact { padding: 0 4px 0 8px; flex-direction: row; align-items: center; gap: 5px; }
.ev.compact .t { flex: 0 1 auto; min-width: 0; white-space: nowrap; text-overflow: ellipsis; display: block; }
.ev.compact .ct { flex: none; font-size: 11px; font-weight: 400; opacity: .9; font-feature-settings: "tnum" 1; }
.ev .mark { position: absolute; right: 4px; top: 4px; }
/* Einzeilig steht das Symbol als letztes Element in der Zeile (nicht frei positioniert). */
.ev.compact .mark { position: static; flex: none; margin-left: auto; }
.ev.rec { padding-right: 18px; }
.ev.rec.compact { padding-right: 4px; }
.ev.selected { color: #fff !important; }
.ev.selected::before { filter: brightness(.8); }
.now { position: absolute; left: 0; right: 0; height: 0; z-index: 10; pointer-events: none; }
.now .thin { position: absolute; left: var(--gutter); height: 1px; background: var(--red); opacity: .45; }
.now .thick { position: absolute; height: 2px; top: -.5px; background: var(--red); }
.now .knob { position: absolute; width: 8px; height: 8px; border-radius: 4px; top: -3.5px; background: var(--red); margin-left: -4px; }
.now .time { position: absolute; right: calc(100% - var(--gutter) + 6px); transform: translateY(-50%); height: 17px; padding: 0 5px;
  border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 600; line-height: 17px;
  font-feature-settings: "tnum" 1; }

/* -------------------------------------------------------------- Tagesansicht */
.dayview { position: absolute; inset: 0; display: flex; }
.dayview .tg { position: relative; flex: 1; min-width: 0; inset: auto; }
.day-panel { flex: none; width: clamp(340px, 33%, 390px); border-left: 1px solid var(--separator); padding: 2px 16px 0 18px;
  overflow-y: auto; }
.day-panel .top { display: flex; align-items: flex-start; gap: 8px; }
.day-panel .mini { margin: 0; flex: none; }
.day-panel .h-nav { padding-top: 0; margin-left: auto; flex: none; }
.info { margin: 16px -4px 0; padding: 12px 14px; border-radius: 12px; background: var(--panel-bg); user-select: text;
  -webkit-user-select: text; }
.info-none { text-align: center; margin-top: 40px; color: var(--tertiary); }

/* --------------------------------------------------------------- Jahresansicht */
.year { position: absolute; inset: 4px 20px 12px; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(3, 1fr); }
.y-month { display: flex; justify-content: center; min-width: 0; min-height: 0; }
.y-block { --d: 24px; width: calc(var(--d) * 7); }
.y-title { font-family: var(--font-display); font-size: 20px; font-weight: 600; margin: 6px 0 6px 2px; border-radius: 4px;
  cursor: pointer; display: inline-block; }
.y-title.current { color: var(--red); }
.y-grid { display: grid; grid-template-columns: repeat(7, var(--d)); }
.y-wd { text-align: center; font-size: 10px; font-weight: 600; color: var(--secondary); margin-bottom: 3px; }
.y-day { width: var(--d); height: var(--d); display: flex; align-items: center; justify-content: center; font-size: 11px;
  font-feature-settings: "tnum" 1; }
.y-day i { font-style: normal; width: calc(var(--d) - 2px); height: calc(var(--d) - 2px); border-radius: 50%; display: flex;
  align-items: center; justify-content: center; }
.y-day:hover i { background: var(--hover-bg); }
.y-day.weekend { color: var(--secondary); }
.y-day.sel i { background: var(--selection-bg); }
.y-day.today i { background: var(--red); color: #fff; font-weight: 700; }

/* ------------------------------------------------------- Infofenster / Details */
.popover { position: fixed; z-index: 50; width: 330px; background: #fff; border-radius: 14px; padding: 12px;
  border: .6px solid #D2D2D7; box-shadow: 0 5px 22px rgba(0, 0, 0, .19); user-select: text; -webkit-user-select: text; }
.popover .arrow { position: absolute; width: 14px; height: 14px; background: #fff; transform: rotate(45deg); margin-top: -7px; }
.popover.right .arrow { left: -7.5px; border-left: .6px solid #D2D2D7; border-bottom: .6px solid #D2D2D7; }
.popover.left .arrow { right: -7.5px; border-right: .6px solid #D2D2D7; border-top: .6px solid #D2D2D7; }
.box { background: var(--panel-bg); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; position: relative; }
.popover .box:last-child { margin-bottom: 0; }
.d-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; display: flex; align-items: baseline; gap: 8px;
  overflow-wrap: anywhere; }
.d-title .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.d-cal { color: var(--secondary); font-size: 11px; margin-top: 2px; }
.d-line { margin-top: 6px; overflow-wrap: anywhere; }
.d-sec { color: var(--secondary); }
.d-sep { height: 1px; background: var(--separator); margin: 7px 0; }
.d-link { display: flex; align-items: center; gap: 7px; height: 26px; }
.d-link .where { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-link svg { color: var(--secondary); }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 22px; min-width: 74px; padding: 0 14px;
  border-radius: 7px; background: #E8E8EB; font-weight: 500; text-decoration: none; color: var(--text); cursor: default; }
.btn:hover { background: var(--control-hover); }
.btn.primary { background: var(--accent); color: #fff; } .btn.primary:hover { background: #0A6FE0; }
.d-notes { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 180px; overflow-y: auto; }
.d-hint { font-size: 11px; color: var(--secondary); margin: 6px 4px 0; }
.pop-close { position: absolute; right: 6px; top: 6px; width: 22px; height: 22px; border-radius: 11px; display: flex;
  align-items: center; justify-content: center; color: var(--secondary); }
.pop-close:hover { background: var(--control-hover); }

/* ----------------------------------------------------------------------- Menü */
.menu { position: fixed; z-index: 70; min-width: 150px; padding: 5px; background: #FBFBFC; border-radius: 8px;
  border: .5px solid #CFCFD4; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); }
.menu button { display: flex; align-items: center; gap: 8px; width: 100%; height: 24px; padding: 0 14px 0 8px; border-radius: 4px;
  text-align: left; white-space: nowrap; }
.menu button:hover:not(:disabled), .menu button:focus-visible { background: var(--accent); color: #fff; outline: none; }
.menu button:disabled { color: var(--tertiary); }
.menu .noicon { width: 14px; }
.menu hr { border: 0; height: 1px; background: var(--separator); margin: 4px 0; }
.menu .who { padding: 3px 8px 5px; font-size: 11px; color: var(--secondary); }

/* ------------------------------------------------------- Rückfragen und Blätter */
.modal { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, .08); display: flex; align-items: center;
  justify-content: center; padding: 16px; }
.alert, .sheet { background: #F9F9FA; border-radius: 16px; border: .5px solid #CFCFD4; box-shadow: 0 8px 24px rgba(0, 0, 0, .31);
  padding: 22px; max-height: 100%; overflow-y: auto; }
.alert { width: 470px; max-width: 100%; }
.sheet { width: 560px; max-width: 100%; }
.alert-title, .sheet-title { font-weight: 700; font-size: 15px; }
.alert-text { margin-top: 8px; }
.sheet-body { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.alert-buttons { margin-top: 18px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.btn.big { height: 26px; min-width: 88px; }
.btn.destructive { color: var(--red); }
.cf-card { margin: 0; padding: 10px 12px; }
.cf-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 8px 0; }
.cf-side { min-width: 0; overflow-wrap: anywhere; }
.cf-head { font-size: 11px; font-weight: 600; color: var(--secondary); }
.cf-title { font-weight: 600; }
.cf-gone { font-style: italic; color: var(--red); }
.cf-buttons { display: flex; flex-wrap: wrap; gap: 8px; }

/* ------------------------------------------------------------ Bearbeiten */
.popover.edit { width: 340px; }
.popover input, .popover select, .popover textarea { font: inherit; color: inherit; }
.e-head { display: flex; align-items: center; gap: 8px; }
.popover .e-title { flex: 1; min-width: 0; border: 0; background: transparent; padding: 0; font-family: var(--font-display);
  font-size: 18px; font-weight: 700; }
.e-line, .e-notes { width: 100%; border: 0; background: transparent; padding: 0; }
.e-notes { resize: none; display: block; min-height: 36px; line-height: 1.35; }
.e-title:focus-visible, .e-line:focus-visible, .e-notes:focus-visible { outline: none; }
.popover ::placeholder { color: #AEAEB2; }
.e-calwrap { flex: none; display: flex; align-items: center; gap: 5px; height: 22px; padding: 0 2px 0 8px; border-radius: 6px;
  background: var(--control-bg); max-width: 130px; }
.e-calwrap .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.e-cal { border: 0; background: transparent; min-width: 0; max-width: 100px; height: 22px; text-overflow: ellipsis; }
.e-summary { display: block; width: 100%; text-align: left; cursor: pointer; line-height: 1.5; font-feature-settings: "tnum" 1;
  border-radius: 6px; }
.e-form { display: grid; grid-template-columns: auto 1fr; gap: 5px 8px; align-items: center; }
.e-label { text-align: right; color: var(--secondary); white-space: nowrap; }
.e-ctl { display: flex; align-items: center; gap: 2px; min-width: 0; }
.e-ctl input, .e-ctl select { height: 22px; border: 0; border-radius: 5px; background: transparent; padding: 0 4px; max-width: 100%;
  font-feature-settings: "tnum" 1; }
.e-ctl input:hover, .e-ctl select:hover { background: #E9E9EC; }
.e-ctl input:focus-visible, .e-ctl select:focus-visible { background: #fff; outline: 2px solid var(--accent); outline-offset: 0; }
.e-ctl input[type="checkbox"] { width: 14px; height: 14px; margin: 0 4px; accent-color: var(--accent); }
.e-ctl select { max-width: 200px; }
.e-count { width: 52px; }
.e-time { width: 50px; text-align: center; }
.e-datewrap { display: inline-flex; align-items: center; position: relative; }
.e-date { width: 84px; }
.e-pick { width: 20px; height: 22px; display: flex; align-items: center; justify-content: center; color: var(--secondary); border-radius: 5px; }
.e-pick:hover { background: #E9E9EC; }
.e-ctl .e-native { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; padding: 0; opacity: 0; pointer-events: none; }
.ghost { position: absolute; z-index: 6; border-radius: 4px; background: rgba(10, 122, 255, .2); border: 1px solid var(--accent);
  pointer-events: none; }
.ghost span { position: absolute; left: 6px; top: 3px; font-size: 11px; font-weight: 600; color: var(--accent);
  font-feature-settings: "tnum" 1; white-space: nowrap; }
.grip { position: absolute; left: 0; right: 0; height: 6px; cursor: ns-resize; }
.grip.top { top: 0; } .grip.bottom { bottom: 0; }
.tg-allday .tg-col.drop, .m-cell.drop { background: #DCE9FD; }
body.dragging, body.dragging * { cursor: grabbing !important; }
body.dragging .grip { cursor: ns-resize !important; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 80; max-width: min(520px, 90vw);
  padding: 9px 16px; border-radius: 10px; background: rgba(40, 40, 44, .94); color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.25); }

/* -------------------------------------------------------------------- Anmeldung */
body.login { display: flex; align-items: center; justify-content: center; background: #F4F4F6; overflow: auto; }
.login-card { width: 340px; margin: 24px; padding: 28px 28px 24px; background: #fff; border-radius: 16px;
  border: .5px solid #DADADF; box-shadow: 0 8px 30px rgba(0, 0, 0, .10); }
.login-card h1 { font-family: var(--font-display); font-size: 24px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.2px; }
.login-card p { margin: 0 0 18px; color: var(--secondary); }
.login-card label { display: block; font-size: 12px; font-weight: 500; margin: 12px 0 4px; }
.login-card input { width: 100%; height: 32px; padding: 0 10px; border-radius: 7px; border: 1px solid #C9C9CE; font: inherit;
  color: inherit; background: #fff; }
.login-card input:focus { border-color: var(--accent); outline: 3px solid rgba(10, 122, 255, .25); outline-offset: 0; }
.login-card button { width: 100%; height: 32px; margin-top: 20px; border-radius: 7px; background: var(--accent); color: #fff;
  font-weight: 600; }
.login-card button:hover { background: #0A6FE0; } .login-card button:disabled { opacity: .5; }
.login-error { min-height: 18px; margin-top: 12px; color: #D70015; font-size: 12px; }

/* Farben eines Termins kommen als Variablen (--c Kalenderfarbe, --fill getönte Fläche, --tc dunkle Schrift). */
.ev, .allday-item, .m-item.bar { background: var(--fill); color: var(--tc); }
.ev.selected, .allday-item.selected, .m-item.selected { background: var(--c); color: #fff; }
.m-item .dot { background: var(--c); }
.tg-allday .tg-cols, .tg-allday .tg-items { right: var(--sbw, 0px); }
.tg-days { margin-right: var(--sbw, 0px); }


/* ------------------------------------------------------------------- Suche */
.search { position: relative; display: flex; align-items: center; height: 34px; width: 190px; padding: 0 10px; gap: 6px;
  border-radius: 17px; background: var(--glass-bg); border: .5px solid var(--glass-border); box-shadow: 0 1px 6px rgba(0, 0, 0, .15);
  color: var(--secondary); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; color: var(--text); outline: none;
  user-select: text; -webkit-user-select: text; }
.search input::-webkit-search-cancel-button { display: none; }
.search:focus-within { outline: 3px solid rgba(10, 122, 255, .6); outline-offset: 1px; }
.search-results { position: absolute; right: 0; top: 40px; width: 340px; max-height: 60vh; overflow-y: auto; z-index: 60; padding: 5px;
  background: #FBFBFC; border-radius: 10px; border: .5px solid #CFCFD4; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); color: var(--text); }
.search-item { display: flex; gap: 8px; align-items: baseline; width: 100%; padding: 4px 8px; border-radius: 6px; text-align: left; }
.search-item.active { background: var(--accent); color: #fff; }
.search-item .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.search-item .main { min-width: 0; }
.search-item .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-item .sub { font-size: 11px; opacity: .75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-none { padding: 6px 8px; color: var(--secondary); }
@media (max-width: 900px) { .search { width: 120px; } }

/* --------------------------------------------------------- Formulare in Blättern */
.sheet.wide { width: 640px; }
.sheet input, .sheet select, .sheet textarea { font: inherit; color: inherit; }
.sheet.busy { cursor: progress; }
.sheet-error { color: #D70015; font-size: 12px; min-height: 0; margin-top: 8px; }
.sheet-error:empty { display: none; }
.form { display: grid; grid-template-columns: auto 1fr; gap: 9px 10px; align-items: center; }
.f-label { text-align: right; white-space: nowrap; }
.f-ctl { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.f-ctl input[type="text"], .f-ctl input[type="url"], .f-ctl input[type="password"] { flex: 1; min-width: 180px; height: 26px;
  padding: 0 8px; border-radius: 6px; border: 1px solid #C9C9CE; background: #fff; user-select: text; -webkit-user-select: text; }
.f-ctl select { height: 26px; padding: 0 6px; border-radius: 6px; border: 1px solid #C9C9CE; background: #fff; max-width: 100%; }
.f-ctl input:focus-visible, .f-ctl select:focus-visible { border-color: var(--accent); outline: 3px solid rgba(10, 122, 255, .25); outline-offset: 0; }
.f-num { width: 60px; height: 26px; padding: 0 6px; border-radius: 6px; border: 1px solid #C9C9CE; background: #fff; }
.f-note { font-size: 11px; color: var(--secondary); line-height: 1.4; max-width: 440px; }
.f-static { overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }
.f-check { display: flex; align-items: center; gap: 8px; }
.f-check input, .f-ctl input[type="checkbox"] { width: 14px; height: 14px; margin: 0; accent-color: var(--accent); }
.f-stack { display: flex; flex-direction: column; gap: 10px; }
.sheet .e-datewrap input { height: 26px; width: 92px; padding: 0 6px; border-radius: 6px; border: 1px solid #C9C9CE; background: #fff; flex: none; min-width: 0; }
.sheet .e-native { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.day-toggles { display: flex; gap: 4px; }
.day-toggles button { width: 28px; height: 26px; border-radius: 6px; border: 1px solid #C9C9CE; background: #fff; font-weight: 500; }
.day-toggles button[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.segmented.inline { position: static; transform: none; align-self: center; margin-bottom: 6px; }
.segmented.inline button { min-width: 0; padding: 0 14px; }
.segmented.inline button[aria-selected="true"] { background: var(--segment-selected); font-weight: 600; }
.acc-card { margin: 0; display: flex; flex-direction: column; gap: 3px; overflow-wrap: anywhere; }
.acc-name { font-weight: 600; }
.acc-card .cf-buttons { margin-top: 6px; }
.actions { display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; align-items: center; }
.f-action { min-width: 250px; }
.keys { display: grid; grid-template-columns: 1fr auto; gap: 5px 16px; max-height: 52vh; overflow-y: auto; padding-right: 6px; }
.keys-group { grid-column: 1 / -1; font-size: 11px; font-weight: 600; color: var(--secondary); margin-top: 8px; }
.keys-key { color: var(--secondary); text-align: right; white-space: nowrap; }
.menu .swatch { width: 10px; height: 10px; border-radius: 50%; margin: 0 2px; flex: none; }
.menu .tick { margin-left: auto; padding-left: 10px; }
button:disabled.btn { opacity: .5; }

/* -------------------------------------------------------------------- Drucken */
@media print {
  @page { size: landscape; margin: 10mm; }
  html, body { height: auto; overflow: visible; background: #fff; }
  #sidebar, #toolbar, .h-nav, .popover, .menu, .modal, .toast, .day-panel, .grip { display: none !important; }
  #app { display: block; height: 100vh; }
  #content { height: 100vh; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
