  :root {
    --green: #1a9e6e; --green-dark: #0d6e4a; --green-light: #e8f8f2; --green-mid: #b2e8d4;
    --bg: #f7f8fa; --card: #ffffff; --border: #e2e6ea; --border-strong: #c8d0d8;
    --text: #1a1d23; --text-2: #4a5568; --text-3: #8a95a3;
    --red: #e53e3e; --red-light: #fff5f5; --amber: #d97706;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.05);
    --radius: 12px; --radius-sm: 8px; --radius-xs: 6px;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: 'DM Sans', system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; font-size: 14px; line-height: 1.6; }

  .layout { display: flex; min-height: 100vh; }
  .sidebar { width: 240px; background: #0f1923; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; height: 100vh; height: 100dvh; overflow: hidden; }
  .sidebar-logo { padding: 14px 16px 14px; border-bottom: 1px solid rgba(255,255,255,0.12); background: #fff; border-radius: 0; flex-shrink: 0; }
  .logo-mark { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; background: var(--green); border-radius: 10px; margin-bottom: 10px; }
  .logo-mark svg { width: 24px; height: 24px; }
  .sidebar-logo h1 { font-size: 15px; font-weight: 600; color: #fff; letter-spacing: -0.3px; }
  .sidebar-logo p { font-size: 11px; color: rgba(255,255,255,0.38); margin-top: 1px; }
  .sidebar-nav { padding: 16px 12px; flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.2) transparent; }
  .sidebar-nav::-webkit-scrollbar { width: 4px; }
  .sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
  .nav-label { font-size: 10px; font-weight: 600; color: rgba(255,255,255,0.25); letter-spacing: 0.08em; text-transform: uppercase; padding: 0 12px; margin-bottom: 6px; margin-top: 16px; }
  .nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; cursor: pointer; color: rgba(255,255,255,0.5); font-size: 13.5px; transition: all 0.15s; margin-bottom: 2px; }
  .nav-item:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.85); }
  .nav-item.active { background: rgba(26,158,110,0.2); color: #4dd9a5; }
  .nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
  .nav-badge { margin-left: auto; background: var(--green); color: #fff; font-size: 10px; font-weight: 600; padding: 1px 7px; border-radius: 999px; min-width: 20px; text-align: center; }
  .sidebar-footer { padding: 16px 24px; border-top: 1px solid rgba(255,255,255,0.07); font-size: 11px; color: rgba(255,255,255,0.25); flex-shrink: 0; }
  #sidebar-user-bar { flex-shrink: 0; padding-bottom: max(10px, env(safe-area-inset-bottom, 0)); }

  .main { margin-left: 240px; flex: 1; display: flex; flex-direction: column; }
  .topbar { background: var(--card); border-bottom: 1px solid var(--border); padding: 0 32px; height: 60px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow-sm); }
  .page-title { font-size: 15px; font-weight: 600; color: var(--text); letter-spacing: -0.2px; }
  .page-subtitle { font-size: 12px; color: var(--text-3); }
  .topbar-right { display: flex; align-items: center; gap: 10px; }

  .btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; border-radius: var(--radius-xs); font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: all 0.15s; font-family: inherit; }
  .btn svg { width: 15px; height: 15px; }
  .btn-primary { background: var(--green); color: #fff; }
  .btn-primary:hover { background: var(--green-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(26,158,110,0.35); }
  .btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border-strong); }
  .btn-ghost:hover { background: var(--bg); color: var(--text); }
  .btn-danger { background: transparent; color: var(--red); border: 1px solid #fca5a5; padding: 5px 10px; font-size: 12px; }
  .btn-danger:hover { background: var(--red-light); }
  .btn-edit { background: transparent; color: #3b82f6; border: 1px solid #93c5fd; padding: 5px 10px; font-size: 12px; }
  .btn-edit:hover { background: #eff6ff; }

  .content { padding: 28px 32px; }
  .view { display: none; } .view.active { display: block; }

  .stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
  .stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
  .stat-label { font-size: 11.5px; color: var(--text-3); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
  .stat-value { font-size: 22px; font-weight: 600; color: var(--text); letter-spacing: -0.5px; }
  .stat-value.green { color: var(--green); } .stat-value.red { color: var(--red); }

  .edit-banner { display: none; background: #fffbeb; border: 1.5px solid #fde68a; border-radius: var(--radius-sm); padding: 10px 16px; margin-bottom: 20px; align-items: center; gap: 10px; font-size: 13px; color: #92400e; font-weight: 500; }
  .edit-banner.show { display: flex; }
  .edit-banner svg { width: 16px; height: 16px; flex-shrink: 0; }
  .edit-banner-cancel { margin-left: auto; background: none; border: 1px solid #fcd34d; color: #92400e; padding: 4px 12px; border-radius: 6px; font-size: 12px; cursor: pointer; font-family: inherit; font-weight: 500; }
  .edit-banner-cancel:hover { background: #fef3c7; }

  .form-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 20px; overflow: hidden; }
  .form-card-header { padding: 16px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; background: #fafbfc; }
  .section-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .section-icon svg { width: 16px; height: 16px; }
  .icon-buy { background: #e8f8f2; color: var(--green); }
  .icon-sell { background: #eff6ff; color: #3b82f6; }
  .icon-cost { background: #fff7ed; color: var(--amber); }
  .icon-info { background: #f5f3ff; color: #7c3aed; }
  .icon-gen  { background: #f0fdf4; color: #16a34a; }
  .section-header-text h3 { font-size: 14px; font-weight: 600; color: var(--text); }
  .section-header-text p  { font-size: 12px; color: var(--text-3); }
  .form-body { padding: 20px 22px; }

  .grid { display: grid; gap: 14px; }
  .g2 { grid-template-columns: 1fr 1fr; }
  .g3 { grid-template-columns: 1fr 1fr 1fr; }
  .g4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
  .mb16 { margin-bottom: 16px; }

  .field { display: flex; flex-direction: column; gap: 5px; }
  .field label { font-size: 11.5px; font-weight: 500; color: var(--text-2); }
  .field input, .field select { font-family: 'DM Sans', sans-serif; font-size: 13.5px; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-xs); background: #fff; color: var(--text); transition: border-color 0.15s, box-shadow 0.15s; outline: none; width: 100%; -webkit-appearance: none; }
  .field input:focus, .field select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(26,158,110,0.12); }
  .field input::placeholder { color: var(--text-3); }
  .field input[type="number"] { font-family: 'DM Mono', monospace; }

  .cost-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-bottom: 1px solid #f0f2f5; font-size: 13.5px; }
  .cost-row:last-child { border-bottom: none; }
  .cost-row.total { border-top: 2px solid var(--border); border-bottom: none; padding-top: 12px; margin-top: 4px; }
  .cost-row.total .cost-label { font-weight: 600; font-size: 14px; }
  .cost-row.total .cost-val { font-weight: 700; font-size: 16px; font-family: 'DM Mono', monospace; }
  .cost-label { color: var(--text-2); } .cost-val { font-family: 'DM Mono', monospace; color: var(--text); font-weight: 500; }
  .gewinn-box { background: var(--green-light); border: 1px solid var(--green-mid); border-radius: var(--radius-sm); padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }
  .gewinn-box.neg { background: var(--red-light); border-color: #fca5a5; }
  .gewinn-label { font-size: 13px; font-weight: 600; color: var(--green-dark); }
  .gewinn-box.neg .gewinn-label { color: var(--red); }
  .gewinn-val { font-size: 26px; font-weight: 700; color: var(--green); font-family: 'DM Mono', monospace; letter-spacing: -1px; }
  .gewinn-box.neg .gewinn-val { color: var(--red); }

  .toast { display: none; padding: 10px 16px; border-radius: var(--radius-xs); font-size: 13px; font-weight: 500; align-items: center; gap: 8px; margin-left: auto; }
  .toast.show { display: inline-flex; }
  .toast.success { background: var(--green-light); color: var(--green-dark); border: 1px solid var(--green-mid); }
  .toast.error   { background: var(--red-light); color: var(--red); border: 1px solid #fca5a5; }

  .db-toolbar-wrap { position: sticky; top: 0; z-index: 20; background: var(--bg); padding-bottom: 10px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
  .db-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
  .db-toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .db-search-wide { flex: 1; min-width: 220px; max-width: 420px; width: auto; }
  .db-select { font-size: 12px; padding: 6px 10px; border: 1.5px solid var(--border); border-radius: var(--radius-xs); background: var(--card); color: var(--text); cursor: pointer; }
  .db-select:focus { outline: none; border-color: var(--green); }
  .db-count-label { font-size: 12px; color: var(--text-3); white-space: nowrap; min-width: 90px; text-align: right; }
  .db-filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
  .db-ftab { padding: 5px 14px; border: 1.5px solid var(--border); border-radius: 20px; background: var(--card); font-size: 12px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: all .12s; }
  .db-ftab:hover { border-color: var(--border-strong); color: var(--text); }
  .db-ftab.active { background: var(--green-light); border-color: var(--green-mid); color: var(--green-dark); }
  .db-ftab-count { margin-left: 6px; font-size: 10px; font-weight: 700; opacity: .75; }
  .search-box { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius-xs); padding: 7px 14px; width: 260px; }
  .search-box:focus-within { border-color: var(--green); }
  .search-box svg { color: var(--text-3); width: 15px; height: 15px; flex-shrink: 0; }
  .search-box input { border: none; outline: none; font-size: 13px; background: transparent; color: var(--text); font-family: inherit; width: 100%; }
  .search-box input::placeholder { color: var(--text-3); }
  .records-grid { display: flex; flex-direction: column; gap: 0; }

  .db-table-wrap { background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
  .db-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
  .db-table thead { background: #f8fafc; position: sticky; top: 0; z-index: 2; }
  .db-table th { padding: 8px 10px; text-align: left; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); border-bottom: 1.5px solid var(--border); white-space: nowrap; }
  .db-table th.r, .db-table td.r { text-align: right; }
  .db-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
  .db-table tbody tr.db-row { cursor: pointer; transition: background .1s; }
  .db-table tbody tr.db-row:hover { background: #f8fafc; }
  .db-table tbody tr.db-row.expanded { background: #f0fdf4; }
  .db-table .db-produkt { font-weight: 600; color: var(--text); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .db-table .db-mono { font-family: 'DM Mono', monospace; font-size: 11.5px; color: var(--text-2); }
  .db-table .db-gewinn { font-family: 'DM Mono', monospace; font-weight: 700; font-size: 12px; white-space: nowrap; }
  .db-gewinn-pos { color: var(--green-dark); }
  .db-gewinn-neg { color: var(--red); }
  .db-table .status-badge { font-size: 10px; padding: 2px 8px; }
  .db-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 6px; background: var(--card); color: var(--text-2); cursor: pointer; transition: all .1s; padding: 0; }
  .db-icon-btn:hover { border-color: var(--border-strong); color: var(--text); background: var(--bg); }
  .db-icon-btn.danger:hover { border-color: #fca5a5; color: var(--red); background: var(--red-light); }
  .db-icon-btn.edit:hover { border-color: var(--green-mid); color: var(--green-dark); background: var(--green-light); }
  .db-actions { display: flex; gap: 4px; justify-content: flex-end; }
  .db-expand-cell { width: 28px; text-align: center; color: var(--text-3); }
  .db-expand-cell svg { transition: transform .15s; }
  .db-row.expanded .db-expand-cell svg { transform: rotate(90deg); color: var(--green-dark); }
  .db-detail-row td { padding: 0; background: #fafbfd; border-bottom: 1.5px solid var(--border); }
  .db-detail-inner { padding: 12px 14px 14px 38px; }
  .db-detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px 16px; margin-bottom: 10px; }
  .db-detail-grid .detail-label { font-size: 9.5px; }
  .db-detail-grid .detail-value { font-size: 12px; }
  .db-detail-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
  .db-pagination { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 0 4px; flex-wrap: wrap; }
  .db-page-info { font-size: 12px; color: var(--text-3); }
  .db-page-btn { padding: 5px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-xs); background: var(--card); font-size: 12px; cursor: pointer; color: var(--text-2); }
  .db-page-btn:hover:not(:disabled) { border-color: var(--green-mid); color: var(--green-dark); }
  .db-page-btn:disabled { opacity: .4; cursor: default; }
  @media(max-width:900px){
    .db-table-wrap { overflow-x: auto; }
    .db-table { min-width: 720px; }
    .db-toolbar-actions { width: 100%; justify-content: flex-end; }
  }

  .record-card { background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 18px 22px; box-shadow: var(--shadow-sm); transition: box-shadow 0.15s, border-color 0.15s; }
  .record-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
  .record-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
  .record-icon { width: 44px; height: 44px; background: var(--green-light); border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-right: 12px; color: var(--green); }
  .record-icon svg { width: 22px; height: 22px; }
  .record-name { font-size: 15px; font-weight: 600; color: var(--text); letter-spacing: -0.2px; }
  .record-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; display: flex; gap: 10px; flex-wrap: wrap; }
  .profit-badge { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; font-family: 'DM Mono', monospace; }
  .profit-badge.pos { background: var(--green-light); color: var(--green-dark); }
  .profit-badge.neg { background: var(--red-light); color: var(--red); }
  .record-details { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 16px; padding-top: 12px; border-top: 1px solid var(--border); }
  .detail-label { font-size: 10.5px; color: var(--text-3); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
  .detail-value { font-size: 13px; font-weight: 500; color: var(--text); margin-top: 1px; }
  .record-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
  .chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
  .chip-green  { background: var(--green-light); color: var(--green-dark); }
  .chip-blue   { background: #eff6ff; color: #1d4ed8; }
  .chip-purple { background: #f5f3ff; color: #5b21b6; }

  .empty-state { text-align: center; padding: 60px 20px; background: var(--card); border: 1.5px dashed var(--border-strong); border-radius: var(--radius); }
  .empty-icon  { color: var(--text-3); margin-bottom: 12px; }
  .empty-title { font-size: 16px; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
  .empty-sub   { font-size: 13px; color: var(--text-3); }

  ::-webkit-scrollbar { width: 6px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

  @media (max-width: 900px) {
    .g3 { grid-template-columns: 1fr 1fr; }
    .stats-row { grid-template-columns: 1fr 1fr; }
  }

  /* ── RECHNUNG ── */
  .rechnung-paper {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 40px 48px;
    max-width: 794px;
    margin: 0 auto;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    color: #1a1a1a;
    line-height: 1.5;
  }
  .rn-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 28px; }
  .rn-logo { width: 110px; }
  .rn-logo img { width: 100%; height: auto; }
  .rn-brand-block { text-align: right; font-size: 10px; color: #333; line-height: 1.7; }
  .rn-brand-name { font-size: 18px; font-weight: 700; color: #1a4a8a; }
  .rn-brand-name span { color: #2d8a3e; }
  .rn-brand-sub { font-size: 10px; color: #2d8a3e; margin-bottom: 4px; }
  .rn-abs { font-size: 8.5px; color: #555; font-style: italic; border-bottom: 1px solid #ddd; padding-bottom: 8px; margin-bottom: 16px; }
  .rn-to { font-size: 11px; font-weight: 700; color: #1a4a8a; line-height: 1.8; margin-bottom: 28px; }
  .rn-meta { display: flex; justify-content: flex-end; margin-bottom: 20px; }
  .rn-meta-table { border-collapse: collapse; }
  .rn-meta-table td { padding: 2px 10px; font-size: 10.5px; }
  .rn-meta-table .rn-ml { color: #333; text-align: right; }
  .rn-meta-table .rn-mv { color: #c00; font-weight: 600; }
  .rn-title { font-size: 22px; font-weight: 400; margin-bottom: 6px; color: #1a1a1a; }
  .rn-rnr { font-size: 10.5px; margin-bottom: 8px; }
  .rn-rnr span { color: #c00; font-weight: 600; }
  .rn-salut { font-size: 10.5px; margin-bottom: 16px; }
  .rn-salut span { font-weight: 700; color: #1a4a8a; }
  .rn-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
  .rn-table th { background: #f5f5f5; border: 1px solid #ccc; padding: 6px 8px; font-size: 10px; font-style: italic; text-align: left; }
  .rn-table th.r { text-align: right; }
  .rn-table td { border: 1px solid #ddd; padding: 8px; font-size: 10.5px; vertical-align: top; }
  .rn-table td.r { text-align: right; }
  .rn-table .rn-prod { font-weight: 700; color: #c00; }
  .rn-total-row { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-bottom: 32px; }
  .rn-total-lbl { font-size: 11px; color: #333; }
  .rn-total-val { font-size: 14px; font-weight: 700; color: #c00; border: 2px solid #c00; padding: 4px 14px; min-width: 100px; text-align: center; }
  .rn-ustg { text-align: center; font-size: 10px; font-weight: 700; color: #1a4a8a; margin: 24px 0 32px; }
  .rn-footer { text-align: center; font-size: 9.5px; color: #333; border-top: 1px solid #ddd; padding-top: 12px; line-height: 1.8; }
  .rn-footer strong { display: block; font-size: 11px; margin-bottom: 2px; }

  /* ── PRINT: فقط view فعال چاپ می‌شود ── */
  @media print {
    @page { margin: 10mm; }

    /* پیش‌فرض: همه مخفی */
    body * { visibility: hidden; }

    /* Rechnung */
    body.print-rechnung .rechnung-paper,
    body.print-rechnung .rechnung-paper * { visibility: visible; }
    body.print-rechnung .rechnung-paper { position: fixed; inset: 0; box-shadow: none; border: none; border-radius: 0; margin: 0; max-width: 100%; padding: 24px 32px; }

    /* Bericht */
    body.print-bericht #bericht-preview,
    body.print-bericht #bericht-preview * { visibility: visible; }
    body.print-bericht #bericht-preview { position: absolute; top: 0; left: 0; width: 100%; }
    body.print-bericht .bericht-paper { box-shadow: none; border: none; border-radius: 0; margin: 0; max-width: 100%; padding: 0; font-size: 8.5px; line-height: 1.35; }
    body.print-bericht #bericht-paper.br-has-kommentar { page-break-after: always; }
    body.print-bericht #bericht-paper-2 { page-break-before: always; margin-top: 0 !important; display: block !important; }
    body.print-bericht #bericht-paper-2:empty { display: none !important; }
    body.print-bericht #bericht-preview > div:first-child { display: none !important; }
    body.print-bericht .br-header { margin-bottom: 8px; padding-bottom: 6px; }
    body.print-bericht .br-logo { width: 72px; }
    body.print-bericht .br-doc-title { font-size: 13px; }
    body.print-bericht .br-section { margin-bottom: 5px; page-break-inside: avoid; }
    body.print-bericht .br-table td { padding: 2px 5px; font-size: 8.5px; }
    body.print-bericht .br-summary { margin-top: 6px; page-break-inside: avoid; }
    body.print-bericht .br-footer { margin-top: 8px; padding-top: 6px; font-size: 7.5px; }
    body.print-bericht .br-page-1 { page-break-inside: avoid; }
    body.print-bericht .br-grid-2 { gap: 5px; margin-bottom: 5px; }
    body.print-bericht .br-grid-stack { gap: 7px; margin-bottom: 6px; }
    body.print-bericht .br-table-wide td { padding: 3px 8px; font-size: 9px; }
    body.print-bericht .br-section-wide .br-section-title { padding: 4px 10px; font-size: 9px; }
    body.print-bericht .br-zf-strip { font-size: 7.5px; padding: 4px 6px; }
  }

  /* ── BERICHT ── */
  .bericht-paper {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 24px 28px;
    max-width: 794px;
    margin: 0 auto;
    font-family: 'Montserrat', Arial, sans-serif;
    font-size: 10px;
    color: #1a1a1a;
    line-height: 1.4;
  }
  .br-page-1 { display: flex; flex-direction: column; gap: 0; }
  .br-header { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 8px; border-bottom: 2px solid #1a4a8a; margin-bottom: 10px; }
  .br-logo { width: 90px; flex-shrink: 0; }
  .br-logo img { width: 100%; height: auto; }
  .br-company { text-align: right; font-size: 9.5px; color: #333; line-height: 1.7; }
  .br-company-name { font-size: 12px; font-weight: 700; color: #1a4a8a; }
  .br-doc-title { font-size: 15px; font-weight: 700; color: #1a4a8a; margin-bottom: 1px; }
  .br-doc-sub { font-size: 8.5px; color: #666; margin-bottom: 0; }
  .br-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
  .br-grid-2 .br-section { margin-bottom: 0; }
  .br-grid-stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
  .br-grid-stack .br-section { margin-bottom: 0; }
  .br-section-wide .br-section-title { padding: 4px 10px; font-size: 9.5px; }
  .br-table-wide td { padding: 5px 10px; font-size: 9.5px; line-height: 1.5; }
  .br-table-wide .br-lbl { width: 14%; min-width: 72px; }
  .br-table-wide .br-val { width: 36%; }
  .br-table-wide .br-val.mono { white-space: nowrap; word-break: keep-all; }
  .br-section { margin-bottom: 8px; }
  .br-zf-section { margin-bottom: 6px; }
  .br-zf-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 6px 8px; background: #f5f8ff; border: 1px solid #dce3ef; border-top: none; font-size: 8.5px; line-height: 1.45; }
  .br-zf-step strong { color: #1a4a8a; font-weight: 700; }
  .br-zf-arr { color: #94a3b8; font-weight: 700; font-size: 10px; }
  .br-kom-page { min-height: 240px; }
  .br-section-title {
    font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
    color: #fff; background: #1a4a8a; padding: 3px 8px;
    margin-bottom: 0; display: flex; align-items: center; gap: 5px;
  }
  .br-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  .br-table tr:nth-child(even) { background: #f5f8ff; }
  .br-table td { border: 1px solid #dce3ef; padding: 3px 6px; font-size: 9px; vertical-align: top; overflow-wrap: break-word; }
  .br-table .br-lbl { color: #555; font-style: italic; width: 22%; background: #f0f4fb; font-size: 9px; white-space: nowrap; }
  .br-table .br-val { font-weight: 600; color: #1a1a1a; width: 28%; }
  .br-table.br-sm .br-lbl { width: 10%; font-size: 8px; }
  .br-table.br-sm .br-val { width: 40%; }
  .br-table .br-val.green { color: #0d6e4a; }
  .br-table .br-val.red   { color: #c00; }
  .br-divider { height: 1px; background: #dce3ef; margin: 10px 0; }
  .br-summary {
    display: grid; grid-template-columns: 1fr 1fr 1fr;
    gap: 6px; margin-top: 8px;
  }
  .br-sum-box { border: 1.5px solid #dce3ef; border-radius: 5px; padding: 6px 8px; text-align: center; }
  .br-sum-lbl { font-size: 7.5px; color: #666; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 2px; }
  .br-sum-val { font-size: 12px; font-weight: 700; font-family: 'Courier New', monospace; color: #1a4a8a; }
  .br-sum-val.green { color: #0d6e4a; }
  .br-sum-val.red   { color: #c00; }
  .br-kommentar { margin-top: 10px; border: 1px solid #dce3ef; border-radius: 4px; padding: 8px 10px; background: #fafbfd; }
  .br-kom-title { font-size: 8.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #555; margin-bottom: 4px; }
  .br-kom-text { font-size: 10px; color: #333; line-height: 1.6; white-space: pre-wrap; }
  .br-footer { text-align: center; font-size: 9px; color: #888; border-top: 1px solid #dce3ef; padding-top: 10px; margin-top: 16px; }

  /* ── LAGERVERWALTUNG ── */
  .lg-tabs { display:flex; gap:3px; padding:4px; background:var(--bg); border:1px solid var(--border); border-radius:var(--radius-sm); margin-bottom:20px; }
  .lg-tab  { flex:1; padding:8px 10px; border:none; border-radius:var(--radius-xs); background:transparent; font-size:12.5px; font-weight:500; color:var(--text-2); cursor:pointer; transition:all .15s; }
  .lg-tab.active { background:var(--card); color:var(--green-dark); font-weight:700; box-shadow:var(--shadow-sm); border:1px solid var(--border); }
  .lg-pane { display:none; }
  .lg-pane.active { display:block; }
  .kl-haupt-pane { display:none; }
  .kl-haupt-pane.active { display:block; }

  /* ── KOSTEN & LAGER (redesign) ── */
  #view-kosten-lager { padding-bottom: 24px; }
  .kl-page-header { margin-bottom: 14px; }
  .kl-page-title { font-size: 20px; font-weight: 800; color: var(--text); margin: 0; letter-spacing: -.3px; }
  .kl-page-sub { font-size: 12px; color: var(--text-3); margin: 4px 0 0; line-height: 1.45; max-width: 52ch; }

  .kl-kpi-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
  }
  .kl-kpi {
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-shadow: var(--shadow-sm);
    transition: border-color .15s, background .15s;
  }
  .kl-kpi-val { font-size: 22px; font-weight: 800; color: #1a4a8a; font-family: 'DM Mono', monospace; line-height: 1.1; }
  .kl-kpi-lbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
  .kl-kpi-warn .kl-kpi-val { color: #b45309; }
  .kl-kpi.kl-kpi-alert { border-color: #fcd34d; background: #fffbeb; }
  .kl-kpi.kl-kpi-alert .kl-kpi-val { color: var(--red); }

  .kl-nav-wrap {
    position: sticky;
    top: 0;
    z-index: 15;
    background: var(--bg);
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border);
  }
  .kl-nav-segments { display: flex; flex-direction: column; gap: 8px; }
  .kl-nav-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: linear-gradient(180deg, #fafbfd 0%, var(--card) 100%);
  }
  .kl-nav-kosten { border-left: 3px solid #3b82f6; }
  .kl-nav-lager { border-left: 3px solid var(--green); }
  .kl-nav-group .kl-group-label {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-3);
    min-width: 52px;
    padding: 0 4px;
    margin: 0;
    border: none;
  }
  .kl-nav-group .kl-tab-groups {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    padding: 0;
    background: transparent;
    border: none;
    margin: 0;
  }
  .kl-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 1 auto;
    padding: 7px 12px;
    font-size: 12px;
    white-space: nowrap;
    border-radius: 8px;
    transition: all .15s;
  }
  .kl-tab-icon { font-size: 13px; line-height: 1; }
  .kl-nav-kosten .kl-tab.active {
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 700;
    border: 1px solid #bfdbfe;
    box-shadow: none;
  }
  .kl-nav-lager .kl-tab.active {
    background: var(--green-light);
    color: var(--green-dark);
    font-weight: 700;
    border: 1px solid #86efac;
    box-shadow: none;
  }

  .kl-section-hero {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 12px;
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
  }
  .kl-section-hero-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: #eff6ff;
    flex-shrink: 0;
  }
  .kl-section-hero.kl-hero-lager .kl-section-hero-icon { background: var(--green-light); }
  .kl-section-hero-title { font-size: 14px; font-weight: 800; color: var(--text); }
  .kl-section-hero-desc { font-size: 11px; color: var(--text-3); margin-top: 2px; }

  .kl-content { display: flex; flex-direction: column; gap: 0; }

  .kl-toolbar { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:10px; }
  .kl-toolbar-compact { margin-bottom: 8px; min-height: 32px; }
  .kl-toolbar h3 { font-size:15px; font-weight:700; color:var(--text); margin:0; letter-spacing:-.2px; }
  .kl-toolbar p { font-size:11px; color:var(--text-3); margin:2px 0 0; }
  .kl-toolbar-actions { display:flex; gap:6px; flex-wrap:wrap; }
  .kl-add-panel { display:none; background:var(--card); border:1.5px solid var(--border); border-radius:var(--radius-sm); padding:12px 14px; margin-bottom:12px; }
  .kl-add-panel.open { display:block; }
  .kl-form-panel-head { margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
  .kl-form-panel-title { font-size: 13px; font-weight: 800; color: var(--text); }
  .kl-form-panel-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }
  .kl-inline-form .kl-form-row { display:flex; align-items:flex-end; gap:8px; flex-wrap:wrap; margin-bottom:8px; }
  .kl-inline-form .kl-form-row:last-child { margin-bottom:0; }
  .kl-inline-form .kl-form-tag { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:#1a4a8a; min-width:88px; padding-bottom:8px; flex-shrink:0; }
  .kl-inline-form .field { margin:0; flex:1; min-width:120px; }
  .kl-inline-form .field label { font-size:10.5px; margin-bottom:3px; }
  .kl-inline-form .field input, .kl-inline-form .field select { padding:7px 10px; font-size:12.5px; }
  .kl-inline-form .btn { flex-shrink:0; padding:7px 14px; font-size:12px; }
  .kl-list-card { background:var(--card); border:1.5px solid var(--border); border-radius:var(--radius); overflow:hidden; box-shadow:var(--shadow-sm); }
  .kl-list-head { display:flex; align-items:center; justify-content:space-between; padding:10px 14px; background:#f8fafc; border-bottom:1px solid var(--border); }
  .kl-list-head-title { font-size:12px; font-weight:700; color:var(--text-2); }
  .kl-list-head-sub { font-size:11px; color:var(--text-3); }
  .kl-list-body { padding:0; }
  .kl-list-body > p { padding:14px; margin:0; }
  .kl-empty-state {
    padding: 28px 20px;
    text-align: center;
    color: var(--text-3);
    font-size: 13px;
    line-height: 1.5;
  }
  .kl-empty-state strong { display: block; color: var(--text-2); font-size: 14px; margin-bottom: 4px; }

  .kl-vs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; padding: 12px; }
  .kl-vs-card {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #fafbfd;
  }
  .kl-vs-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: linear-gradient(180deg, #eff6ff 0%, #f8fafc 100%);
    border-bottom: 1px solid var(--border);
  }
  .kl-vs-dl-name { font-size: 13px; font-weight: 800; color: #1a4a8a; flex: 1; }
  .kl-vs-count { font-size: 10px; font-weight: 600; color: var(--text-3); background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; }
  .kl-vs-mod-list { padding: 6px 0; }
  .kl-vs-mod {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--card);
  }
  .kl-vs-mod:last-child { border-bottom: none; }
  .kl-vs-mod-name { font-size: 12.5px; color: var(--text); }
  .kl-vs-mod-preis { font-family: 'DM Mono', monospace; font-weight: 700; font-size: 13px; color: var(--green-dark); }
  .kl-vs-mod-empty { padding: 12px; font-size: 12px; color: var(--text-3); font-style: italic; }

  .kl-pv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; padding: 12px; }
  .kl-pv-card {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    background: var(--card);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color .15s, box-shadow .15s;
  }
  .kl-pv-card:hover { border-color: #c4b5fd; box-shadow: var(--shadow-sm); }
  .kl-pv-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
  .kl-pv-name { font-size: 14px; font-weight: 800; color: var(--text); }
  .kl-pv-plattform {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #6d28d9;
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    border-radius: 999px;
    padding: 3px 8px;
    align-self: flex-start;
  }
  .kl-pv-prozent {
    font-size: 28px;
    font-weight: 800;
    font-family: 'DM Mono', monospace;
    color: #1a4a8a;
    line-height: 1;
  }
  .kl-pv-prozent span { font-size: 14px; font-weight: 600; color: var(--text-3); }

  .kl-table-compact { font-size:12px; }
  .kl-table-compact th { padding:6px 10px; font-size:10px; }
  .kl-table-compact td { padding:6px 10px; }
  .kl-dl-cell { font-weight:700; color:#1a4a8a; white-space:nowrap; }
  .kl-actions { display:flex; gap:4px; justify-content:flex-end; }
  .kl-icon-btn { display:inline-flex; align-items:center; justify-content:center; width:26px; height:26px; border:1px solid var(--border); border-radius:6px; background:var(--card); color:var(--text-2); cursor:pointer; padding:0; font-size:12px; }
  .kl-icon-btn:hover { border-color:#fca5a5; color:var(--red); background:var(--red-light); }
  .kl-split { display:grid; grid-template-columns:minmax(280px,360px) 1fr; gap:14px; align-items:start; }
  @media(max-width:960px){ .kl-split { grid-template-columns:1fr; } .kl-kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  #kl-lager-wrap .lg-tabs { margin-bottom:12px; flex-wrap:wrap; }
  #kl-lager-wrap .lg-tab { flex:0 1 auto; min-width:auto; padding:6px 12px; font-size:12px; }
  #kl-lager-wrap .form-card.mb16 { margin-bottom:12px; }
  #kl-lager-wrap .form-card-header { padding:12px 16px; }
  #kl-lager-wrap .form-body { padding:14px 16px; }
  .kl-artikel-form-wrap.kl-add-panel.open + .kl-list-card { margin-top:0; }

  /* ── RÜCKGABE ── */
  .rg-modal-box { max-width: 720px; max-height: calc(100dvh - 32px); display: flex; flex-direction: column; }
  .rg-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
  .rg-modal-title { font-size: 17px; font-weight: 800; color: var(--text); }
  .rg-modal-sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }
  .rg-modal-body { padding: 16px 20px; overflow-y: auto; flex: 1; }
  .rg-modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); }
  .rg-section-label { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: #9d174d; margin-bottom: 6px; }
  .rg-section-desc { font-size: 11px; color: var(--text-3); margin: -2px 0 10px; }
  .rg-zeilen-wrap { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; min-height: 48px; }
  .rg-preview-box { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 12px; background: #fdf4ff; border: 1.5px solid #f0abfc; border-radius: var(--radius-sm); }
  .rg-preview-box > div { display: flex; flex-direction: column; gap: 2px; }
  .rg-preview-box span { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--text-3); }
  .rg-preview-box strong { font-family: 'DM Mono', monospace; font-size: 15px; }
  .rg-preview-eff strong { font-size: 18px; }
  .rg-detail-box { margin-top: 10px; padding: 12px; background: #fdf4ff; border: 1.5px solid #f0abfc; border-radius: var(--radius-sm); }
  .rg-detail-head { font-size: 12px; font-weight: 800; color: #9d174d; margin-bottom: 8px; }
  .rg-detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font-size: 12px; }
  .rg-detail-grid span { display: block; font-size: 10px; color: var(--text-3); text-transform: uppercase; }
  .rg-detail-kosten { margin: 8px 0 0; padding-left: 18px; font-size: 11px; color: var(--text-2); }
  .rg-detail-notiz { font-size: 11px; color: var(--text-3); margin-top: 6px; font-style: italic; }
  .db-rg-btn { background: #9d174d !important; border-color: #9d174d !important; font-size: 11px !important; padding: 4px 8px !important; white-space: nowrap; }
  .db-rg-btn:hover { background: #831843 !important; }
  .db-gewinn-rg { font-size: 10px; color: var(--text-3); text-decoration: line-through; }

  .lg-table { width:100%; border-collapse:collapse; font-size:13px; }
  .lg-table th { background:#1a4a8a; color:#fff; padding:8px 12px; text-align:left; font-size:11px; text-transform:uppercase; letter-spacing:.05em; }
  .lg-table th.r { text-align:right; }
  .lg-table td { padding:8px 12px; border-bottom:1px solid var(--border); vertical-align:middle; }
  .lg-table td.r { text-align:right; font-family:'DM Mono',monospace; }
  .lg-table tr:hover td { background:var(--bg); }
  .lg-badge { display:inline-block; padding:2px 9px; border-radius:20px; font-size:11px; font-weight:600; }
  .lg-ok   { background:#d1fae5; color:#065f46; }
  .lg-low  { background:#fef3c7; color:#92400e; }
  .lg-zero { background:#fee2e2; color:#991b1b; }

  /* ── STATUS WORKFLOW ── */
  .status-badge { display:inline-flex; align-items:center; gap:4px; padding:3px 10px; border-radius:20px; font-size:11px; font-weight:600; white-space:nowrap; }
  .status-eingekauft   { background:#fef3c7; color:#92400e; }
  .status-in_bearbeitung { background:#dbeafe; color:#1e40af; }
  .status-bereit       { background:#d1fae5; color:#065f46; }
  .status-verkauft     { background:#ede9fe; color:#5b21b6; }
  .status-entsorgt     { background:#fee2e2; color:#991b1b; }
  .status-select { font-size:11px; padding:3px 6px; border:1.5px solid var(--border); border-radius:6px; background:var(--bg); cursor:pointer; color:var(--text); }
  .status-select:focus { outline:none; border-color:var(--green); }

  /* Entsorgen Modal */
  .modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.5); z-index:8000; display:flex; align-items:center; justify-content:center; }
  .modal-box { background:var(--card); border-radius:var(--radius); padding:28px 32px; max-width:420px; width:90%; box-shadow:0 24px 60px rgba(0,0,0,0.3); }
  .modal-box-lg { background:var(--card); border-radius:var(--radius); padding:0; max-width:660px; width:95%; max-height:90vh; overflow-y:auto; box-shadow:0 24px 60px rgba(0,0,0,0.3); }
  .modal-title { font-size:16px; font-weight:700; color:var(--text); margin-bottom:4px; }
  .modal-sub { font-size:12px; color:var(--text-3); margin-bottom:20px; }
  /* Buchungsjournal Status Badges */
  .bj-badge { display:inline-block; padding:1px 8px; border-radius:10px; font-size:10px; font-weight:700; white-space:nowrap; }
  .bj-auto     { background:#e0e7ff; color:#3730a3; }
  .bj-manuell  { background:#fef3c7; color:#92400e; }
  .bj-geprueft { background:var(--green-light); color:var(--green-dark); }
  .bj-storniert{ background:#fee2e2; color:#991b1b; text-decoration:line-through; }
  .bj-storno   { background:#fce7f3; color:#9d174d; }
  /* Journal row hover */
  .bj-row { transition:background .1s; }
  .bj-row:hover { background:#f8fafc !important; }

  /* Übersicht Tabs */
  .ue-tabs { display:flex; gap:6px; margin-bottom:18px; border-bottom:2px solid var(--border); padding-bottom:0; }
  .ue-tab { padding:9px 18px; border:none; background:none; font-size:13px; font-weight:500; color:var(--text-3); cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-2px; transition:all .15s; }
  .ue-tab.active { color:var(--green-dark); font-weight:700; border-bottom-color:var(--green-dark); }
  .ue-tab:hover:not(.active) { color:var(--text); }
  .ue-count { display:inline-flex; align-items:center; justify-content:center; min-width:20px; height:18px; border-radius:10px; font-size:10px; font-weight:700; padding:0 5px; margin-left:5px; }
  .cnt-offen   { background:#fef3c7; color:#92400e; }
  .cnt-verkauft{ background:#ede9fe; color:#5b21b6; }
  .cnt-entsorgt{ background:#fee2e2; color:#991b1b; }

  /* ── DASHBOARD ── */
  .dash-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:20px; }
  .dash-grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:20px; }
  .dash-grid-3 { display:grid; grid-template-columns:2fr 1fr; gap:14px; margin-bottom:20px; }
  @media(max-width:900px){ .dash-grid{grid-template-columns:1fr 1fr;} .dash-grid-3{grid-template-columns:1fr;} }
  .kpi-card { background:var(--card); border:1px solid var(--border); border-radius:var(--radius); padding:18px 20px; }
  .kpi-label { font-size:11px; color:var(--text-3); font-weight:600; text-transform:uppercase; letter-spacing:.06em; margin-bottom:6px; }
  .kpi-val { font-size:24px; font-weight:700; letter-spacing:-.5px; line-height:1.1; }
  .kpi-sub { font-size:11.5px; color:var(--text-3); margin-top:5px; }
  .kpi-trend { font-size:12px; font-weight:600; margin-top:4px; }
  .trend-up { color:var(--green-dark); }
  .trend-dn { color:var(--red); }
  .dash-chart-wrap { background:var(--card); border:1px solid var(--border); border-radius:var(--radius); padding:18px 20px; }
  .dash-chart-title { font-size:13px; font-weight:600; color:var(--text); margin-bottom:14px; }
  .chart-bars { display:flex; align-items:flex-end; gap:5px; height:120px; }
  .chart-bar-wrap { flex:1; display:flex; flex-direction:column; align-items:center; gap:3px; }
  .chart-bar { width:100%; border-radius:3px 3px 0 0; transition:opacity .2s; cursor:pointer; min-height:2px; }
  .chart-bar:hover { opacity:.75; }
  .chart-label { font-size:9px; color:var(--text-3); text-align:center; }
  .chart-val { font-size:9px; color:var(--text-2); font-weight:600; text-align:center; }
  .top-list { list-style:none; padding:0; margin:0; }
  .top-list li { display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid var(--border); font-size:12.5px; }
  .top-list li:last-child { border-bottom:none; }
  .top-rank { width:20px; height:20px; border-radius:50%; background:var(--bg); font-size:11px; font-weight:700; display:flex; align-items:center; justify-content:center; color:var(--text-2); flex-shrink:0; }
  .top-name { flex:1; font-weight:500; }
  .top-val { font-family:'DM Mono',monospace; font-size:12px; font-weight:600; }
  .status-dot { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
  .open-list { list-style:none; padding:0; margin:0; }
  .open-list li { display:flex; align-items:center; gap:10px; padding:7px 0; border-bottom:1px solid var(--border); font-size:12px; cursor:pointer; }
  .open-list li:hover { opacity:.75; }
  .open-list li:last-child { border-bottom:none; }

  /* ── ZAHLUNGSFLUSS-ZYKLUS (grafisch) ── */
  .zf-zyklus { background:linear-gradient(180deg,#f8fafc 0%,#fff 100%); border:1px solid var(--border); border-radius:12px; padding:18px 16px 14px; margin-bottom:14px; }
  .zf-zyklus-header { display:flex; align-items:baseline; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:16px; padding-bottom:10px; border-bottom:2px solid #1a4a8a; }
  .zf-zyklus-title { font-size:13px; font-weight:800; color:#1a4a8a; letter-spacing:.02em; }
  .zf-zyklus-sub { font-size:11px; color:var(--text-3); }
  .zf-zyklus-product { font-size:11px; font-weight:600; color:var(--text-2); max-width:240px; text-align:right; }
  .zf-zyklus-track { position:relative; }
  .zf-zyklus-line { position:absolute; left:8%; right:8%; top:38px; height:3px; width:84%; z-index:0; }
  .zf-zyklus-line path { stroke:#cbd5e1; stroke-width:3; stroke-dasharray:6 4; fill:none; }
  .zf-zyklus-nodes { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; position:relative; z-index:1; }
  .zf-node { background:var(--card); border:1.5px solid var(--border); border-radius:10px; padding:12px 10px 10px; text-align:center; min-height:148px; display:flex; flex-direction:column; align-items:center; transition:box-shadow .15s,border-color .15s; }
  .zf-node-done { border-color:#93c5fd; box-shadow:0 2px 8px rgba(26,74,138,.08); }
  .zf-node-active { border-color:var(--green-mid); box-shadow:0 0 0 2px rgba(26,158,110,.15); }
  .zf-node-pending { opacity:.55; border-style:dashed; }
  .zf-node-skip { opacity:.4; }
  .zf-node-step { width:22px; height:22px; border-radius:50%; background:#1a4a8a; color:#fff; font-size:10px; font-weight:800; display:flex; align-items:center; justify-content:center; margin-bottom:8px; }
  .zf-node-icon { width:36px; height:36px; border-radius:50%; display:flex; align-items:center; justify-content:center; margin-bottom:8px; }
  .zf-node-einkauf .zf-node-icon { background:#fff7ed; color:#c2410c; }
  .zf-node-kosten .zf-node-icon { background:#fef3c7; color:#92400e; }
  .zf-node-verkauf .zf-node-icon { background:#e8f4fd; color:#1a4a8a; }
  .zf-node-zahlung .zf-node-icon { background:#d1fae5; color:#065f46; }
  .zf-node-title { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--text-2); line-height:1.3; min-height:26px; }
  .zf-node-amt { font-family:'DM Mono',monospace; font-size:14px; font-weight:800; margin:4px 0; }
  .zf-amt-aus { color:#c2410c; }
  .zf-amt-ein { color:var(--green-dark); }
  .zf-node-meta { font-size:10px; color:var(--text-3); line-height:1.35; }
  .zf-node-skr { font-size:9px; color:#1a4a8a; margin-top:4px; font-family:'DM Mono',monospace; background:#f0f4fb; padding:2px 6px; border-radius:4px; }
  .zf-zyklus-footer { display:grid; grid-template-columns:1fr 1fr 1fr; gap:10px; margin-top:14px; }
  .zf-sum-box { border:1.5px solid var(--border); border-radius:8px; padding:10px 12px; text-align:center; background:var(--card); }
  .zf-sum-lbl { font-size:9px; color:var(--text-3); text-transform:uppercase; letter-spacing:.05em; font-weight:600; }
  .zf-sum-val { font-family:'DM Mono',monospace; font-size:16px; font-weight:800; margin-top:4px; }
  .zf-sum-val.red { color:#c2410c; }
  .zf-sum-val.blue { color:#1a4a8a; }
  .zf-sum-val.green { color:var(--green-dark); }
  .zf-zyklus-compact { padding:12px; margin-top:10px; margin-bottom:0; }
  .zf-zyklus-compact .zf-zyklus-header { margin-bottom:10px; padding-bottom:6px; }
  .zf-zyklus-compact .zf-zyklus-title { font-size:11px; }
  .zf-zyklus-compact .zf-node { min-height:120px; padding:8px 6px; }
  .zf-zyklus-compact .zf-node-amt { font-size:12px; }
  .zf-zyklus-compact .zf-zyklus-footer { grid-template-columns:1fr 1fr 1fr; gap:6px; }
  .zf-zyklus-compact .zf-sum-val { font-size:13px; }
  @media(max-width:900px){
    .zf-zyklus-nodes { grid-template-columns:1fr 1fr; }
    .zf-zyklus-line { display:none; }
    .zf-zyklus-footer { grid-template-columns:1fr; }
  }
  #bericht-paper .zf-zyklus { background:#fafbfd; padding:14px; margin:12px 0; border-color:#dce3ef; }
  #bericht-paper .zf-zyklus-header { border-bottom-color:#1a4a8a; }
  #bericht-paper .zf-zyklus-title { font-size:11px; font-family:'Montserrat',Arial,sans-serif; }
  #bericht-paper .zf-node { min-height:130px; }

  /* ── MOBILE & TABLET ── */
  .mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-xs);
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-menu-btn svg { width: 20px; height: 20px; }

  .nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 25, 35, 0.55);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent;
  }
  body.nav-open .nav-backdrop {
    display: block;
    opacity: 1;
  }

  .topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
  }
  .topbar-titles { min-width: 0; }
  .topbar-titles .page-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar-titles .page-subtitle {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .form-actions-bar {
    flex-wrap: wrap;
  }

  @media (max-width: 1024px) {
    .mobile-menu-btn { display: inline-flex; }

    .sidebar {
      width: min(288px, 88vw);
      transform: translateX(-100%);
      transition: transform 0.25s ease;
      box-shadow: none;
      padding-bottom: 0;
      max-height: 100dvh;
    }
    body.nav-open .sidebar {
      transform: translateX(0);
      box-shadow: 8px 0 32px rgba(0, 0, 0, 0.28);
    }
    body.nav-open { overflow: hidden; }

    .sidebar-nav {
      padding-bottom: 8px;
    }

    .sidebar-footer {
      padding: 10px 16px;
      font-size: 10px;
      line-height: 1.35;
    }

    #sidebar-user-bar button {
      min-height: 40px;
      padding: 8px 14px !important;
      font-size: 12px !important;
    }

    .main {
      margin-left: 0;
      width: 100%;
      min-height: 100vh;
      min-height: 100dvh;
    }

    .topbar {
      padding: 0 16px;
      padding-left: max(16px, env(safe-area-inset-left));
      padding-right: max(16px, env(safe-area-inset-right));
      height: auto;
      min-height: 56px;
      flex-wrap: wrap;
      gap: 10px;
      padding-top: max(8px, env(safe-area-inset-top));
      padding-bottom: 8px;
    }

    .topbar-right {
      display: none !important;
    }

    .desktop-only {
      display: none !important;
    }

    .content {
      padding: 16px;
      padding-bottom: max(20px, env(safe-area-inset-bottom));
    }

    .nav-item {
      min-height: 44px;
      padding: 11px 14px;
      font-size: 14px;
    }

    .btn {
      min-height: 44px;
      padding: 10px 16px;
    }

    .g2, .g3, .g4 { grid-template-columns: 1fr; }
    .stats-row, .dash-grid, .dash-grid-2, .dash-grid-3 { grid-template-columns: 1fr; }
    .record-details { grid-template-columns: 1fr 1fr; }

    .db-search-wide { max-width: none; width: 100%; min-width: 0; }
    .db-toolbar { flex-direction: column; align-items: stretch; }
    .db-toolbar-actions { width: 100%; justify-content: space-between; }
    .search-box { width: 100%; }

    .db-ftab {
      padding: 8px 14px;
      font-size: 12.5px;
      min-height: 36px;
    }

    .db-icon-btn {
      width: 40px;
      height: 40px;
    }

    .ue-tabs {
      overflow-x: auto;
      flex-wrap: nowrap;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
    }
    .ue-tabs::-webkit-scrollbar { display: none; }
    .ue-tab { flex-shrink: 0; padding: 10px 16px; }

    .lg-tabs, .kl-tab-groups, .kl-nav-group .kl-tab-groups {
      overflow-x: auto;
      flex-wrap: nowrap;
      -webkit-overflow-scrolling: touch;
    }
    #kl-haupt-tabs-kosten .lg-tab, #kl-haupt-tabs-lager .lg-tab { flex: 0 0 auto; }
    .kl-kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .kl-nav-wrap { top: 0; }

    .form-card-header { flex-wrap: wrap; gap: 10px; }
    .form-body { padding: 16px; }

    .modal-box, .modal-box-lg {
      width: calc(100% - 24px);
      max-height: calc(100dvh - 32px);
      margin: 12px;
    }

    .rechnung-paper, .bericht-paper {
      padding: 20px 16px;
    }

    #login-overlay > div {
      margin: 16px;
      padding: 28px 24px !important;
      max-width: none !important;
    }
    #login-overlay input, #login-overlay button {
      font-size: 16px !important;
      min-height: 48px;
    }
  }

  @media (max-width: 640px) {
    .db-table th:nth-child(6),
    .db-table td:nth-child(6),
    .db-table th:nth-child(7),
    .db-table td:nth-child(7) {
      display: none;
    }
    .db-table { min-width: 580px; }

    .form-actions-bar {
      position: sticky;
      bottom: 0;
      z-index: 30;
      margin: 0 -16px -16px;
      padding: 12px 16px max(12px, env(safe-area-inset-bottom)) !important;
      border-radius: 0 !important;
      border-left: none;
      border-right: none;
      box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
    }
    .form-actions-bar .btn-primary { flex: 1; justify-content: center; }

    .gewinn-val { font-size: 22px; }

    .zf-zyklus-nodes { grid-template-columns: 1fr; }
  }

  @media (hover: none) and (pointer: coarse) {
    .field input, .field select, .search-box input, .db-select {
      font-size: 16px;
      min-height: 44px;
    }
    .btn-primary:hover { transform: none; }
  }

  /* ── Mobile DB cards (Bestandsübersicht) ── */
  .db-mobile-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .db-mobile-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .db-mobile-card:active {
    background: var(--bg);
  }
  .db-mobile-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
  }
  .db-mobile-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    line-height: 1.35;
  }
  .db-mobile-meta,
  .db-mobile-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 12px;
    color: var(--text-3);
    margin-bottom: 4px;
  }
  .db-mobile-gewinn {
    font-size: 14px;
    font-weight: 700;
    font-family: 'DM Mono', monospace;
    white-space: nowrap;
  }
  .db-mobile-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }

