:root {
  --lf-yellow: #fbba00;
  --lf-charcoal: #4a4a49;
  --lf-ink: #1a1a1a;
  --lf-muted: #6b767b;
  --lf-surface: #ffffff;
  --lf-surface-subtle: #f9f9f9;
  --lf-ok: #21ce1a;
  --lf-error: #e62322;
  --lf-radius: 2px;
  --lf-font: "Source Sans 3", "Segoe UI", sans-serif;
  --lf-transition: 180ms ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: var(--lf-font);
  color: var(--lf-charcoal);
  background: var(--lf-surface);
  line-height: 1.45;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--lf-charcoal);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--lf-ink);
}

:focus-visible {
  outline: 2px solid var(--lf-charcoal);
  outline-offset: 2px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid #e6e6e6;
  background: var(--lf-surface);
  position: sticky;
  top: 0;
  /* Above Leaflet panes/controls (up to ~1000) so map popups never cover nav */
  z-index: 1100;
  transition: box-shadow var(--lf-transition);
}

.site-header.is-scrolled {
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: clamp(7.5rem, 14vw, 10rem);
  height: auto;
  flex-shrink: 0;
}

.brand-app {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.1rem;
  min-width: 0;
  padding-left: 0.85rem;
  border-left: 1px solid #e0e0e0;
}

.brand-app strong {
  color: var(--lf-ink);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.brand-app small {
  color: var(--lf-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-toggle {
  display: none;
  background: transparent;
  border: 0;
  padding: 0.35rem;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 1.4rem;
  height: 2px;
  background: var(--lf-yellow);
  margin: 4px 0;
  transition: transform var(--lf-transition);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-nav a {
  text-decoration: none;
  font-weight: 600;
  padding: 0.35rem 0.15rem;
  border-bottom: 2px solid transparent;
  transition: border-color var(--lf-transition), color var(--lf-transition);
}

.site-nav a.is-active,
.site-nav a:hover {
  border-bottom-color: var(--lf-yellow);
}

.account-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.account-switch__select.select {
  min-width: 0;
  width: min(14rem, 70vw);
  max-width: 100%;
  padding: 0.35rem 0.6rem;
}

.link-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.link-list__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.6rem 0;
  border-bottom: 1px solid #e6e6e6;
}

.link-add {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
}

.link-add [data-firma-select] {
  flex: 1 1 16rem;
  min-width: 0;
}

.main {
  flex: 1;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
}

.page-title {
  margin: 0 0 0.35rem;
  color: var(--lf-ink);
  font-size: clamp(1.4rem, 2vw, 1.85rem);
  font-weight: 700;
}

.page-title--with-icon {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.page-title--with-icon .icon {
  color: var(--lf-charcoal);
  flex-shrink: 0;
}

.page-lead {
  margin: 0 0 1.25rem;
  color: var(--lf-muted);
  max-width: 42rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: center;
}

.input,
.select,
.textarea {
  border: 1px solid #cfcfcf;
  background: var(--lf-surface);
  color: var(--lf-charcoal);
  padding: 0.55rem 0.7rem;
  border-radius: var(--lf-radius);
  font: inherit;
  min-width: 12rem;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--lf-radius);
  padding: 0.55rem 0.95rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--lf-transition), color var(--lf-transition), border-color var(--lf-transition);
}

.btn-primary {
  background: var(--lf-yellow);
  color: var(--lf-ink);
}

.btn-primary:hover {
  background: #e5aa00;
}

.btn-dark {
  background: var(--lf-charcoal);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  border-color: #cfcfcf;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
}

.btn-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-with-icon .icon {
  flex-shrink: 0;
}

/* Brand icons */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  color: currentColor;
  vertical-align: middle;
  line-height: 0;
}

.icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.icon--sm {
  width: 1rem;
  height: 1rem;
}

.icon--lg {
  width: 1.75rem;
  height: 1.75rem;
}

.icon--xl {
  width: 2.25rem;
  height: 2.25rem;
}

.dash-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.15rem;
  border: 1px solid #e6e6e6;
  background: var(--lf-surface-subtle);
  color: var(--lf-charcoal);
}

.dash-card__icon .icon {
  width: 1.35rem;
  height: 1.35rem;
}

.dash-card:hover .dash-card__icon {
  border-color: var(--lf-charcoal);
  background: var(--lf-yellow);
  color: var(--lf-ink);
}

.client-table__avatar .icon {
  width: 1rem;
  height: 1rem;
}

/* —— Client index list —— */
.client-index-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
}

.client-index-meta {
  margin: 0;
  color: var(--lf-muted);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

.client-search {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 1.15rem;
}

.client-search__field {
  position: relative;
  flex: 1 1 18rem;
  min-width: 0;
  display: flex;
  align-items: center;
}

.client-search__icon {
  position: absolute;
  left: 0.75rem;
  color: var(--lf-muted);
  display: inline-flex;
  pointer-events: none;
}

.client-search__input {
  width: 100%;
  border: 1px solid #cfcfcf;
  background: var(--lf-surface);
  color: var(--lf-charcoal);
  padding: 0.65rem 0.85rem 0.65rem 2.35rem;
  border-radius: var(--lf-radius);
  font: inherit;
  transition: border-color var(--lf-transition), box-shadow var(--lf-transition);
}

.client-search__input:focus {
  outline: none;
  border-color: var(--lf-charcoal);
  box-shadow: 0 0 0 2px rgba(251, 186, 0, 0.35);
}

.client-table-panel {
  border: 1px solid #e6e6e6;
  background: var(--lf-surface);
}

.client-table-wrap {
  border: 0;
}

.client-table {
  min-width: 720px;
}

.client-table th {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #e6e6e6;
}

.client-table td {
  padding: 0.85rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid #f0f0f0;
}

.client-table__row {
  transition: background var(--lf-transition);
}

.client-table__row:hover {
  background: var(--lf-surface-subtle);
}

.client-table__name {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--lf-ink);
  font-weight: 700;
  text-decoration: none;
  min-width: 0;
}

