/* =========================================================
   Projekte-Manager – Design-System (TU Graz Business)
   Token-basiert, Hell- & Dunkelmodus, Fira Sans + Crimson Text
   ========================================================= */

:root {
  --header-bg: #17171b;
  --header-text: #ffffff;
  --bg: #f3f2f6;
  --surface: #ffffff;
  --surface-2: #faf9fc;
  --col-bg: #eceaf1;
  --text: #222229;
  --muted: #85838f;
  --border: #e7e4ee;
  --border-strong: #d9d5e2;
  --accent: #e51b4a;
  --accent-ink: #ffffff;
  --accent-soft: rgba(229, 27, 74, 0.10);
  --good: #2e9e44;
  --warn: #c01535;
  --ink: #1c1c22;          /* dunkle Fläche (Tabellenkopf, Toast) */
  --ink-text: #ffffff;
  --input-bg: #ffffff;
  --chip-bg: #ffffff;
  --ghost-dark-bg: #ecebf1;
  --hover: #faf4f6;
  --pill-bg: rgba(20, 20, 28, 0.06);
  --radius: 14px;
  --radius-sm: 9px;
  --radius-xs: 6px;
  --shadow-sm: 0 1px 2px rgba(24, 24, 32, 0.06);
  --shadow: 0 1px 2px rgba(24, 24, 32, 0.05), 0 6px 20px rgba(24, 24, 32, 0.07);
  --shadow-lift: 0 10px 26px rgba(24, 24, 32, 0.16);
}

@media (prefers-color-scheme: dark) {
  :root {
    --header-bg: #121215;
    --header-text: #f1f1f4;
    --bg: #0f0f12;
    --surface: #1b1b20;
    --surface-2: #232329;
    --col-bg: #17171b;
    --text: #e8e7ec;
    --muted: #9896a3;
    --border: #2f2e37;
    --border-strong: #3c3b45;
    --accent-soft: rgba(229, 27, 74, 0.20);
    --good: #46c463;
    --warn: #f2637c;
    --ink: #26262e;
    --input-bg: #232329;
    --chip-bg: #1b1b20;
    --ghost-dark-bg: #2a2932;
    --hover: #241c20;
    --pill-bg: rgba(255, 255, 255, 0.08);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 20px rgba(0, 0, 0, 0.45);
    --shadow-lift: 0 12px 28px rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme="light"] {
  --header-bg: #17171b; --header-text: #ffffff; --bg: #f3f2f6; --surface: #ffffff;
  --surface-2: #faf9fc; --col-bg: #eceaf1; --text: #222229; --muted: #85838f;
  --border: #e7e4ee; --border-strong: #d9d5e2; --accent-soft: rgba(229,27,74,0.10);
  --good: #2e9e44; --warn: #c01535; --ink: #1c1c22; --input-bg: #ffffff; --chip-bg: #ffffff;
  --ghost-dark-bg: #ecebf1; --hover: #faf4f6; --pill-bg: rgba(20,20,28,0.06);
  --shadow-sm: 0 1px 2px rgba(24,24,32,0.06);
  --shadow: 0 1px 2px rgba(24,24,32,0.05), 0 6px 20px rgba(24,24,32,0.07);
  --shadow-lift: 0 10px 26px rgba(24,24,32,0.16);
}
:root[data-theme="dark"] {
  --header-bg: #121215; --header-text: #f1f1f4; --bg: #0f0f12; --surface: #1b1b20;
  --surface-2: #232329; --col-bg: #17171b; --text: #e8e7ec; --muted: #9896a3;
  --border: #2f2e37; --border-strong: #3c3b45; --accent-soft: rgba(229,27,74,0.20);
  --good: #46c463; --warn: #f2637c; --ink: #26262e; --input-bg: #232329; --chip-bg: #1b1b20;
  --ghost-dark-bg: #2a2932; --hover: #241c20; --pill-bg: rgba(255,255,255,0.08);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow: 0 1px 2px rgba(0,0,0,0.35), 0 6px 20px rgba(0,0,0,0.45);
  --shadow-lift: 0 12px 28px rgba(0,0,0,0.6);
}

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

body {
  font-family: 'Fira Sans', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: #fff; }

/* ---------- Header ---------- */
.topbar {
  background: var(--header-bg); color: var(--header-text);
  position: sticky; top: 0; z-index: 30;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05), 0 6px 20px rgba(0, 0, 0, 0.2);
}
.topbar-inner {
  max-width: none; margin: 0 auto; padding: 8px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: baseline; gap: 13px; }
.brand-name { font-weight: 700; font-size: 1.0rem; letter-spacing: 0.01em; position: relative; padding-left: 15px; }
.brand-name::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 7px; height: 7px; border-radius: 2px; background: var(--accent);
}
.brand-claim { font-family: 'Crimson Text', Georgia, serif; font-style: italic; font-size: 1.02rem; color: rgba(255, 255, 255, 0.62); }
.brand-claim em { color: var(--accent); font-style: italic; }
.topbar-actions { display: flex; gap: 6px; align-items: center; }
.topbar-divider { width: 1px; height: 22px; background: rgba(255, 255, 255, 0.14); margin: 0 3px; }
.ro-badge {
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: #fff; background: #8657c4; border-radius: 999px; padding: 4px 10px;
}

