/* TEKRO LIMITED – Kalender */

:root {
  --bg: #f3f4f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eef0f4;
  --border: #e3e6eb;
  --border-strong: #cdd2da;
  --line: #e6e8ec;
  --line-soft: #f1f2f5;
  --text: #18202e;
  --muted: #687385;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-soft: #e7eefd;
  --today: #f4f7ff;
  --weekend: #fafbfc;
  --now: #e5484d;
  --danger: #c22a2a;
  --success: #15803d;
  --warn: #b45309;
  --shadow: 0 12px 32px rgba(16, 24, 40, 0.16);
  --shadow-sm: 0 2px 8px rgba(16, 24, 40, 0.12);
  --slot-h: 26px;
  --gutter: 58px;
  --radius: 8px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1015;
    --surface: #151920;
    --surface-2: #1a1f27;
    --surface-3: #222833;
    --border: #2a303b;
    --border-strong: #39414e;
    --line: #262c36;
    --line-soft: #1d222a;
    --text: #e7e9ed;
    --muted: #98a1b0;
    --accent: #5b8cff;
    --accent-hover: #7aa2ff;
    --accent-soft: #1c2840;
    --today: #18202e;
    --weekend: #171b22;
    --now: #ff6369;
    --danger: #ff7a7a;
    --success: #4ade80;
    --warn: #fbbf24;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

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

a { color: var(--accent); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; }
kbd { font: 12px ui-monospace, Consolas, monospace; padding: 1px 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); }

/* ---------- Buttons & Eingaben ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--surface-3); }
.btn:focus-visible, .chip:focus-visible, .icon-btn:focus-visible, .link-btn:focus-visible, .strip-day:focus-visible, .ev:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border-strong)); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.small { height: 28px; padding: 0 9px; font-size: 13px; }
.btn.block { width: 100%; height: 40px; }

.icon-btn {
  flex: none;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

.link-btn {
  border: 0;
  background: none;
  padding: 2px 4px;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

input, select, textarea {
  width: 100%;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 400;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type="color"] { width: 40px; height: 34px; padding: 2px; cursor: pointer; flex: none; }
input[type="color"]:disabled { opacity: 0.4; cursor: not-allowed; }
input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }

/* ---------- Kopfzeile ---------- */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; margin-right: 6px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1d4ed8, #1e3a8a);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 13px; letter-spacing: 0.06em; }
.brand-text span { font-size: 12px; color: var(--muted); }

.week-nav { display: flex; align-items: center; gap: 6px; }
.date-picker { width: auto; height: 34px; padding: 4px 8px; }

