/* ============ Vendor Commissions ============ */
.vendors-page {
  min-width: 0;
}

/* Fill the viewport: the vendor table reaches the bottom of the screen and
   scrolls internally, while the switcher, headline cards and filters stay put.
   The list and summary views end in a .table-shell; the settings view is a
   form and keeps its natural height (no .is-fill). Desktop only, like #34. */
@media (min-width: 901px) {
  /* Cap the frame to the viewport (not just min-height) so the trailing table
     is forced to scroll inside instead of growing the whole page. The fixed
     blocks above it - switcher, cards, filters - sit outside the scroll region. */
  body:has(.vendors-page.is-fill) .app-frame {
    height: 100vh;
  }

  body:has(.vendors-page.is-fill) .workspace {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  body:has(.vendors-page.is-fill) .page-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
  }

  .vendors-page.is-fill {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    /* Consistent breathing room between the switcher, totals, filter card and
       table - the flex gap is the single source of vertical spacing here. */
    gap: 18px;
  }
  /* Drop the block-flow margins so they don't double the flex gap above. */
  .vendors-page.is-fill > .view-switch { margin-bottom: 0; }

  /* The trailing table is the scroll region; everything above it stays fixed. */
  .vendors-page.is-fill > .table-shell {
    flex: 1 1 auto;
    min-height: 0;
  }

  /* Keep the column headers visible while the rows scroll under them. The
     upward shadow covers the seam a sticky th leaves on fractional device
     pixels, same as the orders table. */
  .vendors-page.is-fill > .table-shell thead th {
    position: sticky;
    top: 0;
    background: var(--panel);
    box-shadow: 0 -3px 0 var(--panel);
    z-index: 1;
  }
}

/* Detail views (vendor commission) carry no .is-fill, so they miss the flex
   gap the list view uses for spacing. Stack them with the same 18px rhythm so
   the cards and table don't butt against each other. */
