/* SW Project Manager v0.7.9.8.75
 * Final Claude fidelity regression layer.
 * Admin-shell responsive/interaction polish only. No dashboard restructuring,
 * portal-shell restyling, route changes or business-logic semantics.
 */

/* Keep the shared shell/content resilient against long labels, refs and controls. */
.swpm-app-shell,
.swpm-app-shell .swpm-main,
.swpm-app-shell .swpm-content,
.swpm-app-shell .swpm-card,
.swpm-app-shell .swpm-card-body,
.swpm-app-shell .swpm-card-header,
.swpm-app-shell .swpm-form-grid > *,
.swpm-app-shell .swpm-detail-grid > * {
  min-width: 0;
}

.swpm-app-shell .swpm-content {
  overflow-wrap: break-word;
}

.swpm-app-shell .swpm-card-header {
  gap: 8px 14px;
}

.swpm-app-shell .swpm-card-header > div:first-child {
  min-width: 0;
}

.swpm-app-shell .swpm-card-header h2,
.swpm-app-shell .swpm-card-header h3 {
  overflow-wrap: anywhere;
}

/* Workspace rails: one-line, touch-safe and self-revealing when the active item is clipped. */
.swpm-app-shell .swpm-tabs,
.swpm-app-shell .swpm-cost-detail-tabs,
.swpm-app-shell .swpm-invoice-workbench-tabs,
.swpm-app-shell .swpm-system-health-tabs,
.swpm-app-shell .swpm-work-queue-tabs,
.swpm-app-shell .swpm-time-workbench-tabs,
.swpm-app-shell [role="tablist"] {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  scroll-padding-inline: 12px;
  -webkit-overflow-scrolling: touch;
}

.swpm-app-shell [role="tablist"] > * {
  flex: 0 0 auto;
}

/* Dense tables stay inside their own surface instead of widening the viewport. */
.swpm-app-shell .swpm-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.swpm-app-shell .swpm-table {
  font-variant-numeric: tabular-nums;
}

.swpm-app-shell .swpm-table th,
.swpm-app-shell .swpm-table td {
  vertical-align: middle;
}

.swpm-app-shell .swpm-table td a,
.swpm-app-shell .swpm-table td strong,
.swpm-app-shell .swpm-table td .swpm-row-note {
  overflow-wrap: anywhere;
}

/* Action rows must wrap before they collide with content or force viewport overflow. */
.swpm-app-shell .swpm-actions,
.swpm-app-shell .swpm-page-actions,
.swpm-app-shell .swpm-row-icon-actions,
.swpm-app-shell .swpm-form-actions,
.swpm-app-shell .swpm-topbar-actions {
  min-width: 0;
  flex-wrap: wrap;
}

.swpm-app-shell .swpm-btn,
.swpm-app-shell button,
.swpm-app-shell input,
.swpm-app-shell select,
.swpm-app-shell textarea {
  max-width: 100%;
}

/* Native disclosures are part of the Claude on-demand hierarchy; make them consistent and keyboard-clear. */
.swpm-app-shell details > summary {
  border-radius: 6px;
  outline: none;
}

.swpm-app-shell details > summary:focus-visible,
.swpm-app-shell .swpm-btn:focus-visible,
.swpm-app-shell .swpm-tab:focus-visible,
.swpm-app-shell a:focus-visible,
.swpm-app-shell button:focus-visible,
.swpm-app-shell input:focus-visible,
.swpm-app-shell select:focus-visible,
.swpm-app-shell textarea:focus-visible {
  outline: 2px solid var(--swpm-info, #2563b8);
  outline-offset: 2px;
}

.swpm-app-shell details > summary {
  overflow-wrap: anywhere;
}

.swpm-app-shell details > summary > span,
.swpm-app-shell details > summary > strong {
  min-width: 0;
}

/* Long technical evidence must be contained when it is intentionally opened. */
.swpm-app-shell pre,
.swpm-app-shell code,
.swpm-app-shell .swpm-code-block,
.swpm-app-shell .swpm-pre {
  max-width: 100%;
}

.swpm-app-shell pre,
.swpm-app-shell .swpm-code-block,
.swpm-app-shell .swpm-pre {
  overflow: auto;
  overscroll-behavior: contain;
}

/* Project row action menus: stable trigger size and no layout shift when opened. */
.swpm-app-shell .swpm-row-action-menu-v829 > summary,
.swpm-app-shell .swpm-row-action-menu-v839 > summary {
  flex: 0 0 auto;
}

/* Final source-audit cleanup: secondary disclosure labels stay understated. */
.swpm-app-shell .swpm-people-secondary-v73 > summary,
.swpm-app-shell .swpm-finance-secondary-control-v72 > summary,
.swpm-app-shell .swpm-work-secondary-control > summary,
.swpm-app-shell .swpm-system-details-v74 > summary,
.swpm-app-shell .swpm-system-inline-details-v74 > summary {
  line-height: 1.3;
}

/* Avoid sudden horizontal layout shift when scrollable/long system evidence opens. */
@supports (scrollbar-gutter: stable) {
  .swpm-app-shell .swpm-table-wrap,
  .swpm-app-shell pre,
  .swpm-app-shell .swpm-code-block,
  .swpm-app-shell .swpm-pre {
    scrollbar-gutter: stable;
  }
}

@media (max-width: 1023px) {
  .swpm-app-shell .swpm-content {
    padding-inline: 16px;
  }

  .swpm-app-shell .swpm-card-header {
    align-items: flex-start;
  }
}

@media (max-width: 767px) {
  .swpm-app-shell .swpm-content {
    padding-inline: 12px;
  }

  .swpm-app-shell .swpm-card-header,
  .swpm-app-shell .swpm-system-summary-v74 {
    gap: 8px;
  }

  .swpm-app-shell .swpm-card-header > .swpm-actions,
  .swpm-app-shell .swpm-card-header > .swpm-page-actions {
    width: 100%;
    margin-left: 0;
  }

  .swpm-app-shell .swpm-card-header > .swpm-actions .swpm-btn,
  .swpm-app-shell .swpm-card-header > .swpm-page-actions .swpm-btn {
    flex: 0 1 auto;
  }

  .swpm-app-shell details > summary {
    min-height: 38px;
  }

  .swpm-app-shell .swpm-row-action-menu-v829 > summary,
  .swpm-app-shell .swpm-row-action-menu-v839 > summary {
    min-height: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .swpm-app-shell *,
  .swpm-app-shell *::before,
  .swpm-app-shell *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
