/* Vantage Pulse (built as Profit Tracking): "Plan your next order" and the restock
 * dialog (1 Dec 2026).
 *
 * The file is named pt_reorder on purpose: every stylesheet is linked
 * by name in the head of every page, the pilot seller's page included,
 * and that page is pinned never to carry the word for what this
 * feature tracks (test/integration/pilot_login_test.rb).
 *
 * Every rule is scoped under .pt-reorder, the class on the root of
 * client_profit_tracking/_reorder.html.erb. The restock dialogs are
 * rendered inside that root, so they are styled from here too (a
 * dialog shown in the top layer still matches its ancestors).
 *
 * Colours are the theme tokens, so the block follows light and dark.
 *
 * Phone rule (founder, 30 Nov 2026): nothing scrolls or swipes
 * sideways. Cards stack one to a row at 820px and below, button rows
 * wrap onto further lines, long titles break, and every box may
 * shrink (min-width: 0), so the block fits from 320px up.
 */

.pt-reorder {
  margin-top: 14px;
  min-width: 0;
  max-width: 100%;
}

.pt-reorder .pt-reorder-title {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.pt-reorder .pt-reorder-sub {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: break-word;
}

/* ---------- Cards: one to a row on phones, three across above ---------- */

.pt-reorder .pt-reorder-cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

@media (min-width: 821px) {
  .pt-reorder .pt-reorder-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }
}

.pt-reorder .pt-reorder-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}

.pt-reorder .pt-reorder-product {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.pt-reorder .pt-reorder-asin {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.pt-reorder .pt-reorder-plan {
  margin: 10px 0 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-2);
  overflow-wrap: break-word;
}

/* Buttons wrap onto further lines; none is ever cut off or scrolled. */
.pt-reorder .pt-reorder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  min-width: 0;
}

.pt-reorder .pt-reorder-actions .btn {
  min-height: 44px;
  max-width: 100%;
  justify-content: center;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* ---------- "See all" ---------- */

.pt-reorder .pt-reorder-more {
  margin-top: 10px;
}

/* The summary is drawn as a ghost button, so it reads as something to
   press. Its own marker is dropped with the list-item display. */
.pt-reorder .pt-reorder-more-summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
}

.pt-reorder .pt-reorder-more-summary::-webkit-details-marker {
  display: none;
}

.pt-reorder .pt-reorder-more[open] .pt-reorder-more-summary {
  margin-bottom: 6px;
}

/* ---------- The quiet lines ---------- */

.pt-reorder .pt-reorder-quiet {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.pt-reorder .pt-reorder-quiet li {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.45;
  min-width: 0;
}

.pt-reorder .pt-reorder-quiet-product {
  display: block;
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.pt-reorder .pt-reorder-quiet-line {
  display: block;
  color: var(--muted);
  overflow-wrap: break-word;
}

/* ---------- The restock dialog ---------- */

.pt-reorder .pt-restock {
  width: min(520px, calc(100vw - 32px));
}

.pt-reorder .pt-restock .pt-restock-head {
  min-width: 0;
}

.pt-reorder .pt-restock .stat-modal-subtitle {
  overflow-wrap: anywhere;
}

.pt-reorder .pt-restock-form {
  margin: 0;
  min-width: 0;
}

.pt-reorder .pt-restock-message {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  min-width: 0;
}

.pt-reorder .pt-restock-eyebrow {
  margin: 0 0 8px;
}

.pt-reorder .pt-restock-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  overflow-wrap: anywhere;
}

/* "I would like about [ 240 ] units." The words and the field wrap as
   one sentence. */
.pt-reorder .pt-restock-units {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
}

.pt-reorder .pt-restock-units > span {
  padding-bottom: 10px;
}

.pt-reorder .pt-restock-units > .pt-restock-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 0;
  min-width: 0;
}

.pt-reorder .pt-restock-field label,
.pt-reorder .pt-restock-note label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.pt-reorder .pt-restock-number {
  width: 132px;
  max-width: 100%;
  min-height: 44px;
  font-variant-numeric: tabular-nums;
}

.pt-reorder .pt-restock-note {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 12px;
  min-width: 0;
}

.pt-reorder .pt-restock-note .textarea {
  max-width: 100%;
}

.pt-reorder .pt-restock-help {
  margin: 12px 0 0;
  font-size: 12.5px;
  line-height: 1.45;
  overflow-wrap: break-word;
}

.pt-reorder .pt-restock-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.pt-reorder .pt-restock-actions .btn {
  min-height: 44px;
  justify-content: center;
}

@media (max-width: 820px) {
  /* On a phone the dialog is a bottom sheet as wide as the screen. */
  .pt-reorder .pt-restock {
    width: 100%;
  }

  /* 16px type in the fields, so an iPhone does not zoom the page. */
  .pt-reorder .pt-restock-number,
  .pt-reorder .pt-restock-note .textarea {
    font-size: 16px;
  }

  /* Thumb sized, side by side, wrapping when the screen is narrow. */
  .pt-reorder .pt-restock-actions .btn {
    flex: 1 1 140px;
  }
}
