/* ===== C&L Aufmaß — Design premium ===== */
:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-deep: #172554;
  --accent: #f59e0b;
  --ok: #16a34a;
  --danger: #dc2626;

  --bg: #f4f6fc;
  --bg-2: #eef2fb;
  --surface: #ffffff;
  --surface-2: #f3f6fc;
  --text: #16233b;
  --text-soft: #6b7a90;
  --border: #e9eef7;
  --shadow-sm: 0 1px 2px rgba(30, 58, 138, .05);
  --shadow: 0 8px 24px rgba(30, 58, 138, .08);
  --shadow-lg: 0 18px 44px rgba(15, 23, 42, .16);
  --radius: 22px;
  --radius-sm: 16px;
  --ease: cubic-bezier(.22, .8, .28, 1);
  --dur: .32s;

  --header-h: 60px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1626;
    --bg-2: #0f1b2d;
    --surface: #17263d;
    --surface-2: #1e3252;
    --text: #eaf1fb;
    --text-soft: #9db1cf;
    --border: #26385a;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
    --shadow: 0 4px 16px rgba(0,0,0,.35);
    --shadow-lg: 0 12px 34px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, "SF Pro Display", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

#app-root { display: flex; flex-direction: column; min-height: 100%; }

/* ===== Header ===== */
#app-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  height: calc(var(--header-h) + var(--safe-top));
  padding: var(--safe-top) 16px 0;
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 100%);
  color: #fff;
  box-shadow: 0 2px 16px rgba(15, 27, 45, .25);
}
#app-title { font-size: 1.2rem; font-weight: 750; margin: 0; flex: 1; letter-spacing: .2px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-btn {
  background: rgba(255,255,255,.18); color: #fff; border: 0;
  width: 40px; height: 40px; border-radius: 12px; font-size: 1.7rem; line-height: 1;
  cursor: pointer; display: grid; place-items: center; transition: background .15s, transform .08s;
}
.header-btn:hover { background: rgba(255,255,255,.28); }
.header-btn:active { transform: scale(.92); }
.header-btn[hidden] { display: none; }

