:root {
  --portal-primary: #4f46e5;
  --portal-primary-dark: #3730a3;
  --portal-ink: #182230;
  --portal-muted: #687386;
  --portal-line: #e7eaf0;
}

@media (min-width: 992px) {
  :root {
    --lte-sidebar-width: 16.5rem;
  }
}

body {
  color: var(--portal-ink);
}

.portal-login {
  min-height: 100vh;
  padding: 2rem;
  background:
    radial-gradient(circle at 18% 18%, rgba(99, 102, 241, .2), transparent 28rem),
    radial-gradient(circle at 86% 82%, rgba(14, 165, 233, .14), transparent 24rem),
    #f4f6fb;
}

.portal-login .login-box {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(22rem, 1fr);
  align-items: center;
  gap: 4.5rem;
  width: min(100%, 62rem);
}

.brand-mark,
.welcome-icon {
  display: inline-grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--portal-primary), #0ea5e9);
  box-shadow: 0 12px 28px rgba(79, 70, 229, .24);
}

.brand-mark {
  width: 4rem;
  height: 4rem;
  margin-bottom: 1.5rem;
  border-radius: 1.25rem;
  font-size: 1.8rem;
}

.eyebrow {
  margin-bottom: .6rem;
  color: var(--portal-primary);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.brand-panel h1 {
  max-width: 10ch;
  margin-bottom: 1rem;
  font-size: clamp(2.3rem, 5vw, 4rem);
  font-weight: 750;
  letter-spacing: -.045em;
  line-height: .98;
}

.brand-copy {
  max-width: 28rem;
  color: var(--portal-muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.login-card {
  overflow: hidden;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 1.5rem;
}

.login-card-body {
  padding: 2.35rem;
}

.form-title {
  margin-bottom: .35rem;
  font-size: 1.55rem;
  font-weight: 750;
}

.login-box-msg {
  padding: 0 0 1.25rem;
  color: var(--portal-muted);
  text-align: left;
}

.form-label {
  font-size: .86rem;
  font-weight: 700;
}

.input-group-text,
.form-control,
.form-select,
.password-toggle {
  min-height: 3rem;
  border-color: var(--portal-line);
}

.input-group-text {
  color: var(--portal-muted);
  background: #f8f9fc;
}

.form-control:focus {
  border-color: rgba(79, 70, 229, .6);
  box-shadow: 0 0 0 .2rem rgba(79, 70, 229, .12);
}

.totp-code-fields {
  display: grid;
  grid-template-columns: repeat(var(--totp-digit-count, 6), minmax(0, 1fr));
  gap: clamp(.35rem, 1.8vw, .65rem);
  width: 100%;
  margin-bottom: .35rem;
}

.totp-code-digit.form-control {
  min-width: 0;
  min-height: 3.75rem;
  padding: .25rem;
  border-width: 1px;
  border-radius: .85rem !important;
  text-align: center;
  font-size: 1.55rem;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  line-height: 1;
  caret-color: var(--portal-primary);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease, transform .15s ease;
}

.totp-code-digit.form-control.is-filled {
  border-color: rgba(79, 70, 229, .38);
  background: rgba(79, 70, 229, .055);
}

.totp-code-digit.form-control:focus {
  z-index: 1;
  border-color: var(--portal-primary);
  box-shadow: 0 0 0 .22rem rgba(79, 70, 229, .14);
  transform: translateY(-1px);
}

@media (max-width: 575.98px) {
  .totp-code-fields {
    gap: .35rem;
  }

  .totp-code-digit.form-control {
    min-height: 3.35rem;
    border-radius: .7rem !important;
    font-size: 1.3rem;
  }
}

.login-button {
  display: flex;
  min-height: 3rem;
  align-items: center;
  justify-content: center;
  gap: .7rem;
  border-color: var(--portal-primary);
  background: var(--portal-primary);
  font-weight: 700;
}

.login-button:hover,
.login-button:focus {
  border-color: var(--portal-primary-dark);
  background: var(--portal-primary-dark);
}

.security-note {
  margin: 1.3rem 0 0;
  color: var(--portal-muted);
  font-size: .78rem;
  text-align: center;
}

.app-sidebar {
  background: linear-gradient(180deg, #171a2c, #21243a) !important;
}

.brand-icon {
  display: inline-grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  margin-right: .45rem;
  border-radius: .65rem;
  color: #fff;
  background: var(--portal-primary);
}

.sidebar-menu .nav-link.active {
  background: var(--portal-primary);
}

.sidebar-wrapper-with-footer-menu {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-wrapper-with-footer-menu > nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.sidebar-footer-menu {
  flex: 0 0 auto;
  margin: .5rem;
  padding-top: .5rem;
  border-top: 1px solid rgba(255, 255, 255, .1);
}

.management-active-tenant-separator {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin: .75rem 0 .35rem;
  padding: .65rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, .14);
  border-bottom: 1px solid rgba(255, 255, 255, .14);
}

.sidebar-wrapper-with-footer-menu .tenant-chip {
  position: static;
  flex: 0 0 auto;
  margin: .25rem 1rem 1.2rem;
}

.tenant-chip {
  position: absolute;
  right: 1rem;
  bottom: 1.2rem;
  left: 1rem;
  display: flex;
  box-sizing: border-box;
  width: auto;
  min-height: 4.35rem;
  align-items: center;
  gap: .75rem;
  padding: .85rem;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: .85rem;
  color: rgba(255, 255, 255, .9);
  background: rgba(255, 255, 255, .06);
}

.tenant-chip-button {
  text-align: left;
  font: inherit;
  cursor: pointer;
  appearance: none;
}

.tenant-chip-button > span:nth-child(2) {
  min-width: 0;
  flex: 1 1 auto;
}

.tenant-chip-button:hover,
.tenant-chip-button:focus-visible {
  color: #fff;
  border-color: rgba(255, 255, 255, .3);
  background: rgba(255, 255, 255, .12);
}

.tenant-chip-button:focus-visible {
  outline: 3px solid rgba(13, 110, 253, .45);
  outline-offset: 2px;
}

.tenant-chip-chevron {
  flex: 0 0 auto;
  margin-left: auto;
}

.tenant-chip > span:last-child {
  min-width: 0;
  flex: 1 1 auto;
}

.tenant-chip-icon {
  font-size: 1.3rem;
}

.tenant-chip small,
.tenant-chip strong {
  display: block;
  line-height: 1.25;
}

.server-metric-grid,
.server-disk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: 1rem;
}

.server-metric-card {
  margin-bottom: 0;
}

.server-metric-heading {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.server-metric-heading > div {
  display: grid;
  gap: .15rem;
}

.server-metric-heading span:not(.server-metric-icon) {
  color: var(--portal-muted);
  font-size: .85rem;
}

.server-metric-heading strong {
  font-size: 1.65rem;
  line-height: 1.1;
}

.server-metric-icon {
  display: inline-grid;
  width: 3rem;
  height: 3rem;
  flex: 0 0 3rem;
  place-items: center;
  border-radius: .85rem;
  color: var(--portal-primary);
  background: color-mix(in srgb, var(--portal-primary) 13%, transparent);
  font-size: 1.4rem;
}

.server-metric-progress {
  height: .7rem;
  margin: 1.25rem 0;
  border-radius: 999px;
}

.server-metric-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  margin: 0;
}

.server-metric-facts div {
  display: grid;
  gap: .1rem;
}

.server-metric-facts dt,
.server-disk-values {
  color: var(--portal-muted);
  font-size: .8rem;
  font-weight: 500;
}

.database-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: 1rem;
}

.database-state-list {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  color: var(--portal-muted);
  font-size: .82rem;
}

.database-state-list i {
  margin-right: .35rem;
  color: var(--portal-primary);
  font-size: .55rem;
}

.database-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1rem;
  margin: 0;
}

.database-stat-grid div {
  padding: .85rem;
  border: 1px solid var(--portal-line);
  border-radius: .75rem;
  background: color-mix(in srgb, var(--portal-surface) 94%, var(--portal-primary) 6%);
}

.database-stat-grid dt {
  color: var(--portal-muted);
  font-size: .78rem;
  font-weight: 500;
}

.database-stat-grid dd {
  margin: .25rem 0 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.database-row-chart {
  min-width: 12rem;
}

.database-row-chart .progress {
  height: .55rem;
  border-radius: 999px;
}

.barcode-debug-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(22rem, .85fr);
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1.5rem;
}

.barcode-parameter-panel {
  padding: 1rem;
  border: 1px solid var(--portal-line);
  border-radius: .75rem;
  background: var(--portal-soft);
}

.barcode-parameter-panel h3 {
  margin: 0 0 1rem;
  color: var(--bs-body-color);
  font-size: .9rem;
  font-weight: 750;
}

.barcode-advanced-options {
  padding: .85rem 1rem;
  border: 1px dashed var(--portal-line);
  border-radius: .75rem;
  background: var(--portal-surface);
}

.barcode-advanced-options summary {
  color: var(--portal-primary);
  cursor: pointer;
  font-weight: 700;
}

.barcode-preview-card {
  position: sticky;
  top: 1rem;
  min-height: 32rem;
}

.barcode-preview-card .card-title {
  float: none;
  margin: 0;
}

.barcode-preview-body {
  display: grid;
  min-height: 25rem;
  place-items: center;
  overflow: hidden;
}

.barcode-canvas-stage {
  width: 100%;
  max-height: 65vh;
  overflow: auto;
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid var(--portal-line);
  border-radius: .75rem;
  background: repeating-conic-gradient(#f1f5f9 0 25%, #fff 0 50%) 50% / 1rem 1rem;
  text-align: center;
}

.barcode-canvas-stage canvas {
  display: inline-block;
  max-width: none;
  vertical-align: middle;
  box-shadow: 0 .5rem 1.5rem rgb(15 23 42 / 12%);
}

@media (max-width: 991.98px) {
  .barcode-debug-grid {
    grid-template-columns: 1fr;
  }

  .barcode-preview-card {
    position: static;
  }
}

.settings-switch {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding-left: 0;
}

.settings-switch .form-check-input {
  flex: 0 0 auto;
  margin: .15rem 0 0;
}

.settings-switch .form-check-label span {
  display: block;
  margin-top: .2rem;
  color: var(--portal-muted);
  font-size: .85rem;
}

.booking-license-evidence {
  display: grid;
  gap: .5rem;
  margin-top: .85rem;
}

.booking-license-label {
  color: var(--portal-muted);
  font-size: .8rem;
  font-weight: 700;
}

.booking-license-previews {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
}

.booking-license-previews a {
  overflow: hidden;
  width: 7.5rem;
  border: 1px solid var(--portal-line);
  border-radius: .7rem;
  color: inherit;
  background: var(--portal-surface);
  text-decoration: none;
}

.booking-license-previews img {
  display: block;
  width: 100%;
  height: 4.75rem;
  object-fit: cover;
}

.booking-license-previews span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .4rem;
  padding: .4rem .5rem;
  font-size: .72rem;
  font-weight: 700;
}

.booking-license-valid {
  width: fit-content;
  margin-top: .75rem;
  padding: .4rem .65rem;
  border-radius: 999px;
  color: #146c43;
  background: rgba(25, 135, 84, .12);
  font-size: .78rem;
  font-weight: 700;
}

.server-metric-facts dd {
  margin: 0;
  font-weight: 700;
}

.server-disk-item {
  padding: 1rem;
  border: 1px solid var(--portal-line);
  border-radius: .9rem;
  background: var(--portal-surface);
}

.server-disk-values {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .4rem 1rem;
}

.tenant-chip small {
  margin-bottom: .15rem;
  color: rgba(255, 255, 255, .55);
}

.tenant-chip strong {
  overflow: hidden;
  max-width: 10rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-main {
  background: #f6f7fb;
}

.portal-breadcrumb-bar {
  padding: .85rem 0;
  border-bottom: 1px solid var(--portal-line);
  background: color-mix(in srgb, var(--portal-surface, #fff) 92%, var(--portal-primary) 8%);
}

.portal-breadcrumb {
  align-items: center;
  font-size: .82rem;
  font-weight: 650;
}

.portal-breadcrumb .breadcrumb-item,
.portal-breadcrumb .breadcrumb-item::before {
  color: var(--portal-muted);
}

.portal-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
  content: "\F285";
  padding-top: .08rem;
  font-family: "bootstrap-icons";
  font-size: .68rem;
}

.portal-breadcrumb a {
  color: var(--portal-muted);
  text-decoration: none;
  transition: color .15s ease;
}

.portal-breadcrumb a:hover,
.portal-breadcrumb a:focus-visible {
  color: var(--portal-primary);
}

.portal-breadcrumb .breadcrumb-item.active {
  overflow: hidden;
  max-width: min(34rem, 45vw);
  color: var(--portal-ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-content-header {
  padding-top: 1.5rem;
}

.app-content-header h1 {
  font-weight: 750;
  letter-spacing: -.025em;
}

.portal-page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.portal-page-heading-main {
  min-width: 0;
}

.portal-page-heading-main h1 {
  margin-bottom: .25rem;
}

.portal-page-heading-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: .65rem;
}

@media (max-width: 767.98px) {
  .portal-page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .portal-page-heading-actions {
    justify-content: stretch;
  }

  .portal-page-heading-actions > .btn,
  .portal-page-heading-actions > form,
  .portal-page-heading-actions > form > .btn {
    width: 100%;
  }
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .8rem;
  border: 1px solid #d9eadf;
  border-radius: 999px;
  color: #287044;
  background: #f2fbf5;
  font-size: .8rem;
  font-weight: 700;
}

.status-pill span {
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: #32a65a;
  box-shadow: 0 0 0 .2rem rgba(50, 166, 90, .15);
}

.welcome-card {
  position: relative;
  display: flex;
  min-height: 18rem;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  padding: clamp(2rem, 5vw, 4.5rem);
  border-radius: 1.5rem;
  background:
    radial-gradient(circle at 85% 20%, rgba(255, 255, 255, .16), transparent 16rem),
    linear-gradient(130deg, #312e81, #4f46e5 58%, #0284c7);
  box-shadow: 0 18px 40px rgba(49, 46, 129, .18);
  color: #fff;
}

.welcome-card .eyebrow {
  color: #c7d2fe;
}

.welcome-card h2 {
  margin-bottom: .7rem;
  font-size: clamp(2.1rem, 5vw, 3.6rem);
  font-weight: 760;
  letter-spacing: -.04em;
}

.welcome-card p:last-child {
  margin: 0;
  color: rgba(255, 255, 255, .78);
  font-size: 1.05rem;
}

.welcome-icon {
  width: 3rem;
  height: 3rem;
  margin-bottom: 1.25rem;
  border-radius: .85rem;
  background: rgba(255, 255, 255, .16);
  box-shadow: none;
}

.company-badge {
  display: grid;
  width: 10rem;
  height: 10rem;
  flex: 0 0 auto;
  place-items: center;
  margin-left: 3rem;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 2rem;
  background: rgba(255, 255, 255, .1);
  font-size: 4rem;
  transform: rotate(4deg);
}

.info-card {
  display: flex;
  min-height: 8rem;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.35rem;
  border: 1px solid var(--portal-line);
  border-radius: 1rem;
  background: #fff;
}

.info-card > i {
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: .75rem;
  color: var(--portal-primary);
  background: #eef2ff;
  font-size: 1.2rem;
}

.info-card strong,
.info-card span {
  display: block;
}

.info-card strong {
  margin-bottom: .3rem;
}

.info-card span {
  color: var(--portal-muted);
  font-size: .86rem;
  line-height: 1.5;
}

.info-card-link {
  color: inherit;
  text-decoration: none;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.info-card-link:hover {
  border-color: rgba(79, 70, 229, .38);
  box-shadow: 0 12px 28px rgba(24, 34, 48, .08);
  color: inherit;
  transform: translateY(-2px);
}

.employee-panel,
.employee-form-card {
  overflow: hidden;
  border: 1px solid var(--portal-line);
  border-radius: 1rem;
  box-shadow: 0 8px 24px rgba(24, 34, 48, .05);
}

.employee-panel .card-body {
  padding: 1.25rem;
}

.employee-table thead th {
  padding: .9rem 1rem;
  border-bottom-color: var(--portal-line);
  color: var(--portal-muted);
  background: #f8f9fc;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.employee-table tbody td {
  padding: 1rem;
  border-bottom-color: #eef0f4;
}

.employee-identity {
  display: flex;
  min-width: 13rem;
  align-items: center;
  gap: .75rem;
}

.employee-identity strong,
.employee-identity small {
  display: block;
}

.employee-identity small {
  margin-top: .12rem;
  color: var(--portal-muted);
}

.employee-avatar {
  display: grid;
  width: 2.55rem;
  height: 2.55rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: .8rem;
  color: var(--portal-primary);
  background: #eef2ff;
  font-weight: 800;
}

.employee-avatar-image {
  object-fit: cover;
}

.employee-avatar img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.expiry-date {
  display: block;
  margin-top: .35rem;
  color: var(--portal-muted);
  white-space: nowrap;
}

.employee-status {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 750;
}

.employee-status::before {
  width: .42rem;
  height: .42rem;
  border-radius: 50%;
  content: "";
}

.employee-status.is-active {
  color: #237143;
  background: #ecf8f0;
}

.employee-status.is-active::before {
  background: #32a65a;
}

.employee-status.is-inactive {
  color: #7a5360;
  background: #f7eef1;
}

.employee-status.is-inactive::before {
  background: #a7697d;
}

.employee-status.is-deleted {
  color: #7f1d1d;
  background: #fee2e2;
}

.employee-status.is-deleted::before {
  background: #dc2626;
}

.contact-line {
  display: block;
  min-width: 8rem;
  color: var(--portal-muted);
  font-size: .84rem;
  white-space: nowrap;
}

.contact-line + .contact-line {
  margin-top: .2rem;
}

.contact-line i {
  width: 1.25rem;
  margin-right: .25rem;
}

.employee-actions {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  white-space: nowrap;
}

.employee-actions form {
  display: inline-flex;
}

.empty-state {
  padding: clamp(3rem, 8vw, 6rem) 1.5rem;
  text-align: center;
}

.empty-state > span {
  display: inline-grid;
  width: 4rem;
  height: 4rem;
  place-items: center;
  margin-bottom: 1rem;
  border-radius: 1rem;
  color: var(--portal-primary);
  background: #eef2ff;
  font-size: 1.7rem;
}

.empty-state h2 {
  font-size: 1.25rem;
  font-weight: 750;
}

.empty-state p {
  max-width: 30rem;
  margin: .5rem auto 1.25rem;
  color: var(--portal-muted);
}

.searchable-select-option.is-hierarchical {
  position: relative;
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: 2.75rem;
  padding-left: calc(.8rem + var(--hierarchy-depth, 0) * 1.35rem);
}

.searchable-select-option.is-hierarchical::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(.72rem + var(--hierarchy-depth, 0) * 1.35rem);
  width: 1px;
  background: var(--portal-line);
  content: "";
  transform: translateX(-.55rem);
}

.searchable-select-option-icon {
  display: grid;
  width: 1.7rem;
  height: 1.7rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: .45rem;
  color: var(--portal-primary);
  background: #eef2ff;
}

.searchable-select-option-icon.has-image {
  overflow: hidden;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: .55rem;
  background: var(--portal-soft);
}

.searchable-select-option-icon.has-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.searchable-select-option-label {
  overflow: hidden;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.searchable-select-option.is-hierarchical.is-selected .searchable-select-option-icon {
  color: #fff;
  background: var(--portal-primary);
}

.searchable-select-option.has-details {
  display: flex;
  min-height: 3.7rem;
  align-items: center;
  gap: .75rem;
  padding: .65rem .7rem;
}

.searchable-select-option-content {
  display: block;
  min-width: 0;
}

.searchable-select-option-content strong,
.searchable-select-option-content small {
  display: block;
}

.searchable-select-option-content strong {
  overflow: hidden;
  font-size: .9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.searchable-select-option-content small {
  overflow: hidden;
  margin-top: .15rem;
  color: var(--portal-muted);
  font-size: .73rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.searchable-select-option.has-details.is-selected .searchable-select-option-content small {
  color: rgba(255, 255, 255, .78);
}

.material-category-table tbody tr {
  transition: background-color .15s ease;
}

.material-category-table tbody tr:hover {
  background: var(--portal-soft);
}

.material-category-tree-entry {
  position: relative;
  display: flex;
  min-width: 16rem;
  align-items: center;
  gap: .75rem;
  padding-left: calc(var(--category-depth, 0) * 1.7rem);
}

.material-category-tree-line {
  position: absolute;
  top: -1rem;
  bottom: 50%;
  left: calc(var(--category-depth, 0) * 1.7rem - .85rem);
  width: .62rem;
  border-bottom: 1px solid var(--portal-line);
  border-left: 1px solid var(--portal-line);
  border-bottom-left-radius: .35rem;
  content: "";
}

.material-category-tree-entry.is-root .material-category-tree-line {
  display: none;
}

.material-category-folder {
  display: grid;
  width: 2.45rem;
  height: 2.45rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #dfe3ff;
  border-radius: .7rem;
  color: var(--portal-primary);
  background: #f0f2ff;
  font-size: 1.05rem;
  box-shadow: 0 4px 12px rgba(79, 70, 229, .08);
}

.material-category-tree-entry strong,
.material-category-tree-entry small {
  display: block;
}

.material-category-tree-entry small {
  margin-top: .15rem;
  color: var(--portal-muted);
  font-size: .76rem;
}

.material-category-path {
  display: flex;
  min-width: 14rem;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
  color: var(--portal-muted);
  font-size: .82rem;
}

.material-category-path span:last-child {
  color: var(--portal-ink);
  font-weight: 700;
}

.material-category-path i {
  color: #a5adbb;
  font-size: .65rem;
}

.material-category-count {
  display: inline-flex;
  align-items: baseline;
  gap: .3rem;
  padding: .35rem .65rem;
  border-radius: 999px;
  color: #37507a;
  background: #edf3fc;
  font-size: .76rem;
}

.material-category-count strong {
  font-size: .9rem;
}

.employee-form-card {
  width: 100%;
  max-width: none;
  margin-bottom: 0;
}

.adaptive-form-grid,
.adaptive-card-grid,
.adaptive-dashboard-grid {
  display: grid;
  align-items: start;
  gap: 1.5rem;
}

.adaptive-form-grid {
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 2rem;
}

.adaptive-form-grid.employee-form-layout {
  grid-template-columns: minmax(0, 1fr);
}

.employee-form-master-data {
  order: 1;
}

.employee-form-login {
  order: 2;
}

.employee-form-driving-licenses {
  order: 3;
}

.employee-form-expiry {
  order: 4;
}

.adaptive-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 34rem), 1fr));
}

.adaptive-dashboard-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
}

.adaptive-form-grid > *,
.adaptive-card-grid > *,
.adaptive-dashboard-grid > * {
  width: 100%;
  min-width: 0;
}

.adaptive-form-grid > .grid-full {
  grid-column: 1 / -1;
}

.adaptive-card-grid > .grid-full {
  grid-column: 1 / -1;
}

.adaptive-form-grid > .employee-form-card:last-child {
  height: fit-content;
}

.employee-form-card .card-header,
.employee-form-card .card-footer {
  padding: 1rem 1.25rem;
  border-color: var(--portal-line);
  background: #fff;
}

.employee-form-card .card-title {
  font-size: 1rem;
  font-weight: 750;
}

.employee-form-card .card-body {
  padding: clamp(1.25rem, 3vw, 2rem);
}

.profile-image-editor {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 1.5rem;
  padding: 1.25rem;
  border: 1px solid var(--portal-line);
  border-radius: 1rem;
  background: #f8f9fc;
}

.profile-image-stage {
  display: grid;
  width: 12rem;
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  border: 1px solid #dfe3eb;
  border-radius: 1rem;
  background:
    linear-gradient(45deg, #edf0f5 25%, transparent 25%),
    linear-gradient(-45deg, #edf0f5 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #edf0f5 75%),
    linear-gradient(-45deg, transparent 75%, #edf0f5 75%),
    #fff;
  background-position: 0 0, 0 .5rem, .5rem -.5rem, -.5rem 0;
  background-size: 1rem 1rem;
}

.profile-image-stage img,
.profile-image-stage canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-image-stage canvas {
  cursor: grab;
  touch-action: none;
}

.profile-image-stage canvas:focus-visible {
  outline: .2rem solid rgba(79, 70, 229, .35);
  outline-offset: -.2rem;
}

.profile-image-stage canvas.is-dragging {
  cursor: grabbing;
}

.profile-image-placeholder {
  display: grid;
  width: 4rem;
  height: 4rem;
  place-items: center;
  border-radius: 50%;
  color: #8d96a8;
  background: #e7eaf0;
  font-size: 2rem;
}

.profile-image-fields {
  width: 100%;
  max-width: 38rem;
}

.crop-controls .form-range {
  min-width: 8rem;
}

.expiry-switch {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  min-height: 3rem;
  margin: 0;
  padding: .7rem .9rem .7rem 3rem;
  border: 1px solid var(--portal-line);
  border-radius: .8rem;
  background: #f8f9fc;
}

.expiry-switch .form-check-input {
  margin-top: .15rem;
  margin-left: -2rem;
}

.expiry-switch strong,
.expiry-switch span {
  display: block;
}

.module-permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: .75rem;
}

.module-permission-groups {
  display: grid;
  min-width: 0;
  max-width: 100%;
  gap: 1rem;
}

.module-permission-group {
  min-width: 0;
  max-width: 100%;
  padding: .85rem;
  border: 1px solid var(--portal-line);
  border-radius: .85rem;
  background: var(--portal-surface-soft, #f8f9fc);
}

.module-permission-group h3 {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: .45rem;
  margin: 0 0 .75rem;
  color: var(--portal-ink);
  font-size: .9rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.module-permission-group h3 i {
  color: var(--portal-primary);
}

.module-permission-option {
  display: flex;
  min-width: 0;
  max-width: 100%;
  align-items: flex-start;
  gap: .65rem;
  padding: .85rem;
  border: 1px solid var(--portal-line);
  border-radius: .8rem;
  background: var(--portal-surface-soft, #f8f9fc);
  cursor: pointer;
}

.module-permission-option > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.module-permission-option strong,
.module-permission-option small {
  display: block;
}

.module-permission-option small {
  margin-top: .15rem;
  color: var(--portal-muted);
}

.expiry-switch span {
  margin-top: .18rem;
  color: var(--portal-muted);
  font-size: .82rem;
}

.vehicle-identity {
  min-width: 15rem;
}

.vehicle-assignment {
  display: inline-flex;
  min-width: 9rem;
  align-items: center;
  gap: .4rem;
  color: var(--portal-ink);
  font-size: .84rem;
}

.vehicle-assignment.is-pool {
  color: var(--portal-primary);
}

.vehicle-assignment.is-unassigned {
  color: var(--portal-muted);
}

.vehicle-summary {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--portal-line);
  border-radius: 1.25rem;
  background: #fff;
  box-shadow: 0 10px 30px rgba(24, 34, 48, .06);
}

.vehicle-summary-image {
  display: grid;
  min-height: 13rem;
  place-items: center;
  color: #a4adbb;
  background: linear-gradient(145deg, #eef2ff, #f5f7fb);
  font-size: 4rem;
}

.vehicle-summary-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vehicle-summary-content {
  padding: clamp(1.5rem, 4vw, 2.5rem);
}

.vehicle-summary-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--portal-line);
}

.vehicle-summary-title h2 {
  margin: 0 0 .3rem;
  font-weight: 750;
  letter-spacing: -.025em;
}

.vehicle-summary-title span {
  color: var(--portal-muted);
}

.vehicle-mileage {
  flex: 0 0 auto;
  padding: .55rem .8rem;
  border-radius: .75rem;
  color: var(--portal-primary);
  background: #eef2ff;
}

.vehicle-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.4rem 0 0;
}

.vehicle-facts dt {
  margin-bottom: .25rem;
  color: var(--portal-muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.vehicle-facts dd {
  margin: 0;
  font-weight: 650;
}

.timeline-compose {
  position: sticky;
  top: 5rem;
  overflow: hidden;
  border: 1px solid var(--portal-line);
  border-radius: 1rem;
  box-shadow: 0 8px 24px rgba(24, 34, 48, .05);
}

.timeline-title {
  font-size: 1.25rem;
  font-weight: 750;
}

.vehicle-timeline {
  position: relative;
  padding-left: 1.2rem;
}

.vehicle-timeline::before {
  position: absolute;
  top: 1rem;
  bottom: 1rem;
  left: 1.55rem;
  width: 2px;
  background: #dfe3eb;
  content: "";
}

.timeline-message {
  position: relative;
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  gap: 1rem;
  padding-bottom: 1.5rem;
}

.timeline-marker {
  z-index: 1;
  display: grid;
  width: 2.7rem;
  height: 2.7rem;
  place-items: center;
  border: .3rem solid #f6f7fb;
  border-radius: 50%;
  color: #fff;
  background: #64748b;
}

.timeline-marker.workshop {
  background: #2563eb;
}

.timeline-marker.damage {
  background: #dc2626;
}

.timeline-marker.problem {
  background: #d97706;
}

.timeline-marker.mileage {
  background: #059669;
}

.timeline-marker.fuel {
  background: #0f766e;
}

.timeline-marker.other {
  background: #6366f1;
}

.timeline-marker.booking-requested {
  background: #64748b;
}

.timeline-marker.booking-approved {
  background: #15803d;
}

.timeline-marker.booking-rejected {
  background: #b91c1c;
}

.timeline-marker.booking-cancelled {
  background: #9f1239;
}

.timeline-marker.booking-pickup {
  background: #1d4ed8;
}

.timeline-marker.booking-returned {
  background: #7c3aed;
}

.timeline-bubble {
  min-width: 0;
  padding: 1.15rem;
  border: 1px solid var(--portal-line);
  border-radius: .25rem 1rem 1rem 1rem;
  background: #fff;
  box-shadow: 0 6px 18px rgba(24, 34, 48, .04);
}

.timeline-bubble header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .8rem;
}

.timeline-bubble header strong,
.timeline-bubble header span {
  display: block;
}

.timeline-bubble header span,
.timeline-bubble time,
.timeline-bubble footer {
  color: var(--portal-muted);
  font-size: .75rem;
}

.timeline-bubble p {
  margin-bottom: .8rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.timeline-mileage {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .8rem;
  padding: .35rem .6rem;
  border-radius: .55rem;
  color: #176b4c;
  background: #ecf8f2;
  font-size: .8rem;
  font-weight: 750;
}

.booking-timeline-period {
  color: var(--portal-muted);
  font-size: .9rem;
  font-weight: 700;
}

.booking-timeline-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: .7rem 1rem;
  margin: 0;
}

.booking-timeline-facts div {
  min-width: 0;
  padding: .7rem .8rem;
  border: 1px solid var(--portal-line);
  border-radius: .7rem;
  background: var(--portal-surface-soft);
}

.booking-timeline-facts dt {
  margin-bottom: .2rem;
  color: var(--portal-muted);
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.booking-timeline-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.timeline-images {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .55rem;
  margin: .2rem 0 .9rem;
}

.timeline-images a {
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: .7rem;
  background: #eef0f4;
}

.timeline-images img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .2s ease;
}

.timeline-images a:hover img {
  transform: scale(1.03);
}

.timeline-receipt {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin: .2rem 0 .9rem;
  padding: .7rem .8rem;
  border: 1px solid #b9e3dc;
  border-radius: .7rem;
  color: #0f5f59;
  background: #ecf9f7;
  font-weight: 700;
  text-decoration: none;
}

.timeline-receipt span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-receipt small {
  margin-left: auto;
  color: var(--portal-muted);
  font-weight: 600;
  white-space: nowrap;
}

.timeline-receipt:hover {
  color: #0a4945;
  border-color: #79c9bd;
  background: #def5f1;
}

.timeline-bubble footer {
  padding-top: .7rem;
  border-top: 1px solid #eef0f4;
}

@media (max-width: 767.98px) {
  .portal-login {
    padding: 1.25rem;
  }

  .portal-login .login-box {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .brand-panel h1 {
    max-width: none;
    font-size: 2.4rem;
  }

  .brand-copy {
    display: none;
  }

  .company-badge {
    display: none;
  }

  .welcome-card {
    min-height: 16rem;
  }

  .employee-panel {
    border-radius: .8rem;
  }

  .profile-image-editor {
    grid-template-columns: 1fr;
  }

  .profile-image-stage {
    width: min(100%, 16rem);
  }

  .vehicle-summary {
    grid-template-columns: 1fr;
  }

  .vehicle-summary-image {
    min-height: 12rem;
  }

  .vehicle-summary-title {
    flex-direction: column;
  }

  .vehicle-facts {
    grid-template-columns: 1fr;
  }

  .timeline-images {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .timeline-bubble header {
    flex-direction: column;
    gap: .35rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}

/* Funktionale Ergänzungen im ursprünglichen Erscheinungsbild */
.immutable-notice {
  display: flex;
  align-items: flex-start;
  gap: .8rem;
  padding: 1rem;
  border: 1px solid #f1d49a;
  border-radius: .8rem;
  color: #72510d;
  background: #fff9e9;
}

.immutable-notice > i {
  margin-top: .1rem;
  color: #a97915;
}

.immutable-notice strong,
.immutable-notice span {
  display: block;
}

.immutable-notice span {
  margin-top: .15rem;
  color: #846c3b;
  font-size: .84rem;
}

.form-control[readonly],
.form-select:disabled {
  background: #f3f4f7;
  color: var(--portal-muted);
  cursor: not-allowed;
  opacity: 1;
}

.vehicle-placeholder {
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #8d96a8;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .72), transparent 48%),
    #eef2ff;
}

.vehicle-placeholder-thumb {
  font-size: 1.1rem;
}

.vehicle-placeholder-large {
  width: 100%;
  height: 100%;
  min-height: 13rem;
  align-content: center;
  gap: .6rem;
}

.vehicle-placeholder-large i {
  font-size: 4rem;
}

.vehicle-placeholder-large span {
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.vehicle-placeholder-editor {
  width: 100%;
  height: 100%;
  align-content: center;
  gap: .4rem;
  border-radius: 0;
  font-size: 2.4rem;
}

.vehicle-placeholder-editor small {
  font-size: .68rem;
  font-weight: 750;
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* Kontrastreiches, modernes Theme */
:root {
  --portal-primary: #4338ca;
  --portal-primary-dark: #312e81;
  --portal-ink: #111827;
  --portal-muted: #4b5563;
  --portal-line: #cfd5df;
  --portal-surface: #fff;
  --portal-surface-soft: #f1f4f9;
  --portal-page: #e9edf4;
  --portal-shadow: 0 12px 34px rgba(15, 23, 42, .1);
}

html {
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --portal-primary: #818cf8;
  --portal-primary-dark: #6366f1;
  --portal-ink: #f3f4f6;
  --portal-muted: #c1c8d4;
  --portal-line: #465164;
  --portal-surface: #18202c;
  --portal-surface-soft: #222c3a;
  --portal-page: #0d131d;
  --portal-shadow: 0 14px 38px rgba(0, 0, 0, .34);
  --bs-body-color: #f3f4f6;
  --bs-body-bg: #0d131d;
  --bs-secondary-color: #c1c8d4;
  --bs-tertiary-bg: #111925;
  --bs-border-color: #465164;
}

body,
.app-main {
  background: var(--portal-page);
}

.app-header {
  min-height: 4.15rem;
  border-color: var(--portal-line) !important;
  background: color-mix(in srgb, var(--portal-surface) 94%, transparent) !important;
  box-shadow: 0 5px 22px rgba(15, 23, 42, .08);
  backdrop-filter: blur(14px);
}

.card,
.info-card,
.employee-panel,
.employee-form-card,
.timeline-bubble,
.vehicle-summary {
  border-color: var(--portal-line);
  background: var(--portal-surface);
  box-shadow: var(--portal-shadow);
}

.card-header,
.card-footer,
.employee-form-card .card-header,
.employee-form-card .card-footer {
  border-color: var(--portal-line);
  background: var(--portal-surface);
}

.time-tracking-page .card-header {
  padding: .9rem 1rem;
}

.time-tracking-page .card-header .card-title {
  margin: 0;
  line-height: 1.3;
}

.time-tracking-page .card-header p {
  margin-top: .2rem;
  line-height: 1.4;
}

.time-tracking-page .card-header > div > a.small.text-decoration-none {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-bottom: .55rem;
}

.time-tracking-page .card-header > div > a.small.text-decoration-none + .card-title {
  display: block;
  float: none;
  clear: both;
  margin: 0 0 .3rem !important;
  line-height: 1.25;
}

.time-tracking-page .card-header > div > a.small.text-decoration-none + .card-title + p {
  display: block;
  clear: both;
  margin: 0;
}

.employee-table thead th {
  border-bottom: 2px solid var(--portal-line);
  color: var(--portal-muted);
  background: var(--portal-surface-soft);
}

.employee-table tbody td {
  border-bottom-color: var(--portal-line);
}

.employee-table tbody tr {
  transition: background-color .16s ease;
}

.employee-table tbody tr:hover {
  background: color-mix(in srgb, var(--portal-primary) 7%, transparent);
}

.form-control,
.form-select,
.input-group-text {
  border-color: #aeb7c5;
  background-color: var(--portal-surface);
  color: var(--portal-ink);
}

.form-control::placeholder {
  color: color-mix(in srgb, var(--portal-muted) 82%, transparent);
}

.form-control:focus,
.form-select:focus,
.btn:focus-visible,
.nav-link:focus-visible {
  border-color: var(--portal-primary);
  box-shadow: 0 0 0 .22rem color-mix(in srgb, var(--portal-primary) 24%, transparent);
}

.form-control[readonly],
.form-select:disabled {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--portal-muted) 75%, transparent);
  background: var(--portal-surface-soft);
  color: var(--portal-muted);
  opacity: 1;
  cursor: not-allowed;
}

.btn {
  border-radius: .7rem;
  font-weight: 700;
}

.btn-primary {
  border-color: #4338ca;
  background: #4338ca;
}

.btn-primary:hover,
.btn-primary:focus {
  border-color: #312e81;
  background: #312e81;
}

.theme-toggle {
  display: inline-grid;
  width: 2.6rem;
  height: 2.6rem;
  place-items: center;
  border: 1px solid var(--portal-line);
  border-radius: .8rem;
  color: var(--portal-ink);
  background: var(--portal-surface-soft);
}

.theme-toggle:hover {
  border-color: var(--portal-primary);
  color: var(--portal-primary);
  background: color-mix(in srgb, var(--portal-primary) 10%, var(--portal-surface));
}

.theme-toggle-login {
  position: fixed;
  z-index: 10;
  top: 1.25rem;
  right: 1.25rem;
}

.immutable-notice {
  border-color: #d9a928;
  color: #5b4200;
  background: #fff7d6;
}

.immutable-notice > i {
  color: #9a6b00;
}

.vehicle-placeholder {
  color: #334155;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .68), transparent 46%),
    repeating-linear-gradient(135deg, #dce3ec 0, #dce3ec 10px, #e8edf3 10px, #e8edf3 20px);
}

html[data-theme="dark"] .portal-login {
  background:
    radial-gradient(circle at 18% 18%, rgba(99, 102, 241, .24), transparent 28rem),
    radial-gradient(circle at 86% 82%, rgba(14, 165, 233, .14), transparent 24rem),
    #0b111b;
}

html[data-theme="dark"] .login-card,
html[data-theme="dark"] .login-card-body,
html[data-theme="dark"] .profile-image-editor,
html[data-theme="dark"] .expiry-switch {
  border-color: var(--portal-line);
  background: var(--portal-surface);
}

html[data-theme="dark"] .input-group-text,
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
  border-color: #59667a;
  background-color: #111925;
  color: #f8fafc;
}

html[data-theme="dark"] .form-control[readonly],
html[data-theme="dark"] .form-select:disabled {
  background: #263140;
  color: #cbd5e1;
}

html[data-theme="dark"] .app-sidebar {
  background: linear-gradient(180deg, #070b12, #101827) !important;
}

html[data-theme="dark"] .vehicle-summary-image {
  color: #aab4c3;
  background: linear-gradient(145deg, #1d2939, #111925);
}

html[data-theme="dark"] .timeline-marker {
  border-color: var(--portal-page);
}

html[data-theme="dark"] .timeline-bubble footer,
html[data-theme="dark"] .vehicle-summary-title {
  border-color: var(--portal-line);
}

html[data-theme="dark"] .timeline-receipt {
  border-color: #287d74;
  color: #99f6e4;
  background: #123b38;
}

html[data-theme="dark"] .timeline-receipt:hover {
  border-color: #5eead4;
  color: #ccfbf1;
  background: #174a45;
}

html[data-theme="dark"] .employee-avatar,
html[data-theme="dark"] .info-card > i,
html[data-theme="dark"] .vehicle-mileage,
html[data-theme="dark"] .searchable-select-option-icon {
  color: #c7d2fe;
  background: #293251;
}

html[data-theme="dark"] .material-category-folder {
  border-color: #424d74;
  color: #c7d2fe;
  background: #293251;
}

html[data-theme="dark"] .material-category-count {
  color: #bfdbfe;
  background: #1e334f;
}

html[data-theme="dark"] .employee-status.is-active {
  color: #86efac;
  background: #143525;
}

html[data-theme="dark"] .employee-status.is-inactive {
  color: #fecdd3;
  background: #44212b;
}

html[data-theme="dark"] .employee-status.is-deleted {
  color: #fecaca;
  background: #551d24;
}

html[data-theme="dark"] .immutable-notice {
  border-color: #a47717;
  color: #fde68a;
  background: #3b2d0c;
}

html[data-theme="dark"] .immutable-notice > i {
  color: #fbbf24;
}

html[data-theme="dark"] .immutable-notice span {
  color: #f5d878;
}

html[data-theme="dark"] .vehicle-placeholder {
  color: #cbd5e1;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .07), transparent 46%),
    repeating-linear-gradient(135deg, #263140 0, #263140 10px, #202a37 10px, #202a37 20px);
}

html[data-theme="dark"] .table-light {
  --bs-table-bg: #202a37;
  --bs-table-color: #d1d5db;
}

html[data-theme="dark"] .bg-white {
  color: var(--portal-ink) !important;
  background-color: var(--portal-surface) !important;
}

html[data-theme="dark"] .border-bottom,
html[data-theme="dark"] .border-top {
  border-color: var(--portal-line) !important;
}

.pool-vehicle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 1.25rem;
}

.pool-vehicle-card {
  overflow: hidden;
}

.pool-vehicle-card-image {
  display: grid;
  height: 11rem;
  place-items: center;
  color: #64748b;
  background: #e8edf4;
}

.pool-vehicle-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pool-vehicle-card-image .vehicle-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  font-size: 3rem;
}

.booking-calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.booking-calendar-header .card-title {
  float: none;
  font-size: 1.1rem;
}

.searchable-select {
  position: relative;
}

.searchable-select.is-open {
  z-index: 1090;
}

.employee-panel.searchable-select-host-open,
.employee-form-card.searchable-select-host-open {
  position: relative;
  z-index: 20;
  overflow: visible;
}

.searchable-select [hidden] {
  display: none !important;
}

.searchable-select-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
}

.searchable-select-toggle span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.searchable-select-selection-image {
  width: 1.75rem;
  height: 1.75rem;
  flex: 0 0 auto;
  margin-right: .55rem;
  border-radius: .4rem;
  object-fit: cover;
}

.searchable-select-menu {
  position: absolute;
  z-index: 1080;
  top: calc(100% + .3rem);
  right: 0;
  left: 0;
  overflow: hidden;
  padding: .5rem;
  border: 1px solid var(--portal-line);
  border-radius: .6rem;
  background: var(--portal-surface);
  box-shadow: 0 .75rem 2rem rgb(15 23 42 / 18%);
}

.searchable-select-search {
  margin-bottom: .45rem;
}

.searchable-select-options {
  display: grid;
  max-height: 15rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.searchable-select-option {
  width: 100%;
  padding: .55rem .65rem;
  border: 0;
  border-radius: .4rem;
  color: var(--bs-body-color);
  background: transparent;
  text-align: left;
}

.searchable-select-option:hover,
.searchable-select-option:focus-visible {
  outline: 0;
  background: var(--portal-soft);
}

.searchable-select-option.is-selected {
  color: #fff;
  background: var(--portal-primary);
}

.searchable-select-empty {
  margin: .5rem .65rem;
  color: var(--portal-muted);
  font-size: .875rem;
}

.multi-search-select {
  position: relative;
}

.multi-search-select [hidden] {
  display: none !important;
}

.multi-search-select.is-invalid .multi-search-select-toggle {
  border-color: var(--bs-form-invalid-border-color);
}

.multi-search-select-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
}

.multi-search-selected {
  display: grid;
  gap: .55rem;
  margin-bottom: .75rem;
}

.multi-search-selected-empty {
  margin: 0;
  padding: .8rem 1rem;
  border: 1px dashed var(--portal-line);
  border-radius: .65rem;
  color: var(--portal-muted);
  background: var(--portal-soft);
}

.multi-search-chip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .75rem;
  padding: .65rem .75rem;
  border: 1px solid var(--portal-line);
  border-radius: .7rem;
  background: var(--portal-soft);
}

.multi-search-chip-icon {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  border-radius: 50%;
  color: var(--portal-primary);
  background: color-mix(in srgb, var(--portal-primary) 12%, var(--portal-surface));
}

.multi-search-chip-text,
.multi-search-chip-text strong,
.multi-search-chip-text small {
  display: block;
  min-width: 0;
}

.multi-search-chip-text small {
  margin-top: .1rem;
  color: var(--portal-muted);
}

.multi-search-chip-remove {
  color: var(--portal-muted);
}

.multi-search-chip-remove:hover,
.multi-search-chip-remove:focus-visible {
  color: var(--bs-danger);
  background: color-mix(in srgb, var(--bs-danger) 10%, transparent);
}

.multi-search-select-menu {
  position: absolute;
  z-index: 1080;
  top: calc(100% + .3rem);
  right: 0;
  left: 0;
  overflow: hidden;
  padding: .5rem;
  border: 1px solid var(--portal-line);
  border-radius: .6rem;
  background: var(--portal-surface);
  box-shadow: 0 .75rem 2rem rgb(15 23 42 / 18%);
}

.multi-search-select-flow .multi-search-select-menu {
  position: static;
  margin-top: .3rem;
}

.multi-search-select-options {
  display: grid;
  max-height: 18rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.multi-search-select-option {
  display: flex;
  width: 100%;
  align-items: center;
  gap: .7rem;
  padding: .6rem .65rem;
  border: 0;
  border-radius: .4rem;
  color: var(--bs-body-color);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.multi-search-select-option:hover {
  background: var(--portal-soft);
}

.multi-search-option-icon {
  display: grid;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--portal-primary);
  background: color-mix(in srgb, var(--portal-primary) 10%, var(--portal-surface));
}

.multi-search-option-icon-add {
  position: relative;
}

.multi-search-option-icon-add::before,
.multi-search-option-icon-add::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: .75rem;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  content: '';
  transform: translate(-50%, -50%);
}

.multi-search-option-icon-add::after {
  width: 2px;
  height: .75rem;
}

.multi-search-select-option span,
.multi-search-select-option strong,
.multi-search-select-option small {
  display: block;
}

.multi-search-select-option small {
  color: var(--portal-muted);
}

.booking-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  min-width: 52rem;
}

.booking-calendar-filter {
  position: relative;
  z-index: 5;
  overflow: visible;
}

.booking-calendar-scroll {
  overflow-x: auto;
}

.booking-calendar-weekday {
  padding: .7rem;
  border-bottom: 1px solid var(--portal-line);
  color: var(--portal-muted);
  background: var(--portal-soft);
  text-align: center;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.booking-calendar-day {
  min-height: 8.5rem;
  padding: .55rem;
  border-right: 1px solid var(--portal-line);
  border-bottom: 1px solid var(--portal-line);
  background: var(--portal-surface);
}

.booking-calendar-day:nth-child(7n) {
  border-right: 0;
}

.booking-calendar-day.is-outside {
  background: color-mix(in srgb, var(--portal-soft) 70%, transparent);
  opacity: .65;
}

.booking-calendar-date {
  display: grid;
  width: 1.8rem;
  height: 1.8rem;
  margin-bottom: .35rem;
  place-items: center;
  border-radius: 50%;
  font-size: .82rem;
  font-weight: 700;
}

.booking-calendar-day.is-today .booking-calendar-date {
  color: #fff;
  background: var(--portal-primary);
}

.booking-calendar-events {
  display: grid;
  gap: .3rem;
}

.booking-day-action {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  margin-top: .45rem;
  color: var(--portal-primary);
  font-size: .72rem;
  font-weight: 800;
  text-decoration: none;
}

.booking-day-action:hover {
  text-decoration: underline;
}

.booking-event {
  overflow: hidden;
  padding: .38rem .45rem;
  border-left: .22rem solid;
  border-radius: .35rem;
  font-size: .72rem;
}

.booking-event strong,
.booking-event span,
.booking-event small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.booking-event.is-approved,
.booking-status.is-approved {
  border-color: #15803d;
  color: #14532d;
  background: #dcfce7;
}

.booking-event.is-pending,
.booking-status.is-pending {
  border-color: #b7791f;
  color: #713f12;
  background: #fef3c7;
}

.booking-status.is-rejected {
  color: #881337;
  background: #ffe4e6;
}

.booking-calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.booking-calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

.booking-legend-dot {
  width: .65rem;
  height: .65rem;
  border-radius: 50%;
}

.booking-legend-dot.is-approved {
  background: #15803d;
}

.booking-legend-dot.is-pending {
  background: #d69e2e;
}

.booking-request-list {
  display: grid;
  gap: .8rem;
}

.booking-request {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--portal-line);
  border-radius: .7rem;
  background: var(--portal-soft);
}

.booking-request span,
.booking-request time {
  display: block;
  color: var(--portal-muted);
}

.booking-request p {
  margin: .45rem 0 0;
}

.trip-message {
  padding: .8rem;
  border: 1px solid var(--portal-line);
  border-radius: .65rem;
  background: var(--portal-soft);
}

.trip-message p {
  margin: 0 0 .35rem;
}

.trip-message time {
  color: var(--portal-muted);
  font-size: .78rem;
}

.booking-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  flex: 0 0 auto;
}

.booking-status {
  display: inline-flex;
  padding: .3rem .6rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 800;
}

.booking-vehicle-image,
.booking-vehicle-placeholder {
  width: 7rem;
  height: 7rem;
  border-radius: .7rem;
}

.booking-vehicle-image {
  object-fit: cover;
}

.booking-vehicle-placeholder {
  display: grid;
  place-items: center;
  color: #64748b;
  background: var(--portal-soft);
  font-size: 2.2rem;
}

html[data-theme="dark"] .booking-event.is-approved,
html[data-theme="dark"] .booking-status.is-approved {
  color: #bbf7d0;
  background: #143525;
}

html[data-theme="dark"] .booking-event.is-pending,
html[data-theme="dark"] .booking-status.is-pending {
  color: #fde68a;
  background: #3b2d0c;
}

html[data-theme="dark"] .booking-status.is-rejected {
  color: #fecdd3;
  background: #44212b;
}

.booking-status.is-cancelled {
  color: #9f1239;
  background: #ffe4e6;
}

html[data-theme="dark"] .booking-status.is-cancelled {
  color: #fecdd3;
  background: #4c1828;
}

@media (max-width: 575.98px) {
  .theme-toggle-login {
    top: .8rem;
    right: .8rem;
  }

  .user-label {
    display: none !important;
  }

  .booking-request {
    align-items: stretch;
    flex-direction: column;
  }

  .booking-actions form,
  .booking-actions .btn {
    width: 100%;
  }
}
[data-break-rule] {
  transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

[data-drag-handle] {
  cursor: grab;
}

[data-drag-handle]:active {
  cursor: grabbing;
}

.planning-toolbar,
.planning-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.planning-legend {
  justify-content: flex-start;
  color: var(--portal-muted);
  font-size: .78rem;
}

.legend-dot {
  display: inline-block;
  width: .65rem;
  height: .65rem;
  margin-right: .25rem;
  border-radius: 50%;
}

.legend-dot.is-published { background: #2563eb; }
.legend-dot.is-draft { background: #f59e0b; }

.planning-board-scroll {
  overflow: auto;
  max-height: calc(100vh - 19rem);
  min-height: 24rem;
}

.planning-board {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
}

.planning-board th,
.planning-board td {
  width: 10rem;
  min-width: 10rem;
  padding: .55rem;
  vertical-align: top;
  border-right: 1px solid var(--bs-border-color);
}

.planning-board thead th {
  position: sticky;
  z-index: 3;
  top: 0;
  text-align: center;
  background: var(--bs-body-bg);
}

.planning-board thead th span,
.planning-board thead th strong,
.planning-person-column small {
  display: block;
}

.planning-board .planning-person-column {
  position: sticky;
  z-index: 2;
  left: 0;
  width: 15rem;
  min-width: 15rem;
  background: var(--bs-body-bg);
  box-shadow: 1px 0 var(--bs-border-color);
}

.planning-board thead .planning-person-column { z-index: 4; }
.planning-board .planning-date-column {
  position: sticky;
  z-index: 2;
  left: 0;
  width: 9rem;
  min-width: 9rem;
  background: var(--bs-body-bg);
  box-shadow: 1px 0 var(--bs-border-color);
}

.planning-board thead .planning-date-column { z-index: 4; }

.planning-board-vertical th:not(.planning-date-column),
.planning-board-vertical td {
  width: 14rem;
  min-width: 14rem;
}

.planning-board-vertical .planning-date-column span,
.planning-board-vertical .planning-date-column strong,
.planning-board-vertical thead th small {
  display: block;
}

.planning-board-vertical .planning-day {
  height: auto;
  min-height: 7rem;
}

.planning-template-panel {
  padding: .85rem 1rem;
  border: 1px solid var(--bs-border-color);
  border-radius: .65rem;
  background: var(--portal-soft);
}
.planning-board .is-weekend { background: color-mix(in srgb, var(--portal-soft) 78%, transparent); }
.planning-board .is-today { box-shadow: inset 0 3px #2563eb; }
.planning-day { position: relative; height: 8.5rem; }
.planning-day.has-conflict { box-shadow: inset 0 0 0 2px #f59e0b; }
.planning-target { display: block; color: var(--portal-muted); margin-bottom: .35rem; }
.planning-holiday { display: block; color: #7c3aed; font-size: .72rem; font-weight: 700; margin-bottom: .3rem; }

.planning-shift {
  display: flex;
  width: 100%;
  margin: 0 0 .35rem;
  padding: .45rem .55rem;
  flex-direction: column;
  align-items: flex-start;
  border: 0;
  border-left: 4px solid #2563eb;
  border-radius: .45rem;
  color: inherit;
  background: color-mix(in srgb, #2563eb 12%, var(--bs-body-bg));
  text-align: left;
  line-height: 1.25;
}

.planning-shift.is-draft {
  border-left-color: #f59e0b;
  background: color-mix(in srgb, #f59e0b 15%, var(--bs-body-bg));
}

.planning-shift small { color: var(--portal-muted); }
.planning-shift:not(:disabled):hover { filter: brightness(.96); }

.planning-add {
  display: grid;
  width: 1.8rem;
  height: 1.8rem;
  margin: .3rem auto 0;
  place-items: center;
  border: 1px dashed var(--bs-border-color);
  border-radius: 50%;
  color: var(--bs-primary);
  background: transparent;
}

.planning-absence {
  display: inline-flex;
  min-width: 1.65rem;
  min-height: 1.65rem;
  margin: 0 .2rem .3rem 0;
  padding: .2rem .35rem;
  align-items: center;
  justify-content: center;
  border-radius: .4rem;
  font-size: .72rem;
  font-weight: 800;
}

.planning-absence.is-approved { color: #166534; background: #dcfce7; }
.planning-absence.is-sick { color: #9f1239; background: #ffe4e6; }
.planning-absence.is-requested { outline: 1px dashed currentColor; opacity: .78; }

html[data-theme="dark"] .planning-absence.is-approved { color: #bbf7d0; background: #143525; }
html[data-theme="dark"] .planning-absence.is-sick { color: #fecdd3; background: #44212b; }

@media (max-width: 767.98px) {
  .planning-board-scroll { max-height: none; }
  .planning-board .planning-person-column { width: 11.5rem; min-width: 11.5rem; }
}
.audit-value {
  max-width: 42rem;
  max-height: 16rem;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  font-size: 0.875rem;
}

.planning-pdf-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.planning-pdf-type {
  display: grid;
  grid-template-columns: auto 2.75rem minmax(0, 1fr);
  align-items: start;
  gap: .8rem;
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--portal-line);
  border-radius: .85rem;
  background: var(--portal-surface);
  cursor: pointer;
}

.planning-pdf-type:has(.form-check-input:checked) {
  border-color: color-mix(in srgb, var(--portal-primary) 55%, var(--portal-line));
  box-shadow: 0 0 0 .18rem color-mix(in srgb, var(--portal-primary) 12%, transparent);
}

.planning-pdf-type .form-check-input {
  margin-top: .7rem;
}

.planning-pdf-type-icon {
  display: inline-grid;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  border-radius: .7rem;
  color: #fff;
  background: linear-gradient(135deg, #dc2626, #f97316);
  font-size: 1.15rem;
}

.planning-pdf-type strong,
.planning-pdf-type small {
  display: block;
}

.planning-pdf-type small {
  margin-top: .25rem;
  color: var(--portal-muted);
  line-height: 1.45;
}

@media (max-width: 575.98px) {
  .planning-pdf-type-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .planning-pdf-type {
    grid-template-columns: auto 2.4rem minmax(0, 1fr);
    padding: .85rem;
  }

  .planning-pdf-type-icon {
    width: 2.4rem;
    height: 2.4rem;
  }
}

/* Projektweite Responsive- und Zoom-Stabilisierung */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

.app-wrapper,
.app-main,
.app-content,
.app-content-header,
.app-content > .container-fluid,
.app-content-header > .container-fluid,
.card,
.card-body,
.card-header,
.card-footer,
.row > * {
  min-width: 0;
  max-width: 100%;
}

/*
 * Viewport-Breakpoints kennen die Breite der Sidebar nicht und reagieren daher
 * bei Betriebssystem-Skalierung zu spät. Die Hauptfläche und jede Karte werden
 * zusätzlich zu Größen-Containern, damit ihre Kinder nach dem wirklich
 * verfügbaren Platz umbrechen.
 */
.app-content > .container-fluid {
  container: portal-content / inline-size;
}

.app-content-header > .container-fluid {
  container: portal-header / inline-size;
}

.card {
  container-type: inline-size;
}

fieldset {
  min-width: 0;
  max-width: 100%;
}

@container portal-content (min-width: 72rem) {
  .adaptive-form-grid:not(.employee-form-layout) {
    grid-template-columns: minmax(44rem, 2fr) minmax(22rem, 1fr);
  }
}

@container portal-content (min-width: 76rem) {
  .adaptive-form-grid.employee-form-layout {
    grid-template-columns: minmax(0, 3fr) minmax(22rem, 1fr);
  }
}

@container portal-header (max-width: 61.99rem) {
  .portal-page-heading,
  .app-content-header > .container-fluid > .d-flex.justify-content-between {
    align-items: stretch !important;
    flex-direction: column !important;
  }

  .app-content-header > .container-fluid > .d-flex.justify-content-between > .btn,
  .app-content-header > .container-fluid > .d-flex.justify-content-between > a,
  .app-content-header > .container-fluid > .d-flex.justify-content-between > form,
  .portal-page-heading-actions,
  .portal-page-heading-actions > * {
    width: 100%;
  }
}

@container portal-content (max-width: 61.99rem) {
  .barcode-debug-grid,
  .vehicle-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .barcode-preview-card,
  .timeline-compose {
    position: static;
    top: auto;
  }

  .vehicle-summary-image {
    min-height: 12rem;
  }
}

@container (max-width: 38rem) {
  .card-body .row > [class*="col-sm-"],
  .card-body .row > [class*="col-md-"],
  .card-body .row > [class*="col-lg-"],
  .card-body .row > [class*="col-xl-"],
  .card-body .row > [class*="col-xxl-"] {
    width: 100%;
    max-width: 100%;
    flex: 0 0 auto;
  }

  .profile-image-editor {
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-image-stage {
    width: min(100%, 16rem);
  }

  .planning-pdf-type-grid,
  .vehicle-facts,
  .database-stat-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .vehicle-summary-title,
  .booking-calendar-header,
  .booking-request,
  .server-metric-heading,
  .timeline-receipt {
    align-items: stretch;
    flex-direction: column;
  }
}

@container (max-width: 24rem) {
  .module-permission-group,
  .module-permission-option {
    padding: .7rem;
  }

  .module-permission-option {
    gap: .5rem;
  }
}

img,
video,
svg {
  max-width: 100%;
  height: auto;
}

canvas:not([data-barcode-canvas]) {
  max-width: 100%;
}

pre,
code,
.audit-value,
.timeline-bubble,
.alert,
.form-text,
.card-title,
.portal-page-heading-main,
.portal-page-heading-main p {
  overflow-wrap: anywhere;
}

.card-header,
.card-footer {
  gap: .75rem;
}

.card-header:has(> .card-title),
.card-header > .d-flex,
.card-footer > .d-flex {
  flex-wrap: wrap;
}

.card-header .card-title {
  float: none;
  min-width: 0;
  margin: 0;
}

.card-header .card-tools {
  min-width: 0;
  margin-left: auto;
}

.input-group,
.input-group > .form-control,
.input-group > .form-select,
.form-control,
.form-select,
textarea {
  min-width: 0;
  max-width: 100%;
}

.form-control[type="file"] {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-responsive,
.booking-calendar-scroll,
.planning-board-scroll {
  max-width: 100%;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.table-responsive[tabindex="0"]:focus-visible,
.booking-calendar-scroll[tabindex="0"]:focus-visible,
.planning-board-scroll[tabindex="0"]:focus-visible {
  outline: .2rem solid color-mix(in srgb, var(--portal-primary) 35%, transparent);
  outline-offset: -.2rem;
}

.is-horizontally-scrollable {
  background:
    linear-gradient(90deg, var(--portal-surface) 30%, transparent) left center / 1.5rem 100% no-repeat local,
    linear-gradient(270deg, var(--portal-surface) 30%, transparent) right center / 1.5rem 100% no-repeat local;
}

.employee-actions,
.booking-actions,
.portal-page-heading-actions,
.planning-toolbar {
  max-width: 100%;
}

.modal-dialog,
.modal-content,
.modal-body {
  min-width: 0;
}

/*
 * Bootstrap blendet den Backdrop normalerweise über die Opacity des gesamten
 * Elements ein. Chromium kann diese Ebene zusammen mit dem gefilterten
 * App-Header deckend schwarz zusammensetzen. Die gleiche Abdunklung wird
 * deshalb über den Alpha-Kanal der Bootstrap-Backdrop-Farbe erzeugt.
 */
.modal-backdrop {
  --bs-backdrop-bg: rgba(15, 23, 42, .32);
  --bs-backdrop-opacity: 1;
  background-color: rgba(15, 23, 42, .32);
}

.modal-backdrop.show {
  opacity: 1;
}

body.modal-open .app-header {
  backdrop-filter: none;
}

/*
 * Die dauerhaft sichtbare Navigation soll beim Öffnen eines Dialogs weder
 * abgedunkelt noch optisch neu zusammengesetzt werden. Sie bleibt deshalb über
 * dem Bootstrap-Backdrop (1050), aber unterhalb des eigentlichen Modals (1055).
 * Klicks bleiben gesperrt, solange der Dialog geöffnet ist.
 */
body.modal-open .app-sidebar {
  z-index: 1051;
  pointer-events: none;
}

@media (max-width: 991.98px) {
  .timeline-compose,
  .barcode-preview-card {
    position: static;
    top: auto;
  }

  .vehicle-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portal-page-heading,
  .app-content-header > .container-fluid > .d-flex.justify-content-between {
    align-items: stretch !important;
    flex-direction: column !important;
  }

  .app-content-header > .container-fluid > .d-flex.justify-content-between > .btn,
  .app-content-header > .container-fluid > .d-flex.justify-content-between > a,
  .app-content-header > .container-fluid > .d-flex.justify-content-between > form {
    align-self: stretch;
  }
}

@media (max-width: 767.98px) {
  .app-content-header {
    padding-top: 1rem;
  }

  .app-content-header > .container-fluid,
  .app-content > .container-fluid,
  .portal-breadcrumb-bar > .container-fluid {
    padding-right: .75rem;
    padding-left: .75rem;
  }

  .app-content-header h1,
  .portal-page-heading-main h1 {
    font-size: clamp(1.45rem, 7vw, 2rem);
    line-height: 1.15;
  }

  .portal-breadcrumb {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: .15rem;
    scrollbar-width: thin;
    white-space: nowrap;
  }

  .portal-breadcrumb .breadcrumb-item {
    flex: 0 0 auto;
  }

  .portal-breadcrumb .breadcrumb-item.active {
    max-width: 70vw;
  }

  .card,
  .employee-panel,
  .employee-form-card,
  .vehicle-summary,
  .timeline-compose {
    border-radius: .75rem;
  }

  .card-body,
  .employee-panel .card-body,
  .employee-form-card .card-body {
    padding: 1rem;
  }

  .card-header,
  .card-footer,
  .employee-form-card .card-header,
  .employee-form-card .card-footer {
    padding: .85rem 1rem;
  }

  .card-header .card-tools,
  .card-header .card-tools .btn-group,
  .card-header .card-tools form {
    width: 100%;
    margin-left: 0;
  }

  .form-control,
  .form-select,
  textarea,
  .input-group-text,
  .btn {
    font-size: 1rem;
  }

  .form-control,
  .form-select,
  textarea {
    font-size: 16px;
  }

  .btn:not(.btn-close),
  .form-control,
  .form-select,
  .input-group-text {
    min-height: 2.75rem;
  }

  .btn-sm:not(.btn-close) {
    min-height: 2.5rem;
    padding: .45rem .65rem;
  }

  .form-check-input {
    width: 1.25rem;
    height: 1.25rem;
  }

  .form-switch .form-check-input {
    width: 2.5rem;
  }

  .table-responsive {
    border-radius: .65rem;
  }

  .employee-table thead th,
  .employee-table tbody td,
  .table > :not(caption) > * > * {
    padding: .7rem .75rem;
  }

  .employee-identity {
    min-width: 11rem;
  }

  .employee-actions {
    gap: .3rem;
  }

  .employee-actions .btn {
    display: inline-grid;
    min-width: 2.5rem;
    place-items: center;
  }

  .searchable-select-menu,
  .multi-search-select-menu {
    position: static;
    width: 100%;
    max-width: 100%;
    margin-top: .35rem;
    box-shadow: 0 .4rem 1rem rgb(15 23 42 / 12%);
  }

  .searchable-select-options,
  .multi-search-select-options {
    max-height: min(18rem, 45dvh);
  }

  .booking-calendar-header,
  .booking-request,
  .server-metric-heading,
  .vehicle-summary-title,
  .timeline-receipt {
    align-items: stretch;
    flex-direction: column;
  }

  .booking-calendar-header {
    gap: .75rem;
  }

  .booking-calendar-header .btn,
  .booking-actions,
  .booking-actions form,
  .booking-actions .btn,
  .portal-page-heading-actions > *,
  .portal-page-heading-actions .btn {
    width: 100%;
  }

  .vehicle-facts,
  .database-stat-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .timeline-receipt small {
    margin-left: 0;
    white-space: normal;
  }

  .timeline-message {
    grid-template-columns: 2.35rem minmax(0, 1fr);
    gap: .6rem;
  }

  .vehicle-timeline {
    padding-left: .25rem;
  }

  .vehicle-timeline::before {
    left: 1.1rem;
  }

  .timeline-marker {
    width: 2.25rem;
    height: 2.25rem;
    border-width: .2rem;
  }

  .timeline-bubble {
    padding: .9rem;
  }

  .modal-dialog {
    margin: .5rem;
  }

  .modal-content {
    max-height: calc(100dvh - 1rem);
  }

  .modal-body {
    overflow-y: auto;
  }

  .modal-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .modal-footer > *,
  .modal-footer .btn {
    width: 100%;
    margin: 0;
  }

  .planning-toolbar > *,
  .planning-toolbar form,
  .planning-toolbar .btn,
  .planning-toolbar .form-select {
    width: 100%;
  }
}

@media (max-width: 575.98px) {
  .card-body > *,
  .card-footer > *,
  .profile-image-editor,
  .profile-image-fields,
  .crop-controls,
  .booking-license-evidence,
  .booking-license-previews {
    min-width: 0;
    max-width: 100%;
  }

  .form-control[type="file"] {
    height: auto;
    min-height: 0;
    padding: .4rem;
    line-height: 1.35;
    white-space: normal;
  }

  .form-control[type="file"]::file-selector-button {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 2.65rem;
    margin: 0 0 .4rem;
    padding: .55rem .7rem;
    overflow: hidden;
    border: 0;
    border-radius: .5rem;
    text-overflow: ellipsis;
    white-space: normal;
  }

  .profile-image-editor {
    gap: 1rem;
    padding: .85rem;
  }

  .crop-controls .d-flex {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto;
    max-width: 100%;
  }

  .crop-controls .form-range {
    min-width: 0;
    width: 100%;
  }

  .crop-controls .btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .booking-license-previews a {
    width: min(100%, 7.5rem);
  }

  .portal-login {
    min-height: 100dvh;
    padding: 1rem;
  }

  .portal-login .login-box {
    width: 100%;
    gap: 1rem;
  }

  .brand-mark {
    width: 3.25rem;
    height: 3.25rem;
    margin-bottom: 1rem;
    border-radius: 1rem;
    font-size: 1.45rem;
  }

  .brand-panel h1 {
    margin-bottom: .25rem;
    font-size: clamp(2rem, 11vw, 2.4rem);
  }

  .login-card-body {
    padding: 1.25rem;
  }

  .app-header .container-fluid {
    flex-wrap: nowrap;
    gap: .35rem;
  }

  .app-header .navbar-nav,
  .app-header .navbar-nav.ms-auto {
    min-width: 0;
    flex-wrap: nowrap;
  }

  .app-header .navbar-nav.ms-auto {
    flex: 0 1 auto;
  }

  .app-header .navbar-nav.ms-auto .btn {
    white-space: nowrap;
  }

  .app-header form[action*="logout"] .btn {
    width: 2.65rem;
    padding-right: 0;
    padding-left: 0;
    overflow: hidden;
    font-size: 0;
  }

  .app-header form[action*="logout"] .btn i {
    margin: 0 !important;
    font-size: 1rem;
  }

  .welcome-card {
    min-height: 13rem;
    padding: 1.35rem;
  }

  .welcome-card h2 {
    font-size: clamp(1.75rem, 10vw, 2.4rem);
  }

  .timeline-images {
    grid-template-columns: minmax(0, 1fr);
  }

  .multi-search-chip {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .multi-search-chip-icon {
    display: none;
  }

  .server-metric-facts,
  .server-disk-values {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-height: 650px) and (max-width: 991.98px) {
  .portal-login {
    align-items: flex-start !important;
  }

  .brand-copy {
    display: none;
  }
}

/* Mobile Sidebar: ein zusammenhängender, gut bedienbarer Touch-Bereich. */
.sidebar-mobile-close {
  display: inline-grid;
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 2.75rem;
  place-items: center;
  margin-right: .45rem;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: .75rem;
  color: #fff;
  background: rgb(255 255 255 / 8%);
  font-size: 1.1rem;
  line-height: 1;
}

.sidebar-mobile-close:hover,
.sidebar-mobile-close:focus-visible {
  color: #fff;
  background: rgb(255 255 255 / 16%);
}

@media (max-width: 991.98px) {
  body.sidebar-open {
    overflow: hidden;
  }

  .app-sidebar {
    height: 100dvh;
    max-height: 100dvh;
  }

  .app-sidebar .sidebar-brand {
    display: flex;
    min-height: 4rem;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
  }

  .app-sidebar .brand-link {
    min-width: 0;
    flex: 1 1 auto;
  }

  .app-sidebar .brand-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar-wrapper-with-footer-menu {
    display: block;
    height: calc(100dvh - 4rem);
    max-height: calc(100dvh - 4rem);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
  }

  .sidebar-wrapper-with-footer-menu > nav {
    overflow: visible;
  }

  .sidebar-footer-menu {
    margin-top: 1rem;
  }

  .sidebar-wrapper-with-footer-menu .tenant-chip {
    margin-bottom: max(1rem, env(safe-area-inset-bottom));
  }

  .app-sidebar .nav-link {
    min-height: 3rem;
    align-items: center;
    padding-top: .65rem;
    padding-bottom: .65rem;
    touch-action: manipulation;
  }

  .app-sidebar .nav-link > p {
    min-width: 0;
    line-height: 1.25;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .app-sidebar .nav-arrow {
    margin-left: auto;
  }

  body.sidebar-open .sidebar-overlay {
    position: fixed !important;
    inset: 0 !important;
    width: auto !important;
    height: auto !important;
    min-height: 100dvh;
    touch-action: manipulation;
  }

  body:not(.sidebar-open) .sidebar-overlay {
    position: static !important;
    inset: auto !important;
    width: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    pointer-events: none !important;
  }
}
