.badge-purple {
  background-color: var(--bs-purple, #6f42c1);
  color: #fff;
}

.badge-success-dark {
  background-color: #0f5132;
  color: #fff;
}

.completion-status-offen {
  background-color: #6c757d;
  color: #fff;
}

.completion-status-lieferschein {
  background-color: #0d6efd;
  color: #fff;
}

body .badge.ts-contact-age-1 {
  background-color: #ffe082 !important;
  color: #664d03 !important;
}

body .badge.ts-contact-age-2 {
  background-color: #ffb74d !important;
  color: #5f3700 !important;
}

body .badge.ts-contact-age-3 {
  background-color: #ff9800 !important;
  color: #fff !important;
}

body .badge.ts-contact-age-4 {
  background-color: #f44336 !important;
  color: #fff !important;
}

.ts-workspace {
  display: grid;
  /* Standard: eine Spalte – nutzt die volle verfügbare Breite.
     Das rechte Kontext-Panel (.ts-context-panel) ist aktuell nicht im HTML,
     daher würde eine feste 320px-Spalte rechts nur unnötig Platz blockieren. */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--spacing-lg, 1rem);
  align-items: start;
  padding: var(--spacing-md, 1rem);
  border-radius: 1rem;
  min-width: 0; /* Karte wächst nicht mit zu breiter Tabelle (wie Projekte) */
}

/* Falls das Kontext-Panel später doch eingebaut wird, wieder zweispaltig
   darstellen – ohne dass man die obige Regel zurückdrehen muss.
   Ab 769px Breite aktiv; darunter greift die Mobile-Regel weiter unten. */