.client-table__name:hover {
  color: var(--lf-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.client-table__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  color: var(--lf-charcoal);
  background: rgba(251, 186, 0, 0.18);
  border-left: 3px solid var(--lf-yellow);
}

.client-table__id {
  display: inline-block;
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  font-size: 0.88rem;
  color: var(--lf-charcoal);
  background: var(--lf-surface-subtle);
  padding: 0.2rem 0.45rem;
  border-radius: var(--lf-radius);
}

.client-table__address {
  display: block;
  max-width: 22rem;
  color: var(--lf-charcoal);
  line-height: 1.35;
}

.client-table__actions {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

.client-table__actions .btn + .btn {
  margin-left: 0.35rem;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid #e6e6e6;
  background: var(--lf-surface-subtle);
}

.pager--top {
  margin-bottom: 0.75rem;
}

.pager__info {
  color: var(--lf-muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.pager__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.pager__btn,
.pager__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  min-height: 2.1rem;
  padding: 0.3rem 0.55rem;
  border: 1px solid #d8d8d8;
  background: var(--lf-surface);
  color: var(--lf-charcoal);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--lf-radius);
}

.pager__btn:hover,
.pager__num:hover {
  border-color: var(--lf-charcoal);
  color: var(--lf-ink);
}

.pager__num.is-active {
  background: var(--lf-yellow);
  border-color: var(--lf-yellow);
  color: var(--lf-ink);
}

.pager__btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.pager__ellipsis {
  color: var(--lf-muted);
  padding: 0 0.15rem;
}

.pager__size label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--lf-muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.pager__select {
  min-width: 4.5rem;
  padding: 0.35rem 1.8rem 0.35rem 0.55rem;
}

@media (max-width: 720px) {
  .client-index-header {
    align-items: flex-start;
  }

  .client-search {
    flex-direction: column;
    align-items: stretch;
  }

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

  .pager__controls {
    justify-content: center;
  }

  .pager__size {
    display: flex;
    justify-content: center;
  }
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid #ebebeb;
  background: var(--lf-surface);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

table.data th,
table.data td {
  text-align: left;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}

table.data th {
  background: var(--lf-surface-subtle);
  color: var(--lf-muted);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.status-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  margin-right: 0.35rem;
}

.status-ok { background: var(--lf-ok); }
.status-warn { background: var(--lf-yellow); }
.status-error { background: var(--lf-error); }

.flash {
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-left: 4px solid var(--lf-yellow);
  background: var(--lf-surface-subtle);
  animation: toast-in var(--lf-transition);
}

.flash-error {
  border-left-color: var(--lf-error);
}

.flash-success {
  border-left-color: var(--lf-ok);
}

.interaction-card {
  border: 1px solid #e6e6e6;
  background: var(--lf-surface);
  padding: 1.35rem 1.5rem;
  max-width: 44rem;
}

.page-header {
  margin-bottom: 1.25rem;
}

.section-title {
  margin: 0 0 0.85rem;
  color: var(--lf-ink);
  font-size: 1.15rem;
  font-weight: 700;
}

.invite-card {
  margin-bottom: 0;
}

.access-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 1.25rem;
  padding: 0.35rem;
  border: 1px solid #ebebeb;
  background: var(--lf-surface-subtle, #f9f9f9);
}

.access-tabs__tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 0.95rem;
  text-decoration: none;
  color: var(--lf-charcoal);
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
}

.access-tabs__tab:hover {
  color: var(--lf-ink);
  background: var(--lf-surface, #fff);
}

.access-tabs__tab.is-active {
  color: var(--lf-ink);
  background: var(--lf-surface, #fff);
  border-color: #e0e0e0;
  box-shadow: inset 0 -3px 0 var(--lf-yellow);
}

.access-tabs__badge {
  display: inline-block;
  margin-left: 0.15rem;
  padding: 0.1rem 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--lf-yellow);
  color: var(--lf-ink);
}

.access-tab-panel {
  display: grid;
  gap: 1rem;
}

.access-tab-intro {
  margin-bottom: 0;
}

.access-content-split {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(0, 1.2fr);
  gap: 1rem;
  align-items: start;
}

.access-content-split__aside,
.access-content-split__main {
  min-width: 0;
  display: grid;
  gap: 1rem;
}

.access-stat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.access-stat-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid #eee;
}

.access-stat-list li:last-child {
  border-bottom: 0;
}

.access-stat-list__label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--lf-muted);
  font-size: 0.88rem;
}

.access-stat-list strong {
  font-size: 1.15rem;
  color: var(--lf-ink);
}

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

.access-info__card {
  border: 1px solid #ebebeb;
  background: var(--lf-surface-subtle, #f9f9f9);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.access-info__card p {
  margin: 0;
  color: var(--lf-charcoal);
  font-size: 0.92rem;
  line-height: 1.45;
  flex: 1;
}

.access-info__title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-size: 1rem;
  color: var(--lf-ink);
}

.access-info__card .btn {
  align-self: flex-start;
}

.service-nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.service-nav > li {
  border-bottom: 1px solid #eee;
}

.service-nav > li:last-child {
  border-bottom: 0;
}

.service-nav__link {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 0.35rem;
  text-decoration: none;
  color: inherit;
  border-left: 3px solid transparent;
}

