/* rackbyte ERP Design-System
   Radius-Regel: Controls (Buttons, Inputs, Badges) 8px, Container (Karten, Modals, Dropdowns) 12px.
   Brand: Dunkelgruen #1e3322 + IT-Gruen #d5e26b. Light: Dunkelgruen als Akzent,
   Dark: IT-Gruen als Akzent mit dunklem Text (Logo-Logik gespiegelt). */

:root {
  --brand-primary: #1e3322;
  --brand-lime: #d5e26b;
  --font-headings: 'Plus Jakarta Sans', 'Figtree', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --bg: #f3f5f1;
  --surface: #ffffff;
  --surface-2: #f6f8f4;
  --text: #1e3322;
  --text-2: #4a534b;
  --border: #dcdfdc;
  --border-strong: #c7ccc7;
  --accent: #1e3322;
  --accent-hover: #2c4a33;
  --accent-soft: rgba(30, 51, 34, 0.08);
  --accent-contrast: #ffffff;
  --danger: #b3403a;
  --danger-soft: rgba(179, 64, 58, 0.10);
  --warn: #a16a1f;
  --warn-soft: rgba(161, 106, 31, 0.12);
  --info-soft: rgba(68, 100, 140, 0.10);
  --info: #44648c;
  --shadow: 0 1px 2px rgba(30, 51, 34, 0.05), 0 4px 16px rgba(30, 51, 34, 0.06);
  --shadow-lg: 0 4px 12px rgba(30, 51, 34, 0.08), 0 16px 48px rgba(30, 51, 34, 0.14);
  --r-ctl: 8px;
  --r-card: 12px;
  --nav-h: 60px;
}

[data-theme="dark"] {
  --bg: #121613;
  --surface: #1b211d;
  --surface-2: #222923;
  --text: #e8eae6;
  --text-2: #9ba39c;
  --border: #2b332e;
  --border-strong: #3a443d;
  --accent: #d5e26b;
  --accent-hover: #e1ea8d;
  --accent-soft: rgba(213, 226, 107, 0.13);
  --accent-contrast: #1e3322;
  --danger: #d9706a;
  --danger-soft: rgba(217, 112, 106, 0.14);
  --warn: #cf9b4e;
  --warn-soft: rgba(207, 155, 78, 0.16);
  --info: #7da3cc;
  --info-soft: rgba(125, 163, 204, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.45), 0 16px 48px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body), "Helvetica Neue", Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-family: var(--font-headings); font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16.5px; }
h3 { font-size: 14.5px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Betraege und Nummern in Mono (Brand-Vorgabe) */
.num { font-family: var(--font-mono); font-size: 0.94em; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

.brand-logo { display: flex; align-items: center; color: var(--text); }
.brand-logo svg { display: block; }
.brand-logo .lime { fill: var(--brand-lime); }
[data-theme="dark"] .brand-logo { color: var(--text); }

/* ---------- Boot ---------- */
.boot-splash {
  min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.boot-mark {
  width: 56px; height: 56px; border-radius: 14px;
  background: var(--accent); color: var(--accent-contrast);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700;
}
.boot-text { color: var(--text-2); font-size: 13px; }

/* ---------- Topnav ---------- */
.topnav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 4px;
  padding: 0 20px;
}
.topnav .brand {
  display: flex; align-items: center; gap: 10px;
  margin-right: 18px; cursor: pointer; user-select: none;
}
.topnav .brand .mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent); color: var(--accent-contrast);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.topnav .brand .name { font-weight: 600; font-size: 15px; white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.nav-items { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; }
.nav-item {
  position: relative;
  padding: 8px 12px; border-radius: var(--r-ctl);
  color: var(--text); font-weight: 500; font-size: 14px;
  cursor: pointer; user-select: none; white-space: nowrap;
  display: flex; align-items: center; gap: 5px;
  background: none; border: none; font-family: inherit;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { color: var(--accent); background: var(--accent-soft); }
.nav-item .ti-chevron-down { font-size: 13px; color: var(--text-2); }
.nav-right { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--r-ctl);
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--text); font-size: 18px;
}
.icon-btn:hover { background: var(--surface-2); }

.dropdown {
  position: absolute; top: calc(100% + 6px); left: 0;
  min-width: 220px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-card); box-shadow: var(--shadow-lg);
  padding: 6px; z-index: 60;
}
.dropdown.right { left: auto; right: 0; }
.dropdown .dd-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-ctl);
  cursor: pointer; font-size: 14px; color: var(--text);
  background: none; border: none; width: 100%; text-align: left; font-family: inherit;
}
.dropdown .dd-item:hover { background: var(--surface-2); }
.dropdown .dd-item i { color: var(--text-2); font-size: 16px; width: 18px; text-align: center; }
.dropdown .dd-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.dropdown .dd-head { padding: 8px 10px 4px; font-size: 12px; color: var(--text-2); font-weight: 600; }

.hamburger { display: none; }

