@import url('https://fonts.googleapis.com/css2?family=Spectral:wght@400;500;600&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --ink: #1C2B33;
  --paper: #FAFAF7;
  --paper2: #F0EDE4;
  --teal: #3E7C6E;
  --amber: #C08A3E;
  --rust: #B5533C;
  --line: #D8D3C6;
  --gray: #767B72;
  --st-offen: #D98E7C;
  --st-in-arbeit: #DFB672;
  --st-erledigt: #8CBEAD;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
}
a { color: inherit; }
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  background: var(--ink);
  color: var(--paper);
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar .brand {
  display: block;
  margin-bottom: 28px;
  padding-left: 8px;
}
.brand-logo {
  display: block;
  width: 100%;
  max-width: 160px;
  height: auto;
  /* Logo ist schwarz auf transparent, für die dunkle Seitenleiste auf Weiß umfärben */
  filter: brightness(0) invert(1);
}
.nav-scroll { display: flex; flex-direction: column; gap: 4px; }
.nav-group { display: flex; flex-direction: column; gap: 4px; }
.nav-group + .nav-group { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(250,250,247,0.1); }
.nav-toggle {
  display: none;
  width: 42px; height: 42px; padding: 9px;
  flex-direction: column; justify-content: center; gap: 5px;
  background: transparent; border: none; cursor: pointer;
}
.nav-toggle span {
  display: block; width: 100%; height: 2px; border-radius: 2px;
  background: var(--paper); transition: transform .2s ease, opacity .2s ease;
}
.sidebar a.navitem,
.sidebar summary.navitem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
  color: rgba(250,250,247,0.65);
}
.sidebar a.navitem.active,
.sidebar a.navitem:hover,
.sidebar summary.navitem:hover {
  background: rgba(250,250,247,0.12);
  color: #FAFAF7;
}
.nav-settings summary.navitem { cursor: pointer; list-style: none; }
.nav-settings summary.navitem::-webkit-details-marker { display: none; }
.nav-settings summary.navitem::after { content: '▸'; margin-left: auto; font-size: 11px; opacity: .6; transition: transform .15s ease; }
.nav-settings[open] summary.navitem::after { transform: rotate(90deg); }
.nav-submenu { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; padding-left: 14px; }
.nav-submenu .navitem { font-size: 13.5px; padding: 8px 12px; }
.timer-widget {
  background: rgba(62,124,110,0.25); border: 1px solid rgba(62,124,110,0.5); border-radius: 8px;
  padding: 10px 12px; margin: 8px 0 4px;
}
.timer-label { font-size: 12.5px; font-weight: 500; color: #FAFAF7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer-project { font-size: 11px; color: rgba(250,250,247,0.6); margin-top: 1px; }
.timer-clock { font-family: 'IBM Plex Mono', monospace; font-size: 18px; color: #FAFAF7; margin: 6px 0 8px; }
.timer-note { margin: 4px 0 8px; }
.timer-note input {
  width: 100%; font-size: 12px; padding: 5px 8px; border-radius: 5px;
  background: rgba(250,250,247,0.08); border: 1px solid rgba(250,250,247,0.2); color: #FAFAF7;
}
.timer-note input::placeholder { color: rgba(250,250,247,0.4); }
.timer-rate-select {
  width: 100%; font-size: 12px; padding: 5px 8px; border-radius: 5px; margin-top: 4px;
  background: rgba(250,250,247,0.08); border: 1px solid rgba(250,250,247,0.2); color: #FAFAF7;
}
.timer-rate-select option { color: var(--ink); }
.timer-actions { display: flex; gap: 6px; }
.timer-actions .btn { flex: 1; justify-content: center; padding: 6px 8px; font-size: 12.5px; }
.timer-widget-paused { background: rgba(192,138,62,0.2); border-color: rgba(192,138,62,0.5); }

/* Kosten-Tooltip über "Preis (gesamt)" in den Lieferschein-Positionen: eigene,
   gut lesbare Box statt des winzigen nativen title-Tooltips, position:fixed
   wie bei den anderen Dropdowns im Positionen-Formular (siehe dort), damit sie
   nicht vom horizontal scrollenden Container abgeschnitten wird. */
.row-total[data-cost] { cursor: help; border-bottom: 1px dotted var(--gray); }
.move-trigger { background: none; border: none; color: var(--gray); cursor: pointer; padding: 0; justify-self: center; display: flex; align-items: center; }
.move-trigger:hover { color: var(--ink); }
/* Popover am ⋮-Button zum Verschieben einer Position in einen anderen
   Lieferschein - position:fixed wie die anderen Dropdowns in diesem Formular. */
.move-menu {
  position: fixed; z-index: 40; background: white; border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 6px 18px rgba(28,43,51,0.12);
  min-width: 220px; max-width: 320px; max-height: 260px; overflow-y: auto;
}
.move-menu button {
  display: block; width: 100%; text-align: left; background: none; border: none;
  padding: 8px 10px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.move-menu button:hover { background: var(--paper2); }
.move-menu button:not(:last-child) { border-bottom: 1px solid var(--line); }
.move-menu button.move-menu-back { color: var(--gray); font-size: 12px; background: var(--paper2); }
.cost-tooltip {
  position: fixed; z-index: 50; display: none;
  background: var(--ink); color: #FAFAF7; font-size: 12.5px; font-weight: 500;
  padding: 6px 10px; border-radius: 6px; white-space: nowrap; pointer-events: none;
  box-shadow: 0 4px 16px rgba(28,43,51,0.25);
}
.cost-tooltip.visible { display: block; }
.timer-actions .btn.ghost { background: rgba(250,250,247,0.1); color: #FAFAF7; border-color: rgba(250,250,247,0.25); }
.sidebar .foot {
  margin-top: auto;
  font-size: 11px;
  color: rgba(250,250,247,0.4);
  font-family: 'IBM Plex Mono', monospace;
  padding-left: 8px;
  line-height: 1.5;
}
main {
  flex: 1;
  padding: 32px 40px;
  overflow-x: auto;
}
h1 { font-family: 'Spectral', serif; font-size: 28px; margin: 0 0 6px; }
h2 { font-family: 'Spectral', serif; font-size: 18px; font-weight: 600; margin: 0 0 14px; }
.subtitle { color: var(--gray); margin: 0 0 24px; font-size: 14px; }
.header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.stats { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 32px; }
.stat-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 20px;
  min-width: 180px;
  border-top: 3px solid var(--ink);
}
.stat-card .label { font-size: 12px; color: var(--gray); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-card .value { font-family: 'IBM Plex Mono', monospace; font-size: 22px; font-weight: 500; }

/* Geschätzt-vs.-Tatsächlich-Vergleich für EINEN Lieferschein (oberhalb "Getrackte Zeit je Person") */
.dn-summary-row { display: grid; grid-template-columns: 130px 1fr 90px; gap: 12px; align-items: center; margin-bottom: 8px; font-size: 13px; }
.dn-summary-row:last-child { margin-bottom: 0; }

/* Geschätzt (rot) vs. tatsächlich/getrackt (grün) als zwei knapp übereinander
   liegende Mini-Balken (nicht deckungsgleich), statt zwei getrennter Zeilen –
   siehe dual_bar_row() in includes/functions.php. */
.dual-bar-track { display: flex; flex-direction: column; gap: 2px; }
.dual-bar-line { background: var(--paper2); border-radius: 2px; height: 5px; overflow: hidden; }
.dual-bar-fill { height: 100%; border-radius: 2px; }
.dual-bar-est { background: var(--rust); }
.dual-bar-act { background: var(--teal); }
.dual-bar-values { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; font-size: 12px; line-height: 1.3; white-space: nowrap; }
.dual-bar-values .v-est { color: var(--rust); }
.dual-bar-values .v-act { color: var(--teal); font-weight: 600; }
.dual-bar-legend { display: flex; gap: 18px; font-size: 12px; color: var(--gray); margin-bottom: 10px; }
.hours-dot { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 5px; }
.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 24px;
}
table { border-collapse: collapse; width: 100%; background: white; }
.table-wrap { background: white; border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; overflow-y: hidden; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
th { text-align: left; font-size: 12px; color: var(--gray); font-weight: 500; padding: 10px 14px; text-transform: uppercase; letter-spacing: 0.04em; background: var(--paper2); border-bottom: 1px solid var(--line); }
td { padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
tr:hover td { background: var(--paper2); }
tr.row-link { cursor: pointer; }
.mono { font-family: 'IBM Plex Mono', monospace; }
.muted { color: var(--gray); }
.badge { display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 500; padding: 3px 9px; border-radius: 20px; }

/* Task-Status: eingeklappt nur das farbige Symbol, Text nur im Dropdown */
.task-status-wrap { position: relative; display: inline-flex; align-items: center; vertical-align: middle; justify-self: start; }
.task-status-wrap select.task-status {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  width: 2.1em; height: 1.7em; margin: 0; padding: 0;
  border: none; background: transparent; cursor: pointer;
  color: transparent; font-size: 15px; text-align: center;
}
.task-status-wrap select.task-status:focus-visible { outline: 2px solid var(--line); border-radius: 4px; }
.task-status-wrap .task-status-face {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  pointer-events: none;
  width: 13px; height: 13px; border-radius: 50%;
  background: #BDB7A8;
  box-shadow: inset 0 0 0 1px rgba(28, 43, 51, 0.12);
}
.task-status-face[data-status="offen"]     { background: var(--st-offen); }
.task-status-face[data-status="in_arbeit"] { background: var(--st-in-arbeit); }
.task-status-face[data-status="erledigt"]  { background: var(--st-erledigt); }

/* Nutzer-Avatar: runder Kreis, Bild oder Initialen */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; flex: 0 0 auto; vertical-align: middle;
  color: #fff; font-weight: 600; line-height: 1; letter-spacing: 0.02em;
  object-fit: cover; background: var(--gray); overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(28, 43, 51, 0.08);
}
.avatar-none { background: var(--paper2); color: var(--gray); font-weight: 400; }
.avatar-stack { display: inline-flex; align-items: center; gap: 7px; }

/* Zuständigkeits-Auswahl: eingeklappt nur das Avatar, Namen nur im Dropdown */
.user-select-wrap { position: relative; display: inline-flex; align-items: center; vertical-align: middle; justify-self: start; }
.user-select-wrap select.user-select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  width: 30px; height: 30px; margin: 0; padding: 0;
  border: none; background: transparent; cursor: pointer; color: transparent; font-size: 0;
}
.user-select-wrap select.user-select:focus-visible { outline: 2px solid var(--line); border-radius: 50%; }
.user-select-wrap .user-face { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none; }
select.user-select option { color: var(--ink); font-size: 14px; }
/* schmale, zentrierte Spalte für das User-Avatar in Tabellen */
th.col-user, td.col-user { width: 40px; text-align: center; padding-left: 6px; padding-right: 6px; }

/* Mehrfachauswahl Zuständige: gestapelte Avatare, Klick öffnet Checkliste */
.assignee-picker { position: relative; display: inline-flex; align-items: center; justify-self: start; }
.assignee-face { display: inline-flex; align-items: center; border: none; background: transparent; cursor: pointer; padding: 2px; border-radius: 999px; }
.assignee-face:hover { background: var(--paper2); }
.assignee-dropdown {
  position: absolute; z-index: 20; top: 100%; left: 0; margin-top: 4px;
  background: white; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 18px rgba(28,43,51,0.12); min-width: 170px; max-height: 220px; overflow-y: auto;
}
.assignee-option { display: flex; align-items: center; gap: 8px; padding: 7px 10px; font-size: 13.5px; cursor: pointer; }
.assignee-option:hover { background: var(--paper2); }
.assignee-option input[type="checkbox"] { width: auto; margin: 0; }

.medium-picker { position: relative; display: inline-flex; align-items: center; justify-self: start; max-width: 100%; }
.medium-face {
  display: inline-flex; align-items: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; border: 1px solid var(--line); background: var(--paper); cursor: pointer;
  padding: 4px 8px; border-radius: 6px; font-size: 12.5px; text-align: left;
}
.medium-face:hover { background: var(--paper2); }
.medium-dropdown {
  position: absolute; z-index: 20; top: 100%; left: 0; margin-top: 4px;
  background: white; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 18px rgba(28,43,51,0.12); min-width: 190px; max-height: 240px; overflow-y: auto;
}
.medium-option { display: flex; align-items: center; gap: 8px; padding: 7px 10px; font-size: 13.5px; cursor: pointer; }
.medium-option:hover { background: var(--paper2); }
.medium-option input[type="checkbox"] { width: auto; margin: 0; }

.items-header .sortable { cursor: pointer; user-select: none; }
.items-header .sortable:hover { color: var(--ink); }
.items-header .sortable.sort-active { color: var(--ink); }
.items-header .sortable.sort-active::after { content: ' ▲'; }
.items-header .sortable.sort-active.sort-desc::after { content: ' ▼'; }

/* Ausgaben je Nutzer – Chips über der Liste */
.spend-by-user { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.spend-chip {
  display: flex; align-items: center; gap: 8px;
  background: white; border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 14px 5px 5px; font-size: 13.5px;
}
.spend-chip .spend-name { color: var(--gray); }
.spend-chip .spend-amt { font-family: 'IBM Plex Mono', monospace; font-weight: 500; }

/* Getrackte Zeit je Person (Lieferschein-Bearbeiten) */
.tbu-person { padding: 12px 0; border-bottom: 1px solid var(--line); }
.tbu-person:last-of-type { border-bottom: none; }
.tbu-person-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; margin-bottom: 8px; }
.time-breakdown { margin-top: 14px; }
.time-breakdown summary { cursor: pointer; font-size: 13px; color: var(--gray); user-select: none; }
.time-breakdown[open] summary { margin-bottom: 4px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--ink); color: white; border: none; border-radius: 6px;
  padding: 10px 18px; font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none;
}
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--rust); }
.btn.small { padding: 6px 10px; font-size: 13px; }
.actions { display: flex; gap: 6px; justify-content: flex-end; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 6px;
  border: 1px solid var(--line); background: white; cursor: pointer; color: var(--ink); text-decoration: none;
}
.icon-btn.danger { color: var(--rust); }
form.inline { display: inline; }
label { font-size: 12.5px; color: var(--gray); margin-bottom: 4px; display: block; font-weight: 500; }
input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 14px; background: var(--paper); font-family: 'Inter', sans-serif;
}
.field { margin-bottom: 14px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.empty { border: 1px dashed var(--line); border-radius: 10px; padding: 40px 20px; text-align: center; color: var(--gray); font-size: 14px; }
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: white; border: 1px solid var(--line); border-radius: 12px; padding: 36px 32px; width: 100%; max-width: 360px; }
.login-box h1 { text-align: center; }
.login-logo { display: block; width: 100%; max-width: 220px; height: auto; margin: 0 auto 20px; }
.error { background: #F6E6E2; color: var(--rust); padding: 10px 14px; border-radius: 6px; font-size: 13.5px; margin-bottom: 14px; }
.notice { background: #E7F0E4; color: #3a7d44; padding: 10px 14px; border-radius: 6px; font-size: 13.5px; margin-bottom: 14px; }
.items-scroll { overflow-x: auto; }
.items-box { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 14px; }
.item-row, .items-header { display: grid; gap: 8px; align-items: center; }
.item-row { margin-bottom: 8px; }
.item-row:last-child { margin-bottom: 0; }
/* Im Lieferschein (.item-group-Wrapper mit Drag&Drop) den Abstand als
   padding statt margin: ein Margin auf .item-row kollabiert durch
   .item-group hindurch und fällt aus dessen getBoundingClientRect() raus –
   das erzeugt beim Drag&Drop eine tote Zone zwischen den Items, in der
   weder "davor" noch "danach einfügen" greift. */
.item-group .item-row { margin-bottom: 0; }
.item-group { padding-bottom: 8px; }
.item-group:last-child { padding-bottom: 0; }
.item-row input, .item-row select { min-width: 0; }
.item-row .lt { font-family: 'IBM Plex Mono', monospace; font-size: 13px; text-align: right; }
.remove-row { background: none; border: none; color: var(--rust); cursor: pointer; font-size: 18px; width: auto; padding: 0 6px; justify-self: center; }
.add-row { background: none; border: none; color: var(--teal); cursor: pointer; font-size: 13px; font-weight: 500; padding: 4px 0; }
.items-header { margin-bottom: 6px; padding: 0 10px; font-size: 10.5px; font-weight: 600; color: var(--gray); text-transform: uppercase; letter-spacing: 0.06em; }
.items-subheading {
  font-size: 11px; font-weight: 600; color: var(--teal); text-transform: uppercase; letter-spacing: 0.05em;
  padding: 8px 2px 6px; margin-top: 4px; border-top: 1px dashed var(--line);
}
.items-subheading:first-child { margin-top: 0; border-top: none; padding-top: 0; }
.item-row input[disabled] { background: var(--paper2); color: var(--ink); opacity: 1; }

/* Spaltenraster: 3 = Rechnung read-only, 4 = Rechnung editierbar, dn = Lieferschein-Positionen */
.cols-3 { grid-template-columns: 1fr 80px 100px; }
.cols-4 { grid-template-columns: 1fr 80px 100px 26px; }
.cols-dn { grid-template-columns: 22px 28px 64px minmax(140px,1fr) 58px 60px 80px 80px 110px 65px 65px 46px 64px 30px 26px 26px; }

.drag-handle {
  cursor: grab; color: var(--gray); font-size: 15px; text-align: center;
  align-self: center; justify-self: center; user-select: none;
}
.drag-handle:hover { color: var(--ink); }
.drag-handle:active { cursor: grabbing; }
.item-group.dragging { opacity: 0.4; }
.item-group.drag-over-top { box-shadow: inset 0 2px 0 0 var(--ink); }
.item-group.drag-over-bottom { box-shadow: inset 0 -2px 0 0 var(--ink); }

.track-toggle {
  background: none; border: none; cursor: pointer; color: var(--gray);
  font-size: 17px; line-height: 1; padding: 4px 2px; align-self: center; justify-self: center;
}
.track-toggle:hover { color: var(--ink); }
.track-toggle[aria-expanded="true"] { color: var(--ink); }
.item-track {
  margin: 10px 0 8px 137px; padding: 10px 12px; background: var(--paper2);
  border-radius: 6px; font-size: 12.5px;
}
.item-info-fields { display: flex; flex-direction: column; gap: 8px; }
.item-info-fields .field { margin: 0; }
.item-info-fields label { font-size: 11px; }
.item-info-fields textarea { overflow: hidden; resize: none; }
.item-track-heading { font-size: 10.5px; font-weight: 600; color: var(--gray); text-transform: uppercase; letter-spacing: 0.05em; margin: 10px 0 4px; padding-top: 8px; border-top: 1px dashed var(--line); }
.item-track-row { display: grid; grid-template-columns: 22px 1fr auto 18px 18px; gap: 6px; align-items: start; padding: 3px 0; }
.item-track-row .mono { white-space: nowrap; }
.track-icon-btn { background: none; border: none; color: var(--gray); cursor: pointer; font-size: 13px; padding: 0; justify-self: center; }
.track-icon-btn:hover { color: var(--ink); }
.del-time-entry { background: none; border: none; color: var(--gray); cursor: pointer; font-size: 13px; padding: 0; justify-self: center; }
.del-time-entry:hover { color: var(--rust); }
.item-track-note { color: var(--ink); }
.item-track-sum { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; font-weight: 600; align-items: center; }

/* WooCommerce-Produktsuche in der Positionszeile */
.wc-search-wrap { position: relative; }
.wc-item-link { display: block; font-size: 11px; color: var(--teal); margin-top: 3px; text-decoration: none; }
.wc-item-link:hover { text-decoration: underline; }
.wc-search-results {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
  background: white; border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 4px 16px rgba(28,43,51,0.15); margin-top: 2px; max-height: 220px; overflow-y: auto;
}
.wc-search-results:empty { display: none; }
.wc-search-item { padding: 8px 10px; font-size: 13.5px; cursor: pointer; }
.wc-search-item:hover { background: var(--paper2); }
.wc-search-item:not(:last-child) { border-bottom: 1px solid var(--line); }
.wc-search-spinner {
  display: none; position: absolute; top: 50%; right: 12px; width: 15px; height: 15px;
  margin-top: -7.5px; border: 2px solid var(--line); border-top-color: var(--teal);
  border-radius: 50%; animation: wc-spin .6s linear infinite;
}
.wc-search-spinner.active { display: block; }
.wc-search-wrap:has(.wc-search-spinner) input { padding-right: 32px; }
@keyframes wc-spin { to { transform: rotate(360deg); } }
.totals { display: flex; justify-content: flex-end; }
.totals .box { width: 240px; font-size: 13.5px; }

/* Notiz-Feld in der Tasks-Tabelle: Klick öffnet großen Bearbeiten-Dialog */
.note-trigger {
  display: block; width: 100%; max-width: 220px; text-align: left;
  background: none; border: 1px solid transparent; border-radius: 6px;
  padding: 5px 7px; cursor: pointer; color: var(--ink); font-size: 14px;
  font-family: 'Inter', sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.note-trigger.empty { color: var(--gray); font-style: italic; }
.note-trigger:hover { border-color: var(--line); background: var(--paper2); }
.note-dialog {
  width: 70vw; max-width: 900px; border: 1px solid var(--line); border-radius: 12px;
  padding: 24px; box-shadow: 0 20px 60px rgba(28,43,51,0.28);
}
.note-dialog::backdrop { background: rgba(28,43,51,0.45); }
.note-dialog h3 { font-family: 'Spectral', serif; font-size: 17px; margin: 0 0 16px; }
.note-textarea {
  width: 100%; min-height: 40vh; resize: vertical; font-family: 'Inter', sans-serif;
  font-size: 14.5px; line-height: 1.5; padding: 12px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--paper);
}
.totals .line { display: flex; justify-content: space-between; padding: 4px 0; }
.totals .grand { display: flex; justify-content: space-between; padding: 8px 0; border-top: 2px solid var(--ink); font-weight: 600; margin-top: 4px; }
/* ── Kalender ──────────────────────────────────────────────────────────────── */
.cal-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-nav strong { font-family: 'Spectral', serif; font-size: 18px; min-width: 170px; text-align: center; }
.cal-filter select { max-width: 200px; }
.cal-view-toggle { display: flex; gap: 6px; }
.cal-view-toggle .btn.ghost.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.cal-grid.cal-grid-week td.cal-day { height: 460px; }
.cal-week-th-date { display: block; font-size: 10px; font-weight: 500; color: var(--gray); text-transform: none; letter-spacing: 0; margin-top: 2px; }

.cal-grid-wrap { overflow-x: auto; }
.cal-grid { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 720px; }
.cal-grid th {
  padding: 6px 8px; text-align: left; font-size: 10.5px; font-weight: 600;
  color: var(--gray); text-transform: uppercase; letter-spacing: 0.06em;
}
.cal-grid td.cal-day {
  width: 14.28%; height: 116px; vertical-align: top; padding: 4px 5px;
  border: 1px solid var(--line); background: var(--paper); cursor: pointer;
}
.cal-grid td.cal-day:hover { background: #F3F1EA; }
.cal-kw-th, .cal-grid td.cal-kw { width: 34px; text-align: center; }
.cal-grid td.cal-kw {
  color: var(--gray); font-size: 11px; font-weight: 600; vertical-align: middle;
  background: var(--paper2); border: 1px solid var(--line);
}
.cal-grid:not(.cal-grid-week) td.cal-day { width: calc((100% - 34px) / 7); }
.cal-grid td.cal-out { background: var(--paper2); }
.cal-grid td.cal-out:hover { background: #E9E5DA; }
.cal-grid td.cal-day.cal-today {
  background: #FBF0DE;
  box-shadow: inset 0 0 0 2px var(--amber);
}
.cal-grid td.cal-day.cal-today:hover { background: #F6E7C6; }
.cal-daynum { font-size: 12px; color: var(--gray); margin-bottom: 3px; }
.cal-out .cal-daynum { opacity: 0.6; }
.cal-today .cal-daynum {
  display: inline-block; min-width: 20px; height: 20px; line-height: 20px; text-align: center;
  background: var(--amber); color: var(--paper); border-radius: 50%; font-weight: 700;
}
.cal-ev {
  display: flex; align-items: center; gap: 5px; margin-bottom: 2px; width: 100%;
  padding: 2px 5px; border-radius: 4px; font-size: 11px; line-height: 1.35;
  text-decoration: none; overflow: hidden;
}
button.cal-ev { border: none; font-family: inherit; text-align: left; cursor: pointer; }
.cal-ev-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev-deadline { background: var(--paper2); color: var(--ink); }
.cal-ev-deadline.overdue { color: var(--rust); font-weight: 600; }
.cal-ev-deadline.done .cal-ev-txt { text-decoration: line-through; opacity: 0.6; }
.cal-ev-entry { white-space: nowrap; text-overflow: ellipsis; }
.cal-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--gray); }
.cal-dot[data-status="offen"]     { background: var(--st-offen); }
.cal-dot[data-status="in_arbeit"] { background: var(--st-in-arbeit); }
.cal-dot[data-status="erledigt"]  { background: var(--st-erledigt); }

.entry-dialog {
  width: 460px; max-width: 92vw; border: 1px solid var(--line); border-radius: 12px;
  padding: 24px; box-shadow: 0 20px 60px rgba(28,43,51,0.28);
}
.entry-dialog::backdrop { background: rgba(28,43,51,0.45); }
.entry-dialog h3 { font-family: 'Spectral', serif; font-size: 17px; margin: 0 0 16px; }
.entry-dialog-actions { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.btn.ghost.danger { background: transparent; border: 1px solid var(--line); color: var(--rust); }
.btn[hidden] { display: none; }
.cal-ev-avatars { display: flex; align-items: center; flex: 0 0 auto; }

/* Personen-Auswahl als Tag-Input: Bubbles + Eingabefeld mit Dropdown-Vorschlägen */
.tag-input-wrap {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: white;
}
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 5px; background: var(--paper2);
  border-radius: 999px; padding: 3px 5px 3px 10px; font-size: 13px; white-space: nowrap;
}
.tag-chip button { background: none; border: none; cursor: pointer; color: var(--gray); font-size: 14px; line-height: 1; padding: 2px; }
.tag-chip button:hover { color: var(--rust); }
.tag-input-wrap input[type="text"] { flex: 1; min-width: 120px; border: none; outline: none; padding: 3px 2px; background: transparent; }

@media (max-width: 720px) {
  .cal-grid td.cal-day { height: 84px; }
  .cal-grid.cal-grid-week td.cal-day { height: 220px; }
  .shell { flex-direction: column; }
  .nav-toggle { display: flex; }
  .sidebar {
    position: sticky; top: 0; z-index: 20;
    flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between;
    width: 100%; height: auto; padding: 8px 12px; gap: 6px;
  }
  .sidebar .brand { margin-bottom: 0; padding-left: 0; }
  .brand-logo { max-width: 84px; }
  .sidebar .nav-scroll {
    display: none; flex: 1 1 100%; flex-direction: column; gap: 2px; margin-top: 4px;
  }
  body.nav-open .sidebar .nav-scroll { display: flex; }
  .sidebar a.navitem { padding: 12px; font-size: 15px; border-radius: 8px; }
  body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
  body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .timer-widget { order: 10; flex: 1 1 100%; margin: 4px 0 0; }
  .sidebar .foot { order: 11; flex: 1 1 100%; margin: 4px 0 0; padding-left: 0; display: none; }
  body.nav-open .sidebar .foot { display: block; }
  main { padding: 16px; }
  h1 { font-size: 22px; }
  .card { padding: 16px; }
  .row { flex-direction: column; gap: 0; }
  .stats { gap: 10px; }
  .stat-card { min-width: 0; flex: 1 1 calc(50% - 5px); padding: 12px 14px; }
  .header-row { align-items: flex-start; }
  table th, table td { padding: 8px 10px; font-size: 13px; }
  .note-dialog { width: 92vw; }
  .items-scroll { margin: 0 -2px; padding: 0 2px; }
}
@media print {
  .no-print { display: none !important; }
  main { padding: 0; }
}
