/* =============================================================================
   CUSTOM CSS (loaded after app.css)
   ============================================================================= */

/* ─── 1) Variables ───────────────────────────────────────────────────────────── */
:root {
  --header-height: 70px;
  --sidebar-width: 300px;
  --psu-blue: #041e42;
  --sidebar-bg: #0a4c86;
  --sidebar-hover: #0a4c51;
  --link-color: #ecf0f1;
}

/* ─── 2) Form font sizing ───────────────────────────────────────────────────── */
.form-label {
  font-size: 1.25rem;
}

.form-control,
.form-check-label {
  font-size: 1.125rem;
}

/* make all Bootstrap <select> elements the same size as inputs */
.form-select {
  font-size: 1.125rem !important;
}

/* bump up form-card titles */
.card-title,
.card-header .card-title,
.card-header h5 {
  font-size: 1.5rem !important;
  line-height: 1.4;
  /* optional, for better readability */
}

/* ── enlarge help text under form fields ─────────────────────────────────── */
.form-text {
  font-size: 1rem !important;
  line-height: 1.4;
  /* for readability */
}

/* ── Enlarge all form buttons globally ─────────────────────────────────────── */
form .btn,
form input[type="submit"],
form input[type="button"],
form input[type="reset"] {
  font-size: 1.125rem !important;
  /* match form input text */
  padding: 0.75rem 1.5rem !important;
  /* larger hit area */
}

/* header typography & icons */
#page-topbar .navbar-header,
#page-topbar .navbar-brand-box,
#page-topbar .navbar-header * {
  font-size: 1.5rem !important;
}

/* 1) Only color the top-level header buttons & links white */
#page-topbar .header-item,
#page-topbar .dropdown-toggle {
  color: #ffffff !important;
}

#page-topbar button.header-item i,
#page-topbar .dropdown-toggle i,
#page-topbar .btn i {
  filter: brightness(0) invert(1) !important;
  font-size: 1.25rem !important;
}

/* preserve logo image colors */
#page-topbar .navbar-brand-box img {
  filter: none !important;
}

/* Sidebar  */
.vertical-menu {
  position: fixed !important;
  top: var(--header-height) !important;
  left: 0 !important;
  bottom: 0 !important;
  width: var(--sidebar-width) !important;
  background-color: var(--sidebar-bg) !important;
  z-index: 1000 !important;
  overflow-y: auto !important;
  /* only when needed */

  /* Firefox */
  scrollbar-width: thin;
  scrollbar-color: var(--sidebar-bg) transparent;
}

/* WebKit (Chrome, Edge, Safari) */
.vertical-menu::-webkit-scrollbar {
  width: 0;
  /* hide by default */
  transition: width .2s;
}

.vertical-menu:hover::-webkit-scrollbar {
  width: 8px;
  /* show on hover */
}

.vertical-menu::-webkit-scrollbar-track {
  background: transparent;
}

.vertical-menu::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}

/* logo inside sidebar */
.sidebar-logo-box {
  width: 80%;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 2.8rem;
  z-index: 800 !important;
}

.sidebar-logo-box .sidebar-logo-lg {
  max-height: 80%;
  width: auto;
}

/*5) Sidebar Menu Items */
#sidebar-menu .metismenu li {
  margin: 0.25rem 0;
}

/* links */
#sidebar-menu .metismenu li a {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  color: var(--link-color) !important;
  text-decoration: none;
}

#sidebar-menu .metismenu li a:hover,
#sidebar-menu .metismenu li.mm-active>a {
  background-color: var(--sidebar-hover) !important;
  color: #ffffff !important;
}

/* icons */
#sidebar-menu .metismenu li a i {
  font-size: 2rem;
  margin-right: 0.75rem;
  min-width: 1.25rem;
}

/* section titles */
#sidebar-menu .metismenu .menu-title {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #ffffff;
  margin: 0.5rem 0 0.5rem;
  padding: 0 1rem;
}