@media (min-width: 769px) {
  .ts-workspace:has(> .ts-context-panel) {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
}

.ts-primary-lane {
  min-width: 0;
}

.ts-main-content {
  display: grid;
  gap: var(--spacing-md, 1rem);
  min-width: 0; /* Tabelle: horizontales Scrollen im .eh-table-wrap, nicht die Karte verbreitern */
}

.ts-filter-surface {
  border: 1px solid color-mix(in srgb, var(--bs-border-color, #dee2e6) 72%, transparent);
  border-radius: 1rem;
  background: color-mix(in srgb, var(--bs-body-bg, #fff) 94%, #f3f5f7);
  padding: var(--spacing-md, 1rem);
  min-width: 0;
}

.ts-context-panel {
  display: grid;
  gap: var(--spacing-sm, 0.75rem);
  position: sticky;
  top: 1rem;
}

.ts-context-card {
  border: 1px solid color-mix(in srgb, var(--bs-border-color, #dee2e6) 78%, transparent);
  border-radius: 1rem;
  background: color-mix(in srgb, var(--bs-body-bg, #fff) 96%, #eef1f5);
  padding: 0.9rem 1rem;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.ts-context-label {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--bs-secondary-color, #6c757d);
}

.ts-context-heading {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.ts-context-subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--bs-secondary-color, #6c757d);
}

.ts-context-primary-btn {
  width: 100%;
  min-height: 42px;
  border-radius: 0.8rem;
}

.ts-context-hint {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--bs-secondary-color, #6c757d);
}

.ts-context-actions {
  display: grid;
  gap: 0.5rem;
}

.ts-flow-card {
  border: 1px solid color-mix(in srgb, var(--bs-border-color, #dee2e6) 82%, transparent);
  border-radius: 0.9rem;
  padding: 0.75rem;
  background: color-mix(in srgb, var(--bs-body-bg, #fff) 97%, #f5f7fa);
}

.timesheets-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.75rem;
  background: rgba(0, 0, 0, 0.02);
}

.timesheets-contact-aging {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin: 0 0 1.25rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.6);
}

.timesheets-contact-aging-header {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(0, 0, 0, 0.65);
}

.timesheets-contact-aging-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.timesheets-contact-aging-empty {
  font-size: 0.9rem;
  color: rgba(0, 0, 0, 0.55);
}

.ts-contact-aging-item {
  appearance: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.35rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
  text-align: left;
  cursor: pointer;
  width: 100%;
}

.ts-contact-aging-item:hover,
.ts-contact-aging-item:focus-visible {
  border-color: rgba(0, 0, 0, 0.2);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.ts-contact-aging-item.is-active {
  border-color: var(--bs-primary);
  box-shadow: 0 8px 20px rgba(13, 110, 253, 0.25);
}

.ts-contact-aging-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.ts-contact-aging-meta {
  font-size: 0.85rem;
  color: rgba(0, 0, 0, 0.65);
}

html[data-theme="dark"] .timesheets-contact-aging {
  border-color: var(--bs-border-color);
  background: var(--bs-tertiary-bg);
}

html[data-theme="dark"] .timesheets-contact-aging-header,
html[data-theme="dark"] .timesheets-contact-aging-empty,
html[data-theme="dark"] .ts-contact-aging-meta {
  color: var(--bs-secondary-color);
}

html[data-theme="dark"] .ts-contact-aging-item {
  border-color: var(--bs-border-color);
  background: var(--bs-secondary-bg);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .ts-contact-aging-item:hover,
html[data-theme="dark"] .ts-contact-aging-item:focus-visible {
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .ts-contact-aging-item.is-active {
  border-color: var(--bs-primary);
  box-shadow: 0 8px 20px rgba(13, 110, 253, 0.4);
}

.ts-contact-aging-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ts-contact-aging-badges .badge {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.timesheets-summary-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 7rem;
}

.timesheets-summary-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  opacity: 0.7;
}

.timesheets-summary-value {
  font-size: 1rem;
  font-weight: 700;
}

/* Explorer-Icon nur am Desktop zeigen (wie bei Projekten) */
@media (min-width: 992px) {
  .btn-open {
    cursor: pointer;
    border: none;
    background: transparent;
    font-size: 1.25rem;
  }
}
@media (max-width: 991px) {
  .btn-open { display: none; }
}

#timesheets-container,
#projectCompletionsContainer {
  overflow: visible;
  max-width: 100%;
  min-width: 0;
}

#timesheets-container .eh-table-wrap,
#projectCompletionsContainer .eh-table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible; /* wie Projekte (#orders-container .eh-table-wrap) */
  -webkit-overflow-scrolling: touch;
  border-radius: 0.75rem;
  padding: 0;
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
}

@media (min-width: 992px) {
  #timesheets-container .eh-table thead th,
  #projectCompletionsContainer .eh-table thead th {
    background-color: var(--eh-table-header-bg, var(--bs-primary, #0d6efd));
    color: var(--eh-table-header-color, #ffffff) !important;
  }
}

.orders-floating-header {
  position: fixed;
  z-index: 1200;
  display: none;
  pointer-events: none;
  overflow: hidden;
  border-radius: 0 0 0.75rem 0.75rem;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.22);
}

.orders-floating-header .orders-floating-table {
  margin-bottom: 0;
}

.orders-floating-header .orders-floating-table thead th {
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.orders-floating-header .orders-floating-table thead th:first-child {
  border-bottom-left-radius: 0.75rem;
}

.orders-floating-header .orders-floating-table thead th:last-child {
  border-bottom-right-radius: 0.75rem;
}

#timesheets-container[data-pinned-action-count="1"] .eh-table th:nth-last-child(2),
#timesheets-container[data-pinned-action-count="1"] .eh-table td:nth-last-child(2),
#projectCompletionsContainer[data-pinned-action-count="1"] .eh-table th:nth-last-child(2),
#projectCompletionsContainer[data-pinned-action-count="1"] .eh-table td:nth-last-child(2) {
  padding-right: calc(0.65rem + 96px);
}

#timesheets-container[data-pinned-action-count] .eh-table th:nth-last-child(1),
#timesheets-container[data-pinned-action-count] .eh-table td:nth-last-child(1),
#projectCompletionsContainer[data-pinned-action-count] .eh-table th:nth-last-child(1),
#projectCompletionsContainer[data-pinned-action-count] .eh-table td:nth-last-child(1) {
  position: sticky;
  right: 0;
  z-index: 3;
}

#timesheets-container[data-pinned-action-count] .eh-table thead th:nth-last-child(1),
#projectCompletionsContainer[data-pinned-action-count] .eh-table thead th:nth-last-child(1) {
  background-color: var(--eh-table-header-bg, var(--bs-primary, #0d6efd));
  z-index: 4;
}

#timesheets-container[data-pinned-action-count] .eh-table tbody td:nth-last-child(1),
#projectCompletionsContainer[data-pinned-action-count] .eh-table tbody td:nth-last-child(1) {
  background: inherit;
}

#timesheets-container .eh-table thead th.project-col-resize-enabled,
#projectCompletionsContainer .eh-table thead th.project-col-resize-enabled {
  position: relative;
  user-select: none;
}

#timesheets-container .project-col-resizer,
#projectCompletionsContainer .project-col-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 8;
}

#timesheets-container .project-col-resizer::after,
#projectCompletionsContainer .project-col-resizer::after {
  content: "";
  position: absolute;
  top: 22%;
  bottom: 22%;
  left: 3px;
  width: 2px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--bs-border-color, #cbd5e1) 72%, transparent);
  opacity: 0;
  transition: opacity 120ms ease;
}

#timesheets-container .eh-table thead th.project-col-resize-enabled:hover .project-col-resizer::after,
#projectCompletionsContainer .eh-table thead th.project-col-resize-enabled:hover .project-col-resizer::after {
  opacity: 1;
}

/* Wie #orders-container auf Projekte: Inhalt darf breiter als der Viewport sein, Scroll im .eh-table-wrap */
#timesheets-container .eh-table {
  min-width: max-content;
  table-layout: auto;
}

#projectCompletionsContainer .eh-table {
  min-width: max-content;
  table-layout: auto;
}

#timesheets-container .eh-table > :not(caption) > * > * {
  padding: 0.5rem 0.65rem;
}

#projectCompletionsContainer .eh-table > :not(caption) > * > * {
  padding: 0.5rem 0.65rem;
}

#timesheets-container .eh-table thead th,
#timesheets-container .eh-table tbody td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

#projectCompletionsContainer .eh-table thead th,
#projectCompletionsContainer .eh-table tbody td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

#projectCompletionsContainer .eh-table thead th:nth-child(1),
#projectCompletionsContainer .eh-table tbody td:nth-child(1) {
  width: 30%;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}

#timesheets-container .eh-table thead th:nth-child(2),
#timesheets-container .eh-table tbody td:nth-child(2),
#timesheets-container .eh-table thead th:nth-child(3),
#timesheets-container .eh-table tbody td:nth-child(3),
#timesheets-container .eh-table thead th:nth-child(4),
#timesheets-container .eh-table tbody td:nth-child(4) {
  white-space: normal;
  overflow-wrap: anywhere;
}

.ts-period-cell {
  display: inline-flex;
  flex-direction: column;
  gap: 0.1rem;
  line-height: 1.25;
}

.ts-period-separator {
  opacity: 0.7;
  line-height: 1;
}

#timesheets-container .eh-table thead th:last-child,
#timesheets-container .eh-table tbody td:last-child {
  width: 96px;
  text-align: center;
}

#projectCompletionsContainer .eh-table thead th:last-child,
#projectCompletionsContainer .eh-table tbody td:last-child {
  width: 96px;
  text-align: center;
}