.service-nav__link:hover {
  background: var(--lf-surface-subtle, #f9f9f9);
}

.service-nav__link.is-active {
  background: linear-gradient(90deg, rgba(251, 186, 0, 0.12), transparent);
  border-left-color: var(--lf-yellow);
  padding-left: 0.5rem;
}

.service-nav__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.service-nav__title {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.92rem;
  color: var(--lf-charcoal);
}

.service-contacts__detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.service-contacts__meta {
  display: grid;
  gap: 0.75rem;
  margin: 0 0 1.25rem;
  padding: 0 0 1rem;
  border-bottom: 1px solid #eee;
}

.service-contacts__meta dt {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--lf-muted);
}

.service-contacts__meta dd {
  margin: 0.2rem 0 0;
  color: var(--lf-ink);
}

.service-contacts__item-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

@media (max-width: 960px) {
  .access-content-split {
    grid-template-columns: 1fr;
  }

  .access-info__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .access-tabs__tab {
    font-size: 0.85rem;
  }
}

.service-contacts {
  margin-bottom: 0;
}

.service-contacts__table {
  margin: 1rem 0 1.25rem;
}

.service-contacts__toggle {
  display: inline;
  margin: 0;
}

.service-contacts__pill-btn {
  cursor: pointer;
  border: 0;
  font: inherit;
}

.service-contacts__edit {
  display: inline-block;
}

.service-contacts__edit > summary {
  list-style: none;
  cursor: pointer;
}

.service-contacts__edit > summary::-webkit-details-marker {
  display: none;
}

.service-contacts__edit-panel {
  margin-top: 0.75rem;
  padding: 0.85rem;
  border: 1px solid #ebebeb;
  background: var(--lf-surface-subtle, #f9f9f9);
  min-width: min(100%, 22rem);
}

.service-contacts__add-title {
  margin: 1.25rem 0 0.75rem;
  font-size: 1rem;
  color: var(--lf-ink);
}

.service-contacts__check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  cursor: pointer;
}

.service-contacts__check input {
  width: auto;
  margin: 0;
}

.ticket-service-contacts {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #eee;
}

.ticket-service-contacts__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.ticket-service-contacts__list li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.ticket-service-contacts__list a {
  color: inherit;
}

.invite-list {
  max-width: 100%;
}

.invite-list__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

/* —— App forms (stacked, responsive) —— */
.app-form {
  display: block;
}

.app-form__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
}

.app-form__field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.app-form__field--full {
  grid-column: 1 / -1;
}

.app-form label,
.app-form .form-label {
  display: block;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--lf-ink);
  line-height: 1.3;
}

.app-form label .required,
.app-form .required::after {
  content: none;
}

.app-form .input,
.app-form .select,
.app-form .textarea,
.app-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not(.firma-select__input),
.app-form select,
.app-form textarea {
  display: block;
  width: 100%;
  min-width: 0;
  border: 1px solid #cfcfcf;
  background: var(--lf-surface);
  color: var(--lf-charcoal);
  padding: 0.65rem 0.8rem;
  border-radius: var(--lf-radius);
  font: inherit;
  line-height: 1.35;
  transition: border-color var(--lf-transition), box-shadow var(--lf-transition);
}

.app-form .input:focus,
.app-form .select:focus,
.app-form .textarea:focus,
.app-form input:not(.firma-select__input):focus,
.app-form select:focus,
.app-form textarea:focus {
  outline: none;
  border-color: var(--lf-charcoal);
  box-shadow: 0 0 0 2px rgba(251, 186, 0, 0.35);
}

.app-form select,
.app-form .select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%234a4a49' d='M1.4.6 6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 0.7rem;
  padding-right: 2.25rem;
  cursor: pointer;
}

.app-form__actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.35rem;
  padding-top: 1.1rem;
  border-top: 1px solid #eee;
}

.app-form ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.app-form .form-error,
.app-form ul li {
  color: var(--lf-error);
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

.table-empty {
  color: var(--lf-muted);
  text-align: center;
  padding: 1.5rem 0.8rem !important;
}

@media (max-width: 640px) {
  .app-form__grid {
    grid-template-columns: 1fr;
  }

  .interaction-card {
    padding: 1.1rem 1rem;
  }

  .app-form__actions {
    justify-content: stretch;
  }

  .app-form__actions .btn {
    width: 100%;
  }
}

/* —— Dashboard —— */
.dash-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.dash-kicker {
  margin: 0 0 0.35rem;
  color: var(--lf-muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dash-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.65rem;
  border: 1px solid #e0e0e0;
  background: var(--lf-surface-subtle);
  color: var(--lf-charcoal);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.dash-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.dash-stats--client {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.client-picker {
  margin-bottom: 1.5rem;
}

/* —— Firma searchable select —— */
.firma-select-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: stretch;
}

.firma-select {
  position: relative;
  flex: 1 1 18rem;
  min-width: 0;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0.4rem 0.2rem 0.55rem;
  border: 1px solid #cfcfcf;
  background: var(--lf-surface);
  border-radius: var(--lf-radius);
  transition: border-color var(--lf-transition), box-shadow var(--lf-transition);
}

/* Invite form: do not let .app-form input rules inflate the combobox */
.app-form .firma-select .firma-select__input,
.app-form .invite-firma-select .firma-select__input {
  display: block;
  flex: 1 1 auto;
  width: auto !important;
  min-width: 0;
  margin: 0;
  padding: 0.4rem 0;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  line-height: 1.35;
}

.app-form .firma-select .firma-select__input:focus,
.app-form .invite-firma-select .firma-select__input:focus {
  border: 0 !important;
  box-shadow: none !important;
}

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

.firma-select.is-open,
.firma-select:focus-within {
  border-color: var(--lf-charcoal);
  box-shadow: 0 0 0 2px rgba(251, 186, 0, 0.35);
}

.firma-select__lead-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  flex-shrink: 0;
  color: var(--lf-charcoal);
  background: var(--lf-surface-subtle);
  border-left: 3px solid var(--lf-yellow);
}

.firma-select.has-value .firma-select__lead-icon {
  background: rgba(251, 186, 0, 0.18);
}

.firma-select__input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--lf-ink);
  padding: 0.35rem 0;
  outline: none;
}