/* ---------- Layout ---------- */
.page {
  max-width: 1280px; margin: 0 auto;
  padding: 24px 20px 80px;
}
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.page-head .sub { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.split {
  display: grid; grid-template-columns: 210px 1fr; gap: 20px; align-items: start;
}
.sidebar {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-card); padding: 8px;
  position: sticky; top: calc(var(--nav-h) + 16px);
}
.side-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: var(--r-ctl);
  cursor: pointer; font-size: 13.5px; color: var(--text);
  background: none; border: none; width: 100%; text-align: left; font-family: inherit;
}
.side-item:hover { background: var(--surface-2); }
.side-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-item .count { font-size: 12px; color: var(--text-2); }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; align-items: start; }

/* ---------- Karten ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-card); box-shadow: var(--shadow);
}
.card .card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card .card-body { padding: 18px; }
.card .card-body.tight { padding: 10px; }

.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 16px 18px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(30, 51, 34, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.kpi:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi .kpi-label { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 7px; text-transform: uppercase; letter-spacing: 0.03em; font-weight: 600; }
.kpi .kpi-label i { color: var(--accent); font-size: 15px; }
.kpi .kpi-value { font-size: 22px; font-weight: 700; margin-top: 6px; letter-spacing: -0.01em; }
/* Farbcodierte Warn-Kacheln (wie bei guten Dashboards), in Brand-/Status-Toenen */
.kpi:has(.kpi-value.neg) { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 22%, var(--border)); }
.kpi:has(.kpi-value.neg) .kpi-label i { color: var(--danger); }
.kpi:has(.kpi-value.warn) { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 22%, var(--border)); }
.kpi:has(.kpi-value.warn) .kpi-label i { color: var(--warn); }
.kpi .kpi-value.neg { color: var(--danger); }
.kpi .kpi-value.warn { color: var(--warn); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--r-ctl);
  font-size: 14px; font-weight: 600; font-family: inherit;
  border: 1px solid transparent; cursor: pointer;
  background: var(--accent); color: var(--accent-contrast);
  white-space: nowrap;
  transition: background 0.15s ease, transform 0.05s ease;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(0.92); }
.btn.subtle { background: var(--accent-soft); color: var(--accent); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn i { font-size: 16px; }

/* ---------- Formulare ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text); }
.field .hint { font-size: 12px; color: var(--text-2); }
.input, select.input, textarea.input {
  width: 100%;
  padding: 8px 11px; border-radius: var(--r-ctl);
  border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 14px;
}
textarea.input { resize: vertical; min-height: 70px; }
.input:focus, select.input:focus, textarea.input:focus {
  outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder { color: var(--text-2); }
.input.error { border-color: var(--danger); }
.field .err { font-size: 12.5px; color: var(--danger); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
.checkbox { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; padding: 9px 12px;
  font-size: 12px; font-weight: 600; color: var(--text-2);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover { background: var(--surface-2); }
.tbl .right { text-align: right; }
.tbl td.pos { color: var(--accent); font-weight: 600; }
.tbl td.neg { color: var(--danger); font-weight: 600; }
.tbl tfoot td { font-weight: 600; border-top: 1px solid var(--border-strong); border-bottom: none; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2.5px 9px; border-radius: var(--r-ctl);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge.gray { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.badge.green { background: var(--accent-soft); color: var(--accent); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.yellow { background: var(--warn-soft); color: var(--warn); }
.badge.blue { background: var(--info-soft); color: var(--info); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 9px 14px; font-size: 13.5px; font-weight: 600;
  color: var(--text-2); cursor: pointer; border: none; background: none; font-family: inherit;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20, 18, 16, 0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px 16px; overflow-y: auto;
}
.modal {
  background: var(--surface); border-radius: var(--r-card);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px;
}
.modal.wide { max-width: 760px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-body { padding: 20px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--border);
}

/* ---------- Toasts ---------- */
#toasts {
  position: fixed; top: 14px; right: 14px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-ctl); box-shadow: var(--shadow-lg);
  padding: 11px 16px; font-size: 13.5px; max-width: 360px;
  animation: toast-in 0.18s ease;
}
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- Skeleton / Empty ---------- */
.skeleton {
  border-radius: var(--r-ctl);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
  height: 16px; margin: 10px 0;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
  .toast { animation: none; }
  .btn { transition: none; }
}

.empty {
  text-align: center; padding: 44px 20px; color: var(--text-2);
}
.empty i { font-size: 34px; color: var(--border-strong); display: block; margin-bottom: 10px; }
.empty .empty-title { font-weight: 600; color: var(--text); margin-bottom: 4px; font-size: 15px; }
.empty .empty-hint { font-size: 13px; margin-bottom: 14px; }

/* ---------- Beleg-Editor ---------- */
.doc-banner {
  display: flex; align-items: center; gap: 10px;
  background: var(--accent-soft); color: var(--accent);
  border-radius: var(--r-ctl); padding: 10px 14px;
  font-size: 13.5px; font-weight: 600; margin-bottom: 16px;
}
.doc-banner.warn { background: var(--warn-soft); color: var(--warn); }
.items-table .input { padding: 6px 8px; font-size: 13.5px; }
.items-table td { padding: 6px 6px; }
.totals-box {
  margin-left: auto; max-width: 330px; margin-top: 14px;
  display: flex; flex-direction: column; gap: 6px; font-size: 14px;
}
.totals-box .row { display: flex; justify-content: space-between; gap: 20px; }
.totals-box .row.total {
  font-size: 16.5px; font-weight: 700;
  border-top: 2px solid var(--accent); padding-top: 8px; margin-top: 4px;
}
.totals-box .muted { color: var(--text-2); }

