*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0e17;
  --panel: #111726;
  --panel-2: #0d121e;
  --surface: #161d2e;
  --border: #1f2940;
  --border-soft: #1a2336;
  --text: #e6ebf5;
  --muted: #8b97ad;
  --accent: #3b82f6;
  --accent-2: #2563eb;
  --green: #22c55e;
  --amber: #f59e0b;
  --purple: #a855f7;
  --teal: #14b8a6;
  --red: #ef4444;
  --radius: 12px;
}

html.light {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --panel-2: #ffffff;
  --surface: #eef1f8;
  --border: #dde3ef;
  --border-soft: #e6eaf3;
  --text: #1a2233;
  --muted: #647088;
}

html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: -apple-system, 'Segoe UI', 'Inter', system-ui, sans-serif;
  font-size: 14px; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; }

/* ===== Layout ===== */
#layout { display: grid; grid-template-columns: 248px 1fr; height: 100vh; }
#sidebar { background: var(--panel-2); border-right: 1px solid var(--border); display: flex; flex-direction: column;
  padding: 18px 14px; gap: 16px; overflow-y: auto; }
#content { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
#main { flex: 1; overflow-y: auto; padding: 22px 26px; }

/* ===== Brand + Nav ===== */
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; font-weight: 700; padding: 4px 8px; }
.brand-logo { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; color: #fff; font-weight: 800; }
#sidenav { display: flex; flex-direction: column; gap: 3px; }
.sidenav-gruppe { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  font-weight: 700; padding: 14px 12px 4px; }
.sidenav-gruppe:first-child { padding-top: 2px; }
.sidenav-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 9px;
  color: var(--muted); cursor: pointer; font-weight: 500; transition: all .15s; }
.sidenav-item svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.sidenav-item:hover { background: var(--surface); color: var(--text); }
.sidenav-item.active { background: var(--accent-2); color: #fff; box-shadow: 0 4px 14px rgba(37,99,235,.35); }

.quick { margin-top: auto; display: flex; flex-direction: column; gap: 7px; }
.quick-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 2px; }
.quick-btn { text-align: left; background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 9px 12px; border-radius: 9px; cursor: pointer; transition: all .15s; }
.quick-btn:hover { border-color: var(--accent); color: #fff; }

/* ===== Sidebar foot: User ===== */
.side-foot { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.side-user { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--purple));
  display: grid; place-items: center; font-weight: 700; color: #fff; font-size: .78rem; }
.su-name { font-weight: 600; font-size: .82rem; }
.su-role { color: var(--muted); font-size: .72rem; }

/* ===== Topbar ===== */
#topbar { display: flex; align-items: center; justify-content: space-between;
  padding: 18px 26px; border-bottom: 1px solid var(--border); }
.top-titel { display: flex; align-items: center; gap: 12px; min-width: 0; }
/* Der Menüknopf existiert nur für schmale Bildschirme — am Rechner bleibt die Leiste ohnehin stehen. */
#nav-toggle { display: none; flex: none; }
#nav-backdrop { display: none; position: fixed; inset: 0; z-index: 299; background: rgba(0,0,0,.45); }
#page-title { font-size: 1.5rem; font-weight: 700; }
#page-sub { color: var(--muted); font-size: .85rem; }
#top-search { background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 9px 14px; border-radius: 9px; width: 240px; outline: none; }
#top-search:focus { border-color: var(--accent); }
.top-search-wrap { position: relative; display: inline-block; }
#top-search-results { display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
  min-width: 320px; max-width: 420px; max-height: 380px; overflow: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 14px 40px -12px rgba(0,0,0,.45); padding: 6px; }
