/* ============================================================
   Belege / Betriebsausgaben — LTR German module
   Aligned with locked iOS spacing (persons / txs / loans)
   Does NOT restyle locked pages outside .belege-app
   ============================================================ */

.belege-app,
.belege-sheet,
#modalCard:has(.belege-sheet),
#modalCard:has(.belege-app) {
  direction: ltr !important;
  text-align: left !important;
  unicode-bidi: isolate;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Break out of global RTL — Belege stays LTR German */
body[dir="rtl"] .belege-app .belege-head-top,
body[dir="rtl"] .belege-app .belege-head-actions,
body[dir="rtl"] .belege-app .belege-card,
body[dir="rtl"] .belege-app .belege-card-left,
body[dir="rtl"] .belege-app .belege-staff-card,
body[dir="rtl"] .belege-app .belege-seg,
body[dir="rtl"] .belege-app .belege-kpis,
body[dir="rtl"] .belege-app .belege-profile-stats,
body[dir="rtl"] .belege-app .belege-miss-banner,
body[dir="rtl"] .belege-sheet .hy-vs-head {
  flex-direction: row !important;
}
body[dir="rtl"] .belege-app .belege-head-titles,
body[dir="rtl"] .belege-app .belege-head-titles h1,
body[dir="rtl"] .belege-app .belege-head-titles p {
  text-align: left !important;
}
body[dir="rtl"] .belege-app .belege-card-right,
body[dir="rtl"] .belege-app .detail-row .value {
  text-align: right !important;
}

/* Hide only the old category-pill strip + duplicate Firma picker */
.belege-app .budget-company-pick { display: none !important; }
.belege-app .belege-filter-mini {
  display: flex !important;
  gap: 8px;
  margin: 0 0 12px;
  flex-direction: row !important;
}

.belege-app {
  --belege-blue: #007aff;
  --belege-red: #ff3b30;
  --belege-green: #34c759;
  --belege-orange: #ff9500;
  --belege-muted: #8e8e93;
  --belege-label: #6c6c70;
  --belege-border: rgba(60, 60, 67, 0.12);
  --belege-bg: #f2f2f7;
  --belege-gap: 14px;
  --belege-radius: 14px;
  color: #111;
  max-width: 100%;
}

/* --- Sticky-like head panel (same rhythm as persons) --- */
.belege-app .belege-head {
  background: #fff;
  border-radius: 24px;
  padding: 16px 14px 14px;
  margin: 0 0 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
}

/* Title LEFT · actions RIGHT — never RTL-clumped */
.belege-app .belege-head-top {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 12px;
  margin: 0 0 12px;
  direction: ltr !important;
  width: 100%;
}

.belege-app .belege-head-titles {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left !important;
}

.belege-app .belege-head h1,
.belege-app .belege-head-titles h1 {
  margin: 0 !important;
  font-size: 28px !important;
  font-weight: 800 !important;
  letter-spacing: -0.03em !important;
  line-height: 1.15 !important;
  color: #111 !important;
  text-align: left !important;
}

.belege-app .belege-head .ios-count,
.belege-app .belege-head-titles p {
  margin: 4px 0 0 !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: var(--belege-muted) !important;
  text-align: left !important;
}

.belege-app .belege-head-actions {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin: 0 !important;
}

.belege-app .belege-icon-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  border: none;
  background: #f2f2f7;
  color: var(--belege-blue);
  font-size: 18px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.belege-app .belege-icon-btn:active { opacity: 0.75; }

.belege-app .belege-head .btn-ios-add,
.belege-app .belege-head .btn-header-add {
  min-height: 40px !important;
  height: 40px !important;
  padding: 0 16px !important;
  border-radius: 999px !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}

/* --- Segment Belege | Personal --- */
.belege-app .belege-seg {
  display: flex;
  gap: 0;
  margin: 0 0 12px;
  padding: 4px;
  background: #f2f2f7;
  border-radius: 12px;
}