#sidebar-menu .metismenu .menu-title::before {
  content: "";
  display: block;
  height: 1px;
  background: #495057;
  margin: 0.5rem 1rem;
  width: calc(100% - 2rem);
}

/* remove any inline-spacer LIs */
#sidebar-menu .metismenu li[style] {
  display: none !important;
}

/* Main Content & Spacing  */
.main-content {
  margin-top: var(--header-height) !important;
  margin-left: var(--sidebar-width) !important;
  overflow: hidden;
}

.page-content {
  padding-top: calc(var(--header-height) + 20px) !important;
}

/* adjust for collapsed/sidebar-off on smaller screens */
@media (max-width: 992px) {

  .main-content,
  .vertical-menu {
    margin-left: 0 !important;
    margin-top: var(--header-height);
  }
}

/* Footer */
.footer {
  position: fixed !important;
  bottom: 0 !important;
  left: var(--sidebar-width) !important;
  right: 0 !important;
  width: calc(100% - var(--sidebar-width)) !important;
  z-index: 999 !important;
  padding: 1rem;
}

@media (max-width: 992px) {
  .footer {
    left: 0 !important;
    width: 100% !important;
  }
}

/* Container Width Overrides */
@media (min-width: 1400px) {
  .container-xxl {
    max-width: 2000px !important;
    margin: 0 auto !important;
  }
}

/* optional wide container utility */
.container-wide {
  max-width: 2400px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* 1) Allow the header to overflow its own bounds */
#page-topbar {
  overflow: visible !important;
  z-index: 9999 !important;
  /* stays above sidebar */
}

/* 2) Just lift the logo container above everything */
.navbar-brand-box {
  position: relative !important;
  z-index: 10001 !important;
  /* higher than the page-topbar itself */
}

/* 3) Tiny tweak right/left*/
.navbar-brand-box {
  margin-left: 1rem;
  /* optional, push it in a bit */
  margin-right: 1rem;
  /* optional, give breathing room */
}

/* Sidebar starts under the header  */
.vertical-menu,
.vertical-menu::before {
  position: fixed !important;
  top: var(--header-height) !important;
  left: 0 !important;
  bottom: 0 !important;
  width: var(--sidebar-width) !important;
  z-index: 1000 !important;
  /* below the header */
  padding-top: var(--header-height) !important;
  background-color: var(--sidebar-bg) !important;
  overflow-y: auto !important;
  /* allow scrollbar when items overflow */
  overflow-x: hidden !important;
  /* prevent unwanted horizontal scrollbars */
}

/* ─── Header sits on top of everything ─────────────────────────── */
#page-topbar {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  height: 70px !important;
  /* same 70px */
  z-index: 2000 !important;
  /* above the sidebar */
}

/* ─── Push page content down  ─────────────────────── */
.main-content {
  margin-top: 70px !important;
}

/* 1) Fix header on top */
#page-topbar {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 9999 !important;
}

/* 2) Push the sidebar below the header */
.sidebar-enable .vertical-menu,
.sidebar-enable .vertical-menu::before {
  position: fixed !important;
  top: 70px !important;
  left: 0 !important;
  bottom: 0 !important;
  width: var(--sidebar-width) !important;
  z-index: 1000 !important;
  /* below the header */
  padding-top: var(--header-height) !important;
  background-color: var(--sidebar-bg) !important;
  overflow-y: auto !important;
  /* allow scrollbar when items overflow */
  overflow-x: hidden !important;
  /* prevent unwanted horizontal scrollbars */
}

/* 3) Also nudge the content over & down */
.main-content {
  margin-top: 70px !important;
  /* same header height */
  margin-left: 300px !important;
}

/* mobile fallback */
@media (max-width: 992px) {

  .sidebar-enable .vertical-menu,
  .main-content {
    margin-left: 0 !important;
    margin-top: 70px !important;
  }
}

