/* Orders additions on top of TenderTracker's styles.css (copied as is). Tokens come from its :root. */
:root {
  --st-credit_hold-bg: var(--danger-soft);
  --st-credit_hold-ink: var(--danger);
  --st-shipping-bg: var(--ok-soft);
  --st-shipping-ink: var(--ok);
  --st-backorder-bg: var(--warn-soft);
  --st-backorder-ink: var(--warn-ink);
  --st-open-bg: var(--brand-soft);
  --st-open-ink: var(--brand-ink);
  --st-shipped-bg: var(--surface-3);
  --st-shipped-ink: var(--ink-2);
  --st-credit_note-bg: var(--surface-3);
  --st-credit_note-ink: var(--muted);
}

.status-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.st-credit_hold { background: var(--st-credit_hold-bg); color: var(--st-credit_hold-ink); }
.st-shipping { background: var(--st-shipping-bg); color: var(--st-shipping-ink); }
.st-backorder { background: var(--st-backorder-bg); color: var(--st-backorder-ink); }
.st-open { background: var(--st-open-bg); color: var(--st-open-ink); }
.st-shipped { background: var(--st-shipped-bg); color: var(--st-shipped-ink); }
.st-credit_note { background: var(--st-credit_note-bg); color: var(--st-credit_note-ink); }

.cell-clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.static { cursor: default; }

.lines-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0 4px; }
.lines-table th {
  text-align: left; font-weight: 600; color: var(--muted); padding: 6px 8px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.lines-table td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.lines-table .num, .lines-table th.align-right { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ln-product { font-weight: 600; }

.shipment { padding: 10px 0 6px; border-top: 1px solid var(--line-soft); }
.shipment:first-of-type { border-top: 0; }
.shipment-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.shipment-head span { color: var(--muted); font-size: 14px; }

.static-box { height: auto; max-height: none; }
.users-table td form { margin: 0; }

/* Descriptions wrap inside the panel's line tables; TenderTracker's .sub-line is one clipped line. */
.lines-table .sub-line { white-space: normal; overflow: visible; text-overflow: clip; }
.lines-table td:first-child { width: 100%; }
.sub-line.tone-critical { color: var(--urgent); font-weight: 600; }

/* Pricing */
.crumbs { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.section-title { margin: 28px 0 10px; font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.price-cards { display: flex; flex-wrap: wrap; gap: 12px; margin: 4px 0 16px; }
.price-card {
  flex: 1 1 200px; max-width: 280px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface, #fff);
}
.price-card.is-main { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand-soft); }
.price-card.is-flag { border-color: var(--warn-line); background: var(--warn-soft); }
.pc-label { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.pc-value { margin-top: 6px; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pc-value span { font-size: 13px; font-weight: 500; color: var(--muted); }
.pc-sub { margin-top: 4px; font-size: 13px; color: var(--muted); }
.pricing-table .sub-line { white-space: normal; }
.pricing-table td.num .sub-line { text-align: right; }
.grid-table .currency { margin-left: 2px; }
.sub-line.tone-soon { color: var(--warn-ink); }
.sp-muted { color: var(--muted); }

.settings-form { display: grid; gap: 16px; max-width: 560px; margin-bottom: 8px; }
.settings-form label { display: grid; gap: 6px; font-weight: 600; }
.input-suffix { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--muted); }
.input-suffix input { width: 110px; }
.settings-form .hint { font-weight: 400; font-size: 13px; color: var(--muted); }
.inline-form { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); }
.inline-form input[type="text"] { width: 72px; height: 32px; padding: 0 8px; }
.margins-table td { padding-top: 8px; padding-bottom: 8px; vertical-align: middle; }
.margins-table tr:target { background: var(--ok-soft); }

.line-prices { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; }
.line-prices strong { color: var(--ink); font-weight: 600; }

/* Orders: an active customer filter is easy to miss as a chip; spell it out above the table. */
.filter-banner {
  display: flex; gap: 12px; align-items: center; margin: 0 0 10px;
  padding: 8px 12px; border-radius: 8px; font-size: 14px;
  background: var(--warn-soft); color: var(--warn-ink); border: 1px solid var(--warn-line);
}
.filter-banner a { font-weight: 600; }

/* --- First-open layout (v5) --------------------------------------------------------------------------- */
.dim { color: var(--muted); font-weight: 400; }
.link-btn { padding: 0; border: 0; background: none; color: var(--brand-ink); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* Summary tiles: what needs attention, one click to filter. */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 0 0 16px; }
.tile {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none;
}
.tile:hover { border-color: var(--line-hover); background: var(--hover); text-decoration: none; }
.tile-count { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile-label { font-size: 13px; color: var(--muted); }
.tile-critical .tile-count { color: var(--urgent); }
.tile-soon .tile-count { color: var(--soon); }
.tile-ok .tile-count { color: var(--ok); }
.tile-none .tile-count { color: var(--ink-2); }
.tile.is-zero .tile-count { color: var(--faint); }
.tile.is-on { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); background: var(--brand-softer); }

/* The search box leads the filter bar. */
.search-main .search-box { width: 460px; }

/* One line per order. */
.orders-table td { padding-top: 10px; padding-bottom: 10px; white-space: nowrap; text-overflow: ellipsis; }
.orders-table .close-in { color: inherit; font-size: 13px; }
.orders-table td .chip { margin-left: 4px; }

/* Grouped by customer: header rows open and close their orders (orders.js). */
.group-tools { margin: 0 0 8px; font-size: 13px; }
.grp .match-row { display: none; }
.grp.is-open .match-row { display: table-row; }
.grp .match-row td:first-child { padding-left: 34px; }
.grp-head td { padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); cursor: pointer; white-space: nowrap; }
.grp-head:hover td { background: var(--hover); }
.grp-toggle { padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; }
.grp-toggle .chev { display: inline-block; width: 14px; color: var(--muted); transition: transform 0.12s; }
.grp.is-open .grp-toggle .chev { transform: rotate(90deg); }
.grp-head .dim { margin-left: 6px; font-size: 13px; }
.grp-facts { margin-left: 14px; font-size: 13px; }
.grp-facts > span + span::before { content: "·"; margin: 0 6px; color: var(--faint); }
.grp-facts .tone-critical { font-weight: 600; }
.grp-only { float: right; font-size: 13px; }

/* Page head with the view switches on the right. */
.home-head.with-tools { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.head-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; padding-top: 6px; }
.head-tools .seg { text-decoration: none; }

/* Price vs suggestion: one chip. */
.vs-chip {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  white-space: nowrap; vertical-align: 1px;
}
.vs-chip.is-below { background: var(--danger-soft); color: var(--danger); }
.vs-chip.is-above { background: var(--ok-soft); color: var(--ok); }
.vs-chip.is-at { background: var(--surface-3); color: var(--ink-2); }
.vs-chip.is-warn { background: var(--warn-soft); color: var(--warn-ink); }
.pricing-table td.num .sub-line { text-align: right; white-space: nowrap; }
.pricing-table td.num .sub-line .dim { margin-left: 4px; }

/* Quote lookup. */
.quote-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin: 4px 0 16px; }
.qf-field { display: grid; gap: 4px; flex: 1 1 320px; max-width: 460px; font-size: 13px; font-weight: 600; color: var(--muted); }
.qf-field input { height: 42px; padding: 0 12px; font-size: 15px; }
.pick-list { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; margin: -4px 0 16px; font-size: 14px; }
.pick-list p { margin: 0; width: 100%; color: var(--muted); }
.quote-card {
  display: grid; grid-template-columns: minmax(260px, 1fr) 2fr; gap: 8px 32px; max-width: 1100px;
  padding: 20px 22px; margin: 0 0 20px; border: 1px solid var(--brand); border-radius: 14px;
  background: var(--surface); box-shadow: 0 0 0 1px var(--brand-soft);
}
.qc-value { margin-top: 6px; font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; }
.qc-value span { font-size: 15px; font-weight: 500; color: var(--muted); }
.qc-facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 16px; margin: 4px 0 0; align-content: start; }
.qc-facts dt { color: var(--muted); font-size: 14px; }
.qc-facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.qc-facts .dim { margin-left: 6px; font-size: 13px; }
.qc-links { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 20px; padding-top: 12px; border-top: 1px solid var(--line-soft); font-size: 14px; }