.firma-select__input::-webkit-search-cancel-button {
  appearance: none;
}

.firma-select__input::placeholder {
  color: var(--lf-muted);
}

.firma-select__chevron {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--lf-muted);
  padding: 0.25rem 0.45rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.firma-select.is-open .firma-select__chevron {
  color: var(--lf-ink);
  transform: rotate(180deg);
}

.firma-select__list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 30;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  max-height: min(22rem, 55vh);
  overflow: auto;
  background: var(--lf-surface);
  border: 1px solid #e0e0e0;
  box-shadow: 0 10px 28px rgba(26, 26, 26, 0.12);
}

.firma-select__option {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.65rem 0.7rem;
  cursor: pointer;
  font: inherit;
  color: var(--lf-charcoal);
  transition: background var(--lf-transition);
}

.firma-select__option:hover,
.firma-select__option.is-active {
  background: var(--lf-surface-subtle);
}

.firma-select__option.is-active {
  box-shadow: inset 3px 0 0 var(--lf-yellow);
}

.firma-select__option-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  color: var(--lf-charcoal);
  background: #f3f3f3;
  border-radius: var(--lf-radius);
}

.firma-select__option.is-active .firma-select__option-icon,
.firma-select__option:hover .firma-select__option-icon {
  background: rgba(251, 186, 0, 0.22);
}

.firma-select__option-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.firma-select__option-text strong {
  color: var(--lf-ink);
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.firma-select__option-text small {
  color: var(--lf-muted);
  font-size: 0.8rem;
}

.firma-select__more,
.firma-select__empty {
  margin: 0;
  padding: 0.65rem 0.75rem;
  color: var(--lf-muted);
  font-size: 0.85rem;
}

.firma-select__empty {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 30;
  background: var(--lf-surface);
  border: 1px solid #e0e0e0;
}

.firma-select__status {
  margin: 0.35rem 0 0;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.3;
}

.invite-firma-select {
  width: 100%;
  max-width: 100%;
}

.firma-select-form__go {
  flex: 0 0 auto;
  align-self: stretch;
  padding-inline: 1.25rem;
}

@media (max-width: 640px) {
  .firma-select-form {
    flex-direction: column;
  }

  .firma-select-form__go {
    width: 100%;
  }
}

.client-layout {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.client-profile {
  margin-bottom: 1rem;
}

.client-profile__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem 1.5rem;
}

.client-profile__label {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--lf-muted);
}

.client-profile__value {
  margin: 0;
  color: var(--lf-ink);
  font-size: 1rem;
  line-height: 1.4;
}

.client-profile__meta {
  margin: 0.35rem 0 0;
  color: var(--lf-muted);
  font-size: 0.9rem;
}

.client-profile__contacts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.client-profile__contacts li {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 0.5rem;
  align-items: baseline;
  min-width: 0;
}

.client-profile__key {
  color: var(--lf-muted);
  font-size: 0.85rem;
}

.client-profile__contacts a,
.client-profile__contacts span:not(.client-profile__key) {
  color: var(--lf-ink);
  overflow-wrap: anywhere;
}

.client-profile__contacts a:hover {
  color: var(--lf-charcoal);
}

.client-map {
  height: min(420px, 55vh);
  width: 100%;
  background: #eef0f2;
  border: 1px solid #e6e6e6;
  position: relative;
  z-index: 0;
  isolation: isolate;
}

.map-pin {
  background: transparent !important;
  border: 0 !important;
}

.map-pin__dot {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--pin-color, #21ce1a);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(26, 26, 26, 0.35);
  color: #1a1a1a;
  font-weight: 700;
  font-size: 0.8rem;
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
}

.map-pin__count {
  line-height: 1;
}

.map-popup__head {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 0.55rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid #eee;
}

.map-popup__head strong {
  color: #1a1a1a;
  font-size: 0.95rem;
}

.map-popup__head span {
  color: #6b767b;
  font-size: 0.82rem;
}

.map-popup__list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 12rem;
  overflow: auto;
}

.map-popup__list li + li {
  margin-top: 0.35rem;
}

.map-popup__list a {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  text-decoration: none;
  color: #4a4a49;
}

.map-popup__list a:hover strong {
  text-decoration: underline;
}

.map-popup__list small {
  color: #6b767b;
  font-size: 0.78rem;
}

.client-anlage-list {
  max-height: min(420px, 55vh);
  overflow: auto;
}

.dash-stat {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.15rem 0.85rem;
  align-items: center;
  background: var(--lf-surface-subtle);
  border-left: 3px solid var(--lf-charcoal);
  padding: 0.9rem 1rem;
}

.dash-stat__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  grid-row: 1 / span 2;
  border: 1px solid #e6e6e6;
  background: #fff;
  color: var(--lf-charcoal);
}

.dash-stat__icon .icon {
  width: 1.2rem;
  height: 1.2rem;
}

.dash-stat--warn {
  border-left-color: var(--lf-yellow);
}

.dash-stat--warn .dash-stat__icon {
  border-color: var(--lf-yellow);
  background: #fff8e6;
}

.dash-stat--error {
  border-left-color: var(--lf-error);
}