/* Badge-Spalten: Inhalte nie mit Ellipsis abschneiden */
#timesheets-container .eh-table tbody td:nth-child(1),
#timesheets-container .eh-table tbody td:nth-child(6),
#timesheets-container .eh-table tbody td:nth-child(7) {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

/* Badge-Spalten zentrieren, alle anderen bleiben linksbündig */
#timesheets-container .eh-table thead th:nth-child(1),
#timesheets-container .eh-table tbody td:nth-child(1),
#timesheets-container .eh-table thead th:nth-child(6),
#timesheets-container .eh-table tbody td:nth-child(6),
#timesheets-container .eh-table thead th:nth-child(7),
#timesheets-container .eh-table tbody td:nth-child(7) {
  text-align: center;
}

.ts-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  width: 100%;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.btn-hero-open {
  cursor: pointer;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0.1rem 0.15rem;
}

.hero-logo-small {
  height: 20px;
  width: auto;
}

@media (max-width: 991px) {
  .btn-hero-open { display: none; }
}


.ts-billing-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0.1rem;
}

.ts-billing-list-section h6 {
  font-size: 0.9rem;
}

.ts-billing-list-section .list-group-item {
  padding: 0.25rem 0;
}

.ts-billing-list-section .badge {
  font-size: 0.7rem;
}

