/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Staff data tables. Below the md breakpoint (phones, including 375px) each
   row stacks instead of scrolling sideways. md and up keep the table.
   This file is plain CSS, loaded after Tailwind, so these rules beat
   utilities such as whitespace-nowrap without going through @apply. */
.staff-data-nowrap {
  white-space: nowrap;
}

.sortable-fallback {
  background: #fff;
  box-shadow: 0 8px 20px rgba(17, 24, 39, 0.15);
}

/* Desktop keeps the table and scrolls inside the card when a row is wider
   than the page. Phones stack instead, so this stays off below md. */
@media (min-width: 768px) {
  .staff-data-wrap {
    overflow-x: auto;
  }
}

@media (max-width: 767px) {
  /* Filter selects sit in title rows. Cap them so a long option cannot
     push the page wider than the phone. */
  main select {
    max-width: 100%;
  }

  .staff-data-wrap,
  .staff-data-wrap .inline-block {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-left: 0;
    margin-right: 0;
  }

  .staff-data-wrap.staff-data-bleed {
    width: auto;
    max-width: none;
    margin-left: -2rem;
    margin-right: -2rem;
  }

  .staff-data-wrap.staff-data-bleed table.staff-data-table > tbody > tr {
    box-sizing: border-box;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  table.staff-data-table {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  table.staff-data-table > thead {
    display: none;
  }

  table.staff-data-table > tbody {
    display: block;
    width: 100%;
  }

  table.staff-data-table > tbody > tr {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e5e7eb;
  }

  table.staff-data-table > tbody > tr.hidden {
    display: none;
  }

  table.staff-data-table > tbody > tr > td,
  table.staff-data-table > tbody > tr > th {
    display: block;
    width: auto;
    max-width: 100%;
    min-width: 0;
    padding: 0.125rem 0;
    white-space: normal;
    text-align: left;
    overflow-wrap: break-word;
  }

  table.staff-data-table > tbody > tr > .hidden,
  table.staff-data-table > tbody > tr > .staff-data-empty,
  table.staff-data-table > tbody > tr > td:empty,
  table.staff-data-table > tbody > tr > th:empty {
    display: none;
  }

  table.staff-data-table > tbody > tr > [data-label]:not([data-label=""])::before {
    content: attr(data-label);
    display: block;
    font-size: 0.75rem;
    line-height: 1rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6b7280;
  }

  table.staff-data-table > tbody > tr > .staff-data-title::before {
    content: none;
  }

  table.staff-data-table .whitespace-nowrap {
    white-space: normal;
  }

  table.staff-data-table .staff-data-nowrap {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
    overflow-wrap: normal;
  }

  .staff-data-columns-head.staff-data-columns-head {
    display: none;
  }

  .staff-data-columns {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 0.125rem;
  }

  .staff-data-columns > * {
    width: 100%;
    max-width: 100%;
  }

  .staff-data-columns > :empty {
    display: none;
  }

  .staff-data-columns > [data-label]:not([data-label=""])::before {
    content: attr(data-label);
    display: block;
    font-size: 0.75rem;
    line-height: 1rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6b7280;
  }

  .staff-data-total {
    flex-wrap: wrap;
    width: 100%;
  }

  .staff-data-total > :empty {
    display: none;
  }

  .staff-filter-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem 1rem;
    width: 100%;
    margin-top: 0.75rem;
  }

  .staff-filter-bar > [data-controller="filter-dropdown"] {
    display: flex;
    align-items: center;
    min-width: 0;
    padding-left: 0;
    padding-right: 0;
  }

  table.staff-data-table > tbody > tr:has(> .staff-stack-primary) {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 0.35rem;
    row-gap: 0.125rem;
    width: 100%;
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
  }

  table.staff-data-table > tbody > tr:has(> .staff-stack-primary)::after {
    content: "";
    flex-basis: 100%;
    order: 2;
    height: 0;
  }

  table.staff-data-table > tbody > tr:has(> .staff-stack-primary) > .staff-stack-leading {
    order: 0;
    flex: 0 0 auto;
    width: auto;
    padding: 0;
  }

  table.staff-data-table > tbody > tr:has(> .staff-stack-primary) > .staff-stack-primary {
    order: 1;
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    padding: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.3;
    overflow-wrap: anywhere;
  }

  table.staff-data-table > tbody > tr:has(> .staff-stack-primary) > .staff-stack-action {
    order: 2;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex: 0 0 auto;
    width: auto;
    margin-left: 0.75rem;
    padding: 0;
    font-size: 0.8125rem;
    white-space: nowrap;
  }

  table.staff-data-table > tbody > tr:has(> .staff-stack-primary) > .staff-stack-secondary {
    order: 3;
    flex: 0 1 auto;
    width: auto;
    max-width: 100%;
    padding: 0;
    font-size: 0.75rem;
    line-height: 1.25rem;
    color: #6b7280;
  }

  table.staff-data-table > tbody > tr:has(> .staff-stack-primary) > .staff-stack-primary::before,
  table.staff-data-table > tbody > tr:has(> .staff-stack-primary) > .staff-stack-action::before,
  table.staff-data-table > tbody > tr:has(> .staff-stack-primary) > .staff-stack-leading::before,
  table.staff-data-table > tbody > tr:has(> .staff-stack-primary) > .staff-stack-secondary::before {
    content: none;
    display: none;
  }

  table.staff-data-table > tbody > tr:has(> .staff-stack-primary) > .staff-stack-secondary.staff-stack-dot::before {
    content: "·";
    display: inline;
    margin-right: 0.35rem;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
    color: #9ca3af;
  }

  table.staff-data-table > tbody > tr:has(> .staff-stack-primary) > :is(td, th):not(.hidden):not(.staff-data-empty):not(.staff-stack-primary):not(.staff-stack-secondary):not(.staff-stack-action):not(.staff-stack-leading) {
    order: 4;
    flex: 1 0 100%;
    width: 100%;
    padding: 0;
    font-size: 0.75rem;
    line-height: 1.25rem;
  }

  table.staff-data-table > tbody > tr:has(> .staff-stack-primary) > [data-label]:not([data-label=""])::before {
    display: inline;
    margin-right: 0.35rem;
    letter-spacing: normal;
    text-transform: none;
    font-weight: 500;
  }

  table.staff-data-table > tbody > tr.hidden,
  table.staff-data-table > tbody > tr.hidden:has(> .staff-stack-primary),
  table.staff-data-table > tbody > tr:has(> .staff-stack-primary) > .hidden,
  table.staff-data-table > tbody > tr > .hidden,
  table.staff-data-table > tbody > tr:has(> .staff-stack-primary) > .staff-data-empty,
  table.staff-data-table > tbody > tr > .staff-data-empty {
    display: none;
  }

  .staff-data-columns:has(> .staff-stack-primary) {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 0.35rem;
    row-gap: 0.125rem;
    width: 100%;
    padding: 0.375rem 0.25rem 0.5rem;
  }

  .staff-data-columns:has(> .staff-stack-primary)::after {
    content: "";
    order: 3;
    flex-basis: 100%;
    height: 0;
  }

  .staff-data-columns:has(> .staff-stack-primary) > .staff-stack-primary {
    order: 1;
    display: flex;
    flex: 1 1 0;
    align-items: center;
    width: auto;
    max-width: none;
    min-width: 0;
    padding: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.3;
  }

  .staff-data-columns:has(> .staff-stack-primary) > .staff-stack-primary > .flex {
    min-width: 0;
    flex: 1 1 auto;
  }

  .staff-data-columns:has(> .staff-stack-primary) > .staff-stack-primary span {
    overflow-wrap: anywhere;
  }

  .staff-data-columns:has(> .staff-stack-primary) > .staff-stack-total {
    order: 2;
    flex: 0 0 auto;
    width: auto;
    margin-left: auto;
    padding: 0;
    font-weight: 600;
    white-space: nowrap;
  }

  .staff-data-columns:has(> .staff-stack-primary) > .staff-stack-action {
    order: 3;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
    width: auto;
    padding: 0;
  }

  .staff-data-columns:has(> .staff-stack-primary) > .staff-stack-action form {
    display: inline-flex;
  }

  .staff-data-columns:has(> .staff-stack-primary) > .staff-stack-action a,
  .staff-data-columns:has(> .staff-stack-primary) > .staff-stack-action button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    min-height: 2rem;
  }

  .staff-data-columns:has(> .staff-stack-primary) > .staff-stack-secondary {
    order: 4;
    flex: 0 1 auto;
    width: auto;
    max-width: 100%;
    padding: 0;
    font-size: 0.75rem;
    line-height: 1.25rem;
    color: #6b7280;
  }

  .staff-data-columns:has(> .staff-stack-primary) > .staff-phone-skip {
    display: none;
  }

  .staff-data-columns:has(> .staff-stack-primary) > .staff-stack-primary::before,
  .staff-data-columns:has(> .staff-stack-primary) > .staff-stack-secondary::before,
  .staff-data-columns:has(> .staff-stack-primary) > .staff-stack-total::before,
  .staff-data-columns:has(> .staff-stack-primary) > .staff-stack-action::before {
    content: none;
    display: none;
  }

  .staff-data-columns:has(> .staff-stack-primary) > .staff-stack-secondary.staff-stack-dot::before {
    content: "·";
    display: inline;
    margin-right: 0.35rem;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
    color: #9ca3af;
  }

  .staff-data-columns:has(> .staff-stack-primary) > .staff-stack-secondary.staff-stack-dot[data-label="Qty"]::before {
    content: "· Qty ";
  }

  .staff-data-columns:has(> .staff-stack-primary) > .staff-stack-secondary.staff-stack-dot[data-label="Setup"]::before {
    content: "· Setup ";
  }

  .staff-data-columns:has(> .staff-stack-primary) > .staff-stack-secondary.staff-stack-dot[data-label="Tax"]::before {
    content: "· Tax ";
  }

  .quote-item-description .cursor-grab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px !important;
    height: 44px !important;
    flex: 0 0 44px;
    margin-left: -0.5rem;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }

  .quote-item-nested.quote-item-nested {
    padding-left: 1.25rem;
  }

  .quote-item-nested .quote-item-description.quote-item-description {
    padding-left: 0;
  }

  .staff-data-total.staff-data-total {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: baseline;
    gap: 0.75rem;
    width: 100%;
    margin-top: 0.125rem;
  }

  .staff-data-total.staff-data-total > :empty {
    display: none;
  }

  .staff-data-total.staff-data-total > * {
    width: auto;
    max-width: none;
    padding: 0.25rem 0.5rem;
    text-align: right;
  }
}