.dash-stat__value {
  display: block;
  grid-column: 2;
  color: var(--lf-ink);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
}

.dash-stat__label {
  grid-column: 2;
  color: var(--lf-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.dash-section-title {
  margin: 0 0 0.85rem;
  color: var(--lf-ink);
  font-size: 1.05rem;
  font-weight: 700;
}

.dash-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.dash-actions--compact {
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}

.dash-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
  min-height: 10.5rem;
  padding: 1.25rem 1.3rem;
  border: 1px solid #e6e6e6;
  border-top: 3px solid var(--lf-yellow);
  background: var(--lf-surface);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--lf-transition), transform 160ms ease, box-shadow 160ms ease;
}

.dash-card:hover {
  border-color: var(--lf-charcoal);
  border-top-color: var(--lf-yellow);
  color: inherit;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(26, 26, 26, 0.08);
}

.dash-card__eyebrow {
  display: block;
  color: var(--lf-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.dash-card__title {
  display: block;
  color: var(--lf-ink);
  font-size: 1.15rem;
  line-height: 1.25;
}

.dash-card__text {
  display: block;
  margin: 0;
  color: var(--lf-muted);
  font-size: 0.92rem;
  line-height: 1.45;
  flex: 1;
}

.dash-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: auto;
  padding-top: 0.5rem;
  color: var(--lf-charcoal);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.access-dash-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1.25rem;
}

.access-firma-strip {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.access-firma-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid #e6e6e6;
  background: var(--lf-surface-subtle);
}

.access-firma-chip strong {
  display: block;
  color: var(--lf-ink);
}

.access-panel .pill {
  margin: 0.1rem 0.2rem 0.1rem 0;
}

.invite-list {
  margin-top: 1.5rem;
}

tr.is-muted td {
  opacity: 0.65;
}

@media (max-width: 900px) {
  .access-dash-grid {
    grid-template-columns: 1fr;
  }
}

.invite-recent {
  list-style: none;
  margin: 0;
  padding: 0;
}

.invite-recent li + li {
  border-top: 1px solid #eee;
}

.invite-recent__link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.75rem 0;
  text-decoration: none;
  color: inherit;
}

.invite-recent__link:hover strong {
  text-decoration: underline;
}

.invite-recent__main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.invite-recent__meta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--lf-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.invite-filters {
  align-items: stretch;
}

.invite-filters__select,
.invite-filter-firma {
  min-width: min(100%, 14rem);
}

.invite-filter-firma {
  flex: 1 1 14rem;
}

.invite-error {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--lf-error);
  background: #fff5f5;
}

.invite-error p {
  margin: 0.35rem 0 0;
  color: var(--lf-charcoal);
  overflow-wrap: anywhere;
}

.invite-audit__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.invite-audit {
  list-style: none;
  margin: 0;
  padding: 0;
}

.invite-audit__item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #eee;
}

.invite-audit__item:last-child {
  border-bottom: 0;
}

.invite-audit__body {
  min-width: 0;
  flex: 1 1 14rem;
}