.ts-billing-assignee-badge {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.ts-billing-assign-card {
  background: var(--bs-tertiary-bg);
  border-color: var(--bs-border-color);
}

html[data-theme="dark"] .ts-billing-assign-card {
  background: var(--bs-secondary-bg);
  border-color: var(--bs-border-color);
}

.ts-completion-signature-canvas {
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  width: 100%;
  touch-action: none;
  background: #fff;
}


#tsLinesTable td {
  padding: .28rem .4rem;
  vertical-align: middle;
}

#tsLinesTable .ts-cell-text {
  display: block;
  min-height: 1.25rem;
  padding: .12rem .2rem;
  line-height: 1.3;
}

#tsLinesTable .ts-cell-text-mono {
  font-family: var(--bs-font-monospace);
  font-variant-numeric: tabular-nums;
}

#tsLinesTable .ts-cell-text-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

#tsLinesTable th[data-ts-sort] {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
  }

  #tsLinesTable th[data-ts-sort] .ts-sort-indicator {
    display: inline-block;
    width: 0.9em;
    text-align: center;
    font-size: 0.7rem;
    opacity: 0.6;
  }

  #tsLinesTable th[data-ts-sort].ts-sort-asc .ts-sort-indicator::before {
    content: "▲";
  }

  #tsLinesTable th[data-ts-sort].ts-sort-desc .ts-sort-indicator::before {
    content: "▼";
  }

  /* ─────────────────────────────
   Timesheet-Felder: Labels nur auf Mobile/Tablet
   (weil Tabellen-Header dort ausgeblendet wird)
   ───────────────────────────── */
.ts-field-label {
  display: none;
  font-size: .72rem;
  opacity: .75;
  font-weight: 650;
  margin-bottom: .15rem;
}

@media (max-width: 768px) {
  #tsLinesTable .ts-field-label { display: block; }
  #tsLinesTable .ts-field { width: 100%; }
}


  /* ─────────────────────────────
   Mobile-Optimierung Timesheet Modal
   ───────────────────────────── */

@media (max-width: 576px) {
  /* Vollbild-Modal: Body soll scrollen können */
  #modalTimesheet .modal-content{
    /* iOS Safari: 100vh ist oft „zu groß“ wegen Adress-/Toolbar */
    height: 100dvh;              /* Dynamic Viewport (neuere Safari) */
    min-height: 100dvh;
    height: -webkit-fill-available; /* Fallback für ältere iOS */
    border-radius: 0;
  }

  #modalTimesheet .modal-body {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 96px; /* Platz für sticky Footer */
  }

  /* Sticky Footer damit "Entwurf/Fertigstellen" immer erreichbar bleibt */
  #modalTimesheet .modal-footer {
    position: sticky;
    bottom: 0;

    /* Default: Dark/Glass passend zu deinem Modal */
    background: rgba(20, 22, 26, .92);
    border-top: 1px solid rgba(255,255,255,.10);

    /* Optional: leichtes "Glass" */
    backdrop-filter: blur(8px);

    z-index: 10;
    gap: .5rem;
  }

  /* Buttons im Footer: gleiche Optik / Kontrast im Dark Mode */
  #modalTimesheet .modal-footer .btn {
    border-color: rgba(255,255,255,.14);
  }

  #modalTimesheet .modal-footer .btn-outline-secondary,
  #modalTimesheet .modal-footer .btn-outline-primary {
    color: rgba(255,255,255,.90);
  }

  #modalTimesheet .modal-footer .btn-outline-secondary:hover,
  #modalTimesheet .modal-footer .btn-outline-primary:hover {
    background: rgba(255,255,255,.08);
  }


  /* Buttons im Footer: groß + volle Breite, leicht zu treffen */
  #modalTimesheet .modal-footer .btn {
    flex: 1 1 auto;
    min-height: 44px;
  }

  /* iOS Zoom verhindern: Inputs >= 16px */
  #modalTimesheet input,
  #modalTimesheet select,
  #modalTimesheet textarea {
    font-size: 16px;
  }

  /* Tabellen auf Mobile etwas kompakter */
  #tsLinesTable th,
  #tsLinesTable td {
    padding: .35rem .4rem;
    vertical-align: top;
  }

  /* Beschreibung-Feld soll gut tipbar sein */
  #tsWorkDescription {
    min-height: 140px;
  }

    /* Zeiten-Tabelle auf Handys als Karten (übersichtlicher, mehr Platz) */
  #tsLinesTable thead { display: none; }

  #tsLinesTable tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
    grid-template-areas:
      "person person del"
      "date date del"
      "time_from time_to del"
      "hours hours del"
      "desc desc desc";
    gap: .35rem .5rem;

    padding: .6rem .6rem;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: .75rem;
    margin-bottom: .5rem;
    background: rgba(255,255,255,.04);
  }

  #tsLinesTable tbody td {
    border: 0 !important;
    padding: 0 !important;
  }

  #tsLinesTable tbody td:nth-child(1) { grid-area: person; }
  #tsLinesTable tbody td:nth-child(2) { grid-area: date; }
  #tsLinesTable tbody td:nth-child(3) { grid-area: time_from; }
  #tsLinesTable tbody td:nth-child(4) { grid-area: time_to; }
  #tsLinesTable tbody td:nth-child(5) { grid-area: hours; }
  #tsLinesTable tbody td:nth-child(6) { grid-area: desc; }
  #tsLinesTable tbody td:nth-child(7) {
    grid-area: del;
    justify-self: end;
    align-self: start;
  }

  #tsLinesTable tbody td:nth-child(1) .ts-cell-text { font-weight: 600; }
  #tsLinesTable tbody td:nth-child(5) .ts-cell-text { max-width: 8rem; margin-left: auto; }
  #tsLinesTable tbody td:nth-child(7) .btn {
    padding: .2rem .45rem;
    line-height: 1;
    border-radius: .5rem;
  }


}