/* ---------- Auth & Onboarding ---------- */
.auth-wrap {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 24px 16px; position: relative; overflow: hidden;
  /* Weiche Brand-Glows (Dunkelgruen + IT-Gruen), dezent und eigenstaendig. */
  background:
    radial-gradient(820px 520px at 82% 12%, rgba(213, 226, 107, 0.20), transparent 60%),
    radial-gradient(720px 520px at 12% 22%, rgba(30, 51, 34, 0.16), transparent 62%);
}
[data-theme="dark"] .auth-wrap {
  background:
    radial-gradient(820px 520px at 82% 12%, rgba(213, 226, 107, 0.12), transparent 60%),
    radial-gradient(720px 520px at 12% 22%, rgba(30, 51, 34, 0.45), transparent 62%);
}
.auth-card { width: 100%; max-width: 420px; position: relative; }
.auth-card.wide { max-width: 620px; }
.auth-card > .card {
  border-radius: 22px;
  box-shadow: 0 30px 70px rgba(30, 51, 34, 0.16), 0 2px 8px rgba(30, 51, 34, 0.06);
  border-color: color-mix(in srgb, var(--border) 70%, transparent);
}
.auth-card .card-body { padding: 30px 30px 26px; }
.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; justify-content: center; position: relative; animation: auth-float 7s ease-in-out infinite; }
.auth-logo::before {
  content: ''; position: absolute; inset: -28px -40px; z-index: -1;
  background: radial-gradient(circle, rgba(213, 226, 107, 0.30), rgba(30, 51, 34, 0.12), transparent 70%);
  filter: blur(22px);
}
@keyframes auth-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@media (prefers-reduced-motion: reduce) { .auth-logo { animation: none; } }
.auth-logo .mark {
  width: 44px; height: 44px; border-radius: 11px;
  background: var(--accent); color: var(--accent-contrast);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px;
}
.auth-logo .t { font-size: 19px; font-weight: 700; }
.steps { display: flex; gap: 6px; margin-bottom: 22px; }
.steps .step { flex: 1; height: 4px; border-radius: 2px; background: var(--border); }
.steps .step.done { background: var(--accent); }

/* ---------- Diverses ---------- */
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex.between { justify-content: space-between; }
.flex.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.chart-box { position: relative; height: 240px; }
.logo-preview { max-height: 56px; max-width: 200px; border-radius: 6px; }
.receipt-link { color: var(--accent); cursor: pointer; font-size: 17px; }
.todo-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.todo-row:last-child { border-bottom: none; }
.todo-row.done .t { text-decoration: line-through; color: var(--text-2); }
.todo-row .t { flex: 1; font-size: 13.5px; }
.todo-row .due { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.todo-row .due.over { color: var(--danger); font-weight: 600; }
.acc-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); }
.acc-row:last-child { border-bottom: none; }
.acc-row .n { font-weight: 600; font-size: 13.5px; }
.acc-row .s { font-size: 12px; color: var(--text-2); }
.acc-row .b { font-weight: 700; font-size: 14.5px; }
.acc-row .b.neg { color: var(--danger); }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .split { grid-template-columns: 1fr; }
  .sidebar { position: static; display: flex; overflow-x: auto; gap: 4px; }
  .side-item { white-space: nowrap; width: auto; }
  .nav-items { display: none; }
  .nav-items.open {
    display: flex; flex-direction: column; align-items: stretch;
    position: fixed; top: var(--nav-h); left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 10px; z-index: 49; box-shadow: var(--shadow-lg);
  }
  .nav-items.open .dropdown { position: static; box-shadow: none; border: none; padding-left: 18px; }
  .hamburger { display: flex; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

/* ---------- Druck (Kassenbuch & Auswertungen) ---------- */
@media print {
  .topnav, .page-actions, .sidebar, #toasts, .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: none; box-shadow: none; }
  .page { padding: 0; max-width: none; }
}

/* ---------- Benachrichtigungen ---------- */
.bell-wrap { position: relative; }
.bell-badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.notif-list { max-height: 420px; overflow-y: auto; min-width: 320px; }
.notif-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  font-family: inherit; padding: 9px 10px; border-radius: var(--r-ctl); cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.notif-item:hover { background: var(--surface-2); }
.notif-item .n-title { font-size: 13px; font-weight: 600; color: var(--text); }
.notif-item.unread .n-title::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 7px; }
.notif-item .n-sub { font-size: 11.5px; color: var(--text-2); margin-top: 2px; }

/* ---------- Globale Suche ---------- */
.search-results { max-height: 50vh; overflow-y: auto; margin-top: 12px; }
.search-group-label { font-size: 11.5px; font-weight: 700; color: var(--text-2); text-transform: uppercase; padding: 10px 4px 4px; }
.search-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  font-family: inherit; padding: 8px 10px; border-radius: var(--r-ctl); cursor: pointer;
}
.search-item:hover, .search-item.focus { background: var(--accent-soft); }
.search-item .s-title { font-size: 14px; font-weight: 600; color: var(--text); }
.search-item .s-sub { font-size: 12px; color: var(--text-2); }