.invite-audit__title {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.invite-audit__context {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.invite-audit__open {
  flex: 0 0 auto;
  align-self: center;
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border: 1px solid #d0d0d0;
  border-radius: var(--lf-radius);
  background: var(--lf-surface);
  color: var(--lf-ink);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.invite-audit__open:hover {
  border-color: var(--lf-charcoal);
  background: var(--lf-surface-subtle);
}

.client-table .client-table__address {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.access-firma-chip__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.page-header__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill--ok {
  background: #e8f8e7;
  color: #1a6b16;
}

.pill--error {
  background: #fde8e8;
  color: #a11b1a;
}

.pill--warn {
  background: #fff4d6;
  color: #7a5a00;
}

.client-table__address {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dash-split {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
  align-items: start;
}

.dash-panel {
  border: 1px solid #ebebeb;
  background: var(--lf-surface);
  padding: 1rem;
}

.dash-panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.dash-panel__head h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--lf-ink);
}

.dash-panel__head a {
  font-size: 0.85rem;
  font-weight: 700;
}

.dash-queue {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dash-queue li {
  border-bottom: 1px solid #eee;
}

.dash-queue li:last-child {
  border-bottom: 0;
}

.dash-queue a {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.7rem 0;
  text-decoration: none;
}

.dash-queue a:hover strong {
  color: var(--lf-ink);
}

.dash-queue strong {
  color: var(--lf-charcoal);
  font-size: 0.95rem;
}

.dash-queue span {
  color: var(--lf-muted);
  font-size: 0.82rem;
}

.dash-queue__empty {
  padding: 0.75rem 0;
  color: var(--lf-muted);
  font-size: 0.9rem;
}

.pill {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: var(--lf-surface-subtle);
  color: var(--lf-charcoal);
}

.pill--ok {
  border-left: 3px solid var(--lf-ok);
}

.pill--warn {
  border-left: 3px solid var(--lf-yellow);
}

.pill--error {
  border-left: 3px solid var(--lf-error);
}

.pill--muted {
  border-left: 3px solid var(--lf-muted);
}

.muted-line {
  color: var(--lf-muted);
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

.ticket-workspace {
  display: grid;
  grid-template-columns: minmax(260px, 380px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.ticket-workspace__history {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 8rem);
  overflow: auto;
}

.ticket-workspace__switcher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
}

.ticket-workspace__switcher-label {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--lf-muted);
}

.ticket-workspace__switcher-select {
  flex: 1 1 12rem;
  min-width: 0;
  max-width: 28rem;
}

.ticket-workspace__empty {
  min-height: 12rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.ticket-history {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ticket-history__item {
  border-bottom: 1px solid #eee;
}

.ticket-history__item:last-child {
  border-bottom: 0;
}

.ticket-history__link {
  display: block;
  padding: 0.75rem 0;
  text-decoration: none;
  color: inherit;
}

.ticket-history__link:hover .ticket-history__subject {
  color: var(--lf-ink);
}

.ticket-history__item--active .ticket-history__link {
  background: linear-gradient(90deg, rgba(251, 186, 0, 0.12), transparent);
  margin: 0 -0.5rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  border-left: 3px solid var(--lf-yellow);
}

.ticket-history__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.ticket-history__subject {
  font-size: 0.92rem;
  color: var(--lf-charcoal);
  line-height: 1.35;
}

.ticket-history__meta {
  display: block;
  margin-top: 0.25rem;
  color: var(--lf-muted);
  font-size: 0.8rem;
}

.ticket-history__new {
  margin-top: 0.75rem;
  width: 100%;
}

.ticket-history__reply {
  display: inline-flex;
  margin: 0 0 0.65rem;
}

.ticket-detail__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.ticket-detail__head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.ticket-detail__label {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--lf-muted);
}

.ticket-detail__description {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #eee;
}

.ticket-detail__description p {
  margin: 0;
  line-height: 1.5;
}

.ticket-detail__message {
  border-top: 1px solid #eee;
  padding: 0.75rem 0;
}

.ticket-detail__message p {
  margin: 0.35rem 0 0;
  line-height: 1.45;
}

.ticket-detail__reply {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

@media (max-width: 960px) {
  .dash-stats,
  .dash-stats--client {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dash-actions,
  .dash-split,
  .client-layout,
  .ticket-workspace {
    grid-template-columns: 1fr;
  }

  .ticket-workspace__history {
    position: static;
    max-height: none;
  }

  .client-profile__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .dash-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.site-footer {
  margin-top: auto;
  background: var(--lf-muted);
  color: #fff;
  padding: 1rem 1.25rem;
  font-size: 0.9rem;
}

.site-footer a {
  color: #fff;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* —— Login (split-screen, reference layout) —— */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.login-page {
  background: var(--lf-surface);
}

.login-main {
  flex: 1;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

.login-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

/* Left: form panel */
.login-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--lf-surface);
  padding: clamp(1.25rem, 3vw, 2rem) clamp(1.5rem, 5vw, 3.5rem);
}

.login-brand {
  display: inline-block;
  align-self: flex-start;
  text-decoration: none;
  margin-bottom: clamp(2rem, 6vh, 4rem);
}

.login-brand img {
  display: block;
  width: clamp(9rem, 22vw, 12.5rem);
  height: auto;
}

.login-panel__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(22rem, 100%);
  max-width: 100%;
  margin: 0 auto;
  padding-bottom: clamp(2rem, 8vh, 4rem);
  animation: login-rise 480ms ease both;
}

.login-title {
  margin: 0 0 2rem;
  color: var(--lf-ink);
  font-size: clamp(1.65rem, 2.5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-fields {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  margin-bottom: 2rem;
}

.login-field {
  display: block;
  border-bottom: 1px solid #d8d8d8;
  padding-bottom: 0.35rem;
  transition: border-color var(--lf-transition);
}

.login-field:focus-within {
  border-bottom-color: var(--lf-charcoal);
}

.login-field__label {
  display: block;
  color: var(--lf-muted);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.login-field__input {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0.25rem 0;
  margin: 0;
  color: var(--lf-ink);
  font: inherit;
  font-size: 1rem;
  line-height: 1.4;
  outline: none;
  border-radius: 0;
  box-shadow: none;
}

.login-field__input::placeholder {
  color: #b0b0b0;
}

.login-flash {
  margin: 0 0 1.25rem;
}

.login-form {
  width: 100%;
}

.login-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.85rem 1.25rem;
  border: 0;
  border-radius: 6px;
  background: var(--lf-charcoal);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--lf-transition), transform 180ms ease, box-shadow 180ms ease;
  box-shadow: 0 8px 24px rgba(26, 26, 26, 0.12);
}

.login-submit:hover {
  background: var(--lf-ink);
  color: #fff;
  transform: translateY(-1px);
}

.login-submit:focus-visible {
  outline: 2px solid var(--lf-yellow);
  outline-offset: 3px;
}

.login-help {
  margin: 1.35rem 0 0;
  text-align: center;
  color: var(--lf-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.login-help strong {
  display: block;
  margin-top: 0.25rem;
  color: var(--lf-charcoal);
  font-weight: 700;
}

.login-note {
  margin: 0.85rem 0 0;
  text-align: center;
  color: var(--lf-muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

/* Right: showcase + carousel */
.login-showcase {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #1e2430 0%, #2a3344 42%, #1a1f28 100%);
  min-height: 100vh;
}

.login-showcase__shape {
  position: absolute;
  pointer-events: none;
  z-index: 1;
}

.login-showcase__shape--circle {
  width: clamp(8rem, 18vw, 14rem);
  height: clamp(8rem, 18vw, 14rem);
  border-radius: 50%;
  background: rgba(251, 186, 0, 0.35);
  top: 8%;
  right: -4%;
}

.login-showcase__shape--ring {
  width: clamp(6rem, 12vw, 10rem);
  height: clamp(6rem, 12vw, 10rem);
  border-radius: 50%;
  border: 12px solid rgba(251, 186, 0, 0.25);
  top: 22%;
  left: 6%;
}

.login-showcase__shape--triangle {
  width: 0;
  height: 0;
  border-left: clamp(3rem, 8vw, 5rem) solid transparent;
  border-right: clamp(3rem, 8vw, 5rem) solid transparent;
  border-bottom: clamp(5rem, 12vw, 8rem) solid rgba(251, 186, 0, 0.2);
  bottom: 18%;
  right: 12%;
  transform: rotate(12deg);
}

.login-showcase__shape--dots {
  width: 72px;
  height: 72px;
  bottom: 12%;
  left: 10%;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.45) 2px, transparent 2px);
  background-size: 12px 12px;
  opacity: 0.7;
}

.login-showcase__shape--arc {
  width: clamp(10rem, 22vw, 16rem);
  height: clamp(10rem, 22vw, 16rem);
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  top: 55%;
  left: -8%;
}

.login-carousel {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: clamp(2rem, 5vw, 3.5rem) clamp(1.5rem, 4vw, 2.5rem) clamp(4rem, 8vh, 5rem);
}

.login-carousel__radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.login-carousel__viewport {
  width: min(22rem, 88%);
  margin-bottom: 2rem;
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.06);
}

.login-carousel__track {
  display: flex;
  width: 200%;
  transition: transform 520ms cubic-bezier(0.4, 0, 0.2, 1);
}

.login-carousel:has(#login-slide-1:checked) .login-carousel__track {
  transform: translateX(0);
}

.login-carousel:has(#login-slide-2:checked) .login-carousel__track {
  transform: translateX(-50%);
}

.login-carousel__slide {
  margin: 0;
  flex: 0 0 50%;
  aspect-ratio: 3 / 4;
  background: #111;
}

.login-carousel__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.login-carousel__copy {
  position: relative;
  width: min(26rem, 92%);
  min-height: 5.5rem;
  text-align: center;
  color: #fff;
}

.login-carousel__message {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 420ms ease, transform 420ms ease;
  pointer-events: none;
}

.login-carousel__message h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-carousel__message p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.95rem;
  line-height: 1.55;
}

.login-carousel:has(#login-slide-1:checked) .login-carousel__message:first-child,
.login-carousel:has(#login-slide-2:checked) .login-carousel__message:last-child {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.login-carousel__dots {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.75rem;
}

.login-carousel__dots label {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: background var(--lf-transition), transform var(--lf-transition);
}

.login-carousel__dots label:hover {
  background: rgba(255, 255, 255, 0.6);
}

.login-carousel:has(#login-slide-1:checked) .login-carousel__dots label:first-child,
.login-carousel:has(#login-slide-2:checked) .login-carousel__dots label:last-child {
  background: #fff;
  transform: scale(1.15);
}

@keyframes login-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 960px) {
  .login-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(28rem, 1fr);
  }

  .login-panel {
    min-height: auto;
  }

  .login-panel__body {
    padding-bottom: 2rem;
  }

  .login-brand {
    margin-bottom: 1.5rem;
  }

  .login-showcase,
  .login-carousel {
    min-height: min(70vh, 32rem);
  }

  .login-showcase__shape--circle {
    top: 4%;
    right: -8%;
  }
}

@media (max-width: 480px) {
  .login-panel {
    padding: 1.25rem 1.25rem 0;
  }

  .login-carousel__viewport {
    width: min(18rem, 92%);
  }
}

@media (max-width: 767px) {
  .nav-toggle { display: inline-block; }
  .site-nav {
    display: none;
    position: absolute;
    inset: 3.4rem 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--lf-surface);
    border-bottom: 1px solid #e6e6e6;
    padding: 0.75rem 1.25rem 1rem;
  }
  .site-nav.is-open { display: flex; }
  .account-switch,
  .account-switch__select.select { width: 100%; max-width: none; min-width: 0; }
  table.data { min-width: 0; }
  table.data thead { display: none; }
  table.data tr {
    display: block;
    border-bottom: 1px solid #e6e6e6;
    padding: 0.75rem 0;
  }
  table.data td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border: 0;
    padding: 0.25rem 0.8rem;
  }
  table.data td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--lf-muted);
  }
}

/* —— Document list + in-app viewer (Kunden) —— */
.doc-page__header {
  margin-bottom: 0.25rem;
}

.doc-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin: 1rem 0 0.25rem;
}

.doc-toolbar__firma {
  max-width: 28rem;
  width: min(100%, 28rem);
}

.doc-table-wrap {
  margin-top: 0.25rem;
}

.doc-row__link {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.55rem;
  text-decoration: none;
  color: inherit;
  max-width: 100%;
}

.doc-row__link:hover .doc-row__title {
  text-decoration: underline;
  color: var(--lf-charcoal);
}

.doc-row__file-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  margin-top: 0.05rem;
  color: var(--lf-charcoal);
  background: #f4f4f4;
  border: 1px solid #e4e4e4;
}

.doc-row__file-icon--file-pdf { color: #8b1e1e; background: #f8ecec; border-color: #efd4d4; }
.doc-row__file-icon--file-image { color: #1e5a8b; background: #eaf3f9; border-color: #cfe0ee; }
.doc-row__file-icon--file-video { color: #5a3d8b; background: #f2ecf8; border-color: #ddd0ee; }

.doc-row__title {
  font-weight: 700;
  color: var(--lf-ink);
  line-height: 1.35;
  word-break: break-word;
}

.doc-row__meta {
  display: block;
  font-size: 0.9rem;
  line-height: 1.3;
}

.doc-row__meta--muted {
  color: var(--lf-muted);
  font-size: 0.8rem;
}

.doc-table__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
  white-space: nowrap;
}

.doc-table__actions-col {
  width: 1%;
}

.pill--doc {
  background: #f4f4f4;
  color: var(--lf-charcoal);
  border: 1px solid #e4e4e4;
}

.doc-viewer {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: calc(100vh - 8rem);
}

.doc-viewer__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #ebebeb;
}

.doc-viewer__back {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--lf-muted);
  text-decoration: none;
  margin-bottom: 0.35rem;
}

.doc-viewer__back:hover {
  color: var(--lf-ink);
}

.doc-viewer__title {
  margin: 0;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  color: var(--lf-ink);
  line-height: 1.25;
  max-width: 42rem;
}

.doc-viewer__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin: 0.55rem 0 0;
}