/* ─────────────────────────────
   Collapse-Header (Phone + Tablet)
   ───────────────────────────── */
@media (max-width: 991.98px) {
  .ts-collapse-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: .5rem;

    padding: .65rem .75rem;
    border-radius: .75rem;

    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.06);

    color: rgba(255,255,255,.92);
    font-weight: 650;
    letter-spacing: .2px;
    text-align: left;
  }

  .ts-collapse-title { flex: 1 1 auto; }

  .ts-collapse-sub {
    font-weight: 500;
    color: rgba(255,255,255,.65);
    font-size: .9em;
  }

  .ts-collapse-chevron::before {
    content: "›";
    display: inline-block;
    transform: rotate(90deg);
    font-size: 1.2em;
    opacity: .85;
    transition: transform .15s ease;
  }

  .ts-collapse-btn[aria-expanded="true"] .ts-collapse-chevron::before {
    transform: rotate(-90deg);
  }
}


/* ─────────────────────────────────────────────
   Topbar (Header + Suche + Button)
   ───────────────────────────────────────────── */

.ts-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .9rem 1rem;
  flex-wrap: wrap;
}

.ts-topbar-main { flex: 1 1 auto; }
.ts-topbar-actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

.ts-search { min-width: 260px; }
.ts-new-btn { white-space: nowrap; }

@media (max-width: 768px){
  .ts-workspace {
    grid-template-columns: 1fr;
  }

  .ts-context-panel {
    position: static;
  }

  .ts-topbar{
    flex-direction: column;
    align-items: stretch;
  }

  .ts-topbar-actions{
    width: 100%;
  }

  .ts-search{
    flex: 1 1 100%;
    min-width: 0;
  }

  .ts-new-btn{
    flex: 1 1 100%;
    min-height: 44px;
  }
}


/* ─────────────────────────────────────────────
   Filterleisten (angelehnt an Projekte-Seite)
   ───────────────────────────────────────────── */
.year-filter {
  margin: var(--spacing-md) 0 var(--spacing-lg);
}

.filter-container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  justify-content: space-between;
}

.kunden-filter,
.ordner-filter,
.billing-question-filter,
.sordner-filter,
.status-filter {
  flex: 1 1 45%;
}
.status-filter{
  margin-bottom: var(--spacing-lg);
}

.kunden-filter h3,
.ordner-filter h3,
.billing-question-filter h3,
.sordner-filter h3,
.status-filter h3{
  font-size: 1.05rem;
  margin: 0 0 6px 0;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--spacing-sm);
}

.filter-bar .btn{
  padding: 6px 10px;
  min-width: 64px;
  font-weight: 600;
  border-radius: 12px;
  flex: 0 0 auto;
}

.filter-bar .form-select {
  max-width: 320px;
}

#timesheetsYearFilterBar button.sordner{
  min-width: 96px;
}

.hidden { display: none !important; }