.belege-app .belege-seg button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 36px;
  border: 0;
  background: transparent;
  color: #3a3a3c;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 9px;
  cursor: pointer;
}

.belege-app .belege-seg button.is-on {
  background: #fff;
  color: #111;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-weight: 700;
}

.belege-app .belege-head .period-bar,
.belege-app .belege-head .report-period-bar,
.belege-app .belege-head [class*="period"] {
  margin: 0 !important;
}

/* --- KPI grid (platform person-board rhythm) --- */
.belege-app .belege-kpis {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 14px !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
}

.belege-app .belege-kpis .person-stat,
.belege-app .belege-kpis article {
  background: #fff !important;
  border-radius: var(--belege-radius) !important;
  border: 0.5px solid var(--belege-border) !important;
  box-shadow: none !important;
  padding: 14px !important;
  min-height: 84px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin: 0 !important;
}

.belege-app .belege-kpis small {
  font-size: 12px !important;
  font-weight: 600 !important;
  color: var(--belege-muted) !important;
  letter-spacing: 0.01em;
  margin: 0 !important;
}

.belege-app .belege-kpis b {
  font-size: 20px !important;
  font-weight: 700 !important;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  direction: ltr;
  unicode-bidi: isolate;
  margin-top: 8px !important;
  line-height: 1.15 !important;
}