#top-search-results .ts-item { padding: 9px 12px; border-radius: 8px; cursor: pointer; }
#top-search-results .ts-item:hover { background: var(--surface); }
#top-search-results .ts-titel { font-weight: 600; font-size: .9rem; }
#top-search-results .ts-sub { color: var(--muted); font-size: .78rem; margin-top: 1px; }
#top-search-results .ts-leer { color: var(--muted); font-size: .85rem; padding: 10px 12px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn { background: var(--surface); border: 1px solid var(--border); color: var(--text);
  width: 38px; height: 38px; border-radius: 9px; font-size: 1.05rem; cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { border-color: var(--accent); }
.lang-switch { display: flex; gap: 4px; }
.lang-switch button { background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  width: 34px; height: 34px; border-radius: 8px; font-size: 1rem; cursor: pointer; display: grid; place-items: center; }
.lang-switch button.active { border-color: var(--accent); background: var(--panel); }

/* ===== Generische Bausteine ===== */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.section-block { margin-bottom: 20px; }
.section-block h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.muted { color: var(--muted); }
h2.view-h { font-size: 1.15rem; font-weight: 700; margin-bottom: 14px; }

.btn { background: var(--accent-2); border: none; color: #fff; padding: 9px 16px; border-radius: 9px;
  cursor: pointer; font-weight: 600; transition: all .15s; }
.btn:hover { background: var(--accent); }
.btn.mini { padding: 6px 11px; font-size: .8rem; font-weight: 500; }
.btn.ghost, .btn.mini.ghost { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.btn.ghost:hover { border-color: var(--accent); }
.btn.on { background: var(--accent); }
.btn.danger { background: transparent; border: 1px solid rgba(239,68,68,.5); color: #fca5a5; }
.btn.danger:hover { background: rgba(239,68,68,.15); }
a.btn.dl { text-decoration: none; display: inline-block; }

.form-row { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.form-row label { font-size: .76rem; color: var(--muted); }
.form-row input, .form-row select {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text);
  padding: 10px 12px; outline: none; }
.form-row input:focus, .form-row select:focus { border-color: var(--accent); }
.form-row input[type="date"], .form-row input[type="time"] { color-scheme: dark; }
html.light .form-row input[type="date"], html.light .form-row input[type="time"] { color-scheme: light; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 38px !important; width: 100%; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: none;
  cursor: pointer; font-size: 1rem; color: var(--muted); padding: 4px 6px; line-height: 1; }
.evform-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; }
.evform-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toast { margin-top: 8px; color: var(--green); font-size: .82rem; min-height: 16px; }

table.data { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.data th, table.data td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border-soft); }
table.data th { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }

.chip { background: var(--surface); border: 1px solid var(--border); color: var(--muted); padding: 6px 13px;
  border-radius: 20px; font-size: .78rem; cursor: pointer; transition: all .15s; }
.chip:hover { color: var(--text); }
.chip.on { background: var(--accent-2); color: #fff; border-color: transparent; }

/* ===== Kalender-View Layout ===== */
.cal-layout { display: grid; grid-template-columns: 1fr 300px; gap: 18px; }
.cal-main { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.cal-rail { display: flex; flex-direction: column; gap: 16px; }

.cal-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-bar .spacer { flex: 1; }
.cal-range { font-weight: 600; font-size: 1rem; }
.seg { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.seg button { background: transparent; border: none; color: var(--muted); padding: 8px 14px; cursor: pointer; }
.seg button.on { background: var(--accent-2); color: #fff; }

.cal-filterbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

/* Wochen-Zeitraster */
.week { display: grid; grid-template-columns: 56px repeat(7, 1fr); border: 1px solid var(--border-soft);
  border-radius: 10px; overflow: hidden; }
.week-head { background: var(--panel-2); padding: 10px 6px; text-align: center; font-size: .76rem; color: var(--muted);
  border-bottom: 1px solid var(--border-soft); border-left: 1px solid var(--border-soft); }
.week-head.today { color: var(--accent); }
.week-head .wh-num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; margin-left: 4px; font-weight: 700; color: var(--text); }
.week-head.today .wh-num { background: var(--accent-2); color: #fff; }
.week-corner { background: var(--panel-2); border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: .74rem; font-weight: 700; letter-spacing: .03em; color: var(--muted); }
.week-grid { display: contents; }
.time-col { position: relative; }
.time-label { height: 56px; text-align: right; padding-right: 8px; font-size: .7rem; color: var(--muted);
  border-top: 1px solid var(--border-soft); transform: translateY(-7px); }
.day-col { position: relative; border-left: 1px solid var(--border-soft); }
.day-col .slot { height: 56px; border-top: 1px solid var(--border-soft); }
.ev-block { position: absolute; left: 3px; right: 3px; border-radius: 7px; padding: 5px 7px; font-size: .72rem;
  overflow: hidden; cursor: pointer; border-left: 3px solid var(--c, var(--accent));
  background: color-mix(in srgb, var(--c, var(--accent)) 20%, var(--panel)); color: var(--text); }
.ev-block:hover { filter: brightness(1.2); }
.ev-block.done { opacity: .55; }
.ev-time { font-size: .66rem; opacity: .8; }
.ev-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-loc { font-size: .66rem; opacity: .75; }
.ev-phasen { display: flex; gap: 3px; margin-top: 2px; }
.ev-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }

/* Monat (Fallback) */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-wd { text-align: center; font-size: .7rem; color: var(--muted); padding-bottom: 4px; }
.cal-cell { min-height: 84px; border: 1px solid var(--border-soft); border-radius: 8px; padding: 5px; cursor: pointer; }
.cal-cell:hover { border-color: var(--accent); }
.cal-cell.out { opacity: .4; } .cal-cell.today { border-color: var(--accent); }
.cal-daynum { text-align: right; font-size: .76rem; color: var(--muted); }
.cal-chip { font-size: .64rem; padding: 2px 5px; margin-top: 2px; border-radius: 4px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; background: color-mix(in srgb, var(--c, var(--accent)) 22%, var(--panel)); border-left: 2px solid var(--c, var(--accent)); }
.cal-more { font-size: .62rem; color: var(--muted); }

/* Rechte Detail-Spalte */
.mini-month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mini-month .mm-h { text-align: center; font-size: .62rem; color: var(--muted); padding: 2px 0; }
.mini-month .mm-d { text-align: center; font-size: .74rem; padding: 5px 0; border-radius: 6px; cursor: pointer; }
.mini-month .mm-d:hover { background: var(--surface); }
.mini-month .mm-d.today { background: var(--accent-2); color: #fff; }
.mini-month .mm-d.out { color: #3a465e; }
.detail-row { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .82rem; margin-bottom: 7px; }
.detail-title { font-size: 1rem; font-weight: 700; margin-bottom: 10px; color: var(--text); }
.parts-list { display: flex; flex-direction: column; gap: 9px; }
.part { display: flex; align-items: center; gap: 9px; }
.part .pa { width: 28px; height: 28px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: .7rem; }
.check { display: flex; align-items: center; gap: 9px; padding: 6px 0; font-size: .85rem; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

/* Mitarbeiter-Strip unten */
.emp-strip { margin-top: 18px; }
.emp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.emp-card { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; }
.emp-card .avatar { width: 40px; height: 40px; }
.emp-name { font-weight: 600; }
.emp-role { color: var(--muted); font-size: .76rem; }
.emp-status { font-size: .72rem; margin-top: 3px; display: flex; align-items: center; gap: 5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.green { background: var(--green); } .dot.amber { background: var(--amber); } .dot.gray { background: #64748b; }

/* Aufmaß-Überblick aufklappbar */
.ma-block { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; padding: 4px 14px; }
.ma-block summary { cursor: pointer; display: flex; justify-content: space-between; padding: 10px 0; font-weight: 600; }
.ma-sum { color: var(--green); }

/* Karte */
#map { width: 100%; height: 64vh; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.map-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.map-pin { width: 16px; height: 16px; border-radius: 50%; cursor: pointer; background: var(--accent); border: 2px solid #fff; box-shadow: 0 0 8px rgba(0,0,0,.5); }
.map-pin.done { opacity: .5; }
.map-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 10px; padding: 8px 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; }
.leg { display: flex; align-items: center; gap: 6px; font-size: .76rem; color: var(--muted); }
.badge-status { font-size: .72rem; padding: 3px 10px; border-radius: 20px; background: rgba(245,158,11,.18); color: #fbbf24; }
.badge-status.done { background: rgba(34,197,94,.18); color: #4ade80; }
.maplibregl-popup-content { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; }
.maplibregl-popup-content strong { color: var(--accent); }

.empty, .board-empty { color: var(--muted); text-align: center; padding: 24px; }

/* Modal */
/* Wartegrund: der Termin konnte nicht wahrgenommen werden und wartet auf einen neuen Anlauf */
.warte-marke { margin-left: 8px; font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 20px;
  background: rgba(239,68,68,.14); color: #fca5a5; border: 1px solid rgba(239,68,68,.4);
  max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block;
  vertical-align: middle; }
html.light .warte-marke { color: #b91c1c; }

/* Kalenderwoche: im Kopf neben dem Zeitraum, in der Monatsansicht klein am Montag */
.kw-marke { margin-left: 10px; font-size: .72rem; font-weight: 700; letter-spacing: .03em;
  color: var(--muted); background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 2px 9px; vertical-align: middle; }
.kw-zelle { float: right; font-size: .62rem; font-weight: 700; letter-spacing: .02em;
  color: var(--muted); opacity: .75; }

.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgba(2,6,14,.7); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; }
.modal { width: min(560px, 92vw); max-height: 88vh; overflow-y: auto; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
/* Der Kopf ist zugleich der Griff: am Kopf lässt sich das Fenster zur Seite ziehen,
   wenn es verdeckt, was man darunter nachsehen möchte. */
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
  cursor: grab; touch-action: none; }
.modal-head:active { cursor: grabbing; }
.modal-head button, .modal-head input, .modal-head a { cursor: pointer; }
.modal-head h3 { font-size: 1.1rem; }
.modal-head .x { background: var(--surface); border: 1px solid var(--border); color: var(--muted); width: 30px; height: 30px;
  border-radius: 8px; cursor: pointer; }
.modal-head .x:hover { color: var(--text); }

@media (max-width: 1200px) { .cal-layout { grid-template-columns: 1fr; } }

/* Schmale Bildschirme (Tablet hochkant, halbiertes Fenster): die Seitenleiste verschwindet nicht
   ersatzlos — sie fährt als Schublade über den Inhalt, aufgerufen über den ☰-Knopf im Kopfbereich.
   Vorher war sie schlicht ausgeblendet, damit gab es unterhalb von 820px überhaupt keine
   Navigation mehr und man kam vom Dashboard nicht mehr weg. */
@media (max-width: 820px) {
  #layout { grid-template-columns: 1fr; }
  #sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 262px; z-index: 300;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.45);
  }
  body.nav-offen #sidebar { transform: none; }
  #nav-toggle { display: grid; }
  body.nav-offen #nav-backdrop { display: block; }
  #topbar { padding: 14px 16px; gap: 10px; flex-wrap: wrap; }
  #page-title { font-size: 1.25rem; }
  #top-search { width: 150px; }
  #main { padding: 16px 14px; }
}
@media (max-width: 560px) {
  .top-actions { gap: 6px; }
  #top-search { width: 110px; }
  #page-sub { display: none; }
}

/* ===== Büro-Chat-Widget (Desktop) ===== */
#chat-launcher { position: fixed; bottom: 22px; right: 22px; width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent-2); color: #fff; border: none; font-size: 1.5rem; cursor: pointer; z-index: 200;
  box-shadow: 0 6px 20px rgba(37,99,235,.45); display: flex; align-items: center; justify-content: center; }
#chat-launcher:hover { transform: scale(1.05); }
.chat-badge { background: var(--red); color: #fff; font-size: .7rem; font-weight: 700; min-width: 18px; height: 18px;
  border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }
#chat-launcher .chat-badge { position: absolute; top: -2px; right: -2px; border: 2px solid var(--bg); }
#chat-panel { position: fixed; bottom: 22px; right: 22px; width: 360px; max-width: calc(100vw - 44px);
  height: 520px; max-height: calc(100vh - 44px); background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; z-index: 201; flex-direction: column; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,.4); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border);
  font-weight: 700; background: var(--panel-2); }
.chat-head .chat-x, .chat-head .chat-back { margin-left: auto; background: none; border: none; color: var(--muted);
  font-size: 1.1rem; cursor: pointer; padding: 2px 6px; }
.chat-head .chat-back { margin-left: 0; margin-right: 2px; font-size: 1.5rem; }
.chat-head .chat-x:hover, .chat-head .chat-back:hover { color: var(--text); }
.chat-body { flex: 1; overflow-y: auto; }
#chat-threadliste .chat-thread-row { display: flex; align-items: center; gap: 11px; padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft); cursor: pointer; }
.chat-thread-row:hover { background: var(--surface); }
.chat-avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: .8rem; flex-shrink: 0; }
.chat-thread-name { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-thread-preview { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#chat-msgs { display: flex; flex-direction: column; gap: 8px; padding: 14px; }
.chat-msg { align-self: flex-start; max-width: 82%; background: var(--surface); border: 1px solid var(--border);
  border-radius: 13px; padding: 8px 12px; }
.chat-msg.eigen { align-self: flex-end; background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.chat-msg-von { font-size: .72rem; opacity: .8; margin-bottom: 2px; }
.chat-msg-text { font-size: .9rem; white-space: pre-wrap; word-break: break-word; }
.chat-msg-zeit { font-size: .66rem; opacity: .7; margin-top: 3px; text-align: right; }
.chat-input-row { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.chat-input-row input { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  color: var(--text); padding: 10px 15px; }

/* ===== Cloud: nachträglich Bilder/Dateien hinzufügen =====
   Rundes Plus unten rechts in der Ecke, darüber klappt eine Blase mit der Auswahl auf. */
/* Sitzt bewusst ÜBER dem Chat-Knopf (#chat-launcher: bottom 22px, 56px hoch) statt daneben —
   rechts 23px hält die Mittelachse beider Knöpfe bündig. */
.cloud-add { position: fixed; right: 23px; bottom: 90px; z-index: 40; }
.cloud-fab {
  width: 54px; height: 54px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--purple)); color: #fff;
  font-size: 28px; line-height: 1; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 28px -8px rgba(59, 130, 246, .65);
  transition: transform .18s ease, box-shadow .18s ease;
}
.cloud-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 32px -8px rgba(59, 130, 246, .8); }
.cloud-fab.offen { transform: rotate(45deg); }

.cloud-bubble {
  position: absolute; right: 0; bottom: 66px; width: 268px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 8px; box-shadow: 0 18px 46px -14px rgba(0, 0, 0, .55);
  animation: cloudBubbleAuf .16s ease-out;
}
/* Spitze zum Plus hin */
.cloud-bubble::after {
  content: ""; position: absolute; right: 19px; bottom: -7px; width: 12px; height: 12px;
  background: var(--panel); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  transform: rotate(45deg);
}
@keyframes cloudBubbleAuf {
  from { opacity: 0; transform: translateY(6px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.cloud-bubble-opt {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  background: none; border: none; border-radius: 10px; padding: 10px 11px; cursor: pointer;
  color: var(--text); transition: background .12s ease;
}
.cloud-bubble-opt:hover { background: var(--surface); }
.cloud-bubble-opt .cb-ico {
  width: 34px; height: 34px; flex: none; border-radius: 9px; background: var(--surface);
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.cloud-bubble-opt b { display: block; font-size: .9rem; font-weight: 600; }
.cloud-bubble-opt small { display: block; font-size: .75rem; color: var(--muted); margin-top: 1px; }

@media (max-width: 700px) {
  .cloud-bubble { width: 240px; }
}

/* ===== Monatsnachweis Arbeitszeit (druckbar) ===== */
.ztr-kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px;
  padding-bottom: 14px; border-bottom: 2px solid var(--text); margin-bottom: 14px; }
.ztr-titel { font-size: 1.15rem; font-weight: 700; }
.ztr-monat { color: var(--muted); margin-top: 2px; }
.ztr-firma { text-align: right; font-size: .82rem; line-height: 1.5; color: var(--muted); }
.ztr-person { margin-bottom: 12px; font-size: .95rem; }
.ztr-person span { color: var(--muted); }
.ztr-tab { width: 100%; border-collapse: collapse; font-size: .8rem; font-variant-numeric: tabular-nums; }
.ztr-tab th, .ztr-tab td { text-align: right; padding: 5px 7px; border-bottom: 1px solid var(--border); }
.ztr-tab th:first-child, .ztr-tab td:first-child,
.ztr-tab th:last-child, .ztr-tab td:last-child { text-align: left; }
.ztr-tab th { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  border-bottom: 1px solid var(--text); }
.ztr-tab tfoot td { border-top: 2px solid var(--text); border-bottom: none; padding-top: 9px; font-size: .85rem; }
.ztr-leer td { color: var(--muted); }
.ztr-we td:first-child { color: var(--muted); }
.ztr-hinweis { color: var(--amber); font-size: .72rem; }
.ztr-recht { margin-top: 18px; font-size: .68rem; line-height: 1.55; color: var(--muted);
  border-top: 1px solid var(--border); padding-top: 10px; }
.ztr-sign { display: flex; gap: 40px; margin-top: 34px; font-size: .72rem; color: var(--muted); }
.ztr-sign > div { flex: 1; }
.ztr-line { border-bottom: 1px solid var(--text); margin-bottom: 5px; height: 30px; }
.ztr-fuss { margin-top: 16px; font-size: .68rem; color: var(--muted); }

/* Beim Drucken bleibt nur das Blatt übrig — ohne App-Rahmen, Chat-Knopf und Schaltflächen. */
@media print {
  body.drucken { background: #fff; }
  body.drucken #layout, body.drucken #chat-launcher, body.drucken #chat-panel,
  body.drucken .cloud-add, body.drucken .no-print { display: none !important; }
  body.drucken .modal-bg { position: static; background: none; backdrop-filter: none; display: block !important; }
  body.drucken .modal { max-width: none !important; width: auto !important; max-height: none !important;
    border: none !important; box-shadow: none !important; background: #fff !important; overflow: visible !important; }
  body.drucken .modal-body { padding: 0 !important; }
  body.drucken #zt-report { color: #000; }
  body.drucken #zt-report .ztr-monat, body.drucken #zt-report .ztr-firma,
  body.drucken #zt-report .ztr-recht, body.drucken #zt-report .ztr-fuss,
  body.drucken #zt-report .ztr-sign, body.drucken #zt-report .ztr-tab th { color: #444; }
  body.drucken #zt-report .ztr-hinweis { color: #8a5a00; }
  body.drucken #zt-report .ztr-kopf, body.drucken #zt-report .ztr-tab th,
  body.drucken #zt-report .ztr-tab tfoot td, body.drucken #zt-report .ztr-line { border-color: #000; }
  body.drucken #zt-report .ztr-tab td { border-color: #ccc; }
  .ztr-tab { page-break-inside: auto; }
  .ztr-tab tr { page-break-inside: avoid; }
}

/* ===== Kleines "i" für Bedienhinweise ===== */
.hilfe-i {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  width: 18px; height: 18px; margin-left: 7px; padding: 0;
  border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: 11px; font-weight: 700; font-style: italic;
  font-family: Georgia, "Times New Roman", serif; line-height: 1; cursor: help;
  transition: color .15s ease, border-color .15s ease;
}
.hilfe-i:hover { color: var(--accent); border-color: var(--accent); }
.hilfe-blase {
  position: absolute; z-index: 300; background: var(--panel);
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
  font-size: .82rem; line-height: 1.55; color: var(--text); font-weight: 400;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .55);
  animation: hilfeAuf .14s ease-out;
}
@keyframes hilfeAuf {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media print { .hilfe-i, .hilfe-blase { display: none !important; } }

/* Zahlvermerk aus dem Aufmaß-Abgleich: „gezahlt am 30.07.2026" — rot, damit beim Durchsehen einer
   Liste sofort auffällt, was der Auftraggeber bereits bezahlt hat. Klickbar (mit Preisrecht), um
   den Vermerk wieder zurückzunehmen. */
.gezahlt-marke {
  display: inline-block; margin-left: 8px; padding: 2px 9px; border-radius: 20px;
  background: rgba(239, 68, 68, .13); border: 1px solid rgba(239, 68, 68, .38);
  color: var(--red); font-size: .72rem; font-weight: 600; white-space: nowrap; vertical-align: middle;
}
.gezahlt-marke[data-gezahlt-weg] { cursor: pointer; }
.gezahlt-marke[data-gezahlt-weg]:hover { background: rgba(239, 68, 68, .24); }

/* Prüffenster des Aufmaß-Abgleichs: links die Adresse aus dem PDF, rechts der Systemeintrag.
   Zeile anklicken klappt die Einzelheiten auf; das Häkchen davor entscheidet, was zusammengeführt
   wird. */
.pruef-kopf { display: flex; gap: 10px; align-items: center; padding: 0 10px 6px;
  color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.pruef-kopf > span:first-child { width: 22px; flex: none; }
.pruef-spalten { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: center; flex: 1; min-width: 0; }
.pruef-zeile { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap;
  padding: 9px 10px; border: 1px solid var(--border-soft); border-radius: 10px; margin-bottom: 6px;
  cursor: pointer; transition: background .12s, border-color .12s; }
.pruef-zeile:hover { background: var(--surface); }
.pruef-zeile.offen { border-color: var(--border); background: var(--surface); }
.pruef-haken { display: flex; align-items: center; padding-top: 2px; cursor: pointer; }
.pruef-haken input { width: 17px; height: 17px; cursor: pointer; }
.pruef-details { flex-basis: 100%; margin-top: 8px; }
@media (max-width: 720px) {
  .pruef-spalten { grid-template-columns: 1fr; gap: 4px; }
  .pruef-kopf { display: none; }
}

/* Kleines Zeichen für Listen und Kalenderkacheln: „bezahlt". Kurz genug, um neben einer Adresse
   Platz zu finden, auffällig genug, um beim Überfliegen einer Liste hängenzubleiben. Das Datum
   steht im Tooltip; die ausgeschriebene Marke (.gezahlt-marke) steht in den Detailansichten. */
.gezahlt-zeichen {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; margin-left: 5px; border-radius: 50%;
  background: var(--red); color: #fff; font-size: .62rem; font-weight: 800;
  line-height: 1; vertical-align: middle; flex: none; cursor: help;
}
.ev-title .gezahlt-zeichen, .cal-chip .gezahlt-zeichen { width: 13px; height: 13px; font-size: .58rem; margin-left: 4px; }
@media print { .gezahlt-zeichen { background: none; color: var(--red); border: 1px solid var(--red); } }

/* Rollen-Auswahl direkt auf der Mitarbeiterkarte: sieht im Ruhezustand wie die bisherige
   Rollen-Zeile aus und gibt sich erst beim Überfahren als Auswahlfeld zu erkennen — die Karte soll
   nicht zum Formular werden. */
.rolle-wahl {
  margin-top: 2px; padding: 2px 22px 2px 6px; border: 1px solid transparent; border-radius: 7px;
  background: transparent; color: var(--muted); font-size: .8rem; font-family: inherit;
  cursor: pointer; max-width: 100%;
}
.rolle-wahl:hover, .rolle-wahl:focus { border-color: var(--border); background: var(--panel); color: var(--text); }
.rolle-wahl:disabled { opacity: .5; cursor: wait; }

/* Zeiterfassung: Personalübersicht */
.zt-personal tr[data-ma]:hover { background: var(--surface); cursor: pointer; }
.zt-punkt { width: 9px; height: 9px; border-radius: 50%; background: var(--border); flex: none; display: inline-block; }
.zt-punkt.an { background: var(--green); box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
.zt-punkt.pause { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.18); }
.abw-status { font-size: .72rem; padding: 2px 9px; border-radius: 20px; border: 1px solid var(--border); white-space: nowrap; }
.abw-status.beantragt { background: rgba(245,158,11,.15); color: #b45309; border-color: rgba(245,158,11,.35); }
.abw-status.genehmigt { background: rgba(34,197,94,.15); color: #15803d; border-color: rgba(34,197,94,.35); }
.abw-status.abgelehnt { background: rgba(239,68,68,.12); color: #b91c1c; border-color: rgba(239,68,68,.3); }

/* Feiertage: kompakte Chips, vergangene blasser */
.feiertag-chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 5px 12px; font-size: .8rem; white-space: nowrap;
}
.feiertag-chip.vorbei { opacity: .45; }

/* Aktualisieren-Knopf: dreht sich, solange nachgeladen wird */
#reload-btn.dreht { animation: reloadDreh .5s linear infinite; }
@keyframes reloadDreh { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ── Termine per Ziehen verschieben + Klick ins Raster ─────────────────────
   Beides ersetzt Umwege über das Bearbeiten-Formular: einen Termin verschiebt man,
   indem man ihn anfasst, und einen neuen legt man an, indem man auf die freie Stelle
   tippt, an der er hingehört. */

/* Der Griff wird erst beim Überfahren sichtbar — sonst sieht das Raster unruhig aus. */
.ev-block { touch-action: none; }              /* sonst scrollt das Tablet statt zu ziehen */
.ev-block.ziehbar:hover { cursor: grab; }
.ev-block.zieht {
  cursor: grabbing; z-index: 40; opacity: .9;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  filter: brightness(1.15);
  /* Während des Ziehens darf der Block keine Zeiger-Ereignisse abfangen, sonst findet
     elementFromPoint immer nur ihn selbst und nie die Spalte darunter. */
  pointer-events: none;
}
/* Wo der Termin landen würde — als Umriss an der eingerasteten Position. */
.ziel-umriss {
  position: absolute; left: 3px; right: 3px; z-index: 30; pointer-events: none;
  border: 2px dashed var(--accent); border-radius: 7px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
/* Die neue Uhrzeit klebt am Umriss — man soll nicht raten müssen, wo man landet. */
.ziel-zeit {
  position: absolute; z-index: 41; pointer-events: none;
  background: var(--accent); color: #fff; font-size: .7rem; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  transform: translateY(-50%); box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
/* Spalte, in der man gerade landen würde — wichtig beim Schieben auf einen anderen Tag. */
.day-col.ziel-spalte { background: color-mix(in srgb, var(--accent) 6%, transparent); }

/* Klick ins freie Raster: zeigt beim Überfahren, welche Viertelstunde getroffen wird. */
.neu-marke {
  position: absolute; left: 3px; right: 3px; z-index: 5; pointer-events: none;
  height: 14px;                                  /* eine Viertelstunde bei SLOT=56 */
  border-top: 2px solid var(--accent); opacity: .55;
}
.neu-marke::after {
  content: attr(data-zeit); position: absolute; left: 4px; top: 1px;
  font-size: .64rem; font-weight: 700; color: var(--accent);
}
.day-col:hover { cursor: copy; }
.ev-block { cursor: pointer; }                   /* auf dem Block gilt weiter der Zeiger */