@media (max-width: 768px) {
  .filter-container {
    gap: var(--spacing-sm);
  }

  .filter-bar .btn{
    flex: 1 0 48%;
  }
}

/* ─────────────────────────────
   Billing-Rückfragen: Karten & Antworten
   ───────────────────────────── */
.billing-question-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.billing-question-group {
  padding: 0.25rem 0;
}

.billing-question-card {
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.02);
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
}

.billing-question-title {
  font-size: 0.95rem;
}

.billing-question-meta {
  margin-top: 0.2rem;
}

.billing-question-answer {
  margin-top: 0.35rem;
}

.billing-question-answers {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.billing-question-answer-card {
  border: 1px dashed rgba(0, 0, 0, 0.12);
  background: #fff;
  border-radius: 0.65rem;
  padding: 0.65rem 0.75rem;
}

.billing-question-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #334155;
  background: rgba(51, 65, 85, 0.08);
  border: 1px solid rgba(51, 65, 85, 0.12);
  border-radius: 999px;
  padding: 0.2rem 0.5rem;
  margin-bottom: 0.35rem;
}

.billing-question-badge--price {
  color: #1e293b;
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.2);
}

.billing-question-badge--open {
  color: #9a3412;
  background: rgba(251, 191, 36, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
}

.billing-question-price {
  font-variant-numeric: tabular-nums;
}

.billing-question-price:not(input) {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--bs-secondary-color, #6c757d);
  margin-top: 0.25rem;
}

html[data-theme="dark"] .billing-question-card {
  border-color: rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.6);
  color: #e2e8f0;
}

html[data-theme="dark"] .billing-question-meta {
  color: #cbd5f5;
}

html[data-theme="dark"] .billing-question-answer {
  color: #e2e8f0;
}

html[data-theme="dark"] .billing-question-answer-card {
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(30, 41, 59, 0.9);
  color: #e2e8f0;
}

html[data-theme="dark"] .billing-question-badge {
  color: #e2e8f0;
  background: rgba(148, 163, 184, 0.15);
  border-color: rgba(148, 163, 184, 0.3);
}

html[data-theme="dark"] .billing-question-badge--price {
  color: #e0f2fe;
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.35);
}

html[data-theme="dark"] .billing-question-badge--open {
  color: #fde68a;
  background: rgba(217, 119, 6, 0.2);
  border-color: rgba(245, 158, 11, 0.45);
}


/* ─────────────────────────────
   Materialpositionen: Mobile/Tablet übersichtlicher
   - Mehr Platz für Bezeichnung
   - Hero-Nr. als reine Anzeige (kein "Eingabefeld"-Look)
   ───────────────────────────── */

/* Default: Inline-Hero unter Bezeichnung nur auf Mobile/Tablet */
.mat-hero-inline { display: none; }

@media (max-width: 768px) {
  /* Kopfzeile spart Platz (Mobile) */
  #tsMaterialTable thead { display: none; }

  /* Jede Material-Zeile als Grid (Qty | Unit | EAN | X, darunter Bezeichnung) */
  #tsMaterialTable tbody tr.ts-mat-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1.2fr auto;
    grid-template-areas:
      "qty unit ean actions"
      "label label label label";
    gap: .35rem .5rem;
    padding: .5rem .5rem;
    border-bottom: 1px solid var(--bs-border-color);
  }

  #tsMaterialTable tbody tr.ts-mat-row td {
    border: 0;
    padding: 0;
  }

  #tsMaterialTable tbody tr.ts-mat-row td.mat-col-qty { grid-area: qty; }
  #tsMaterialTable tbody tr.ts-mat-row td.mat-col-unit { grid-area: unit; }
  #tsMaterialTable tbody tr.ts-mat-row td.ts-ean-col { grid-area: ean; } /* <-- neu */
  #tsMaterialTable tbody tr.ts-mat-row td.mat-col-actions { grid-area: actions; justify-self: end; }
  #tsMaterialTable tbody tr.ts-mat-row td.mat-col-label { grid-area: label; }

  /* Hero-Nr. als eigenes Feld ausblenden – stattdessen Inline-Text unter Bezeichnung */
  #tsMaterialTable tbody tr.ts-mat-row td.mat-col-hero { display: none; }
  .mat-hero-inline { display: block; }
}



/* ─────────────────────────────
   EAN-Spalte (nur mobil anzeigen)
   ───────────────────────────── */