.belege-app .belege-kpis b.t-exp { color: var(--belege-red) !important; }
.belege-app .belege-kpis b.t-inc { color: var(--belege-green) !important; }
.belege-app .belege-kpis b.t-warn { color: var(--belege-orange) !important; }
.belege-app .belege-kpis b.t-n { color: #111 !important; }

/* --- Miss banner --- */
.belege-app .belege-miss-banner {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff5f5;
  border: 0.5px solid #fecaca;
  color: #991b1b;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.belege-app .belege-miss-banner button {
  flex-shrink: 0;
}

/* --- Category pills --- */
.belege-app .belege-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 14px;
  margin: 0;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.belege-app .belege-pills::-webkit-scrollbar { display: none; }

.belege-app .belege-pill {
  background: #fff;
  border: 0.5px solid var(--belege-border);
  padding: 8px 14px;
  min-height: 34px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  color: #1c1c1e;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.belege-app .belege-pill.is-on {
  background: var(--belege-blue);
  color: #fff;
  border-color: var(--belege-blue);
  box-shadow: none;
}
.belege-app .belege-pill.is-warn { color: #9a3412; border-color: #ffd0a8; }
.belege-app .belege-pill.is-warn.is-on {
  background: var(--belege-orange);
  color: #fff;
  border-color: var(--belege-orange);
}

/* --- Inset list (like ios-inset-group) --- */
.belege-app .belege-inset {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  border: 0.5px solid var(--belege-border);
  margin: 0 0 8px;
}

.belege-app .belege-card {
  background: #fff;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  border: none;
  border-bottom: 0.5px solid var(--belege-border);
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  min-height: 68px;
}
.belege-app .belege-inset .belege-card:last-child { border-bottom: none; }
.belege-app .belege-card:active { background: #fafafa; }
.belege-app .belege-card.is-miss { background: #fffafa; }

.belege-app .belege-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.belege-app .belege-ico {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #e8f1ff;
  color: var(--belege-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  flex: 0 0 auto;
  text-transform: uppercase;
}
.belege-app .belege-ico.in {
  background: #eaf8ef;
  color: #1f8f4a;
}

.belege-app .belege-card .title {
  font-weight: 650;
  font-size: 15px;
  line-height: 1.25;
  margin: 0 0 3px;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 52vw;
}
.belege-app .belege-card .sub {
  font-size: 12px;
  line-height: 1.3;
  color: var(--belege-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 52vw;
  margin: 0;
}

.belege-app .belege-card-right {
  text-align: right;
  flex: 0 0 auto;
  min-width: 88px;
}

.belege-app .belege-amt {
  font-weight: 700;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  direction: ltr;
  unicode-bidi: isolate;
  line-height: 1.2;
}
.belege-app .belege-amt.exp { color: var(--belege-red); }
.belege-app .belege-amt.inc { color: var(--belege-green); }

.belege-app .belege-file {
  font-size: 11px;
  color: var(--belege-muted);
  margin-top: 4px;
  font-weight: 500;
}
.belege-app .belege-file.miss {
  color: var(--belege-red);
  font-weight: 700;
}

.belege-app .belege-empty {
  text-align: center;
  color: var(--belege-muted);
  padding: 36px 16px;
  font-size: 14px;
  font-weight: 500;
  background: #fff;
  border-radius: 16px;
  border: 0.5px solid var(--belege-border);
}

/* --- Staff list --- */
.belege-app .belege-search {
  margin: 0 0 12px;
}
.belege-app .belege-search input {
  height: 46px !important;
  min-height: 46px !important;
  background: #fff !important;
  border: none !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04) !important;
  padding: 0 16px 0 40px !important;
  font-size: 15px !important;
  width: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%238e8e93' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='5.5'/%3E%3Cpath d='M12.5 12.5L16 16'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: 14px center !important;
}

.belege-app .belege-staff-card {
  background: #fff;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  border-bottom: 0.5px solid var(--belege-border);
  min-height: 72px;
}
.belege-app .belege-inset .belege-staff-card:last-child { border-bottom: none; }
.belege-app .belege-staff-card:active { background: #fafafa; }

.belege-app .belege-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #e8f1ff;
  color: var(--belege-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  flex: 0 0 auto;
}
.belege-app .belege-avatar.lg {
  width: 72px;
  height: 72px;
  font-size: 28px;
  margin: 0 auto 12px;
}
.belege-app .belege-chev {
  color: #c7c7cc;
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
}

.belege-app .belege-staff-name {
  font-weight: 650;
  font-size: 16px;
  color: #111;
  line-height: 1.25;
}
.belege-app .belege-staff-meta {
  font-size: 13px;
  color: var(--belege-muted);
  margin-top: 2px;
}

/* --- Profile --- */
.belege-app .belege-profile-hero {
  background: #fff;
  border-radius: 16px;
  border: 0.5px solid var(--belege-border);
  padding: 22px 16px 18px;
  text-align: center;
  margin: 0 0 14px;
}
.belege-app .belege-profile-hero h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #111;
}
.belege-app .belege-profile-hero .role {
  color: var(--belege-muted);
  font-size: 13px;
  margin-top: 4px;
  font-weight: 500;
}

.belege-app .belege-profile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 14px;
}
.belege-app .belege-stat-box {
  background: #fff;
  border: 0.5px solid var(--belege-border);
  border-radius: var(--belege-radius);
  padding: 14px;
  text-align: left;
  min-height: 84px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.belege-app .belege-stat-box .lbl {
  font-size: 12px;
  color: var(--belege-muted);
  font-weight: 600;
}
.belege-app .belege-stat-box .val {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  direction: ltr;
  unicode-bidi: isolate;
  margin-top: 10px;
}
.belege-app .belege-stat-box .val.exp { color: var(--belege-red); }
.belege-app .belege-stat-box .val.inc { color: var(--belege-green); }

.belege-app .belege-hist-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--belege-muted);
  margin: 2px 0 10px 4px;
  letter-spacing: 0.01em;
}

.belege-app .belege-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: var(--belege-blue);
  font-size: 16px;
  font-weight: 500;
  padding: 0;
  margin: 0 0 6px;
  cursor: pointer;
  min-height: 28px;
}

/* --- Form sheet DE — beat voice-sheet-lock RTL (loads before this file) --- */
html body.skin-ios #modalCard.belege-host,
html body.skin-ios #modalCard.belege-host.hy-form-sheet-host,
html body[dir="rtl"].skin-ios #modalCard.belege-host,
html body #modalCard:has(.belege-sheet),
html body .belege-sheet,
html body .belege-sheet.hy-form-sheet {
  direction: ltr !important;
  text-align: left !important;
  unicode-bidi: isolate !important;
}

/* Keep locked sheet chrome (centered title + absolute ✕) but force LTR start = left */
html body.skin-ios #modalCard.belege-host .belege-sheet .hy-vs-x,
html body.skin-ios .belege-sheet .hy-vs-x,
html body[dir="rtl"] .belege-sheet .hy-vs-x {
  inset-inline-start: 0 !important;
  inset-inline-end: auto !important;
  left: 0 !important;
  right: auto !important;
}

html body.skin-ios #modalCard.belege-host .belege-sheet .hy-vs-title,
html body.skin-ios .belege-sheet .hy-vs-title {
  text-align: center !important;
  direction: ltr !important;
}

/* Labels LEFT — override body.skin-ios .hy-form-sheet label { text-align:right } */
html body.skin-ios #modalCard.belege-host .belege-sheet label,
html body.skin-ios #modalCard.belege-host .belege-sheet .form-group > label,
html body.skin-ios #modalCard.belege-host .belege-sheet.hy-form-sheet label,
html body.skin-ios #modalCard.belege-host .belege-sheet.hy-form-sheet .form-group > label,
html body.skin-ios .belege-sheet.hy-form-sheet label,
html body.skin-ios .belege-sheet.hy-form-sheet .form-group > label,
html body.skin-ios .belege-sheet .form-group label,
html body[dir="rtl"].skin-ios .belege-sheet label,
html body[dir="rtl"] .belege-sheet .form-group > label,
.belege-sheet .form-group > label,
.belege-sheet label:not(.belege-check-lab) {
  display: block !important;
  width: 100% !important;
  text-align: left !important;
  direction: ltr !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #64748b !important;
  margin: 0 0 6px !important;
}

html body.skin-ios #modalCard.belege-host .belege-sheet .form-control,
html body.skin-ios #modalCard.belege-host .belege-sheet input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
html body.skin-ios #modalCard.belege-host .belege-sheet select,
html body.skin-ios .belege-sheet .form-control,
html body.skin-ios .belege-sheet select,
html body[dir="rtl"] .belege-sheet .form-control,
.belege-sheet .form-control,
.belege-sheet input.form-control,
.belege-sheet select.form-control {
  text-align: left !important;
  direction: ltr !important;
  min-height: 48px !important;
  height: 48px !important;
  border-radius: 12px !important;
  font-size: 16px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

html body.skin-ios #modalCard.belege-host .belege-sheet .form-group,
html body.skin-ios .belege-sheet .form-group,
.belege-sheet .form-group {
  margin: 0 0 14px !important;
  text-align: left !important;
  direction: ltr !important;
}

/* Ausgabe / Einnahme — full-width 50/50 like locked .seg */
html body.skin-ios #modalCard.belege-host .belege-sheet .belege-kind-seg,
html body.skin-ios #modalCard.belege-host .belege-sheet .seg.belege-kind-seg,
html body.skin-ios .belege-sheet .belege-kind-seg,
html body.skin-ios .belege-sheet .seg.belege-kind-seg,
html body[dir="rtl"] .belege-sheet .belege-kind-seg,
.belege-sheet .belege-kind-seg,
.belege-sheet .seg.belege-kind-seg {
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch !important;
  width: 100% !important;
  box-sizing: border-box !important;
  background: #f1f5f9 !important;
  border-radius: 12px !important;
  padding: 4px !important;
  margin: 0 0 16px !important;
  direction: ltr !important;
  gap: 0 !important;
}

html body.skin-ios #modalCard.belege-host .belege-sheet .belege-kind-seg button,
html body.skin-ios #modalCard.belege-host .belege-sheet .seg.belege-kind-seg button,
html body.skin-ios .belege-sheet .belege-kind-seg button,
html body.skin-ios .belege-sheet .seg.belege-kind-seg button,
.belege-sheet .belege-kind-seg button,
.belege-sheet .seg.belege-kind-seg button {
  flex: 1 1 50% !important;
  width: 50% !important;
  max-width: 50% !important;
  min-width: 0 !important;
  min-height: 44px !important;
  height: 44px !important;
  text-align: center !important;
  padding: 0 8px !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  border-radius: 10px !important;
  border: none !important;
  cursor: pointer !important;
  color: #64748b !important;
  margin: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  direction: ltr !important;
}

html body.skin-ios #modalCard.belege-host .belege-sheet .belege-kind-seg button.active,
html body.skin-ios .belege-sheet .belege-kind-seg button.active,
.belege-sheet .belege-kind-seg button.active {
  background: #fff !important;
  color: #007aff !important;
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.16) !important;
}

.belege-sheet .belege-check-lab {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
  margin-top: 8px !important;
  font-weight: 600 !important;
  text-align: left !important;
  direction: ltr !important;
  width: auto !important;
}

/* Confirm / help text must stay visible (lock hides .sub) */
html body.skin-ios #modalCard.belege-host .belege-sheet .sub,
html body.skin-ios #modalCard.belege-host .belege-sheet .belege-form-sub,
html body.skin-ios .belege-sheet .sub.belege-form-sub,
.belege-sheet .belege-form-sub,
.belege-sheet p.belege-form-sub {
  display: block !important;
  text-align: left !important;
  direction: ltr !important;
  color: #111 !important;
  font-size: 15px !important;
  line-height: 1.5 !important;
  margin: 0 0 16px !important;
}

.belege-sheet .btn.block {
  width: 100% !important;
}

.belege-sheet .belege-req {
  color: #ff3b30 !important;
  font-weight: 800 !important;
  margin-inline-start: 2px;
}

html body.skin-ios #modalCard.belege-host .belege-sheet .form-control.is-invalid,
html body.skin-ios .belege-sheet .form-control.is-invalid,
.belege-sheet .form-control.is-invalid,
.belege-sheet select.is-invalid,
.belege-sheet input.is-invalid {
  border-color: #ff3b30 !important;
  background: #fff5f5 !important;
  box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.18) !important;
}

.belege-sheet .form-group.is-invalid > label {
  color: #ff3b30 !important;
}

.belege-sheet .belege-field-err {
  display: block !important;
  margin-top: 6px !important;
  color: #ff3b30 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  text-align: left !important;
  direction: ltr !important;
}

.belege-app .detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--belege-border);
  text-align: left;
}
.belege-app .detail-row .label {
  color: var(--belege-muted);
  font-size: 13px;
  font-weight: 500;
  flex: 0 0 38%;
}
.belege-app .detail-row .value {
  flex: 1;
  text-align: right;
  font-size: 14px;
  font-weight: 600;
  color: #111;
}

/* --- Classic desk: keep table readable LTR --- */
body.skin-new:not(.skin-ios) .belege-app .belege-head {
  box-shadow: none;
  border: 1px solid var(--belege-border);
  border-radius: 12px;
}
body.skin-new:not(.skin-ios) .belege-app .fit-table {
  direction: ltr;
}
body.skin-new:not(.skin-ios) .belege-app .fit-table th,
body.skin-new:not(.skin-ios) .belege-app .fit-table td {
  text-align: left;
}

/* Page body rhythm */
body.skin-ios.ios-page-belege #screen.wrap {
  padding-bottom: calc(108px + env(safe-area-inset-bottom, 0px)) !important;
}

/* Hide legacy duplicate action row if any */
.belege-app .belege-actions { display: none !important; }

/* Company pick inside module */
.belege-app .budget-company-pick {
  margin: 0 0 14px;
}
.belege-app .budget-company-pick .title {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--belege-muted);
  margin-bottom: 6px;
  text-align: left;
}