/* ---------- Kanban (Vertrieb) ---------- */
.kanban { display: grid; grid-template-columns: repeat(6, minmax(190px, 1fr)); gap: 12px; overflow-x: auto; align-items: start; }
.kanban-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-card); padding: 8px; min-height: 120px; }
.kanban-col.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.kanban-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 8px; font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.deal-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-ctl);
  padding: 9px 10px; margin-bottom: 8px; cursor: grab; box-shadow: var(--shadow);
}
.deal-card:active { cursor: grabbing; }
.deal-card .d-title { font-size: 13.5px; font-weight: 600; }
.deal-card .d-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
@media (max-width: 1000px) { .kanban { grid-template-columns: repeat(6, 230px); } }

/* ---------- Zeiterfassung ---------- */
.timer-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-card); padding: 14px 18px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.timer-clock { font-family: var(--font-mono); font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.timer-bar.running { border-color: var(--accent); }

/* ---------- Projekt-Statistik ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--surface-2); }
.stat .s-label { font-size: 11.5px; color: var(--text-2); }
.stat .s-value { font-size: 16px; font-weight: 700; margin-top: 2px; }
.stat .s-value.neg { color: var(--danger); }
@media (max-width: 1000px) { .stat-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- v3.1: Animationen, Logout, Links, Mobile ---------- */
@media (prefers-reduced-motion: no-preference) {
  #view > .page { animation: page-in 0.28s cubic-bezier(0.16, 1, 0.3, 1); }
  .modal { animation: modal-pop 0.2s cubic-bezier(0.16, 1, 0.3, 1); }
  .kpi { transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease; }
  .kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
  .card { transition: border-color 0.14s ease; }
  .tbl tbody tr.click { transition: background 0.12s ease; }
  .badge, .btn i, .nav-item, .side-item { transition: all 0.14s ease; }
  .deal-card { transition: transform 0.12s ease, box-shadow 0.12s ease; }
  .deal-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
}
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes modal-pop { from { opacity: 0; transform: translateY(8px) scale(0.99); } to { opacity: 1; transform: none; } }
.fade-in { animation: page-in 0.3s cubic-bezier(0.16, 1, 0.3, 1); }

.linklike {
  background: none; border: none; color: var(--accent); cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 600; padding: 8px; width: 100%; margin-top: 4px;
}
.linklike:hover { text-decoration: underline; }

.success-check { font-size: 52px; color: var(--accent); line-height: 1; }
@media (prefers-reduced-motion: no-preference) {
  .success-check { animation: pop-check 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
}
@keyframes pop-check { 0% { transform: scale(0.4); opacity: 0; } 60% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }

/* Mobile-Feinschliff */
@media (max-width: 700px) {
  .page { padding: 16px 13px 80px; }
  h1 { font-size: 19px; }
  .kpi-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .page-head { gap: 10px; }
  .page-actions { width: 100%; }
  .page-actions .input, .page-actions select.input { flex: 1; min-width: 0; }
  .modal { max-width: 100%; }
  .modal-overlay { padding: 10px; align-items: flex-end; }
  .modal { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .topnav { padding: 0 12px; }
  .tbl th, .tbl td { padding: 8px 9px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 420px) {
  .kpi-row { grid-template-columns: 1fr; }
}

/* Touch-Feedback */
@media (hover: none) {
  .btn:active { transform: scale(0.97); }
  .kpi:active, .tbl tbody tr.click:active { background: var(--surface-2); }
}

/* ---------- v3.2: Mandanten-Logo, PDF-Editor, Design-Features ---------- */
.brand-mandant-logo { max-height: 34px; max-width: 190px; object-fit: contain; display: block; }
.brand-logo svg { max-height: 30px; }

/* PDF-Layout-Editor */
.pdf-editor-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 1000px) { .pdf-editor-grid { grid-template-columns: 1fr; } }
.pdf-preview { display: flex; justify-content: center; }
.pdf-page {
  width: 100%; max-width: 340px; aspect-ratio: 1 / 1.414;
  background: #fff; color: #221f1a; border: 1px solid var(--border);
  border-radius: 4px; box-shadow: var(--shadow-lg); overflow: hidden;
  font-size: 7px; display: flex; flex-direction: column;
}
.pp-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.pp-logo { background: #eef0e7; border: 1px dashed #b9c08a; border-radius: 3px; display: flex; align-items: center; justify-content: center; color: #8a9555; font-weight: 700; font-size: 8px; flex-shrink: 0; }
.pp-sender { text-align: right; margin-left: auto; font-size: 6.5px; line-height: 1.4; }
.pp-bar { height: 3px; border-radius: 2px; margin: 4px 0 8px; }
.pp-title { font-weight: 800; font-size: 11px; margin-bottom: 8px; }
.pp-row { display: flex; gap: 4px; font-size: 6.5px; border-bottom: 1px solid #eee; }
.pp-row span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pp-row-head { font-weight: 700; border-bottom-width: 1.5px; padding-bottom: 3px; margin-bottom: 3px; }
.pp-foot { margin-top: auto; padding-top: 6px; border-top: 1px solid #ddd; font-size: 5.5px; color: #888; }

/* Design-Feature: dezenter Glas-Topnav beim Scrollen */
.topnav { backdrop-filter: saturate(1.1); }
@supports (backdrop-filter: blur(8px)) {
  .topnav { background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: blur(10px) saturate(1.2); }
}
/* KPI-Akzentkante beim Hover */
.kpi { position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); transform: scaleY(0); transform-origin: top; transition: transform 0.18s ease; }
@media (prefers-reduced-motion: no-preference) { .kpi:hover::after { transform: scaleY(1); } }
/* Bell-Puls bei ungelesenen */
@media (prefers-reduced-motion: no-preference) {
  .bell-badge { animation: bell-pulse 2s ease-in-out infinite; }
}
@keyframes bell-pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--danger-soft); } 50% { box-shadow: 0 0 0 4px transparent; } }
/* Sanftes Zahlen-Hochzählen */
.kpi-value.count { font-variant-numeric: tabular-nums; }

/* ---------- v3.3: WYSIWYG-PDF + Produkt-Tour ---------- */
.pdf-wysiwyg-wrap { width: 100%; aspect-ratio: 1 / 1.414; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #525659; }
.pdf-wysiwyg { width: 100%; height: 100%; border: none; display: block; }
.pdf-wysiwyg-loading { display: none; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.ti.spin { animation: ra-spin 0.9s linear infinite; display: inline-block; }
@keyframes ra-spin { to { transform: rotate(360deg); } }

/* Produkt-Tour (Spotlight) */
.tour-spot {
  position: fixed; z-index: 300; border-radius: 10px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(16, 19, 15, 0.62); transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.tour-pop {
  position: fixed; z-index: 301; max-width: 320px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: var(--shadow-lg); padding: 16px 18px; animation: page-in 0.25s ease;
}
.tour-pop h3 { margin-bottom: 6px; }
.tour-pop p { margin: 0 0 14px; font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.tour-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tour-dots { display: flex; gap: 5px; }
.tour-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); }
.tour-dot.on { background: var(--accent); }
.tour-skip { position: fixed; z-index: 301; top: 16px; right: 16px; }

/* Onboarding-Feinschliff */
.ob-step-icon {
  width: 46px; height: 46px; border-radius: 12px; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 24px; margin-bottom: 12px;
}
.steps .step { transition: background 0.3s ease; }

/* ---------- Phase 3: Rechte-Grid ---------- */
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
@media (max-width: 700px) { .perm-grid { grid-template-columns: 1fr; } }

/* ---------- v4: Loading-Buttons, Split-Editor, Eingangsrechnungen ---------- */
.btn.is-loading { pointer-events: none; opacity: 0.85; }
.btn.is-loading::before {
  content: ""; width: 13px; height: 13px; border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; display: inline-block; animation: ra-spin 0.7s linear infinite;
}

/* Beleg-Editor Split (Maske + Live-PDF) */
.doc-split { display: grid; grid-template-columns: 1fr 0.85fr; gap: 20px; align-items: start; }
.doc-preview-sticky { position: sticky; top: calc(var(--nav-h) + 16px); }
@media (max-width: 1100px) { .doc-split { grid-template-columns: 1fr; } .doc-preview-col { display: none; } }

/* Eingangsrechnung erfassen (Split) */
.er-split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 1000px) { .er-split { grid-template-columns: 1fr; } }
.er-preview-card { padding: 0; overflow: hidden; min-height: 460px; display: flex; }
.er-preview { width: 100%; display: flex; align-items: center; justify-content: center; }
.er-drop { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 60px 20px; }
.er-drop i { font-size: 38px; }
.er-doc { width: 100%; height: 70vh; border: none; }
.er-doc-img { max-width: 100%; max-height: 70vh; object-fit: contain; display: block; margin: auto; }

/* ============================================================
   Klassischer Beleg-Editor (Lexware/sevDesk-Stil) + Vorschau
   ============================================================ */
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Sticky Toolbar mit Aktionen, Brutto/Netto-Umschalter, Vorschau-Button */
.doc-toolbar {
  position: sticky; top: var(--nav-h); z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  padding: 14px 0 12px; margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.doc-form { display: block; }

/* Kopfdaten: zwei Blöcke nebeneinander */
.doc-head-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.doc-head-block { display: flex; flex-direction: column; gap: 11px; }
.doc-head-block .field { margin: 0; }
.doc-plz-ort { gap: 10px; }
.doc-plz-ort .field:first-child { flex: 0 0 110px; }
.doc-plz-ort .field:last-child { flex: 1; }
@media (max-width: 900px) { .doc-head-grid { grid-template-columns: 1fr; gap: 16px; } }

/* Brutto/Netto-Umschalter */
.seg-toggle { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--r-ctl); overflow: hidden; background: var(--surface); }
.seg-toggle .seg { padding: 7px 14px; font-size: 13px; font-weight: 600; border: none; background: transparent; color: var(--text-2); cursor: pointer; }
.seg-toggle .seg + .seg { border-left: 1px solid var(--border); }
.seg-toggle .seg.active { background: var(--accent); color: #fff; }

/* Positionstabelle: breit, klar umrandet */
.pos-table-wrap { overflow-x: auto; }
.pos-table { width: 100%; border-collapse: collapse; }
.pos-table thead th {
  text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-2); padding: 4px 8px 8px; border-bottom: 2px solid var(--border-strong); white-space: nowrap;
}
.pos-table thead th.right { text-align: right; }
.pos-table thead th.pos-no { width: 46px; }
.pos-row td { padding: 8px 6px; vertical-align: top; border-bottom: 1px solid var(--border); }
.pos-row.alt { opacity: .7; }
.pos-row .pos-no { text-align: center; color: var(--text-2); font-family: var(--font-mono); font-size: 13px; white-space: nowrap; }
.pos-row .pos-alt { margin-top: 6px; }
.pos-main { min-width: 260px; }
.pos-name-wrap { position: relative; }
.pos-name { font-weight: 600; }
.pos-desc { margin-top: 5px; font-size: 13px; color: var(--text-2); }
.pos-cell { width: 1%; }
.pos-cell.right { text-align: right; }
.pos-cell.del { width: 40px; }
.pos-total { display: inline-block; padding-top: 8px; font-weight: 600; }
/* feste, gut sichtbare Spaltenbreiten */
.pos-table td:nth-child(3) .input, .pos-table td:nth-child(6) .input { width: 74px; }
.pos-table td:nth-child(4) .input { width: 84px; }
.pos-table td:nth-child(5) .input { width: 104px; }
.pos-table td:nth-child(7) .input { width: 70px; }
.pos-cell .input { text-align: right; }
.pos-cell:nth-child(4) .input { text-align: left; }

/* Artikel-Schnellsuche */
.pos-suggest {
  display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 40; margin-top: 3px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-ctl);
  box-shadow: 0 10px 30px rgba(20,30,22,.16); max-height: 240px; overflow-y: auto;
}
.pos-suggest.open { display: block; }
.pos-suggest-item { display: flex; justify-content: space-between; gap: 12px; padding: 8px 11px; cursor: pointer; font-size: 13.5px; }
.pos-suggest-item:hover, .pos-suggest-item.active { background: var(--accent-soft); }

.pos-totals-wrap { display: flex; justify-content: flex-end; padding: 14px 8px 6px; }
.pos-totals-wrap .totals-box { min-width: 280px; }

.btn-brand { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-brand:hover { background: var(--accent-hover); }

/* ---- Dedizierte Vorschau-Seite ---- */
.preview-page { display: flex; flex-direction: column; gap: 0; }
.preview-toolbar {
  position: sticky; top: var(--nav-h); z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-card) var(--r-card) 0 0;
}
.preview-title { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.preview-split { display: grid; grid-template-columns: 1fr 260px; gap: 0; min-height: 70vh; }
.preview-stage {
  display: flex; justify-content: center; padding: 28px; background: #4a4f52;
  border: 1px solid var(--border); border-top: none; overflow: auto;
}
.preview-doc {
  width: 100%; max-width: 780px; aspect-ratio: 1 / 1.414; background: #fff; border: none;
  box-shadow: 0 12px 40px rgba(0,0,0,.35); border-radius: 2px;
}
.preview-side {
  background: var(--surface); border: 1px solid var(--border); border-left: none; border-top: none;
  border-radius: 0 0 var(--r-card) 0; padding: 18px 16px;
}
.preview-side h3 { margin: 0 0 2px; }
.tpl-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.tpl-tile {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-ctl); color: var(--text);
}
.tpl-tile:hover { border-color: var(--border-strong); }
.tpl-tile.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tpl-thumb {
  flex: 0 0 38px; height: 48px; display: flex; align-items: flex-start; justify-content: center;
  padding-top: 6px; background: var(--surface-2); border-radius: 4px; border-top: 4px solid var(--accent); color: var(--text-2);
}
.tpl-thumb.tpl-gruen { border-top-color: #1e3322; }
.tpl-thumb.tpl-anthrazit { border-top-color: #2b2f33; }
.tpl-thumb.tpl-blau { border-top-color: #1d4ed8; }
.tpl-name { font-weight: 600; font-size: 13.5px; }
@media (max-width: 820px) {
  .preview-split { grid-template-columns: 1fr; }
  .preview-side { border-left: 1px solid var(--border); border-radius: 0 0 var(--r-card) var(--r-card); }
}

/* Integrierter Autocomplete (Kundenwahl im Belegeditor) */
.ac-wrap { position: relative; }
.ac-suggest {
  display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 45; margin-top: 3px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-card);
  box-shadow: 0 12px 32px rgba(20,30,22,.18); max-height: 280px; overflow-y: auto;
}
.ac-suggest.open { display: block; }
.ac-item { display: flex; flex-direction: column; gap: 1px; padding: 8px 12px; cursor: pointer; }
.ac-item:hover, .ac-item.active { background: var(--accent-soft); }
.ac-name { font-weight: 600; font-size: 14px; }
.ac-meta { font-size: 12px; }

/* Fahrtenbuch */
.trip-summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 18px; }
.trip-summary .stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 14px 16px;
}
.trip-summary .stat-card.accent { border-color: var(--accent); background: var(--accent-soft); }
.trip-summary .stat-label { font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.trip-summary .stat-value { font-family: var(--font-mono); font-size: 18px; font-weight: 600; }
.trip-form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 10px; }
.trip-route-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 10px; }
@media (max-width: 800px) {
  .trip-summary { grid-template-columns: repeat(2, 1fr); }
  .trip-form-grid, .trip-route-grid { grid-template-columns: 1fr; }
}

/* Aufgaben-Widget: scrollbar, Fälligkeit pro Zeile, Eingabezeile */
.todo-list { max-height: 300px; overflow-y: auto; margin: -2px -4px 0; padding: 0 4px; }
.todo-row.done .t { text-decoration: line-through; color: var(--text-2); }
.todo-due-input {
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
  color: var(--text-2); font-family: inherit; font-size: 11.5px; padding: 2px 5px; width: 124px;
}
.todo-due-input.over { color: var(--danger); border-color: var(--danger); font-weight: 600; }
.todo-due-input:focus { outline: 1.5px solid var(--accent); border-color: var(--accent); }
.icon-btn.sm { width: 26px; height: 26px; font-size: 15px; }
.todo-add-row { display: flex; gap: 6px; align-items: center; }
.todo-add-row .input:first-child { flex: 1; }

/* "Neuen Kunden anlegen"-Zeile im Autocomplete */
.ac-item.ac-create { display: flex; flex-direction: row; align-items: center; gap: 7px; color: var(--accent); font-weight: 600; font-size: 13.5px; border-top: 1px solid var(--border); }
.ac-item.ac-create i { font-size: 16px; }

/* Hilfe-Seite */
.help-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; align-items: start; }
.help-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow); overflow: hidden; }
.help-sec-head { display: flex; align-items: center; gap: 9px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.help-sec-head i { color: var(--accent); font-size: 19px; }
.help-items { padding: 6px 8px 10px; }
.help-item { border-bottom: 1px solid var(--border); }
.help-item:last-child { border-bottom: none; }
.help-item > summary { cursor: pointer; padding: 10px 10px; font-weight: 600; font-size: 13.5px; list-style: none; display: flex; align-items: center; gap: 8px; }
.help-item > summary::-webkit-details-marker { display: none; }
.help-item > summary::before { content: '+'; color: var(--accent); font-weight: 700; width: 14px; }
.help-item[open] > summary::before { content: '\2212'; }
.help-steps { margin: 0 6px 12px 30px; padding: 0; color: var(--text-2); font-size: 13px; line-height: 1.55; }
.help-steps li { margin-bottom: 5px; }
@media (max-width: 800px) { .help-grid { grid-template-columns: 1fr; } }

/* Pro-Element-Font-Picker im PDF-Editor */
.font-picker-box { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
.font-picker-box .form-row { gap: 10px; margin: 0; }

/* ============================================================
   Design-Level-Up v4.7: Tiefe, Bewegung, Politur
   ============================================================ */

/* Weichere, tiefere Karten im ganzen Tool */
:root { --r-card: 14px; }
.card { transition: box-shadow 0.22s ease, border-color 0.22s ease; }
.card:hover { box-shadow: 0 2px 6px rgba(30, 51, 34, 0.06), 0 10px 28px rgba(30, 51, 34, 0.09); }
[data-theme="dark"] .card:hover { box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45), 0 10px 28px rgba(0, 0, 0, 0.4); }
.card .card-head h2 { letter-spacing: -0.015em; }

/* Seiten-Eintritt: sanftes Aufsteigen */
@keyframes rise-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.page { animation: rise-in 0.3s ease both; }

/* Gestaffeltes Erscheinen der Dashboard-Kacheln und Karten */
.kpi-row .kpi { animation: rise-in 0.4s ease backwards; }
.kpi-row .kpi:nth-child(1) { animation-delay: 0.03s; }
.kpi-row .kpi:nth-child(2) { animation-delay: 0.08s; }
.kpi-row .kpi:nth-child(3) { animation-delay: 0.13s; }
.kpi-row .kpi:nth-child(4) { animation-delay: 0.18s; }
.grid-3 > *, .grid-2 > * { animation: rise-in 0.45s ease backwards; }
.grid-3 > *:nth-child(2), .grid-2 > *:nth-child(2) { animation-delay: 0.08s; }
.grid-3 > *:nth-child(3) { animation-delay: 0.16s; }

/* Buttons: Anheben beim Hover, Eindruecken beim Klick */
.btn { transition: transform 0.13s ease, box-shadow 0.13s ease, background 0.16s ease, border-color 0.16s ease; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(30, 51, 34, 0.16); }
.btn:active { transform: translateY(0) scale(0.98); box-shadow: none; }
.btn.ghost:hover, .btn.subtle:hover { box-shadow: 0 3px 10px rgba(30, 51, 34, 0.10); }
.icon-btn { transition: background 0.14s ease, transform 0.14s ease; }
.icon-btn:active { transform: scale(0.92); }

/* Tabellen: ruhige Zeilen-Hover ueberall */
.tbl tbody tr { transition: background 0.12s ease; }
.tbl tbody tr:hover { background: var(--surface-2); }

/* Modals: federndes Aufpoppen, Overlay weich einblenden */
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-pop { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: none; } }
.modal-overlay { animation: overlay-in 0.18s ease both; backdrop-filter: blur(3px); }
.modal { animation: modal-pop 0.24s cubic-bezier(0.21, 0.9, 0.32, 1.18) both; }