.vendors-page:not(.is-fill) {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.vendors-page:not(.is-fill) > .view-switch { margin-bottom: 0; }

.vendors-page .section-card,
.vendors-page .table-shell { background: #fff; border-color: var(--line); }
.vendors-page .button { border-color: var(--accent); color: var(--accent); background: #fff; }
.vendors-page .button:hover { background: var(--accent); color: #fff; }
.vendors-page .button-ghost:hover { color: var(--accent); border-color: var(--accent); }

/* Said once, above the table, instead of on every row. */

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

.vc-rule-tag { font-size: 11px; font-weight: 700; color: var(--faint); }
.vc-rule-tag.is-custom { color: var(--accent); }
/* The add-vendor panel. Its handle now lives in the toolbar, so the disclosure's
   own summary is a quiet fallback for a browser without the script - not a second
   green call to action sitting under the filters. */

/* Date-range preset chips. */
.range-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip-button {
  font: inherit;
  font-size: 11.5px;
  font-weight: 650;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}
.chip-button:hover { color: var(--accent); border-color: var(--accent); }
.chip-button.is-active { color: var(--accent); border-color: var(--accent); background: var(--accent-weak); }

/* Expanding an order in place.
   The detail row is `hidden` until its toggle opens it, so four orders draw as
   four rows. It used to be rendered open-but-collapsed under every order, which
   is what doubled the table before anyone clicked anything. */
.vc-toggle-head { width: 34px; }
.vc-toggle-cell { width: 34px; padding-right: 0 !important; }
.vc-toggle {
  display: flex;
  padding: 4px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: transform 0.15s ease, color 0.15s ease;
}
.vc-toggle:hover { color: var(--text); background: var(--hover); }
.vc-toggle[aria-expanded="true"] { transform: rotate(90deg); color: var(--text); }
.vc-order-row.is-open > td { background: var(--panel-subtle); }
.vc-order-date { font-size: 12px; color: var(--faint); margin-top: 1px; }
.vc-sales { font-weight: 650; font-variant-numeric: tabular-nums; }
.vc-none { color: var(--faint); }
.vc-refunded { color: var(--red); }

/* On a phone .table-cards makes every row a block, which beat [hidden] and
   opened every order's details at once. */
.table-cards tbody tr.vc-detail-row[hidden] { display: none; }
.vc-detail-row > td { padding: 0 20px 18px 48px !important; background: var(--panel-subtle); border-top: 0; }
/* stretch, not start: with one line item the left card is short, and `start`
   left a band of the row's grey showing beside the taller money card, which read
   as a gap in the layout rather than as two panels. */
.vc-detail { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; align-items: stretch; }
.vc-detail-lines { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; }
.vc-detail-money {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font-size: 13px;
}
.vc-detail-money > div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.vc-detail-money dt { color: var(--muted); }
.vc-detail-money dd { margin: 0; font-variant-numeric: tabular-nums; }
.vc-detail-money .vc-neg { color: var(--red); }
.vc-detail-money .vc-detail-rule { border-top: 1px solid var(--line-soft); margin-top: 4px; padding-top: 8px; }
.vc-detail-money .vc-detail-total { font-weight: 700; }
@media (max-width: 860px) {
  .vc-detail { grid-template-columns: minmax(0, 1fr); }
  .vc-detail-row > td { padding-left: 20px !important; }
}

.vc-lines-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.vc-lines-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 4px 8px;
  border-bottom: 1px solid var(--line-soft);
}
.vc-lines-table td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft); }
.vc-lines-table tr:last-child td { border-bottom: 0; }
.vc-lines-table .align-right { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .vc-lines-table { display: block; overflow-x: auto; }
}

/* E phase 6b - the phone pass. Each rule below fixed a page that scrolled
   sideways or crushed its text at 390px (e2e/phone_width.spec.ts holds the line). */

/* A tab tray wider than the screen (Vendors has five) scrolls within itself
   rather than pushing the page wider. */
.view-switch { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.view-switch-tab { flex: none; }

@media (max-width: 639px) {
  /* Settings rows: the badge and the button drop under the text instead of
     squeezing it to a word a line, and a row is only as tall as it needs. */
  
  .set-row-txt { flex-basis: calc(100% - 53px); }
  .set-row .badge { margin-left: 53px; }
  .set-row > .button-sm:last-child { margin-left: auto; }
}

/* A bold word inside a settings row's description stays a word, not a second
   title - the title rule above reaches every <strong> in the row. */
.set-row-txt p strong { display: inline; font-size: inherit; }

@media (max-width: 767px) {
  /* Vendor detail: an order's breakdown row spans the card, and the line
     items inside it stay a table - the card rules reach nested tables too,
     which turned each line into a half-width card of its own. */
  .table-cards .vc-detail-row > td { display: block; padding: 12px !important; }
  .table-cards .vc-lines-table thead { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; }
  .table-cards .vc-lines-table { display: table; width: 100%; }
  .table-cards .vc-lines-table tr { display: table-row; padding: 0; border: 0; border-radius: 0; background: none; }
  .table-cards .vc-lines-table tr + tr { margin-top: 0; }
  .table-cards .vc-lines-table th { display: table-cell; }
  .table-cards .vc-lines-table tbody td { display: table-cell; padding: 6px 8px; border-bottom: 1px solid var(--line-soft); text-align: left; font-size: 12.5px; font-weight: 400; }
  .table-cards .vc-lines-table tbody td::before { content: none; }
  .table-cards .vc-lines-table tbody td.align-right { text-align: right; }
}

/* --- Vendor payouts --------------------------------------------------- */

.vc-drift { margin: 8px 0 0; padding-left: 18px; }
.vc-drift li { margin-top: 3px; }

/* Illustrated empty state. Deliberately not .empty-state, which is defined
   twice in this file (the later grid rule wins and strips the padding). */
.empty-rich {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 14px;
  padding: 52px 32px;
}

.empty-rich-compact { padding: 38px 28px; }

/* Wash fades into the panel, so it stops short of the rounded bottom corners. */
.empty-rich-tinted {
  background: linear-gradient(180deg, var(--accent-weak), transparent 72%);
  border-radius: 7px 7px 0 0;
}

.empty-rich-art { display: block; }
.empty-rich-copy { display: grid; gap: 6px; justify-items: center; }
.empty-rich-title { font-size: 15px; font-weight: 700; margin: 0; color: var(--text); }
.empty-rich-body { margin: 0; color: var(--muted); max-width: 46ch; }

.empty-rich-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  margin-top: 4px;
}

.empty-rich-actions form { margin: 0; }

/* align-items:start matters: .field is itself a grid, so a stretched column
   spreads the slack across its rows and the control drifts below its label.
   The "Effective from" hint makes that column tallest, which staggered the
   whole row. */
/* One flex column drives the whole form's vertical rhythm, so the fields grid,
   checkbox, advanced disclosure, example callout and buttons all sit an even
   16px apart instead of relying on per-block margins that drift out of sync. */
.commission-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Native date inputs render a pixel taller than text inputs at the same
   min-height, which shows up next to them in the same row. */
.commission-form .field input[type="date"] { height: 36px; }

.cf-advanced summary { font-weight: 700; font-size: 12.5px; color: var(--accent); cursor: pointer; }
.cf-advanced[open] summary { margin-bottom: 10px; }
.cf-advanced .checkbox-row + .checkbox-row { margin-top: 8px; }
.cf-preview { background: var(--hero-bg); border: 1px solid var(--hero-border); border-radius: 12px; padding: 16px 18px; color: var(--hero-text); max-width: 380px; }
.cf-preview .eyebrow { color: var(--hero-accent); margin-bottom: 10px; }
.cf-prow { display: flex; justify-content: space-between; gap: 16px; padding: 5px 0; font-size: 13px; color: var(--hero-text); font-variant-numeric: tabular-nums; }
.cf-prow.cf-sub { border-top: 1px solid var(--hero-line); margin-top: 5px; padding-top: 9px; }
.cf-prow.cf-grand { border-top: 1px solid var(--hero-line); margin-top: 5px; padding-top: 10px; font-size: 15px; font-weight: 800; color: var(--hero-heading); }
.cf-warn { color: var(--amber); font-size: 12.5px; font-weight: 650; }

/* Live-filter results: dim briefly while the filtered page is fetched. */
.is-filtering { opacity: 0.55; transition: opacity 0.12s ease; }