.sync-indicator {
  display: flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 600;
  background: rgba(255,255,255,.15); padding: 5px 11px; border-radius: 999px;
}
.sync-indicator .dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.sync-indicator.online .dot { background: #4ade80; box-shadow: 0 0 8px #4ade80; }
.sync-indicator.offline .dot { background: #fbbf24; box-shadow: 0 0 8px #fbbf24; }

/* ===== Main ===== */
#app { flex: 1; padding: 18px 16px calc(90px + var(--safe-bottom)); max-width: 820px; width: 100%; margin: 0 auto; }

/* ===== Bottom navigation ===== */
#bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  display: flex; justify-content: center; gap: 2px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--border);
  padding: 6px 6px calc(6px + var(--safe-bottom));
  box-shadow: 0 -4px 20px rgba(15, 27, 45, .08);
}
#bottom-nav button {
  flex: 1; max-width: 120px; background: none; border: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 0 5px; border-radius: 12px; color: var(--text-soft);
  font-size: .66rem; font-weight: 650; font-family: inherit;
  transition: color .15s, background .15s, transform .08s;
}
#bottom-nav button .nav-ico { font-size: 1.42rem; line-height: 1; filter: grayscale(.3); transition: transform .12s, filter .15s; }
#bottom-nav button:active { transform: scale(.92); }
#bottom-nav button.active { color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, transparent); }
#bottom-nav button.active .nav-ico { filter: none; transform: translateY(-1px) scale(1.06); }
@media (prefers-color-scheme: dark) { #bottom-nav button.active { color: #7fb0e6; } }

/* ===== Dashboard ===== */
.dash-welcome { text-align: center; margin: 2px 4px 4px; }
.dash-hi { font-size: 1.35rem; font-weight: 750; letter-spacing: -.3px; }
.dash-sub { font-size: .82rem; color: var(--text-soft); font-weight: 600; margin-top: 2px; }

.dash-today { padding: 16px 18px; }
.dash-today-head { display: flex; justify-content: space-between; align-items: center; font-size: .82rem; font-weight: 700; color: var(--text-soft); margin-bottom: 14px; }
.dash-clock-wrap { font-variant-numeric: tabular-nums; }
.dash-clock { font-weight: 800; color: var(--text); }
.dash-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.dash-stat { display: flex; align-items: center; gap: 9px; background: var(--surface-2); border-radius: 14px; padding: 11px 10px; }
.dash-stat-ico { font-size: 1.25rem; }
.dash-stat-val { font-size: 1.06rem; font-weight: 800; color: var(--text); letter-spacing: -.4px; line-height: 1.1; }
.dash-stat-lbl { font-size: .68rem; color: var(--text-soft); font-weight: 600; }
.dash-live { margin-top: 14px; font-size: .86rem; color: var(--text-soft); cursor: pointer; }
.dash-sites { margin-top: 14px; font-size: .86rem; color: var(--text); font-weight: 600; }
.dash-sites.muted { color: var(--text-soft); font-weight: 500; }

/* ===== Logo ===== */
.home-logo-wrap { display: flex; justify-content: center; margin: 4px 0 16px; }
.home-logo {
  max-width: 260px; width: 70%; height: auto; background: #fff;
  border-radius: 22px; padding: 12px 16px; box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.home-welcome { margin: 2px 4px 16px; color: var(--text-soft); font-size: .95rem; text-align: center; }
.home-welcome strong { color: var(--text); }

/* ===== Suchleiste (Home) ===== */
.search-bar {
  display: flex; align-items: center; gap: 11px; width: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); padding: 14px 16px; margin-bottom: 4px;
  cursor: pointer; font-family: inherit; text-align: left;
  transition: border-color .15s, box-shadow .15s, transform .08s;
}
.search-bar:hover { border-color: var(--brand); }
.search-bar:active { transform: scale(.99); }
.search-bar .sb-ico { font-size: 1.2rem; flex: 0 0 auto; }
.search-bar .sb-text { color: var(--text-soft); font-size: .95rem; font-weight: 500; }

/* ===== Home grid — plăci colorate ===== */
.home-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 8px; }
.tile {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 14px;
  min-height: 120px; padding: 18px;
  border: 0; border-radius: var(--radius);
  box-shadow: var(--shadow); cursor: pointer; text-align: left;
  color: #fff;
  transition: transform .16s var(--ease), box-shadow .2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.tile:hover { transform: translateY(-2px); }
.tile:active { transform: scale(.955); }
.tile .ico-wrap {
  width: 50px; height: 50px; border-radius: 15px; background: rgba(255,255,255,.18);
  display: grid; place-items: center;
}
.tile .ico { font-size: 1.7rem; line-height: 1; }
.tile .tile-label { font-size: 1.1rem; font-weight: 750; letter-spacing: .2px; }

/* culori module — degrade curat + umbră colorată (viață) */
.c-blue   { background: linear-gradient(150deg, #3b82f6, #1d4ed8); box-shadow: 0 10px 24px rgba(37,99,235,.30); }
.c-teal   { background: linear-gradient(150deg, #2dd4bf, #0d9488); box-shadow: 0 10px 24px rgba(20,184,166,.30); }
.c-orange { background: linear-gradient(150deg, #fb923c, #ea580c); box-shadow: 0 10px 24px rgba(234,88,12,.30); }
.c-purple { background: linear-gradient(150deg, #a78bfa, #7c3aed); box-shadow: 0 10px 24px rgba(139,92,246,.30); }
.c-pink   { background: linear-gradient(150deg, #fb7185, #e11d48); box-shadow: 0 10px 24px rgba(244,63,94,.30); }
.c-indigo { background: linear-gradient(150deg, #818cf8, #4f46e5); box-shadow: 0 10px 24px rgba(99,102,241,.30); }
.c-slate  { background: linear-gradient(150deg, #64748b, #334155); box-shadow: 0 10px 24px rgba(71,85,105,.24); }
.c-green   { background: linear-gradient(150deg, #34d399, #059669); box-shadow: 0 10px 24px rgba(5,150,105,.30); }

.tile.full {
  grid-column: 1 / -1; min-height: 0; flex-direction: row; align-items: center;
  justify-content: flex-start; padding: 16px 20px; gap: 16px;
}
/* Gesperrtes Modul: sichtbar, aber abgedunkelt (Kunde sieht es, kann es nicht öffnen) */
.tile.locked { filter: grayscale(.85); opacity: .55; box-shadow: var(--shadow-sm); }
.tile.locked:active { transform: none; }
#bottom-nav button.locked { opacity: .4; }
/* Gesperrte Einzel-Funktion (Feature-Flag): abgedunkelt + Schloss */
.feat-locked { opacity: .5; filter: grayscale(.6); }
.feat-locked::after { content: ' 🔒'; }
.tile.full .ico-wrap { width: 46px; height: 46px; }
.tile.full .tile-label { font-size: 1.08rem; }

/* ===== Section / cards ===== */
.section-title {
  font-size: 1.05rem; font-weight: 750; margin: 22px 4px 12px; display: flex; align-items: center; gap: 9px;
}
.section-title::before {
  content: ''; width: 4px; height: 18px; border-radius: 3px;
  background: linear-gradient(var(--accent), #d97706);
}
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px;
}
.card.pad-sm { padding: 10px 16px; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 8px; text-align: center; box-shadow: var(--shadow-sm);
}
.stat .val { font-size: 1.3rem; font-weight: 800; color: var(--brand); letter-spacing: -.5px; }
.stat .lbl { font-size: .72rem; color: var(--text-soft); margin-top: 3px; font-weight: 600; }
@media (prefers-color-scheme: dark) { .stat .val { color: #7fb0e6; } }

/* ===== Forms ===== */
.field { margin-bottom: 13px; }
.field label { display: block; font-size: .82rem; font-weight: 650; color: var(--text-soft); margin-bottom: 7px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 14px 15px; font-size: 1rem; font-family: inherit;
  background: var(--surface); color: var(--text);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 165, .14);
}
.field textarea { resize: vertical; min-height: 76px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 15px 18px; font-size: 1rem; font-weight: 700; font-family: inherit;
  border: 0; border-radius: var(--radius-sm); cursor: pointer; width: 100%;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 165, .28); -webkit-tap-highlight-color: transparent;
  transition: transform .08s, filter .15s, box-shadow .15s;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; box-shadow: none; }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1.5px solid var(--border); box-shadow: var(--shadow-sm); }
.btn.accent { background: linear-gradient(135deg, #f59e0b, #d97706); color: #3b2600; box-shadow: 0 4px 14px rgba(245,158,11,.3); }
.btn.ok { background: linear-gradient(135deg, #22b866, #16a34a); box-shadow: 0 4px 14px rgba(22,163,74,.3); }
.btn.danger { background: linear-gradient(135deg, #ef4444, #dc2626); box-shadow: 0 4px 14px rgba(220,38,38,.3); }
.btn.ghost { background: transparent; color: var(--brand); box-shadow: none; }
.btn.big { padding: 20px; font-size: 1.15rem; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.btn-row.three { grid-template-columns: repeat(3, 1fr); }

/* ===== List items ===== */
.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 15px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); cursor: pointer; transition: transform .08s, box-shadow .15s;
}
.item:hover { box-shadow: var(--shadow); }
.item:active { transform: scale(.99); }
.item .main { flex: 1; min-width: 0; }
.item .main .t { font-weight: 700; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .main .s { font-size: .82rem; color: var(--text-soft); margin-top: 3px; }
.item .val { text-align: right; font-weight: 800; color: var(--brand); white-space: nowrap; }
@media (prefers-color-scheme: dark) { .item .val { color: #7fb0e6; } }
.item .chev { color: var(--text-soft); font-size: 1.5rem; opacity: .6; }
/* Kleiner, fixer Aktions-Knopf in einer Listenzeile (z. B. PDF-Export) — NICHT die volle .btn-Breite. */
.item-act {
  flex: 0 0 auto; width: 40px; height: 40px; padding: 0; margin: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); cursor: pointer; font-size: 1.15rem; line-height: 1;
  transition: background .12s, border-color .12s, transform .08s;
}
.item-act:hover { border-color: var(--brand); background: rgba(23,63,115,.06); }
.item-act:active { transform: scale(.92); }

.empty { text-align: center; color: var(--text-soft); padding: 48px 20px; }
.empty .ico { font-size: 3.2rem; opacity: .5; }

/* ===== Timeline / Projekt-Journal ===== */
.tl-day {
  font-size: .8rem; font-weight: 800; color: var(--text-soft); text-transform: uppercase;
  letter-spacing: .5px; margin: 18px 4px 8px; padding-bottom: 5px; border-bottom: 1px solid var(--border);
}
.tl-day:first-child { margin-top: 4px; }

/* ===== FAB ===== */
.fab {
  position: fixed; right: 20px; bottom: calc(88px + var(--safe-bottom)); z-index: 40;
  width: 62px; height: 62px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; font-size: 2rem; line-height: 1;
  box-shadow: 0 8px 24px rgba(245, 158, 11, .42); display: grid; place-items: center;
  transition: transform .1s;
}
.fab:active { transform: scale(.9); }

/* ===== Toast ===== */
#toast-host { position: fixed; left: 0; right: 0; bottom: calc(92px + var(--safe-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 100; pointer-events: none; }
.toast {
  background: #17233a; color: #fff; padding: 13px 20px; border-radius: 14px; font-size: .92rem; font-weight: 600;
  box-shadow: var(--shadow-lg); max-width: 90%; animation: toastIn .22s cubic-bezier(.2,.8,.2,1);
}
.toast.ok { background: linear-gradient(135deg, #22b866, #16a34a); } .toast.err { background: linear-gradient(135deg, #ef4444, #dc2626); }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } }

/* ===== Multi-select chips ===== */
.chip-select { display: flex; flex-wrap: wrap; gap: 8px; max-height: 220px; overflow-y: auto; padding: 2px; }
.chip-opt {
  padding: 10px 14px; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--surface); color: var(--text); font-size: .85rem; font-weight: 650;
  cursor: pointer; -webkit-tap-highlight-color: transparent; display: flex; align-items: center; gap: 6px;
  transition: transform .08s, background .12s, border-color .12s;
}
.chip-opt:active { transform: scale(.95); }
.chip-opt.sel { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; border-color: transparent; box-shadow: 0 3px 10px rgba(37,99,165,.28); }
.chip-opt .dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.chip-count { font-size: .78rem; color: var(--text-soft); margin: 9px 2px 0; font-weight: 600; }

/* ===== Chip / badge ===== */
.chip { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: .74rem; font-weight: 700; background: var(--surface-2); color: var(--text-soft); }
.chip.on { background: rgba(22,163,74,.15); color: var(--ok); }

/* ===== Modal ===== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10,20,35,.55); backdrop-filter: blur(2px); z-index: 200; display: grid; place-items: end center; }
.modal { background: var(--surface); width: 100%; max-width: 820px; max-height: 92vh; overflow-y: auto; border-radius: 24px 24px 0 0; padding: 22px 18px calc(26px + var(--safe-bottom)); box-shadow: var(--shadow-lg); animation: sheetUp .26s cubic-bezier(.2,.8,.2,1); }
.modal::before { content: ''; display: block; width: 42px; height: 5px; border-radius: 3px; background: var(--border); margin: -6px auto 14px; }
@keyframes sheetUp { from { transform: translateY(100%); } }
/* Schließen-Knopf: klebt oben, bleibt beim Scrollen sichtbar */
.sheet-topbar { position: sticky; top: -6px; z-index: 6; height: 0; display: flex; justify-content: flex-end; pointer-events: none; }
.sheet-close { pointer-events: auto; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--text); font-size: 1.15rem; font-weight: 700; line-height: 1; cursor: pointer; display: grid; place-items: center; box-shadow: var(--shadow-sm); -webkit-tap-highlight-color: transparent; }
.sheet-close:active { transform: scale(.9); }
.modal h2 { margin: 2px 0 18px; font-size: 1.25rem; font-weight: 750; padding-right: 44px; }

/* ===== Auf Plan messen (Vollbild) ===== */
.plan-overlay { position: fixed; inset: 0; z-index: 300; background: #0f1b2d; display: flex; flex-direction: column; }
.plan-bar { display: flex; align-items: center; gap: 10px; padding: 12px 14px calc(12px); color: #fff; background: #173f73; }
.plan-bar strong { font-size: 1.05rem; }
.plan-tools { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 12px; background: #12294a; }
.plan-tool { width: auto !important; padding: 8px 12px !important; margin: 0 !important; box-shadow: none !important; font-size: .9rem; }
.plan-scroll { flex: 1; overflow: auto; background: #1e293b; -webkit-overflow-scrolling: touch; display: block; }
.plan-canvas { display: block; background: #fff; touch-action: pan-x pan-y; }
.plan-status { padding: 10px 14px calc(10px + var(--safe-bottom)); color: #cbd5e1; font-size: .82rem; background: #12294a; min-height: 1.2em; }

.divider { height: 1px; background: var(--border); margin: 14px 0; border: 0; }
.muted { color: var(--text-soft); font-size: .85rem; }

/* big live timer */
.timer-big { font-size: 3.4rem; font-weight: 850; text-align: center; font-variant-numeric: tabular-nums; color: var(--brand); margin: 8px 0; letter-spacing: 1px; }
@media (prefers-color-scheme: dark) { .timer-big { color: #7fb0e6; } }

/* ===== Aufmaß Dashboard (KPIs) ===== */
.auf-dash { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.auf-kpi { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; box-shadow: var(--shadow-sm); }
.auf-kpi.wide { grid-column: 1 / -1; }
.auf-kpi-ico { font-size: 1.5rem; line-height: 1; flex: 0 0 auto; }
.auf-kpi-val { font-size: 1.15rem; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.auf-kpi.wide .auf-kpi-val { color: var(--brand); }
.auf-kpi-lbl { font-size: .76rem; color: var(--text-soft); font-weight: 600; }

/* ===== Quick Actions (Projekt-Hub) ===== */
.quick-row { display: flex; gap: 8px; overflow-x: auto; margin-top: 12px; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.quick-row::-webkit-scrollbar { display: none; }
.quick-btn { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 68px; padding: 10px 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); cursor: pointer; font-size: .74rem; font-weight: 700; color: var(--text); }
.quick-btn:active { transform: scale(.95); }
.quick-ico { font-size: 1.35rem; line-height: 1; }

/* ===== Kunden Plus/Minus ===== */
.pc-item { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; margin-bottom: 8px; box-shadow: var(--shadow-sm); }
.pc-x { border: 0; background: transparent; color: var(--text-soft); cursor: pointer; font-size: .95rem; padding: 2px 6px; flex: 0 0 auto; }
.pc-x:active { transform: scale(.9); }

/* ===== Foto-Ordner ===== */
.ordner-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.ordner-tile { position: relative; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); padding: 16px 14px; cursor: pointer; background-size: cover; background-position: center; min-height: 92px; overflow: hidden; }
.ordner-tile:active { transform: scale(.97); }
.ordner-tile.has-cover { color: #fff; }
.ordner-tile.has-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.6), rgba(0,0,0,.05)); z-index: 0; }
.ordner-tile.has-cover .ordner-name, .ordner-tile.has-cover .ordner-count { position: relative; z-index: 1; }
.ordner-ico { font-size: 1.8rem; line-height: 1; margin-bottom: 6px; }
.ordner-name { font-weight: 750; font-size: .98rem; }
.ordner-count { font-size: .78rem; color: var(--text-soft); font-weight: 600; }
.ordner-tile.has-cover .ordner-count { color: rgba(255,255,255,.85); }

/* ===== Foto-Galerie ===== */
.foto-day { font-size: .8rem; font-weight: 700; color: var(--text-soft); margin: 14px 2px 8px; }
.foto-day:first-child { margin-top: 4px; }
.foto-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.foto-thumb { aspect-ratio: 1; border-radius: 12px; background-color: var(--surface-2); background-size: cover; background-position: center; background-repeat: no-repeat; display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow-sm); font-size: 1.5rem; overflow: hidden; }
.foto-thumb:active { transform: scale(.96); }

/* ===== Aufmaß (Positionen) ===== */
.auf-row { border-left: 4px solid var(--brand); }
.auf-row-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.auf-row-nr { font-weight: 750; color: var(--brand); font-size: .92rem; }
.auf-del { border: 0; background: var(--surface-2); color: var(--danger); width: 32px; height: 32px; border-radius: 10px; font-size: 1rem; cursor: pointer; line-height: 1; }
.auf-del:active { transform: scale(.92); }
.auf-calc { margin-top: 12px; padding: 9px 12px; border-radius: 12px; background: var(--surface-2); color: var(--text-soft); font-size: .84rem; font-variant-numeric: tabular-nums; }
.auf-summe { background: linear-gradient(135deg, var(--brand-dark), var(--brand)); color: #fff; }
.auf-summe-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; font-variant-numeric: tabular-nums; }
.auf-summe-row span { opacity: .85; }
.auf-summe-row strong { font-size: 1.05rem; font-weight: 750; }
.auf-summe-row.big strong { font-size: 1.5rem; font-weight: 850; }

/* ===== Rechnungs-Editor (LexOffice-inspiriert, eigenes Branding) ===== */
.rech-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.rech-doc-title { font-size: 1.28rem; font-weight: 850; color: var(--text); letter-spacing: -.01em; }
.rech-seg { display: inline-flex; background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 12px; padding: 3px; gap: 3px; }
.rech-seg-btn { border: 0; background: transparent; color: var(--text-soft); font-weight: 750; font-size: .86rem; padding: 7px 16px; border-radius: 9px; cursor: pointer; transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.rech-seg-btn.on { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
/* Zweispaltiger Kopf — stapelt auf schmalen Screens */
.rech-head { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 4px 0 2px; }
.rech-panel { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); padding: 16px; }
.rech-panel-h { font-size: .82rem; font-weight: 800; color: var(--brand); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1.5px solid var(--border); }
.rech-intro { margin-top: 12px; }
/* Positionszeile: Menge/Einheit/Preis nebeneinander */
.rech-pos-row { grid-template-columns: 1fr 1fr 1.2fr; }
/* Summenleiste dezent dunkler (dokumenthafter Abschluss) */
.rech-summe { background: linear-gradient(135deg, #2b3648, #1e2836); }
@media (max-width: 620px) { .rech-head { grid-template-columns: 1fr; } }

/* ===== Route-Picker (Fahrtenbuch: Stopps der Reihe nach) ===== */
.route-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.route-nr { font-weight: 750; color: var(--brand); font-size: .78rem; flex: 0 0 54px; }
.route-sel { flex: 1; min-width: 0; }
.route-actions { display: flex; gap: 4px; flex: 0 0 auto; }
.route-btn { border: 1.5px solid var(--border); background: var(--surface-2); color: var(--text-soft); width: 34px; height: 40px; border-radius: 10px; font-size: 1rem; cursor: pointer; line-height: 1; }
.route-btn.del { color: var(--danger); }
.route-btn:active { transform: scale(.9); }
.route-list:empty { display: none; }

/* ========================================================= */
/* ===== Leben & Bewegung (Animationen, Feedback) ========== */
/* ========================================================= */

/* Sanftes Einblenden der Seite — jede Ansicht „atmet" beim Öffnen */
@keyframes appIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
#app > * { animation: appIn var(--dur) var(--ease) both; }
#app > *:nth-child(2) { animation-delay: .04s; }
#app > *:nth-child(3) { animation-delay: .08s; }
#app > *:nth-child(4) { animation-delay: .12s; }
#app > *:nth-child(5) { animation-delay: .16s; }
#app > *:nth-child(6) { animation-delay: .20s; }
#app > *:nth-child(7) { animation-delay: .24s; }
#app > *:nth-child(n+8) { animation-delay: .28s; }

/* Home-Kacheln nacheinander hereinfliegen */
.home-grid .tile { animation: appIn var(--dur) var(--ease) both; }
.home-grid .tile:nth-child(2) { animation-delay: .04s; }
.home-grid .tile:nth-child(3) { animation-delay: .08s; }
.home-grid .tile:nth-child(4) { animation-delay: .12s; }
.home-grid .tile:nth-child(5) { animation-delay: .16s; }
.home-grid .tile:nth-child(6) { animation-delay: .20s; }
.home-grid .tile:nth-child(7) { animation-delay: .24s; }
.home-grid .tile:nth-child(8) { animation-delay: .28s; }
.home-grid .tile:nth-child(n+9) { animation-delay: .32s; }

/* „Online"-Punkt pulsiert — Zeichen von Leben */
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(74,222,128,.5); }
  70% { box-shadow: 0 0 0 7px rgba(74,222,128,0); }
  100% { box-shadow: 0 0 0 0 rgba(74,222,128,0); }
}
.sync-indicator.online .dot { animation: livePulse 2.4s ease-out infinite; }

/* Sanfter Druck-Feedback überall */
.card, .stat, .auf-kpi, .search-bar { transition: transform .12s var(--ease), box-shadow .18s var(--ease); }

/* Nutzer, die Animationen reduzieren wollen — alles ruhig */
@media (prefers-reduced-motion: reduce) {
  #app > *, .home-grid .tile, .sync-indicator.online .dot { animation: none !important; }
}

/* ===== Marktplatz (Auftragsbörse) ===== */
.mp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 2px 12px; }
.mp-head-title { font-size: 1.15rem; font-weight: 800; letter-spacing: -.3px; }

.mp-filterbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.mp-filter {
  flex: 1 1 30%; min-width: 92px; padding: 9px 11px; font-size: .88rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm);
}
.mp-filter:focus { outline: none; border-color: var(--brand); }

.mp-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); padding: 14px 16px; margin-bottom: 11px; cursor: pointer;
  border-left: 4px solid var(--accent); transition: transform .12s var(--ease), box-shadow .18s var(--ease);
}
.mp-card:active { transform: scale(.99); }
.mp-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.mp-gewerk { font-size: .74rem; font-weight: 800; color: var(--brand); text-transform: uppercase; letter-spacing: .4px; }
.mp-time { font-size: .74rem; color: var(--text-soft); font-weight: 600; }
.mp-card-title { font-size: 1.02rem; font-weight: 700; line-height: 1.3; margin-bottom: 4px; }
.mp-card-vol { font-size: .84rem; color: var(--text-soft); margin-bottom: 6px; }
.mp-card-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.mp-loc { font-size: .82rem; color: var(--text-soft); font-weight: 600; }
.mp-budget { font-size: .92rem; font-weight: 800; color: var(--ok); white-space: nowrap; }

.mp-drow { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.mp-drow:last-child { border-bottom: none; }
.mp-dlabel { color: var(--text-soft); font-weight: 600; font-size: .88rem; flex: 0 0 auto; }

/* ===== Marktplatz — Tabs, Anonym, Checkbox ===== */
.mp-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.mp-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 9px 6px; border-radius: 14px; cursor: pointer;
  background: var(--surface); color: var(--text-soft);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  font-weight: 700; transition: all .15s var(--ease);
}
.mp-tab.active { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--brand); border-color: var(--brand); }
.mp-tab-l { font-size: .95rem; }
.mp-tab-s { font-size: .68rem; font-weight: 600; opacity: .8; }

.mp-anon { color: var(--accent); font-weight: 700; }
.mp-anon-badge {
  display: inline-block; margin-top: 8px; padding: 3px 10px; border-radius: 999px;
  font-size: .74rem; font-weight: 700; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent);
}
.mp-check {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 6px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px;
  font-size: .9rem; font-weight: 600; cursor: pointer;
}
.mp-check input { width: 20px; height: 20px; flex: 0 0 auto; accent-color: var(--brand); }