@media (min-width: 992px) {
  #tsMaterialTable th.ts-ean-col,
  #tsMaterialTable td.ts-ean-col {
    display: none;
  }
}

#tsMaterialTable .mat-ean {
  font-variant-numeric: tabular-nums;
}

/* EAN-Scanner Modal */
#modalEanScan .ean-scan-video-wrap {
  width: 100%;
  border-radius: .75rem;
  overflow: hidden;
  background: #0b0f19;
}

#modalEanScan video {
  width: 100%;
  height: 260px;
  object-fit: cover;
  display: block;
}

/* EAN Feedback */
#tsMaterialTable .mat-ean.ean-incomplete,
#tsMaterialTable .mat-ean.ean-error {
  border-color: var(--bs-danger) !important;
  box-shadow: 0 0 0 .2rem rgba(var(--bs-danger-rgb), .25) !important;
}

#tsMaterialTable .mat-ean.ean-ok {
  border-color: var(--bs-success) !important;
  box-shadow: 0 0 0 .2rem rgba(var(--bs-success-rgb), .25) !important;
}

#tsMaterialTable .mat-ean.ean-searching {
  border-color: var(--bs-primary) !important;
  box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .18) !important;
}

/* Mobile: Kein seitliches Wischen/Scrollen im Timesheet-Modal */
@media (max-width: 768px) {
  /* verhindert horizontales Scrollen auch nach Focus */
  body.modal-open {
    overflow-x: hidden !important;
    overscroll-behavior-x: none;
  }

  #modalTimesheet,
  #modalTimesheet .modal-dialog,
  #modalTimesheet .modal-content,
  #modalTimesheet .modal-body {
    overflow-x: hidden !important;
    max-width: 100vw;
  }

  /* häufige Ursache: Elemente, die breiter als der Viewport werden */
  #modalTimesheet * {
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Autocomplete-Dropdown darf nicht "rausstehen" */
  #modalTimesheet .dropdown-menu {
    max-width: calc(100vw - 24px);
    overflow-x: hidden;
  }

  /* Input-Groups (EAN etc.) sollen nicht überlaufen */
  #modalTimesheet .input-group {
    width: 100%;
  }

  /* verhindert "rubber band" seitlich */
  #modalTimesheet .modal-body {
    overscroll-behavior: contain;
  }
}

@media (max-width: 768px) {
  #modalTimesheet input,
  #modalTimesheet select,
  #modalTimesheet textarea {
    font-size: 16px; /* iOS verhindert Focus-Zoom */
  }
}

/* ─────────────────────────────
   Mobile: Breiten vereinheitlichen + kein horizontaler Overflow
   ───────────────────────────── */
@media (max-width: 768px) {
  /* Bootstrap-rows haben negative Margins -> kann in Modals „breiter“ wirken */
  #modalTimesheet .modal-body { overflow-x: hidden; }
  #modalTimesheet .modal-body .row { margin-left: 0; margin-right: 0; }
  #modalTimesheet .modal-body .row > [class^="col"] { padding-left: 0; padding-right: 0; }

  /* Materialtabelle darf niemals breiter als der Viewport werden
     (Inline-widths im THEAD überschreiben) */
  #tsMaterialTable { width: 100%; max-width: 100%; table-layout: fixed; }
  #tsMaterialTable th, #tsMaterialTable td { width: auto !important; }
  #tsMaterialTable tbody tr.ts-mat-row { width: 100%; max-width: 100%; }
  #tsMaterialTable tbody tr.ts-mat-row td { min-width: 0; }

  /* Inputs innerhalb der Grid-Zeile dürfen shrinken (sonst erzwingen sie Overflow) */
  #tsMaterialTable .form-control,
  #tsMaterialTable .form-select,
  #tsMaterialTable .input-group,
  #tsMaterialTable .mat-ean { min-width: 0; }
}

/* ─────────────────────────────
   Mobile: Footer-Button sichtbar (iOS Safe Area)
   ───────────────────────────── */
@media (max-width: 576px) {
  #modalTimesheet .modal-footer {
    padding-bottom: calc(.75rem + env(safe-area-inset-bottom));
  }
  /* Content nicht „hinter“ den sticky Footer laufen lassen */
  #modalTimesheet .modal-body {
    padding-bottom: calc(4.5rem + env(safe-area-inset-bottom));
  }
}