/* 1) Header on top, full width */
#page-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height) !important;
  /* use header height */
  background-color: var(--psu-blue) !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 2000 !important;
  /* above sidebar */
  overflow: visible !important;
  /* allow logo overflow */
}

/* 2) Ensure the brand box floats above everything */
#page-topbar .navbar-header {
  overflow: visible !important;
}

#page-topbar .navbar-brand-box {
  position: relative !important;
  z-index: 2010 !important;
  padding: 0 1rem;
}

/* 3) Show both small & large logo spans at all breakpoints */
#page-topbar .logo-sm,
#page-topbar .logo-lg {
  display: inline-block !important;
}

/* 4) Constrain & center the image */
#page-topbar .navbar-brand-box img {
  max-height: calc(var(--header-height) - 20px);
  height: auto;
  width: auto;
  display: block;
  margin: 0 auto;
}

/* 5) Sidebar starts just under header */
/* .vertical-menu consolidated above */

/* 6) Main content pushed over & down */
.main-content {
  margin-left: var(--sidebar-width) !important;
}

/*Make sure the sidebar starts below the header */
:root {
  --header-height: 70px;
}

/* .vertical-menu consolidated above */

/* 2) Strip any bg from the header brand box */
#page-topbar .navbar-brand-box,
#page-topbar .navbar-brand-box a.logo {
  background-color: transparent !important;
}

.sidebar-logo-box {
  background: none !important;
}

/* ── remove excess top‐margin from page content ─────────────────────────────── */
.main-content {
  /* keep just enough to clear the fixed header */
  margin-top: var(--header-height) !important;
}

.page-content {
  /* kill the extra padding */
  padding-top: 0 !important;
}


/* ───Pipeline Details list ──────────────────────────────────────────────────────── */

.bar-container {
  display: flex;
  align-items: center;
  /* center labels and bar vertically */
}

.bar-container small {
  width: 2rem;
  /* fixed width for min/max */
  text-align: center;
  line-height: 1.5rem;
  /* match bar height */
  font-size: 0.85rem;
}

.bar-container .progress {
  flex: 1;
  margin: 0 0.5rem;
  background-color: #6c757d;
  height: 1.5rem;
}

/* make wide-tooltip center its text and allow long species names on one line */
.tooltip.wide-tooltip .tooltip-inner {
  text-align: left;
  max-width: 500px;
  white-space: pre-line;
  font-size: 1.2rem
}

/* bump up the grid text */
.detail-table-container table,
.detail-table-container table th,
.detail-table-container table td {
  font-size: 1.2rem;
}

/* center all table header labels in the detail view */
.detail-table-container table thead th {
  text-align: center;
}

/* ───Pipeline list ──────────────────────────────────────── */
/* pipelines table larger text */
.pipeline-list-container table,
.pipeline-list-container table th,
.pipeline-list-container table td {
  font-size: 0.8rem;
  /* adjust up or down as you like */
  padding: 0.75rem 1.25rem;
  /* 0.75rem top/bottom, 1.25rem left/right */
}

/* center all table header labels in the pipeline list */
.pipeline-list-container {
  padding-left: 2rem;
  /* adjust to taste */
  padding-right: 2rem;
}

/* helper class to force small-button sizing */
.pipeline-list-container td form>button.btn-outline-danger {
  font-size: 0.875rem !important;
  /* same as .btn-sm */
  padding: 0.1rem 0.3rem !important;
  /* same as .btn-sm */
  line-height: 1.5 !important;
  /* ensure correct height */
}

/* shrink Start/Stop and Delete buttons in the monitor list to .btn-sm size */
.monitor-list-container td form>button.btn-outline-danger,
.monitor-list-container td form>button.btn-outline-success {
  font-size: 0.875rem !important;
  /* Bootstrap .btn-sm */
  padding: 0.25rem 0.5rem !important;
  line-height: 1.5 !important;
}

/* Custom button sizing classes */
.btn-uniform {
  min-height: 48px;
}


.btn-uniform-lg {
  min-height: 48px;
}