.week-title { display: flex; align-items: baseline; gap: 10px; font-size: 16px; font-weight: 600; }
.kw {
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.loading {
  align-self: center;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

/* ---------- Legende / Filter ---------- */

.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.legend-title { margin-right: 4px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.chip:hover { border-color: var(--border-strong); }
.chip.off { opacity: 0.5; text-decoration: line-through; }
.chip.off .dot { background: transparent; box-shadow: inset 0 0 0 2px var(--c); }
.chip.static { cursor: default; height: 24px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }

/* ---------- Tagesleiste (nur Handy) ---------- */

.day-strip {
  display: none;
  align-items: stretch;
  gap: 2px;
  padding: 6px 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.strip-nav {
  flex: none;
  width: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
}
.strip-day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.strip-day .wd { font-size: 11px; color: var(--muted); }
.strip-day .num { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.strip-day .marks { width: 5px; height: 5px; border-radius: 50%; }
.strip-day .marks.has { background: var(--muted); }
.strip-day.today .num { color: var(--accent); }
.strip-day.sel { background: var(--accent); }
.strip-day.sel .wd, .strip-day.sel .num { color: #fff; }
.strip-day.sel .marks.has { background: #fff; }

/* ---------- Kalenderraster ---------- */

.calendar {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--surface);
  overscroll-behavior: contain;
}

.cal-grid {
  display: grid;
  grid-template-columns: var(--gutter) repeat(7, minmax(118px, 1fr));
  min-width: min-content;
}

.corner {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 6;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.corner { display: flex; align-items: flex-end; justify-content: flex-end; }
.allday-label { padding: 0 6px 9px 0; font-size: 10px; color: var(--muted); }

.day-head {
  position: sticky;
  top: 0;
  z-index: 5;
  min-width: 0;
  padding: 9px 4px 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--line);
  font-weight: 600;
}
.day-label { text-align: center; white-space: nowrap; }
.allday { display: flex; flex-direction: column; gap: 3px; margin-top: 7px; }
.allday-ev {
  display: block;
  width: 100%;
  padding: 3px 6px;
  border: 0;
  border-left: 3px solid var(--ev);
  border-radius: 4px;
  background: color-mix(in srgb, var(--ev) 18%, var(--surface));
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.allday-ev:hover { background: color-mix(in srgb, var(--ev) 28%, var(--surface)); }
.allday-ev.st-tentative { outline: 1px dashed var(--ev); outline-offset: -1px; }
.allday-ev.st-cancelled { opacity: 0.55; text-decoration: line-through; }
.day-head .wd { color: var(--muted); font-weight: 500; }
.day-head .dt { font-variant-numeric: tabular-nums; }
.day-head.today .wd { color: var(--accent); font-weight: 700; }
.day-head.today .dt { padding: 2px 8px; border-radius: 999px; background: var(--accent); color: #fff; }

.gutter {
  position: sticky;
  left: 0;
  z-index: 4;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.gutter-label {
  position: relative;
  height: var(--slot-h);
  padding-right: 8px;
  text-align: right;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.gutter-label span { position: relative; top: -0.7em; }
.gutter-label:first-child span { top: 2px; }
.gutter-label.half { font-size: 10px; opacity: 0.55; }

.day-col {
  position: relative;
  height: calc(var(--slots) * var(--slot-h));
  border-right: 1px solid var(--line);
  background-color: var(--surface);
  background-image: linear-gradient(
    to bottom,
    transparent calc(var(--slot-h) - 1px),
    var(--line-soft) calc(var(--slot-h) - 1px),
    var(--line-soft) var(--slot-h),
    transparent var(--slot-h),
    transparent calc(2 * var(--slot-h) - 1px),
    var(--line) calc(2 * var(--slot-h) - 1px)
  );
  background-size: 100% calc(2 * var(--slot-h));
  cursor: cell;
}
.day-col.weekend { background-color: var(--weekend); }
.day-col.today { background-color: var(--today); }

.slot-ghost {
  position: absolute;
  left: 2px;
  right: 2px;
  z-index: 0;
  padding: 2px 6px;
  border: 1px dashed var(--accent);
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
}

.now-line {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 4;
  height: 2px;
  margin-top: -1px;
  background: var(--now);
  pointer-events: none;
}
.now-line::before {
  content: "";
  position: absolute;
  left: -5px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--now);
}

/* ---------- Termine ---------- */

.ev {
  position: absolute;
  z-index: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 3px 6px 3px 7px;
  border: 1px solid color-mix(in srgb, var(--ev) 35%, transparent);
  border-left: 4px solid var(--ev);
  border-radius: 6px;
  background: color-mix(in srgb, var(--ev) 15%, var(--surface));
  color: var(--text);
  font-size: 12px;
  line-height: 1.25;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: box-shadow 0.12s;
}
.ev:hover { z-index: 3; box-shadow: var(--shadow-sm); }
.ev-title {
  flex: none;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: var(--lines, 3);
  -webkit-box-orient: vertical;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.ev.one-line .ev-title { display: block; white-space: nowrap; text-overflow: ellipsis; }
.ev-time, .ev-company {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.ev-company { color: color-mix(in srgb, var(--ev) 55%, var(--text)); font-weight: 500; }

.ev.compact { flex-direction: row; align-items: baseline; gap: 5px; padding-top: 1px; padding-bottom: 1px; }
.ev.compact .ev-time { order: -1; flex: none; }
.ev.compact .ev-title { flex: 1 1 auto; min-width: 0; display: block; white-space: nowrap; text-overflow: ellipsis; }
.ev.compact .ev-company { display: none; }

.ev.st-tentative {
  border-style: dashed;
  border-left-style: dashed;
  border-color: color-mix(in srgb, var(--ev) 75%, transparent);
  background: repeating-linear-gradient(
    -45deg,
    color-mix(in srgb, var(--ev) 8%, var(--surface)) 0 6px,
    color-mix(in srgb, var(--ev) 16%, var(--surface)) 6px 12px
  );
}
.ev.st-cancelled { opacity: 0.55; background: color-mix(in srgb, var(--ev) 6%, var(--surface)); }
.ev.st-cancelled .ev-title { text-decoration: line-through; }

.ev.clip-top { border-top: 2px dotted var(--ev); border-top-left-radius: 0; border-top-right-radius: 0; }
.ev.clip-bottom { border-bottom: 2px dotted var(--ev); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }

.ev-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; cursor: ns-resize; }
.ev.dragging {
  z-index: 20;
  left: 2px !important;
  width: calc(100% - 4px) !important;
  opacity: 0.92;
  box-shadow: var(--shadow);
  cursor: grabbing;
}
.ev.flash { animation: flash 1.5s ease-out; }
@keyframes flash {
  0%, 40% { box-shadow: 0 0 0 3px var(--ev); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
/* Verschieben-Modus */
.ev.moving {
  z-index: 4;
  cursor: grab;
  box-shadow: 0 0 0 2px var(--ev), var(--shadow);
  animation: moving-pulse 1.6s ease-in-out infinite;
}
@keyframes moving-pulse {
  50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--ev) 35%, transparent), var(--shadow); }
}
body.is-moving .ev:not(.moving) { opacity: 0.5; }
body.is-moving .day-col { cursor: copy; }
.slot-ghost.move {
  z-index: 6;
  border: 2px dashed var(--ev);
  background: color-mix(in srgb, var(--ev) 18%, transparent);
  color: var(--text);
}

.move-bar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 10px 12px 10px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}
.move-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--ev); }
.move-text { display: flex; flex-direction: column; min-width: 0; font-size: 13px; line-height: 1.35; }
.move-text strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.move-text span { color: var(--muted); }
body.is-moving .toasts { bottom: 96px; }

body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; }
body.is-resizing, body.is-resizing * { cursor: ns-resize !important; user-select: none; }

.cal-grid.anim-next .day-col.sel { animation: slide-next 0.18s ease-out; }
.cal-grid.anim-prev .day-col.sel { animation: slide-prev 0.18s ease-out; }
@keyframes slide-next { from { transform: translateX(24px); opacity: 0.4; } }
@keyframes slide-prev { from { transform: translateX(-24px); opacity: 0.4; } }

/* ---------- Dialoge ---------- */

dialog.dialog {
  width: min(700px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
dialog.dialog.narrow { width: min(520px, calc(100vw - 32px)); }
dialog.dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgba(10, 14, 22, 0.5); }
dialog > form, .dlg-inner { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.dlg-inner:focus { outline: none; }

.dlg-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px 10px 20px; }
.dlg-head h2 { flex: 1; margin: 0; font-size: 18px; line-height: 1.3; }
.dlg-body { flex: 1; min-height: 0; overflow: auto; padding: 6px 20px 18px; }
.dlg-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 0 0 14px 14px;
}
.spacer { flex: 1; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; align-content: start; }
.form-grid label, .sub-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.span-2 { grid-column: 1 / -1; }
.span-3 { grid-column: 1 / -1; }

.time-grid { display: grid; grid-template-columns: 1.2fr 0.9fr 0.9fr 1.2fr 2fr; gap: 10px; }
.time-grid .end-date[hidden] + label { grid-column: span 2; }
.tz-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; margin-top: -6px; }
.tz-hint { margin: 0; min-height: 1.4em; font-size: 13px; color: var(--muted); }
.tz-hint.active { color: var(--accent); font-weight: 600; }

fieldset { margin: 0; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 12px; }
fieldset legend { padding: 0 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.sub-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
fieldset.plain { border: 0; padding: 0; margin: 0 0 16px; }
fieldset.plain legend { padding: 0; margin-bottom: 8px; }

.color-row { display: flex; align-items: flex-end; gap: 10px; }
.form-grid label.check { flex-direction: row; align-items: center; gap: 8px; height: 34px; color: var(--text); font-weight: 500; font-size: 14px; }

.form-error {
  margin: 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  color: var(--danger);
  font-weight: 500;
}
.hint { margin: 8px 0 0; color: var(--muted); font-size: 13px; }

/* Details */
.detail-head { position: relative; padding-top: 20px; }
.detail-head::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 6px;
  border-radius: 14px 14px 0 0;
  background: var(--ev);
}
.detail-title { flex: 1; min-width: 0; }
.detail-title h2 { margin: 6px 0 4px; word-break: break-word; }
.detail-title h2.strike { text-decoration: line-through; color: var(--muted); }
.d-when { margin: 0; font-weight: 600; }
.d-orig { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: color-mix(in srgb, var(--success) 14%, var(--surface));
  color: var(--success);
}
.badge.st-tentative { background: color-mix(in srgb, var(--warn) 15%, var(--surface)); color: var(--warn); border: 1px dashed currentColor; }
.badge.st-cancelled { background: color-mix(in srgb, var(--danger) 13%, var(--surface)); color: var(--danger); }

.join { margin: 4px 0 14px; }
.d-list { margin: 0; display: grid; gap: 2px; }
.d-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.d-row:last-child { border-bottom: 0; }
.d-row dt { color: var(--muted); font-size: 13px; font-weight: 600; }
.d-row dd { margin: 0; display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.d-value { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.notes { white-space: pre-wrap; }
.dial div + div { margin-top: 2px; }
.copy-btn {
  flex: none;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.copy-btn:hover { color: var(--text); border-color: var(--border-strong); }

/* Gruppen */
.group-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.group-row { display: flex; align-items: center; gap: 8px; }
.group-row .count { flex: none; min-width: 74px; color: var(--muted); font-size: 12px; text-align: right; }
.group-add { display: flex; gap: 8px; padding-top: 14px; border-top: 1px solid var(--border); }

.range-row { display: flex; gap: 12px; }
.range-row label { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }

/* ---------- Drop-Overlay & Toasts ---------- */

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--accent) 18%, rgba(10, 14, 22, 0.55));
  pointer-events: none;
}
.drop-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 36px 48px;
  border: 2px dashed var(--accent);
  border-radius: 18px;
  background: var(--surface);
  text-align: center;
  box-shadow: var(--shadow);
}
.drop-box svg { width: 40px; height: 40px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.drop-box strong { font-size: 18px; }
.drop-box span { color: var(--muted); }

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  padding: 10px 14px;
  border-radius: 10px;
  border-left: 4px solid var(--accent);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font-weight: 500;
  pointer-events: auto;
  animation: toast-in 0.18s ease-out;
  transition: opacity 0.3s, transform 0.3s;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast.out { opacity: 0; transform: translateY(6px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Login ---------- */

.login-page { display: grid; place-items: center; padding: 16px; overflow: auto; }
.login-card {
  width: min(380px, 100%);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.login-card h1 { margin: 22px 0 14px; font-size: 22px; }
.login-card form { display: grid; gap: 14px; }
.login-card label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.login-card input[type="password"] { height: 40px; }

/* ---------- Mittelgroße Bildschirme ---------- */

@media (max-width: 1599px) {
  .topbar { gap: 10px 12px; }
  .brand { margin-right: 0; }
  .actions .lbl-xl { display: none; }
}
@media (max-width: 1439px) {
  .week-nav .lbl { display: none; }
}
@media (max-width: 960px) {
  .actions .lbl { display: none; }
  .actions .btn { padding: 0 9px; }
}

/* ---------- Handy: Tagesansicht ---------- */

@media (max-width: 760px) {
  :root { --gutter: 46px; --slot-h: 30px; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .brand { order: 1; margin-right: 0; }
  .brand-text span { display: none; }
  .actions { order: 2; gap: 4px; }
  .actions .btn { height: 34px; width: 36px; padding: 0; }
  .week-nav { order: 3; width: 100%; }
  .week-nav .btn { flex: none; padding: 0 10px; }
  .date-picker { flex: 1; min-width: 0; }
  .week-title { order: 4; width: 100%; font-size: 14px; }
  .legend { padding: 6px 12px; gap: 4px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .legend::-webkit-scrollbar { display: none; }
  .legend .chip { flex: none; height: 26px; }
  .day-strip { display: flex; }

  .cal-grid { grid-template-columns: var(--gutter) minmax(0, 1fr); min-width: 0; }
  .day-head:not(.sel), .day-col:not(.sel) { display: none; }
  .day-col { cursor: pointer; }
  .allday-label { padding-right: 3px; font-size: 9px; }
  .allday-ev { font-size: 13px; padding: 5px 8px; }
  .toast { padding: 8px 12px; font-size: 13px; }
  .ev { font-size: 13px; }
  .ev-time, .ev-company { font-size: 12px; }

  dialog.dialog, dialog.dialog.narrow {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .dlg-foot { border-radius: 0; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .dlg-foot .btn { flex: 1 1 auto; }
  .dlg-foot .spacer { display: none; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .time-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .time-grid label:first-child, .time-grid label:last-child { grid-column: 1 / -1; }
  .time-grid .end-date[hidden] + label { grid-column: 1 / -1; }
  .sub-grid { grid-template-columns: minmax(0, 1fr); }
  .d-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .group-row { flex-wrap: wrap; }
  .group-row input:not([type="color"]) { flex: 1; }
  .toasts { left: 16px; right: 16px; align-items: stretch; max-width: none; }
  .move-bar { left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); width: auto; max-width: none; transform: none; }
  body.is-moving .toasts { bottom: 110px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