/* ─────────────────────────────
   Sticky Footer im Timesheet-Modal: immer sichtbar + Inhalt läuft nicht drunter
   ───────────────────────────── */
:root{
  /* Fallback-Höhe für den sticky Footer (Buttons + Padding) */
  --ts-footer-h: 110px;
}

@media (max-width: 768px) {
  /* Sticky Footer: safe-area + immer über Content */
  #modalTimesheet .modal-footer {
    position: sticky;
    bottom: 0;
    z-index: 1056; /* über modal-body */
    background: inherit; /* oder var(--bs-body-bg) falls nötig */

    padding-bottom: calc(.75rem + env(safe-area-inset-bottom));
    min-height: calc(var(--ts-footer-h) + env(safe-area-inset-bottom));
  }

  /* Content darf nie unter den Footer laufen */
  #modalTimesheet .modal-body {
    padding-bottom: calc(var(--ts-footer-h) + env(safe-area-inset-bottom) + 8px) !important;
  }
}


/* ─────────────────────────────────────────────
   Autocomplete (Mitarbeiter) in Zeiten-Tabelle:
   Dropdown darf nicht vom Tabellen-Wrapper geclippt werden
   ───────────────────────────────────────────── */
#modalTimesheet .ts-lines-responsive {
  overflow: visible;
  position: relative;
}

@media (min-width: 992px) {
  #modalTimesheet .ts-lines-responsive {
    overflow-x: auto;
    overflow-y: visible;
  }

  #modalTimesheet #tsLinesTable {
    width: 100%;
    table-layout: fixed;
  }

  #modalTimesheet #tsLinesTable th:nth-child(1) { width: 18%; }
  #modalTimesheet #tsLinesTable th:nth-child(2) { width: 13%; }
  #modalTimesheet #tsLinesTable th:nth-child(3),
  #modalTimesheet #tsLinesTable th:nth-child(4) { width: 9%; }
  #modalTimesheet #tsLinesTable th:nth-child(5) { width: 8%; }
  #modalTimesheet #tsLinesTable th:nth-child(6) { width: 31%; }
  #modalTimesheet #tsLinesTable th:nth-child(7) { width: 140px; }

  #modalTimesheet #tsLinesTable th,
  #modalTimesheet #tsLinesTable td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #modalTimesheet #tsLinesTable td:nth-child(1),
  #modalTimesheet #tsLinesTable td:nth-child(2),
  #modalTimesheet #tsLinesTable td:nth-child(6) {
    white-space: normal;
  }

  #modalTimesheet #tsLinesTable td:nth-child(7),
  #modalTimesheet #tsLinesTable th:nth-child(7) {
    width: 140px;
  }

  #modalTimesheet #tsLinesTable td:nth-child(7) > div {
    display: flex;
    justify-content: center;
    gap: 0.35rem;
    flex-wrap: nowrap;
  }
}

/* Auf kleinen Screens horizontales Scrollen behalten, vertikal aber nicht clippen */
@media (max-width: 768px) {
  #modalTimesheet .ts-lines-responsive {
    overflow-x: auto;
    overflow-y: visible;
  }
}

#modalTimesheet #tsLinesTable,
#modalTimesheet #tsLinesTable tbody,
#modalTimesheet #tsLinesTable tr {
  overflow: visible;
}

#modalTimesheet .ts-employee-ac .eh-ac .dropdown-menu {
  z-index: 9000;
}

.timesheets-buero-tabs {
  margin: 0.5rem 0 1rem;
}

#projectCompletionsTabPane td {
  vertical-align: top;
}
/* Archivierte Stundennachweise: deaktivierte Optik, aber klickbar für Hinweisansicht */
.ts-archived-row,
.ts-archived-card {
  opacity: 0.62;
  filter: saturate(0.45);
  border-style: dashed;
}

.ts-archived-row,
.ts-archived-row *,
.ts-archived-card,
.ts-archived-card * {
  cursor: help !important;
}

.ts-archived-row:hover,
.ts-archived-row:focus-within,
.ts-archived-card:hover,
.ts-archived-card:focus-within {
  opacity: 0.7;
  filter: saturate(0.55);
}

.ts-archived-row .btn-open,
.ts-archived-card .btn-open {
  cursor: pointer !important;
}