/* For anchor tags that need to behave like buttons */
.btn-anchor {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 51px;
}

/* ─── Pipeline create loading overlay ─── */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  z-index: 1050;
  text-align: center;
  padding-top: 20%;
  font-size: 3rem;
}

.loading-overlay.active {
  display: block;
}

/* make the switch larger */
.form-check.form-switch .form-check-input {
  transform: scale(1.8);
  margin-right: 1rem;
  padding-right: 1.5rem;
}

/* adjust the clickable area*/
.form-check.form-switch {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

/* ─── Admin Extras ─────────────────────────── */
.dashboard-widgets {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--spacing);
  margin-top: 2rem;
}

.widget-card {
  background: var(--card-bg);
  padding: var(--spacing);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

.widget-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
}

.widget-value {
  font-size: 2rem;
  font-weight: 600;
  text-align: center;
}

/* Admin Dashboard badge styling */
.dashboard-card .badge {
  display: inline-block;
  min-width: 1.2em;
  padding: 0.1em 0.4em;
  font-size: 0.75em;
  font-weight: 600;
  line-height: 1;
  color: #fff;
  background-color: var(--primary);
  border-radius: 0.5rem;
  margin-left: 0.5rem;
}

/* Icon spacing in card headers and widgets */
.dashboard-card h2 .fas,
.widget-card h3 .fas {
  margin-right: 0.5rem;
}

/* static/css/pipeline-status.css */
.bg-queued {
  background-color: #ffc107 !important;
}

.bg-requeued {
  background-color: #ff7802 !important;
}

/* warning */
.bg-running {
  background-color: #0d20f0 !important;
}

.bg-rerunning {
  background-color: #0dacf0 !important;
}

/* info    */
.bg-completed {
  background-color: #198754 !important;
}

/* success */
.bg-failed {
  background-color: #dc3545 !important;
}

/* danger  */
.bg-error {
  background-color: #dc3545 !important;
}

/* Progress bar sizing */
.progress--tall {
  /* Bootstrap 5 uses a CSS variable for height */
  --bs-progress-height: 34px;
}

/* Limit width + center it */
.progress--narrow {
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

/* (Optional) bump font a touch inside the bar */
.progress__bar--lg {
  font-size: 0.95rem;
}

/* (Optional) a wider version on large screens */
@media (min-width: 992px) {
  .progress--narrow {
    max-width: 520px;
  }
}

/* Fastq path resolver overlay */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#loading-overlay.active {
  display: flex;
}

#loading-overlay .card {
  background: #fff;
  padding: 24px 28px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
  text-align: center;
  max-width: 520px;
}

#loading-overlay .spinner {
  width: 28px;
  height: 28px;
  border: 4px solid #ddd;
  border-top-color: #555;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* HTMX loading indicator */
.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator {
  display: inline-block;
}

.dataTables_filter {
  display: none !important;
}

/* Sort affordances for DataTables headers */
table.dataTable thead th.sorting,
table.dataTable thead th.sorting_asc,
table.dataTable thead th.sorting_desc {
  cursor: pointer;
  white-space: nowrap;
}

table.dataTable thead th.sorting::after {
  content: "↕";
  opacity: .35;
  margin-left: .35rem;
  font-size: .85em;
}

table.dataTable thead th.sorting_asc::after {
  content: "↑";
  opacity: .85;
}

table.dataTable thead th.sorting_desc::after {
  content: "↓";
  opacity: .85;
}

/* Pager: ensure real links are clickable; keep spans inert */
#pager .page-item .page-link {
  pointer-events: auto !important;
  cursor: pointer;
  position: relative;
  z-index: 1;
}

#pager .page-item span.page-link {
  pointer-events: none;
  cursor: default;
}

#pager .page-item a.page-link {
  pointer-events: auto !important;
  cursor: pointer;
}

#pager .page-item span.page-link {
  pointer-events: none;
  cursor: default;
}

