/* The Quote tab's Revisions (js/quoteRevisions.js): each export of the
   design's quote, newest first, under Pricing Source; and a revision's View
   dialog. Kept apart from styles.css, which the Quote tab's other parts
   share. */

/* A container, so the list turns into cards (below) whenever its column is
   narrow: a phone, and a laptop's Quote tab too, where the table with its
   buttons is wider than the column. */
.quote-revisions { flex: 0 0 auto; margin-bottom: 8px; container: quote-revisions / inline-size; }
.quote-revisions .quote-table-wrap { flex: none; min-height: 0; max-height: 260px; }
.quote-revisions > .hint { margin: 6px 2px; }
.quote-revisions .hint.error { color: var(--danger-text); }
.quote-revisions > .quote-revisions-next { font-size: 12px; color: var(--text-dim); margin-top: 6px; }
.quote-revisions-next:empty { display: none; }

.quote-revisions-table td.quote-revisions-number { font-weight: 600; white-space: nowrap; }
.quote-revisions-table td:nth-child(2) { white-space: nowrap; }
.quote-revisions-sub { color: var(--text-dim); font-size: 11px; white-space: normal; }
.quote-table td.quote-revisions-total { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.quote-revisions-actions { white-space: nowrap; }
.quote-revisions-actions button { font-size: 11px; padding: 3px 8px; margin-left: 4px; }
.quote-revisions-actions button:first-child { margin-left: 0; }
/* "Show all (N)" / "Show fewer" at the heading's right, as Check Design is
   beside Current Quote's (styles.css), so it takes no row of its own. */
.quote-revisions-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
/* Its focus ring hugs the words inside its own box, so it stays in the
   column, over neither the list under it nor (on a phone) the screen's
   edge. On a phone, a bigger target to tap than its words (the ::after),
   still without making the heading any taller. */
.quote-revisions-toggle { position: relative; padding: 3px 5px; margin: -3px 0; }
.quote-revisions-toggle:focus-visible { outline-offset: -2px; }
@media (max-width: 700px) {
  .quote-revisions-toggle::after { content: ""; position: absolute; inset: -10px 0 -3px -12px; }
}

/* While the rest are folded away, the newest revision is one line, boxed
   as the tables above are: "Rev 3 · when · total" at the left, its buttons
   at the right, no taller than the hint a design with none has there. On
   a phone the buttons wrap under it. */
.quote-revision-latest {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 10px;
  padding: 4px 6px 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  font-size: 12px;
}
.quote-revision-latest-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quote-revision-latest-total { font-variant-numeric: tabular-nums; }
.quote-revision-latest .quote-revisions-actions { display: flex; gap: 4px; margin-left: auto; }
.quote-revision-latest .quote-revisions-actions button { margin: 0; padding: 2px 8px; }
@media (max-width: 700px) {
  .quote-revision-latest { padding: 6px 8px 6px 10px; }
  .quote-revision-latest .quote-revisions-actions { gap: 6px; }
  .quote-revision-latest .quote-revisions-actions button { padding: 6px 14px; }
}

/* View: wider than the other small dialogs, for the lines' table. */
.quote-revision-dialog .unit-picker-box { width: min(760px, calc(100vw - 32px)); }
.quote-revisions-heading { font-weight: 600; font-size: 13px; margin: 10px 0 4px; }
.quote-revisions-changes { margin: 0 0 8px; padding-left: 18px; font-size: 12px; line-height: 1.5; }
.quote-revisions-lines { flex: none; min-height: 0; max-height: 320px; }
.quote-table td.quote-revisions-desc { min-width: 160px; }

/* A phone: each line as it went out is a small card, as the revisions
   are: quantity, manufacturer and line total on top, model and price
   under them, then the description, with nothing off to the side. */
@media (max-width: 620px) {
  .quote-revisions-lines thead { display: none; }
  .quote-revisions-lines table, .quote-revisions-lines tbody { display: block; }
  .quote-revisions-lines tr {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 2px 10px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
  }
  .quote-revisions-lines td { display: block; padding: 0; border: none; white-space: normal; }
  .quote-revisions-lines td:nth-child(1) { grid-area: 1 / 1; }
  .quote-revisions-lines td:nth-child(1)::after { content: " \00d7"; }
  .quote-revisions-lines td:nth-child(2) { grid-area: 1 / 2; font-weight: 600; }
  .quote-revisions-lines td:nth-child(3) { grid-area: 2 / 2; }
  .quote-revisions-lines td:nth-child(6) { grid-area: 1 / 3; }
  .quote-revisions-lines td:nth-child(5) { grid-area: 2 / 3; color: var(--text-dim); }
  .quote-revisions-lines td:nth-child(5)::before { content: "each "; }
  .quote-revisions-lines td.quote-revisions-desc { grid-area: 3 / 2 / 3 / 4; min-width: 0; color: var(--text-dim); }
}

/* A narrow column (a phone, or a laptop's Quote tab): each revision is a
   small card rather than a row wider than the column: "Rev 2", when and
   its total on top, who under it, then what changed and its buttons, all
   in view without scrolling sideways. */
@container quote-revisions (max-width: 620px) {
  .quote-revisions .quote-table-wrap { max-height: 360px; }
  .quote-revisions-table thead { display: none; }
  .quote-revisions-table, .quote-revisions-table tbody { display: block; }
  .quote-revisions-table tr {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 2px 10px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
  }
  .quote-revisions-table td { display: block; padding: 0; border: none; }
  .quote-revisions-table td.quote-revisions-number { grid-area: 1 / 1; }
  .quote-revisions-table td.quote-revisions-number::before { content: "Rev "; }
  .quote-revisions-table td:nth-child(2) { grid-area: 1 / 2; white-space: normal; }
  .quote-revisions-table td:nth-child(3) { grid-area: 2 / 2; color: var(--text-dim); }
  .quote-revisions-table td:nth-child(3):not(:empty)::before { content: "by "; }
  .quote-revisions-table td.quote-revisions-total { grid-area: 1 / 3; }
  .quote-revisions-table td:nth-child(5) { grid-area: 3 / 2 / 3 / 4; }
  .quote-revisions-table td.quote-revisions-actions { grid-area: 4 / 2 / 4 / 4; white-space: normal; margin-top: 4px; }
  .quote-revisions-table .quote-revisions-actions button { margin: 0 6px 0 0; padding: 5px 12px; }
}

/* Named revisions (FR-31): the name under the number in the full list, in
   the newest's one line (cut short before the date and total are), the
   name and note fields in View, and the drawing's changes with the
   revision they're compared with. */
/* The name is what a designer scans for: in the text's own colour and
   size, not dim. */
.quote-revisions-table td.quote-revisions-number .quote-revisions-name {
  white-space: normal; font-weight: 400; max-width: 140px; overflow-wrap: anywhere; color: var(--text); font-size: 12px;
}
.quote-revision-latest-text { display: flex; align-items: baseline; }
.quote-revision-latest-text > * { flex: none; }
.quote-revision-latest-text > .quote-revision-latest-name { flex: 0 1 auto; min-width: 3ch; max-width: 42ch; overflow: hidden; text-overflow: ellipsis; }
/* Where the line has room for its buttons (481 px and up, wide enough for
   "Rev 3 · <when> · <total>" and the buttons), a long name is cut short
   rather than the buttons going under it, which would cost the quote's
   list above a line. */
@container quote-revisions (min-width: 481px) {
  .quote-revision-latest-text { flex: 1 1 0; }
}
.quote-revisions-naming { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) auto; gap: 0 12px; margin: 6px 0 2px; }
.quote-revisions-naming .export-package-field textarea { min-height: 34px; }
/* Save beside the note, at its foot, with what saving said beside it
   ("Saved.", or why not). */