/* "Needs attention" lists under the lookup. */
.attention { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin-top: 8px; }
.att-card { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.att-card h2 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.att-card h2 .badge { margin-left: 4px; }
.att-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 6px;
  margin: 0 -6px; border-top: 1px solid var(--line-soft); color: var(--ink); text-decoration: none; border-radius: 6px;
}
.att-row:hover { background: var(--hover); text-decoration: none; }
.att-main { display: grid; min-width: 0; font-weight: 600; font-size: 14px; }
.att-main .dim { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-side { display: flex; gap: 8px; align-items: center; font-size: 13px; white-space: nowrap; color: var(--ink-2); }
.att-more { margin: 8px 0 0; font-size: 13px; color: var(--muted); }

/* Pricing side panels are wider: their tables have five columns. */
.side-panel:has(.sp-wide) { width: 900px; }
.sp-desc { margin-top: 4px; color: var(--muted); font-size: 13px; }
.side-panel .price-card { flex-basis: 160px; }
.head-tools .seg, .seg-group .seg { white-space: nowrap; }
.pricing-table .sub-line.cell-clip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Price check (v7): one answer card. */
.quote-card { grid-template-columns: minmax(280px, 1fr) 1.4fr; max-width: 980px; }
.qc-head { grid-column: 1 / -1; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); font-size: 15px; }
.qc-head .dim { margin-left: 6px; font-size: 13px; }
.qc-reason { margin-top: 6px; font-size: 14px; color: var(--ink-2); }
.qc-hint { grid-column: 1 / -1; margin: 0; padding-top: 12px; border-top: 1px solid var(--line-soft); font-size: 14px; color: var(--muted); }
.qc-facts .cost-row { padding-top: 8px; border-top: 1px dashed var(--line); }
.qc-facts dd.cost-row { margin-top: 0; }
.section-title .dim { text-transform: none; letter-spacing: 0; font-weight: 400; }
.line-prices { display: flex; flex-wrap: wrap; gap: 4px 14px; }

/* Price check, empty page: recent checks and how the price is picked. */
.recent-list { display: grid; max-width: 980px; margin: 0 0 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.recent-row { display: grid; grid-template-columns: 1fr auto 16px; align-items: center; gap: 16px; padding: 11px 16px; border-top: 1px solid var(--line-soft); color: var(--ink); text-decoration: none; }
.recent-row:first-child { border-top: 0; }
.recent-row:hover { background: var(--hover); text-decoration: none; }
.rr-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.rr-main .dim { margin-left: 8px; font-size: 13px; }
.rr-price { font-variant-numeric: tabular-nums; white-space: nowrap; }
.rr-go { color: var(--muted); }
.how-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 980px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.how-steps li { position: relative; display: grid; align-content: start; gap: 4px; padding: 14px 16px 14px 48px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); counter-increment: step; font-size: 14px; }
.how-steps li::before { content: counter(step); position: absolute; left: 16px; top: 13px; width: 22px; height: 22px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 13px; text-align: center; line-height: 22px; }
.how-steps span { color: var(--muted); font-size: 13px; }
@media (max-width: 720px) { .how-steps { grid-template-columns: 1fr; } }