/* Kompakte Icon-Buttons in der Kopfzeile */
.icon-btn {
  border: none; background: rgba(255, 255, 255, 0.08); color: var(--header-text);
  width: 34px; height: 34px; border-radius: var(--radius-sm); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
  font-size: 1rem; line-height: 1; transition: background 0.15s, transform 0.08s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.18); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn .ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Benutzer-Avatar (Initialen) */
.avatar-btn {
  border: none; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; padding: 0;
  color: #fff; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.2);
  transition: transform 0.08s, filter 0.15s;
}
.avatar-btn:hover { filter: brightness(1.08); }
.avatar-btn:active { transform: translateY(1px); }
.avatar-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- Buttons ---------- */
.btn {
  border: none; border-radius: var(--radius-sm); padding: 9px 15px; font: inherit;
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
  transition: transform 0.08s, filter 0.15s, background 0.15s, box-shadow 0.15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-sm { padding: 7px 13px; font-size: 0.82rem; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 2px 8px rgba(229, 27, 74, 0.3); }
.btn-ghost { background: rgba(255, 255, 255, 0.1); color: var(--header-text); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.18); filter: none; }
.btn-ghost-dark { background: var(--ghost-dark-bg); color: var(--text); }
.btn-danger { background: transparent; color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); }
.btn-danger.armed { background: var(--warn); color: #fff; border-color: var(--warn); }

/* ---------- Stats (kompakter Streifen) ---------- */
.stats {
  max-width: none; margin: 12px auto 0; padding: 0 24px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px;
}
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); padding: 9px 14px; transition: transform 0.12s, box-shadow 0.12s;
  display: flex; flex-direction: column; justify-content: center;
}
.stat:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.stat .num { font-size: 1.2rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; line-height: 1.15; }
.stat .num.accent { color: var(--accent); }
.stat .lbl { font-size: 0.64rem; color: var(--muted); margin-top: 1px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }

/* ---------- Rechnungssumme nach Geschäftsjahr ---------- */
.year-breakdown { max-width: none; margin: 12px auto 0; padding: 0 24px; }
.yb-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.yb-head span { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text); }
.yb-head small { font-size: 0.72rem; color: var(--muted); }
.yb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.yb-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); padding: 10px 14px; transition: transform 0.12s, box-shadow 0.12s;
}
.yb-tile:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.yb-tile.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset, var(--shadow-sm); }
.yb-year { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.yb-now { font-size: 0.58rem; font-weight: 700; color: #fff; background: var(--accent); border-radius: 999px; padding: 1px 6px; letter-spacing: 0.03em; }
.yb-sum { font-size: 1.2rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; margin-top: 2px; line-height: 1.15; }
.yb-tile.current .yb-sum { color: var(--accent); }
.yb-count { font-size: 0.66rem; color: var(--muted); margin-top: 1px; }

/* ---------- Toolbar ---------- */
.toolbar {
  max-width: none; margin: 12px auto; padding: 0 24px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
#search {
  flex: 1 1 240px; max-width: 360px; height: 34px; padding: 0 13px; font: inherit; font-size: 0.86rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--input-bg);
  color: var(--text); box-sizing: border-box; transition: border-color 0.15s, box-shadow 0.15s;
}
#search::placeholder { color: var(--muted); }
#search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border); background: var(--chip-bg); border-radius: 999px;
  height: 34px; padding: 0 13px; font: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer;
  color: var(--muted); transition: all 0.12s; display: inline-flex; align-items: center;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { color: #fff; border-color: transparent; }
.toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.board-sort { display: flex; align-items: center; gap: 7px; height: 34px; font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.board-sort select {
  font: inherit; font-size: 0.78rem; height: 34px; padding: 0 11px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--input-bg); color: var(--text); cursor: pointer; box-sizing: border-box;
}
.board-sort select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.view-toggle {
  display: flex; height: 34px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; box-sizing: border-box; background: var(--chip-bg);
}
.view-toggle button {
  border: none; background: transparent; padding: 0 16px; font: inherit; font-size: 0.82rem; font-weight: 600;
  color: var(--muted); cursor: pointer; display: flex; align-items: center; transition: background 0.12s, color 0.12s;
}
.view-toggle button.active { background: var(--accent); color: #fff; }

/* ---------- Board ---------- */
main { max-width: none; margin: 0 auto 40px; padding: 0 24px; }
.board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 16px; align-items: flex-start; }
.col {
  --col-accent: var(--muted);
  flex: 0 0 300px; background: var(--col-bg); border-radius: var(--radius);
  border-top: 3px solid var(--col-accent);
  display: flex; flex-direction: column; max-height: calc(100vh - 224px);
}
.col-head { padding: 12px 14px 8px; display: flex; align-items: center; gap: 8px; }
.col-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--col-accent); flex: 0 0 auto; }
.col-title { font-weight: 700; font-size: 0.85rem; letter-spacing: 0.01em; }
.col-count {
  margin-left: auto; font-size: 0.72rem; color: var(--text); font-weight: 700;
  background: var(--pill-bg); border-radius: 999px; padding: 2px 9px; min-width: 22px; text-align: center;
}
.col-cards { padding: 4px 10px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; min-height: 44px; }
.col.dragover { outline: 2px dashed var(--accent); outline-offset: -4px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); padding: 11px 13px 12px; cursor: pointer;
  border-left: 3px solid var(--accent); transition: transform 0.1s, box-shadow 0.1s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.card.dragging { opacity: 0.4; }
