@layer pages {
  /* Helpdesk settings */
  .helpdesk-settings-panel {
    display: grid;
    gap: calc(var(--app-spacing) * 0.75);
    margin-top: calc(var(--app-spacing) * 0.75);
  }

  .helpdesk-settings-test-result {
    margin-top: calc(var(--app-spacing) * 0.6);
  }

  .helpdesk-settings-rule-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: calc(var(--app-spacing) * 0.65);
  }

  .helpdesk-settings-rule-grid-full {
    grid-column: 1 / -1;
  }

  @media (max-width: 760px) {
    .helpdesk-settings-rule-grid {
      grid-template-columns: minmax(0, 1fr);
    }
  }

  /* Automation tab: compact rule list */
  .helpdesk-settings-rules {
    display: grid;
    gap: calc(var(--app-spacing) * 0.5);
    margin-top: calc(var(--app-spacing) * 0.5);
  }

  .helpdesk-settings-rule {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0 calc(var(--app-spacing) * 0.5);
    align-items: center;
    padding: calc(var(--app-spacing) * 0.4) 0;
  }

  .helpdesk-settings-rules > hr {
    margin: 0;
  }

  .helpdesk-settings-rule > input[type="checkbox"] {
    grid-row: 1 / 3;
  }

  .helpdesk-settings-rule-label {
    font-weight: 500;
  }

  .helpdesk-settings-rule > small {
    grid-column: 2;
  }

  /* Risk monitoring: rule with inline threshold */
  .helpdesk-settings-rule-with-threshold {
    grid-template-columns: auto 1fr auto;
  }

  .helpdesk-settings-rule-toggle {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0 calc(var(--app-spacing) * 0.5);
    align-items: center;
    grid-column: 1 / 3;
    cursor: pointer;
  }

  .helpdesk-settings-rule-toggle > input[type="checkbox"] {
    grid-row: 1 / 3;
  }

  .helpdesk-settings-rule-toggle > small {
    grid-column: 2;
  }

  .helpdesk-settings-rule-threshold {
    grid-row: 1 / 3;
    min-width: 6rem;
    max-width: 8rem;
  }

  @media (max-width: 760px) {
    .helpdesk-settings-rule-with-threshold {
      grid-template-columns: auto 1fr;
    }

    .helpdesk-settings-rule-threshold {
      grid-column: 1 / -1;
      max-width: none;
    }
  }

  /* Advanced options disclosure */
  .helpdesk-settings-advanced {
    margin-top: calc(var(--app-spacing) * 0.5);
  }

  .helpdesk-settings-advanced > summary {
    cursor: pointer;
    font-size: 0.85em;
    opacity: 0.7;
    font-weight: 500;
  }

  .helpdesk-settings-advanced > summary:hover {
    opacity: 1;
  }

  .helpdesk-settings-advanced-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: calc(var(--app-spacing) * 0.5);
    margin-top: calc(var(--app-spacing) * 0.5);
  }

  @media (max-width: 760px) {
    .helpdesk-settings-advanced-grid {
      grid-template-columns: minmax(0, 1fr);
    }
  }

  /* Team workload — skeleton loading */
  .helpdesk-team-skeleton-card {
    border: 1px solid var(--app-muted-border-color);
    border-radius: var(--app-radius, 0.375rem);
    overflow: hidden;
    margin-bottom: calc(var(--app-spacing) * 0.5);
  }

  .helpdesk-team-skeleton-header {
    display: flex;
    align-items: center;
    gap: calc(var(--app-spacing) * 0.5);
    padding: calc(var(--app-spacing) * 0.5) calc(var(--app-spacing) * 0.75);
    background: color-mix(
      in srgb,
      var(--app-muted-border-color) 15%,
      transparent
    );
    border-bottom: 1px solid var(--app-muted-border-color);
  }

  .helpdesk-team-skeleton-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    flex-shrink: 0;
  }

  .helpdesk-team-skeleton-name {
    height: 0.85rem;
    width: 10rem;
  }

  .helpdesk-team-skeleton-badge {
    height: 1.1rem;
    width: 2rem;
    border-radius: 999px;
    margin-left: auto;
  }

  .helpdesk-team-skeleton-rows {
    padding: calc(var(--app-spacing) * 0.35) calc(var(--app-spacing) * 0.5);
  }

  .helpdesk-team-skeleton-row {
    display: flex;
    gap: calc(var(--app-spacing) * 0.5);
    padding: calc(var(--app-spacing) * 0.3) 0;
  }

  .helpdesk-team-skeleton-cell-sm {
    height: 0.7rem;
    width: 5rem;
  }

  .helpdesk-team-skeleton-cell-md {
    height: 0.7rem;
    width: 10rem;
  }

  .helpdesk-team-skeleton-cell-lg {
    height: 0.7rem;
    flex: 1;
  }

  /* Team workload — agent widget card */
  .helpdesk-team-widget {
    border: 1px solid var(--app-muted-border-color);
    border-radius: var(--app-radius, 0.375rem);
    margin-bottom: var(--app-spacing);
  }

  .helpdesk-team-widget > .helpdesk-support-section-title {
    margin: 0;
    padding: calc(var(--app-spacing) * 0.5) calc(var(--app-spacing) * 0.75);
    background: color-mix(
      in srgb,
      var(--app-muted-border-color) 15%,
      transparent
    );
    border-bottom: 1px solid var(--app-muted-border-color);
    border-radius: var(--app-radius, 0.375rem) var(--app-radius, 0.375rem) 0 0;
  }

  .helpdesk-team-widget > .helpdesk-support-section-title::after {
    display: none;
  }

  .helpdesk-team-table-scroll {
    overflow-x: auto;
  }

  .helpdesk-team-widget
    > .helpdesk-team-table-scroll
    > .helpdesk-team-ticket-table,
  .helpdesk-team-widget > .helpdesk-team-ticket-table {
    border: none;
    border-radius: 0;
  }

  .helpdesk-team-widget > .helpdesk-team-ticket-table th {
    border-radius: 0;
  }

  /* Team workload — trend delta indicator */
  .helpdesk-team-trend-up,
  .helpdesk-team-trend-down {
    font-size: var(--text-xs, 0.75rem);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
  }

  .helpdesk-team-trend-up {
    color: var(--app-warning, #f59e0b);
  }

  .helpdesk-team-trend-down {
    color: var(--app-success, #198754);
  }

  /* Team workload — inline avatar for section titles */
  .helpdesk-team-avatar-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    background: color-mix(
      in srgb,
      var(--app-muted-border-color) 80%,
      transparent
    );
    color: var(--app-muted-color);
    vertical-align: middle;
  }

  /* Count badge in section title — always neutral */
  .helpdesk-team-title-count {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.1em 0.5em;
    border-radius: 999px;
    background: color-mix(in srgb, var(--app-contrast, #000) 7%, transparent);
    color: var(--app-muted-color);
  }

  /* Ticket table inside agent widget */
  .helpdesk-team-ticket-table {
    width: 100%;
    font-size: var(--text-sm, 0.875rem);
    border: 1px solid var(--app-muted-border-color);
    border-radius: var(--app-radius, 0.375rem);
    border-spacing: 0;
    overflow: hidden;
    table-layout: fixed;
    min-width: 50rem;
  }

  /* Column widths — consistent across all agent cards */
  .helpdesk-team-col-ticket {
    width: 12ch;
  }
  .helpdesk-team-col-customer {
    width: 22ch;
  }
  .helpdesk-team-col-category {
    width: 20ch;
  }
  .helpdesk-team-col-activity {
    width: 20ch;
  }

  .helpdesk-team-ticket-table th {
    text-align: left;
    font-weight: 500;
    color: var(--app-muted-color);
    padding: calc(var(--app-spacing) * 0.3) calc(var(--app-spacing) * 0.5);
    border-bottom: 1px solid var(--app-muted-border-color);
    background: color-mix(
      in srgb,
      var(--app-muted-border-color) 20%,
      transparent
    );
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .helpdesk-team-ticket-table td {
    padding: calc(var(--app-spacing) * 0.35) calc(var(--app-spacing) * 0.5);
    border-bottom: 1px solid
      color-mix(in srgb, var(--app-muted-border-color) 40%, transparent);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .helpdesk-team-ticket-table tbody tr:last-child td {
    border-bottom: none;
  }

  /* Narrow columns: no wrap, natural width */
  .helpdesk-team-ticket-no {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    white-space: nowrap;
  }

  .helpdesk-team-ticket-customer {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .helpdesk-team-ticket-date {
    white-space: nowrap;
    color: var(--app-muted-color);
  }

  .helpdesk-team-ticket-desc {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Links */
  .helpdesk-team-ticket-no a,
  .helpdesk-team-ticket-table td a {
    color: inherit;
    text-decoration: none;
  }

  .helpdesk-team-ticket-no a:hover,
  .helpdesk-team-ticket-table td a:hover {
    color: var(--app-primary, #0d6efd);
    text-decoration: underline;
  }

  /* Critical: only highlight the ticket number */
  .helpdesk-team-ticket-critical .helpdesk-team-ticket-no,
  .helpdesk-team-ticket-critical .helpdesk-team-ticket-no a {
    color: var(--app-warning, #f59e0b);
    font-weight: 600;
  }

  /* Legend */
  .helpdesk-team-legend {
    display: flex;
    align-items: center;
    gap: calc(var(--app-spacing) * 0.75);
    margin-top: calc(var(--app-spacing) * 0.75);
    font-size: var(--text-xs, 0.75rem);
    color: var(--app-muted-color);
  }

  .helpdesk-team-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
  }

  .helpdesk-team-legend-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    flex-shrink: 0;
  }

  .helpdesk-team-legend-dot-warning {
    background: var(--app-warning, #f59e0b);
  }

  .helpdesk-team-performance-panel > .helpdesk-segment-control {
    margin-bottom: calc(var(--app-spacing) * 0.75);
  }

  /* Performance insights grid inside agent widget */
  .helpdesk-team-perf-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: calc(var(--app-spacing) * 0.75);
    padding: calc(var(--app-spacing) * 0.65) calc(var(--app-spacing) * 0.75);
  }

  .helpdesk-team-perf-grid > :nth-child(n + 2) {
    border-left: 1px solid var(--app-muted-border-color);
    padding-left: calc(var(--app-spacing) * 0.75);
  }

  @media (max-width: 760px) {
    .helpdesk-team-perf-grid {
      grid-template-columns: minmax(0, 1fr);
    }

    .helpdesk-team-perf-grid > :nth-child(n + 2) {
      border-left: none;
      padding-left: 0;
      border-top: 1px solid var(--app-muted-border-color);
      padding-top: calc(var(--app-spacing) * 0.5);
    }
  }

  .helpdesk-team-perf-stat-label {
    display: block;
    font-size: var(--text-xs, 0.75rem);
    font-weight: 600;
    color: var(--app-muted-color);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: calc(var(--app-spacing) * 0.3);
  }

  .helpdesk-team-perf-ranked {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: rank;
  }

  .helpdesk-team-perf-ranked li {
    display: flex;
    align-items: baseline;
    gap: calc(var(--app-spacing) * 0.3);
    padding: calc(var(--app-spacing) * 0.15) 0;
    font-size: var(--text-sm, 0.875rem);
    counter-increment: rank;
  }

  .helpdesk-team-perf-ranked li::before {
    content: counter(rank) ".";
    color: var(--app-muted-color);
    font-size: var(--text-xs, 0.75rem);
    font-variant-numeric: tabular-nums;
    min-width: 1.5ch;
  }

  .helpdesk-team-perf-ranked-plain {
    counter-reset: none;
  }

  .helpdesk-team-perf-ranked-plain li::before {
    display: none;
  }

  .helpdesk-team-perf-ranked-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .helpdesk-team-perf-ranked-count {
    font-variant-numeric: tabular-nums;
    color: var(--app-muted-color);
    font-size: var(--text-xs, 0.75rem);
  }

  /* Clickable ranked items */
  .helpdesk-team-perf-ranked-clickable {
    cursor: pointer;
    border-radius: var(--app-border-radius, 0.25rem);
    padding-inline: calc(var(--app-spacing) * 0.25);
    margin-inline: calc(var(--app-spacing) * -0.25);
    transition: background-color 0.15s ease;
  }

  .helpdesk-team-perf-ranked-clickable:hover {
    background: color-mix(in srgb, var(--app-primary, #0d6efd) 8%, transparent);
  }

  .helpdesk-team-perf-ranked-clickable.active {
    background: color-mix(
      in srgb,
      var(--app-primary, #0d6efd) 12%,
      transparent
    );
  }

  .helpdesk-team-perf-ranked-clickable.active .helpdesk-team-perf-ranked-name {
    font-weight: 600;
    color: var(--app-primary, #0d6efd);
  }

  /* Filtered state on resolution times */
  .helpdesk-team-perf-stat-filtered .helpdesk-team-perf-ranked-count {
    color: var(--app-primary, #0d6efd);
    font-weight: 600;
  }

  /* --- Risk Radar --- */
  .helpdesk-risk-radar-toolbar {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: calc(var(--app-spacing) * 0.5);
    margin-bottom: calc(var(--app-spacing) * 0.75);
  }

  .helpdesk-risk-legend {
    width: 100%;
  }

  .helpdesk-risk-legend-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: calc(var(--app-spacing) * 0.5) calc(var(--app-spacing) * 0.75);
    margin: 0;
    padding: 0;
  }

  .helpdesk-risk-legend-item {
    display: inline-flex;
    align-items: center;
    gap: calc(var(--app-spacing) * 0.25);
    font-size: var(--text-sm, 0.875rem);
  }

  .helpdesk-risk-legend-dot {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 999px;
    flex: 0 0 auto;
    border: 1px solid transparent;
  }

  .helpdesk-risk-legend-dot.helpdesk-risk-level-high {
    background: var(--app-danger, #dc3545);
    border-color: color-mix(in srgb, var(--app-danger, #dc3545) 70%, black);
  }

  .helpdesk-risk-legend-dot.helpdesk-risk-level-medium {
    background: var(--app-warning, #f59e0b);
    border-color: color-mix(in srgb, var(--app-warning, #f59e0b) 70%, black);
  }

  .helpdesk-risk-legend-dot.helpdesk-risk-level-low {
    background: var(--app-success, #198754);
    border-color: color-mix(in srgb, var(--app-success, #198754) 70%, black);
  }

  .helpdesk-risk-radar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
    gap: calc(var(--app-spacing) * 0.6);
    margin-top: calc(var(--app-spacing) * 0.75);
  }

  .helpdesk-risk-card {
    border: 1px solid var(--app-muted-border-color);
    border-left: 3px solid var(--app-muted-border-color);
    border-radius: var(--app-radius, 0.375rem);
    padding: calc(var(--app-spacing) * 0.65) calc(var(--app-spacing) * 0.75);
    margin-bottom: 0;
    transition:
      border-color 0.15s ease,
      box-shadow 0.15s ease;
    cursor: pointer;
  }

  .helpdesk-risk-card.helpdesk-risk-level-high {
    border-left-color: var(--app-danger, #dc3545);
  }

  .helpdesk-risk-card.helpdesk-risk-level-medium {
    border-left-color: var(--app-warning, #f59e0b);
  }

  .helpdesk-risk-card.helpdesk-risk-level-low {
    border-left-color: var(--app-success, #198754);
  }

  .helpdesk-risk-card:hover {
    border-color: var(--app-muted-border-color);
    box-shadow: 0 2px 8px color-mix(in srgb, currentColor 6%, transparent);
  }

  .helpdesk-risk-card.helpdesk-risk-level-high:hover {
    border-left-color: var(--app-danger, #dc3545);
  }

  .helpdesk-risk-card.helpdesk-risk-level-medium:hover {
    border-left-color: var(--app-warning, #f59e0b);
  }

  .helpdesk-risk-card.helpdesk-risk-level-low:hover {
    border-left-color: var(--app-success, #198754);
  }

  .helpdesk-risk-card:focus-visible {
    outline: 2px solid var(--app-primary, #0d6efd);
    outline-offset: -2px;
  }

  .helpdesk-risk-card-header {
    display: flex;
    align-items: self-start;
    justify-content: space-between;
    gap: calc(var(--app-spacing) * 0.6);
  }

  .helpdesk-risk-card-score {
    font-variant-numeric: tabular-nums;
    font-size: var(--text-xs, 0.75rem);
    flex-shrink: 0;
    line-height: 1;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    width: 3.5ch;
    height: 3.5ch;
    text-align: center;
    justify-content: center;
  }

  .helpdesk-risk-card-score.helpdesk-risk-level-high {
    color: var(--app-danger, #dc3545);
    background: color-mix(in srgb, var(--app-danger, #dc3545) 10%, transparent);
  }

  .helpdesk-risk-card-score.helpdesk-risk-level-medium {
    color: color-mix(in srgb, var(--app-warning, #f59e0b) 85%, black);
    background: color-mix(
      in srgb,
      var(--app-warning, #f59e0b) 12%,
      transparent
    );
  }

  .helpdesk-risk-card-score.helpdesk-risk-level-low {
    color: var(--app-success, #198754);
    background: color-mix(
      in srgb,
      var(--app-success, #198754) 10%,
      transparent
    );
  }

  .helpdesk-risk-card-info {
    flex: 1;
    min-width: 0;
  }

  .helpdesk-risk-card-name {
    font-weight: 600;
    font-size: var(--text-sm, 0.875rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
  }

  .helpdesk-risk-card-level {
    font-size: var(--text-xs, 0.75rem);
    font-weight: 500;
    color: var(--app-muted-color);
  }

  .helpdesk-risk-card-facts {
    margin: calc(var(--app-spacing) * 0.35) 0 0;
    font-size: var(--text-xs, 0.75rem);
    color: var(--app-muted-color);
  }

  .helpdesk-risk-detail-tickets {
    width: 100%;
    font-size: var(--text-sm, 0.875rem);
    border: 1px solid var(--app-muted-border-color);
    border-radius: var(--app-radius, 0.375rem);
    border-spacing: 0;
    overflow: hidden;
    margin-bottom: calc(var(--app-spacing) * 0.75);
  }

  .helpdesk-risk-detail-tickets th {
    text-align: left;
    font-weight: 500;
    color: var(--app-muted-color);
    padding: calc(var(--app-spacing) * 0.3) calc(var(--app-spacing) * 0.5);
    border-bottom: 1px solid var(--app-muted-border-color);
    background: color-mix(
      in srgb,
      var(--app-muted-border-color) 20%,
      transparent
    );
  }

  .helpdesk-risk-detail-tickets td {
    padding: calc(var(--app-spacing) * 0.3) calc(var(--app-spacing) * 0.5);
    border-bottom: 1px solid
      color-mix(in srgb, var(--app-muted-border-color) 40%, transparent);
  }

  .helpdesk-risk-detail-tickets tbody tr:last-child td {
    border-bottom: none;
  }

  .helpdesk-risk-detail-ticket-critical td:first-child {
    color: var(--app-warning, #f59e0b);
    font-weight: 600;
  }

  .helpdesk-risk-detail-link {
    display: inline-block;
    font-size: var(--text-sm, 0.875rem);
    color: var(--app-primary, #0d6efd);
    text-decoration: none;
  }

  .helpdesk-risk-detail-link:hover {
    text-decoration: underline;
  }

  /* Clickable rows — shared between search results and ticket list */
  .app-clickable-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
  }

  .app-clickable-row:hover,
  .app-clickable-row:focus-visible {
    background: color-mix(in srgb, var(--app-contrast, #000) 4%, transparent);
  }

  .app-clickable-row:focus-visible {
    outline: 2px solid var(--app-primary, #0d6efd);
    outline-offset: -2px;
  }

  /* Skeleton loading */
  @keyframes helpdesk-shimmer {
    0% {
      background-position: 200% 0;
    }
    100% {
      background-position: -200% 0;
    }
  }

  .helpdesk-skeleton {
    background: linear-gradient(
      90deg,
      var(--app-border-subtle, #e9ecef) 25%,
      color-mix(
          in srgb,
          var(--app-border-subtle, #e9ecef) 60%,
          var(--app-card-background-color, #fff)
        )
        50%,
      var(--app-border-subtle, #e9ecef) 75%
    );
    background-size: 200% 100%;
    animation: helpdesk-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--app-border-radius);
  }

  .helpdesk-skeleton-line {
    height: 0.75rem;
    margin-bottom: 0.5rem;
  }

  .helpdesk-skeleton-line-short {
    width: 60%;
  }

  .helpdesk-skeleton-line-xs {
    height: 0.5rem;
    width: 40%;
  }

  .helpdesk-skeleton-kpi {
    padding: calc(var(--app-spacing) * 0.75) calc(var(--app-spacing) * 0.9);
    border: 1px solid var(--app-border, #d0d7de);
    border-radius: var(--app-border-radius);
    background: var(--app-card-background-color, #fff);
  }

  .helpdesk-skeleton-kpi-label {
    height: 0.625rem;
    width: 70%;
    margin-bottom: 0.625rem;
  }

  .helpdesk-skeleton-kpi-value {
    height: 1.35rem;
    width: 45%;
    margin-bottom: 0.375rem;
  }

  .helpdesk-skeleton-kpi-trend {
    height: 0.5rem;
    width: 55%;
  }

  .helpdesk-skeleton-divider {
    height: 1px;
    background: var(--app-border, #dee2e6);
    margin: calc(var(--app-spacing) * 0.75) 0;
  }

  .helpdesk-skeleton-row {
    display: flex;
    gap: calc(var(--app-spacing) * 0.75);
    padding: 0.5rem 0;
  }

  .helpdesk-skeleton-cell {
    height: 0.75rem;
    flex: 1;
  }

  .helpdesk-skeleton-cell-narrow {
    flex: 0 0 5rem;
  }

  .helpdesk-skeleton-aside-bubble {
    height: 3.5rem;
    margin-bottom: 0.75rem;
    border-radius: 0.75rem;
  }

  .helpdesk-skeleton-aside-bubble-short {
    width: 75%;
  }

  .helpdesk-skeleton-aside-bubble-alt {
    margin-left: auto;
    width: 65%;
  }

  /* Support dashboard */
  .helpdesk-support-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: calc(var(--app-spacing) * 0.75);
  }

  .helpdesk-support-metrics-aside {
    grid-template-columns: minmax(0, 1fr);
  }

  .helpdesk-support-metric {
    margin: 0;
    padding: calc(var(--app-spacing) * 0.75) calc(var(--app-spacing) * 0.9);
    border: 1px solid var(--app-border, #d0d7de);
    border-radius: var(--app-border-radius);
    background: var(--app-card-background-color, #fff);
  }

  .helpdesk-support-metric-label {
    margin: 0;
    font-size: var(--text-xs);
    line-height: 1.35;
    color: var(--app-muted, #6c757d);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
  }

  .helpdesk-kpi-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid var(--app-border-color, #dee2e6);
    font-size: 9px;
    font-weight: var(--font-semibold, 600);
    font-style: italic;
    line-height: 1;
    color: var(--app-muted, #6c757d);
    text-transform: none;
    letter-spacing: 0;
    cursor: help;
    vertical-align: middle;
    margin-left: 0.15rem;
    transition:
      border-color 0.15s ease,
      color 0.15s ease;
  }

  .helpdesk-kpi-info:hover,
  .helpdesk-kpi-info:focus-visible {
    border-color: var(--app-primary, #0d6efd);
    color: var(--app-primary, #0d6efd);
  }

  .helpdesk-kpi-info::after {
    white-space: normal;
    max-width: 220px;
    text-align: left;
    line-height: 1.4;
  }

  .helpdesk-support-metric-value {
    margin: 0.35rem 0 0;
    font-size: clamp(1.15rem, 1rem + 0.45vw, 1.45rem);
    line-height: 1.2;
    font-weight: var(--font-bold);
    color: var(--app-contrast, #1f2937);
  }

  .helpdesk-support-metric-trend {
    margin: 0.3rem 0 0;
    font-size: var(--text-xs);
    line-height: 1.35;
    min-height: 1.1em;
  }

  .helpdesk-kpi-trend-positive {
    color: var(--app-success, #198754);
    font-weight: var(--font-medium);
  }

  .helpdesk-kpi-trend-negative {
    color: var(--app-danger, #dc3545);
    font-weight: var(--font-medium);
  }

  .helpdesk-kpi-trend-neutral {
    color: var(--app-muted, #6c757d);
  }

  .helpdesk-kpi-clickable {
    cursor: pointer;
    transition:
      border-color 0.15s ease,
      box-shadow 0.15s ease;
  }

  .helpdesk-kpi-clickable:hover {
    border-color: var(--app-primary, #0d6efd);
    box-shadow: 0 1px 4px rgb(0 0 0 / 0.06);
  }

  /* Uniform vertical rhythm inside tab content areas and ticket detail */
  #support-content > * + *,
  #sales-content > * + *,
  #controlling-content > * + *,
  .helpdesk-ticket-detail-content > * + * {
    margin-top: calc(var(--app-spacing) * 1.75);
  }

  #support-content > .app-stats-table,
  #sales-content > .app-stats-table,
  #controlling-content > .app-stats-table,
  .helpdesk-ticket-detail-content > .app-stats-table {
    margin-bottom: 0;
  }

  .helpdesk-support-section-title {
    display: flex;
    align-items: center;
    gap: calc(var(--app-spacing) * 0.75);
    margin: 0 0 calc(var(--app-spacing) * 0.75);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--app-contrast, #1f2937);
  }

  .helpdesk-support-section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--app-border, #dee2e6);
  }

  @media (max-width: 1024px) {
    .helpdesk-support-metrics {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }

  @media (max-width: 560px) {
    .helpdesk-support-metrics {
      grid-template-columns: minmax(0, 1fr);
    }
  }

  /* Contract detail dialog */
  .helpdesk-contract-dialog-article {
    max-height: min(80vh, 40rem);
    display: flex;
    flex-direction: column;
  }

  .helpdesk-contract-dialog-article > header {
    position: relative;
    padding-inline-end: 2.5rem;
  }

  .helpdesk-contract-dialog-article > header h2 {
    margin: 0;
  }

  .helpdesk-contract-dialog-article > header h2 small {
    font-weight: var(--font-normal, 400);
    color: var(--app-muted, #6c757d);
    margin-left: 0.35rem;
  }

  .helpdesk-contract-dialog-article > header .close {
    position: absolute;
    inset-inline-end: 1rem;
    inset-block-start: 1rem;
    float: none;
    margin: 0;
  }

  .helpdesk-contract-dialog-meta {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: calc(var(--app-spacing) * 0.65);
    padding-bottom: calc(var(--app-spacing) * 0.75);
    border-bottom: 1px solid var(--app-border, #dee2e6);
    margin-bottom: calc(var(--app-spacing) * 0.75);
  }

  .helpdesk-contract-dialog-meta > span {
    font-size: var(--text-sm);
    color: var(--app-contrast, #1f2937);
  }

  .helpdesk-contract-dialog-meta strong {
    display: block;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--app-muted, #6c757d);
    font-weight: var(--font-medium);
    margin-bottom: 0.15rem;
  }

  .helpdesk-contract-dialog-section-title {
    margin: 0 0 calc(var(--app-spacing) * 0.35);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    color: var(--app-muted, #6c757d);
  }

  .helpdesk-contract-dialog-lines {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
  }

  .helpdesk-contract-dialog-lines table {
    font-size: var(--text-sm);
  }

  #helpdesk-contacts-grid .gridjs-wrapper,
  #helpdesk-tickets-grid .gridjs-wrapper {
    min-height: auto;
  }

  /* Activity timeline */
  .helpdesk-timeline {
    padding: 0.75rem 1rem;
  }

  .helpdesk-timeline-date {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--app-muted, #6c757d);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.75rem 0 0.375rem;
    border-bottom: 1px solid var(--app-border, #dee2e6);
    margin-bottom: 0.5rem;
  }

  .helpdesk-timeline-date:first-child {
    padding-top: 0;
  }

  .helpdesk-timeline-entry {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.375rem 0;
    font-size: 0.875rem;
    line-height: 1.4;
  }

  .helpdesk-timeline-icon {
    flex: 0 0 1.5rem;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.75rem;
  }

  .helpdesk-timeline-entry[data-variant="message"] .helpdesk-timeline-icon {
    background: #d9e8fb;
    color: #1a56db;
  }

  .helpdesk-timeline-entry[data-variant="status"] .helpdesk-timeline-icon {
    background: #fde8d8;
    color: #b35c14;
  }

  .helpdesk-timeline-entry[data-variant="forward"] .helpdesk-timeline-icon {
    background: #f3e8ff;
    color: #7c3aed;
  }

  .helpdesk-timeline-entry[data-variant="file"] .helpdesk-timeline-icon {
    background: #d9f2e6;
    color: #1f6a3a;
  }

  .helpdesk-timeline-entry[data-variant="other"] .helpdesk-timeline-icon {
    background: var(--app-border, #dee2e6);
    color: var(--app-muted, #6c757d);
  }

  .helpdesk-timeline-body {
    flex: 1;
    min-width: 0;
  }

  .helpdesk-timeline-body strong {
    font-weight: 600;
  }

  .helpdesk-timeline-time {
    margin-left: 0.5rem;
    color: var(--app-muted, #6c757d);
    font-size: 0.8125rem;
  }

  /* Communication feed (ticket + debtor aside) */
  .helpdesk-comm-hint {
    margin: 0.75rem 1rem 0;
    font-size: 0.8125rem;
    color: var(--app-muted, #6c757d);
  }

  .helpdesk-comm-feed {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 0;
    padding: 0.75rem 1rem;
    list-style: none;
    max-height: 26rem;
    min-width: 0;
    position: relative;
  }

  .helpdesk-comm-feed::before {
    content: "";
    position: absolute;
    left: calc(1rem + 7px);
    top: 1.2rem;
    bottom: 1.2rem;
    width: 1px;
    background: color-mix(in srgb, var(--app-border, #dee2e6) 88%, transparent);
    z-index: 0;
  }

  .helpdesk-comm-feed > li {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  #app-details-aside-section .helpdesk-comm-feed {
    max-height: none;
    height: 100%;
    min-height: 0;
    padding: 0.5rem 0 0;
  }

  #app-details-aside-section .helpdesk-comm-feed::before {
    left: 7px;
  }

  .helpdesk-chat-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-width: 100%;
    min-width: 0;
  }

  .helpdesk-chat-row--message {
    --helpdesk-tl-x: 7px;
    --helpdesk-tl-dot: 10px;
    position: relative;
    align-self: stretch;
    padding: 0.05rem 0 0.05rem 1.35rem;
  }

  .helpdesk-chat-row--customer {
    align-self: flex-start;
  }

  .helpdesk-chat-row--support {
    align-self: flex-start;
  }

  .helpdesk-chat-row--activity {
    align-self: stretch;
    max-width: 100%;
    gap: 0.15rem;
  }

  .helpdesk-chat-meta-block {
    display: grid;
    gap: 0.18rem;
    min-width: 0;
  }

  .helpdesk-chat-meta-block--center {
    justify-items: center;
  }

  .helpdesk-chat-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.12rem 0.45rem;
    font-size: 0.6875rem;
    color: var(--app-muted, #6c757d);
    min-width: 0;
  }

  .helpdesk-chat-meta-row > * {
    min-width: 0;
  }

  .helpdesk-chat-meta-row > * + *::before {
    content: "•";
    margin-right: 0.4rem;
    color: color-mix(in srgb, var(--app-muted, #6c757d) 70%, transparent);
  }

  .helpdesk-chat-meta-row--center {
    justify-content: center;
  }

  .helpdesk-chat-meta-item {
    line-height: 1.35;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .helpdesk-chat-meta-link {
    color: color-mix(in srgb, var(--app-primary, #1a56db) 88%, #0b2e7a);
    text-decoration: none;
    line-height: 1.35;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .helpdesk-chat-meta-link:hover {
    text-decoration: underline;
  }

  .helpdesk-chat-actor {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--app-contrast, #1f2937);
    overflow-wrap: anywhere;
  }

  .helpdesk-chat-time {
    font-size: 0.75rem;
    color: var(--app-muted, #6c757d);
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .helpdesk-chat-meta-row--center .helpdesk-chat-time {
    margin-left: 0;
  }

  .helpdesk-chat-bubble {
    margin: 0;
    border: 1px solid #d0d7de;
    background: #fff;
    border-radius: 0.5rem;
    padding: 0.62rem 0.78rem;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.45;
    box-shadow: 0 1px 0 rgb(27 31 36 / 0.04);
  }

  .helpdesk-chat-row--customer .helpdesk-chat-bubble {
    background: var(--app-secondary);
    color: var(--app-secondary-inverse);
    border-color: var(--app-secondary-border);
  }

  .helpdesk-chat-row--support .helpdesk-chat-bubble {
    background: var(--app-primary);
    border-color: var(--app-primary);
    color: var(--app-primary-inverse);
  }
  .helpdesk-chat-row--message::before {
    display: none;
  }

  .helpdesk-chat-row--message::after {
    content: "";
    position: absolute;
    left: calc(var(--helpdesk-tl-x) - (var(--helpdesk-tl-dot) / 2) + 0.5px);
    top: 0.52rem;
    width: var(--helpdesk-tl-dot);
    height: var(--helpdesk-tl-dot);
    border-radius: 50%;
    box-sizing: border-box;
    border: 2px solid
      color-mix(in srgb, var(--app-border, #dee2e6) 82%, #8f9bae);
    background: #fff;
    z-index: 1;
  }

  .helpdesk-chat-row--message > * {
    position: relative;
    z-index: 1;
  }

  .helpdesk-chat-row--message .helpdesk-chat-meta-block,
  .helpdesk-chat-row--message .helpdesk-chat-bubble {
    margin-left: 1.35rem;
  }

  .helpdesk-chat-activity {
    --helpdesk-tl-x: 7px;
    --helpdesk-tl-dot: 10px;
    position: relative;
    display: block;
    padding: 0.1rem 0 0.1rem 1.35rem;
    margin: 0;
  }

  .helpdesk-chat-activity::before {
    display: none;
  }

  .helpdesk-chat-activity::after {
    content: "";
    position: absolute;
    left: calc(var(--helpdesk-tl-x) - (var(--helpdesk-tl-dot) / 2) + 0.5px);
    top: 0.48rem;
    width: var(--helpdesk-tl-dot);
    height: var(--helpdesk-tl-dot);
    border-radius: 50%;
    box-sizing: border-box;
    border: 2px solid
      color-mix(in srgb, var(--app-border, #dee2e6) 86%, #8f9bae);
    background: #fff;
    z-index: 1;
  }

  .helpdesk-chat-activity-pill {
    position: relative;
    z-index: 1;
    display: block;
    border-radius: 0;
    border: 0;
    border-left: 0;
    background: transparent;
    color: color-mix(in srgb, var(--app-muted, #6c757d) 92%, #334155);
    padding: 0.08rem 0 0.08rem 0;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.4;
    max-width: 100%;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
  }

  .helpdesk-chat-activity[data-variant="status"] .helpdesk-chat-activity-pill {
    color: color-mix(in srgb, var(--app-muted, #6c757d) 92%, #334155);
  }

  .helpdesk-chat-activity[data-variant="forward"] .helpdesk-chat-activity-pill {
    color: color-mix(in srgb, var(--app-muted, #6c757d) 92%, #334155);
  }

  .helpdesk-chat-activity[data-variant="file"] .helpdesk-chat-activity-pill {
    color: color-mix(in srgb, var(--app-muted, #6c757d) 92%, #334155);
  }

  #app-details-aside-section .helpdesk-chat-row {
    max-width: 100%;
    min-width: 0;
  }

  #app-details-aside-section .helpdesk-chat-time {
    margin-left: 0;
  }

  #app-details-aside-section .helpdesk-chat-meta-row {
    gap: 0.25rem 0.4rem;
  }

  @media (min-width: 968px) {
    .app-details-container {
      overflow-x: hidden;
      overflow-x: clip;
    }

    #app-details-aside-section .helpdesk-comm-aside {
      display: flex;
      flex-direction: column;
      flex: 1;
      height: 100%;
      min-height: 0;
    }

    #app-details-aside-section #debitor-communication-content:not([hidden]) {
      display: flex;
      flex: 1;
      min-height: 0;
      min-width: 0;
    }

    #app-details-aside-section #debitor-communication-feed {
      display: flex;
      flex-direction: column;
      flex: 1;
      min-height: 0;
      min-width: 0;
    }
  }

  /* Ticket detail aside — KPIs + meta list */
  .helpdesk-ticket-aside > * + * {
    margin-top: calc(var(--app-spacing) * 1.25);
  }

  .helpdesk-ticket-aside > .helpdesk-support-section-title {
    margin-top: calc(var(--app-spacing) * 1.5);
  }

  .helpdesk-ticket-aside > .helpdesk-support-section-title:first-child {
    margin-top: 0;
  }

  /* Key-value definition list (Stripe-style) */
  .helpdesk-ticket-meta {
    margin: 0;
    padding: 0;
  }

  .helpdesk-ticket-meta-item {
    padding: calc(var(--app-spacing) * 0.6) 0;
    border-bottom: 1px solid var(--app-border-subtle, #f0f0f0);
  }

  .helpdesk-ticket-meta-item:last-child {
    border-bottom: 0;
  }

  .helpdesk-ticket-meta dt {
    margin: 0;
    font-size: var(--text-xs);
    color: var(--app-muted, #6c757d);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    line-height: 1.35;
  }

  .helpdesk-ticket-meta dd {
    margin: 0.15rem 0 0;
    font-size: var(--text-base);
    line-height: 1.4;
    color: var(--app-contrast, #1f2937);
    word-break: break-word;
  }

  .helpdesk-ticket-meta dd a {
    color: var(--app-primary, #0d6efd);
    text-decoration: none;
  }

  .helpdesk-ticket-meta dd a:hover {
    text-decoration: underline;
  }

  /* File attachment in chat */
  .helpdesk-chat-file {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
  }

  .helpdesk-chat-file-preview {
    display: block;
    max-width: 16rem;
    position: relative;
  }

  .helpdesk-chat-file-skeleton {
    display: block;
    width: 12rem;
    height: 8rem;
    border-radius: var(--app-radius, 0.375rem);
  }

  .helpdesk-chat-file-preview img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: var(--app-radius, 0.375rem);
    border: 1px solid var(--app-muted-border-color);
    cursor: zoom-in;
  }

  .helpdesk-chat-file-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    font-size: var(--text-sm, 0.875rem);
    font-weight: 500;
    color: var(--app-primary, #0d6efd);
    text-decoration: none;
  }

  .helpdesk-chat-file-link:hover {
    text-decoration: underline;
  }

  /* Ticket detail — communication feed in main content (no max-height) */
  .helpdesk-ticket-detail-content .helpdesk-comm-feed {
    max-height: none;
  }

  /* --- Controlling dashboard --- */

  /* Segment control — radio + label (no button CSS bleed) */
  .helpdesk-segment-control {
    display: inline-flex;
    border: 1px solid var(--app-border, #dee2e6);
    border-radius: var(--app-radius, 0.375rem);
    overflow: hidden;
  }

  .helpdesk-segment-control input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .helpdesk-segment-control label {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    font-size: var(--text-sm, 0.875rem);
    line-height: 1.4;
    color: var(--app-contrast, #1f2937);
    background: transparent;
    cursor: pointer;
    user-select: none;
    transition:
      background-color 0.15s ease,
      color 0.15s ease;
    border-right: 1px solid var(--app-border, #dee2e6);
    margin: 0;
  }

  .helpdesk-segment-control label:last-of-type {
    border-right: none;
  }

  .helpdesk-segment-control input[type="radio"]:checked + label {
    background: var(--app-primary, #0d6efd);
    color: #fff;
  }

  .helpdesk-segment-control input[type="radio"]:focus-visible + label {
    outline: 2px solid var(--app-primary, #0d6efd);
    outline-offset: -2px;
  }

  .helpdesk-segment-control label:hover {
    background: var(--app-background-muted, #f8f9fa);
  }

  .helpdesk-segment-control input[type="radio"]:checked + label:hover {
    background: var(--app-primary, #0d6efd);
  }

  /* Horizontal bar chart */
  .helpdesk-controlling-chart {
    padding: calc(var(--app-spacing) * 0.75);
  }

  /* Vertical grouped bar chart */
  .helpdesk-vchart-area {
    position: relative;
    height: 10rem;
    padding-left: 1.5rem; /* room for Y-axis labels */
    border-bottom: 1px solid var(--app-border, #dee2e6);
  }

  /* Horizontal grid lines */
  .helpdesk-vchart-grid-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 0;
    border-top: 1px dashed var(--app-border-subtle, #e9ecef);
    pointer-events: none;
    z-index: 0;
  }

  .helpdesk-vchart-grid-label {
    position: absolute;
    left: 0;
    transform: translateY(-50%);
    font-size: 0.625rem;
    color: var(--app-muted, #6c757d);
    line-height: 1;
  }

  /* Bar groups sit inside the area and stretch full height */
  .helpdesk-vchart-groups {
    position: relative;
    display: flex;
    height: 100%;
    z-index: 1;
  }

  .helpdesk-vchart-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 0;
  }

  /* Bar container — takes remaining space, bars grow upward from bottom */
  .helpdesk-vchart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    flex: 1;
    width: 100%;
  }

  .helpdesk-vchart-bar {
    width: clamp(0.625rem, 22%, 1.25rem);
    border-radius: 3px 3px 0 0;
    transition: height 0.4s ease;
  }

  .helpdesk-vchart-bar-created {
    background: hsl(0 65% 60%);
  }

  .helpdesk-vchart-bar-closed {
    background: hsl(152 50% 48%);
  }

  /* Period label — fixed below bars */
  .helpdesk-vchart-label {
    flex-shrink: 0;
    font-size: var(--text-xs, 0.75rem);
    color: var(--app-muted, #6c757d);
    padding-top: 0.3rem;
    white-space: nowrap;
    text-align: center;
  }

  /* Legend */
  .helpdesk-vchart-legend {
    display: flex;
    justify-content: center;
    gap: calc(var(--app-spacing) * 1.25);
    padding-top: calc(var(--app-spacing) * 0.5);
    font-size: var(--text-xs, 0.75rem);
    color: var(--app-muted, #6c757d);
  }

  .helpdesk-vchart-legend-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
  }

  .helpdesk-vchart-legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
  }

  .helpdesk-vchart-dot-created {
    background: hsl(0 65% 60%);
  }

  .helpdesk-vchart-dot-closed {
    background: hsl(152 50% 48%);
  }

  /* Contract timeline (swimlane) */
  .helpdesk-tl {
    padding: 0.75rem;
  }

  .helpdesk-tl-body {
    position: relative;
  }

  .helpdesk-tl-guides {
    position: absolute;
    inset: 0;
    margin-left: calc(7.5rem + 0.625rem); /* align with tracks */
    pointer-events: none;
    z-index: 0;
  }

  .helpdesk-tl-guide {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--app-border-subtle, #e9ecef);
  }

  .helpdesk-tl-rows {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1;
  }

  .helpdesk-tl-row {
    display: grid;
    grid-template-columns: 7.5rem 1fr;
    align-items: center;
    gap: 0.625rem;
    min-height: 1.5rem;
  }

  .helpdesk-tl-row-clickable {
    cursor: pointer;
    border-radius: var(--app-border-radius);
    padding: 0.2rem 0.375rem;
    margin: -0.2rem -0.375rem;
    transition: background 0.15s ease;
  }

  .helpdesk-tl-row-clickable:hover {
    background: var(--app-background-muted, #f8f9fa);
  }

  .helpdesk-tl-row-clickable:focus-visible {
    outline: 2px solid var(--app-primary, #0d6efd);
    outline-offset: -2px;
  }

  .helpdesk-tl-label {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    text-align: right;
    min-width: 0;
  }

  .helpdesk-tl-type {
    font-size: var(--text-sm, 0.875rem);
    font-weight: var(--font-semibold, 600);
    color: var(--app-fg, #212529);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .helpdesk-tl-amount {
    font-size: 0.6875rem;
    color: var(--app-muted, #6c757d);
    white-space: nowrap;
  }

  .helpdesk-tl-track {
    position: relative;
    height: 1.25rem;
    background: var(--app-border-subtle, #f0f0f0);
    border-radius: 3px;
    overflow: visible;
  }

  .helpdesk-tl-bar {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 3px;
    min-width: 4px;
    transition: opacity 0.15s ease;
  }

  .helpdesk-tl-bar:hover {
    opacity: 0.8;
  }

  .helpdesk-tl-bar-active {
    background: var(--app-success, #198754);
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }

  .helpdesk-tl-bar-ended {
    background: hsl(0 0% 72%);
  }

  .helpdesk-tl-bar-arrow {
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 0.625rem solid transparent;
    border-bottom: 0.625rem solid transparent;
    border-left: 6px solid var(--app-success, #198754);
  }

  /* Time axis with year ticks */
  .helpdesk-tl-axis {
    position: relative;
    height: 1.25rem;
    margin-left: calc(7.5rem + 0.625rem); /* align with tracks */
    border-top: 1px solid var(--app-border, #dee2e6);
    margin-top: 0.5rem;
  }

  .helpdesk-tl-tick {
    position: absolute;
    top: 0;
    width: 0;
  }

  .helpdesk-tl-tick::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 5px;
    background: var(--app-border, #dee2e6);
  }

  .helpdesk-tl-tick-label {
    position: absolute;
    top: 6px;
    left: 0;
    transform: translateX(-50%);
    font-size: 0.625rem;
    color: var(--app-muted, #6c757d);
    white-space: nowrap;
  }

  /* Legend */
  .helpdesk-tl-legend {
    display: flex;
    justify-content: center;
    gap: calc(var(--app-spacing) * 1.25);
    padding-top: calc(var(--app-spacing) * 0.5);
    font-size: var(--text-xs, 0.75rem);
    color: var(--app-muted, #6c757d);
  }

  .helpdesk-tl-legend-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
  }

  .helpdesk-tl-legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
  }

  .helpdesk-tl-dot-active {
    background: var(--app-success, #198754);
  }

  .helpdesk-tl-dot-ended {
    background: hsl(0 0% 72%);
  }

  @media (max-width: 560px) {
    .helpdesk-tl-row {
      grid-template-columns: 5rem 1fr;
    }

    .helpdesk-tl-axis,
    .helpdesk-tl-guides {
      margin-left: calc(5rem + 0.625rem);
    }
  }

  /* Risk assessment — Stripe-style checks */
  .helpdesk-risk-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--app-border-subtle, #e9ecef);
  }

  .helpdesk-risk-header-icon {
    font-size: var(--text-sm, 0.875rem);
    line-height: 1;
  }

  .helpdesk-risk-summary-ok {
    color: var(--app-success, #198754);
  }
  .helpdesk-risk-summary-warn {
    color: hsl(38 92% 50%);
  }
  .helpdesk-risk-summary-critical {
    color: var(--app-danger, #dc3545);
  }

  .helpdesk-risk-header-label {
    font-size: var(--text-sm, 0.875rem);
    font-weight: var(--font-medium, 500);
    color: var(--app-fg, #212529);
  }

  .helpdesk-risk-checks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0;
  }

  .helpdesk-risk-check {
    padding: 0.75rem;
    border-bottom: 1px solid var(--app-border-subtle, #e9ecef);
    min-width: 0; /* prevent grid blowout with long values */
  }

  .helpdesk-risk-checks > .helpdesk-risk-check:last-child {
    border-bottom: none;
  }

  @media (min-width: 640px) {
    .helpdesk-risk-checks {
      grid-template-columns: 1fr 1fr;
    }

    .helpdesk-risk-check {
      border-right: 1px solid var(--app-border-subtle, #e9ecef);
    }

    .helpdesk-risk-check:nth-child(2n) {
      border-right: none;
    }

    /* Remove bottom border from last row */
    .helpdesk-risk-check:nth-last-child(-n + 2) {
      border-bottom: none;
    }
  }

  .helpdesk-risk-check-header {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 0.25rem;
  }

  .helpdesk-risk-icon {
    font-size: 0.8125rem;
    line-height: 1;
    flex-shrink: 0;
  }

  .helpdesk-risk-icon-ok {
    color: var(--app-success, #198754);
  }
  .helpdesk-risk-icon-warn {
    color: hsl(38 92% 50%);
  }

  .helpdesk-risk-check-label {
    font-size: var(--text-sm, 0.875rem);
    font-weight: var(--font-medium, 500);
    color: var(--app-fg, #212529);
  }

  .helpdesk-risk-check-value {
    font-size: 1.25rem;
    font-weight: var(--font-semibold, 600);
    line-height: 1.3;
    color: var(--app-fg, #212529);
    margin-bottom: 0.125rem;
    padding-left: 1.1875rem; /* align with label (icon width + gap) */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .helpdesk-risk-check-desc {
    font-size: var(--text-xs, 0.75rem);
    color: var(--app-muted, #6c757d);
    line-height: 1.4;
    margin-bottom: 0.375rem;
    padding-left: 1.1875rem;
  }

  .helpdesk-risk-bar-wrapper {
    position: relative;
    height: 10px; /* tall enough for limit marker overshoot */
    margin: 0.375rem 0 0.25rem 1.1875rem;
    display: flex;
    align-items: center;
  }

  .helpdesk-risk-bar-track {
    position: relative;
    width: 100%;
    height: 4px;
    background: var(--app-border-subtle, #e9ecef);
    border-radius: 2px;
    overflow: hidden;
  }

  .helpdesk-risk-bar-fill {
    position: absolute;
    inset: 0 auto 0 0;
    height: 100%;
    border-radius: 2px;
    max-width: 100%;
    transition: width 0.4s ease;
  }

  .helpdesk-risk-bar-ok {
    background: var(--app-success, #198754);
  }

  .helpdesk-risk-bar-over {
    background: hsl(38 92% 50%);
  }

  .helpdesk-risk-bar-limit {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: var(--app-fg, #212529);
    border-radius: 1px;
    opacity: 0.35;
    transform: translateX(-1px);
  }

  .helpdesk-risk-bar-legend {
    font-size: var(--text-xs, 0.75rem);
    color: var(--app-muted, #6c757d);
    padding-left: 1.1875rem;
  }

  /* Recommendation alert cards */
  .helpdesk-rec-list {
    display: flex;
    flex-direction: column;
    gap: calc(var(--app-spacing) * 0.5);
  }

  .helpdesk-rec-card {
    display: block;
    padding: 0.75rem 0.875rem;
    border: 1px solid var(--app-border, #d0d7de);
    border-left: 3px solid var(--app-muted, #6c757d);
    border-radius: var(--app-border-radius);
    background: var(--app-card-background-color, #fff);
    text-decoration: none;
    color: inherit;
    transition:
      box-shadow 0.15s ease,
      border-color 0.15s ease;
  }

  a.helpdesk-rec-card:hover {
    box-shadow: 0 1px 4px rgb(0 0 0 / 0.06);
  }

  a.helpdesk-rec-card:focus-visible {
    outline: 2px solid var(--app-primary, #0d6efd);
    outline-offset: -2px;
  }

  .helpdesk-rec-critical {
    border-left-color: var(--app-danger, #dc3545);
  }
  .helpdesk-rec-high {
    border-left-color: hsl(25 95% 53%);
  }
  .helpdesk-rec-medium {
    border-left-color: hsl(38 92% 50%);
  }
  .helpdesk-rec-low {
    border-left-color: var(--app-primary, #0d6efd);
  }

  .helpdesk-rec-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
  }

  .helpdesk-rec-card-ticket {
    font-size: var(--text-sm, 0.875rem);
    font-weight: var(--font-semibold, 600);
    color: var(--app-fg, #212529);
  }

  .helpdesk-rec-card-age {
    font-size: var(--text-xs, 0.75rem);
    font-weight: var(--font-medium, 500);
    color: var(--app-muted, #6c757d);
    white-space: nowrap;
  }

  .helpdesk-rec-card-message {
    font-size: var(--text-sm, 0.875rem);
    line-height: 1.45;
    color: var(--app-muted, #6c757d);
  }

  /* ── Sales split layout (contacts 2/3 + meetings 1/3) ─ */

  .helpdesk-sales-split {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: calc(var(--app-spacing) * 1.5);
    align-items: start;
  }

  .helpdesk-sales-split-main {
    min-width: 0;
    overflow: hidden;
  }

  .helpdesk-sales-split-aside {
    padding-left: calc(var(--app-spacing) * 1.5);
  }

  @media (max-width: 860px) {
    .helpdesk-sales-split {
      grid-template-columns: 1fr;
    }

    .helpdesk-sales-split-aside {
      padding-left: 0;
      padding-top: calc(var(--app-spacing) * 1);
    }
  }

  /* ── Meetings timeline ───────────────────────────────── */

  .helpdesk-meetings-group-header {
    font-size: var(--text-xs, 0.75rem);
    font-weight: var(--font-semibold, 600);
    letter-spacing: var(--tracking-wide, 0.025em);
    text-transform: uppercase;
    color: var(--app-muted, #6c757d);
    padding-block: calc(var(--app-spacing) * 0.5);
    margin-block-start: calc(var(--app-spacing) * 1.25);
    border-bottom: 1px solid var(--app-border, #d0d7de);
  }

  .helpdesk-meetings-group-header:first-child {
    margin-block-start: 0;
  }

  .helpdesk-meetings-group-header-past {
    margin-block-start: calc(var(--app-spacing) * 1.5);
  }

  .helpdesk-meetings-month {
    padding-block-start: calc(var(--app-spacing) * 0.75);
  }

  .helpdesk-meetings-month-label {
    display: block;
    font-size: var(--text-xs, 0.75rem);
    font-weight: var(--font-medium, 500);
    color: var(--app-muted, #6c757d);
    padding-block-end: calc(var(--app-spacing) * 0.35);
  }

  .helpdesk-meetings-card {
    display: flex;
    flex-direction: column;
    gap: calc(var(--app-spacing) * 0.2);
    padding: calc(var(--app-spacing) * 0.6) calc(var(--app-spacing) * 0.75);
    border-left: 3px solid var(--app-border, #d0d7de);
    border-radius: 0;
    transition: background 0.15s ease;
  }

  .helpdesk-meetings-card-released {
    border-left-color: var(--app-success, #198754);
  }

  .helpdesk-meetings-card-pending {
    border-left-color: hsl(40 75% 55%);
  }

  .helpdesk-meetings-card:hover {
    background: var(--app-hover-background, hsl(0 0% 0% / 0.03));
  }

  .helpdesk-meetings-card + .helpdesk-meetings-card {
    margin-block-start: calc(var(--app-spacing) * 0.6);
  }

  .helpdesk-meetings-card-body {
    min-width: 0;
  }

  .helpdesk-meetings-card-comment {
    margin: 0;
    font-size: var(--text-sm, 0.875rem);
    font-weight: var(--font-medium, 500);
    line-height: 1.4;
    color: var(--app-contrast, #1f2937);
  }

  .helpdesk-meetings-card-secondary {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: calc(var(--app-spacing) * 0.35);
    font-size: var(--text-xs, 0.75rem);
    color: var(--app-muted, #6c757d);
  }

  .helpdesk-meetings-card-context {
    display: flex;
    align-items: center;
    gap: calc(var(--app-spacing) * 0.25);
  }

  .helpdesk-meetings-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: var(--font-medium, 500);
    line-height: 1.4;
  }

  .helpdesk-meetings-badge-released {
    background: hsl(142 64% 93%);
    color: hsl(142 64% 28%);
  }

  .helpdesk-meetings-badge-pending {
    background: hsl(40 80% 92%);
    color: hsl(40 60% 30%);
  }

  @media (prefers-color-scheme: dark) {
    .helpdesk-meetings-badge-released {
      background: hsl(142 40% 18%);
      color: hsl(142 60% 70%);
    }

    .helpdesk-meetings-badge-pending {
      background: hsl(40 40% 18%);
      color: hsl(40 60% 70%);
    }
  }

  /* Handover protocol schema editor — split layout */
  .handover-schema-split {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: var(--app-spacing);
    align-items: start;
  }

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

  .handover-schema-split-preview {
    border: 1px solid var(--app-card-border-color);
    border-radius: var(--app-border-radius);
    background: var(--app-card-background-color);
    position: sticky;
    top: calc(var(--app-topbar-height) + var(--app-spacing) * 5);
  }

  .handover-schema-preview-header {
    font-weight: 600;
    padding: calc(var(--app-spacing) * 0.6) calc(var(--app-spacing) * 0.75);
    border-bottom: 1px solid var(--app-card-border-color);
    font-size: 0.875rem;
  }

  .handover-schema-preview {
    padding: calc(var(--app-spacing) * 0.75);
  }

  .handover-schema-preview-empty {
    color: var(--app-muted-color);
    font-style: italic;
  }

  .handover-schema-preview-form {
    display: grid;
    gap: calc(var(--app-spacing) * 0.6);
  }

  .handover-schema-preview-form h3 {
    margin: calc(var(--app-spacing) * 0.25) 0 0;
    font-size: 1rem;
  }

  .handover-schema-preview-form p {
    margin: 0;
    color: var(--app-muted-color);
  }

  .handover-schema-preview-field {
    display: flex;
    flex-direction: column;
    gap: calc(var(--app-spacing) * 0.15);
  }

  .handover-schema-preview-field label {
    font-size: 0.8125rem;
    font-weight: 500;
  }

  .handover-schema-preview-field input:not([type="checkbox"]),
  .handover-schema-preview-field textarea,
  .handover-schema-preview-field select {
    width: 100%;
  }

  .handover-schema-preview-field:has(> input[type="checkbox"]) {
    flex-direction: row;
    align-items: center;
    gap: 0;
  }

  .handover-schema-preview-field > input[type="checkbox"] {
    width: 1.25em;
    height: 1.25em;
    flex-shrink: 0;
    margin-bottom: 0;
  }

  .handover-schema-preview-form [data-field-index] {
    transition:
      background-color 0.15s ease,
      border-color 0.15s ease;
    border-radius: var(--app-border-radius);
    padding: calc(var(--app-spacing) * 0.3);
    padding-inline-start: calc(var(--app-spacing) * 0.5);
    margin: calc(var(--app-spacing) * -0.3);
    margin-inline-start: calc(var(--app-spacing) * -0.5);
    border-left: 2px solid transparent;
  }

  .handover-schema-preview-highlight {
    background-color: color-mix(
      in srgb,
      var(--app-primary, #635bff) 5%,
      transparent
    );
    border-left-color: var(--app-primary, #635bff);
  }

  .handover-schema-preview-required {
    color: var(--app-danger-color, hsl(0 70% 55%));
  }

  /* Handover protocol schema editor — reset core margin on buttons/inputs/selects */
  .handover-schema-split-editor button[type="button"],
  .handover-schema-row select,
  .handover-schema-row input,
  .handover-schema-row textarea,
  .handover-schema-row label {
    margin-bottom: 0;
  }

  /* Handover protocol schema editor — insert divider */
  .handover-schema-insert-divider {
    display: flex;
    align-items: center;
    gap: calc(var(--app-spacing) * 0.5);
    padding: calc(var(--app-spacing) * 0.25) 0;
  }

  .handover-schema-insert-divider::before,
  .handover-schema-insert-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--app-card-border-color);
  }

  .handover-schema-insert-button {
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border-radius: 50%;
    font-size: 0.75rem;
    flex-shrink: 0;
  }

  /* Handover protocol schema editor — field cards */
  .handover-schema-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(var(--app-spacing) * 0.75);
    padding: calc(var(--app-spacing) * 2) var(--app-spacing);
    border: 2px dashed var(--app-card-border-color);
    border-radius: var(--app-border-radius);
    text-align: center;
  }

  .handover-schema-empty-state > p {
    color: var(--app-muted-color);
    margin: 0;
  }

  .handover-schema-list {
    display: grid;
    gap: calc(var(--app-spacing) * 0.75);
    margin-bottom: var(--app-spacing);
  }

  .handover-schema-row {
    border: 1px solid var(--app-card-border-color);
    border-radius: var(--app-border-radius);
    padding: calc(var(--app-spacing) * 0.75);
    background: var(--app-card-background-color);
  }

  .handover-schema-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(var(--app-spacing) * 0.5);
    margin-bottom: calc(var(--app-spacing) * 0.5);
  }

  .handover-schema-row-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--app-muted-color);
  }

  .handover-schema-row-actions {
    display: flex;
    gap: calc(var(--app-spacing) * 0.25);
    flex-shrink: 0;
  }

  .handover-schema-row > .handover-schema-field-group {
    margin-bottom: calc(var(--app-spacing) * 0.5);
  }

  .handover-schema-row-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: calc(var(--app-spacing) * 0.5);
    align-items: end;
  }

  .handover-schema-row-required {
    margin-top: calc(var(--app-spacing) * 0.4);
  }

  .handover-schema-field-group {
    display: flex;
    flex-direction: column;
    gap: calc(var(--app-spacing) * 0.2);
  }

  .handover-schema-field-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--app-muted-color);
  }

  .handover-schema-field-group input[type="text"],
  .handover-schema-field-group textarea,
  .handover-schema-field-group select {
    width: 100%;
  }

  .handover-schema-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: calc(var(--app-spacing) * 0.25);
    cursor: pointer;
  }

  .handover-schema-options {
    margin-top: calc(var(--app-spacing) * 0.65);
    padding-top: calc(var(--app-spacing) * 0.65);
    border-top: 1px solid var(--app-card-border-color);
  }

  .handover-schema-options-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: calc(var(--app-spacing) * 0.4);
  }

  .handover-schema-options-header > strong {
    font-size: 0.8125rem;
  }

  .handover-schema-option-row {
    display: flex;
    gap: calc(var(--app-spacing) * 0.35);
    align-items: center;
    margin-bottom: calc(var(--app-spacing) * 0.35);
  }

  .handover-schema-option-row input[type="text"] {
    flex: 1;
    min-width: 0;
  }

  /* ── Wizard (Stripe-style two-step assistant) ───────────────────────── */

  /* ── Wizard (Stripe-style creation assistant) ─────────────────────── */

  .app-wizard-content {
    max-width: 32rem;
  }

  .app-wizard-header {
    display: flex;
    align-items: center;
    gap: calc(var(--app-spacing) * 0.75);
    margin-bottom: calc(var(--app-spacing) * 1.25);
  }

  .app-wizard-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--app-border-radius);
    color: var(--app-muted-color);
    text-decoration: none;
    transition:
      background 0.15s ease,
      color 0.15s ease;
  }

  .app-wizard-back:hover {
    background: var(--app-background-muted, #f8f9fa);
    color: var(--app-color);
  }

  .app-wizard-title {
    font-size: var(--text-xl, 1.25rem);
    font-weight: var(--font-semibold, 600);
    margin: 0;
  }

  /* Step indicator — compact, not full-width */
  .app-wizard-steps {
    display: inline-flex;
    align-items: center;
    margin: 0 0 calc(var(--app-spacing) * 1.5);
  }

  .app-wizard-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .app-wizard-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    font-size: var(--text-sm, 0.875rem);
    font-weight: var(--font-semibold, 600);
    border: 2px solid var(--app-border);
    color: var(--app-muted-color);
    background: transparent;
    transition:
      border-color 0.2s ease,
      background 0.2s ease,
      color 0.2s ease;
    flex-shrink: 0;
  }

  .app-wizard-step-label {
    font-size: var(--text-sm, 0.875rem);
    color: var(--app-muted-color);
    white-space: nowrap;
  }

  .app-wizard-step.is-active .app-wizard-step-number {
    border-color: var(--app-primary, #635bff);
    background: var(--app-primary, #635bff);
    color: #fff;
  }

  .app-wizard-step.is-active .app-wizard-step-label {
    color: var(--app-color);
    font-weight: var(--font-medium, 500);
  }

  .app-wizard-step.is-completed .app-wizard-step-number {
    border-color: var(--app-success, #198754);
    background: var(--app-success, #198754);
    color: #fff;
  }

  .app-wizard-step.is-completed .app-wizard-step-label {
    color: var(--app-muted-color);
  }

  .app-wizard-step-connector {
    width: 2rem;
    height: 2px;
    background: var(--app-border);
    margin: 0 0.5rem;
    flex-shrink: 0;
    transition: background 0.2s ease;
  }

  .app-wizard-step-connector.is-completed {
    background: var(--app-success, #198754);
  }

  /* Card */
  .app-wizard-card {
    background: var(--app-card-background-color, #fff);
    border: 1px solid var(--app-card-border-color, #e5e7eb);
    border-radius: calc(var(--app-border-radius) * 2);
    padding: calc(var(--app-spacing) * 1.5);
    box-shadow: 0 1px 3px rgb(0 0 0 / 0.04);
  }

  .app-wizard-card-heading {
    font-size: var(--text-lg, 1.125rem);
    font-weight: var(--font-semibold, 600);
    margin: 0 0 0.25rem;
  }

  .app-wizard-card-description {
    font-size: var(--text-sm, 0.875rem);
    color: var(--app-muted-color);
    margin: 0 0 calc(var(--app-spacing) * 1.25);
  }

  .app-wizard-field-group {
    margin-bottom: calc(var(--app-spacing) * 1.25);
  }

  .app-wizard-field-group > label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: var(--text-sm, 0.875rem);
    font-weight: var(--font-medium, 500);
  }

  .app-wizard-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: calc(var(--app-spacing) * 1.5);
    padding-top: calc(var(--app-spacing) * 1.25);
    border-top: 1px solid var(--app-card-border-color, #e5e7eb);
  }

  /* Handover aside — subtle links in hgroup */
  .app-details-aside-section hgroup a {
    color: inherit;
    text-decoration: none;
  }

  .app-details-aside-section hgroup a:hover {
    text-decoration: underline;
    text-underline-offset: 0.15em;
  }

  /* Handover form — shared styles */
  .handover-form-heading {
    margin-top: calc(var(--app-spacing) * 1.25);
    margin-bottom: calc(var(--app-spacing) * 0.75);
  }

  .handover-form-heading:first-child {
    margin-top: 0;
  }

  .handover-form-required {
    color: var(--app-danger-color, hsl(0 70% 55%));
  }

  .handover-form-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
  }

  .handover-form-checkbox-label input[type="checkbox"] {
    width: 1.25em;
    height: 1.25em;
    flex-shrink: 0;
    margin-bottom: 0;
  }

  @media (max-width: 576px) {
    .app-wizard-step-label {
      display: none;
    }

    .app-wizard-card {
      padding: var(--app-spacing);
    }
  }

  /* ── Revision timeline (commit graph) ────────────────────────────── */

  .handover-revision-timeline {
    position: relative;
    display: flex;
    flex-direction: column;
    padding-left: 1.25rem;
  }

  /* Vertical line */
  .handover-revision-timeline::before {
    content: "";
    position: absolute;
    left: 2.9px;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 1px;
    background: var(--app-border);
  }

  .handover-revision-item {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0.25rem;
    padding: calc(var(--app-spacing) * 0.4) 0;
  }

  /* Circle node */
  .handover-revision-item::before {
    content: "";
    position: absolute;
    left: -1.25rem;
    top: calc(var(--app-spacing) * 0.4 + 0.35rem);
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    border: 2px solid var(--app-border);
    background: var(--app-background-color);
    z-index: 1;
    flex-shrink: 0;
  }

  .handover-revision-item.is-active::before {
    border-color: var(--app-primary);
    background: var(--app-primary);
  }

  .handover-revision-item:first-child::before {
    border-color: var(--app-primary);
    background: var(--app-primary);
  }

  .handover-revision-link {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex: 1;
    min-width: 0;
    padding: calc(var(--app-spacing) * 0.25) calc(var(--app-spacing) * 0.4);
    border-radius: var(--app-border-radius);
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
  }

  .handover-revision-link:hover {
    background: color-mix(in srgb, var(--app-primary) 6%, transparent);
    text-decoration: none;
  }

  .handover-revision-item.is-active .handover-revision-link {
    background: color-mix(in srgb, var(--app-primary) 10%, transparent);
  }

  .handover-revision-compare {
    flex-shrink: 0;
    padding: 0.2rem;
    margin-top: calc(var(--app-spacing) * 0.25);
    color: var(--app-muted-color);
    text-decoration: none;
    border-radius: var(--app-border-radius);
    opacity: 0.55;
    transition:
      opacity 0.15s ease,
      color 0.15s ease;
  }

  .handover-revision-item:hover .handover-revision-compare,
  .handover-revision-compare:focus-visible {
    opacity: 1;
  }

  .handover-revision-compare:hover {
    color: var(--app-primary);
  }

  .handover-revision-compare:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--app-primary) 45%, transparent);
    outline-offset: 2px;
  }

  .handover-revision-number {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: var(--font-semibold, 600);
    font-size: var(--text-sm);
  }

  .handover-revision-number .badge {
    font-size: var(--text-xs);
    padding: 0.05em 0.4em;
  }

  .handover-revision-meta {
    display: flex;
    flex-direction: column;
    font-size: var(--text-xs);
    color: var(--app-muted-color);
    line-height: 1.35;
  }

  .handover-revision-change {
    color: var(--app-contrast, #1f2937);
    font-size: var(--text-xs);
  }

  .handover-revision-restore {
    margin-top: calc(var(--app-spacing) * 0.75);
  }

  .handover-revision-restore button {
    width: 100%;
    margin-bottom: 0;
  }

  /* ── Revision banner ───────────────────────────────────────────────── */

  .handover-revision-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--app-spacing);
    padding: calc(var(--app-spacing) * 0.6) calc(var(--app-spacing) * 1);
    margin: 0 calc(var(--app-spacing) * 2) calc(var(--app-spacing) * 0.5);
    background: color-mix(in srgb, var(--app-primary) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--app-primary) 20%, transparent);
    border-radius: var(--app-border-radius);
    font-size: var(--text-sm);
  }

  .handover-revision-banner p {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
  }

  .handover-revision-banner a {
    flex-shrink: 0;
    margin-bottom: 0;
  }

  /* ── Diff highlighting (git-diff style) ──────────────────────────── */

  .handover-diff-field {
    position: relative;
    border-radius: var(--app-border-radius);
    padding: calc(var(--app-spacing) * 0.5) calc(var(--app-spacing) * 0.75);
    margin-left: calc(var(--app-spacing) * -0.75);
    margin-right: calc(var(--app-spacing) * -0.75);
  }

  .handover-diff-changed {
    background: color-mix(in srgb, hsl(40 90% 50%) 8%, transparent);
    border-left: 3px solid hsl(40 90% 50%);
  }

  .handover-diff-added {
    background: color-mix(in srgb, hsl(145 60% 42%) 8%, transparent);
    border-left: 3px solid hsl(145 60% 42%);
  }

  .handover-diff-removed {
    background: color-mix(in srgb, hsl(0 70% 55%) 8%, transparent);
    border-left: 3px solid hsl(0 70% 55%);
  }

  .handover-diff-removed input,
  .handover-diff-removed select,
  .handover-diff-removed textarea {
    text-decoration: line-through;
    opacity: 0.5;
  }

  .handover-diff-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: calc(var(--app-spacing) * 0.15);
    font-size: var(--text-xs);
    line-height: 1.3;
  }

  .handover-diff-indicator::before {
    content: "±";
    font-weight: var(--font-semibold, 600);
    color: hsl(40 70% 45%);
  }

  .handover-diff-added .handover-diff-indicator::before {
    content: "+";
    color: hsl(145 60% 38%);
  }

  .handover-diff-removed .handover-diff-indicator::before {
    content: "−";
    color: hsl(0 70% 50%);
  }

  /* Domain detail page */
  .helpdesk-domain-url-prominent {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    word-break: break-all;
    text-decoration: none;
  }

  .helpdesk-domain-url-prominent:hover {
    text-decoration: underline;
  }

  .helpdesk-domain-overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: calc(var(--app-spacing) * 1.25);
    align-items: start;
  }

  @media (max-width: 760px) {
    .helpdesk-domain-overview-grid {
      grid-template-columns: 1fr;
    }
  }

  /* Related domains — compact aside list */
  .helpdesk-domain-related-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(var(--app-spacing) * 0.35);
    padding: calc(var(--app-spacing) * 0.4) 0;
    border-bottom: 1px solid var(--app-border-subtle, #f0f0f0);
    text-decoration: none;
    color: inherit;
    font-size: var(--text-sm);
  }

  .helpdesk-domain-related-item:last-child {
    border-bottom: 0;
  }

  .helpdesk-domain-related-item:hover .helpdesk-domain-related-item-url {
    text-decoration: underline;
  }

  .helpdesk-domain-related-item-url {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }

  /* Handover list — Stripe-style compact clickable rows */
  .helpdesk-domain-handover-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--app-border-subtle, #f0f0f0);
    border-radius: var(--app-border-radius);
    overflow: hidden;
  }

  .helpdesk-domain-handover-item {
    display: block;
    padding: calc(var(--app-spacing) * 0.65) calc(var(--app-spacing) * 0.75);
    background: var(--app-card-background-color, #fff);
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s ease;
  }

  .helpdesk-domain-handover-item:hover {
    background: var(--app-card-sectioning-background-color, #fafafa);
  }

  .helpdesk-domain-handover-item-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: calc(var(--app-spacing) * 0.5);
  }

  .helpdesk-domain-handover-item-product {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--app-contrast, #1f2937);
  }

  .helpdesk-domain-handover-item-meta {
    margin-top: 0.15rem;
    font-size: var(--text-xs);
    color: var(--app-muted, #6c757d);
  }

  td.gridjs-td .badge[role="button"] {
    cursor: pointer;
    transition: filter 0.12s ease;
  }

  td.gridjs-td .badge[role="button"]:hover {
    filter: brightness(0.92);
  }

  td.gridjs-td .badge[role="button"]:focus {
    outline: 2px solid var(--app-primary, #0d6efd);
    outline-offset: 1px;
  }

  td.gridjs-td .app-cell-note {
    display: inline-block;
    max-width: 24ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    color: var(--app-muted, #6c757d);
  }
}