.doc-viewer__meta-text {
  font-size: 0.9rem;
  color: var(--lf-charcoal);
}

.doc-viewer__meta-text a {
  font-weight: 700;
  text-decoration: none;
}

.doc-viewer__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.doc-viewer--pdf {
  min-height: calc(100vh - 5.5rem);
}

.doc-viewer__stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 70vh;
  background: var(--lf-surface-subtle);
  border: 1px solid #ebebeb;
}

.doc-viewer--pdf .doc-viewer__stage {
  min-height: calc(100vh - 11rem);
}

.doc-viewer__placeholder {
  margin: auto;
  max-width: 28rem;
  padding: 2rem 1.25rem;
  text-align: center;
}

.doc-viewer__placeholder-title {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--lf-ink);
}

.doc-viewer__frame-wrap {
  flex: 1;
  display: flex;
  min-height: 70vh;
  background: #ececec;
}

.doc-viewer--pdf .doc-viewer__frame-wrap {
  min-height: calc(100vh - 11rem);
  background: #3a3a3a;
}

.doc-viewer__frame {
  flex: 1;
  width: 100%;
  min-height: 70vh;
  border: 0;
  background: #525659;
}

.pdf-viewer {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: inherit;
}

.pdf-viewer__chrome {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.45rem 0.75rem;
  background: var(--lf-surface, #fff);
  border-bottom: 1px solid #e4e4e4;
  position: sticky;
  top: 0;
  z-index: 2;
}

.pdf-viewer__group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.pdf-viewer__meta {
  min-width: 4.5rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--lf-charcoal);
  font-variant-numeric: tabular-nums;
}