.quote-revisions-naming-actions { display: flex; align-items: center; align-self: end; gap: 8px; padding-bottom: 6px; }
.quote-revisions-naming-save { margin: 0; padding: 5px 14px; }
.quote-revisions-naming-status { font-size: 11px; color: var(--text-dim); max-width: 22ch; }
.quote-revisions-naming-status:empty { display: none; }
@media (max-width: 560px) {
  .quote-revisions-naming { grid-template-columns: minmax(0, 1fr); }
  .quote-revisions-naming-status { max-width: none; }
}
/* View's drawing changes: devices, then connections, each under its
   counts; a line added marked + in green, one removed − in red. */
.quote-revisions-subheading { font-size: 12px; font-weight: 600; color: var(--text-dim); margin: 4px 0 2px; }
.quote-revisions-drawing-changes { list-style: none; padding-left: 4px; }
.drawing-change { display: flex; gap: 6px; }
.drawing-change-mark { flex: none; width: 1ch; text-align: center; font-weight: 700; }
.drawing-change-added .drawing-change-mark { color: var(--ok-fg); }
.drawing-change-removed .drawing-change-mark { color: var(--danger-text); }
.drawing-change-changed .drawing-change-mark { color: var(--text-dim); }
.quote-revisions-note { white-space: pre-wrap; font-size: 12.5px; margin: 6px 0; }
.quote-revisions-drawing-heading { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.quote-revisions-drawing-heading select { width: auto; flex: 0 1 auto; font: inherit; font-weight: 400; font-size: 12px; padding: 2px 6px; margin: 0; max-width: 100%; }
@container quote-revisions (max-width: 620px) {
  /* As a card: the name under the number, beside the date and who, in a
     column as wide on every card (the name wraps inside it), so each
     card's date starts at the same place. Only when some revision in the
     list has a name: else "Rev 3" needs no more room than it takes. */
  .quote-revisions-table td.quote-revisions-number { grid-area: 1 / 1 / 4 / 2; }
  .quote-revisions-table.has-names td.quote-revisions-number { width: 13ch; }
  .quote-revisions-table td.quote-revisions-number .quote-revisions-name { max-width: 13ch; }
}

/* Price freshness (FR-33, quoteUI.js): "Old price" and "Price changed" on a
   Current Quote line, beside its model number as Discontinued is, in the
   amber of everything that wants a look; and the one line above the quote
   with "Update all N". Nothing here is an error: exports go out at the
   quote's prices until they're updated. */
.price-fresh-badge {
  /* Holds its screen reader's words (.price-fresh-sr, absolutely placed):
     without it they're placed against the page, outside the list's
     scrolling box, and a flagged line out of sight below makes the whole
     page taller, so it scrolls, header and all. */
  position: relative;
  display: inline-block;
  margin-left: 6px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 1px 5px;
  border-radius: 8px;
  color: var(--warn-fg-soft);
  border: 1px solid var(--warn-border);
  background: var(--warn-bg);
  vertical-align: 1px;
  white-space: nowrap;
  cursor: help;
}
.price-fresh-old { color: var(--warn-fg); }
/* Changed: the badge, the two prices and the button on a line of their
   own under the line, across the table (wrapping on a narrow one), with
   no rule between the two. */
#quote-current-items tr.price-fresh-row > td { border-bottom: none; padding-bottom: 3px; }
#quote-current-items tr.price-fresh-subrow > td { padding: 0 8px 7px; }
#quote-current-items tr.price-fresh-row:hover, #quote-current-items tr.price-fresh-row:hover + tr.price-fresh-subrow { background: rgba(255,255,255,0.03); }
.price-fresh-change { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 11px; line-height: 15px; }
.price-fresh-change .price-fresh-badge { margin-left: 0; }
/* It may break before the arrow (never after it), so a phone's column
   needn't be as wide as both prices. */
.price-fresh-amounts { color: var(--text-dim); font-variant-numeric: tabular-nums; cursor: help; }
/* "Use current price" a link, as Check Design is, so the line stays two
   lines tall where it fits. */
.quote-table button.price-fresh-use {
  background: none; border: none; padding: 0; font: inherit; color: var(--accent);
  text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; cursor: pointer;
}
.quote-table button.price-fresh-use:hover { background: none; color: var(--accent-hover); }
.quote-table button.price-fresh-use:disabled { color: var(--text-dim); text-decoration: none; cursor: default; }
/* A line's price each (FR-71, quoteUI.js): a button that reads as the
   price, right-aligned in its column, which is a box to type in once
   clicked. "No MSRP" muted: under MSRP the line goes out at $0.00. */
.quote-table td.quote-each-cell { text-align: right; white-space: nowrap; }
.quote-table button.quote-price-btn {
  background: none; border: none; padding: 0; font: inherit; color: var(--text);
  font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer;
  text-decoration: underline dotted var(--text-dim); text-underline-offset: 3px;
}
.quote-table button.quote-price-btn:hover { background: none; color: var(--accent-hover); }
.quote-table button.quote-price-btn:disabled { color: var(--text); text-decoration: none; cursor: default; }
.quote-table button.quote-price-btn.quote-price-none { color: var(--text-dim); font-style: italic; }
.quote-table .quote-price-input {
  width: 84px; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 4px; padding: 3px 5px; font-size: 12px; text-align: right; font-variant-numeric: tabular-nums;
}
.quote-table .quote-price-input.input-invalid { border-color: var(--danger-text); }
.quote-table .quote-price-input.input-invalid:focus-visible { outline-color: var(--danger-text); }
/* An edited price on a line of its own under the line, as a changed one
   is (in the accent, not the amber: it's no warning). */
#quote-current-items tr.quote-edited-row > td { border-bottom: none; padding-bottom: 3px; }
#quote-current-items tr.quote-edited-row:hover, #quote-current-items tr.quote-edited-row:hover + tr.quote-edited-subrow { background: rgba(255,255,255,0.03); }
.price-fresh-badge.price-fresh-edited { color: var(--accent-hover); border-color: var(--accent-dim); background: transparent; }
/* A revision's line that went out at an edited price, in its View. */
.price-edited-mark {
  display: inline-block; margin-left: 6px; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
  padding: 0 5px; border-radius: 8px; color: var(--accent-hover); border: 1px solid var(--accent-dim); vertical-align: 1px; cursor: help;
}
/* Under Pricing Source: a manufacturer's lines are at a cost price. */
.quote-pricing-cost-hint { margin: 6px 0 0; color: var(--warn-fg); }

/* Words a screen reader reads with the badge, which sighted people get
   from its tooltip. */
.price-fresh-sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.quote-fresh {
  display: flex;
  align-items: baseline;
  gap: 0 6px;
  margin: 0 6px 0 auto;
  min-width: 0;
  text-transform: none;
  letter-spacing: normal;
  font-size: 11.5px;
}
/* Words-as-buttons, as Check Design is: the count (to the next flagged
   line) in amber while some price has changed, plain once only old ones
   are left (nothing to do here: an admin re-dates them); "Update all N" a
   link. A taller target than the heading's line, without a taller line. */
.quote-fresh button {
  background: none; border: none; font: inherit; white-space: nowrap; cursor: pointer;
  padding: 4px 0; margin: -4px 0;
}
.quote-fresh .quote-fresh-text { color: var(--warn-fg); text-decoration: underline dotted; text-underline-offset: 3px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.quote-fresh.quote-fresh-quiet .quote-fresh-text { color: var(--text-dim); }
.quote-fresh .quote-fresh-update { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.quote-fresh .quote-fresh-update::before { content: "\00b7\00a0"; color: var(--text-dim); display: inline-block; text-decoration: none; }
.quote-fresh button:hover { background: none; color: var(--accent-hover); }
.quote-fresh .quote-fresh-update:disabled { color: var(--text-dim); text-decoration: none; cursor: default; }
/* The line the count went to, marked a moment. */
@keyframes price-fresh-flash { from { background: var(--warn-bg); } to { background: transparent; } }
#quote-current-items tr.price-fresh-flash > td { animation: price-fresh-flash 1.6s ease-out; }
/* A line just added from search, where the order put it, marked in the
   accent (it's not a warning): held while the list glides to it, then
   faded, and carried on from --added-at when the list is redrawn meanwhile
   (quoteUI.js). A line the price check's "next one" brings into view comes
   clear of the sticky column headings (an added line's scroll measures
   them, quoteAddedLine.js). */
@keyframes quote-line-added { 0%, 50% { background: var(--accent-dim); } 100% { background: transparent; } }
#quote-current-items tr.quote-line-added > td { animation: quote-line-added 2.2s ease-out var(--added-at, 0s); }
#quote-current-items tbody tr { scroll-margin-top: 32px; }
/* What the add added, read out by a screen reader; on screen the status
   bar says it. */
#quote-added-said {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
/* Less motion: either mark held a moment, then gone, without the fade. */
@media (prefers-reduced-motion: reduce) {
  #quote-current-items tr.price-fresh-flash > td, #quote-current-items tr.quote-line-added > td { animation-timing-function: step-end; }
}
/* An old price's date under its badge: a phone has no tooltips. */
.price-fresh-when { display: none; }
@media (max-width: 700px) {
  /* A phone's narrow column: the badge on its own line under the number,
     not indented, so the column is no wider than it needs to be. */
  #quote-current-items .price-fresh-badge { display: block; width: fit-content; margin: 2px 0 0; letter-spacing: 0.2px; }
  .price-fresh-when { display: block; font-size: 10.5px; line-height: 14px; color: var(--text-dim); white-space: nowrap; }
  /* The summary on a line of its own under the heading and Check Design,
     rather than squeezed between them. */
  .quote-current-header:has(.quote-fresh:not(.hidden)) { flex-wrap: wrap; row-gap: 6px; }
  .quote-fresh { order: 3; flex: 1 0 100%; margin: 0; }
  /* Targets 44 px tall to tap (as a phone's dialog buttons are), without
     a taller line: the padding reaches over the line's own margins. */
  .quote-fresh button { padding: 14px 4px; margin: -14px -4px; }
  .quote-fresh .quote-fresh-update { margin-left: 4px; }
  .quote-table button.price-fresh-use { position: relative; z-index: 1; padding: 14.5px 6px; margin: -14.5px -6px; }
}