/* Dropdowns und Autocomplete: kleiner Pop */
@keyframes dd-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.dropdown, .ac-suggest.open, .pos-suggest.open { animation: dd-in 0.16s ease both; }

/* ---- Belegeditor: ruhiges Raster, Fokus zieht die Zeile hervor ---- */
.pos-table .pos-row td { transition: background 0.14s ease; }
.pos-table .pos-row:hover td { background: var(--surface-2); }
.pos-table .input, .pos-table select.input {
  border-color: transparent; background: transparent;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.pos-table .pos-row:hover .input, .pos-table .pos-row:hover select.input { border-color: var(--border); background: var(--surface); }
.pos-table .input:focus, .pos-table select.input:focus { border-color: var(--accent); background: var(--surface); }
.pos-row { animation: rise-in 0.25s ease both; }

/* Summenblock als ruhige Akzent-Karte */
.pos-totals-wrap .totals-box {
  background: var(--surface-2); border: 1px solid var(--border);
  border-top: 3px solid var(--accent); border-radius: 12px; padding: 12px 16px; min-width: 300px;
}
.pos-totals-wrap .totals-box .row.total { font-size: 15.5px; }

/* Sticky Beleg-Toolbar bekommt etwas Tiefe */
.doc-toolbar { box-shadow: 0 8px 18px -12px rgba(30, 51, 34, 0.25); }

/* Kopfdaten-Karte im Editor: feine Trennlinie zwischen den Bloecken */
@media (min-width: 901px) {
  .doc-head-grid { position: relative; }
  .doc-head-grid::before { content: ''; position: absolute; left: 50%; top: 4px; bottom: 4px; width: 1px; background: var(--border); }
}

/* Eingaben: weicher Fokusuebergang ueberall */
.input, select.input, textarea.input { transition: border-color 0.15s ease, box-shadow 0.15s ease; }

/* Nav: sanfter aktiver Zustand */
.nav-item { transition: background 0.14s ease, color 0.14s ease; }

/* Reduzierte Bewegung respektieren */
@media (prefers-reduced-motion: reduce) {
  .page, .kpi-row .kpi, .grid-3 > *, .grid-2 > *, .pos-row, .modal, .modal-overlay, .dropdown, .ac-suggest.open, .pos-suggest.open { animation: none; }
  .btn:hover, .kpi:hover { transform: none; }
}

/* ============================================================
   Level-Up v4.7.1: Glas-Nav, Hero, Icon-Chips, Premium-Buttons
   ============================================================ */

/* Topnav als Glasleiste */
.topnav {
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
}

/* Dashboard-Hero */
.dash-hero {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 6px 2px 22px;
}
.dash-hero-kicker {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--text-2); margin-bottom: 4px;
}
.dash-hero-title {
  font-size: 30px; letter-spacing: -0.02em; line-height: 1.15;
  background: linear-gradient(100deg, var(--text) 30%, color-mix(in srgb, var(--accent) 70%, var(--text)) 75%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.dash-hero-sub { margin-top: 8px; }
.dash-date-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
  box-shadow: 0 1px 2px rgba(30, 51, 34, 0.05);
}
.dash-date-chip i { color: var(--accent); font-size: 14px; }

/* KPI-Kacheln: Icon-Chip + grosse Zahl */
.kpi .kpi-top { display: flex; align-items: center; gap: 9px; }
.kpi .kpi-chip {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-size: 16px;
  transition: transform 0.18s ease;
}
.kpi:hover .kpi-chip { transform: scale(1.08) rotate(-3deg); }
.kpi .kpi-chip.neg { background: var(--danger-soft); color: var(--danger); }
.kpi .kpi-chip.warn { background: var(--warn-soft); color: var(--warn); }
.kpi .kpi-label i { display: none; }
.kpi .kpi-value { font-size: 23px; margin-top: 9px; }

/* Primaerbutton: feiner Verlauf + Glow */
.btn:not(.ghost):not(.subtle):not(.danger) {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #ffffff) 0%, var(--accent) 55%);
  border-color: var(--accent);
}
.btn:not(.ghost):not(.subtle):not(.danger):hover {
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 38%, transparent);
}

/* Skeleton mit Schimmer-Lauf */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--surface-2) 55%, var(--surface)) 42%, var(--surface-2) 60%);
  background-size: 220% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 130% 0; } 100% { background-position: -90% 0; } }

/* Karten-Titelzeile: feine Akzent-Markierung */
.card .card-head h2 { position: relative; padding-left: 12px; }
.card .card-head h2::before {
  content: ''; position: absolute; left: 0; top: 3px; bottom: 3px; width: 3.5px;
  border-radius: 4px; background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 45%, var(--brand-lime)));
}

/* Tabellenkopf etwas markanter */
.tbl thead th { text-transform: uppercase; font-size: 11px; letter-spacing: 0.04em; }

@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } .kpi:hover .kpi-chip { transform: none; } }
@media (max-width: 700px) { .dash-hero-title { font-size: 24px; } }