/* Persist highlight for the current page even if some JS toggles classes */
#pager li[aria-current="page"] .page-link {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
  color: #fff;
}

#pager li[aria-current="page"] .page-link:hover {
  color: #fff;
}

/* Resizable columns + responsive scroll */
#pipeline-table {
  table-layout: fixed;
}

#pipeline-table thead th {
  position: relative;
}

#pipeline-table thead th .resize-handle {
  position: absolute;
  right: -3px;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: col-resize;
  user-select: none;
}

#pipeline-table thead th .resize-handle::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 25%;
  bottom: 25%;
  border-right: 1px solid rgba(0, 0, 0, .2);
}

/* global cursor while dragging */
html.resizing,
html.resizing * {
  cursor: col-resize !important;
}

/* ===== Responsive Sidebar: desktop fixed, mobile off-canvas ===== */

/* Sizes you can tune */
:root {
  --sidebar-width-desktop: 300px;
  --sidebar-width-tablet: 240px;
  /* optional narrower width */
  --sidebar-width-mobile: 260px;
  /* drawer width on small screens */
}

/* Use a single variable everywhere (your file already uses --sidebar-width) */
:root {
  --sidebar-width: var(--sidebar-width-desktop);
}

/* Slightly narrower on medium/large viewports (optional) */
@media (max-width: 1400px) {
  :root {
    --sidebar-width: var(--sidebar-width-tablet);
  }
}

/* --- Off-canvas behavior (phones/tablets) --- */
@media (max-width: 992px) {

  /* Main content gets the full width */
  .main-content,
  .footer {
    margin-left: 0 !important;
  }

  /* Sidebar becomes a drawer, hidden by default */
  .vertical-menu {
    width: var(--sidebar-width-mobile) !important;
    transform: translateX(-100%) !important;
    transition: transform .25s ease-in-out !important;
    will-change: transform;
    /* keep your existing fixed positioning & z-index from custom.css */
  }

  /* Show the drawer when body has .sidebar-open */
  body.sidebar-open .vertical-menu {
    transform: translateX(0) !important;
  }

  /* Clickable backdrop behind the drawer */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    z-index: 999;
    /* below the menu (which is z-index:1000 in your CSS) */
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
  }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .vertical-menu {
    transition: none !important;
  }
}

#sidebarToggle,
#sidebarToggle .bi {
  color: #fff !important;
}

#sidebarToggle.btn-outline-light {
  border-color: rgba(255, 255, 255, .5);
}

#sidebarToggle.btn-outline-light:hover {
  background: rgba(255, 255, 255, .15);
}

/* Mobile drawer: hide by default */
@media (max-width: 992px) {
  .vertical-menu {
    transform: translateX(-100%) !important;
    /* hidden off-canvas */
    transition: transform .25s ease-in-out !important;
  }

  /* SHOW when the element itself has the open class (wins specificity) */
  .vertical-menu.vertical-menu--open {
    transform: translateX(0) !important;
  }
}

/* ===== Off-canvas sidebar (phones/tablets) ===== */
@media (max-width: 992px) {

  /* Hidden by default: slide it off the left */
  #app-sidebar {
    position: fixed !important;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sidebar-width-mobile, 260px) !important;
    transform: translateX(-100%) !important;
    transition: transform .25s ease-in-out !important;
    display: block !important;
    z-index: 1040 !important;
    /* above the backdrop */
  }

  /* Show the drawer: accept both triggers */
  body.sidebar-open #app-sidebar,
  #app-sidebar.vertical-menu--open {
    transform: translateX(0) !important;
  }

  /* Backdrop sits just under the sidebar */
  #sidebarBackdrop.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    z-index: 1030 !important;
    /* below #app-sidebar */
  }

  body.sidebar-open #sidebarBackdrop.sidebar-backdrop {
    display: block;
  }

  /* Let content use full width on small screens */
  .main-content,
  .footer {
    margin-left: 0 !important;
    left: 0 !important;
    width: 100% !important;
  }
}