.pdf-viewer__pages {
  flex: 1;
  overflow: auto;
  padding: 1rem 0.75rem 2rem;
  min-height: 60vh;
  scroll-behavior: smooth;
}

.pdf-viewer__page {
  margin: 0 auto 1rem;
  width: fit-content;
  max-width: 100%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.pdf-viewer__page canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.doc-viewer__image {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  margin: auto;
  object-fit: contain;
}

.doc-viewer__video {
  display: block;
  width: 100%;
  max-height: 80vh;
  margin: auto;
  background: #111;
}

.doc-viewer__fallback {
  margin: auto;
  padding: 2rem;
  text-align: center;
}

.doc-viewer__status {
  margin: 0;
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  color: var(--lf-muted);
  border-top: 1px solid #e6e6e6;
  background: var(--lf-surface);
}

/* —— Document folders (index) —— */
.doc-folders {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
  list-style: none;
  padding: 0;
}

.doc-folder {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.85rem;
  min-height: 5.5rem;
  padding: 1.1rem 1rem;
  text-decoration: none !important;
  color: inherit;
  background: var(--lf-surface, #fff);
  border: 1px solid #e4e4e4;
  border-left: 4px solid var(--lf-yellow, #f5c518);
  box-shadow: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.doc-folder:hover,
.doc-folder:focus-visible {
  background: #fafafa;
  border-color: #cfcfcf;
  outline: none;
  transform: translateY(-1px);
}

.doc-folder--empty {
  opacity: 0.72;
  border-left-color: #d0d0d0;
}

.doc-folder--empty:hover,
.doc-folder--empty:focus-visible {
  opacity: 1;
}

.doc-folder--tickets {
  border-left-color: var(--lf-charcoal, #333);
}

.doc-folder__icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  color: var(--lf-charcoal);
  background: #f6f6f6;
  border: 1px solid #e8e8e8;
  flex-shrink: 0;
}

.doc-folder--work_report .doc-folder__icon-wrap { background: #f3f7fb; color: #1e4d73; }
.doc-folder--inspection .doc-folder__icon-wrap { background: #f2f8f3; color: #2a6b3a; }
.doc-folder--invoice .doc-folder__icon-wrap { background: #f8f3ec; color: #8a5a1e; }
.doc-folder--contract .doc-folder__icon-wrap { background: #f4f2f8; color: #4a3a73; }
.doc-folder--other .doc-folder__icon-wrap { background: #f6f6f6; color: #444; }
.doc-folder--tickets .doc-folder__icon-wrap { background: #111; color: var(--lf-yellow, #f5c518); border-color: #111; }

.doc-folder__body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.doc-folder__title {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--lf-ink);
  line-height: 1.25;
  text-decoration: none;
}

.doc-folder__count {
  font-size: 0.85rem;
  color: var(--lf-muted);
  line-height: 1.3;
}

.doc-folder__badge {
  align-self: flex-start;
  min-width: 1.75rem;
  padding: 0.2rem 0.45rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--lf-ink);
  background: var(--lf-yellow, #f5c518);
  border: 1px solid #e0b400;
}

.doc-folder--empty .doc-folder__badge {
  background: #eee;
  border-color: #ddd;
  color: var(--lf-muted);
}

@media (max-width: 768px) {
  .doc-viewer__toolbar {
    flex-direction: column;
  }

  .doc-viewer__actions {
    width: 100%;
  }

  .doc-viewer__actions .btn {
    flex: 1;
    text-align: center;
  }

  .doc-table__actions {
    justify-content: flex-start;
  }

  .doc-folders {
    grid-template-columns: 1fr;
  }
}