.card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.card-nr { font-size: 0.7rem; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.card-badge {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: #fff; border-radius: 5px; padding: 3px 7px; margin-left: auto;
}
.card-client { font-weight: 700; font-size: 0.92rem; margin-bottom: 3px; line-height: 1.25; }
.card-content {
  font-size: 0.79rem; color: var(--muted); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-flags { display: inline-flex; gap: 3px; align-items: center; margin-left: 5px; }
.flag { display: inline-flex; color: var(--warn); line-height: 0; }
.card-dates {
  font-size: 0.71rem; color: var(--muted); margin-top: 7px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums;
}
.card-foot { display: flex; align-items: center; margin-top: 9px; gap: 8px; }
.card-vol { font-size: 0.82rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.card-invoice { margin-left: auto; font-size: 0.7rem; color: var(--accent); font-weight: 600; }

/* ---------- Tabelle ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
thead th {
  text-align: left; padding: 12px 14px; background: var(--ink); color: var(--ink-text);
  font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase; cursor: pointer; user-select: none; white-space: nowrap;
}
thead th:first-child { border-top-left-radius: var(--radius); }
thead th:last-child { border-top-right-radius: var(--radius); }
thead th .arrow { opacity: 0.8; margin-left: 4px; color: var(--accent); }
tbody td { padding: 11px 14px; border-top: 1px solid var(--border); vertical-align: top; }
tbody tr { cursor: pointer; transition: background 0.1s; }
tbody tr:hover { background: var(--hover); }
.td-badge { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: #fff; border-radius: 5px; padding: 3px 7px; white-space: nowrap; }
.td-status { font-size: 0.7rem; font-weight: 700; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.td-content { max-width: 420px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(12, 12, 16, 0.6); backdrop-filter: blur(3px); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding: 4vh 16px; overflow-y: auto;
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; width: 880px; max-width: 100%;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4); margin-bottom: 4vh;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px 14px; border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 1.12rem; display: flex; align-items: center; }
.modal-close { border: none; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 2px 6px; border-radius: 6px; }
.modal-close:hover { color: var(--text); background: var(--ghost-dark-bg); }
#project-form { padding: 16px 24px 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
fieldset {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 14px 15px; background: var(--surface-2);
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; align-content: start;
}
legend { font-weight: 700; font-size: 0.72rem; padding: 0 7px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 0.72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
label.span2 { grid-column: span 2; }
input, select, textarea {
  font: inherit; font-size: 0.86rem; font-weight: 400; text-transform: none; letter-spacing: normal;
  color: var(--text); padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-xs);
  background: var(--input-bg); width: 100%; transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled, textarea:disabled, select:disabled { opacity: 0.6; cursor: not-allowed; }
textarea { resize: vertical; }
.modal-foot { display: flex; gap: 10px; margin-top: 18px; align-items: center; flex-wrap: wrap; }
.foot-spacer { flex: 1; }
.history { border-top: 1px solid var(--border); padding: 14px 24px 18px; }
.history summary { font-size: 0.78rem; font-weight: 700; color: var(--muted); cursor: pointer; text-transform: uppercase; letter-spacing: 0.04em; }
.history ul { list-style: none; margin-top: 10px; display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.history li { font-size: 0.78rem; color: var(--muted); }
.history li b { color: var(--text); }
.history .old { text-decoration: line-through; opacity: 0.7; }

/* ---------- VPI / Marker ---------- */
.vpi-mark { font-size: 0.64rem; font-weight: 700; color: #fff; background: var(--accent); border-radius: 4px; padding: 1px 5px; vertical-align: 1px; cursor: help; white-space: nowrap; }
.chip-vpi { color: var(--text); }
.check-label { justify-content: flex-end; }
.check-label.span2 { justify-content: flex-start; }
.check-label span { display: flex; align-items: center; gap: 7px; font-size: 0.84rem; color: var(--text); text-transform: none; letter-spacing: normal; }
.check-label input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.index-preview { font-size: 0.8rem; color: var(--muted); min-height: 1em; }
.index-preview b { color: var(--accent); }
.modal-small { width: 420px; }
.vpi-body { padding: 16px 24px 8px; }
.vpi-hint { font-size: 0.78rem; color: var(--muted); margin-bottom: 12px; }
.vpi-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.vpi-row .vpi-year { flex: 1; }
.vpi-row .vpi-rate { flex: 1; }
.vpi-del { border: none; background: var(--ghost-dark-bg); border-radius: var(--radius-xs); width: 32px; height: 32px; font-size: 1.1rem; cursor: pointer; color: var(--muted); flex: 0 0 auto; }
.vpi-del:hover { background: var(--warn); color: #fff; }
#vpi-add { margin: 4px 0 10px; }
.vpi-foot { padding: 0 24px 20px; }

/* ---------- Beträge pro Jahr ---------- */
.jahre-block { display: flex; flex-direction: column; gap: 8px; }
.jahre-head { display: flex; align-items: center; gap: 8px; font-size: 0.72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.btn-round { border: none; border-radius: 50%; width: 26px; height: 26px; background: var(--accent); color: #fff; font-size: 1.05rem; line-height: 1; font-weight: 700; cursor: pointer; flex: 0 0 auto; }
.btn-round:hover { filter: brightness(1.1); }
.jahr-row { display: flex; gap: 8px; align-items: center; }
.jahr-row input { flex: 1; }
.jahr-mark { font-size: 0.64rem; font-weight: 700; color: #fff; background: #6a7c93; border-radius: 4px; padding: 1px 5px; vertical-align: 1px; cursor: help; white-space: nowrap; }

/* ---------- Jahr-Umschalter im Kärtchen ---------- */
.yr-nav { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; background: var(--pill-bg); border-radius: 999px; padding: 1px 4px; vertical-align: 1px; }
.yr-btn { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 0.85rem; line-height: 1; padding: 1px 3px; font-weight: 700; }
.yr-btn:hover:not(:disabled) { color: var(--accent); }
.yr-btn:disabled { opacity: 0.3; cursor: default; }
.yr-cur { font-size: 0.66rem; font-weight: 700; color: var(--text); }

/* ---------- Kontakt-Editor (Avatare) ---------- */
.contact-field { gap: 7px; }
.contact-editor { display: flex; flex-direction: column; gap: 7px; }
.contact-chip {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
}
.contact-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%; color: #fff; font-size: 0.72rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  text-transform: none; letter-spacing: 0.01em;
}
.contact-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.contact-name { font-size: 0.84rem; font-weight: 600; color: var(--text); text-transform: none; letter-spacing: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-sub { font-size: 0.72rem; color: var(--muted); text-transform: none; letter-spacing: normal; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-del {
  border: none; background: transparent; color: var(--muted); font-size: 1.15rem; line-height: 1;
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center; transition: background 0.12s, color 0.12s;
}
.contact-del:hover { background: var(--warn); color: #fff; }
.contact-empty { font-size: 0.82rem; color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: normal; }
.contact-add { display: flex; gap: 8px; align-items: center; }
.contact-add .contact-input { flex: 1; }
.contact-add-btn {
  border: none; border-radius: 50%; width: 32px; height: 32px; background: var(--accent); color: #fff;
  font-size: 1.15rem; line-height: 1; font-weight: 700; cursor: pointer; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
}
.contact-add-btn:hover { filter: brightness(1.08); }

/* ---------- Benutzerverwaltung ---------- */
.modal-mid { width: 660px; }
.users-body { padding: 16px 24px 20px; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.user-info { flex: 1 1 200px; display: flex; flex-direction: column; }
.user-info .user-mail { font-size: 0.76rem; color: var(--muted); }
.user-self { color: var(--accent); font-size: 0.76rem; font-weight: 600; }
.user-row select { width: auto; }
.user-row .btn { padding: 6px 10px; font-size: 0.78rem; }
.user-pending { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: #8a6d00; background: #fdf3d0; border-radius: 999px; padding: 3px 9px; margin-left: 6px; white-space: nowrap; }
.user-pending.expired { color: #fff; background: var(--warn); }
.invite-row { display: flex; gap: 6px; margin-top: 6px; max-width: 440px; }
.invite-link { flex: 1; font-size: 0.74rem; padding: 6px 8px; color: var(--muted); border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--surface-2); }
.invite-row .btn { padding: 5px 10px; font-size: 0.74rem; }
.info-circle { border: none; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 0.72rem; font-weight: 700; font-style: italic; font-family: Georgia, serif; cursor: pointer; vertical-align: 1px; margin-left: 9px; line-height: 20px; padding: 0; }
.info-circle:hover { filter: brightness(1.1); }
.perm-matrix { margin: 0 24px 14px; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.perm-matrix table { border-collapse: collapse; width: 100%; font-size: 0.8rem; }
.perm-matrix th, .perm-matrix td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: 7px 10px; text-align: left; }
.perm-matrix tr td:last-child, .perm-matrix tr th:last-child { border-right: none; }
.perm-matrix tbody tr:last-child td { border-bottom: none; }
.perm-matrix thead th { background: var(--ink); color: var(--ink-text); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.03em; text-align: center; }
.perm-matrix thead th:first-child { text-align: left; }
.perm-matrix td:not(:first-child) { text-align: center; }
.perm-matrix td.yes { color: var(--good); font-weight: 700; }
.perm-matrix td.no { color: var(--muted); }
.perm-matrix small { color: var(--muted); font-weight: 400; }
.perm-matrix-hint { font-size: 0.74rem; color: var(--muted); margin: 8px 24px 0; }

/* Papierkorb */
.trash-body { padding: 16px 24px 20px; }
.trash-hint, .log-empty, .trash-empty { font-size: 0.8rem; color: var(--muted); margin-bottom: 12px; }
.trash-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.trash-info { flex: 1 1 240px; display: flex; flex-direction: column; }
.trash-meta { font-size: 0.74rem; color: var(--muted); }
.trash-content { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.trash-row .btn { padding: 6px 11px; font-size: 0.78rem; }

/* Änderungsprotokoll */
.log-body { padding: 16px 24px 20px; }
#log-search { width: 100%; height: 38px; padding: 0 12px; font: inherit; font-size: 0.85rem; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 12px; background: var(--input-bg); color: var(--text); }
#log-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#log-list { max-height: 55vh; overflow-y: auto; }
.log-row { display: grid; grid-template-columns: 132px 120px 1fr 2fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.78rem; align-items: baseline; }
.log-ts { color: var(--muted); font-variant-numeric: tabular-nums; }
.log-who { font-weight: 600; }
.log-proj { color: var(--text); font-weight: 600; }
.log-what { color: var(--muted); }
.log-what b { color: var(--text); }
.log-what .old { text-decoration: line-through; opacity: 0.7; }
@media (max-width: 720px) { .log-row { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- Finanzen ---------- */
.modal-wide { width: 1040px; }
.fin-body { padding: 16px 24px 20px; }
.fin-tabs { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.fin-tab {
  border: 1px solid var(--border); background: var(--chip-bg); border-radius: var(--radius-sm);
  padding: 7px 14px; font: inherit; font-size: 0.84rem; font-weight: 700; color: var(--muted); cursor: pointer;
  display: flex; align-items: baseline; gap: 7px; transition: all 0.12s;
}
.fin-tab small { font-size: 0.68rem; font-weight: 500; color: var(--muted); text-transform: none; }
.fin-tab:hover { border-color: var(--border-strong); color: var(--text); }
.fin-tab.active { background: var(--accent); color: #fff; border-color: transparent; }
.fin-tab.active small { color: rgba(255, 255, 255, 0.8); }
#fin-export { margin-left: auto; }
.fin-hint { font-size: 0.78rem; color: var(--muted); margin-bottom: 12px; }
.fin-scroll { overflow-x: auto; max-height: 62vh; overflow-y: auto; }
.fin-table { border-collapse: collapse; width: 100%; font-size: 0.82rem; }
.fin-table th { position: sticky; top: 0; background: var(--ink); color: var(--ink-text); text-align: left; padding: 9px 11px; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.fin-table td { padding: 8px 11px; border-top: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.fin-table tbody tr:hover { background: var(--hover); }
.fin-num { text-align: right; font-variant-numeric: tabular-nums; }
.fin-zero { color: var(--muted); }
.fin-status, .fin-einheit { color: var(--muted); font-size: 0.76rem; }
.fin-table tfoot td { border-top: 2px solid var(--border-strong); font-weight: 700; color: var(--text); padding: 10px 11px; background: var(--surface-2); position: sticky; bottom: 0; }

.user-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; width: 100%; }
.user-perms { width: 100%; margin: 8px 0 2px; padding: 11px 13px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); display: flex; flex-direction: column; gap: 8px; }
.user-write { display: flex; align-items: center; gap: 7px; font-size: 0.8rem; font-weight: 600; color: var(--text); }
.user-write input { width: auto; accent-color: var(--accent); }
.perm-label { font-size: 0.76rem; color: var(--muted); font-weight: 600; display: block; margin-bottom: 5px; }
.lieferant-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.lief-check { display: flex; align-items: center; gap: 5px; font-size: 0.8rem; font-weight: 600; color: var(--text); }
.lief-check input { width: auto; accent-color: var(--accent); }
.scope-hint { font-size: 0.74rem; color: var(--muted); font-style: italic; }
.perms-block { margin-top: 12px; padding: 13px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); display: flex; flex-direction: column; gap: 10px; }
.perm-write { display: flex; align-items: center; }
.perm-write span { display: flex; align-items: center; gap: 7px; font-size: 0.82rem; color: var(--text); }
.perm-write input { width: auto; accent-color: var(--accent); }
.user-create { margin-top: 18px; }
.user-create h3 { font-size: 0.9rem; margin-bottom: 10px; }
.user-create-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.users-hint { font-size: 0.76rem; color: var(--muted); margin: 10px 0 12px; }
.pw-body { padding: 16px 24px 18px; display: flex; flex-direction: column; gap: 10px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--ink-text); padding: 11px 22px; border-radius: 999px;
  font-size: 0.86rem; font-weight: 600; box-shadow: var(--shadow-lift); z-index: 100; transition: opacity 0.25s;
}

/* ---------- Bestätigungs-Dialog ---------- */
#confirm-backdrop { z-index: 70; align-items: center; }
.confirm-box { width: 400px; padding: 24px; text-align: center; }
.confirm-box #confirm-msg { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 20px; line-height: 1.4; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }
.confirm-actions .btn { min-width: 110px; }

.hidden { display: none !important; }

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

@media (max-width: 720px) {
  .topbar-inner { padding: 11px 16px; }
  .stats { padding: 0 16px; grid-template-columns: repeat(2, 1fr); }
  .toolbar { padding: 0 16px; }
  main { padding: 0 16px; }
  .form-grid { grid-template-columns: 1fr; }
  fieldset { grid-template-columns: 1fr; }
  .brand-claim { display: none; }
  .user-create-grid { grid-template-columns: 1fr; }
  .topbar-actions { flex-wrap: wrap; }
  .col { flex: 0 0 84vw; }
}