/* iOS: make horizontal scroll smooth and DON'T force-fit the table */
#table-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* momentum scroll on iPhone */
}

/* Small screens: ensure the table can be wider than the viewport */
@media (max-width: 992px) {
  #pipeline-table {
    table-layout: fixed;
    /* predictable columns */
    min-width: 900px;
    /* fallback width if JS can’t compute yet */
  }

  /* Optional: prevent messy wraps; you can remove or target specific columns later */
  #pipeline-table th,
  #pipeline-table td {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }
}

/* Prevent Safari auto-shrinking text which causes odd overlaps */
html {
  -webkit-text-size-adjust: 100%;
}

/* Ensure smooth horizontal scroll */
#table-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Mobile/tablet: allow table to be wider than viewport and add a tiny right gutter */
@media (max-width: 992px) {

  /* a small padding so the last column never gets clipped under the edge/scrollbar */
  #table-scroll-wrap {
    padding-right: 12px;
  }
}

/* Extra nudge for iOS Safari only */
@supports (-webkit-touch-callout: none) {
  #table-scroll-wrap {
    padding-right: 14px;
  }
}

/* === Desktop: collapse sidebar and reclaim width (authoritative override) === */
@media (min-width: 993px) {

  /* 1) Slide the sidebar off canvas */
  body.sidebar-hidden #app-sidebar {
    transform: translateX(-100%) !important;
  }

  /* 2) Reclaim width for main area, header, and footer */
  body.sidebar-hidden .main-content,
  body.sidebar-hidden #page-topbar,
  body.sidebar-hidden .footer {
    margin-left: 0 !important;
    left: 0 !important;
    /* footer/header safety */
    width: 100% !important;
    /* footer safety vs width:calc(...) */
  }
}

/* Header: plain Bootstrap flex row */
#page-topbar .navbar-header {
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  overflow: visible !important;
  /* let dropdowns overflow */
}

/* Right group goes to the far right */
#page-topbar .navbar-header .ms-auto {
  margin-left: auto !important;
}

/* Make sure nothing covers the header on desktop */
.sidebar-backdrop {
  display: none;
  pointer-events: none;
}

@media (max-width: 992px) {

  body.sidebar-open .sidebar-backdrop,
  body.right-open .sidebar-backdrop {
    display: block;
    pointer-events: auto;
  }
}

/* Dropdowns render above everything */
#page-topbar .dropdown-menu {
  z-index: 4000 !important;
}

/* === iPhone/iPad: show the full right edge of the table === */
@media (max-width: 992px) {

  /* 1) Don't clip scrollables */
  .main-content,
  .pipeline-list-container {
    overflow: visible !important;
  }

  /* 2) Make the wrapper actually scroll horizontally */
  #table-scroll-wrap {
    overflow-x: auto !important;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-right: 16px;
    /* small gutter so Safari doesn't shave the end */
  }

  /* 3) Let the table grow to its real width (sum of columns) */
  #pipeline-table {
    display: block;
    /* so width can be content-based */
    width: max-content;
    /* expand to fit all columns */
    min-width: 100%;
    /* but never smaller than the viewport */
  }

  /* 4) Don't clip the buttons in the last two columns */
  #pipeline-table th:nth-last-child(-n+2),
  #pipeline-table td:nth-last-child(-n+2) {
    overflow: visible !important;
    /* overrides earlier ellipsis rule */
    text-overflow: initial !important;
    white-space: nowrap;
    min-width: 90px;
    /* tweak 110–140px as you like */
  }
}

/* Extra nudge for iOS Safari rounding */
@supports (-webkit-touch-callout: none) {
  #table-scroll-wrap {
    padding-right: 20px;
  }
}

@media (max-width: 992px) {
  #pipeline-table td:nth-last-child(-n+2) .btn {
    padding: .25rem .5rem;
    /* smaller */
    font-size: .875rem;
    /* ~btn-sm */
  }
}